Repository navigation
Refactor: Read the last game folder offsets as members - #7652
Merged
Merged
Conversation
Collaborator
|
Merged, thank you! Checked with #7651: all MATCH, shipped MD5 in both place.py modes. On the two mismatches you found ( |
This branch is waiting to be deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #7078
Model: Ares / claude-opus-5
Rewrites the last 5 counted byte-offset accesses in
src/game, taking the folder to 0 and the repo count from 55 to 50.LoadRadarPic): the 0x40-byte block it reads was achar header[0x40]read with offset casts. It is nowRadarPicHeader, withmapWTiles(+0x4),mapHTiles(+0x8),pixelOffset(+0x28) andhasPixels(+0x2c), so the casts are member reads and the comment no longer has to quote offsets.UpdatePlayers):u = (Unit*)((char*)u + 0x118)becomesu++. The file forward-declaredstruct Unitonly, so the stride had to be spelled; including../units/unit.hmakesUnitcomplete and the pointer arithmetic says what it means. The forward declaration goes with it.AiSearchGoal::DrawOnSurface):ownerwas achar*and the call read(short*)(this->owner + 0x76)and*(int*)(this->owner + 0x7e).owneris nowUnit*and the file gets aUnitview withcell(+0x76) andfootprint(+0x7e), bothPoint16exactly asunits/unit.hdeclares them, so the call reads(short*)&this->owner->celland*(int*)&this->owner->footprint. The cast on the second stays because the call passes the pair packed into one int.The names come from
data/thaldren/functions.csv: Thaldren hasMap_LoadRadarPic(char * pszMapPath, int * pOutMapWTiles, int * pOutMapHTiles), which is this function, and its two output parameters are the +0x4 and +0x8 dwords.pixelOffsetandhasPixelsare named from their use: the code seeks to the first and tests bit 0 of the second before reading any pixels.cellandfootprintareunits/unit.hs own names for +0x76 and +0x7e.Checks: checkall 127 of 127 MATCH (every function in
data_files.cpp,players_464290.cppandconsole_commands.cpp); place.py MD5 8e74a1dffa1f5988624c52048f5b20cd, with and without--no-orig --strict; modules.py --check passes; cleanup_progress.py byte-offset count 55 to 50Left out:
*(int*)(c + 0x142e9)and*(int*)(c + 0x142ed)in 0x424720 (radar.cpp).cis aCell*and those reach a game-level structure 0x142e9 bytes past it. Nothing insrc/names that structure or that pair of fields, so there is no member to write, and inventing a type that far off aCell*would read worse than the cast.Two #7244-pattern mismatches I found and did not touch, since fixing either is a rename rather than an offset rewrite:
src/sound/sound.cpp:217declaresint __stdcall IsUnitVisible(Unit* unit)and calls it at 593 and 601, whilesrc/ingame/selection.cpp:176definesint __stdcall IsUnitVisible(char* unit). Only thechar*form (?IsUnitVisible@@YGHPAD) appears anywhere indata/, so sound.cpp emits a reference to a decorated name the project never records.src/game/console_commands.cpp:372declaresDrawMapTileSelectionOutline(void*, short*, int)andsrc/ingame/info_panel.cpp:1066defines it as(void*, Size_0046b9d0*, int), which is the only spelling indata/.Size_0046b9d0is declared insideinfo_panel.cppwith no header, so the caller cannot name it today.Suspected original bugs:
*pWTiles = pic.mapWTiles - 1and*pHTiles = pic.mapHTiles - 1, so the header stores a count one larger than the value the caller gets; that is consistent with a 1-based tile count and I left it.