game-builder-garage-editor
game-builder-garage-editor copied to clipboard
Edited games cannot be uploaded
Edited game files load fine when opening them normally, however when trying to upload them to the online gallery, the game will tell you the data is corrupted. Copying or editing the file in the game (in an attempt to get it to fix the file itself) doesn't make a difference. This limits the usefulness of this save editor quite a lot.
I think this is likely due to a hash somewhere in the savedata not matching the game file after it's been edited. I've located what appears to be a file hash list, but need to figure out how these hashes are generated to be able to check if this is the culprit.
Reference save file (no levels here are edited): savedata.zip
The relevant files are
-
LgcTpb.bin
- Table of game files, this contains some kind of hash for each file -
LgcTpbFile_MyGame[ ].bin
- Game files, these don't contain a hash - Other files are unknown / likely irrelevant
LgcTpb.bin
contains an array of hashes with the key 343f7f9b
(mValueHashCache[].u32
), which is an uint32 array containing an element for each game file.
The hashes in the reference save's LgcTpb.bin are:
0x3cc5177a, 0xf88aea9a, 0xcd8c72b1, 0xc4690251, 0xe76f4b06, 0xf35ee1b1, 0xdd6bdd3b, 0x1b893be3
Reverse engineering notes:
- I've already tried checking if these are the crc32 of the file data -- they're not
- Function at
71008cd050
handles parsingLgcTpb.bin
- Function at
71008ce0c0
handles looping through all themValueHashCache[].u32
array elements inLgcTpb.bin
- Function at
71007a3080
seems to handle adding keys to the game file (or something else?) for upload, including a key calledmValueHash
I reverse engineered the mValueHashCache
a bit. It is a crc32 hash, but not of the whole file. Instead, you must take only the values that are defined in the game file, in the order in which they are defined in the parameter classes in the code.
I believe that the first value mVersion.u32
, so the buffer over which the hash is calculated should start with these 32 bits. Then add the other fields.
@kinnay thanks for checking! Unfortunately I still haven't managed to get a matching result even though I've followed the order pretty carefully, I must be missing something
Current code is here: https://github.com/jaames/game-builder-garage-editor/blob/main/src/formats/GameFile/GameFileHasher.ts
@jaames I wonder if you can tell me something about the savedata or its data struct? I am puzzled about how GameBuilder export the game, as a program script like scratch and blockly? or it is a process json that run with some module like blueprint?
@kimyLee it uses Nintendo's binary yaml format (https://zeldamods.org/wiki/BYML), after unpacking it the structure for a game file looks like this: https://github.com/jaames/game-builder-garage-editor/blob/main/notes/LgcTpbFile_MyGame%5Bx%5D.bin
Any updates or similar projects anywhere? Would love to be able to use :)
Any updates or similar projects anywhere? Would love to be able to use :)
@ThePsycrow I'm not aware of any other save editors for Game Builder Garage, no. I couldn't get past this issue and I've since lost interest in this game and have become busy with other things, so I'm afraid there likely won't be any further development, sorry.
Any updates or similar projects anywhere? Would love to be able to use :)
@ThePsycrow I'm not aware of any other save editors for Game Builder Garage, no. I couldn't get past this issue and I've since lost interest in this game and have become busy with other things, so I'm afraid there likely won't be any further development, sorry.
Sorry to hear that! BTW I noticed previously that, browsing the Switch's save data on the SD card, there were two folders for GBG, and one of them just had the three files "Lab.bin", "LgcTpb.bin", and "Tpb.bin" whereas the other one had all three of those along with the actual saved games. One time when I used JKSV to replace save files, there was a mismatch between those between the two folders and I couldn't upload, until I made them match in both folders. (I think I took old copies which were in the folder that just had those three files, and put them into the one which had all the ones including the saved games too.) I know that using JKSV only replaces them in that latter folder, so I don't know if that's relevant or not to why it was having the issue, but just thought I'd mention as a clue in case you ever start looking into it again!