Code:
<00515FD0>
@LoadDLLAndCrashIfModified:
call @LoadRevDLL ; LoadDLLAndCrashIfModified proc
jmp 406910 ; Sysinit::InitExe
<004C9C31>
call @LoadDLLAndCrashIfModified
<004F6000>
dd 0deadbeef ; marker for helper DLL
<004F6004>
@DLL_LoadPlugins:
<004F6008>
@DLL_GetMessageLineLength:
<004F600C>
@DLL_AuroraBltRect:
<004F6010>
@DLL_AuroraDrawLine:
<004F6014>
@DLL_BetterGetResFilename:
<004F6018>
@DLL_BetterErrorMessage:
<004F601C>
@DLL_F3Pressed:
<004F6020>
@DLL_TraceLine:
<004F6024>
@DLL_DrawTracingImage:
<004F6028>
@DLL_LogSetVar:
<004F602C>
@DLL_LogSetSwitch:
<004F6030>
@DLL_SimulateKeyPress:
<004F67F0>
@PlugInSetVarHandler:
dd @DummySetVarHandler
<004F6800>
@VarIDCurrentEventID:
dd 49991.
@VarIDCurrentEventPage:
dd 49992.
@VarIDCurrentEventScriptLine:
dd 49993.
@CheckF11:
push 7a ; CheckF11 proc ; VK_F11
call 407054 ; GetAsyncKeyState
movsx eax, ax
test ah, 80
jz 407054 ; GetAsyncKeyState
mov eax, [4cdc7c]
mov eax, [eax]
mov byte ptr [eax+4], 5
mov eax, [4cdfcc]
mov eax, [eax]
mov byte ptr [eax+50], 1
mov byte ptr [eax+51], 0
mov eax, [4cdc1c]
mov eax, [eax]
push 40240000
push 0
call 48ce04 ; FadeOut
mov eax, [4cdc1c]
mov eax, [eax]
mov byte ptr [eax+0c], 0
xor ax, ax
retn 4
@SetVarCommand:
push ebx
push esi
push edi
mov edi, ecx
pushad
cmp edx, [@VarIDCurrentEventID]
je @DontLog
cmp edx, [@VarIDCurrentEventPage]
je @DontLog
cmp edx, [@VarIDCurrentEventScriptLine]
je @DontLog
push ecx
push edx
call [@DLL_LogSetVar]
@DontLog:
popad
jmp 48b3b5
@GetResFilenameWrapper:
push ebp ; GetResFilenameWrapper proc
mov ebp, esp
push 0 ; [ebp-4] / [local.1] => eax
push 0 ; [ebp-8] / [local.2] => edx
push 0 ; [ebp-0c] / [local.3] => [arg.1]
mov [local.1], eax
mov [local.2], edx
push [arg.1]
pop [local.3]
push [arg.2]
push [arg.1]
push @GRFJumpBack
push ebp
mov ebp, esp
add esp, -10
jmp 474706
@GRFJumpBack:
pushad
push [local.3]
push [local.2]
push [local.1]
call [@DLL_BetterGetResFilename]
popad
mov esp, ebp
pop ebp
retn 8
@LoadRevDLL:
pushad ; LoadRevDLL proc
push @RevDLLName
call 406c14 ; LoadLibraryA
test eax, eax
jz @RevDLLError
call [@DLL_LoadPlugins]
popad
retn
@RevDLLError:
push 0
push 0
push @ErrRevhelperDLLNotFound
push 0
call 4012dc ; MessageBoxA
call 4012d4 ; ExitProcess
int3
@RevDLLName:
"revhelper.dll\0"
@ErrRevhelperDLLNotFound:
"File not found: revhelper.dll\0"
@DummySetVarHandler:
retn 8 ; DummySetVarHandler proc
@GetVar:
push edx ; GetVar proc
push ecx
mov eax, [4cdc7c]
mov eax, [eax]
mov edx, [esp+0c]
call 48b398 ; GetVar
pop ecx
pop edx
retn 4
@SetVar:
push edx ; SetVar proc
push ecx
mov eax, [4cdc7c]
mov eax, [eax]
mov edx, [esp+10]
mov ecx, [esp+0c]
call 48b3b0 ; SetVar
pop ecx
pop edx
retn 8
@GetSwitch:
push edx ; GetSwitch proc
push ecx
mov eax, [4cdc7c]
mov eax, [eax]
mov edx, [esp+0c]
call 48b324 ; GetSwitch
and eax, 1
pop ecx
pop edx
retn 4
@SetSwitch:
push edx ; SetSwitch proc
push ecx
mov eax, [4cdc7c]
mov eax, [eax]
mov edx, [esp+10]
mov ecx, [esp+0c]
call 48b33c ; SetSwitch
pop ecx
pop edx
retn 8
@SetEventIDVariable:
pushad ; SetEventIDVariable proc
push [@VarIDCurrentEventScriptLine]
inc edx
push edx
call @SetVar
push [@VarIDCurrentEventID]
push [ebx+1c]
call @SetVar
push [@VarIDCurrentEventPage]
push 0
call @SetVar
mov eax, [4cdd74]
mov eax, [eax]
mov eax, [eax+18]
mov edx, [ebx+1c]
call 475740 ; GetFromList
test eax, eax
jz @SEIDVCont
call 4ab4f0 ; GetActiveEventPage
push [@VarIDCurrentEventPage]
push eax
call @SetVar
@SEIDVCont:
popad
call 479710 ; GetEventScriptLine
pushad
push [@VarIDCurrentEventScriptLine]
push [@VarIDCurrentEventPage]
push [@VarIDCurrentEventID]
push eax
call [@DLL_TraceLine]
popad
retn
@BetterErrorMessage:
push eax ; BetterErrorMessage proc
push ecx
push [@VarIDCurrentEventScriptLine]
push [@VarIDCurrentEventPage]
push [@VarIDCurrentEventID]
push edx
call [@DLL_BetterErrorMessage]
mov edx, eax
mov eax, [4cdd4c]
mov eax, [eax]
mov byte ptr [eax+18], 0
pop ecx
pop eax
jmp 4558ac ; Forms::TApplication::MessageBox
@SetCommonEventID1:
call 47991c ; SetCommonEventID1 proc ; CallEvent
mov eax, ebx
neg eax
retn
@SetCommonEventID2:
call 47991c ; SetCommonEventID2 proc ; CallEvent
mov eax, edi
neg eax
mov [ebx+1c], eax
retn
@SetCommonEventID3:
call 47991c ; SetCommonEventID3 proc ; CallEvent
mov edx, 1
mov eax, esi
call 47967c ; GetEvParam
neg eax
mov [ebx+1c], eax
retn
@SetCommonEventID4:
call 47991c ; SetCommonEventID4 proc ; CallEvent
xor edx, edx
mov eax, edi
call 47967c ; GetEvParam
neg eax
mov [ebx+1c], eax
retn
@UpdateScreenHook:
pushad ; UpdateScreenHock proc
call [@DLL_DrawTracingImage]
popad
push ebp
mov ebp, esp
push ecx
mov [ebp-4], eax
jmp 46bc33
@LogSetSwitch:
pushad ; LogSetSwitch proc
push ecx
push edx
call [@DLL_LogSetSwitch]
popad
push ebx
push esi
push edi
mov ebx, ecx
jmp 48b341
@CheckRestartOnError:
mov ecx, [4cdb94] ; CheckRestartOnError proc
mov ecx, [ecx]
test ecx, ecx
jz @AbortGame
cmp dword ptr [ecx], 0
jz @AbortGame
mov ecx, [ecx+10]
test ecx, ecx
jz @AbortGame
jmp 46ae95
@AbortGame:
mov eax, [4cde78]
mov eax, [eax]
call 455808 ; Forms::TApplication::Terminate
jmp 46ae95
<0048B33C>
jmp @LogSetSwitch
<0046BC2C>
jmp @UpdateScreenHook
<004B2DA6>
call @SetCommonEventID1 ; set common event ID in +1C field
nop
nop
<004B0ECC>
call @SetCommonEventID2
<004B0D5A>
call @SetCommonEventID3
<004B0F71>
call @SetCommonEventID4
<0046AE84>
call @BetterErrorMessage ; show last event script info in error messages
<004B1DEC>
call @SetEventIDVariable ; put current event ID in a variable
<00474700>
jmp @GetResFilenameWrapper ; better handling of file-not-found errors
<004A3717>
call @CheckF11 ; in testplay, use F11 for saving the game
<0046AE89>
jmp @CheckRestartOnError ; don't close on error; just restart game
<0048B3B0>
jmp @SetVarCommand ; log variable changes
Ich weiß, dass einiges nicht optimal gelöst ist, aber ich habe meinen alten Code von RMEventFactory übernommen und hatte keine Lust, ihn komplett umzuschreiben. Wer das hier runterlädt, kann sich freuen, denn er hält damit auch meinen Code zum Lesen und Schreiben von Events in der Zwischenablage in den Händen, sowie den des EasyEventExporters, wenn auch in überarbeiteter Form.
Die DLL enthält übrigens einige Dinge, die hier gar nicht verwendet werden, im eigentlichen Revolution Patch aber schon.