Skip to content
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

Fix the cIGZSystemService definitions #6

Merged
merged 2 commits into from
Feb 2, 2024

Conversation

0xC0000054
Copy link
Collaborator

OnTick and OnIdle take a single integer parameter, which appears to be
some kind of incrementing counter.
The cIGZSystemService header was also missing the GetServiceTickPriority method, which
was causing it to crash when calling AddToTick.

Fixed the OnTick and OnIdle method signatures in various headers.

OnTick and OnIdle take a single integer parameter, which appears to be
some kind of incrementing counter. Not sure what the value is used for,
providing callers an easy way to track the time elapsed between calls?

The header was also missing the GetServiceTickPriority method, which
was causing it to crash when calling AddToTick.
@nsgomez
Copy link
Owner

nsgomez commented Feb 2, 2024

@0xC0000054 thanks for the PRs! I think the parameter is supposed to be the total number of tick and idle frames that have elapsed since the game started. At least that's what I've been able to deduce from reverse-engineering in https://github.com/nsgomez/scion

Declaration I used there: https://github.com/nsgomez/scion/blob/main/src/framework/include/cIGZSystemService.h

Usage: https://github.com/nsgomez/scion/blob/f0608f01e058b2e97e7d94225f02047d84573a8d/src/framework/src/cGZFramework.cpp#L490

@nsgomez nsgomez merged commit 6112e4b into nsgomez:master Feb 2, 2024
@0xC0000054 0xC0000054 deleted the fix-system-service branch February 2, 2024 09:39
@0xC0000054
Copy link
Collaborator Author

That makes sense. How is scion supposed to be used for reverse engineering?

I see that it uses a version of STLPORT, are scion's collection types (std::list, etc.) binary compatible with SC4?
As I mentioned in #8, the EASTL vector type is binary compatible with SC4 but its list type is not.

@nsgomez
Copy link
Owner

nsgomez commented Feb 2, 2024

Scion is a bottom-up reverse engineering of the GZ/RZ game framework, including source code. gzcom-dll is more top-down, starting with SimCity 4's game-specific bits and working down, and mostly focuses on declaring interfaces instead of reversing the source wholesale. You could smush them together by replacing gzcom-dll's GZCOM declarations with the ones from Scion.

And yeah, SimCity 4 (on Windows) uses STLPORT instead of EASTL or the compiler-provided STL. If you inspect SimCity 4.exe in a PE viewer, there's a program section referencing it:

image

So you should have better luck using that instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants