Runtime Trigger ASM Research

How Can We Help?

< Back

Runtime vs Parsetime (Loadtime)

Parsetime is the code that is run when loading character files
Runtime is the code that runs while in the actual game
To relatively define this, Runtime is every frame when executing things every frame, such as negative statedefs.

Preface

The following documentation lists parts in steps in a relative way
Not only is the definition of a step vague
But we do not know at which point Step 1 occurs, or even how to define what Step 1 actually is.

Step A

This is the first observed part of how Triggers are evaulated

mugen.exe+5642B mov eax,[esi+0C]
mugen.exe+5642E mov [esp+28],eax
mugen.exe+56432 cmp eax,00000190 { 400 }
mugen.exe+56437 ja mugen.exe+57EF3
mugen.exe+5643D movzx ecx,byte ptr [eax+mugen.exe+58104]
mugen.exe+56444 jmp dword ptr [ecx*4+mugen.exe+57F0C]


ESI in this context likely refers to a Trigger Structure (Class/Struct)
EAX in this context is similar to a Trigger ID.
We are using ID trigger that has a value of 0x61 (97 decimal)
If EAX is above this jump to error handing
Where it throws an Invalid Trigger Code error
Using the Trigger Code ID and the base offset to set ECX
The ID Trigger has a ECX ID of 0x31 (49 decimal)
Using the ECX ID which is derived from the EAX ID
Jump to the specified memory

Step B. MOV Offsets Common JMP

Each trigger leads to a section like this

mugen.exe+56F3B mov ebp,[ebx+04]
mugen.exe+56F3E jmp mugen.exe+57CE2

In this, the EBX represents the Player, and +0x04 is the Offset of Their ID
For System Data Triggers, it looks like this (Roundstate Trigger)
Also note that even when evaluating player triggers
EDX still holds the Game Structure Pointer regardless

mugen.exe+5704D mov ebp,[edx+00012754]
mugen.exe+57053 jmp mugen.exe+57CE2

There are 127 instances of this JMP instruction
Therefore we can assume every Trigger eventually JMPs to this location
More complex triggers undergo several unique operations before the JMP
And in special cases, may jump elsewhere for error handling.

Common Function 57CE2


Leave a comment

Your email address will not be published. Required fields are marked *