Skip to content

[GEN][ZH] Fix wrong class member set to INVALID_DRAWABLE_ID in ParticleUplinkCannonUpdate::createGroundToOrbitLaser() #729

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 28, 2025

Conversation

Mauller
Copy link

@Mauller Mauller commented Apr 20, 2025

This fix was originally discovered by @helmutbuhler and split out of the original PR it was contained in.

Within createGroundToOrbitLaser the wrong ID variable was being set to invalid once the beam had been destroyed.
This corrects that by setting the ID on the correct variable.

@Mauller Mauller self-assigned this Apr 20, 2025
@Mauller Mauller added Minor Severity: Minor < Major < Critical < Blocker Generals Related Generals only ZeroHour Relates to Zero Hour GameMismatchWith104Maybe Maybe affects game state towards original 1.04 Stability Concerns stability of the runtime Bug Something is not working right labels Apr 20, 2025
Copy link

@feliwir feliwir left a comment

Choose a reason for hiding this comment

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

Looks good to me. Please add @helmutbuhler as Co-Author when squash-merging

@xezon
Copy link

xezon commented Apr 21, 2025

This change has game mismatch maybe label. Does it need testing?

@Mauller
Copy link
Author

Mauller commented Apr 21, 2025

This change has game mismatch maybe label. Does it need testing?

Yeah the ones i labeled with possible mistmatch need a quick test to check they don't break compat. I will need to rebase them all once we confirm that the hashmap reversion fixes AI based replays.

@xezon
Copy link

xezon commented Apr 23, 2025

Hash map change is reverted, so this can be tested now.

@Mauller Mauller force-pushed the fix-particle-cannon-id branch from 4e3cc83 to 750c552 Compare April 23, 2025 06:35
@Mauller
Copy link
Author

Mauller commented Apr 23, 2025

Hash map change is reverted, so this can be tested now.

Rebased with main and pushed so it is ready for testing.

@sorcerer86pt
Copy link

played golden replay on this one.

vc6 no mismatch all worked until the end.
win32 as expected, immediate mismatch message

@Mauller Mauller force-pushed the fix-particle-cannon-id branch from 750c552 to 05eec1d Compare April 26, 2025 07:11
…instead of m_groundToOrbitBeamID

Co-authored-by: Helmut Buhler <buhler@8gadgetpack.net>
@Mauller Mauller force-pushed the fix-particle-cannon-id branch from 05eec1d to e0c4fc9 Compare April 27, 2025 06:28
@Mauller
Copy link
Author

Mauller commented Apr 27, 2025

Tweaked to cleanup comment and ready to go.

@xezon
Copy link

xezon commented Apr 27, 2025

Did you find out if this changes any retail behavior?

@Mauller
Copy link
Author

Mauller commented Apr 27, 2025

Did you find out if this changes any retail behavior?

Not just yet, was checking the stealth one.

@Mauller
Copy link
Author

Mauller commented Apr 27, 2025

Just testing and between this fix and retail there does not appear to be any visual difference or behaviour difference.

@xezon
Copy link

xezon commented Apr 27, 2025

I eyeballed the particle effects and did not observe a visual difference.

Does this change fix any memory leaks?

@Mauller
Copy link
Author

Mauller commented Apr 27, 2025

I eyeballed the particle effects and did not observe a visual difference.

Does this change fix any memory leaks?

Looks like there is a chance that a memory leak could occur if an orbit to ground particle beam already exists.
Under normal conditions the code appears to create a new beam each time it is used and rarely goes into the first block of code where the incorrect value was being set.

The first block appears to be there to destroy the existing beam. So i guess if the beam was interrupted and started again it would cleanup in that block then make a new one in the consecutive code.

@Mauller
Copy link
Author

Mauller commented Apr 28, 2025

I could not get the game to fall into the block where the cleanup code for a current beam was setting the invalid drawable ID on the wrong drawable.

I tried powering down the particle beam uplink with a microwave tank while it was firing, but even once it lost power it continued to fire till the end of the normal firing cycle.

Sold power stations as well and it continued firing after losing power and never fell into that block.

So i think there is little chance that this will have an issue with retail. Since the game always creates a new particle beam when firing, i think retail will just end up with some small memory leak if the obscure situation occurs that hits the relevant code.

@Mauller Mauller removed the GameMismatchWith104Maybe Maybe affects game state towards original 1.04 label Apr 28, 2025
@xezon
Copy link

xezon commented Apr 28, 2025

I put a breakpoint on this code and it never hits when shooting with the Particle Cannon. This indicates that it is a theoretical issue only. As far as I can tell this fixes no retail bug.

@xezon xezon added Fix Is fixing something and removed Bug Something is not working right Stability Concerns stability of the runtime labels Apr 28, 2025
@xezon xezon changed the title [GEN][ZH] Fix invalid drawable ID being set on m_orbitToTargetBeamID instead of m_groundToOrbitBeamID [GEN][ZH] Fix wrong class member set to INVALID_DRAWABLE_ID in ParticleUplinkCannonUpdate::createGroundToOrbitLaser() Apr 28, 2025
@xezon
Copy link

xezon commented Apr 28, 2025

Improved the title a bit.

@xezon xezon merged commit bea27c1 into TheSuperHackers:main Apr 28, 2025
19 checks passed
@xezon xezon deleted the fix-particle-cannon-id branch April 28, 2025 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fix Is fixing something Generals Related Generals only Minor Severity: Minor < Major < Critical < Blocker ZeroHour Relates to Zero Hour
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants