Skip to content

Conversation

@xezon
Copy link

@xezon xezon commented Aug 15, 2025

This change is an alternative to #1444 and attempts to fix the Special Power ready state during construction. To do that, it postpones the Special Power initialization until the construction is signaled done.

TODO

  • Have Mauller test this
  • Replicate in Generals

@xezon xezon requested a review from Mauller August 15, 2025 20:01
@xezon xezon added Major Severity: Minor < Major < Critical < Blocker ThisProject The issue was introduced by this project, or this task is specific to this project NoRetail This fix or change is not applicable with Retail game compatibility labels Aug 15, 2025
@xezon
Copy link
Author

xezon commented Aug 15, 2025

I tested this on local player and AI Player and Special Powers worked correctly.

@Mauller please check if this solves all the issues that you have seen.

@xezon xezon force-pushed the xezon/fix-special-power-update-under-construction branch from 20617ca to 060b423 Compare August 15, 2025 20:04
@xezon xezon added the Bug Something is not working right, typically is user facing label Aug 20, 2025
DEBUG_ASSERTCRASH(m_availableOnFrame == UINT_MAX,
("Unexpected state. Function must be called only after OBJECT_STATUS_UNDER_CONSTRUCTION was completed"));

m_availableOnFrame = 0;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be m_availableOnFrame = TheGameLogic->getFrame(); ?

Copy link
Author

@xezon xezon Oct 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has been a long time and I do not remember if this was intentional. I tend to believe it was intentionally 0. We can try TheGameLogic->getFrame() and see if that works.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using zero or the current frame at this point should work either way, when init is called it will call initCountdown(); which will set m_availableOnFrame into the future where it needs to be for the countdown to work.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main thing to prevent the bugged behaviour is making sure that the m_availableOnFrame is set into the far future while a building is still under construciton or a unit is not ready yet etc.

This then prevents the exploit that can crash the game.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it not be enough to just return false with initiateIntentToDoSpecialPower?

@Skyaero42
Copy link

It crashes the game for me (RETAIL_COMPATIBLE_CRC = 0

image

@xezon
Copy link
Author

xezon commented Oct 11, 2025

Well that is not good. What do you do?

@Skyaero42
Copy link

So I build 1 complete nuke and 1 scaffold nuke, group them in the same team. Then use a hotkey (like F).

  • In retail it then shows the red nuke outline. When pressing left button, nothing happens
  • In non-retail, it also shows the red nuke outline. When pressing the left button, the game crashes.

So what I have been doing is not exactly the exploit, but something is still not right

@xezon xezon force-pushed the xezon/fix-special-power-update-under-construction branch from 060b423 to 6e3da22 Compare October 12, 2025 11:36
@xezon
Copy link
Author

xezon commented Oct 12, 2025

I do not understand how you are doing this. I cannot add 2 buildings to the same team.

I have made additional changes that hopefully fix it while keeping retail compatibility.

@Skyaero42
Copy link

Skyaero42 commented Oct 12, 2025

It doesn't crash anymore, but now I can launch a nuke from a scaffold.

To be able to group buildings, you need to comment out line 1200 and 1217 in SelectionXlat.cpp, as grouping of buildings is not allowed since #1347. - And yes, that does make it a lot harder to crash/exploit the game with the bug(s) that this PR is trying to resolve.

Alternatively, here is a replay with pre-grouped buildings. Press 1, click on the fire nuke icon (even when it is not finished) and fire the nuke from scaffold.

00000077.zip

@xezon
Copy link
Author

xezon commented Nov 8, 2025

I am unable to shoot the missile when 2 silos are selected.

I tested with
RETAIL_COMPATIBLE_BUG 0
RETAIL_COMPATIBLE_CRC 0
RETAIL_COMPATIBLE_XFER_SAVE 0

I need a video or step by step guide.

@xezon xezon force-pushed the xezon/fix-special-power-update-under-construction branch from 6e3da22 to 9351133 Compare November 8, 2025 11:56
@xezon xezon requested a review from Skyaero42 November 8, 2025 13:30
@xezon
Copy link
Author

xezon commented Nov 8, 2025

I have applied more changes, but have lost track of what is going on with RETAIL_COMPATIBLE_CRC.

Things look ok with RETAIL_COMPATIBLE_CRC 0, but I could be wrong.

Code is very messy as usual, which makes it cumbersome.

@Skyaero42
Copy link

Skyaero42 commented Nov 8, 2025

With retail compatibility on and off, I can still do this:

2025-11-08.19-36-48.mp4

You cannot manually group buildings as we fixed that bug. However with cheat engines there are still ways around it, or just disable the code that prevents it. To help out, I already created a replay that has the buildings grouped.

Steps:

  1. Download this replay: https://github.com/user-attachments/files/22874036/00000077.zip
  2. Press 1 to select the scaffold and build nuke together
  3. click the fire nuke icon (it is not ready, you can click it anyways)
    (in the video at around 0:15 there is an assert firing, hence the freeze)
    4 click anywhere.

@xezon
Copy link
Author

xezon commented Nov 9, 2025

I cannot reproduce this bug. When pressing 1, the Control Bar does not show this button.

I also tested with Control Bar Pro 1.2. Can you reproduce it with unmodified game data?

shot_20251109_104339_1

@xezon xezon force-pushed the xezon/fix-special-power-update-under-construction branch from 60b7d98 to b80c622 Compare November 9, 2025 09:46
@xezon
Copy link
Author

xezon commented Nov 9, 2025

Rebased on main.

@Skyaero42
Copy link

I cannot reproduce this bug. When pressing 1, the Control Bar does not show this button.

I also tested with Control Bar Pro 1.2. Can you reproduce it with unmodified game data?

I've reinstalled the game from Steam, removed all the Genpatcher stuff and I can still do what I showed in the video.
May investigate later on my end figuring out whats going on.

@xezon
Copy link
Author

xezon commented Nov 9, 2025

Ok I wonder where this behavior difference comes from.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something is not working right, typically is user facing Major Severity: Minor < Major < Critical < Blocker NoRetail This fix or change is not applicable with Retail game compatibility ThisProject The issue was introduced by this project, or this task is specific to this project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants