Skip to content

Load the race fish whose names outgrow the fish's field - #216

Open
nicoNaeg wants to merge 1 commit into
TheMoonPeople:masterfrom
nicoNaeg:fix/race-fish-long-names
Open

nicoNaeg wants to merge 1 commit into
TheMoonPeople:masterfrom
nicoNaeg:fix/race-fish-long-names

Conversation

@nicoNaeg

@nicoNaeg nicoNaeg commented Nov 22, 2026 •

Copy link
Copy Markdown

Summary

Finny Frenzy crashes before the first heat when the game is in French, German or Spanish (#215). The rival fish now load, so the race no longer reads a null fish.

  • In Game crashs when i try to do the Finny Frenzy #215's log, rfd2.cfg.json: name is longer than the game holds comes just before the crash in sgInitGyoRace.
  • English and Italian are not affected by this crash: none of their names is too long.
  • A few rival names are shortened to fit the fish's name field (see "Not covered").

Part of #215. The race also needs #177, which ports sgLoopGyoRace. The reporter's second log, in English, gets past sgInitGyoRace and stops in that stub (gyorace.cpp:1426). With this change alone, French, German and Spanish get as far.

Cause

  1. The names. The race fish documents (gameplay/sg/gyo/rfd<language>.cfg.json) spell PAL accents as 9-byte tags, as the game's text does. "Télégraham" is T[UNI00e9]l[UNI00e9]graham, 26 bytes. BREEDFISH_USED::name holds 20 bytes and a terminator.
  2. The loader. ParseRaceFish (port/src/object/menu/menuaqua.cpp) refused any name longer than that field, and one refused name refused the whole document. CGyoraceFishData::LoadData then left every race class empty.
  3. The crash. sgInitGyoRace (gyorace.cpp:568) copies each racer's name. A rival slot held a null fish, hence the report's EXCEPTION_ACCESS_VIOLATION reading 0x10.

Names longer than the field in the PAL data, 216 per document:

Document Language Over 20 bytes 0x20 bytes or more
rfd0 Japanese (CP932) 0 0
rfd1 English 0 0
rfd2 French 4 0
rfd3 German 3 0
rfd4 Italian 0 0
rfd5 Spanish 11 0
rfd6 Language 6, debug menu only (Hangul names) 182 49

Retail's _GYORACE_DATA hands every name to SetName, which takes anything under 0x20 bytes.

Change

  • The loader. ParseRaceFish reads the name without a length limit and lets SetName decide, as retail's loader did. A name of 0x20 bytes or more leaves the fish's species name (49 names, all in rfd6); any other is stored.
  • The cut. CGameDataUsed::SetName (port/src/platform/userdata.cpp) already cut a long name to the field. It now cuts before a bracketed tag that the field would split:
    • "Tortan muscl[UNI00e9]" used to become "Tortan muscl[UNI00e9", which the font prints as text. It is now "Tortan muscl".
    • Brackets count only at character starts, since a Shift-JIS trail byte can be 0x5B or 0x5D.
    • Renames go through the same code.
  • Tests.
    • NativeRecords.RaceFishNamesLongerThanTheFieldStillLoad (port/src/tests/native_records_test.cpp) loads a French document with two such names.
    • ItemNames.FishRenameKeepsAccentTagsWhole (port/src/tests/memory_safety_test.cpp) checks both cuts, and a Shift-JIS name whose trail bytes are 0x5B.

Testing

Environment: macOS 26.6.2 arm64 (M4 Pro), Homebrew LLVM 23.1.6, MoltenVK 1.4.2, preset macos-arm64 (Debug).

Check Without change With change
NativeRecords.RaceFishNamesLongerThanTheFieldStillLoad FAIL: "longer than the game holds" logged, no fish loaded PASS
ItemNames.FishRenameKeepsAccentTagsWhole FAIL: "Tortan muscl[UNI00e9" PASS
The seven PAL rfd documents through LoadData and SetName (a local test, not committed) All load: 4 classes of 54 fish, no null fish. No stored name ends inside a tag
ItemNames.*, NativeRecords.RaceFish* 6/6 PASS
Full ctest, Debug 2755/2760 pass. Two timeouts under -j6 pass when rerun: GfxGpuRenderThread.LockstepRecordingStaysOnTheCaller, and NativeCharacterRetail.LoadsConvertedC01ProfileAndEvaluatesItsNativeMotion, which timed out once more alone right after the rebuild, then passed three times in 1.6 s of its 5 s. The 3 failures fail on master too: PcSettingsReplay.pad (KeyError: 'present_mode'), and the Kazarov renderer tests GfxMisc.MeshBoundsFollowTheFlagAndAreInvalidatedByUpdates and GfxGpuMeshDc2.FragmentInvocationQueriesPreservePixelsAndWindowOwnership

Not covered

  • In game. The race was not run in French here. --jump starts in English, and there is no French save near the race. The loader test and the report's stack cover the crash path. Without Port the retail fish race loop #177 the race cannot be run past its first frame in any language.
  • Shortened names. A name longer than the field loses its end, at a whole character.
    • French: "Agnès la joi", "Supermâchoti", "Tortan muscl", and "Télé" for "Télégraham".
    • 3 German and 11 Spanish names are shortened the same way, and 133 in rfd6.
    • From retail's code, retail copied such a name over the fields after it, then wrote kind and size over part of it. A 21-byte name showed whole; a longer one showed stray bytes.
    • Showing every name whole would need the race to take its names from the document, since RaceInfo holds 0x18 bytes per name.

Finny Frenzy crashed before the first heat in French, German, Spanish
and Korean (TheMoonPeople#215). The race fish documents spell PAL accents as 9-byte
tags such as [UNI00e9], so some names run past the 20 bytes that
BREEDFISH_USED::name holds: "T[UNI00e9]l[UNI00e9]graham" is 26.
ParseRaceFish refused such a name, which refused the language's whole
rfd document. No rival fish loaded, and sgInitGyoRace read the name of
a null fish.

Retail's SetName takes any name under 0x20 bytes, so read the name
without a limit and let SetName decide, as retail's loader did. SetName
already cuts a long name to the field; it now cuts before a bracketed
tag the field would split, which the font would print as text. Brackets
count only at character starts, since a Shift-JIS trail byte can be one.

NativeRecords.RaceFishNamesLongerThanTheFieldStillLoad and
ItemNames.FishRenameKeepsAccentTagsWhole cover the two parts.
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.

1 participant