Skip to content

Reimplement tick orchestration and document game-loop ownership - #226

Open
Krarilotus wants to merge 4 commits into
sourcehold:mainfrom
Krarilotus:reimplement/game-tick-orchestration
Open

Krarilotus wants to merge 4 commits into
sourcehold:mainfrom
Krarilotus:reimplement/game-tick-orchestration

Conversation

@Krarilotus

@Krarilotus Krarilotus commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

TL;DR: Reconstruct the tick coordinator while preserving native pause and update order.

A call to the tick coordinator is not always a completed simulation step; paused maintenance and synchronization can take different paths.

Changes: Implement GameStateStructures::processGameTick at 0x45CD10 with existing resolvers. Add a short game-loop reference and the soft status entry.

Review / testing: DLL build passed. Structural comparison resolves the 54 helper targets and finds one unused ECX setup difference; linked raw reccmp remains 35.98% and soft status is 99.0%. Those are different measures, not a claim of identical DLL bytes. No live deployment was reported.

Comment on lines +95 to +109
if (MACRO_CALL_MEMBER(GameCore_Func::getAreWeInAInGameMenu, DAT_GameCore::ptr)()) {
if (DAT_GameCore::instance.gamePausedLogical != 0
&& static_cast<int>(DAT_TileMapState::instance.DAT_FutureMapOrientation) >= 8) {
goto maintenance;
}
if (!MACRO_CALL_MEMBER(GameCore_Func::isGameHaltingMenuOpen, DAT_GameCore::ptr)()) {
MACRO_CALL_MEMBER(Random::RNG_Func::nextRandomNumber2, SEC_RNG::ptr)();
MACRO_CALL_MEMBER(Random::RNG_Func::nextRandomNumber1, SEC_RNG::ptr)();
++DAT_GameCore::instance.mapTimeInTicks;
MACRO_CALL_MEMBER(Game::GameStateStructures_Func::processSingleTimeTick, DAT_GameState::ptr)();
}
}
if (static_cast<int>(DAT_TileMapState::instance.DAT_FutureMapOrientation) < 8) {
DAT_RotateMapOrPullDownTerrain::instance = 1;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is the remaining mismatch related to this goto?

If yes and you not have tried it, you could invert the if block and pack the following block inside.
Naturally, this would mean if static_cast<int>(DAT_TileMapState::instance.DAT_FutureMapOrientation) < 8 would be tested (since the if is inverted) and this would be false, then compiler would know that it can skip the other if-block before the jmp target and you can avoid the goto.

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