UnderminersTeam / UndertaleModTool

The most complete tool for modding, decompiling and unpacking Undertale (and other Game Maker: Studio games!)
GNU General Public License v3.0
1.07k stars 206 forks source link

for some reason gml_Object_obj_mainchara_ch1_Draw_0 in deltarune 1.15 and gml_Object_obj_mainchara_Draw_0 in SURVEY_PROGRAM decompiles differently #1417

Closed H-A-M-G-E-R closed 4 months ago

H-A-M-G-E-R commented 1 year ago

Describe the bug

in 1.15 there's <<'s that shouldn't be there

Reproducing steps

decompile both of them

Setup Details

version 0.5.1.0 (the decompiler isn't updated in 2 months...)

Jacky720 commented 1 year ago

Not a bug. Enums in GMS2.3+ (the Chapter 2 version) compile incompletely, retaining the << 0 you're seeing. << means "bitshift left", that is, turning 1 into 2 or 2 into 4... but because it's a 0, it makes no change to the actual value.

I guess it would be possible to make some kind of nonfunctional enum marker in the decompiler... but it wouldn't really affect anything.

H-A-M-G-E-R commented 1 year ago

also there's new instructions in the assembly in chapter 2 that aren't seen in survey_program

Jacky720 commented 1 year ago

Yes, those instructions indicate the presence of enums.

H-A-M-G-E-R commented 1 year ago

see line 362 of UndertaleModLib/Decompiler/Decompiler.cs

H-A-M-G-E-R commented 1 year ago

one instruction is conv.b.v

Jacky720 commented 1 year ago

That's because GameMaker added a boolean format, even though it basically still acts like an integer. The decompiler doesn't properly process that, pretty much ignores it in fact, but... there is no UTMT bug here. This is just stuff that changed in the game.

H-A-M-G-E-R commented 1 year ago

that's because i'm using the wrong compiler

Jacky720 commented 4 months ago

Not a bug.