AurieFramework / YYToolkit

The definitive internal modding tool for GameMaker games
GNU Affero General Public License v3.0
72 stars 10 forks source link

YYToolkit fails to look up rooms in 2024.2+ VM #67

Open Archie-osu opened 4 months ago

Archie-osu commented 4 months ago

YYToolkit fails to find the array used in Room_Data in 2024.2+ VM runners. The problem is in multiple places at once:

First up, YYTK::VM::GmpFindRoomData should contain the following check (might also wanna include in YYC if applicable):

// Reject stupidity like mov reg, [reg] - we have to have displacement
if (!mov_instruction.operands[1].mem.disp.has_displacement)
    return AURIE_INVALID_SIGNATURE;

Next up, it's possible this pattern repeats multiple times, such as in the current 2024.2.0.163 runner:

; pattern 1, not it
mov r9, [rcx] ; doesn't have displacement, is rejected by proposed check
mov rax, cs:qword_140DB0C08 
test rax, rax
jz short loc_14028A05A

; pattern 2, actually it
mov rax, cs:qword_140B62330 ; the actual array, has displacement
mov rbx, [rax+rbx*8]
test rbx, rbx
jz short loc_14028A0C1

The current behavior of VM::GmpFindRoomData is to trust the first mnemonic pattern match as the correct one, which isn't true here.