UnderminersTeam / UndertaleModTool

The most complete tool for modding, decompiling and unpacking Undertale (and other GameMaker games!)
GNU General Public License v3.0
1.19k stars 234 forks source link

TGIN chunk (GM2) #70

Closed LinXP closed 6 years ago

LinXP commented 6 years ago

I'll start collecting information on TGIN chunk. I don't know yet what he is responsible for, but I wrote the structure of this chunk. Screen: http://i.prntscr.com/XQQBuoxPRim05LpPL2i8LA.png

colinator27 commented 6 years ago

Where have you found this chunk's existence?

LinXP commented 6 years ago

@colinator27 https://store.steampowered.com/app/356650/Deaths_Gambit/ Hint: If you take a Steam game and change the SteamAppId parameter to zero, then the game will not require Steam App ps: I can unload the folder with the game and give a link, if it is not against the rules

colinator27 commented 6 years ago

Are you sure TGIN is an actual chunk, or part of something else inside a chunk? If you haven't checked, just go through each chunk and jump to the next using its length. If TGIN doesn't show up, that means it's part of something else (maybe some other IFF-like data), but if it does then I guess we have a really weird chunk that I found no evidence of anywhere else.

LinXP commented 6 years ago

@colinator27 I think it will be better to see the size of the chunks above and below http://i.prntscr.com/DvbFx_JZQy6qr_x3wwgflQ.png

I found a couple more games: Rivals of Aether http://i.prntscr.com/wgBxXIM6QC2-rJcFR45lhA.png Wandersong http://i.prntscr.com/f-Qundz1R6iSTjWOh4XThg.png

And now the most interesting: BytecodeVersion these games 17 http://i.prntscr.com/dLhnyubuS1WdQ7MGwQjgzA.png

deathsgambit397.exe in IDA: http://i.prntscr.com/_Gb-8uVuTNKPDdX3TeLqsA.png

krzys-h commented 6 years ago

Oh, bytecode 17 I see, that's new. I really wonder how did they get it, the latest GMS2 trial generates 16 afaik.

colinator27 commented 6 years ago

Hm, let me see if I have it in my latest compiler. I was analyzing 2.1.5, but I'll try 2.2 now.

colinator27 commented 6 years ago

Hm, I can't seem to find anything about it (yet) in the compiler. How recently were these games built? I recall that there is a special beta branch for GMS2 somewhere...

Yeah, I give it a good chance that it's part of the beta branch. I'll try to pick it apart once the 2.2.1 update comes out of beta.

LinXP commented 6 years ago

http://i.prntscr.com/HbLlKr0mQ3ydEro1R-SbGg.png I added a link and got access to beta

GMAssetCompiler_2.2.1.277: info http://i.prntscr.com/cyiyh0jBR-KKX_FcauNw7w.png http://i.prntscr.com/EyhvfNXnSziO89r0ZIH4Rw.png

colinator27 commented 6 years ago

Oh wow, that's a neat trick.

colinator27 commented 6 years ago

I'll assist in collecting some information as well then. I know a lot of the compiler's structure already.

colinator27 commented 6 years ago

So, I'm getting a good amount of progress. This seems to relate to the new functions they added for texture groups, and I think TGIN stands for "texture group info".

colinator27 commented 6 years ago

Alright, so this has a pretty simple format. Here's what I got, and it works with the research LinXP did as well:

TGIN structure - likely stands for Texture Group Info
Chunk introduced in 2.2.1 with new texture functions
---

Int32 - unknown always 1

PointerList<T> structure (this is almost but not quite a ListChunk because of the 1 above). Each item represents a texture group:
    32-bit string pointer - Name
    32-bit pointer #1
    32-bit pointer #2
    32-bit pointer #3
    32-bit pointer #4
    32-bit pointer #5

    #1 leads here:
    SimpleList<int> of texture page IDs the group has

    #2 leads here:
    SimpleList<int> of sprite IDs the group has

    #3 leads here:
    SimpleList<int> of Spine sprite IDs (normal sprite ID, just this has Spine sprites separated) the group has

    #4 leads here:
    SimpleList<int> of font IDs the group has

    #5 leads here:
    SimpleList<int> of tileset IDs the group has
colinator27 commented 6 years ago

Also, I just realized the implementation for this should still be a ListChunk, but how EMBI does it. I'll try implementing it really quickly.

colinator27 commented 6 years ago

Support should be added in #76.

krzys-h commented 6 years ago

The "1" is probably just a version number, they realized with new chunks that something like this would be useful

colinator27 commented 6 years ago

Oh, yeah, that makes sense...