From f87deb5f8d1431e2a87e0d8a32fbd9ed449c2e5b Mon Sep 17 00:00:00 2001 From: szapp Date: Fri, 14 Jul 2023 14:49:24 +0200 Subject: [PATCH 1/9] Initialize compatibility for Gothic Sequel (1.12f) --- Makefile | 8 +- extractSymbols.bat | 11 +- getAddress.bat | 16 +- src/core.asm | 2 +- src/data/io.asm | 6 +- src/dll/Ninja.asm | 41 ++- src/exec/createVdfArray.asm | 8 +- src/exec/deploy.asm | 66 ++--- src/exec/init.asm | 4 +- src/exec/misc.asm | 58 ++--- src/exec/parse.asm | 96 +++---- src/func/allowRedefine.asm | 2 +- src/func/armParser.asm | 4 +- src/func/conEvalFunc.asm | 2 +- src/hook_CGameManager_destructor.asm | 9 +- src/hook_Hlp_GetNpc.asm | 9 +- src/hook_Hlp_IsValidItem.asm | 9 +- src/hook_Hlp_IsValidNpc.asm | 9 +- src/hook_archiveWorldCountLogicalNpc.asm | 9 +- src/hook_archiveWorldWriteLogicalNpc.asm | 9 +- src/hook_createVdfArray.asm | 9 +- src/hook_deploy_ani_ninja.asm | 9 +- src/hook_deploy_camera_ninja.asm | 15 +- src/hook_deploy_content_ninja.asm | 13 +- src/hook_deploy_fightai_ninja.asm | 15 +- src/hook_deploy_menu_ninja.asm | 9 +- src/hook_deploy_music_ninja.asm | 13 +- src/hook_deploy_ou_ninja.asm | 9 +- src/hook_deploy_pfx_ninja.asm | 13 +- src/hook_deploy_sfx_ninja.asm | 15 +- src/hook_deploy_vfx_ninja.asm | 15 +- src/hook_fastexit.asm | 9 +- src/hook_init_content.asm | 9 +- src/hook_init_menu.asm | 9 +- src/hook_libExit.asm | 9 +- src/hook_linkerReplaceFunc.asm | 9 +- src/hook_npcReference.asm | 9 +- src/hook_oCSpawnManager__Archive.asm | 9 +- src/hook_parserDeclareClass.asm | 9 +- src/hook_parserDeclareFunc.asm | 9 +- src/hook_parserDeclarePrototype.asm | 9 +- src/hook_parserDeclareVar.asm | 9 +- src/hook_parserDeclareVar_constInt.asm | 9 +- src/hook_parserDeclareVar_constString.asm | 9 +- src/hook_parserParseSource.asm | 9 +- src/hook_setVobToTransient.asm | 9 +- src/hook_unarchiveInfoMan.asm | 9 +- src/hook_unarchiveNpcs.asm | 9 +- src/hook_unarchiveVobs.asm | 9 +- src/hook_zCPar_Symbol__GetNext.asm | 9 +- src/hook_zCParser__LoadGlobalVars.asm | 9 +- src/inc/engine.inc | 4 + src/inc/engine_g1.inc | 1 + src/inc/engine_g112.inc | 239 ++++++++++++++++++ src/inc/macros.inc | 12 +- src/inc/symbols.inc | 18 ++ src/ow_ani.asm | 25 +- src/ow_aniAlias.asm | 25 +- src/ow_aniBatch.asm | 23 +- src/ow_aniBlend.asm | 25 +- src/ow_aniComb.asm | 23 +- src/ow_aniDisable.asm | 25 +- src/ow_aniSync.asm | 25 +- src/ow_parserDeclareClass_showOverwrite.asm | 11 +- src/ow_parserDeclareFunc_showOverwrite.asm | 11 +- ...w_parserDeclarePrototype_showOverwrite.asm | 11 +- src/ow_parserDeclareVar_showOverwrite.asm | 15 +- src/ow_playerInfoName1.asm | 9 +- src/ow_playerInfoName2.asm | 9 +- src/ow_playerInfoName3.asm | 9 +- src/ow_playerInfoName4.asm | 9 +- src/ow_playerInfoName5.asm | 9 +- src/ow_reopenFileWarning.asm | 9 +- verifySize.bat | 16 +- 74 files changed, 655 insertions(+), 601 deletions(-) create mode 100644 src/inc/engine_g112.inc create mode 100644 src/inc/symbols.inc diff --git a/Makefile b/Makefile index e22eef7..aa1f79f 100644 --- a/Makefile +++ b/Makefile @@ -81,6 +81,7 @@ CONTENT := $(INCDIR)injections$(INCEXT) # Included files INC := $(INCDIR)stackops$(INCEXT) $(INCDIR)macros$(INCEXT) $(INCDIR)engine$(INCEXT) INC_G1 := $(INC) $(INCDIR)engine_g1$(INCEXT) +INC_G112 := $(INC) $(INCDIR)engine_g112$(INCEXT) INC_G2 := $(INC) $(INCDIR)engine_g2$(INCEXT) # Intermediate files @@ -179,6 +180,7 @@ DATA_BASE := symbols \ messages BINARIES_G1 := $(BIN_BASE:%=$(BINDIR)%_g1) +BINARIES_G112 := # $(BIN_BASE:%=$(BINDIR)%_g112) BINARIES_G2 := $(BIN_BASE:%=$(BINDIR)%_g2) $(BIN_BASE_G2:%=$(BINDIR)%_g2) FUNC := $(FUNC_BASE:%=$(FUNCDIR)%$(ASMEXT)) EXEC := $(EXEC_BASE:%=$(EXECDIR)%$(ASMEXT)) @@ -231,7 +233,7 @@ $(OBJ) : $(SRCDLL) $(CONTENT) $(IKLG) $(RSC) : $(RC) gorc $(FLAGS_RC) /fo $@ /r $^ -$(CONTENT) : $(BINARIES_G1) $(BINARIES_G2) +$(CONTENT) : $(BINARIES_G1) $(BINARIES_G112) $(BINARIES_G2) $(GETBINLIST) $(call FixPath,$@) $(SRCDIR) $(BINDIR)core_g% : $(SRCDIR)core$(ASMEXT) $(FUNC) $(EXEC) $(DATA) $(INC_G%) $(META) @@ -246,6 +248,10 @@ $(BINDIR)%_g1 : $(SRCDIR)%$(ASMEXT) $(INCDIR)symbols_g1$(INCEXT) $(INC_G1) $(MET @$(call mkdir,$(BINDIR)) $(NASM) -DGOTHIC_BASE_VERSION=1 $(FLAGS_C) -o $@ $< +$(BINDIR)%_g112 : $(SRCDIR)%$(ASMEXT) $(INCDIR)symbols_g112$(INCEXT) $(INC_G112) $(META) + @$(call mkdir,$(BINDIR)) + $(NASM) -DGOTHIC_BASE_VERSION=112 $(FLAGS_C) -o $@ $< + $(BINDIR)%_g2 : $(SRCDIR)%$(ASMEXT) $(INCDIR)symbols_g2$(INCEXT) $(INC_G2) $(META) @$(call mkdir,$(BINDIR)) $(NASM) -DGOTHIC_BASE_VERSION=2 $(FLAGS_C) -o $@ $< diff --git a/extractSymbols.bat b/extractSymbols.bat index 831ca4d..28d495f 100644 --- a/extractSymbols.bat +++ b/extractSymbols.bat @@ -1,7 +1,7 @@ :: :: Extract all global symbols from assembly files and format them into a macro file :: -:: Arguments: OUTFILE.ASM GOTHIC-BASE-VERSION(1 or 2) SOURCE.ASM [SOURCE.ASM ...] +:: Arguments: OUTFILE.ASM GOTHIC-BASE-VERSION(1, 112, or 2) SOURCE.ASM [SOURCE.ASM ...] :: @ECHO OFF SETLOCAL ENABLEDELAYEDEXPANSION @@ -13,8 +13,11 @@ SET getAddress=%~pd0getAddress IF [%1] == [] GOTO usage IF [%2] == [] GOTO usage IF [%3] == [] GOTO usage -IF %2 LSS 1 GOTO usage -IF %2 GTR 2 GOTO usage +IF %2 EQU 1 GOTO start +IF %2 EQU 112 GOTO start +IF %2 NEQ 2 GOTO usage + +:start SET gothic=%2 :: Write file header @@ -65,4 +68,4 @@ DEL /Q temp.O EXIT /B :usage -ECHO Usage: %~nx0 OUTFILE.ASM GOTHIC-BASE-VERSION(1 or 2) SOURCE.ASM [SOURCE.ASM ...] +ECHO Usage: %~nx0 OUTFILE.ASM GOTHIC-BASE-VERSION(1, 112, or 2) SOURCE.ASM [SOURCE.ASM ...] diff --git a/getAddress.bat b/getAddress.bat index 93898ca..1bd5493 100644 --- a/getAddress.bat +++ b/getAddress.bat @@ -1,7 +1,7 @@ :: :: Read starting address (ORG) from assembly file :: -:: Arguments: SOURCE.ASM GOTHIC-BASE-VERSION(1 or 2) +:: Arguments: SOURCE.ASM GOTHIC-BASE-VERSION(1, 112, or 2) :: @ECHO OFF SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION @@ -9,8 +9,12 @@ SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION :: Sanity check IF [%1] == [] GOTO usage IF [%2] == [] GOTO usage -IF %2 LSS 1 GOTO usage -IF %2 GTR 2 GOTO usage +IF %2 EQU 1 SET gId=1&& GOTO start +IF %2 EQU 112 SET gId=2&& GOTO start +IF %2 EQU 2 SET gId=3&& GOTO start +GOTO usage + +:start :: Parse file name SET filefull=%~f1 @@ -32,10 +36,10 @@ SET i=0 FOR /F "tokens=*" %%A IN (tmp.text) DO ( SET /A i=i+1 SET addr=%%A - IF !i!==%2 GOTO break + IF !i!==%gId% GOTO break ) :: Only one address found -IF %i% LSS %2 GOTO break +IF %i% LSS %gId% GOTO break :: None found DEL /Q tmp.text @@ -47,4 +51,4 @@ ECHO %addr% EXIT /B 0 :usage -ECHO Usage: %~nx0 SOURCE.ASM GOTHIC-BASE-VERSION(1 or 2) +ECHO Usage: %~nx0 SOURCE.ASM GOTHIC-BASE-VERSION(1, 112, or 2) diff --git a/src/core.asm b/src/core.asm index 89cfb3b..58dbb3e 100644 --- a/src/core.asm +++ b/src/core.asm @@ -4,7 +4,7 @@ %include "inc/engine.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x452640,0x457470) + org g1g2(0x452640,0x459190,0x457470) %endif bits 32 diff --git a/src/data/io.asm b/src/data/io.asm index 35ed931..8d35ba4 100644 --- a/src/data/io.asm +++ b/src/data/io.asm @@ -1,7 +1,7 @@ char_ikarus db 'IKARUS', 0 char_lego db 'LEGO', 0 char_rb db 'rb', 0 -char_g1g2 db '_G', g1g2('1','2'), 0 +char_g1g2 db '_G', g1g2('1','112','2'), 0 char_bin db '.BIN', 0 char_csl db '.CSL', 0 char_zOPT_ignorePatches db 'IncompatibleNinjaPatches', 0 @@ -19,8 +19,8 @@ NINJA_PATH_DATA db 'DATA\', 0 NINJA_PATH_VDF db 'DATA\*.VDF', 0 NINJA_PATH_IKARUS db '\NINJA\_INTERN\IKARUS\IKARUS.D', 0 NINJA_PATH_LEGO db '\NINJA\_INTERN\LEGO\LEGO.D', 0 -NINJA_PATH_IKARUSSRC db '\NINJA\_INTERN\IKARUS\IKARUS_G', g1g2('1','2'), '.SRC', 0 -NINJA_PATH_LEGOSRC db '\NINJA\_INTERN\LEGO\HEADER_G', g1g2('1','2'),'.SRC', 0 +NINJA_PATH_IKARUSSRC db '\NINJA\_INTERN\IKARUS\IKARUS_G', g1g2('1','112','2'), '.SRC', 0 +NINJA_PATH_LEGOSRC db '\NINJA\_INTERN\LEGO\HEADER_G', g1g2('1','112','2'),'.SRC', 0 NINJA_MDS_PREFIX db 'ANIMS_', 0 NINJA_FILE db '\SYSTEM\NINJA.DLL', 0 NINJA_VDF_VERSION1 db 'PSVDSC_V2.00', 0xD, 0xA, 0xD, 0xA diff --git a/src/dll/Ninja.asm b/src/dll/Ninja.asm index 06c340c..cb5a464 100644 --- a/src/dll/Ninja.asm +++ b/src/dll/Ninja.asm @@ -10,6 +10,14 @@ %assign inject_g1_count inject_g1_count + 1 %endmacro +%assign inject_g112_count 0 +%macro add_inject_g112 2 + injectObj_g112_%[inject_g112_count]_addr equ %1 + injectObj_g112_%[inject_g112_count]_new incbin %2 + injectObj_g112_%[inject_g112_count]_size equ $-injectObj_g112_%[inject_g112_count]_new + %assign inject_g112_count inject_g112_count + 1 +%endmacro + %assign inject_g2_count 0 %macro add_inject_g2 2 injectObj_g2_%[inject_g2_count]_addr equ %1 @@ -61,9 +69,11 @@ section .data db 'privileges and/or delete the hidden file \Data\', scriptsFileName, 0 verify_addr_g1 equ 0x82C0C0 + verify_addr_g112 equ 0x87F918 verify_addr_g2 equ 0x89A7FC zCParser__ParseBlock_g1 equ 0x6E6C00 + zCParser__ParseBlock_g112 equ 0x71F8E0 zCParser__ParseBlock_g2 equ 0x78FE30 %include "inc/injections.inc" @@ -167,6 +177,8 @@ inject: injectAll: cmp DWORD [verify_addr_g2], 'Goth' jz .g2 + cmp DWORD [verify_addr_g112], 'GOTH' + jz .g112 cmp DWORD [verify_addr_g1], 'Goth' jz .g1 @@ -188,7 +200,7 @@ injectAll: push injectObj_g1_%[it]_size push injectObj_g1_%[it]_addr call inject - addStack 4*4 + addStack 3*4 test eax, eax jz .failed %assign it it + 1 @@ -205,6 +217,28 @@ injectAll: mov eax, DWORD 0x1 ret +.g112: + %assign it 0 + %rep inject_g112_count + push injectObj_g112_%[it]_new + push injectObj_g112_%[it]_size + push injectObj_g112_%[it]_addr + call inject + addStack 3*4 + test eax, eax + jz .failed + %assign it it + 1 + %endrep + + push 0x8 + push zCParser__ParseBlock_g112 + call clearAccess + addStack 2*4 + test eax, eax + jz .failed + + jmp .success + .g2: %assign it 0 %rep inject_g2_count @@ -212,6 +246,7 @@ injectAll: push injectObj_g2_%[it]_size push injectObj_g2_%[it]_addr call inject + addStack 3*4 test eax, eax jz .failed %assign it it + 1 @@ -267,7 +302,11 @@ verifyModuleName: xor eax, eax inc ecx cmp DWORD [ecx], 'Goth' + jz .funcSucc + cmp DWORD [ecx], 'GOTH' jnz .funcEnd + +.funcSucc: inc eax .funcEnd: diff --git a/src/exec/createVdfArray.asm b/src/exec/createVdfArray.asm index db9beb6..f7e063d 100644 --- a/src/exec/createVdfArray.asm +++ b/src/exec/createVdfArray.asm @@ -49,7 +49,8 @@ createVdfArray: call zSTRING___zSTRING add esp, 0x14 - mov al, [SystemPack_version_info+g1g2(0xD,0xB)] ; Check for old Ninja system +%if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 2 + mov al, [SystemPack_version_info+g1g2(0xD,0x0,0xB)] ; Check for old Ninja system cmp al, 'N' jnz .checkScripts @@ -64,6 +65,7 @@ createVdfArray: ; mov ecx, esp ; Never reached: Safe some space ; call zSTRING___zSTRING add esp, 0x14 +%endif .checkScripts: call zFILE_VDFS__LockCriticalSection @@ -120,6 +122,7 @@ createVdfArray: call zCConsole__AddEvalFunc addStack 4 +%if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 2 reportToSpy NINJA_READING_INI mov esi, DWORD [zCOption_zgameoptions] test esi, esi @@ -158,6 +161,7 @@ createVdfArray: lea ecx, [esp+stackoffset+var_retstr] call zSTRING___zSTRING jmp .detect +%endif .ignoreListEmpty: push char_NUL @@ -561,7 +565,7 @@ createVdfArray: verifyStackoffset push char_zStartupWindowed - jmp g1g2(0x6019C6,0x630B61) + jmp g1g2(0x6019C6,0x623783,0x630B61) ; int __cdecl ninja_compareTimestampsUnsigned(void const *, void const *) diff --git a/src/exec/deploy.asm b/src/exec/deploy.asm index 25848df..8d473a8 100644 --- a/src/exec/deploy.asm +++ b/src/exec/deploy.asm @@ -2,7 +2,7 @@ global deploy_music_ninja deploy_music_ninja: - resetStackoffset g1g2(0xD8,0xC8) + resetStackoffset g1g2(0xD8,0,0xC8) pusha push ninja_injectSrc push NINJA_PATH_MUSIC @@ -11,17 +11,17 @@ deploy_music_ninja: call ninja_armParser addStack 3*4 popa - verifyStackoffset g1g2(0xD8,0xC8) + verifyStackoffset g1g2(0xD8,0,0xC8) ; Jump back - lea edx, [esp+stackoffset+g1g2(-0xC5,-0xB5)] + lea edx, [esp+stackoffset+g1g2(-0xC5,0,-0xB5)] push edx - jmp g1g2(0x4DA44D,0x4E7661) + jmp g1g2(0x4DA44D,0,0x4E7661) global deploy_sfx_ninja deploy_sfx_ninja: - resetStackoffset g1g2(0x304,0x308) + resetStackoffset g1g2(0x304,0,0x308) pusha push ninja_injectSrc push NINJA_PATH_SFX @@ -30,17 +30,17 @@ deploy_sfx_ninja: call ninja_armParser addStack 3*4 popa - verifyStackoffset g1g2(0x304,0x308) + verifyStackoffset g1g2(0x304,0,0x308) ; Jump back - lea g1g2(ecx,eax), [esp+stackoffset+g1g2(-0x2F2,-0x2F6)] - push g1g2(ecx,eax) - jmp g1g2(0x4DD891,0x4EAE90) + lea g1g2(ecx,0,eax), [esp+stackoffset+g1g2(-0x2F2,0,-0x2F6)] + push g1g2(ecx,0,eax) + jmp g1g2(0x4DD891,0,0x4EAE90) global deploy_pfx_ninja deploy_pfx_ninja: - resetStackoffset g1g2(0x8C,0xC8) + resetStackoffset g1g2(0x8C,0,0xC8) pusha push ninja_injectSrc push NINJA_PATH_PFX @@ -49,17 +49,17 @@ deploy_pfx_ninja: call ninja_armParser addStack 3*4 popa - verifyStackoffset g1g2(0x8C,0xC8) + verifyStackoffset g1g2(0x8C,0,0xC8) ; Jump back - lea eax, [esp+stackoffset+g1g2(-0x79,-0xB5)] + lea eax, [esp+stackoffset+g1g2(-0x79,0,-0xB5)] push eax - jmp g1g2(0x58CA27,0x5AC7C1) + jmp g1g2(0x58CA27,0,0x5AC7C1) global deploy_vfx_ninja deploy_vfx_ninja: - resetStackoffset g1g2(0x248,0x250) + resetStackoffset g1g2(0x248,0,0x250) pusha push ninja_injectSrc push NINJA_PATH_VFX @@ -68,12 +68,12 @@ deploy_vfx_ninja: call ninja_armParser addStack 3*4 popa - verifyStackoffset g1g2(0x248,0x250) + verifyStackoffset g1g2(0x248,0,0x250) ; Jump back - lea g1g2(edx,eax), [esp+stackoffset+g1g2(-0x239,-0x235)] - push g1g2(edx,eax) - jmp g1g2(0x483A41,0x48B6F4) + lea g1g2(edx,0,eax), [esp+stackoffset+g1g2(-0x239,0,-0x235)] + push g1g2(edx,0,eax) + jmp g1g2(0x483A41,0,0x48B6F4) global deploy_ou_ninja @@ -92,7 +92,7 @@ deploy_ou_ninja: global deploy_content_ninja deploy_content_ninja: - resetStackoffset g1g2(0x90,0x80) + resetStackoffset g1g2(0x90,0,0x80) pusha push ninja_injectSrc push NINJA_PATH_CONTENT @@ -100,17 +100,17 @@ deploy_content_ninja: call ninja_armParser addStack 3*4 popa - verifyStackoffset g1g2(0x90,0x80) + verifyStackoffset g1g2(0x90,0,0x80) ; Jump back push 0x1 - lea ecx, [esp+stackoffset+g1g2(-0x44,-0x1C)] - jmp g1g2(0x6371F7,0x6C12A6) + lea ecx, [esp+stackoffset+g1g2(-0x44,0,-0x1C)] + jmp g1g2(0x6371F7,0,0x6C12A6) global deploy_fightai_ninja deploy_fightai_ninja: - resetStackoffset g1g2(0x7C,0x64) + resetStackoffset g1g2(0x7C,0,0x64) pusha push ninja_injectSrc push NINJA_PATH_FIGHT @@ -118,12 +118,12 @@ deploy_fightai_ninja: call ninja_armParser addStack 3*4 popa - verifyStackoffset g1g2(0x7C,0x64) + verifyStackoffset g1g2(0x7C,0,0x64) ; Jump back - lea g1g2(edx,eax), [esp+stackoffset+g1g2(-0x69,-0x51)] - push g1g2(edx,eax) - jmp g1g2(0x747EBF,0x67C62B) + lea g1g2(edx,0,eax), [esp+stackoffset+g1g2(-0x69,0,-0x51)] + push g1g2(edx,0,eax) + jmp g1g2(0x747EBF,0,0x67C62B) global deploy_menu_ninja @@ -141,12 +141,12 @@ deploy_menu_ninja: ; Jump back mov eax, DWORD [zCSoundSystem_zsound] - jmp g1g2(0x4CD57F,0x4DA19B) + jmp g1g2(0x4CD57F,0,0x4DA19B) global deploy_camera_ninja deploy_camera_ninja: - resetStackoffset g1g2(0xB4,0xB8) + resetStackoffset g1g2(0xB4,0,0xB8) pusha push ninja_injectSrc push NINJA_PATH_CAMERA @@ -155,12 +155,12 @@ deploy_camera_ninja: call ninja_armParser addStack 3*4 popa - verifyStackoffset g1g2(0xB4,0xB8) + verifyStackoffset g1g2(0xB4,0,0xB8) ; Jump back - lea g1g2(eax,edx), [esp+stackoffset+g1g2(-0xA1,-0xA5)] - push g1g2(eax,edx) - jmp g1g2(0x4990A3,0x4A0559) + lea g1g2(eax,0,edx), [esp+stackoffset+g1g2(-0xA1,0,-0xA5)] + push g1g2(eax,0,edx) + jmp g1g2(0x4990A3,0,0x4A0559) global deploy_ani_ninja diff --git a/src/exec/init.asm b/src/exec/init.asm index a54fc0a..6ede94b 100644 --- a/src/exec/init.asm +++ b/src/exec/init.asm @@ -15,7 +15,7 @@ init_menu: ; Jump back pop ebp mov ecx, [esp+stackoffset-0xC] - jmp g1g2(0x4CE914,0x4DB504) + jmp g1g2(0x4CE914,0,0x4DB504) global init_content @@ -37,4 +37,4 @@ init_content: add esp, 0x8 test eax, eax %endif - jmp g1g2(0x637F8A,0x6C20C8) + jmp g1g2(0x637F8A,0,0x6C20C8) diff --git a/src/exec/misc.asm b/src/exec/misc.asm index a45977d..7e37af9 100644 --- a/src/exec/misc.asm +++ b/src/exec/misc.asm @@ -15,7 +15,7 @@ setVobToTransient: test eax, eax jz .back - mov eax, [esi+g1g2(0x7B0,0x770)] ; oCNpc.instanz + mov eax, [esi+g1g2(0x7B0,0,0x770)] ; oCNpc.instanz test eax, eax jl .back mov edi, eax @@ -84,13 +84,13 @@ setVobToTransient: verifyStackoffset 0x68 ; Jump back - mov eax, [esi+g1g2(0x214,0x25C)] - jmp g1g2(0x68CB37,0x72F167) + mov eax, [esi+g1g2(0x214,0,0x25C)] + jmp g1g2(0x68CB37,0,0x72F167) global checkNpcTransient1 checkNpcTransient1: - resetStackoffset g1g2(0x5C,0x94) + resetStackoffset g1g2(0x5C,0,0x94) call DWORD [edx+0x104] ; oCNpc.IsSelfPlayer(void) test eax, eax jnz .back @@ -102,15 +102,15 @@ checkNpcTransient1: %endif jz .back mov eax, 0x1 - verifyStackoffset g1g2(0x5C,0x94) + verifyStackoffset g1g2(0x5C,0,0x94) .back: - jmp g1g2(0x6D652A,0x77F66A)+6 + jmp g1g2(0x6D652A,0,0x77F66A)+6 global checkNpcTransient2 checkNpcTransient2: - resetStackoffset g1g2(0x5C,0x94) + resetStackoffset g1g2(0x5C,0,0x94) call DWORD [eax+0x104] ; oCNpc.IsSelfPlayer(void) test eax, eax jnz .back @@ -122,15 +122,15 @@ checkNpcTransient2: %endif jz .back mov eax, 0x1 - verifyStackoffset g1g2(0x5C,0x94) + verifyStackoffset g1g2(0x5C,0,0x94) .back: - jmp g1g2(0x6D65A3,0x77F6E1)+6 + jmp g1g2(0x6D65A3,0,0x77F6E1)+6 global removeInvalidNpcs removeInvalidNpcs: - resetStackoffset g1g2(0x58,0x8C) + resetStackoffset g1g2(0x58,0,0x8C) push ebx push edx @@ -149,16 +149,16 @@ removeInvalidNpcs: pop ecx jz .back - mov eax, [esi+g1g2(0x7B0,0x770)] ; oCNpc.instance + mov eax, [esi+g1g2(0x7B0,0,0x770)] ; oCNpc.instance test eax, eax jge .back reportToSpy NINJA_REMOVE_NPC push char_meatbug_mds - lea ecx, [esi+g1g2(0x07B4,0x774)] ; oCNpc.mds_name + lea ecx, [esi+g1g2(0x07B4,0,0x774)] ; oCNpc.mds_name call zSTRING__zSTRING addStack 4 - mov ecx, [esp+stackoffset+g1g2(-0x48,-0x7C)] + mov ecx, [esp+stackoffset+g1g2(-0x48,0,-0x7C)] mov edx, esi call oCWorld__RemoveFromLists @@ -180,7 +180,7 @@ removeInvalidNpcs: .back: pop edx pop ebx - verifyStackoffset g1g2(0x58,0x8C) + verifyStackoffset g1g2(0x58,0,0x8C) ; Jump back %if GOTHIC_BASE_VERSION == 1 @@ -197,11 +197,11 @@ removeInvalidNpcs: global removeInvalidNpcs2 removeInvalidNpcs2: - resetStackoffset g1g2(0x5C,0x98) + resetStackoffset g1g2(0x5C,0,0x98) test esi, esi jz .back - mov eax, [esi+g1g2(0x7B0,0x770)] ; oCNpc.instance + mov eax, [esi+g1g2(0x7B0,0,0x770)] ; oCNpc.instance test eax, eax jl .remove call oCWorld__InsertInLists @@ -210,13 +210,13 @@ removeInvalidNpcs2: .remove: reportToSpy NINJA_REMOVE_NPC push char_meatbug_mds - lea ecx, [esi+g1g2(0x07B4,0x774)] ; oCNpc.mds_name + lea ecx, [esi+g1g2(0x07B4,0,0x774)] ; oCNpc.mds_name call zSTRING__zSTRING addStack 4 .back: - verifyStackoffset g1g2(0x5C,0x98) - jmp g1g2(0x6D6828,0x77F9C0) + verifyStackoffset g1g2(0x5C,0,0x98) + jmp g1g2(0x6D6828,0,0x77F9C0) global removeNpcInstRef removeNpcInstRef: @@ -236,7 +236,7 @@ removeNpcInstRef: %elif GOTHIC_BASE_VERSION == 2 cmp [esi+0x758], ebp %endif - jmp g1g2(0x68C0FC,0x72E62B) + jmp g1g2(0x68C0FC,0,0x72E62B) global ninja_injectInfo ninja_injectInfo: @@ -434,7 +434,7 @@ ninja_injectInfo: ; Jump back push esi mov ecx, oCMissionManager_misMan - jmp g1g2(0x63C7F4,0x6C6D24) + jmp g1g2(0x63C7F4,0,0x6C6D24) global createGlobalVarIfNotExist @@ -483,7 +483,7 @@ fix_Hlp_GetNpc: resetStackoffset 0x10 mov eax, [esi+zCPar_Symbol_offset_offset] test eax, eax - jz g1g2(0x65880E,0x6EEE6E) + jz g1g2(0x65880E,0,0x6EEE6E) push ecx mov ecx, eax @@ -495,13 +495,13 @@ fix_Hlp_GetNpc: add esp, 0x8 test eax, eax pop ecx - jz g1g2(0x65880E,0x6EEE6E) + jz g1g2(0x65880E,0,0x6EEE6E) verifyStackoffset 0x10 ; Jump back push edi push oCNpc_RTTI_Type_Descriptor - jmp g1g2(0x6587F2,0x6EEE52) + jmp g1g2(0x6587F2,0,0x6EEE52) global fix_Hlp_IsValidNpc @@ -527,7 +527,7 @@ fix_Hlp_IsValidNpc: ; Jump back call dynamic_cast .backClean: - jmp g1g2(0x658883,0x6EEEE3) + jmp g1g2(0x658883,0,0x6EEEE3) global fix_Hlp_IsValidItem @@ -553,7 +553,7 @@ fix_Hlp_IsValidItem: ; Jump back call dynamic_cast .backClean: - jmp g1g2(0x658B43,0x6EF1D3) + jmp g1g2(0x658B43,0,0x6EF1D3) ; Deinitialize VDFS on fast exit to ensure release of data file @@ -574,7 +574,7 @@ CGameMananager_destruction_deinit_vdfs: ; Jump back mov BYTE [esp+stackoffset-0x4], 0x4 - jmp g1g2(0x423BE1,0x4247D1) + jmp g1g2(0x423BE1,0,0x4247D1) ; Deinitialize VDFS on libExit (fatal error) @@ -587,5 +587,5 @@ libExit_deinit_vdfs: verifyStackoffset ; Jump back - mov eax, g1g2(0x86F51C,0x8D4294) - jmp g1g2(0x4F3C35,0x502AB5) + mov eax, g1g2(0x86F51C,0,0x8D4294) + jmp g1g2(0x4F3C35,0,0x502AB5) diff --git a/src/exec/parse.asm b/src/exec/parse.asm index dc23091..83db5c9 100644 --- a/src/exec/parse.asm +++ b/src/exec/parse.asm @@ -18,7 +18,7 @@ parser_check_func: .back: test eax, eax mov ebp, eax - jnz g1g2(0x6F4980,0x79E1D1) + jnz g1g2(0x6F4980,0,0x79E1D1) %if GOTHIC_BASE_VERSION == 1 push 0x5AE @@ -32,7 +32,7 @@ parser_check_func: global linker_replace_func linker_replace_func: - resetStackoffset g1g2(0xA8,0xE4) + resetStackoffset g1g2(0xA8,0,0xE4) %assign var_symb_content 0x4 %assign var_parser 0x0 push edi @@ -45,7 +45,7 @@ linker_replace_func: mov eax, [ecx+zCPar_Symbol_content_offset] test eax, eax - verifyStackoffset g1g2(0xA8,0xE4) + 0xC + verifyStackoffset g1g2(0xA8,0,0xE4) + 0xC jz .rf_back push eax ; symbol->content @@ -62,7 +62,7 @@ linker_replace_func: call DWORD [ds_lstrcmpiA] addStack 2*4 test eax, eax - verifyStackoffset g1g2(0xA8,0xE4) + 0x14 + verifyStackoffset g1g2(0xA8,0,0xE4) + 0x14 jz .no_rf_back push edi call DWORD [ds_lstrlenA] @@ -76,7 +76,7 @@ linker_replace_func: mov ecx, [ecx+zCParser_stackpos_offset] mov eax, [esp+var_symb_content] ; symbol->content cmp BYTE [eax+ecx], zPAR_TOK_RET - verifyStackoffset g1g2(0xA8,0xE4) + 0x14 + verifyStackoffset g1g2(0xA8,0,0xE4) + 0x14 jz .no_rf_back pop ebp ; parser @@ -87,14 +87,14 @@ linker_replace_func: mov BYTE [eax], zPAR_TOK_JUMP mov [eax+1], ecx sub esp, 0x4 - verifyStackoffset g1g2(0xA8,0xE4) + 0xC + verifyStackoffset g1g2(0xA8,0,0xE4) + 0xC .rf_back: add esp, 0x4 pop ecx pop edi call zCPar_Symbol__SetStackPos - jmp g1g2(0x6E8269,0x7915CC) + jmp g1g2(0x6E8269,0,0x7915CC) .no_rf_back: sub esp, 0x14 @@ -114,13 +114,13 @@ linker_replace_func: pop ebp add esp, 0x14 pop edi - jmp g1g2(0x6E8269,0x7915CC) + jmp g1g2(0x6E8269,0,0x7915CC) global parser_check_var parser_check_var: - resetStackoffset g1g2(0x394,0x3EC) - xor g1g2(edi,ebp), g1g2(edi,ebp) + resetStackoffset g1g2(0x394,0,0x3EC) + xor g1g2(edi,0,ebp), g1g2(edi,0,ebp) mov eax, DWORD [zCParser__enableParsing] ; Check if wrapped by Ninja cmp eax, 0x2A jnz .check_sym @@ -131,24 +131,24 @@ parser_check_var: mov eax, DWORD [esi+zCParser_in_class_offset] ; parser->in_class->name test eax, eax jnz .sub_var - lea ecx, [esp+stackoffset+g1g2(-0x354,-0x3BC)] ; Variable name + lea ecx, [esp+stackoffset+g1g2(-0x354,0,-0x3BC)] ; Variable name push ecx mov ecx, esi call zCParser__GetSymbol_str addStack 4 - mov g1g2(edi,ebp), eax - verifyStackoffset g1g2(0x394,0x3EC) + mov g1g2(edi,0,ebp), eax + verifyStackoffset g1g2(0x394,0,0x3EC) jmp .check_sym .sub_var: sub esp, 0x14 push char_dot push eax ; Prefix (function or class name) - lea eax, [esp+stackoffset+g1g2(-0x3A8,-0x400)] ; New string + lea eax, [esp+stackoffset+g1g2(-0x3A8,0,-0x400)] ; New string push eax call operator_StrPlusChar ; __cdecl add esp, 0xC - mov ecx, DWORD [esp+stackoffset+g1g2(-0x34C,-0x3B4)] ; Variable name + mov ecx, DWORD [esp+stackoffset+g1g2(-0x34C,0,-0x3B4)] ; Variable name push ecx mov ecx, eax call zSTRING__operator_plusEq @@ -157,13 +157,13 @@ parser_check_var: mov ecx, esi call zCParser__GetSymbol_str addStack 4 - mov g1g2(edi,ebp), eax - lea ecx, [esp+stackoffset+g1g2(-0x3A8,-0x400)] ; New string + mov g1g2(edi,0,ebp), eax + lea ecx, [esp+stackoffset+g1g2(-0x3A8,0,-0x400)] ; New string call zSTRING___zSTRING add esp, 0x14 .check_sym: - verifyStackoffset g1g2(0x394,0x3EC) + verifyStackoffset g1g2(0x394,0,0x3EC) %if GOTHIC_BASE_VERSION == 1 test edi, edi @@ -181,7 +181,7 @@ parser_check_var: global parser_check_class parser_check_class: - resetStackoffset g1g2(0x5C,0x50) + resetStackoffset g1g2(0x5C,0,0x50) %if GOTHIC_BASE_VERSION == 2 pop ecx %endif @@ -195,7 +195,7 @@ parser_check_class: call zCPar_SymbolTable__GetSymbol_str addStack 4 test eax, eax - verifyStackoffset g1g2(0x5C,(0x50-0x4)) + verifyStackoffset g1g2(0x5C,0,(0x50-0x4)) ; Jump back %if GOTHIC_BASE_VERSION == 1 @@ -248,7 +248,7 @@ parser_check_prototype: global parser_verify_ikarus_version parser_verify_ikarus_version: - resetStackoffset g1g2(0x398,0x3F0) + resetStackoffset g1g2(0x398,0,0x3F0) %assign var_newvalue 0x04 push eax push ebx @@ -259,7 +259,7 @@ parser_verify_ikarus_version: mov ecx, [esi+zCParser_mergemode_offset] test ecx, ecx - verifyStackoffset g1g2(0x398,0x3F0) + 0x8 + verifyStackoffset g1g2(0x398,0,0x3F0) + 0x8 jz .backClean mov ebx, keep_int_symbol_start @@ -272,7 +272,7 @@ parser_verify_ikarus_version: call DWORD [ds_lstrcmpiA] addStack 2*4 test eax, eax - verifyStackoffset g1g2(0x398,0x3F0) + 0x8 + verifyStackoffset g1g2(0x398,0,0x3F0) + 0x8 jz .skip push ebx call DWORD [ds_lstrlenA] @@ -288,7 +288,7 @@ parser_verify_ikarus_version: call DWORD [ds_lstrcmpiA] addStack 2*4 test eax, eax - verifyStackoffset g1g2(0x398,0x3F0) + 0x8 + verifyStackoffset g1g2(0x398,0,0x3F0) + 0x8 jnz .back reportToSpy NINJA_VERIFY_VERSION @@ -312,7 +312,7 @@ parser_verify_ikarus_version: ; mov ecx, esp ; Never reached: Safe some space ; call zSTRING___zSTRING add esp, 0x14 - verifyStackoffset g1g2(0x398,0x3F0) + 0x8 + verifyStackoffset g1g2(0x398,0,0x3F0) + 0x8 jmp .back .verifyFilePath: @@ -333,12 +333,12 @@ parser_verify_ikarus_version: addStack 2*4 pop eax test eax, eax - verifyStackoffset g1g2(0x398,0x3F0) + 0x8 + verifyStackoffset g1g2(0x398,0,0x3F0) + 0x8 jz .back reportToSpy NINJA_COMPARE_VERSIONS cmp ebx, eax - verifyStackoffset g1g2(0x398,0x3F0) + 0x8 + verifyStackoffset g1g2(0x398,0,0x3F0) + 0x8 jge .back push edi @@ -407,7 +407,7 @@ parser_verify_ikarus_version: call zCPar_Symbol__GetValue addStack 2*4 pop eax - verifyStackoffset g1g2(0x398,0x3F0) + 0x8 + verifyStackoffset g1g2(0x398,0,0x3F0) + 0x8 jmp .backClean .back: @@ -416,18 +416,18 @@ parser_verify_ikarus_version: .backClean: pop ebx add esp, 0x4 - verifyStackoffset g1g2(0x398,0x3F0) + verifyStackoffset g1g2(0x398,0,0x3F0) ; Jump back push eax mov ecx, ebp call zCPar_Symbol__SetValue_int - jmp g1g2(0x6F2459,0x79BDD8) + jmp g1g2(0x6F2459,0,0x79BDD8) global parser_verify_lego_version parser_verify_lego_version: - resetStackoffset g1g2(0x394,0x3EC) + resetStackoffset g1g2(0x394,0,0x3EC) push eax push edx push ebx @@ -438,7 +438,7 @@ parser_verify_lego_version: mov ecx, [esi+zCParser_mergemode_offset] test ecx, ecx - verifyStackoffset g1g2(0x394,0x3EC) + 0xC + verifyStackoffset g1g2(0x394,0,0x3EC) + 0xC jz .back mov ebx, keep_string_symbol_start @@ -451,7 +451,7 @@ parser_verify_lego_version: call DWORD [ds_lstrcmpiA] addStack 2*4 test eax, eax - verifyStackoffset g1g2(0x394,0x3EC) + 0xC + verifyStackoffset g1g2(0x394,0,0x3EC) + 0xC jz .skip push ebx call DWORD [ds_lstrlenA] @@ -466,15 +466,15 @@ parser_verify_lego_version: call DWORD [ds_lstrcmpiA] addStack 2*4 test eax, eax - verifyStackoffset g1g2(0x394,0x3EC) + 0xC + verifyStackoffset g1g2(0x394,0,0x3EC) + 0xC jnz .back reportToSpy NINJA_VERIFY_VERSION - mov ecx, [esp+stackoffset+g1g2(-0x340,-0x394)+0x8] ; str->ptr + mov ecx, [esp+stackoffset+g1g2(-0x340,0,-0x394)+0x8] ; str->ptr push ecx call DWORD [ds_lstrlenA] addStack 4 - mov ecx, [esp+stackoffset+g1g2(-0x340,-0x394)+0x8] ; str->ptr + mov ecx, [esp+stackoffset+g1g2(-0x340,0,-0x394)+0x8] ; str->ptr sub eax, 0x5 ; Expects "...-Nxxx" add ecx, eax cmp BYTE [ecx], '-' @@ -507,7 +507,7 @@ parser_verify_lego_version: ; mov ecx, esp ; Never reached: Safe some space ; call zSTRING___zSTRING add esp, 0x14 - verifyStackoffset g1g2(0x394,0x3EC) + 0xC + verifyStackoffset g1g2(0x394,0,0x3EC) + 0xC jmp .back .verifyFilePath: @@ -516,7 +516,7 @@ parser_verify_lego_version: call ninja_scriptPathInvalid addStack 2*4 test eax, eax - verifyStackoffset g1g2(0x394,0x3EC) + 0xC + verifyStackoffset g1g2(0x394,0,0x3EC) + 0xC jnz .back .compareVersions: @@ -524,7 +524,7 @@ parser_verify_lego_version: lea edx, [eax+edi*0x4] mov eax, [edx+0x8] test eax, eax - verifyStackoffset g1g2(0x394,0x3EC) + 0xC + verifyStackoffset g1g2(0x394,0,0x3EC) + 0xC jz .back reportToSpy NINJA_COMPARE_VERSIONS @@ -532,15 +532,15 @@ parser_verify_lego_version: call ninja_parseVersionString addStack 4 test eax, eax - verifyStackoffset g1g2(0x394,0x3EC) + 0xC + verifyStackoffset g1g2(0x394,0,0x3EC) + 0xC jl .back mov ebx, eax - mov eax, [esp+stackoffset+g1g2(-0x340,-0x394)+0x8] ; str->ptr + mov eax, [esp+stackoffset+g1g2(-0x340,0,-0x394)+0x8] ; str->ptr push eax call ninja_parseVersionString addStack 4 cmp eax, ebx - verifyStackoffset g1g2(0x394,0x3EC) + 0xC + verifyStackoffset g1g2(0x394,0,0x3EC) + 0xC jge .back push edi @@ -604,17 +604,17 @@ parser_verify_lego_version: jmp .backClean .back: - lea ecx, [esp+stackoffset+g1g2(-0x340,-0x394)] + lea ecx, [esp+stackoffset+g1g2(-0x340,0,-0x394)] .backClean: pop ebx pop edx pop eax - verifyStackoffset g1g2(0x394,0x3EC) + verifyStackoffset g1g2(0x394,0,0x3EC) ; Jump back push edi - jmp g1g2(0x6F24B1,0x79BE30) + jmp g1g2(0x6F24B1,0,0x79BE30) global parser_resolve_path_src @@ -630,7 +630,7 @@ parser_resolve_path_src: push NINJA_PATH_IKARUSSRC call zSTRING__zSTRING addStack 4 - jmp g1g2(0x6E6100,0x78F380) + jmp g1g2(0x6E6100,0,0x78F380) verifyStackoffset 0x250 .checkLeGo: @@ -644,11 +644,11 @@ parser_resolve_path_src: push NINJA_PATH_LEGOSRC call zSTRING__zSTRING addStack 4 - jmp g1g2(0x6E6100,0x78F380) + jmp g1g2(0x6E6100,0,0x78F380) verifyStackoffset 0x250 .back: ; Jump back lea ecx, [esp+stackoffset-0x240] call zSTRING__Upper - jmp g1g2(0x6E5F1E,0x78F19E) + jmp g1g2(0x6E5F1E,0,0x78F19E) diff --git a/src/func/allowRedefine.asm b/src/func/allowRedefine.asm index 65be6a4..30f9b28 100644 --- a/src/func/allowRedefine.asm +++ b/src/func/allowRedefine.asm @@ -50,7 +50,7 @@ ninja_allowRedefine: push eax mov eax, [esp+stackoffset+arg_1] - mov eax, [eax+g1g2(0x10A4,0x20A4)] ; parser->line + mov eax, [eax+g1g2(0x10A4,0,0x20A4)] ; parser->line push 0xA push ecx push eax diff --git a/src/func/armParser.asm b/src/func/armParser.asm index f854395..94ca7d5 100644 --- a/src/func/armParser.asm +++ b/src/func/armParser.asm @@ -14,8 +14,8 @@ ninja_armParser: push eax mov eax, DWORD [zCParser__ParseBlock+4] push eax - mov DWORD [zCParser__ParseBlock], g1g2(0xC868FF6A,0x0868FF6A) - mov DWORD [zCParser__ParseBlock+4], g1g2(0x64007C4A,0x640082A6) + mov DWORD [zCParser__ParseBlock], g1g2(0xC868FF6A,0,0x0868FF6A) + mov DWORD [zCParser__ParseBlock+4], g1g2(0x64007C4A,0,0x640082A6) mov eax, DWORD [zCParser__cur_parser] push eax diff --git a/src/func/conEvalFunc.asm b/src/func/conEvalFunc.asm index eaea17f..66f9e04 100644 --- a/src/func/conEvalFunc.asm +++ b/src/func/conEvalFunc.asm @@ -182,7 +182,7 @@ ninja_Y3JjMzI: push ecx mov ecx, esp push eax - call g1g2(0x5CE900, 0x5F9BF0) + call g1g2(0x5CE900,0x5ED6A0,0x5F9BF0) addStack 4 call _itoa add esp, 0xC diff --git a/src/hook_CGameManager_destructor.asm b/src/hook_CGameManager_destructor.asm index 872d69f..fa37a01 100644 --- a/src/hook_CGameManager_destructor.asm +++ b/src/hook_CGameManager_destructor.asm @@ -1,15 +1,10 @@ ; Hook improper destruction of CGameManager to ensure deinitialization of VDFS to release data file %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x423BDC,0x4247CC) + org g1g2(0x423BDC,0,0x4247CC) %endif bits 32 diff --git a/src/hook_Hlp_GetNpc.asm b/src/hook_Hlp_GetNpc.asm index 18f9bb1..4196fee 100644 --- a/src/hook_Hlp_GetNpc.asm +++ b/src/hook_Hlp_GetNpc.asm @@ -1,15 +1,10 @@ ; Add safety check for the external Hlp_GetNpc in case a patch causes to save invalid symbol indices %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6587EC,0x6EEE4C) + org g1g2(0x6587EC,0,0x6EEE4C) %endif bits 32 diff --git a/src/hook_Hlp_IsValidItem.asm b/src/hook_Hlp_IsValidItem.asm index 965284b..a690792 100644 --- a/src/hook_Hlp_IsValidItem.asm +++ b/src/hook_Hlp_IsValidItem.asm @@ -1,15 +1,10 @@ ; Add safety check for the external Hlp_IsValidItem in case a patch causes to save invalid symbol indices %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x658B3E,0x6EF1CE) + org g1g2(0x658B3E,0,0x6EF1CE) %endif bits 32 diff --git a/src/hook_Hlp_IsValidNpc.asm b/src/hook_Hlp_IsValidNpc.asm index c2a3d5f..8a58c62 100644 --- a/src/hook_Hlp_IsValidNpc.asm +++ b/src/hook_Hlp_IsValidNpc.asm @@ -1,15 +1,10 @@ ; Add safety check for the external Hlp_IsValidNpc in case a patch causes to save invalid symbol indices %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x65887E,0x6EEEDE) + org g1g2(0x65887E,0,0x6EEEDE) %endif bits 32 diff --git a/src/hook_archiveWorldCountLogicalNpc.asm b/src/hook_archiveWorldCountLogicalNpc.asm index 183112f..93e6651 100644 --- a/src/hook_archiveWorldCountLogicalNpc.asm +++ b/src/hook_archiveWorldCountLogicalNpc.asm @@ -1,15 +1,10 @@ ; Hook oCWorld::Archive to ignore counting of logical NPC that are non-persistent %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6D652A,0x77F66A) + org g1g2(0x6D652A,0,0x77F66A) %endif bits 32 diff --git a/src/hook_archiveWorldWriteLogicalNpc.asm b/src/hook_archiveWorldWriteLogicalNpc.asm index b922279..826a354 100644 --- a/src/hook_archiveWorldWriteLogicalNpc.asm +++ b/src/hook_archiveWorldWriteLogicalNpc.asm @@ -1,15 +1,10 @@ ; Hook oCWorld::Archive to ignore writing of logical NPC that are non-persistent %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6D65A3,0x77F6E1) + org g1g2(0x6D65A3,0,0x77F6E1) %endif bits 32 diff --git a/src/hook_createVdfArray.asm b/src/hook_createVdfArray.asm index 74be84d..14220ab 100644 --- a/src/hook_createVdfArray.asm +++ b/src/hook_createVdfArray.asm @@ -1,15 +1,10 @@ ; Hook for general initialization %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6019C1,0x630B5C) + org g1g2(0x6019C1,0x62377E,0x630B5C) %endif bits 32 diff --git a/src/hook_deploy_ani_ninja.asm b/src/hook_deploy_ani_ninja.asm index 333099e..2b2feda 100644 --- a/src/hook_deploy_ani_ninja.asm +++ b/src/hook_deploy_ani_ninja.asm @@ -1,15 +1,10 @@ ; Hook reading of animations in zCModelPrototype::ReadAniEnum (g1), zCModelPrototype::ReadAniEnumMSB (g2) %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x57DC40,0x5961CD) + org g1g2(0x57DC40,0,0x5961CD) %endif bits 32 diff --git a/src/hook_deploy_camera_ninja.asm b/src/hook_deploy_camera_ninja.asm index 886eca6..3786b11 100644 --- a/src/hook_deploy_camera_ninja.asm +++ b/src/hook_deploy_camera_ninja.asm @@ -1,15 +1,10 @@ ; Hook camera parser in zCAICamera::StartUp %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x49909E,0x4A0554) + org g1g2(0x49909E,0,0x4A0554) %endif bits 32 @@ -20,6 +15,6 @@ section .text align=1 ; Pre jmp deploy_camera_ninja ; Overwrites - ; resetStackoffset g1g2(0xB4,0xB8) - ; lea g1g2(eax,edx), [esp+stackoffset+g1g2(-0xA1,-0xA5)] - ; push g1g2(eax,edx) + ; resetStackoffset g1g2(0xB4,0,0xB8) + ; lea g1g2(eax,0,edx), [esp+stackoffset+g1g2(-0xA1,0,-0xA5)] + ; push g1g2(eax,0,edx) diff --git a/src/hook_deploy_content_ninja.asm b/src/hook_deploy_content_ninja.asm index 7f2eaf4..20e0427 100644 --- a/src/hook_deploy_content_ninja.asm +++ b/src/hook_deploy_content_ninja.asm @@ -1,15 +1,10 @@ ; Hook content parser in oCGame::Init %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6371F1,0x6C12A0) + org g1g2(0x6371F1,0,0x6C12A0) %endif bits 32 @@ -21,6 +16,6 @@ section .text align=1 ; Pre nop ; Overwrites - ; resetStackoffset g1g2(0x94,0x84) + ; resetStackoffset g1g2(0x94,0,0x84) ; push 0x1 - ; lea ecx, [esp+stackoffset+g1g2(-0x44,-0x1C)] + ; lea ecx, [esp+stackoffset+g1g2(-0x44,0,-0x1C)] diff --git a/src/hook_deploy_fightai_ninja.asm b/src/hook_deploy_fightai_ninja.asm index 8f1e7fc..4e34ee4 100644 --- a/src/hook_deploy_fightai_ninja.asm +++ b/src/hook_deploy_fightai_ninja.asm @@ -1,15 +1,10 @@ ; Hook fight AI parser in oCNpc::InitFightAI %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x747EBA,0x67C626) + org g1g2(0x747EBA,0,0x67C626) %endif bits 32 @@ -20,6 +15,6 @@ section .text align=1 ; Pre jmp deploy_fightai_ninja ; Overwrites - ; resetStackoffset g1g2(0x7C,0x64) - ; lea g1g2(edx,eax), [esp+stackoffset+g1g2(-0x69,-0x51)] - ; push g1g2(edx,eax) + ; resetStackoffset g1g2(0x7C,0,0x64) + ; lea g1g2(edx,0,eax), [esp+stackoffset+g1g2(-0x69,0,-0x51)] + ; push g1g2(edx,0,eax) diff --git a/src/hook_deploy_menu_ninja.asm b/src/hook_deploy_menu_ninja.asm index ba622a9..158fa09 100644 --- a/src/hook_deploy_menu_ninja.asm +++ b/src/hook_deploy_menu_ninja.asm @@ -1,15 +1,10 @@ ; Hook menu parser in zCMenu::Startup %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x4CD57A,0x4DA196) + org g1g2(0x4CD57A,0,0x4DA196) %endif bits 32 diff --git a/src/hook_deploy_music_ninja.asm b/src/hook_deploy_music_ninja.asm index e157238..ebb7a6c 100644 --- a/src/hook_deploy_music_ninja.asm +++ b/src/hook_deploy_music_ninja.asm @@ -1,15 +1,10 @@ ; Hook music parser in zCMusicSys_DirectMusic::zCMusicSys_DirectMusic %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x4DA448,0x4E765C) + org g1g2(0x4DA448,0,0x4E765C) %endif bits 32 @@ -20,6 +15,6 @@ section .text align=1 ; Pre jmp deploy_music_ninja ; Overwrites - ; resetStackoffset g1g2(0xD8,0xC8) - ; lea edx, [esp+stackoffset+g1g2(-0xC5,-0xB5)] + ; resetStackoffset g1g2(0xD8,0,0xC8) + ; lea edx, [esp+stackoffset+g1g2(-0xC5,0,-0xB5)] ; push edx diff --git a/src/hook_deploy_ou_ninja.asm b/src/hook_deploy_ou_ninja.asm index 34e80e2..61c0297 100644 --- a/src/hook_deploy_ou_ninja.asm +++ b/src/hook_deploy_ou_ninja.asm @@ -1,15 +1,10 @@ ; Hook OU loader in/after zCCSManager::LibForceToLoad %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x41BE77,0x41C407) + org g1g2(0x41BE77,0,0x41C407) %endif bits 32 diff --git a/src/hook_deploy_pfx_ninja.asm b/src/hook_deploy_pfx_ninja.asm index 3944093..db8ea02 100644 --- a/src/hook_deploy_pfx_ninja.asm +++ b/src/hook_deploy_pfx_ninja.asm @@ -1,15 +1,10 @@ ; Hook PFX parser in zCParticleFX::ParseParticleFXScript %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x58CA22,0x5AC7BC) + org g1g2(0x58CA22,0,0x5AC7BC) %endif bits 32 @@ -20,6 +15,6 @@ section .text align=1 ; Pre jmp deploy_pfx_ninja ; Overwrites - ; resetStackoffset g1g2(0x8C,0xC8) - ; lea eax, [esp+stackoffset+g1g2(-0x79,-0xB5)] + ; resetStackoffset g1g2(0x8C,0,0xC8) + ; lea eax, [esp+stackoffset+g1g2(-0x79,0,-0xB5)] ; push eax diff --git a/src/hook_deploy_sfx_ninja.asm b/src/hook_deploy_sfx_ninja.asm index 515c1cf..8a89d8d 100644 --- a/src/hook_deploy_sfx_ninja.asm +++ b/src/hook_deploy_sfx_ninja.asm @@ -1,15 +1,10 @@ ; Hook SFX parser in zCSndSys_MSS::zCSndSys_MSS %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x4DD88C,0x4EAE8B) + org g1g2(0x4DD88C,0,0x4EAE8B) %endif bits 32 @@ -20,6 +15,6 @@ section .text align=1 ; Pre jmp deploy_sfx_ninja ; Overwrites - ; resetStackoffset g1g2(0x304,0x308) - ; lea g1g2(ecx,eax), [esp+stackoffset+g1g2(-0x2F2,-0x2F6)] - ; push g1g2(ecx,eax) + ; resetStackoffset g1g2(0x304,0,0x308) + ; lea g1g2(ecx,0,eax), [esp+stackoffset+g1g2(-0x2F2,0,-0x2F6)] + ; push g1g2(ecx,0,eax) diff --git a/src/hook_deploy_vfx_ninja.asm b/src/hook_deploy_vfx_ninja.asm index f60933d..3ec5062 100644 --- a/src/hook_deploy_vfx_ninja.asm +++ b/src/hook_deploy_vfx_ninja.asm @@ -1,15 +1,10 @@ ; Hook VFX parser in oCVisualFX::InitParser %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x483A3C,0x48B6EF) + org g1g2(0x483A3C,0,0x48B6EF) %endif bits 32 @@ -20,6 +15,6 @@ section .text align=1 ; Pre jmp deploy_vfx_ninja ; Overwrites - ; resetStackoffset g1g2(0x248,0x250) - ; lea g1g2(edx,eax), [esp+stackoffset+g1g2(-0x239,0x235)] - ; push g1g2(edx,eax) + ; resetStackoffset g1g2(0x248,0,0x250) + ; lea g1g2(edx,0,eax), [esp+stackoffset+g1g2(-0x239,0,0x235)] + ; push g1g2(edx,0,eax) diff --git a/src/hook_fastexit.asm b/src/hook_fastexit.asm index 4363ff2..ed7a640 100644 --- a/src/hook_fastexit.asm +++ b/src/hook_fastexit.asm @@ -1,15 +1,10 @@ ; Hook fast exit to ensure deinitialization of VDFS to release data file %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x4249B2,0x4256AF) + org g1g2(0x4249B2,0,0x4256AF) %endif bits 32 diff --git a/src/hook_init_content.asm b/src/hook_init_content.asm index e913007..388bc5c 100644 --- a/src/hook_init_content.asm +++ b/src/hook_init_content.asm @@ -2,15 +2,10 @@ ; In Gothic 1 there is no Init_Global, instead call AFTER Init_[World] %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x637F84,0x6C20C3) + org g1g2(0x637F84,0,0x6C20C3) %endif bits 32 diff --git a/src/hook_init_menu.asm b/src/hook_init_menu.asm index b59e9c2..ae70585 100644 --- a/src/hook_init_menu.asm +++ b/src/hook_init_menu.asm @@ -1,15 +1,10 @@ ; Hook menu creation in zCMenu::SetByScript %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x4CE90F,0x4DB4FF) + org g1g2(0x4CE90F,0,0x4DB4FF) %endif bits 32 diff --git a/src/hook_libExit.asm b/src/hook_libExit.asm index 826c941..bcb401e 100644 --- a/src/hook_libExit.asm +++ b/src/hook_libExit.asm @@ -1,15 +1,10 @@ ; Hook libExit(void) to ensure deinitialization of VDFS to release data file %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x4F3C30,0x502AB0) + org g1g2(0x4F3C30,0,0x502AB0) %endif bits 32 diff --git a/src/hook_linkerReplaceFunc.asm b/src/hook_linkerReplaceFunc.asm index 1ffde26..7272c22 100644 --- a/src/hook_linkerReplaceFunc.asm +++ b/src/hook_linkerReplaceFunc.asm @@ -1,15 +1,10 @@ ; Hook function linking in zCParser::PushOnStack %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6E79C1,0x790CA8) + org g1g2(0x6E79C1,0,0x790CA8) %endif bits 32 diff --git a/src/hook_npcReference.asm b/src/hook_npcReference.asm index cb55a6e..8ba260a 100644 --- a/src/hook_npcReference.asm +++ b/src/hook_npcReference.asm @@ -1,15 +1,10 @@ ; Hook oCNpc::CleanUp to remove instance references %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x68C0F6,0x72E625) + org g1g2(0x68C0F6,0,0x72E625) %endif bits 32 diff --git a/src/hook_oCSpawnManager__Archive.asm b/src/hook_oCSpawnManager__Archive.asm index 1f42b55..068388f 100644 --- a/src/hook_oCSpawnManager__Archive.asm +++ b/src/hook_oCSpawnManager__Archive.asm @@ -1,15 +1,10 @@ ; Hook oCSpawnManager::Archive %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6D0F40,0x7797F0) + org g1g2(0x6D0F40,0,0x7797F0) %endif bits 32 diff --git a/src/hook_parserDeclareClass.asm b/src/hook_parserDeclareClass.asm index f56facd..c9647a6 100644 --- a/src/hook_parserDeclareClass.asm +++ b/src/hook_parserDeclareClass.asm @@ -1,15 +1,10 @@ ; Hook class parsing in zCParser::DeclareClass %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6F2B21,0x79C432) + org g1g2(0x6F2B21,0,0x79C432) %endif bits 32 diff --git a/src/hook_parserDeclareFunc.asm b/src/hook_parserDeclareFunc.asm index 4708b3e..5220c2a 100644 --- a/src/hook_parserDeclareFunc.asm +++ b/src/hook_parserDeclareFunc.asm @@ -1,15 +1,10 @@ ; Hook function parsing in zCParser::DeclareFunc %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6F494E,0x79E1AE) + org g1g2(0x6F494E,0,0x79E1AE) %endif bits 32 diff --git a/src/hook_parserDeclarePrototype.asm b/src/hook_parserDeclarePrototype.asm index 2f125aa..fb152ff 100644 --- a/src/hook_parserDeclarePrototype.asm +++ b/src/hook_parserDeclarePrototype.asm @@ -1,15 +1,10 @@ ; Hook prototype parsing in zCParser::DeclarePrototype %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6F36B2,0x79CF72) + org g1g2(0x6F36B2,0,0x79CF72) %endif bits 32 diff --git a/src/hook_parserDeclareVar.asm b/src/hook_parserDeclareVar.asm index dab9f81..866ce14 100644 --- a/src/hook_parserDeclareVar.asm +++ b/src/hook_parserDeclareVar.asm @@ -1,15 +1,10 @@ ; Hook variable parsing in zCParser::DeclareVar %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6F18CD,0x79B3B5) + org g1g2(0x6F18CD,0,0x79B3B5) %endif bits 32 diff --git a/src/hook_parserDeclareVar_constInt.asm b/src/hook_parserDeclareVar_constInt.asm index 01218fe..501a349 100644 --- a/src/hook_parserDeclareVar_constInt.asm +++ b/src/hook_parserDeclareVar_constInt.asm @@ -1,15 +1,10 @@ ; Overwrite the setting of a integer constant %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6F2451,0x79BDD0) + org g1g2(0x6F2451,0,0x79BDD0) %endif bits 32 diff --git a/src/hook_parserDeclareVar_constString.asm b/src/hook_parserDeclareVar_constString.asm index a7ef37f..986c586 100644 --- a/src/hook_parserDeclareVar_constString.asm +++ b/src/hook_parserDeclareVar_constString.asm @@ -1,15 +1,10 @@ ; Overwrite the setting of a string constant %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6F24AC,0x79BE2B) + org g1g2(0x6F24AC,0,0x79BE2B) %endif bits 32 diff --git a/src/hook_parserParseSource.asm b/src/hook_parserParseSource.asm index 7dd772c..a4ff839 100644 --- a/src/hook_parserParseSource.asm +++ b/src/hook_parserParseSource.asm @@ -1,15 +1,10 @@ ; Resolve 'Ikarus' and 'LeGo' in SRC files when parsing %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6E5F19,0x78F199) + org g1g2(0x6E5F19,0,0x78F199) %endif bits 32 diff --git a/src/hook_setVobToTransient.asm b/src/hook_setVobToTransient.asm index a406c83..0a26ca0 100644 --- a/src/hook_setVobToTransient.asm +++ b/src/hook_setVobToTransient.asm @@ -1,15 +1,10 @@ ; Hook oCNpc::InitByScript to set dontWriteToArchive flag for instances from patches %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x68CB31,0x72F161) + org g1g2(0x68CB31,0,0x72F161) %endif bits 32 diff --git a/src/hook_unarchiveInfoMan.asm b/src/hook_unarchiveInfoMan.asm index 62d2490..ebfbe6c 100644 --- a/src/hook_unarchiveInfoMan.asm +++ b/src/hook_unarchiveInfoMan.asm @@ -1,15 +1,10 @@ ; Hook after oCInfoManager::Unarchive in oCGame::LoadSavegame to add new infos to the info manager %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x63C7EE,0x6C6D1E) + org g1g2(0x63C7EE,0,0x6C6D1E) %endif bits 32 diff --git a/src/hook_unarchiveNpcs.asm b/src/hook_unarchiveNpcs.asm index 7772550..3b6e0f7 100644 --- a/src/hook_unarchiveNpcs.asm +++ b/src/hook_unarchiveNpcs.asm @@ -1,15 +1,10 @@ ; Hook oCWorld::Unarchive to catch invalid oCNpc objects %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6D6823,0x77F9BB) + org g1g2(0x6D6823,0,0x77F9BB) %endif bits 32 diff --git a/src/hook_unarchiveVobs.asm b/src/hook_unarchiveVobs.asm index 0b58d6c..7e60e9c 100644 --- a/src/hook_unarchiveVobs.asm +++ b/src/hook_unarchiveVobs.asm @@ -1,15 +1,10 @@ ; Hook zCWorld::UnarcTraverseVobs to catch invalid oCNpc objects %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x5F8149,0x62678A) + org g1g2(0x5F8149,0,0x62678A) %endif bits 32 diff --git a/src/hook_zCPar_Symbol__GetNext.asm b/src/hook_zCPar_Symbol__GetNext.asm index 5380dc3..1e0e31e 100644 --- a/src/hook_zCPar_Symbol__GetNext.asm +++ b/src/hook_zCPar_Symbol__GetNext.asm @@ -1,15 +1,10 @@ ; Hook retrieval of next Daedalus symbol in zCPar_Symbol::GetNext %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6F84D0,0x7A1DD0) + org g1g2(0x6F84D0,0,0x7A1DD0) %endif bits 32 diff --git a/src/hook_zCParser__LoadGlobalVars.asm b/src/hook_zCParser__LoadGlobalVars.asm index 1c4843f..d1db8f5 100644 --- a/src/hook_zCParser__LoadGlobalVars.asm +++ b/src/hook_zCParser__LoadGlobalVars.asm @@ -1,15 +1,10 @@ ; Hook loading of global Daedalus symbols in zCParser::LoadGlobalVars %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6EDAD5,0x7973E1) + org g1g2(0x6EDAD5,0,0x7973E1) %endif bits 32 diff --git a/src/inc/engine.inc b/src/inc/engine.inc index eb33d45..8790714 100644 --- a/src/inc/engine.inc +++ b/src/inc/engine.inc @@ -6,6 +6,10 @@ %include "inc/engine_g1.inc" + %elif GOTHIC_BASE_VERSION == 112 + + %include "inc/engine_g112.inc" + %elif GOTHIC_BASE_VERSION == 2 %include "inc/engine_g2.inc" diff --git a/src/inc/engine_g1.inc b/src/inc/engine_g1.inc index 12e67c1..cf87fe1 100644 --- a/src/inc/engine_g1.inc +++ b/src/inc/engine_g1.inc @@ -137,6 +137,7 @@ %define char_timer 0x8510CC ; 'timer', 0 %define char_noOfEntries 0x8510E4 ; 'NoOfEntries', 0 %define char_spawningEnabled 0x8510BC ; 'spawningEnabled', 0 + %define char_zStartupWindowed 0x846978 ; 'zStartupWindowed', 0 %define char_settings 0x82BD98 ; 'SETTINGS', 0 %define char_meatbug_mds 0x84E358 ; 'Meatbug.mds', 0 diff --git a/src/inc/engine_g112.inc b/src/inc/engine_g112.inc new file mode 100644 index 0000000..58c2cf3 --- /dev/null +++ b/src/inc/engine_g112.inc @@ -0,0 +1,239 @@ +%ifndef ENGINE_G112_INC + %define ENGINE_G112_INC + + %define _atexit 0x7BA3DB ; void (__cdecl *)() + %define _exit 0x7BB68A ; void + %define operator_new 0x5670A0 ; uint + %define operator_new_len 0x5670E0 ; uint, char const *, char const *, int + %define operator_delete 0x5670B0 ; void * + %define _memset 0x7C6DB0 ; void *, int, size_t + %define dynamic_cast 0x7BAE5A ; void **, int, TypeDescriptor *, TypeDescriptor *, int + %define operator_StrPlusChar 0x404F30 ; zSTRING const &, char const * + %define zCArray_int___zCArray_int_ 0x5619C0 ; void + %define zCArray_int___InsertEnd 0x4D9010 ; int const & + %define zCArray_int____zCArray_int_ 0x5619C0 ; void + %define zCArraySort_int___QuickSort 0x631890 ; void + %define _qsort 0x7BB33F ; void *, size_t, size_t, int (__cdecl *)(const void *, const void *) + %define _fopen 0x7BC432 ; const char *, const char * + %define _fseek 0x7BC348 ; FILE *, __int32, int + %define _fread 0x7BC811 ; void *, size_t, size_t, FILE * + %define _fclose 0x7BC57E ; FILE * + %define _findfirst 0x7BC928 ; const char *, finddata_t * + %define _findnext 0x7BC9F5 ; int, _finddata_t * + %define _findclose 0x7BCABD ; int + %define zFILE_VDFS__LockCriticalSection 0x44D120 ; void + %define zFILE_VDFS__UnlockCriticalSection 0x44D140 ; void + %define zFILE_cur_mds_file 0x8B9BC4 ; zFILE * + %define zFILE_VDFS__DeinitFileSystem 0x44CD90 ; void + %define std__basic_string__assign 0x403480 ; char const *, uint + %define _atol 0x7BB50D ; const char * + %define _itoa 0x7CC64A ; int, char *, int + %define zSTRING__zSTRING 0x4010C0 ; char const * + %define zSTRING__zSTRING_void 0x402F90 ; void + %define zSTRING___zSTRING 0x401160 ; void + %define zSTRING__Sprintf 0x46F9F0 ; char const *, ... + %define zSTRING__Upper 0x46D090 ; void + %define zSTRING__Search 0x46F650 ; int, char const *, uint + %define zSTRING__TrimRight 0x46F4A0 ; char + %define zSTRING__Delete 0x46E710 ; uint, ulong + %define zSTRING__DeleteRight 0x46E600 ; uint + %define zSTRING__operator_eq 0x4D5310 ; char const * + %define zSTRING__operator_plusEq 0x66C7D0 ; char const * + %define ds_lstrcatA 0x8132E0 ; LPTSTR, LPTSTR + %define ds_lstrcpyA 0x81328C ; LPTSTR, LPTSTR + %define ds_lstrlenA 0x813278 ; LPCSTR + %define ds_lstrcmpiA 0x8132D0 ; LPCSTR, LPCSTR + %define _strncmp 0x7C95F0 ; char *, char *, int + %define ds_vdf_fexists 0x8134B4 ; const char*, long + %define zCParser_parser 0x925048 ; zCParser + %define zCParser__CallFunc 0x722640 ; zSTRING const & + %define zCParser__ParseBlock 0x71F8E0 ; void + %define zCParser__Error 0x71DA20 ; zSTRING &, int + %define zCParser__MergeFile 0x721270 ; zSTRING & + %define zCParser__GetIndex 0x723120 ; zSTRING const & + %define zCParser__GetSymbol_str 0x723580 ; zSTRING const & + %define zCParser__GetSymbolInfo 0x7234A0 ; int, int &, int & + %define zCParser__GetInstance 0x7233F0 ; int, int + %define zCParser__CreateInstance 0x722C10 ; int, void * + %define zCParser__cur_parser 0x926214 ; zCParser * + %define zCParser__enableParsing 0x92620C ; int + %define zCParser__ClearInstanceRefs 0x726840 ; void * + %define zCPar_SymbolTable__Insert 0x7347C0 ; zCPar_Symbol * + %define zCPar_SymbolTable__GetIndex 0x734330 ; zCPar_Symbol * + %define zCPar_SymbolTable__GetIndex_str 0x734420 ; zSTRING const & + %define zCPar_SymbolTable__GetSymbol_int 0x7347A0 ; int + %define zCPar_SymbolTable__GetSymbol_str 0x734700 ; zSTRING const & + %define zCPar_SymbolTable__cur_table 0x9263D4 ; zCPar_SymbolTable * + %define zCPar_Symbol__zCPar_Symbol 0x731E80 ; void + %define zCPar_Symbol__SetFlag 0x7326D0 ; int + %define zCPar_Symbol__GetValue 0x732950 ; int &, int + %define zCPar_Symbol__SetValue_int 0x7327A0 ; int, int + %define zCPar_Symbol__SetValue_str 0x732800 ; zSTRING &, int + %define zCPar_Symbol__SetStackPos 0x732790 ; int, int + %define zCMusicSys_DirectMusic__musicParser 0x8B31FC ; zCParser * + %define zCSndSys_MSS__sfxParser 0x8B38C0 ; zCParser * + %define zCParticleFX__s_pfxParser 0x8BA204 ; zCParser * + %define oCVisualFX__fxParser 0x8AF4EC ; zCParser * + %define zCMenu__menuParser 0x8B2F04 ; zCParser * + %define zCAICamera__cameraParser 0x8AFB5C ; zCParser * + %define zCSoundSystem_zsound 0x914D14 ; zCSoundSystem * + %define oCGame_ogame 0x920D8C ; oCGame * + %define oCGame__GetInfoManager 0x65F030 ; void + %define oCMissionManager_misMan 0x921C50 ; oCMissionManager* + %define oCNpc__classDef 0x922830 ; zCClassDef + %define oCItem__classDef 0x921950 ; zCClassDef + %define zCObject__CheckInheritance 0x478FF0 ; zCClassDef const *, zCClassDef const * + %define oCWorld__InsertInLists 0x70F1C0 ; zCVob * + %define oCWorld__RemoveFromLists 0x70F2B0 ; zCVob * + %define zCConsole_zcon 0x9247D8 ; zCConsole * + %define zCConsole__AddEvalFunc 0x713CF0 ; int (*)(zSTRING const &, zSTRING &) + %define zCConsole__Register 0x7115D0 ; zSTRING const &, zSTRING const & + %define zERROR_zerr 0x8AE718 ; zERROR * + %define zERROR__SearchForSpy 0x4501B0 ; void + %define zERROR__Report 0x44E2B0 ; zERROR_TYPE, int, zSTRING const &, signed char, uint, int, char *, char * + %define zERROR__Message 0x44F510 ; zSTRING const & + %define zERROR__Fatal 0x44F580 ; zSTRING const & + %define zCOption_zoptions 0x8AE3AC ; zCOption * + + %define zCOption__ReadString 0x4648E0 ; zSTRING const &, char const *, char const * + %define zCOption__GetDirString 0x467400 ; zTOptionPaths + %define zCOption__ParmValue 0x467540 ; zSTRING const & + %define zCObjectFactory_zfactory 0x8B9E00 ; zCObjectFactory * + %define zCModelPrototype__ReadModel 0x598C60 ; void + %define zCModelPrototype__SearchAniIndex 0x588C60 ; zSTRING const & + %define zCModelAni__deleting_destructor 0x583900 ; uint + %define zCArchiverFactory__CreateArchiverRead 0x51EEF0 ; zFILE *, int + %define zCArchiverFactory_zarcFactory 0x8B561C ; zCArchiverFactory + %define zCCSManager__LibValidateOU 0x41DCB0 ; zString * + %define zCCSManager__LibAddOU 0x41D930 ; zCCSBlock * + %define zCCSLib___CreateNewInstance 0x41A3A0 ; void + %define zCCSLib__deleting_destructor 0x41ADB0 ; uint + %define zCCSBlock__deleting_destructor 0x40E1D0 ; uint + %define zCListSort__GetNumInList 0x69E530 ; void + %define zCListSort__InsertSort 0x70FE00 ; void * + %define oCInfo__oCInfo 0x6927A0 ; void + %define oCInfo__SetInstance 0x692950 ; int + %define oCInfo__DoCheck 0x692B00 ; void + %define oCNpc_RTTI_Type_Descriptor 0x872E80 ; TypeDescriptor + + + %define NINJA_PATCH_ARRAY 0x875EF1 ; zCArray + + %define char_NUL 0x8A2634 ; 0 + %define char_space 0x87719C ; ' ', 0 + %define char_cnpc 0x88EE54 ; 'C_NPC', 0 + %define char_model 0x8864F4 ; 'MODEL', 0 + %define char_mds 0x8790A0 ; '.MDS', 0 + %define char_src 0x898490 ; '.SRC', 0 + %define char_dot 0x870DAC ; '.', 0 + %define char_commaSpace 0x878024 ; ', ', 0 + %define char_BSlash 0x8738B8 ; '\', 0 + %define char_doubleFSlash 0x874900 ; '//', 0 + %define char_lf 0x873018 ; 0xA, 0 + %define char_line 0x898414 ; ' ( line ', 0 + %define char_spaceClosingParanthesis 0x898410 ; ' )', 0 + %define char_npc 0x89742C ; 'npc', 0 + %define char_spawnPos 0x897420 ; 'spawnPos', 0 + %define char_timer 0x897418 ; 'timer', 0 + %define char_noOfEntries 0x897430 ; 'NoOfEntries', 0 + %define char_spawningEnabled 0x897408 ; 'spawningEnabled', 0 + + %define char_zStartupWindowed 0x88C634 ; 'zStartupWindowed', 0 + + %define char_meatbug_mds 0x8944B0 ; 'Meatbug.mds', 0 + %define char_redefinedIdentifier 0x898934 ; 'Redefined identifier : ', 0 + %define zSTRING_mdlBuffer 0x8B9AA8 ; zSTRING * + %define zSTRING_infoClass 0x921538 ; zSTRING + %define zSTRING_empty 0x8AE6A8 ; zSTRING const + %define zOPT_SEC_GAME 0x8AE058 ; zSTRING const + + %define zCObjectFactory__CreateZFile_offset 0x14 ; zSTRING const & + %define zFILE_VDFS__Exists_offset 0x94 ; void + %define zFILE_VDFS__Open_offset 0x8C ; bool + %define zFILE_VDFS__Eof_offset 0xB0 ; void + %define zFILE_VDFS__Read_offset 0xC4 ; zSTRING & + %define zFILE_VDFS__Close_offset 0x98 ; void + %define zFILE_VDFS__deleting_destructor_offset 0x0 ; uint + + %define zCArchiver__ReadObject_offset 0xB0 ; zCObject * + %define zCArchiver__Close_offset 0xE0 ; void + %define zCArchiver__deleting_destructor_offset 0xC ; uint + + %define zCParser_file_offset 0x4 + %define zCParser_table_offset 0x10 + %define zCParser_lastsym_offset 0x34 + %define zCParser_stackpos_offset 0x48 + %define zCParser_stringcount_offset 0x10D0 + %define zCParser_in_func_offset 0x10D4 ; zCPar_Symbol * + %define zCParser_in_class_offset 0x10D8 ; zCPar_Symbol * + %define zCParser_datsave_offset 0x1090 + %define zCParser_mergemode_offset 0x109C + + %define zCPar_Symbol_content_offset 0x18 + %define zCPar_Symbol_offset_offset 0x1C + %define zCPar_Symbol_bitfield_offset 0x20 + + %define zPAR_TOK_RET 0x3C + %define zPAR_TOK_JUMP 0x4B + + %define zPAR_TYPE_INT 2<<12 + %define zPAR_TYPE_STRING 3<<12 + %define zPAR_TYPE_PROTOTYPE 6<<12 + %define zPAR_TYPE_INSTANCE 7<<12 + + %define zPAR_FLAG_CONST 1<<16 + + %define char_sep 0x1A + %define INVALID_HANDLE_VALUE 0xFFFFFFFF + %define VDF_VIRTUAL 1 + %define VDF_PHYSICAL 2 + %define VDF_PHYSICALFIRST 4 + %define VDF_TYPE_DIR 0x80000000 + %define VDF_TYPE_LAST 0x40000000 + + %define DIR_ANIMS 4 + + %define SEEK_SET 0 + + struc zCArray + .array: resd 0x1 ; 0x0 T* + .numAlloc: resd 0x1 ; 0x4 int + .numInArray: resd 0x1 ; 0x8 int + endstruc + + struc zCArraySort + .array: resd 0x1 ; 0x0 T* + .numAlloc: resd 0x1 ; 0x4 int + .numInArray: resd 0x1 ; 0x8 int + .compare: resd 0x1 ; 0xC int (__cdecl *)(void *, void *) + endstruc + + struc finddata_t + .attrib resd 0x1 ; 0x00 + .time_create resd 0x1 ; 0x04 + .time_access resd 0x1 ; 0x08 + .time_write resd 0x1 ; 0x0C + .size resd 0x1 ; 0x10 + .name resb 0x104 ; 0x14 + endstruc + + struc VDFheader + .comment resb 0x100 ; 0x000 char[] + .signature resb 0x10 ; 0x100 char[] + .numEntries resd 0x1 ; 0x110 int + .numFiles resd 0x1 ; 0x114 int + .timestamp resd 0x1 ; 0x118 int + .datasize resd 0x1 ; 0x11C int + .rootOffset resd 0x1 ; 0x120 int + .entrySize resd 0x1 ; 0x124 int + endstruc + + struc VDFentry + .name resb 0x40 ; 0x00 char[] + .offset resd 0x1 ; 0x40 int + .size resd 0x1 ; 0x44 int + .type resd 0x1 ; 0x48 int + .attrib resd 0x1 ; 0x4C int + endstruc + +%endif diff --git a/src/inc/macros.inc b/src/inc/macros.inc index 53f4e02..6e99a61 100644 --- a/src/inc/macros.inc +++ b/src/inc/macros.inc @@ -3,9 +3,9 @@ ; Sanity check %ifndef GOTHIC_BASE_VERSION - %fatal "Macro GOTHIC_BASE_VERSION must be defined (1 or 2)." - %elif GOTHIC_BASE_VERSION != 1 && GOTHIC_BASE_VERSION != 2 - %fatal "GOTHIC_BASE_VERSION must either be 1 or 2." + %fatal "Macro GOTHIC_BASE_VERSION must be defined (1, 112, or 2)." + %elif GOTHIC_BASE_VERSION != 1 && GOTHIC_BASE_VERSION != 112 && GOTHIC_BASE_VERSION != 2 + %fatal "GOTHIC_BASE_VERSION must either be 1, 112, or 2." %endif ; General macros @@ -16,9 +16,11 @@ %define LEGO_N_VERSION %!LEGO_N_VERSION %define MAX_VDF_TIME 0x7F9FBF7D ; 2043-12-23 23:59:58 %if GOTHIC_BASE_VERSION == 1 - %define g1g2(g1,g2) g1 + %define g1g2(g1,g112,g2) g1 + %elif GOTHIC_BASE_VERSION == 112 + %define g1g2(g1,g112,g2) g112 %elif GOTHIC_BASE_VERSION == 2 - %define g1g2(g1,g2) g2 + %define g1g2(g1,g112,g2) g2 %endif %include "inc/stackops.inc" diff --git a/src/inc/symbols.inc b/src/inc/symbols.inc new file mode 100644 index 0000000..1afd388 --- /dev/null +++ b/src/inc/symbols.inc @@ -0,0 +1,18 @@ +%ifndef SYMBOLS_INC + %define SYMBOLS_INC + + ; Version dependent macros + %if GOTHIC_BASE_VERSION == 1 + + %include "inc/symbols_g1.inc" + + %elif GOTHIC_BASE_VERSION == 112 + + %include "inc/symbols_g112.inc" + + %elif GOTHIC_BASE_VERSION == 2 + + %include "inc/symbols_g2.inc" + + %endif +%endif diff --git a/src/ow_ani.asm b/src/ow_ani.asm index 37940c3..0787233 100644 --- a/src/ow_ani.asm +++ b/src/ow_ani.asm @@ -2,15 +2,10 @@ %include "inc/macros.inc" %include "inc/engine.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x57D639,0x59C406) + org g1g2(0x57D639,0,0x59C406) %endif bits 32 @@ -18,27 +13,27 @@ bits 32 section .text align=1 ; Prevent auto-alignment - resetStackoffset g1g2(0xF54,0x1310) + resetStackoffset g1g2(0xF54,0,0x1310) push eax ; Existing zCModelAni * - mov ecx, [esp+stackoffset+g1g2(-0xF24,-0x12C8)] + mov ecx, [esp+stackoffset+g1g2(-0xF24,0,-0x12C8)] push ecx - mov edx, [esp+stackoffset+g1g2(-0xF44,-0x12FC)] + mov edx, [esp+stackoffset+g1g2(-0xF44,0,-0x12FC)] add edx, 0x24 call zCModelPrototype__SearchAniIndex ; __fastcall pop ecx mov ecx, [ecx+0x48] - mov edx, [esp+stackoffset+g1g2(-0xF44,-0x12FC)] + mov edx, [esp+stackoffset+g1g2(-0xF44,0,-0x12FC)] mov [ecx+eax*0x4], edx ; New ani pop ecx ; Old ani mov eax, [ecx+0x4] dec eax ; Decrease refCtr mov [ecx+0x4], eax cmp eax, 0 - verifyStackoffset g1g2(0xF54,0x1310) - jg g1g2(0x57D8F8,0x59C6C3) ; Continue + verifyStackoffset g1g2(0xF54,0,0x1310) + jg g1g2(0x57D8F8,0,0x59C6C3) ; Continue push 0x1 ; If refCtr <= 0 then call zCModelAni__deleting_destructor addStack 4 - verifyStackoffset g1g2(0xF54,0x1310) - jmp g1g2(0x57D8F8,0x59C6C3) + verifyStackoffset g1g2(0xF54,0,0x1310) + jmp g1g2(0x57D8F8,0,0x59C6C3) ; Room to 0x57D69A (g1), 0x59C459 (g2) diff --git a/src/ow_aniAlias.asm b/src/ow_aniAlias.asm index 6c592b0..3101b4d 100644 --- a/src/ow_aniAlias.asm +++ b/src/ow_aniAlias.asm @@ -2,15 +2,10 @@ %include "inc/macros.inc" %include "inc/engine.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x579D54,0x597AA7) + org g1g2(0x579D54,0,0x597AA7) %endif bits 32 @@ -18,28 +13,28 @@ bits 32 section .text align=1 ; Prevent auto-alignment - resetStackoffset g1g2(0xF54,0x12E8) + resetStackoffset g1g2(0xF54,0,0x12E8) push eax ; Existing zCModelAni * - mov ecx, [esp+stackoffset+g1g2(-0xF24,-0x12A0)] ; zCModelPrototype * + mov ecx, [esp+stackoffset+g1g2(-0xF24,0,-0x12A0)] ; zCModelPrototype * push ecx - mov edx, g1g2(edi,ebp) ; New zCModelAni->name + mov edx, g1g2(edi,0,ebp) ; New zCModelAni->name call zCModelPrototype__SearchAniIndex ; __fastcall pop ecx mov ecx, [ecx+0x48] %if GOTHIC_BASE_VERSION == 1 mov edx, [esp+stackoffset-0xF38] ; New zCModelAni * %endif - mov [ecx+eax*0x4], g1g2(edx,edi) ; New ani + mov [ecx+eax*0x4], g1g2(edx,0,edi) ; New ani pop ecx ; Old ani mov eax, [ecx+0x4] dec eax ; Decrease refCtr mov [ecx+0x4], eax cmp eax, 0 - verifyStackoffset g1g2(0xF54,0x12E8) - jg g1g2(0x579DC2,0x597B10) ; Continue + verifyStackoffset g1g2(0xF54,0,0x12E8) + jg g1g2(0x579DC2,0,0x597B10) ; Continue push 0x1 ; If refCtr <= 0 then call zCModelAni__deleting_destructor addStack 4 - verifyStackoffset g1g2(0xF54,0x12E8) - jmp g1g2(0x579DC2,0x597B10) ; Continue + verifyStackoffset g1g2(0xF54,0,0x12E8) + jmp g1g2(0x579DC2,0,0x597B10) ; Continue ; Room to 0x579DB5 (g1), 0x597AFA (g2) diff --git a/src/ow_aniBatch.asm b/src/ow_aniBatch.asm index fc0a237..2724c1e 100644 --- a/src/ow_aniBatch.asm +++ b/src/ow_aniBatch.asm @@ -2,15 +2,10 @@ %include "inc/macros.inc" %include "inc/engine.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x57A72A,0x59875B) + org g1g2(0x57A72A,0,0x59875B) %endif bits 32 @@ -18,9 +13,9 @@ bits 32 section .text align=1 ; Prevent auto-alignment - resetStackoffset g1g2(0xF54,0x128C) + resetStackoffset g1g2(0xF54,0,0x128C) push eax ; Existing zCModelAni * - mov ecx, [esp+stackoffset+g1g2(-0xF24,-0x1244)] ; zCModelPrototype * + mov ecx, [esp+stackoffset+g1g2(-0xF24,0,-0x1244)] ; zCModelPrototype * push ecx %if GOTHIC_BASE_VERSION == 1 mov edx, [esp+stackoffset-0xF38] ; New zCModelAni * @@ -34,17 +29,17 @@ section .text align=1 ; Pre %if GOTHIC_BASE_VERSION == 1 mov edx, [esp+stackoffset-0xF38] %endif - mov [ecx+eax*0x4], g1g2(edx,ebp) ; New ani + mov [ecx+eax*0x4], g1g2(edx,0,ebp) ; New ani pop ecx ; Old ani mov eax, [ecx+0x4] dec eax ; Decrease refCtr mov [ecx+0x4], eax cmp eax, 0 - verifyStackoffset g1g2(0xF54,0x128C) - jg g1g2(0x57A795,0x5987C4) ; Continue + verifyStackoffset g1g2(0xF54,0,0x128C) + jg g1g2(0x57A795,0,0x5987C4) ; Continue push 0x1 ; If refCtr <= 0 then call zCModelAni__deleting_destructor addStack 4 - verifyStackoffset g1g2(0xF54,0x128C) - jmp g1g2(0x57A795,0x5987C4) ; Continue + verifyStackoffset g1g2(0xF54,0,0x128C) + jmp g1g2(0x57A795,0,0x5987C4) ; Continue ; Room to 0x57A783 (g1), 0x5987AE (g2) diff --git a/src/ow_aniBlend.asm b/src/ow_aniBlend.asm index 4f3b469..2b4b2c5 100644 --- a/src/ow_aniBlend.asm +++ b/src/ow_aniBlend.asm @@ -2,15 +2,10 @@ %include "inc/macros.inc" %include "inc/engine.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x57A17C,0x598065) + org g1g2(0x57A17C,0,0x598065) %endif bits 32 @@ -18,28 +13,28 @@ bits 32 section .text align=1 ; Prevent auto-alignment - resetStackoffset g1g2(0xF54,0x12D4) + resetStackoffset g1g2(0xF54,0,0x12D4) push eax ; Existing zCModelAni * - mov ecx, [esp+stackoffset+g1g2(-0xF24,(-0x129C+0x10))] ; zCModelPrototype * + mov ecx, [esp+stackoffset+g1g2(-0xF24,0,(-0x129C+0x10))] ; zCModelPrototype * push ecx - mov edx, g1g2(edi,ebp) ; New zCModelAni->name + mov edx, g1g2(edi,0,ebp) ; New zCModelAni->name call zCModelPrototype__SearchAniIndex ; __fastcall pop ecx mov ecx, [ecx+0x48] %if GOTHIC_BASE_VERSION == 1 mov edx, [esp+stackoffset-0xF38] ; New zCModelAni * %endif - mov [ecx+eax*0x4], g1g2(edx,edi) ; New ani + mov [ecx+eax*0x4], g1g2(edx,0,edi) ; New ani pop ecx ; Old ani mov eax, [ecx+0x4] dec eax ; Decrease refCtr mov [ecx+0x4], eax cmp eax, 0 - verifyStackoffset g1g2(0xF54,0x12D4) - jg g1g2(0x57A1EA,0x5980CE) ; Continue + verifyStackoffset g1g2(0xF54,0,0x12D4) + jg g1g2(0x57A1EA,0,0x5980CE) ; Continue push 0x1 ; If refCtr <= 0 then call zCModelAni__deleting_destructor addStack 4 - verifyStackoffset g1g2(0xF54,0x12D4) - jmp g1g2(0x57A1EA,0x5980CE) ; Continue + verifyStackoffset g1g2(0xF54,0,0x12D4) + jmp g1g2(0x57A1EA,0,0x5980CE) ; Continue ; Room to 0x57A1C7 (g1), 0x5980A9 (g2) diff --git a/src/ow_aniComb.asm b/src/ow_aniComb.asm index 2fd1b21..59e1d34 100644 --- a/src/ow_aniComb.asm +++ b/src/ow_aniComb.asm @@ -2,15 +2,10 @@ %include "inc/macros.inc" %include "inc/engine.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x57B169,0x599456) + org g1g2(0x57B169,0,0x599456) %endif bits 32 @@ -18,7 +13,7 @@ bits 32 section .text align=1 ; Prevent auto-alignment - resetStackoffset g1g2(0xF54,0x12EC) + resetStackoffset g1g2(0xF54,0,0x12EC) push eax ; Existing zCModelAni * %if GOTHIC_BASE_VERSION == 1 mov ecx, [esp+stackoffset-0xF24] ; zCModelPrototype * @@ -26,24 +21,24 @@ section .text align=1 ; Pre mov ecx, edi %endif push ecx - mov edx, g1g2(edi,ebx) ; New zCModelAni->name + mov edx, g1g2(edi,0,ebx) ; New zCModelAni->name call zCModelPrototype__SearchAniIndex ; __fastcall pop ecx mov ecx, [ecx+0x48] %if GOTHIC_BASE_VERSION == 1 mov edx, [esp+stackoffset-0xF38] ; New zCModelAni * %endif - mov [ecx+eax*0x4], g1g2(edx,ebp) ; New ani + mov [ecx+eax*0x4], g1g2(edx,0,ebp) ; New ani pop ecx ; Old ani mov eax, [ecx+0x4] dec eax ; Decrease refCtr mov [ecx+0x4], eax cmp eax, 0 - verifyStackoffset g1g2(0xF54,0x12EC) - jg g1g2(0x57A1EA,0x5994BB) ; Continue + verifyStackoffset g1g2(0xF54,0,0x12EC) + jg g1g2(0x57A1EA,0,0x5994BB) ; Continue push 0x1 ; If refCtr <= 0 then call zCModelAni__deleting_destructor addStack 4 - verifyStackoffset g1g2(0xF54,0x12EC) - jmp g1g2(0x57A1EA,0x5994BB) ; Continue + verifyStackoffset g1g2(0xF54,0,0x12EC) + jmp g1g2(0x57A1EA,0,0x5994BB) ; Continue ; Room to 0x57B1CA (g1), 0x5994A9 (g2) diff --git a/src/ow_aniDisable.asm b/src/ow_aniDisable.asm index f363ce2..3641157 100644 --- a/src/ow_aniDisable.asm +++ b/src/ow_aniDisable.asm @@ -2,15 +2,10 @@ %include "inc/macros.inc" %include "inc/engine.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x57B372,0x599783) + org g1g2(0x57B372,0,0x599783) %endif bits 32 @@ -18,28 +13,28 @@ bits 32 section .text align=1 ; Prevent auto-alignment - resetStackoffset g1g2(0xF54,0x12C0) + resetStackoffset g1g2(0xF54,0,0x12C0) push eax ; Existing zCModelAni * - mov ecx, [esp+stackoffset+g1g2(-0xF24,(-0x1284+0xC))] ; zCModelPrototype * + mov ecx, [esp+stackoffset+g1g2(-0xF24,0,(-0x1284+0xC))] ; zCModelPrototype * push ecx - mov edx, g1g2(edi,ebp) ; New zCModelAni->name + mov edx, g1g2(edi,0,ebp) ; New zCModelAni->name call zCModelPrototype__SearchAniIndex ; __fastcall pop ecx mov ecx, [ecx+0x48] %if GOTHIC_BASE_VERSION == 1 mov edx, [esp+stackoffset-0xF38] ; New zCModelAni * %endif - mov [ecx+eax*0x4], g1g2(edx,edi) ; New ani + mov [ecx+eax*0x4], g1g2(edx,0,edi) ; New ani pop ecx ; Old ani mov eax, [ecx+0x4] dec eax ; Decrease refCtr mov [ecx+0x4], eax cmp eax, 0 - verifyStackoffset g1g2(0xF54,0x12C0) - jg g1g2(0x57B3DD,0x5980CE) ; Continue + verifyStackoffset g1g2(0xF54,0,0x12C0) + jg g1g2(0x57B3DD,0,0x5980CE) ; Continue push 0x1 ; If refCtr <= 0 then call zCModelAni__deleting_destructor addStack 4 - verifyStackoffset g1g2(0xF54,0x12C0) - jmp g1g2(0x57B3DD,0x5980CE) ; Continue + verifyStackoffset g1g2(0xF54,0,0x12C0) + jmp g1g2(0x57B3DD,0,0x5980CE) ; Continue ; Room to 0x57B3CB (g1), 0x5997CE (g2) diff --git a/src/ow_aniSync.asm b/src/ow_aniSync.asm index 32fa164..ca2d804 100644 --- a/src/ow_aniSync.asm +++ b/src/ow_aniSync.asm @@ -2,15 +2,10 @@ %include "inc/macros.inc" %include "inc/engine.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x57A4A5,0x5984E1) + org g1g2(0x57A4A5,0,0x5984E1) %endif bits 32 @@ -18,28 +13,28 @@ bits 32 section .text align=1 ; Prevent auto-alignment - resetStackoffset g1g2(0xF54,0x12C4) + resetStackoffset g1g2(0xF54,0,0x12C4) push eax ; Existing zCModelAni * - mov ecx, [esp+stackoffset+g1g2(-0xF24,(-0x1284+0x8))] ; zCModelPrototype * + mov ecx, [esp+stackoffset+g1g2(-0xF24,0,(-0x1284+0x8))] ; zCModelPrototype * push ecx - mov edx, g1g2(edi,ebp) ; New zCModelAni->name + mov edx, g1g2(edi,0,ebp) ; New zCModelAni->name call zCModelPrototype__SearchAniIndex ; __fastcall pop ecx mov ecx, [ecx+0x48] %if GOTHIC_BASE_VERSION == 1 mov edx, [esp+stackoffset-0xF38] ; New zCModelAni * %endif - mov [ecx+eax*0x4], g1g2(edx,edi) ; New ani + mov [ecx+eax*0x4], g1g2(edx,0,edi) ; New ani pop ecx ; Old ani mov eax, [ecx+0x4] dec eax ; Decrease refCtr mov [ecx+0x4], eax cmp eax, 0 - verifyStackoffset g1g2(0xF54,0x12C4) - jg g1g2(0x57A1EA,0x59854A) ; Continue + verifyStackoffset g1g2(0xF54,0,0x12C4) + jg g1g2(0x57A1EA,0,0x59854A) ; Continue push 0x1 ; If refCtr <= 0 then call zCModelAni__deleting_destructor addStack 4 - verifyStackoffset g1g2(0xF54,0x12C4) - jmp g1g2(0x57A1EA,0x59854A) ; Continue + verifyStackoffset g1g2(0xF54,0,0x12C4) + jmp g1g2(0x57A1EA,0,0x59854A) ; Continue ; Room to 0x57A4FD (g1), 0x598534 (g2) diff --git a/src/ow_parserDeclareClass_showOverwrite.asm b/src/ow_parserDeclareClass_showOverwrite.asm index 7a919fb..dbec3ac 100644 --- a/src/ow_parserDeclareClass_showOverwrite.asm +++ b/src/ow_parserDeclareClass_showOverwrite.asm @@ -1,15 +1,10 @@ ; Overwrite error message during parsing in zCParser::DeclareClass %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6F2B99,0x79C4AA) + org g1g2(0x6F2B99,0,0x79C4AA) %endif bits 32 @@ -24,4 +19,4 @@ section .text align=1 ; Pre call ninja_allowRedefine addStack 2*4 verifyStackoffset 0x4C - jmp g1g2(0x6F2BEA,0x79C4FB) + jmp g1g2(0x6F2BEA,0,0x79C4FB) diff --git a/src/ow_parserDeclareFunc_showOverwrite.asm b/src/ow_parserDeclareFunc_showOverwrite.asm index 8d101bb..5056a5d 100644 --- a/src/ow_parserDeclareFunc_showOverwrite.asm +++ b/src/ow_parserDeclareFunc_showOverwrite.asm @@ -1,15 +1,10 @@ ; Overwrite error message during parsing in zCParser::DeclareFunc %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6F49C1,0x79E212) + org g1g2(0x6F49C1,0,0x79E212) %endif bits 32 @@ -24,4 +19,4 @@ section .text align=1 ; Pre call ninja_allowRedefine addStack 2*4 verifyStackoffset 0xA4 - jmp g1g2(0x6F49FD,0x79E24E) + jmp g1g2(0x6F49FD,0,0x79E24E) diff --git a/src/ow_parserDeclarePrototype_showOverwrite.asm b/src/ow_parserDeclarePrototype_showOverwrite.asm index 86d37e5..c4d289c 100644 --- a/src/ow_parserDeclarePrototype_showOverwrite.asm +++ b/src/ow_parserDeclarePrototype_showOverwrite.asm @@ -1,15 +1,10 @@ ; Overwrite error message during parsing in zCParser::DeclarePrototype %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6F3753,0x79D004) + org g1g2(0x6F3753,0,0x79D004) %endif bits 32 @@ -24,4 +19,4 @@ section .text align=1 ; Pre call ninja_allowRedefine addStack 2*4 verifyStackoffset 0xB8 - jmp g1g2(0x6F3794,0x79D045) + jmp g1g2(0x6F3794,0,0x79D045) diff --git a/src/ow_parserDeclareVar_showOverwrite.asm b/src/ow_parserDeclareVar_showOverwrite.asm index f965941..c474a86 100644 --- a/src/ow_parserDeclareVar_showOverwrite.asm +++ b/src/ow_parserDeclareVar_showOverwrite.asm @@ -1,15 +1,10 @@ ; Overwrite error message during parsing in zCParser::DeclareVar %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6F2113,0x79BABF) + org g1g2(0x6F2113,0,0x79BABF) %endif bits 32 @@ -17,11 +12,11 @@ bits 32 section .text align=1 ; Prevent auto-alignment - resetStackoffset g1g2(0x394,0x3EC) + resetStackoffset g1g2(0x394,0,0x3EC) mov eax, [ebp+0x8] push eax push esi call ninja_allowRedefine addStack 2*4 - verifyStackoffset g1g2(0x394,0x3EC) - jmp g1g2(0x6F215B,0x79BB07) + verifyStackoffset g1g2(0x394,0,0x3EC) + jmp g1g2(0x6F215B,0,0x79BB07) diff --git a/src/ow_playerInfoName1.asm b/src/ow_playerInfoName1.asm index e39c75f..5fefe72 100644 --- a/src/ow_playerInfoName1.asm +++ b/src/ow_playerInfoName1.asm @@ -2,15 +2,10 @@ %include "inc/macros.inc" %include "inc/engine.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x4618DB,0x466FCE) + org g1g2(0x4618DB,0,0x466FCE) %endif bits 32 diff --git a/src/ow_playerInfoName2.asm b/src/ow_playerInfoName2.asm index fcd5ad3..332dd02 100644 --- a/src/ow_playerInfoName2.asm +++ b/src/ow_playerInfoName2.asm @@ -2,15 +2,10 @@ %include "inc/macros.inc" %include "inc/engine.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x462475,0x467B15) + org g1g2(0x462475,0,0x467B15) %endif bits 32 diff --git a/src/ow_playerInfoName3.asm b/src/ow_playerInfoName3.asm index 2d69610..34e01ea 100644 --- a/src/ow_playerInfoName3.asm +++ b/src/ow_playerInfoName3.asm @@ -2,15 +2,10 @@ %include "inc/macros.inc" %include "inc/engine.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x4626FA,0x467DC2) + org g1g2(0x4626FA,0,0x467DC2) %endif bits 32 diff --git a/src/ow_playerInfoName4.asm b/src/ow_playerInfoName4.asm index bff17f1..d488471 100644 --- a/src/ow_playerInfoName4.asm +++ b/src/ow_playerInfoName4.asm @@ -2,15 +2,10 @@ %include "inc/macros.inc" %include "inc/engine.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x462F13,0x46860A) + org g1g2(0x462F13,0,0x46860A) %endif bits 32 diff --git a/src/ow_playerInfoName5.asm b/src/ow_playerInfoName5.asm index 463ca3b..fc7949f 100644 --- a/src/ow_playerInfoName5.asm +++ b/src/ow_playerInfoName5.asm @@ -2,15 +2,10 @@ %include "inc/macros.inc" %include "inc/engine.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x46AAD7,0x46FF1B) + org g1g2(0x46AAD7,0,0x46FF1B) %endif bits 32 diff --git a/src/ow_reopenFileWarning.asm b/src/ow_reopenFileWarning.asm index 2898f86..e5a7257 100644 --- a/src/ow_reopenFileWarning.asm +++ b/src/ow_reopenFileWarning.asm @@ -1,15 +1,10 @@ ; Remove warning when opening already opened file %include "inc/macros.inc" - -%if GOTHIC_BASE_VERSION == 1 - %include "inc/symbols_g1.inc" -%elif GOTHIC_BASE_VERSION == 2 - %include "inc/symbols_g2.inc" -%endif +%include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x5CE925,0x5F9C15) + org g1g2(0x5CE925,0,0x5F9C15) %endif bits 32 diff --git a/verifySize.bat b/verifySize.bat index 1350dcc..c1fcc8c 100644 --- a/verifySize.bat +++ b/verifySize.bat @@ -1,15 +1,18 @@ :: :: Verify file size :: -:: Arguments: BINFILE GOTHIC-BASE-VERSION(1 or 2) +:: Arguments: BINFILE GOTHIC-BASE-VERSION(1, 112, or 2) :: @ECHO OFF :: Sanity check IF [%1] == [] GOTO usage IF [%2] == [] GOTO usage -IF %2 LSS 1 GOTO usage -IF %2 GTR 2 GOTO usage +IF %2 EQU 1 GOTO start +IF %2 EQU 112 GOTO start +IF %2 NEQ 2 GOTO usage + +:start SET gothic=%2 :: Parse file name @@ -20,8 +23,9 @@ SET filename=%~nx1 IF NOT EXIST %filefull% ECHO File '%filefull%' not found.&& EXIT /B 1 :: Set size limits in bytes corresponding to the available address range -IF %gothic% == 1 SET SIZELIMIT=11280 -IF %gothic% == 2 SET SIZELIMIT=11904 +IF %gothic% == 1 SET SIZELIMIT=11280 +IF %gothic% == 112 SET SIZELIMIT=12096 +IF %gothic% == 2 SET SIZELIMIT=11904 :: Check file size against limit SET FILESIZE=%~z1 @@ -30,4 +34,4 @@ IF %FILESIZE% GTR %SIZELIMIT% ECHO %filename% exceeds %SIZELIMIT% bytes (%FILESI EXIT /B :usage -ECHO Usage: %~nx0 BINFILE GOTHIC-BASE-VERSION(1 or 2) +ECHO Usage: %~nx0 BINFILE GOTHIC-BASE-VERSION(1, 112, or 2) From 66aefe9f5ad9f9127f6073e2275bf2c0562c1306 Mon Sep 17 00:00:00 2001 From: szapp Date: Fri, 14 Jul 2023 15:05:09 +0200 Subject: [PATCH 2/9] Add addresses to functions --- README.md | 2 +- getBinList.bat | 3 +++ src/func/allowRedefine.asm | 2 +- src/func/armParser.asm | 4 ++-- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8d14802..77b11c4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Ninja -This repository contains the source code of the Ninja extension for Gothic 1 and Gothic 2 NotR. +This repository contains the source code of the Ninja extension for Gothic, Gothic Sequel, and Gothic 2 NotR. If you are interested in developing patches with Ninja, please follow the instructions in the relevant chapters of the [documentation](https://github.com/szapp/Ninja/wiki). diff --git a/getBinList.bat b/getBinList.bat index 315a3db..d7e0ba7 100644 --- a/getBinList.bat +++ b/getBinList.bat @@ -34,6 +34,9 @@ COPY /Y NUL "%outfile%" >NUL SET gothic=1 FOR %%N IN ("%indir%") DO CALL :fileloop %%N || EXIT /B 3 ECHO/>> %outfile% +SET gothic=112 +FOR %%N IN ("%indir%") DO CALL :fileloop %%N || EXIT /B 3 +ECHO/>> %outfile% SET gothic=2 FOR %%N IN ("%indir%") DO CALL :fileloop %%N || EXIT /B 3 diff --git a/src/func/allowRedefine.asm b/src/func/allowRedefine.asm index 30f9b28..f5e3b79 100644 --- a/src/func/allowRedefine.asm +++ b/src/func/allowRedefine.asm @@ -50,7 +50,7 @@ ninja_allowRedefine: push eax mov eax, [esp+stackoffset+arg_1] - mov eax, [eax+g1g2(0x10A4,0,0x20A4)] ; parser->line + mov eax, [eax+g1g2(0x10A4,0x10A4,0x20A4)] ; parser->line push 0xA push ecx push eax diff --git a/src/func/armParser.asm b/src/func/armParser.asm index 94ca7d5..22e8fed 100644 --- a/src/func/armParser.asm +++ b/src/func/armParser.asm @@ -14,8 +14,8 @@ ninja_armParser: push eax mov eax, DWORD [zCParser__ParseBlock+4] push eax - mov DWORD [zCParser__ParseBlock], g1g2(0xC868FF6A,0,0x0868FF6A) - mov DWORD [zCParser__ParseBlock+4], g1g2(0x64007C4A,0,0x640082A6) + mov DWORD [zCParser__ParseBlock], g1g2(0xC868FF6A,0x1868FF6A,0x0868FF6A) + mov DWORD [zCParser__ParseBlock+4], g1g2(0x64007C4A,0x6400807C,0x640082A6) mov eax, DWORD [zCParser__cur_parser] push eax From ab3a80e9ae19bc0e6a395a8a86aa50bf17bbe04d Mon Sep 17 00:00:00 2001 From: szapp Date: Thu, 20 Jul 2023 10:05:47 +0200 Subject: [PATCH 3/9] Get the core parsing running for 1.12f --- Makefile | 17 ++++- src/core.asm | 2 + src/exec/deploy.asm | 89 ++++++++++++------------ src/exec/init.asm | 15 ++-- src/exec/misc.asm | 22 +++--- src/func/initContent.asm | 2 +- src/func/initMenu.asm | 2 +- src/hook_CGameManager_destructor.asm | 2 +- src/hook_archiveWorldCountLogicalNpc.asm | 2 +- src/hook_archiveWorldWriteLogicalNpc.asm | 2 +- src/hook_deploy_ani_ninja.asm | 8 +-- src/hook_deploy_camera_ninja.asm | 6 +- src/hook_deploy_content_ninja.asm | 7 +- src/hook_deploy_fightai_ninja.asm | 8 +-- src/hook_deploy_menu_ninja.asm | 2 +- src/hook_deploy_music_ninja.asm | 8 +-- src/hook_deploy_ou_ninja.asm | 2 +- src/hook_deploy_pfx_ninja.asm | 8 +-- src/hook_deploy_sfx_ninja.asm | 8 +-- src/hook_deploy_vfx_ninja.asm | 15 ++-- src/hook_init_content.asm | 8 +-- src/hook_init_menu.asm | 6 +- src/hook_zCPar_Symbol__GetNext.asm | 2 +- src/inc/engine_g1.inc | 3 + src/inc/engine_g112.inc | 5 +- src/inc/engine_g2.inc | 3 + 26 files changed, 142 insertions(+), 112 deletions(-) diff --git a/Makefile b/Makefile index aa1f79f..c5ad650 100644 --- a/Makefile +++ b/Makefile @@ -140,6 +140,21 @@ BIN_BASE := core \ ow_playerInfoName3 \ ow_playerInfoName4 \ ow_playerInfoName5 +BIN_BASE_G112 := core \ + hook_createVdfArray \ + hook_deploy_ani_ninja \ + hook_deploy_camera_ninja \ + hook_deploy_content_ninja \ + hook_deploy_fightai_ninja \ + hook_deploy_menu_ninja \ + hook_deploy_music_ninja \ + hook_deploy_ou_ninja \ + hook_deploy_pfx_ninja \ + hook_deploy_sfx_ninja \ + hook_deploy_vfx_ninja \ + hook_init_menu \ + hook_init_content \ + hook_zCPar_Symbol__GetNext BIN_BASE_G2 := ow_zCParser__LoadGlobalVars \ skip_writeAniBinFile_ModelTag \ skip_writeAniBinFile_ReadMeshAndTree \ @@ -180,7 +195,7 @@ DATA_BASE := symbols \ messages BINARIES_G1 := $(BIN_BASE:%=$(BINDIR)%_g1) -BINARIES_G112 := # $(BIN_BASE:%=$(BINDIR)%_g112) +BINARIES_G112 := $(BIN_BASE_G112:%=$(BINDIR)%_g112) BINARIES_G2 := $(BIN_BASE:%=$(BINDIR)%_g2) $(BIN_BASE_G2:%=$(BINDIR)%_g2) FUNC := $(FUNC_BASE:%=$(FUNCDIR)%$(ASMEXT)) EXEC := $(EXEC_BASE:%=$(EXECDIR)%$(ASMEXT)) diff --git a/src/core.asm b/src/core.asm index 58dbb3e..fbd0678 100644 --- a/src/core.asm +++ b/src/core.asm @@ -19,8 +19,10 @@ section .text %include "exec/createVdfArray.asm" %include "exec/deploy.asm" %include "exec/init.asm" +%if GOTHIC_BASE_VERSION != 112 %include "exec/parse.asm" %include "exec/misc.asm" +%endif %include "func/freeVdfArray.asm" %include "func/dispatch.asm" diff --git a/src/exec/deploy.asm b/src/exec/deploy.asm index 8d473a8..f6f4194 100644 --- a/src/exec/deploy.asm +++ b/src/exec/deploy.asm @@ -2,7 +2,7 @@ global deploy_music_ninja deploy_music_ninja: - resetStackoffset g1g2(0xD8,0,0xC8) + resetStackoffset g1g2(0xD8,0xB0,0xC8) pusha push ninja_injectSrc push NINJA_PATH_MUSIC @@ -11,17 +11,17 @@ deploy_music_ninja: call ninja_armParser addStack 3*4 popa - verifyStackoffset g1g2(0xD8,0,0xC8) + verifyStackoffset g1g2(0xD8,0xB0,0xC8) ; Jump back - lea edx, [esp+stackoffset+g1g2(-0xC5,0,-0xB5)] - push edx - jmp g1g2(0x4DA44D,0,0x4E7661) + lea g1g2(edx,eax,edx), [esp+stackoffset+g1g2(-0xC5,-0x9D,-0xB5)] + push g1g2(edx,eax,edx) + jmp g1g2(0x4DA448,0x4EB55C,0x4E765C)+5 global deploy_sfx_ninja deploy_sfx_ninja: - resetStackoffset g1g2(0x304,0,0x308) + resetStackoffset g1g2(0x304,0x2F8,0x308) pusha push ninja_injectSrc push NINJA_PATH_SFX @@ -30,17 +30,17 @@ deploy_sfx_ninja: call ninja_armParser addStack 3*4 popa - verifyStackoffset g1g2(0x304,0,0x308) + verifyStackoffset g1g2(0x304,0x2F8,0x308) ; Jump back - lea g1g2(ecx,0,eax), [esp+stackoffset+g1g2(-0x2F2,0,-0x2F6)] - push g1g2(ecx,0,eax) - jmp g1g2(0x4DD891,0,0x4EAE90) + lea g1g2(ecx,eax,eax), [esp+stackoffset+g1g2(-0x2F2,0x2E5,-0x2F6)] + push g1g2(ecx,eax,eax) + jmp g1g2(0x4DD88C,0x4EECDC,0x4EAE8B)+5 global deploy_pfx_ninja deploy_pfx_ninja: - resetStackoffset g1g2(0x8C,0,0xC8) + resetStackoffset g1g2(0x8C,0x7C,0xC8) pusha push ninja_injectSrc push NINJA_PATH_PFX @@ -49,17 +49,17 @@ deploy_pfx_ninja: call ninja_armParser addStack 3*4 popa - verifyStackoffset g1g2(0x8C,0,0xC8) + verifyStackoffset g1g2(0x8C,0x7C,0xC8) ; Jump back - lea eax, [esp+stackoffset+g1g2(-0x79,0,-0xB5)] - push eax - jmp g1g2(0x58CA27,0,0x5AC7C1) + lea g1g2(eax,ecx,eax), [esp+stackoffset+g1g2(-0x79,-0x69,-0xB5)] + push g1g2(eax,ecx,eax) + jmp g1g2(0x58CA22,0x5A7F33,0x5AC7BC)+5 global deploy_vfx_ninja deploy_vfx_ninja: - resetStackoffset g1g2(0x248,0,0x250) + resetStackoffset g1g2(0x248,0x234,0x250) pusha push ninja_injectSrc push NINJA_PATH_VFX @@ -68,12 +68,16 @@ deploy_vfx_ninja: call ninja_armParser addStack 3*4 popa - verifyStackoffset g1g2(0x248,0,0x250) + verifyStackoffset g1g2(0x248,0x234,0x250) ; Jump back +%if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 2 lea g1g2(edx,0,eax), [esp+stackoffset+g1g2(-0x239,0,-0x235)] +%elif GOTHIC_BASE_VERSION == 112 + mov [esp+stackoffset-0x21C], cl +%endif push g1g2(edx,0,eax) - jmp g1g2(0x483A41,0,0x48B6F4) + jmp g1g2(0x483A3C,0x48EB1F,0x48B6EF)+5 global deploy_ou_ninja @@ -92,7 +96,8 @@ deploy_ou_ninja: global deploy_content_ninja deploy_content_ninja: - resetStackoffset g1g2(0x90,0,0x80) + resetStackoffset g1g2(0x90,0x7C,0x80) + call sysEvent ; Overwritten pusha push ninja_injectSrc push NINJA_PATH_CONTENT @@ -100,30 +105,28 @@ deploy_content_ninja: call ninja_armParser addStack 3*4 popa - verifyStackoffset g1g2(0x90,0,0x80) + verifyStackoffset g1g2(0x90,0x7C,0x80) ; Jump back - push 0x1 - lea ecx, [esp+stackoffset+g1g2(-0x44,0,-0x1C)] - jmp g1g2(0x6371F7,0,0x6C12A6) + jmp g1g2(0x637208,0x65D5A1,0x6C12B7)+5 global deploy_fightai_ninja deploy_fightai_ninja: - resetStackoffset g1g2(0x7C,0,0x64) + resetStackoffset g1g2(0x7C,0x50,0x64) pusha push ninja_injectSrc push NINJA_PATH_FIGHT - push ebx + push g1g2(ebx,ebp,ebx) call ninja_armParser addStack 3*4 popa - verifyStackoffset g1g2(0x7C,0,0x64) + verifyStackoffset g1g2(0x7C,0x50,0x64) ; Jump back - lea g1g2(edx,0,eax), [esp+stackoffset+g1g2(-0x69,0,-0x51)] - push g1g2(edx,0,eax) - jmp g1g2(0x747EBF,0,0x67C62B) + lea g1g2(edx,edx,eax), [esp+stackoffset+g1g2(-0x69,-0x34,-0x51)] + push g1g2(edx,edx,eax) + jmp g1g2(0x747EBA,0x788F52,0x67C626)+5 global deploy_menu_ninja @@ -141,12 +144,12 @@ deploy_menu_ninja: ; Jump back mov eax, DWORD [zCSoundSystem_zsound] - jmp g1g2(0x4CD57F,0,0x4DA19B) + jmp g1g2(0x4CD57A,0x4DDC34,0x4DA196)+5 global deploy_camera_ninja deploy_camera_ninja: - resetStackoffset g1g2(0xB4,0,0xB8) + resetStackoffset g1g2(0xB4,0x9C,0xB8) pusha push ninja_injectSrc push NINJA_PATH_CAMERA @@ -155,22 +158,22 @@ deploy_camera_ninja: call ninja_armParser addStack 3*4 popa - verifyStackoffset g1g2(0xB4,0,0xB8) + verifyStackoffset g1g2(0xB4,0x9C,0xB8) ; Jump back - lea g1g2(eax,0,edx), [esp+stackoffset+g1g2(-0xA1,0,-0xA5)] - push g1g2(eax,0,edx) - jmp g1g2(0x4990A3,0,0x4A0559) + lea g1g2(eax,edx,edx), [esp+stackoffset+g1g2(-0xA1,-0x89,-0xA5)] + push g1g2(eax,edx,edx) + jmp g1g2(0x49909E,0x4A6138,0x4A0554)+5 global deploy_ani_ninja deploy_ani_ninja: -%if GOTHIC_BASE_VERSION == 1 +%if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 - resetStackoffset 0xF54 + resetStackoffset g1g2(0xF54,0xFD8,0x0) pusha - mov ebp, [esp+stackoffset-0xF24] ; zCModelPrototype * + mov ebp, [esp+stackoffset-g1g2(0xF24,0xFA8,0x0)] ; zCModelPrototype * mov esi, [ebp+0x14] ; name->ptr push esi mov esi, DWORD [zFILE_cur_mds_file] @@ -179,7 +182,7 @@ deploy_ani_ninja: call DWORD [ds_lstrcmpiA] addStack 2*4 test eax, eax - verifyStackoffset 0xF54+32 ; Base + pusha + verifyStackoffset g1g2(0xF54,0xFD8,0x0)+32 ; Base + pusha jnz .back sub esp, 0x120 mov eax, esp @@ -200,9 +203,9 @@ deploy_ani_ninja: .back: popa - verifyStackoffset 0xF54 - cmp [esp+stackoffset-0xE88], ebp - jmp 0x57DC47 + verifyStackoffset g1g2(0xF54,0xFD8,0x0) + cmp [esp+stackoffset-g1g2(0xE88,0xF20,0x0)], ebp + jmp g1g2(0x57DC40,0x598474,0x0)+7 %elif GOTHIC_BASE_VERSION == 2 @@ -230,6 +233,6 @@ deploy_ani_ninja: ; Jump back mov eax, [esp+stackoffset-0x3E0] - jmp 0x5961D4 + jmp 0x5961CD+7 %endif diff --git a/src/exec/init.asm b/src/exec/init.asm index 6ede94b..faddb10 100644 --- a/src/exec/init.asm +++ b/src/exec/init.asm @@ -2,7 +2,8 @@ global init_menu init_menu: - resetStackoffset 0x2C + resetStackoffset g1g2(0x34,0x3C,0x34) + call zCArraySort_zCMenu___InsertSort ; Overwritten pusha push ninja_initMenu push char_src @@ -10,12 +11,10 @@ init_menu: call ninja_dispatch addStack 3*4 popa - verifyStackoffset 0x2C + verifyStackoffset g1g2(0x34,0x3C,0x34) ; Jump back - pop ebp - mov ecx, [esp+stackoffset-0xC] - jmp g1g2(0x4CE914,0,0x4DB504) + jmp g1g2(0x4CE909,0x4DF1A6,0x4DB4F9)+5 global init_content @@ -31,10 +30,10 @@ init_content: verifyStackoffset ; Jump back -%if GOTHIC_BASE_VERSION == 1 - mov DWORD [0x8DDF90], edi +%if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 + mov DWORD [zCParser_parser+zCParser_progressBar_offset], edi %elif GOTHIC_BASE_VERSION == 2 add esp, 0x8 test eax, eax %endif - jmp g1g2(0x637F8A,0,0x6C20C8) + jmp g1g2(0x637F84,0x65E408,0x6C20C3)+5 diff --git a/src/exec/misc.asm b/src/exec/misc.asm index 7e37af9..626a1a0 100644 --- a/src/exec/misc.asm +++ b/src/exec/misc.asm @@ -90,42 +90,42 @@ setVobToTransient: global checkNpcTransient1 checkNpcTransient1: - resetStackoffset g1g2(0x5C,0,0x94) + resetStackoffset g1g2(0x5C,0x5C,0x94) call DWORD [edx+0x104] ; oCNpc.IsSelfPlayer(void) test eax, eax jnz .back - %if GOTHIC_BASE_VERSION == 1 + %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 test BYTE [ecx+0xF5], 0x1 ; zCVob.dontwritetoarchive %elif GOTHIC_BASE_VERSION == 2 test BYTE [ecx+0x114], 0x10 ; zCVob.dontwritetoarchive %endif jz .back mov eax, 0x1 - verifyStackoffset g1g2(0x5C,0,0x94) + verifyStackoffset g1g2(0x5C,0x5C,0x94) .back: - jmp g1g2(0x6D652A,0,0x77F66A)+6 + jmp g1g2(0x6D652A,0x70DF35,0x77F66A)+6 global checkNpcTransient2 checkNpcTransient2: - resetStackoffset g1g2(0x5C,0,0x94) + resetStackoffset g1g2(0x5C,0x5C,0x94) call DWORD [eax+0x104] ; oCNpc.IsSelfPlayer(void) test eax, eax jnz .back - %if GOTHIC_BASE_VERSION == 1 + %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 test BYTE [ecx+0xF5], 0x1 ; zCVob.dontwritetoarchive %elif GOTHIC_BASE_VERSION == 2 test BYTE [ecx+0x114], 0x10 ; zCVob.dontwritetoarchive %endif jz .back mov eax, 0x1 - verifyStackoffset g1g2(0x5C,0,0x94) + verifyStackoffset g1g2(0x5C,0x5C,0x94) .back: - jmp g1g2(0x6D65A3,0,0x77F6E1)+6 + jmp g1g2(0x6D65A3,0x70DFA6,0x77F6E1)+6 global removeInvalidNpcs @@ -566,15 +566,15 @@ fastexit_deinit_vdfs: ; Deinitialize VDFS on improper CGameManager destruction (access violation) global CGameMananager_destruction_deinit_vdfs CGameMananager_destruction_deinit_vdfs: - resetStackoffset 0x3C + resetStackoffset g1g2(0x3C,0x38,0x3C) pusha call zFILE_VDFS__DeinitFileSystem popa - verifyStackoffset 0x3C + verifyStackoffset g1g2(0x3C,0x38,0x3C) ; Jump back mov BYTE [esp+stackoffset-0x4], 0x4 - jmp g1g2(0x423BE1,0,0x4247D1) + jmp g1g2(0x423BE1,0x4265C9,0x4247D1) ; Deinitialize VDFS on libExit (fatal error) diff --git a/src/func/initContent.asm b/src/func/initContent.asm index 1889168..2b7e49c 100644 --- a/src/func/initContent.asm +++ b/src/func/initContent.asm @@ -16,7 +16,7 @@ ninja_initContent: addStack 4 add eax, [esp+stackoffset+arg_1] - sub eax, 0xA ; Cut off/overwrite '\CONTENT_G*.SRC' + sub eax, g1g2(0xA,0xC,0xA) ; Cut off/overwrite '\CONTENT_G*.SRC' mov BYTE [eax], 0x0 sub eax, 0x4 mov DWORD [eax], 'INIT' diff --git a/src/func/initMenu.asm b/src/func/initMenu.asm index 82709f2..6013e68 100644 --- a/src/func/initMenu.asm +++ b/src/func/initMenu.asm @@ -16,7 +16,7 @@ ninja_initMenu: addStack 4 add eax, [esp+stackoffset+arg_1] - sub eax, 0xA ; Cut off/overwrite '\CONTENT_G*.SRC' + sub eax, g1g2(0xA,0xC,0xA) ; Cut off/overwrite '\CONTENT_G*.SRC' mov BYTE [eax], 0x0 sub eax, 0x4 mov DWORD [eax], 'MENU' diff --git a/src/hook_CGameManager_destructor.asm b/src/hook_CGameManager_destructor.asm index fa37a01..8b670fe 100644 --- a/src/hook_CGameManager_destructor.asm +++ b/src/hook_CGameManager_destructor.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x423BDC,0,0x4247CC) + org g1g2(0x423BDC,0x4265C4,0x4247CC) %endif bits 32 diff --git a/src/hook_archiveWorldCountLogicalNpc.asm b/src/hook_archiveWorldCountLogicalNpc.asm index 93e6651..92ab124 100644 --- a/src/hook_archiveWorldCountLogicalNpc.asm +++ b/src/hook_archiveWorldCountLogicalNpc.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6D652A,0,0x77F66A) + org g1g2(0x6D652A,0x70DF35,0x77F66A) %endif bits 32 diff --git a/src/hook_archiveWorldWriteLogicalNpc.asm b/src/hook_archiveWorldWriteLogicalNpc.asm index 826a354..59140fb 100644 --- a/src/hook_archiveWorldWriteLogicalNpc.asm +++ b/src/hook_archiveWorldWriteLogicalNpc.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6D65A3,0,0x77F6E1) + org g1g2(0x6D65A3,0x70DFA6,0x77F6E1) %endif bits 32 diff --git a/src/hook_deploy_ani_ninja.asm b/src/hook_deploy_ani_ninja.asm index 2b2feda..153d49d 100644 --- a/src/hook_deploy_ani_ninja.asm +++ b/src/hook_deploy_ani_ninja.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x57DC40,0,0x5961CD) + org g1g2(0x57DC40,0x598474,0x5961CD) %endif bits 32 @@ -16,9 +16,9 @@ section .text align=1 ; Pre times 2 nop ; Overwrites - ; %if GOTHIC_BASE_VERSION == 1 - ; resetStackoffset 0xF54 - ; cmp [esp+stackoffset-0xE88], ebp + ; %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 + ; resetStackoffset g1g2(0xF54,0xFD8,0x0) + ; cmp [esp+stackoffset-g1g2(0xE88,0xF20,0x0)], ebp ; %elif GOTHIC_BASE_VERSION == 2 ; resetStackoffset 0x49C ; mov eax, [esp+stackoffset-0x3E0] diff --git a/src/hook_deploy_camera_ninja.asm b/src/hook_deploy_camera_ninja.asm index 3786b11..54af1bf 100644 --- a/src/hook_deploy_camera_ninja.asm +++ b/src/hook_deploy_camera_ninja.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x49909E,0,0x4A0554) + org g1g2(0x49909E,0x4A6138,0x4A0554) %endif bits 32 @@ -16,5 +16,5 @@ section .text align=1 ; Pre ; Overwrites ; resetStackoffset g1g2(0xB4,0,0xB8) - ; lea g1g2(eax,0,edx), [esp+stackoffset+g1g2(-0xA1,0,-0xA5)] - ; push g1g2(eax,0,edx) + ; lea g1g2(eax,edx,edx), [esp+stackoffset+g1g2(-0xA1,-0x89,-0xA5)] + ; push g1g2(eax,edx,edx) diff --git a/src/hook_deploy_content_ninja.asm b/src/hook_deploy_content_ninja.asm index 20e0427..0b41c8d 100644 --- a/src/hook_deploy_content_ninja.asm +++ b/src/hook_deploy_content_ninja.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6371F1,0,0x6C12A0) + org g1g2(0x637208,0x65D5A1,0x6C12B7) %endif bits 32 @@ -13,9 +13,6 @@ bits 32 section .text align=1 ; Prevent auto-alignment jmp deploy_content_ninja - nop ; Overwrites - ; resetStackoffset g1g2(0x94,0,0x84) - ; push 0x1 - ; lea ecx, [esp+stackoffset+g1g2(-0x44,0,-0x1C)] + ; call sysEvent diff --git a/src/hook_deploy_fightai_ninja.asm b/src/hook_deploy_fightai_ninja.asm index 4e34ee4..dc4ce7d 100644 --- a/src/hook_deploy_fightai_ninja.asm +++ b/src/hook_deploy_fightai_ninja.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x747EBA,0,0x67C626) + org g1g2(0x747EBA,0x788F52,0x67C626) %endif bits 32 @@ -15,6 +15,6 @@ section .text align=1 ; Pre jmp deploy_fightai_ninja ; Overwrites - ; resetStackoffset g1g2(0x7C,0,0x64) - ; lea g1g2(edx,0,eax), [esp+stackoffset+g1g2(-0x69,0,-0x51)] - ; push g1g2(edx,0,eax) + ; resetStackoffset g1g2(0x7C,0x50,0x64) + ; lea g1g2(edx,edx,eax), [esp+stackoffset+g1g2(-0x69,-0x34,-0x51)] + ; push g1g2(edx,edx,eax) diff --git a/src/hook_deploy_menu_ninja.asm b/src/hook_deploy_menu_ninja.asm index 158fa09..3306785 100644 --- a/src/hook_deploy_menu_ninja.asm +++ b/src/hook_deploy_menu_ninja.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x4CD57A,0,0x4DA196) + org g1g2(0x4CD57A,0x4DDC34,0x4DA196) %endif bits 32 diff --git a/src/hook_deploy_music_ninja.asm b/src/hook_deploy_music_ninja.asm index ebb7a6c..e793378 100644 --- a/src/hook_deploy_music_ninja.asm +++ b/src/hook_deploy_music_ninja.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x4DA448,0,0x4E765C) + org g1g2(0x4DA448,0x4EB55C,0x4E765C) %endif bits 32 @@ -15,6 +15,6 @@ section .text align=1 ; Pre jmp deploy_music_ninja ; Overwrites - ; resetStackoffset g1g2(0xD8,0,0xC8) - ; lea edx, [esp+stackoffset+g1g2(-0xC5,0,-0xB5)] - ; push edx + ; resetStackoffset g1g2(0xD8,0xB0,0xC8) + ; lea g1g2(edx,eax,edx), [esp+stackoffset+g1g2(-0xC5,-0x9D,-0xB5)] + ; push g1g2(edx,eax,edx) diff --git a/src/hook_deploy_ou_ninja.asm b/src/hook_deploy_ou_ninja.asm index 61c0297..953fc3e 100644 --- a/src/hook_deploy_ou_ninja.asm +++ b/src/hook_deploy_ou_ninja.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x41BE77,0,0x41C407) + org g1g2(0x41BE77,0x41DCD7,0x41C407) %endif bits 32 diff --git a/src/hook_deploy_pfx_ninja.asm b/src/hook_deploy_pfx_ninja.asm index db8ea02..14bbeb9 100644 --- a/src/hook_deploy_pfx_ninja.asm +++ b/src/hook_deploy_pfx_ninja.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x58CA22,0,0x5AC7BC) + org g1g2(0x58CA22,0x5A7F33,0x5AC7BC) %endif bits 32 @@ -15,6 +15,6 @@ section .text align=1 ; Pre jmp deploy_pfx_ninja ; Overwrites - ; resetStackoffset g1g2(0x8C,0,0xC8) - ; lea eax, [esp+stackoffset+g1g2(-0x79,0,-0xB5)] - ; push eax + ; resetStackoffset g1g2(0x8C,0x7C,0xC8) + ; lea g1g2(eax,ecx,eax), [esp+stackoffset+g1g2(-0x79,-0x69,-0xB5)] + ; push g1g2(eax,ecx,eax) diff --git a/src/hook_deploy_sfx_ninja.asm b/src/hook_deploy_sfx_ninja.asm index 8a89d8d..01a6d87 100644 --- a/src/hook_deploy_sfx_ninja.asm +++ b/src/hook_deploy_sfx_ninja.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x4DD88C,0,0x4EAE8B) + org g1g2(0x4DD88C,0x4EECDC,0x4EAE8B) %endif bits 32 @@ -15,6 +15,6 @@ section .text align=1 ; Pre jmp deploy_sfx_ninja ; Overwrites - ; resetStackoffset g1g2(0x304,0,0x308) - ; lea g1g2(ecx,0,eax), [esp+stackoffset+g1g2(-0x2F2,0,-0x2F6)] - ; push g1g2(ecx,0,eax) + ; resetStackoffset g1g2(0x304,0x2F8,0x308) + ; lea g1g2(ecx,eax,eax), [esp+stackoffset+g1g2(-0x2F2,0x2E5,-0x2F6)] + ; push g1g2(ecx,eax,eax) diff --git a/src/hook_deploy_vfx_ninja.asm b/src/hook_deploy_vfx_ninja.asm index 3ec5062..4c2b9d6 100644 --- a/src/hook_deploy_vfx_ninja.asm +++ b/src/hook_deploy_vfx_ninja.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x483A3C,0,0x48B6EF) + org g1g2(0x483A3C,0x48EB1F,0x48B6EF) %endif bits 32 @@ -13,8 +13,15 @@ bits 32 section .text align=1 ; Prevent auto-alignment jmp deploy_vfx_ninja +%if GOTHIC_BASE_VERSION == 112 + nop +%endif ; Overwrites - ; resetStackoffset g1g2(0x248,0,0x250) - ; lea g1g2(edx,0,eax), [esp+stackoffset+g1g2(-0x239,0,0x235)] - ; push g1g2(edx,0,eax) + ; resetStackoffset g1g2(0x248,0x234,0x250) + ; %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 2 + ; lea g1g2(edx,0,eax), [esp+stackoffset+g1g2(-0x239,0,-0x235)] + ; %elif GOTHIC_BASE_VERSION == 112 + ; mov [esp+stackoffset-0x21C], cl + ; %endif + ; push g1g2(edx,0,eax) diff --git a/src/hook_init_content.asm b/src/hook_init_content.asm index 388bc5c..4aead9b 100644 --- a/src/hook_init_content.asm +++ b/src/hook_init_content.asm @@ -5,7 +5,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x637F84,0,0x6C20C3) + org g1g2(0x637F84,0x65E408,0x6C20C3) %endif bits 32 @@ -15,14 +15,14 @@ section .text align=1 ; Pre jmp init_content - %if GOTHIC_BASE_VERSION == 1 + %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 nop %endif ; Overwrites ; - ; %if GOTHIC_BASE_VERSION == 1 - ; mov DWORD [0x8DDF90], edi + ; %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 + ; mov DWORD [zCParser_parser+zCParser_progressBar_offset], edi ; %elif GOTHIC_BASE_VERSION == 2 ; add esp, 0x8 ; test eax, eax diff --git a/src/hook_init_menu.asm b/src/hook_init_menu.asm index ae70585..7fdfa48 100644 --- a/src/hook_init_menu.asm +++ b/src/hook_init_menu.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x4CE90F,0,0x4DB4FF) + org g1g2(0x4CE909,0x4DF1A6,0x4DB4F9) %endif bits 32 @@ -15,6 +15,4 @@ section .text align=1 ; Pre jmp init_menu ; Overwrites - ; resetStackoffset 0x28 - ; pop ebp - ; mov ecx, [esp+stackoffset-0xC] + ; call zCArraySort_zCMenu___InsertSort diff --git a/src/hook_zCPar_Symbol__GetNext.asm b/src/hook_zCPar_Symbol__GetNext.asm index 1e0e31e..367aa94 100644 --- a/src/hook_zCPar_Symbol__GetNext.asm +++ b/src/hook_zCPar_Symbol__GetNext.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6F84D0,0,0x7A1DD0) + org g1g2(0x6F84D0,0x732740,0x7A1DD0) %endif bits 32 diff --git a/src/inc/engine_g1.inc b/src/inc/engine_g1.inc index cf87fe1..6133568 100644 --- a/src/inc/engine_g1.inc +++ b/src/inc/engine_g1.inc @@ -12,6 +12,7 @@ %define zCArray_int___zCArray_int_ 0x5499D0 ; void %define zCArray_int___InsertEnd 0x530010 ; int const & %define zCArray_int____zCArray_int_ 0x52FF50 ; void + %define zCArraySort_zCMenu___InsertSort 0x4D1270 ; zCMenu * %define zCArraySort_int___QuickSort 0x60F100 ; void %define _qsort 0x77757F ; void *, size_t, size_t, int (__cdecl *)(const void *, const void *) %define _fopen 0x778672 ; const char *, const char * @@ -45,6 +46,7 @@ %define ds_lstrcmpiA 0x7D02C4 ; LPCSTR, LPCSTR %define _strncmp 0x7859F0 ; char *, char *, int %define ds_vdf_fexists 0x7D04D0 ; const char*, long + %define sysEvent 0x4F6AC0 ; void %define zCParser_parser 0x8DCE08 ; zCParser %define zCParser__CallFunc 0x6E9670 ; zSTRING const & %define zCParser__ParseBlock 0x6E6C00 ; void @@ -168,6 +170,7 @@ %define zCParser_in_class_offset 0x10D8 ; zCPar_Symbol * %define zCParser_datsave_offset 0x1090 %define zCParser_mergemode_offset 0x109C + %define zCParser_progressBar_offset 0x1188 %define zCPar_Symbol_content_offset 0x18 %define zCPar_Symbol_offset_offset 0x1C diff --git a/src/inc/engine_g112.inc b/src/inc/engine_g112.inc index 58c2cf3..e1b2d68 100644 --- a/src/inc/engine_g112.inc +++ b/src/inc/engine_g112.inc @@ -11,7 +11,8 @@ %define operator_StrPlusChar 0x404F30 ; zSTRING const &, char const * %define zCArray_int___zCArray_int_ 0x5619C0 ; void %define zCArray_int___InsertEnd 0x4D9010 ; int const & - %define zCArray_int____zCArray_int_ 0x5619C0 ; void + %define zCArray_int____zCArray_int_ 0x546860 ; void + %define zCArraySort_zCMenu___InsertSort 0x4E19B0 ; zCMenu * %define zCArraySort_int___QuickSort 0x631890 ; void %define _qsort 0x7BB33F ; void *, size_t, size_t, int (__cdecl *)(const void *, const void *) %define _fopen 0x7BC432 ; const char *, const char * @@ -45,6 +46,7 @@ %define ds_lstrcmpiA 0x8132D0 ; LPCSTR, LPCSTR %define _strncmp 0x7C95F0 ; char *, char *, int %define ds_vdf_fexists 0x8134B4 ; const char*, long + %define sysEvent 0x509530 ; void %define zCParser_parser 0x925048 ; zCParser %define zCParser__CallFunc 0x722640 ; zSTRING const & %define zCParser__ParseBlock 0x71F8E0 ; void @@ -168,6 +170,7 @@ %define zCParser_in_class_offset 0x10D8 ; zCPar_Symbol * %define zCParser_datsave_offset 0x1090 %define zCParser_mergemode_offset 0x109C + %define zCParser_progressBar_offset 0x1188 %define zCPar_Symbol_content_offset 0x18 %define zCPar_Symbol_offset_offset 0x1C diff --git a/src/inc/engine_g2.inc b/src/inc/engine_g2.inc index 046d0ce..9240c5d 100644 --- a/src/inc/engine_g2.inc +++ b/src/inc/engine_g2.inc @@ -12,6 +12,7 @@ %define zCArray_int___zCArray_int_ 0x560690 ; void %define zCArray_int___InsertEnd 0x4D5A30 ; int const & %define zCArray_int____zCArray_int_ 0x543CC0 ; void + %define zCArraySort_zCMenu___InsertSort 0x4DE100 ; zCMenu * %define zCArraySort_int___QuickSort 0x63FCA0 ; void %define _qsort 0x7D0F6F ; void *, size_t, size_t, int (__cdecl *)(const void *, const void *) %define _fopen 0x7D2010 ; const char *, const char * @@ -45,6 +46,7 @@ %define ds_lstrcmpiA 0x82E174 ; LPCSTR, LPCSTR %define _strncmp 0x7DF2C0 ; char *, char *, int %define ds_vdf_fexists 0x82E66C ; const char*, long + %define sysEvent 0x5053E0 ; void %define zCParser_parser 0xAB40C0 ; zCParser %define zCParser__CallFunc 0x7929D0 ; zSTRING const & %define zCParser__ParseBlock 0x78FE30 ; void @@ -169,6 +171,7 @@ %define zCParser_datsave_offset 0x2090 %define zCParser_mergemode_offset 0x209C + %define zCPar_Symbol_content_offset 0x18 %define zCPar_Symbol_offset_offset 0x1C %define zCPar_Symbol_bitfield_offset 0x20 From da97015ea1b54ef3926319d2d94814d9bd174236 Mon Sep 17 00:00:00 2001 From: szapp Date: Thu, 20 Jul 2023 10:59:58 +0200 Subject: [PATCH 4/9] Initialize compatibility for Gothic 2 Classic (1.30 fix) --- Makefile | 9 +- README.md | 3 +- extractSymbols.bat | 5 +- getAddress.bat | 7 +- getBinList.bat | 3 + src/core.asm | 4 +- src/data/io.asm | 6 +- src/dll/Ninja.asm | 34 +++ src/exec/createVdfArray.asm | 4 +- src/exec/deploy.asm | 82 +++--- src/exec/init.asm | 8 +- src/exec/misc.asm | 62 ++--- src/exec/parse.asm | 96 +++---- src/func/allowRedefine.asm | 2 +- src/func/armParser.asm | 4 +- src/func/conEvalFunc.asm | 2 +- src/func/initContent.asm | 2 +- src/func/initMenu.asm | 2 +- src/hook_CGameManager_destructor.asm | 2 +- src/hook_Hlp_GetNpc.asm | 2 +- src/hook_Hlp_IsValidItem.asm | 2 +- src/hook_Hlp_IsValidNpc.asm | 2 +- src/hook_archiveWorldCountLogicalNpc.asm | 2 +- src/hook_archiveWorldWriteLogicalNpc.asm | 2 +- src/hook_createVdfArray.asm | 2 +- src/hook_deploy_ani_ninja.asm | 6 +- src/hook_deploy_camera_ninja.asm | 8 +- src/hook_deploy_content_ninja.asm | 2 +- src/hook_deploy_fightai_ninja.asm | 8 +- src/hook_deploy_menu_ninja.asm | 2 +- src/hook_deploy_music_ninja.asm | 8 +- src/hook_deploy_ou_ninja.asm | 2 +- src/hook_deploy_pfx_ninja.asm | 8 +- src/hook_deploy_sfx_ninja.asm | 8 +- src/hook_deploy_vfx_ninja.asm | 8 +- src/hook_fastexit.asm | 2 +- src/hook_init_content.asm | 2 +- src/hook_init_menu.asm | 2 +- src/hook_libExit.asm | 2 +- src/hook_linkerReplaceFunc.asm | 2 +- src/hook_npcReference.asm | 2 +- src/hook_oCSpawnManager__Archive.asm | 2 +- src/hook_parserDeclareClass.asm | 2 +- src/hook_parserDeclareFunc.asm | 2 +- src/hook_parserDeclarePrototype.asm | 2 +- src/hook_parserDeclareVar.asm | 2 +- src/hook_parserDeclareVar_constInt.asm | 2 +- src/hook_parserDeclareVar_constString.asm | 2 +- src/hook_parserParseSource.asm | 2 +- src/hook_setVobToTransient.asm | 2 +- src/hook_unarchiveInfoMan.asm | 2 +- src/hook_unarchiveNpcs.asm | 2 +- src/hook_unarchiveVobs.asm | 2 +- src/hook_zCPar_Symbol__GetNext.asm | 2 +- src/hook_zCParser__LoadGlobalVars.asm | 2 +- src/inc/engine.inc | 4 + src/inc/engine_g130.inc | 242 ++++++++++++++++++ src/inc/macros.inc | 14 +- src/inc/symbols.inc | 4 + src/ow_ani.asm | 18 +- src/ow_aniAlias.asm | 18 +- src/ow_aniBatch.asm | 16 +- src/ow_aniBlend.asm | 18 +- src/ow_aniComb.asm | 16 +- src/ow_aniDisable.asm | 18 +- src/ow_aniSync.asm | 18 +- src/ow_parserDeclareClass_showOverwrite.asm | 4 +- src/ow_parserDeclareFunc_showOverwrite.asm | 4 +- ...w_parserDeclarePrototype_showOverwrite.asm | 4 +- src/ow_parserDeclareVar_showOverwrite.asm | 8 +- src/ow_playerInfoName1.asm | 2 +- src/ow_playerInfoName2.asm | 2 +- src/ow_playerInfoName3.asm | 2 +- src/ow_playerInfoName4.asm | 2 +- src/ow_playerInfoName5.asm | 2 +- src/ow_reopenFileWarning.asm | 2 +- verifySize.bat | 6 +- 77 files changed, 587 insertions(+), 286 deletions(-) create mode 100644 src/inc/engine_g130.inc diff --git a/Makefile b/Makefile index c5ad650..46fbb56 100644 --- a/Makefile +++ b/Makefile @@ -82,6 +82,7 @@ CONTENT := $(INCDIR)injections$(INCEXT) INC := $(INCDIR)stackops$(INCEXT) $(INCDIR)macros$(INCEXT) $(INCDIR)engine$(INCEXT) INC_G1 := $(INC) $(INCDIR)engine_g1$(INCEXT) INC_G112 := $(INC) $(INCDIR)engine_g112$(INCEXT) +INC_G130 := $(INC) $(INCDIR)engine_g130$(INCEXT) INC_G2 := $(INC) $(INCDIR)engine_g2$(INCEXT) # Intermediate files @@ -155,6 +156,7 @@ BIN_BASE_G112 := core \ hook_init_menu \ hook_init_content \ hook_zCPar_Symbol__GetNext +BIN_BASE_G130 := BIN_BASE_G2 := ow_zCParser__LoadGlobalVars \ skip_writeAniBinFile_ModelTag \ skip_writeAniBinFile_ReadMeshAndTree \ @@ -196,6 +198,7 @@ DATA_BASE := symbols \ BINARIES_G1 := $(BIN_BASE:%=$(BINDIR)%_g1) BINARIES_G112 := $(BIN_BASE_G112:%=$(BINDIR)%_g112) +BINARIES_G130 := $(BIN_BASE_G130:%=$(BINDIR)%_g130) BINARIES_G2 := $(BIN_BASE:%=$(BINDIR)%_g2) $(BIN_BASE_G2:%=$(BINDIR)%_g2) FUNC := $(FUNC_BASE:%=$(FUNCDIR)%$(ASMEXT)) EXEC := $(EXEC_BASE:%=$(EXECDIR)%$(ASMEXT)) @@ -248,7 +251,7 @@ $(OBJ) : $(SRCDLL) $(CONTENT) $(IKLG) $(RSC) : $(RC) gorc $(FLAGS_RC) /fo $@ /r $^ -$(CONTENT) : $(BINARIES_G1) $(BINARIES_G112) $(BINARIES_G2) +$(CONTENT) : $(BINARIES_G1) $(BINARIES_G112) $(BINARIES_G130) $(BINARIES_G2) $(GETBINLIST) $(call FixPath,$@) $(SRCDIR) $(BINDIR)core_g% : $(SRCDIR)core$(ASMEXT) $(FUNC) $(EXEC) $(DATA) $(INC_G%) $(META) @@ -267,6 +270,10 @@ $(BINDIR)%_g112 : $(SRCDIR)%$(ASMEXT) $(INCDIR)symbols_g112$(INCEXT) $(INC_G112) @$(call mkdir,$(BINDIR)) $(NASM) -DGOTHIC_BASE_VERSION=112 $(FLAGS_C) -o $@ $< +$(BINDIR)%_g130 : $(SRCDIR)%$(ASMEXT) $(INCDIR)symbols_g130$(INCEXT) $(INC_G130) $(META) + @$(call mkdir,$(BINDIR)) + $(NASM) -DGOTHIC_BASE_VERSION=130 $(FLAGS_C) -o $@ $< + $(BINDIR)%_g2 : $(SRCDIR)%$(ASMEXT) $(INCDIR)symbols_g2$(INCEXT) $(INC_G2) $(META) @$(call mkdir,$(BINDIR)) $(NASM) -DGOTHIC_BASE_VERSION=2 $(FLAGS_C) -o $@ $< diff --git a/README.md b/README.md index 77b11c4..fd73f86 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Ninja -This repository contains the source code of the Ninja extension for Gothic, Gothic Sequel, and Gothic 2 NotR. +This repository contains the source code of the Ninja extension for Gothic, Gothic Sequel, Gothic 2, and Gothic 2 NotR, +specifically the game versions 1.08k_mod, 1.12f, 1.30 fix (report version), 2.6 fix (report version). If you are interested in developing patches with Ninja, please follow the instructions in the relevant chapters of the [documentation](https://github.com/szapp/Ninja/wiki). diff --git a/extractSymbols.bat b/extractSymbols.bat index 28d495f..98de845 100644 --- a/extractSymbols.bat +++ b/extractSymbols.bat @@ -1,7 +1,7 @@ :: :: Extract all global symbols from assembly files and format them into a macro file :: -:: Arguments: OUTFILE.ASM GOTHIC-BASE-VERSION(1, 112, or 2) SOURCE.ASM [SOURCE.ASM ...] +:: Arguments: OUTFILE.ASM GOTHIC-BASE-VERSION(1, 112, 130, or 2) SOURCE.ASM [SOURCE.ASM ...] :: @ECHO OFF SETLOCAL ENABLEDELAYEDEXPANSION @@ -15,6 +15,7 @@ IF [%2] == [] GOTO usage IF [%3] == [] GOTO usage IF %2 EQU 1 GOTO start IF %2 EQU 112 GOTO start +IF %2 EQU 130 GOTO start IF %2 NEQ 2 GOTO usage :start @@ -68,4 +69,4 @@ DEL /Q temp.O EXIT /B :usage -ECHO Usage: %~nx0 OUTFILE.ASM GOTHIC-BASE-VERSION(1, 112, or 2) SOURCE.ASM [SOURCE.ASM ...] +ECHO Usage: %~nx0 OUTFILE.ASM GOTHIC-BASE-VERSION(1, 112, 130, or 2) SOURCE.ASM [SOURCE.ASM ...] diff --git a/getAddress.bat b/getAddress.bat index 1bd5493..66bae37 100644 --- a/getAddress.bat +++ b/getAddress.bat @@ -1,7 +1,7 @@ :: :: Read starting address (ORG) from assembly file :: -:: Arguments: SOURCE.ASM GOTHIC-BASE-VERSION(1, 112, or 2) +:: Arguments: SOURCE.ASM GOTHIC-BASE-VERSION(1, 112, 130, or 2) :: @ECHO OFF SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION @@ -11,7 +11,8 @@ IF [%1] == [] GOTO usage IF [%2] == [] GOTO usage IF %2 EQU 1 SET gId=1&& GOTO start IF %2 EQU 112 SET gId=2&& GOTO start -IF %2 EQU 2 SET gId=3&& GOTO start +IF %2 EQU 130 SET gId=3&& GOTO start +IF %2 EQU 2 SET gId=4&& GOTO start GOTO usage :start @@ -51,4 +52,4 @@ ECHO %addr% EXIT /B 0 :usage -ECHO Usage: %~nx0 SOURCE.ASM GOTHIC-BASE-VERSION(1, 112, or 2) +ECHO Usage: %~nx0 SOURCE.ASM GOTHIC-BASE-VERSION(1, 112, 130, or 2) diff --git a/getBinList.bat b/getBinList.bat index d7e0ba7..41bbcd5 100644 --- a/getBinList.bat +++ b/getBinList.bat @@ -37,6 +37,9 @@ ECHO/>> %outfile% SET gothic=112 FOR %%N IN ("%indir%") DO CALL :fileloop %%N || EXIT /B 3 ECHO/>> %outfile% +SET gothic=130 +FOR %%N IN ("%indir%") DO CALL :fileloop %%N || EXIT /B 3 +ECHO/>> %outfile% SET gothic=2 FOR %%N IN ("%indir%") DO CALL :fileloop %%N || EXIT /B 3 diff --git a/src/core.asm b/src/core.asm index fbd0678..d5dcc23 100644 --- a/src/core.asm +++ b/src/core.asm @@ -4,7 +4,7 @@ %include "inc/engine.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x452640,0x459190,0x457470) + org g1g2(0x452640,0x459190,0,0x457470) %endif bits 32 @@ -19,7 +19,7 @@ section .text %include "exec/createVdfArray.asm" %include "exec/deploy.asm" %include "exec/init.asm" -%if GOTHIC_BASE_VERSION != 112 +%if GOTHIC_BASE_VERSION != 112 && GOTHIC_BASE_VERSION != 130 %include "exec/parse.asm" %include "exec/misc.asm" %endif diff --git a/src/data/io.asm b/src/data/io.asm index 8d35ba4..51e5d51 100644 --- a/src/data/io.asm +++ b/src/data/io.asm @@ -1,7 +1,7 @@ char_ikarus db 'IKARUS', 0 char_lego db 'LEGO', 0 char_rb db 'rb', 0 -char_g1g2 db '_G', g1g2('1','112','2'), 0 +char_g1g2 db '_G', g1g2('1','112','130','2'), 0 char_bin db '.BIN', 0 char_csl db '.CSL', 0 char_zOPT_ignorePatches db 'IncompatibleNinjaPatches', 0 @@ -19,8 +19,8 @@ NINJA_PATH_DATA db 'DATA\', 0 NINJA_PATH_VDF db 'DATA\*.VDF', 0 NINJA_PATH_IKARUS db '\NINJA\_INTERN\IKARUS\IKARUS.D', 0 NINJA_PATH_LEGO db '\NINJA\_INTERN\LEGO\LEGO.D', 0 -NINJA_PATH_IKARUSSRC db '\NINJA\_INTERN\IKARUS\IKARUS_G', g1g2('1','112','2'), '.SRC', 0 -NINJA_PATH_LEGOSRC db '\NINJA\_INTERN\LEGO\HEADER_G', g1g2('1','112','2'),'.SRC', 0 +NINJA_PATH_IKARUSSRC db '\NINJA\_INTERN\IKARUS\IKARUS_G', g1g2('1','112','130','2'), '.SRC', 0 +NINJA_PATH_LEGOSRC db '\NINJA\_INTERN\LEGO\HEADER_G', g1g2('1','112','130','2'),'.SRC', 0 NINJA_MDS_PREFIX db 'ANIMS_', 0 NINJA_FILE db '\SYSTEM\NINJA.DLL', 0 NINJA_VDF_VERSION1 db 'PSVDSC_V2.00', 0xD, 0xA, 0xD, 0xA diff --git a/src/dll/Ninja.asm b/src/dll/Ninja.asm index cb5a464..830d97b 100644 --- a/src/dll/Ninja.asm +++ b/src/dll/Ninja.asm @@ -18,6 +18,14 @@ %assign inject_g112_count inject_g112_count + 1 %endmacro +%assign inject_g130_count 0 +%macro add_inject_g130 2 + injectObj_g130_%[inject_g130_count]_addr equ %1 + injectObj_g130_%[inject_g130_count]_new incbin %2 + injectObj_g130_%[inject_g130_count]_size equ $-injectObj_g130_%[inject_g130_count]_new + %assign inject_g130_count inject_g130_count + 1 +%endmacro + %assign inject_g2_count 0 %macro add_inject_g2 2 injectObj_g2_%[inject_g2_count]_addr equ %1 @@ -70,10 +78,12 @@ section .data verify_addr_g1 equ 0x82C0C0 verify_addr_g112 equ 0x87F918 + verify_addr_g130 equ 0x88F858 verify_addr_g2 equ 0x89A7FC zCParser__ParseBlock_g1 equ 0x6E6C00 zCParser__ParseBlock_g112 equ 0x71F8E0 + zCParser__ParseBlock_g130 equ 0x7303F0 zCParser__ParseBlock_g2 equ 0x78FE30 %include "inc/injections.inc" @@ -179,6 +189,8 @@ injectAll: jz .g2 cmp DWORD [verify_addr_g112], 'GOTH' jz .g112 + cmp DWORD [verify_addr_g130], 'Goth' + jz .g130 cmp DWORD [verify_addr_g1], 'Goth' jz .g1 @@ -239,6 +251,28 @@ injectAll: jmp .success +.g130: + %assign it 0 + %rep inject_g130_count + push injectObj_g130_%[it]_new + push injectObj_g130_%[it]_size + push injectObj_g130_%[it]_addr + call inject + addStack 3*4 + test eax, eax + jz .failed + %assign it it + 1 + %endrep + + push 0x8 + push zCParser__ParseBlock_g130 + call clearAccess + addStack 2*4 + test eax, eax + jz .failed + + jmp .success + .g2: %assign it 0 %rep inject_g2_count diff --git a/src/exec/createVdfArray.asm b/src/exec/createVdfArray.asm index f7e063d..fec1b2b 100644 --- a/src/exec/createVdfArray.asm +++ b/src/exec/createVdfArray.asm @@ -50,7 +50,7 @@ createVdfArray: add esp, 0x14 %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 2 - mov al, [SystemPack_version_info+g1g2(0xD,0x0,0xB)] ; Check for old Ninja system + mov al, [SystemPack_version_info+g1g2(0xD,0x0,0,0xB)] ; Check for old Ninja system cmp al, 'N' jnz .checkScripts @@ -565,7 +565,7 @@ createVdfArray: verifyStackoffset push char_zStartupWindowed - jmp g1g2(0x6019C6,0x623783,0x630B61) + jmp g1g2(0x6019C6,0x623783,0,0x630B61) ; int __cdecl ninja_compareTimestampsUnsigned(void const *, void const *) diff --git a/src/exec/deploy.asm b/src/exec/deploy.asm index f6f4194..4cbb08f 100644 --- a/src/exec/deploy.asm +++ b/src/exec/deploy.asm @@ -2,7 +2,7 @@ global deploy_music_ninja deploy_music_ninja: - resetStackoffset g1g2(0xD8,0xB0,0xC8) + resetStackoffset g1g2(0xD8,0xB0,0,0xC8) pusha push ninja_injectSrc push NINJA_PATH_MUSIC @@ -11,17 +11,17 @@ deploy_music_ninja: call ninja_armParser addStack 3*4 popa - verifyStackoffset g1g2(0xD8,0xB0,0xC8) + verifyStackoffset g1g2(0xD8,0xB0,0,0xC8) ; Jump back - lea g1g2(edx,eax,edx), [esp+stackoffset+g1g2(-0xC5,-0x9D,-0xB5)] - push g1g2(edx,eax,edx) - jmp g1g2(0x4DA448,0x4EB55C,0x4E765C)+5 + lea g1g2(edx,eax,0,edx), [esp+stackoffset+g1g2(-0xC5,-0x9D,0,-0xB5)] + push g1g2(edx,eax,0,edx) + jmp g1g2(0x4DA448,0x4EB55C,0,0x4E765C)+5 global deploy_sfx_ninja deploy_sfx_ninja: - resetStackoffset g1g2(0x304,0x2F8,0x308) + resetStackoffset g1g2(0x304,0x2F8,0,0x308) pusha push ninja_injectSrc push NINJA_PATH_SFX @@ -30,17 +30,17 @@ deploy_sfx_ninja: call ninja_armParser addStack 3*4 popa - verifyStackoffset g1g2(0x304,0x2F8,0x308) + verifyStackoffset g1g2(0x304,0x2F8,0,0x308) ; Jump back - lea g1g2(ecx,eax,eax), [esp+stackoffset+g1g2(-0x2F2,0x2E5,-0x2F6)] - push g1g2(ecx,eax,eax) - jmp g1g2(0x4DD88C,0x4EECDC,0x4EAE8B)+5 + lea g1g2(ecx,eax,0,eax), [esp+stackoffset+g1g2(-0x2F2,0x2E5,0,-0x2F6)] + push g1g2(ecx,eax,0,eax) + jmp g1g2(0x4DD88C,0x4EECDC,0,0x4EAE8B)+5 global deploy_pfx_ninja deploy_pfx_ninja: - resetStackoffset g1g2(0x8C,0x7C,0xC8) + resetStackoffset g1g2(0x8C,0x7C,0,0xC8) pusha push ninja_injectSrc push NINJA_PATH_PFX @@ -49,17 +49,17 @@ deploy_pfx_ninja: call ninja_armParser addStack 3*4 popa - verifyStackoffset g1g2(0x8C,0x7C,0xC8) + verifyStackoffset g1g2(0x8C,0x7C,0,0xC8) ; Jump back - lea g1g2(eax,ecx,eax), [esp+stackoffset+g1g2(-0x79,-0x69,-0xB5)] - push g1g2(eax,ecx,eax) - jmp g1g2(0x58CA22,0x5A7F33,0x5AC7BC)+5 + lea g1g2(eax,ecx,0,eax), [esp+stackoffset+g1g2(-0x79,-0x69,0,-0xB5)] + push g1g2(eax,ecx,0,eax) + jmp g1g2(0x58CA22,0x5A7F33,0,0x5AC7BC)+5 global deploy_vfx_ninja deploy_vfx_ninja: - resetStackoffset g1g2(0x248,0x234,0x250) + resetStackoffset g1g2(0x248,0x234,0,0x250) pusha push ninja_injectSrc push NINJA_PATH_VFX @@ -68,16 +68,16 @@ deploy_vfx_ninja: call ninja_armParser addStack 3*4 popa - verifyStackoffset g1g2(0x248,0x234,0x250) + verifyStackoffset g1g2(0x248,0x234,0,0x250) ; Jump back %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 2 - lea g1g2(edx,0,eax), [esp+stackoffset+g1g2(-0x239,0,-0x235)] + lea g1g2(edx,0,0,eax), [esp+stackoffset+g1g2(-0x239,0,0,-0x235)] %elif GOTHIC_BASE_VERSION == 112 mov [esp+stackoffset-0x21C], cl %endif - push g1g2(edx,0,eax) - jmp g1g2(0x483A3C,0x48EB1F,0x48B6EF)+5 + push g1g2(edx,0,0,eax) + jmp g1g2(0x483A3C,0x48EB1F,0,0x48B6EF)+5 global deploy_ou_ninja @@ -96,7 +96,7 @@ deploy_ou_ninja: global deploy_content_ninja deploy_content_ninja: - resetStackoffset g1g2(0x90,0x7C,0x80) + resetStackoffset g1g2(0x90,0x7C,0,0x80) call sysEvent ; Overwritten pusha push ninja_injectSrc @@ -105,28 +105,28 @@ deploy_content_ninja: call ninja_armParser addStack 3*4 popa - verifyStackoffset g1g2(0x90,0x7C,0x80) + verifyStackoffset g1g2(0x90,0x7C,0,0x80) ; Jump back - jmp g1g2(0x637208,0x65D5A1,0x6C12B7)+5 + jmp g1g2(0x637208,0x65D5A1,0,0x6C12B7)+5 global deploy_fightai_ninja deploy_fightai_ninja: - resetStackoffset g1g2(0x7C,0x50,0x64) + resetStackoffset g1g2(0x7C,0x50,0,0x64) pusha push ninja_injectSrc push NINJA_PATH_FIGHT - push g1g2(ebx,ebp,ebx) + push g1g2(ebx,ebp,0,ebx) call ninja_armParser addStack 3*4 popa - verifyStackoffset g1g2(0x7C,0x50,0x64) + verifyStackoffset g1g2(0x7C,0x50,0,0x64) ; Jump back - lea g1g2(edx,edx,eax), [esp+stackoffset+g1g2(-0x69,-0x34,-0x51)] - push g1g2(edx,edx,eax) - jmp g1g2(0x747EBA,0x788F52,0x67C626)+5 + lea g1g2(edx,edx,0,eax), [esp+stackoffset+g1g2(-0x69,-0x34,0,-0x51)] + push g1g2(edx,edx,0,eax) + jmp g1g2(0x747EBA,0x788F52,0,0x67C626)+5 global deploy_menu_ninja @@ -144,12 +144,12 @@ deploy_menu_ninja: ; Jump back mov eax, DWORD [zCSoundSystem_zsound] - jmp g1g2(0x4CD57A,0x4DDC34,0x4DA196)+5 + jmp g1g2(0x4CD57A,0x4DDC34,0,0x4DA196)+5 global deploy_camera_ninja deploy_camera_ninja: - resetStackoffset g1g2(0xB4,0x9C,0xB8) + resetStackoffset g1g2(0xB4,0x9C,0,0xB8) pusha push ninja_injectSrc push NINJA_PATH_CAMERA @@ -158,12 +158,12 @@ deploy_camera_ninja: call ninja_armParser addStack 3*4 popa - verifyStackoffset g1g2(0xB4,0x9C,0xB8) + verifyStackoffset g1g2(0xB4,0x9C,0,0xB8) ; Jump back - lea g1g2(eax,edx,edx), [esp+stackoffset+g1g2(-0xA1,-0x89,-0xA5)] - push g1g2(eax,edx,edx) - jmp g1g2(0x49909E,0x4A6138,0x4A0554)+5 + lea g1g2(eax,edx,0,edx), [esp+stackoffset+g1g2(-0xA1,-0x89,0,-0xA5)] + push g1g2(eax,edx,0,edx) + jmp g1g2(0x49909E,0x4A6138,0,0x4A0554)+5 global deploy_ani_ninja @@ -171,9 +171,9 @@ deploy_ani_ninja: %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 - resetStackoffset g1g2(0xF54,0xFD8,0x0) + resetStackoffset g1g2(0xF54,0xFD8,0,0x0) pusha - mov ebp, [esp+stackoffset-g1g2(0xF24,0xFA8,0x0)] ; zCModelPrototype * + mov ebp, [esp+stackoffset-g1g2(0xF24,0xFA8,0,0x0)] ; zCModelPrototype * mov esi, [ebp+0x14] ; name->ptr push esi mov esi, DWORD [zFILE_cur_mds_file] @@ -182,7 +182,7 @@ deploy_ani_ninja: call DWORD [ds_lstrcmpiA] addStack 2*4 test eax, eax - verifyStackoffset g1g2(0xF54,0xFD8,0x0)+32 ; Base + pusha + verifyStackoffset g1g2(0xF54,0xFD8,0,0x0)+32 ; Base + pusha jnz .back sub esp, 0x120 mov eax, esp @@ -203,9 +203,9 @@ deploy_ani_ninja: .back: popa - verifyStackoffset g1g2(0xF54,0xFD8,0x0) - cmp [esp+stackoffset-g1g2(0xE88,0xF20,0x0)], ebp - jmp g1g2(0x57DC40,0x598474,0x0)+7 + verifyStackoffset g1g2(0xF54,0xFD8,0,0x0) + cmp [esp+stackoffset-g1g2(0xE88,0xF20,0,0x0)], ebp + jmp g1g2(0x57DC40,0x598474,0,0x0)+7 %elif GOTHIC_BASE_VERSION == 2 diff --git a/src/exec/init.asm b/src/exec/init.asm index faddb10..01d5c32 100644 --- a/src/exec/init.asm +++ b/src/exec/init.asm @@ -2,7 +2,7 @@ global init_menu init_menu: - resetStackoffset g1g2(0x34,0x3C,0x34) + resetStackoffset g1g2(0x34,0x3C,0,0x34) call zCArraySort_zCMenu___InsertSort ; Overwritten pusha push ninja_initMenu @@ -11,10 +11,10 @@ init_menu: call ninja_dispatch addStack 3*4 popa - verifyStackoffset g1g2(0x34,0x3C,0x34) + verifyStackoffset g1g2(0x34,0x3C,0,0x34) ; Jump back - jmp g1g2(0x4CE909,0x4DF1A6,0x4DB4F9)+5 + jmp g1g2(0x4CE909,0x4DF1A6,0,0x4DB4F9)+5 global init_content @@ -36,4 +36,4 @@ init_content: add esp, 0x8 test eax, eax %endif - jmp g1g2(0x637F84,0x65E408,0x6C20C3)+5 + jmp g1g2(0x637F84,0x65E408,0,0x6C20C3)+5 diff --git a/src/exec/misc.asm b/src/exec/misc.asm index 626a1a0..e895f98 100644 --- a/src/exec/misc.asm +++ b/src/exec/misc.asm @@ -15,7 +15,7 @@ setVobToTransient: test eax, eax jz .back - mov eax, [esi+g1g2(0x7B0,0,0x770)] ; oCNpc.instanz + mov eax, [esi+g1g2(0x7B0,0,0,0x770)] ; oCNpc.instanz test eax, eax jl .back mov edi, eax @@ -84,13 +84,13 @@ setVobToTransient: verifyStackoffset 0x68 ; Jump back - mov eax, [esi+g1g2(0x214,0,0x25C)] - jmp g1g2(0x68CB37,0,0x72F167) + mov eax, [esi+g1g2(0x214,0,0,0x25C)] + jmp g1g2(0x68CB37,0,0,0x72F167) global checkNpcTransient1 checkNpcTransient1: - resetStackoffset g1g2(0x5C,0x5C,0x94) + resetStackoffset g1g2(0x5C,0x5C,0,0x94) call DWORD [edx+0x104] ; oCNpc.IsSelfPlayer(void) test eax, eax jnz .back @@ -102,15 +102,15 @@ checkNpcTransient1: %endif jz .back mov eax, 0x1 - verifyStackoffset g1g2(0x5C,0x5C,0x94) + verifyStackoffset g1g2(0x5C,0x5C,0,0x94) .back: - jmp g1g2(0x6D652A,0x70DF35,0x77F66A)+6 + jmp g1g2(0x6D652A,0x70DF35,0,0x77F66A)+6 global checkNpcTransient2 checkNpcTransient2: - resetStackoffset g1g2(0x5C,0x5C,0x94) + resetStackoffset g1g2(0x5C,0x5C,0,0x94) call DWORD [eax+0x104] ; oCNpc.IsSelfPlayer(void) test eax, eax jnz .back @@ -122,15 +122,15 @@ checkNpcTransient2: %endif jz .back mov eax, 0x1 - verifyStackoffset g1g2(0x5C,0x5C,0x94) + verifyStackoffset g1g2(0x5C,0x5C,0,0x94) .back: - jmp g1g2(0x6D65A3,0x70DFA6,0x77F6E1)+6 + jmp g1g2(0x6D65A3,0x70DFA6,0,0x77F6E1)+6 global removeInvalidNpcs removeInvalidNpcs: - resetStackoffset g1g2(0x58,0,0x8C) + resetStackoffset g1g2(0x58,0,0,0x8C) push ebx push edx @@ -149,16 +149,16 @@ removeInvalidNpcs: pop ecx jz .back - mov eax, [esi+g1g2(0x7B0,0,0x770)] ; oCNpc.instance + mov eax, [esi+g1g2(0x7B0,0,0,0x770)] ; oCNpc.instance test eax, eax jge .back reportToSpy NINJA_REMOVE_NPC push char_meatbug_mds - lea ecx, [esi+g1g2(0x07B4,0,0x774)] ; oCNpc.mds_name + lea ecx, [esi+g1g2(0x07B4,0,0,0x774)] ; oCNpc.mds_name call zSTRING__zSTRING addStack 4 - mov ecx, [esp+stackoffset+g1g2(-0x48,0,-0x7C)] + mov ecx, [esp+stackoffset+g1g2(-0x48,0,0,-0x7C)] mov edx, esi call oCWorld__RemoveFromLists @@ -180,7 +180,7 @@ removeInvalidNpcs: .back: pop edx pop ebx - verifyStackoffset g1g2(0x58,0,0x8C) + verifyStackoffset g1g2(0x58,0,0,0x8C) ; Jump back %if GOTHIC_BASE_VERSION == 1 @@ -197,11 +197,11 @@ removeInvalidNpcs: global removeInvalidNpcs2 removeInvalidNpcs2: - resetStackoffset g1g2(0x5C,0,0x98) + resetStackoffset g1g2(0x5C,0,0,0x98) test esi, esi jz .back - mov eax, [esi+g1g2(0x7B0,0,0x770)] ; oCNpc.instance + mov eax, [esi+g1g2(0x7B0,0,0,0x770)] ; oCNpc.instance test eax, eax jl .remove call oCWorld__InsertInLists @@ -210,13 +210,13 @@ removeInvalidNpcs2: .remove: reportToSpy NINJA_REMOVE_NPC push char_meatbug_mds - lea ecx, [esi+g1g2(0x07B4,0,0x774)] ; oCNpc.mds_name + lea ecx, [esi+g1g2(0x07B4,0,0,0x774)] ; oCNpc.mds_name call zSTRING__zSTRING addStack 4 .back: - verifyStackoffset g1g2(0x5C,0,0x98) - jmp g1g2(0x6D6828,0,0x77F9C0) + verifyStackoffset g1g2(0x5C,0,0,0x98) + jmp g1g2(0x6D6828,0,0,0x77F9C0) global removeNpcInstRef removeNpcInstRef: @@ -236,7 +236,7 @@ removeNpcInstRef: %elif GOTHIC_BASE_VERSION == 2 cmp [esi+0x758], ebp %endif - jmp g1g2(0x68C0FC,0,0x72E62B) + jmp g1g2(0x68C0FC,0,0,0x72E62B) global ninja_injectInfo ninja_injectInfo: @@ -434,7 +434,7 @@ ninja_injectInfo: ; Jump back push esi mov ecx, oCMissionManager_misMan - jmp g1g2(0x63C7F4,0,0x6C6D24) + jmp g1g2(0x63C7F4,0,0,0x6C6D24) global createGlobalVarIfNotExist @@ -483,7 +483,7 @@ fix_Hlp_GetNpc: resetStackoffset 0x10 mov eax, [esi+zCPar_Symbol_offset_offset] test eax, eax - jz g1g2(0x65880E,0,0x6EEE6E) + jz g1g2(0x65880E,0,0,0x6EEE6E) push ecx mov ecx, eax @@ -495,13 +495,13 @@ fix_Hlp_GetNpc: add esp, 0x8 test eax, eax pop ecx - jz g1g2(0x65880E,0,0x6EEE6E) + jz g1g2(0x65880E,0,0,0x6EEE6E) verifyStackoffset 0x10 ; Jump back push edi push oCNpc_RTTI_Type_Descriptor - jmp g1g2(0x6587F2,0,0x6EEE52) + jmp g1g2(0x6587F2,0,0,0x6EEE52) global fix_Hlp_IsValidNpc @@ -527,7 +527,7 @@ fix_Hlp_IsValidNpc: ; Jump back call dynamic_cast .backClean: - jmp g1g2(0x658883,0,0x6EEEE3) + jmp g1g2(0x658883,0,0,0x6EEEE3) global fix_Hlp_IsValidItem @@ -553,7 +553,7 @@ fix_Hlp_IsValidItem: ; Jump back call dynamic_cast .backClean: - jmp g1g2(0x658B43,0,0x6EF1D3) + jmp g1g2(0x658B43,0,0,0x6EF1D3) ; Deinitialize VDFS on fast exit to ensure release of data file @@ -566,15 +566,15 @@ fastexit_deinit_vdfs: ; Deinitialize VDFS on improper CGameManager destruction (access violation) global CGameMananager_destruction_deinit_vdfs CGameMananager_destruction_deinit_vdfs: - resetStackoffset g1g2(0x3C,0x38,0x3C) + resetStackoffset g1g2(0x3C,0x38,0,0x3C) pusha call zFILE_VDFS__DeinitFileSystem popa - verifyStackoffset g1g2(0x3C,0x38,0x3C) + verifyStackoffset g1g2(0x3C,0x38,0,0x3C) ; Jump back mov BYTE [esp+stackoffset-0x4], 0x4 - jmp g1g2(0x423BE1,0x4265C9,0x4247D1) + jmp g1g2(0x423BE1,0x4265C9,0,0x4247D1) ; Deinitialize VDFS on libExit (fatal error) @@ -587,5 +587,5 @@ libExit_deinit_vdfs: verifyStackoffset ; Jump back - mov eax, g1g2(0x86F51C,0,0x8D4294) - jmp g1g2(0x4F3C35,0,0x502AB5) + mov eax, g1g2(0x86F51C,0,0,0x8D4294) + jmp g1g2(0x4F3C35,0,0,0x502AB5) diff --git a/src/exec/parse.asm b/src/exec/parse.asm index 83db5c9..106b7b2 100644 --- a/src/exec/parse.asm +++ b/src/exec/parse.asm @@ -18,7 +18,7 @@ parser_check_func: .back: test eax, eax mov ebp, eax - jnz g1g2(0x6F4980,0,0x79E1D1) + jnz g1g2(0x6F4980,0,0,0x79E1D1) %if GOTHIC_BASE_VERSION == 1 push 0x5AE @@ -32,7 +32,7 @@ parser_check_func: global linker_replace_func linker_replace_func: - resetStackoffset g1g2(0xA8,0,0xE4) + resetStackoffset g1g2(0xA8,0,0,0xE4) %assign var_symb_content 0x4 %assign var_parser 0x0 push edi @@ -45,7 +45,7 @@ linker_replace_func: mov eax, [ecx+zCPar_Symbol_content_offset] test eax, eax - verifyStackoffset g1g2(0xA8,0,0xE4) + 0xC + verifyStackoffset g1g2(0xA8,0,0,0xE4) + 0xC jz .rf_back push eax ; symbol->content @@ -62,7 +62,7 @@ linker_replace_func: call DWORD [ds_lstrcmpiA] addStack 2*4 test eax, eax - verifyStackoffset g1g2(0xA8,0,0xE4) + 0x14 + verifyStackoffset g1g2(0xA8,0,0,0xE4) + 0x14 jz .no_rf_back push edi call DWORD [ds_lstrlenA] @@ -76,7 +76,7 @@ linker_replace_func: mov ecx, [ecx+zCParser_stackpos_offset] mov eax, [esp+var_symb_content] ; symbol->content cmp BYTE [eax+ecx], zPAR_TOK_RET - verifyStackoffset g1g2(0xA8,0,0xE4) + 0x14 + verifyStackoffset g1g2(0xA8,0,0,0xE4) + 0x14 jz .no_rf_back pop ebp ; parser @@ -87,14 +87,14 @@ linker_replace_func: mov BYTE [eax], zPAR_TOK_JUMP mov [eax+1], ecx sub esp, 0x4 - verifyStackoffset g1g2(0xA8,0,0xE4) + 0xC + verifyStackoffset g1g2(0xA8,0,0,0xE4) + 0xC .rf_back: add esp, 0x4 pop ecx pop edi call zCPar_Symbol__SetStackPos - jmp g1g2(0x6E8269,0,0x7915CC) + jmp g1g2(0x6E8269,0,0,0x7915CC) .no_rf_back: sub esp, 0x14 @@ -114,13 +114,13 @@ linker_replace_func: pop ebp add esp, 0x14 pop edi - jmp g1g2(0x6E8269,0,0x7915CC) + jmp g1g2(0x6E8269,0,0,0x7915CC) global parser_check_var parser_check_var: - resetStackoffset g1g2(0x394,0,0x3EC) - xor g1g2(edi,0,ebp), g1g2(edi,0,ebp) + resetStackoffset g1g2(0x394,0,0,0x3EC) + xor g1g2(edi,0,0,ebp), g1g2(edi,0,0,ebp) mov eax, DWORD [zCParser__enableParsing] ; Check if wrapped by Ninja cmp eax, 0x2A jnz .check_sym @@ -131,24 +131,24 @@ parser_check_var: mov eax, DWORD [esi+zCParser_in_class_offset] ; parser->in_class->name test eax, eax jnz .sub_var - lea ecx, [esp+stackoffset+g1g2(-0x354,0,-0x3BC)] ; Variable name + lea ecx, [esp+stackoffset+g1g2(-0x354,0,0,-0x3BC)] ; Variable name push ecx mov ecx, esi call zCParser__GetSymbol_str addStack 4 - mov g1g2(edi,0,ebp), eax - verifyStackoffset g1g2(0x394,0,0x3EC) + mov g1g2(edi,0,0,ebp), eax + verifyStackoffset g1g2(0x394,0,0,0x3EC) jmp .check_sym .sub_var: sub esp, 0x14 push char_dot push eax ; Prefix (function or class name) - lea eax, [esp+stackoffset+g1g2(-0x3A8,0,-0x400)] ; New string + lea eax, [esp+stackoffset+g1g2(-0x3A8,0,0,-0x400)] ; New string push eax call operator_StrPlusChar ; __cdecl add esp, 0xC - mov ecx, DWORD [esp+stackoffset+g1g2(-0x34C,0,-0x3B4)] ; Variable name + mov ecx, DWORD [esp+stackoffset+g1g2(-0x34C,0,0,-0x3B4)] ; Variable name push ecx mov ecx, eax call zSTRING__operator_plusEq @@ -157,13 +157,13 @@ parser_check_var: mov ecx, esi call zCParser__GetSymbol_str addStack 4 - mov g1g2(edi,0,ebp), eax - lea ecx, [esp+stackoffset+g1g2(-0x3A8,0,-0x400)] ; New string + mov g1g2(edi,0,0,ebp), eax + lea ecx, [esp+stackoffset+g1g2(-0x3A8,0,0,-0x400)] ; New string call zSTRING___zSTRING add esp, 0x14 .check_sym: - verifyStackoffset g1g2(0x394,0,0x3EC) + verifyStackoffset g1g2(0x394,0,0,0x3EC) %if GOTHIC_BASE_VERSION == 1 test edi, edi @@ -181,7 +181,7 @@ parser_check_var: global parser_check_class parser_check_class: - resetStackoffset g1g2(0x5C,0,0x50) + resetStackoffset g1g2(0x5C,0,0,0x50) %if GOTHIC_BASE_VERSION == 2 pop ecx %endif @@ -195,7 +195,7 @@ parser_check_class: call zCPar_SymbolTable__GetSymbol_str addStack 4 test eax, eax - verifyStackoffset g1g2(0x5C,0,(0x50-0x4)) + verifyStackoffset g1g2(0x5C,0,0,(0x50-0x4)) ; Jump back %if GOTHIC_BASE_VERSION == 1 @@ -248,7 +248,7 @@ parser_check_prototype: global parser_verify_ikarus_version parser_verify_ikarus_version: - resetStackoffset g1g2(0x398,0,0x3F0) + resetStackoffset g1g2(0x398,0,0,0x3F0) %assign var_newvalue 0x04 push eax push ebx @@ -259,7 +259,7 @@ parser_verify_ikarus_version: mov ecx, [esi+zCParser_mergemode_offset] test ecx, ecx - verifyStackoffset g1g2(0x398,0,0x3F0) + 0x8 + verifyStackoffset g1g2(0x398,0,0,0x3F0) + 0x8 jz .backClean mov ebx, keep_int_symbol_start @@ -272,7 +272,7 @@ parser_verify_ikarus_version: call DWORD [ds_lstrcmpiA] addStack 2*4 test eax, eax - verifyStackoffset g1g2(0x398,0,0x3F0) + 0x8 + verifyStackoffset g1g2(0x398,0,0,0x3F0) + 0x8 jz .skip push ebx call DWORD [ds_lstrlenA] @@ -288,7 +288,7 @@ parser_verify_ikarus_version: call DWORD [ds_lstrcmpiA] addStack 2*4 test eax, eax - verifyStackoffset g1g2(0x398,0,0x3F0) + 0x8 + verifyStackoffset g1g2(0x398,0,0,0x3F0) + 0x8 jnz .back reportToSpy NINJA_VERIFY_VERSION @@ -312,7 +312,7 @@ parser_verify_ikarus_version: ; mov ecx, esp ; Never reached: Safe some space ; call zSTRING___zSTRING add esp, 0x14 - verifyStackoffset g1g2(0x398,0,0x3F0) + 0x8 + verifyStackoffset g1g2(0x398,0,0,0x3F0) + 0x8 jmp .back .verifyFilePath: @@ -333,12 +333,12 @@ parser_verify_ikarus_version: addStack 2*4 pop eax test eax, eax - verifyStackoffset g1g2(0x398,0,0x3F0) + 0x8 + verifyStackoffset g1g2(0x398,0,0,0x3F0) + 0x8 jz .back reportToSpy NINJA_COMPARE_VERSIONS cmp ebx, eax - verifyStackoffset g1g2(0x398,0,0x3F0) + 0x8 + verifyStackoffset g1g2(0x398,0,0,0x3F0) + 0x8 jge .back push edi @@ -407,7 +407,7 @@ parser_verify_ikarus_version: call zCPar_Symbol__GetValue addStack 2*4 pop eax - verifyStackoffset g1g2(0x398,0,0x3F0) + 0x8 + verifyStackoffset g1g2(0x398,0,0,0x3F0) + 0x8 jmp .backClean .back: @@ -416,18 +416,18 @@ parser_verify_ikarus_version: .backClean: pop ebx add esp, 0x4 - verifyStackoffset g1g2(0x398,0,0x3F0) + verifyStackoffset g1g2(0x398,0,0,0x3F0) ; Jump back push eax mov ecx, ebp call zCPar_Symbol__SetValue_int - jmp g1g2(0x6F2459,0,0x79BDD8) + jmp g1g2(0x6F2459,0,0,0x79BDD8) global parser_verify_lego_version parser_verify_lego_version: - resetStackoffset g1g2(0x394,0,0x3EC) + resetStackoffset g1g2(0x394,0,0,0x3EC) push eax push edx push ebx @@ -438,7 +438,7 @@ parser_verify_lego_version: mov ecx, [esi+zCParser_mergemode_offset] test ecx, ecx - verifyStackoffset g1g2(0x394,0,0x3EC) + 0xC + verifyStackoffset g1g2(0x394,0,0,0x3EC) + 0xC jz .back mov ebx, keep_string_symbol_start @@ -451,7 +451,7 @@ parser_verify_lego_version: call DWORD [ds_lstrcmpiA] addStack 2*4 test eax, eax - verifyStackoffset g1g2(0x394,0,0x3EC) + 0xC + verifyStackoffset g1g2(0x394,0,0,0x3EC) + 0xC jz .skip push ebx call DWORD [ds_lstrlenA] @@ -466,15 +466,15 @@ parser_verify_lego_version: call DWORD [ds_lstrcmpiA] addStack 2*4 test eax, eax - verifyStackoffset g1g2(0x394,0,0x3EC) + 0xC + verifyStackoffset g1g2(0x394,0,0,0x3EC) + 0xC jnz .back reportToSpy NINJA_VERIFY_VERSION - mov ecx, [esp+stackoffset+g1g2(-0x340,0,-0x394)+0x8] ; str->ptr + mov ecx, [esp+stackoffset+g1g2(-0x340,0,0,-0x394)+0x8] ; str->ptr push ecx call DWORD [ds_lstrlenA] addStack 4 - mov ecx, [esp+stackoffset+g1g2(-0x340,0,-0x394)+0x8] ; str->ptr + mov ecx, [esp+stackoffset+g1g2(-0x340,0,0,-0x394)+0x8] ; str->ptr sub eax, 0x5 ; Expects "...-Nxxx" add ecx, eax cmp BYTE [ecx], '-' @@ -507,7 +507,7 @@ parser_verify_lego_version: ; mov ecx, esp ; Never reached: Safe some space ; call zSTRING___zSTRING add esp, 0x14 - verifyStackoffset g1g2(0x394,0,0x3EC) + 0xC + verifyStackoffset g1g2(0x394,0,0,0x3EC) + 0xC jmp .back .verifyFilePath: @@ -516,7 +516,7 @@ parser_verify_lego_version: call ninja_scriptPathInvalid addStack 2*4 test eax, eax - verifyStackoffset g1g2(0x394,0,0x3EC) + 0xC + verifyStackoffset g1g2(0x394,0,0,0x3EC) + 0xC jnz .back .compareVersions: @@ -524,7 +524,7 @@ parser_verify_lego_version: lea edx, [eax+edi*0x4] mov eax, [edx+0x8] test eax, eax - verifyStackoffset g1g2(0x394,0,0x3EC) + 0xC + verifyStackoffset g1g2(0x394,0,0,0x3EC) + 0xC jz .back reportToSpy NINJA_COMPARE_VERSIONS @@ -532,15 +532,15 @@ parser_verify_lego_version: call ninja_parseVersionString addStack 4 test eax, eax - verifyStackoffset g1g2(0x394,0,0x3EC) + 0xC + verifyStackoffset g1g2(0x394,0,0,0x3EC) + 0xC jl .back mov ebx, eax - mov eax, [esp+stackoffset+g1g2(-0x340,0,-0x394)+0x8] ; str->ptr + mov eax, [esp+stackoffset+g1g2(-0x340,0,0,-0x394)+0x8] ; str->ptr push eax call ninja_parseVersionString addStack 4 cmp eax, ebx - verifyStackoffset g1g2(0x394,0,0x3EC) + 0xC + verifyStackoffset g1g2(0x394,0,0,0x3EC) + 0xC jge .back push edi @@ -604,17 +604,17 @@ parser_verify_lego_version: jmp .backClean .back: - lea ecx, [esp+stackoffset+g1g2(-0x340,0,-0x394)] + lea ecx, [esp+stackoffset+g1g2(-0x340,0,0,-0x394)] .backClean: pop ebx pop edx pop eax - verifyStackoffset g1g2(0x394,0,0x3EC) + verifyStackoffset g1g2(0x394,0,0,0x3EC) ; Jump back push edi - jmp g1g2(0x6F24B1,0,0x79BE30) + jmp g1g2(0x6F24B1,0,0,0x79BE30) global parser_resolve_path_src @@ -630,7 +630,7 @@ parser_resolve_path_src: push NINJA_PATH_IKARUSSRC call zSTRING__zSTRING addStack 4 - jmp g1g2(0x6E6100,0,0x78F380) + jmp g1g2(0x6E6100,0,0,0x78F380) verifyStackoffset 0x250 .checkLeGo: @@ -644,11 +644,11 @@ parser_resolve_path_src: push NINJA_PATH_LEGOSRC call zSTRING__zSTRING addStack 4 - jmp g1g2(0x6E6100,0,0x78F380) + jmp g1g2(0x6E6100,0,0,0x78F380) verifyStackoffset 0x250 .back: ; Jump back lea ecx, [esp+stackoffset-0x240] call zSTRING__Upper - jmp g1g2(0x6E5F1E,0,0x78F19E) + jmp g1g2(0x6E5F1E,0,0,0x78F19E) diff --git a/src/func/allowRedefine.asm b/src/func/allowRedefine.asm index f5e3b79..6878dfa 100644 --- a/src/func/allowRedefine.asm +++ b/src/func/allowRedefine.asm @@ -50,7 +50,7 @@ ninja_allowRedefine: push eax mov eax, [esp+stackoffset+arg_1] - mov eax, [eax+g1g2(0x10A4,0x10A4,0x20A4)] ; parser->line + mov eax, [eax+g1g2(0x10A4,0x10A4,0,0x20A4)] ; parser->line push 0xA push ecx push eax diff --git a/src/func/armParser.asm b/src/func/armParser.asm index 22e8fed..ca5bbb5 100644 --- a/src/func/armParser.asm +++ b/src/func/armParser.asm @@ -14,8 +14,8 @@ ninja_armParser: push eax mov eax, DWORD [zCParser__ParseBlock+4] push eax - mov DWORD [zCParser__ParseBlock], g1g2(0xC868FF6A,0x1868FF6A,0x0868FF6A) - mov DWORD [zCParser__ParseBlock+4], g1g2(0x64007C4A,0x6400807C,0x640082A6) + mov DWORD [zCParser__ParseBlock], g1g2(0xC868FF6A,0x1868FF6A,0,0x0868FF6A) + mov DWORD [zCParser__ParseBlock+4], g1g2(0x64007C4A,0x6400807C,0,0x640082A6) mov eax, DWORD [zCParser__cur_parser] push eax diff --git a/src/func/conEvalFunc.asm b/src/func/conEvalFunc.asm index 66f9e04..2911eb0 100644 --- a/src/func/conEvalFunc.asm +++ b/src/func/conEvalFunc.asm @@ -182,7 +182,7 @@ ninja_Y3JjMzI: push ecx mov ecx, esp push eax - call g1g2(0x5CE900,0x5ED6A0,0x5F9BF0) + call g1g2(0x5CE900,0x5ED6A0,0,0x5F9BF0) addStack 4 call _itoa add esp, 0xC diff --git a/src/func/initContent.asm b/src/func/initContent.asm index 2b7e49c..ce4cd10 100644 --- a/src/func/initContent.asm +++ b/src/func/initContent.asm @@ -16,7 +16,7 @@ ninja_initContent: addStack 4 add eax, [esp+stackoffset+arg_1] - sub eax, g1g2(0xA,0xC,0xA) ; Cut off/overwrite '\CONTENT_G*.SRC' + sub eax, g1g2(0xA,0xC,0xC,0xA) ; Cut off/overwrite '\CONTENT_G*.SRC' mov BYTE [eax], 0x0 sub eax, 0x4 mov DWORD [eax], 'INIT' diff --git a/src/func/initMenu.asm b/src/func/initMenu.asm index 6013e68..17d3f9f 100644 --- a/src/func/initMenu.asm +++ b/src/func/initMenu.asm @@ -16,7 +16,7 @@ ninja_initMenu: addStack 4 add eax, [esp+stackoffset+arg_1] - sub eax, g1g2(0xA,0xC,0xA) ; Cut off/overwrite '\CONTENT_G*.SRC' + sub eax, g1g2(0xA,0xC,0xC,0xA) ; Cut off/overwrite '\CONTENT_G*.SRC' mov BYTE [eax], 0x0 sub eax, 0x4 mov DWORD [eax], 'MENU' diff --git a/src/hook_CGameManager_destructor.asm b/src/hook_CGameManager_destructor.asm index 8b670fe..193d29c 100644 --- a/src/hook_CGameManager_destructor.asm +++ b/src/hook_CGameManager_destructor.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x423BDC,0x4265C4,0x4247CC) + org g1g2(0x423BDC,0x4265C4,0,0x4247CC) %endif bits 32 diff --git a/src/hook_Hlp_GetNpc.asm b/src/hook_Hlp_GetNpc.asm index 4196fee..466dadc 100644 --- a/src/hook_Hlp_GetNpc.asm +++ b/src/hook_Hlp_GetNpc.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6587EC,0,0x6EEE4C) + org g1g2(0x6587EC,0,0,0x6EEE4C) %endif bits 32 diff --git a/src/hook_Hlp_IsValidItem.asm b/src/hook_Hlp_IsValidItem.asm index a690792..69ad8d5 100644 --- a/src/hook_Hlp_IsValidItem.asm +++ b/src/hook_Hlp_IsValidItem.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x658B3E,0,0x6EF1CE) + org g1g2(0x658B3E,0,0,0x6EF1CE) %endif bits 32 diff --git a/src/hook_Hlp_IsValidNpc.asm b/src/hook_Hlp_IsValidNpc.asm index 8a58c62..d8530ad 100644 --- a/src/hook_Hlp_IsValidNpc.asm +++ b/src/hook_Hlp_IsValidNpc.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x65887E,0,0x6EEEDE) + org g1g2(0x65887E,0,0,0x6EEEDE) %endif bits 32 diff --git a/src/hook_archiveWorldCountLogicalNpc.asm b/src/hook_archiveWorldCountLogicalNpc.asm index 92ab124..eb8c260 100644 --- a/src/hook_archiveWorldCountLogicalNpc.asm +++ b/src/hook_archiveWorldCountLogicalNpc.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6D652A,0x70DF35,0x77F66A) + org g1g2(0x6D652A,0x70DF35,0,0x77F66A) %endif bits 32 diff --git a/src/hook_archiveWorldWriteLogicalNpc.asm b/src/hook_archiveWorldWriteLogicalNpc.asm index 59140fb..fd1cfde 100644 --- a/src/hook_archiveWorldWriteLogicalNpc.asm +++ b/src/hook_archiveWorldWriteLogicalNpc.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6D65A3,0x70DFA6,0x77F6E1) + org g1g2(0x6D65A3,0x70DFA6,0,0x77F6E1) %endif bits 32 diff --git a/src/hook_createVdfArray.asm b/src/hook_createVdfArray.asm index 14220ab..bf1407c 100644 --- a/src/hook_createVdfArray.asm +++ b/src/hook_createVdfArray.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6019C1,0x62377E,0x630B5C) + org g1g2(0x6019C1,0x62377E,0,0x630B5C) %endif bits 32 diff --git a/src/hook_deploy_ani_ninja.asm b/src/hook_deploy_ani_ninja.asm index 153d49d..a5ff81f 100644 --- a/src/hook_deploy_ani_ninja.asm +++ b/src/hook_deploy_ani_ninja.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x57DC40,0x598474,0x5961CD) + org g1g2(0x57DC40,0x598474,0,0x5961CD) %endif bits 32 @@ -17,8 +17,8 @@ section .text align=1 ; Pre ; Overwrites ; %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 - ; resetStackoffset g1g2(0xF54,0xFD8,0x0) - ; cmp [esp+stackoffset-g1g2(0xE88,0xF20,0x0)], ebp + ; resetStackoffset g1g2(0xF54,0xFD8,0,0x0) + ; cmp [esp+stackoffset-g1g2(0xE88,0xF20,0,0x0)], ebp ; %elif GOTHIC_BASE_VERSION == 2 ; resetStackoffset 0x49C ; mov eax, [esp+stackoffset-0x3E0] diff --git a/src/hook_deploy_camera_ninja.asm b/src/hook_deploy_camera_ninja.asm index 54af1bf..135cecc 100644 --- a/src/hook_deploy_camera_ninja.asm +++ b/src/hook_deploy_camera_ninja.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x49909E,0x4A6138,0x4A0554) + org g1g2(0x49909E,0x4A6138,0,0x4A0554) %endif bits 32 @@ -15,6 +15,6 @@ section .text align=1 ; Pre jmp deploy_camera_ninja ; Overwrites - ; resetStackoffset g1g2(0xB4,0,0xB8) - ; lea g1g2(eax,edx,edx), [esp+stackoffset+g1g2(-0xA1,-0x89,-0xA5)] - ; push g1g2(eax,edx,edx) + ; resetStackoffset g1g2(0xB4,0,0,0xB8) + ; lea g1g2(eax,edx,0,edx), [esp+stackoffset+g1g2(-0xA1,-0x89,0,-0xA5)] + ; push g1g2(eax,edx,0,edx) diff --git a/src/hook_deploy_content_ninja.asm b/src/hook_deploy_content_ninja.asm index 0b41c8d..0e1c5a3 100644 --- a/src/hook_deploy_content_ninja.asm +++ b/src/hook_deploy_content_ninja.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x637208,0x65D5A1,0x6C12B7) + org g1g2(0x637208,0x65D5A1,0,0x6C12B7) %endif bits 32 diff --git a/src/hook_deploy_fightai_ninja.asm b/src/hook_deploy_fightai_ninja.asm index dc4ce7d..30ff1e6 100644 --- a/src/hook_deploy_fightai_ninja.asm +++ b/src/hook_deploy_fightai_ninja.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x747EBA,0x788F52,0x67C626) + org g1g2(0x747EBA,0x788F52,0,0x67C626) %endif bits 32 @@ -15,6 +15,6 @@ section .text align=1 ; Pre jmp deploy_fightai_ninja ; Overwrites - ; resetStackoffset g1g2(0x7C,0x50,0x64) - ; lea g1g2(edx,edx,eax), [esp+stackoffset+g1g2(-0x69,-0x34,-0x51)] - ; push g1g2(edx,edx,eax) + ; resetStackoffset g1g2(0x7C,0x50,0,0x64) + ; lea g1g2(edx,edx,0,eax), [esp+stackoffset+g1g2(-0x69,-0x34,0,-0x51)] + ; push g1g2(edx,edx,0,eax) diff --git a/src/hook_deploy_menu_ninja.asm b/src/hook_deploy_menu_ninja.asm index 3306785..bc2ad47 100644 --- a/src/hook_deploy_menu_ninja.asm +++ b/src/hook_deploy_menu_ninja.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x4CD57A,0x4DDC34,0x4DA196) + org g1g2(0x4CD57A,0x4DDC34,0,0x4DA196) %endif bits 32 diff --git a/src/hook_deploy_music_ninja.asm b/src/hook_deploy_music_ninja.asm index e793378..ad4d02c 100644 --- a/src/hook_deploy_music_ninja.asm +++ b/src/hook_deploy_music_ninja.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x4DA448,0x4EB55C,0x4E765C) + org g1g2(0x4DA448,0x4EB55C,0,0x4E765C) %endif bits 32 @@ -15,6 +15,6 @@ section .text align=1 ; Pre jmp deploy_music_ninja ; Overwrites - ; resetStackoffset g1g2(0xD8,0xB0,0xC8) - ; lea g1g2(edx,eax,edx), [esp+stackoffset+g1g2(-0xC5,-0x9D,-0xB5)] - ; push g1g2(edx,eax,edx) + ; resetStackoffset g1g2(0xD8,0xB0,0,0xC8) + ; lea g1g2(edx,eax,0,edx), [esp+stackoffset+g1g2(-0xC5,-0x9D,0,-0xB5)] + ; push g1g2(edx,eax,0,edx) diff --git a/src/hook_deploy_ou_ninja.asm b/src/hook_deploy_ou_ninja.asm index 953fc3e..e77471d 100644 --- a/src/hook_deploy_ou_ninja.asm +++ b/src/hook_deploy_ou_ninja.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x41BE77,0x41DCD7,0x41C407) + org g1g2(0x41BE77,0x41DCD7,0,0x41C407) %endif bits 32 diff --git a/src/hook_deploy_pfx_ninja.asm b/src/hook_deploy_pfx_ninja.asm index 14bbeb9..2695844 100644 --- a/src/hook_deploy_pfx_ninja.asm +++ b/src/hook_deploy_pfx_ninja.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x58CA22,0x5A7F33,0x5AC7BC) + org g1g2(0x58CA22,0x5A7F33,0,0x5AC7BC) %endif bits 32 @@ -15,6 +15,6 @@ section .text align=1 ; Pre jmp deploy_pfx_ninja ; Overwrites - ; resetStackoffset g1g2(0x8C,0x7C,0xC8) - ; lea g1g2(eax,ecx,eax), [esp+stackoffset+g1g2(-0x79,-0x69,-0xB5)] - ; push g1g2(eax,ecx,eax) + ; resetStackoffset g1g2(0x8C,0x7C,0,0xC8) + ; lea g1g2(eax,ecx,0,eax), [esp+stackoffset+g1g2(-0x79,-0x69,0,-0xB5)] + ; push g1g2(eax,ecx,0,eax) diff --git a/src/hook_deploy_sfx_ninja.asm b/src/hook_deploy_sfx_ninja.asm index 01a6d87..702910c 100644 --- a/src/hook_deploy_sfx_ninja.asm +++ b/src/hook_deploy_sfx_ninja.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x4DD88C,0x4EECDC,0x4EAE8B) + org g1g2(0x4DD88C,0x4EECDC,0,0x4EAE8B) %endif bits 32 @@ -15,6 +15,6 @@ section .text align=1 ; Pre jmp deploy_sfx_ninja ; Overwrites - ; resetStackoffset g1g2(0x304,0x2F8,0x308) - ; lea g1g2(ecx,eax,eax), [esp+stackoffset+g1g2(-0x2F2,0x2E5,-0x2F6)] - ; push g1g2(ecx,eax,eax) + ; resetStackoffset g1g2(0x304,0x2F8,0,0x308) + ; lea g1g2(ecx,eax,0,eax), [esp+stackoffset+g1g2(-0x2F2,0x2E5,0,-0x2F6)] + ; push g1g2(ecx,eax,0,eax) diff --git a/src/hook_deploy_vfx_ninja.asm b/src/hook_deploy_vfx_ninja.asm index 4c2b9d6..3f6f2c3 100644 --- a/src/hook_deploy_vfx_ninja.asm +++ b/src/hook_deploy_vfx_ninja.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x483A3C,0x48EB1F,0x48B6EF) + org g1g2(0x483A3C,0x48EB1F,0,0x48B6EF) %endif bits 32 @@ -18,10 +18,10 @@ section .text align=1 ; Pre %endif ; Overwrites - ; resetStackoffset g1g2(0x248,0x234,0x250) + ; resetStackoffset g1g2(0x248,0x234,0,0x250) ; %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 2 - ; lea g1g2(edx,0,eax), [esp+stackoffset+g1g2(-0x239,0,-0x235)] + ; lea g1g2(edx,0,0,eax), [esp+stackoffset+g1g2(-0x239,0,0,-0x235)] ; %elif GOTHIC_BASE_VERSION == 112 ; mov [esp+stackoffset-0x21C], cl ; %endif - ; push g1g2(edx,0,eax) + ; push g1g2(edx,0,0,eax) diff --git a/src/hook_fastexit.asm b/src/hook_fastexit.asm index ed7a640..0c51baf 100644 --- a/src/hook_fastexit.asm +++ b/src/hook_fastexit.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x4249B2,0,0x4256AF) + org g1g2(0x4249B2,0,0,0x4256AF) %endif bits 32 diff --git a/src/hook_init_content.asm b/src/hook_init_content.asm index 4aead9b..dd3e482 100644 --- a/src/hook_init_content.asm +++ b/src/hook_init_content.asm @@ -5,7 +5,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x637F84,0x65E408,0x6C20C3) + org g1g2(0x637F84,0x65E408,0,0x6C20C3) %endif bits 32 diff --git a/src/hook_init_menu.asm b/src/hook_init_menu.asm index 7fdfa48..cfa99f6 100644 --- a/src/hook_init_menu.asm +++ b/src/hook_init_menu.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x4CE909,0x4DF1A6,0x4DB4F9) + org g1g2(0x4CE909,0x4DF1A6,0,0x4DB4F9) %endif bits 32 diff --git a/src/hook_libExit.asm b/src/hook_libExit.asm index bcb401e..8c3e9e1 100644 --- a/src/hook_libExit.asm +++ b/src/hook_libExit.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x4F3C30,0,0x502AB0) + org g1g2(0x4F3C30,0,0,0x502AB0) %endif bits 32 diff --git a/src/hook_linkerReplaceFunc.asm b/src/hook_linkerReplaceFunc.asm index 7272c22..216b5d1 100644 --- a/src/hook_linkerReplaceFunc.asm +++ b/src/hook_linkerReplaceFunc.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6E79C1,0,0x790CA8) + org g1g2(0x6E79C1,0,0,0x790CA8) %endif bits 32 diff --git a/src/hook_npcReference.asm b/src/hook_npcReference.asm index 8ba260a..a2bc968 100644 --- a/src/hook_npcReference.asm +++ b/src/hook_npcReference.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x68C0F6,0,0x72E625) + org g1g2(0x68C0F6,0,0,0x72E625) %endif bits 32 diff --git a/src/hook_oCSpawnManager__Archive.asm b/src/hook_oCSpawnManager__Archive.asm index 068388f..89fcdf8 100644 --- a/src/hook_oCSpawnManager__Archive.asm +++ b/src/hook_oCSpawnManager__Archive.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6D0F40,0,0x7797F0) + org g1g2(0x6D0F40,0,0,0x7797F0) %endif bits 32 diff --git a/src/hook_parserDeclareClass.asm b/src/hook_parserDeclareClass.asm index c9647a6..0afd966 100644 --- a/src/hook_parserDeclareClass.asm +++ b/src/hook_parserDeclareClass.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6F2B21,0,0x79C432) + org g1g2(0x6F2B21,0,0,0x79C432) %endif bits 32 diff --git a/src/hook_parserDeclareFunc.asm b/src/hook_parserDeclareFunc.asm index 5220c2a..f3fd5a1 100644 --- a/src/hook_parserDeclareFunc.asm +++ b/src/hook_parserDeclareFunc.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6F494E,0,0x79E1AE) + org g1g2(0x6F494E,0,0,0x79E1AE) %endif bits 32 diff --git a/src/hook_parserDeclarePrototype.asm b/src/hook_parserDeclarePrototype.asm index fb152ff..619acf5 100644 --- a/src/hook_parserDeclarePrototype.asm +++ b/src/hook_parserDeclarePrototype.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6F36B2,0,0x79CF72) + org g1g2(0x6F36B2,0,0,0x79CF72) %endif bits 32 diff --git a/src/hook_parserDeclareVar.asm b/src/hook_parserDeclareVar.asm index 866ce14..1bf1fdd 100644 --- a/src/hook_parserDeclareVar.asm +++ b/src/hook_parserDeclareVar.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6F18CD,0,0x79B3B5) + org g1g2(0x6F18CD,0,0,0x79B3B5) %endif bits 32 diff --git a/src/hook_parserDeclareVar_constInt.asm b/src/hook_parserDeclareVar_constInt.asm index 501a349..baa36d5 100644 --- a/src/hook_parserDeclareVar_constInt.asm +++ b/src/hook_parserDeclareVar_constInt.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6F2451,0,0x79BDD0) + org g1g2(0x6F2451,0,0,0x79BDD0) %endif bits 32 diff --git a/src/hook_parserDeclareVar_constString.asm b/src/hook_parserDeclareVar_constString.asm index 986c586..2775a8e 100644 --- a/src/hook_parserDeclareVar_constString.asm +++ b/src/hook_parserDeclareVar_constString.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6F24AC,0,0x79BE2B) + org g1g2(0x6F24AC,0,0,0x79BE2B) %endif bits 32 diff --git a/src/hook_parserParseSource.asm b/src/hook_parserParseSource.asm index a4ff839..cd096c0 100644 --- a/src/hook_parserParseSource.asm +++ b/src/hook_parserParseSource.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6E5F19,0,0x78F199) + org g1g2(0x6E5F19,0,0,0x78F199) %endif bits 32 diff --git a/src/hook_setVobToTransient.asm b/src/hook_setVobToTransient.asm index 0a26ca0..f14add4 100644 --- a/src/hook_setVobToTransient.asm +++ b/src/hook_setVobToTransient.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x68CB31,0,0x72F161) + org g1g2(0x68CB31,0,0,0x72F161) %endif bits 32 diff --git a/src/hook_unarchiveInfoMan.asm b/src/hook_unarchiveInfoMan.asm index ebfbe6c..bbcf433 100644 --- a/src/hook_unarchiveInfoMan.asm +++ b/src/hook_unarchiveInfoMan.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x63C7EE,0,0x6C6D1E) + org g1g2(0x63C7EE,0,0,0x6C6D1E) %endif bits 32 diff --git a/src/hook_unarchiveNpcs.asm b/src/hook_unarchiveNpcs.asm index 3b6e0f7..4607519 100644 --- a/src/hook_unarchiveNpcs.asm +++ b/src/hook_unarchiveNpcs.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6D6823,0,0x77F9BB) + org g1g2(0x6D6823,0,0,0x77F9BB) %endif bits 32 diff --git a/src/hook_unarchiveVobs.asm b/src/hook_unarchiveVobs.asm index 7e60e9c..f283ee6 100644 --- a/src/hook_unarchiveVobs.asm +++ b/src/hook_unarchiveVobs.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x5F8149,0,0x62678A) + org g1g2(0x5F8149,0,0,0x62678A) %endif bits 32 diff --git a/src/hook_zCPar_Symbol__GetNext.asm b/src/hook_zCPar_Symbol__GetNext.asm index 367aa94..97a2b70 100644 --- a/src/hook_zCPar_Symbol__GetNext.asm +++ b/src/hook_zCPar_Symbol__GetNext.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6F84D0,0x732740,0x7A1DD0) + org g1g2(0x6F84D0,0x732740,0,0x7A1DD0) %endif bits 32 diff --git a/src/hook_zCParser__LoadGlobalVars.asm b/src/hook_zCParser__LoadGlobalVars.asm index d1db8f5..7684d63 100644 --- a/src/hook_zCParser__LoadGlobalVars.asm +++ b/src/hook_zCParser__LoadGlobalVars.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6EDAD5,0,0x7973E1) + org g1g2(0x6EDAD5,0,0,0x7973E1) %endif bits 32 diff --git a/src/inc/engine.inc b/src/inc/engine.inc index 8790714..3f8881f 100644 --- a/src/inc/engine.inc +++ b/src/inc/engine.inc @@ -10,6 +10,10 @@ %include "inc/engine_g112.inc" + %elif GOTHIC_BASE_VERSION == 130 + + %include "inc/engine_g130.inc" + %elif GOTHIC_BASE_VERSION == 2 %include "inc/engine_g2.inc" diff --git a/src/inc/engine_g130.inc b/src/inc/engine_g130.inc new file mode 100644 index 0000000..cd03c5e --- /dev/null +++ b/src/inc/engine_g130.inc @@ -0,0 +1,242 @@ +%ifndef ENGINE_G130_INC + %define ENGINE_G130_INC + + %define _atexit 0x ; void (__cdecl *)() + %define _exit 0x ; void + %define operator_new 0x ; uint + + %define operator_delete 0x ; void * + %define _memset 0x ; void *, int, size_t + %define dynamic_cast 0x ; void **, int, TypeDescriptor *, TypeDescriptor *, int + %define operator_StrPlusChar 0x ; zSTRING const &, char const * + %define zCArray_int___zCArray_int_ 0x ; void + %define zCArray_int___InsertEnd 0x ; int const & + %define zCArray_int____zCArray_int_ 0x ; void + %define zCArraySort_zCMenu___InsertSort 0x ; zCMenu * + %define zCArraySort_int___QuickSort 0x ; void + %define _qsort 0x ; void *, size_t, size_t, int (__cdecl *)(const void *, const void *) + %define _fopen 0x ; const char *, const char * + %define _fseek 0x ; FILE *, __int32, int + %define _fread 0x ; void *, size_t, size_t, FILE * + %define _fclose 0x ; FILE * + %define _findfirst 0x ; const char *, finddata_t * + %define _findnext 0x ; int, _finddata_t * + %define _findclose 0x ; int + %define zFILE_VDFS__LockCriticalSection 0x ; void + %define zFILE_VDFS__UnlockCriticalSection 0x ; void + %define zFILE_cur_mds_file 0x ; zFILE * + %define zFILE_VDFS__DeinitFileSystem 0x ; void + %define std__basic_string__assign 0x ; char const *, uint + %define _atol 0x ; const char * + %define _itoa 0x ; int, char *, int + %define zSTRING__zSTRING 0x ; char const * + %define zSTRING__zSTRING_void 0x ; void + %define zSTRING___zSTRING 0x ; void + %define zSTRING__Sprintf 0x ; char const *, ... + %define zSTRING__Upper 0x ; void + %define zSTRING__Search 0x ; int, char const *, uint + %define zSTRING__TrimRight 0x ; char + %define zSTRING__Delete 0x ; uint, ulong + %define zSTRING__DeleteRight 0x ; uint + %define zSTRING__operator_eq 0x ; char const * + %define zSTRING__operator_plusEq 0x ; char const * + %define ds_lstrcatA 0x ; LPTSTR, LPTSTR + %define ds_lstrcpyA 0x ; LPTSTR, LPTSTR + %define ds_lstrlenA 0x ; LPCSTR + %define ds_lstrcmpiA 0x ; LPCSTR, LPCSTR + %define _strncmp 0x ; char *, char *, int + %define ds_vdf_fexists 0x ; const char*, long + %define sysEvent 0x ; void + %define zCParser_parser 0x ; zCParser + %define zCParser__CallFunc 0x ; zSTRING const & + %define zCParser__ParseBlock 0x ; void + %define zCParser__Error 0x ; zSTRING &, int + %define zCParser__MergeFile 0x ; zSTRING & + %define zCParser__GetIndex 0x ; zSTRING const & + %define zCParser__GetSymbol_str 0x ; zSTRING const & + %define zCParser__GetSymbolInfo 0x ; int, int &, int & + %define zCParser__GetInstance 0x ; int, int + %define zCParser__CreateInstance 0x ; int, void * + %define zCParser__cur_parser 0x ; zCParser * + %define zCParser__enableParsing 0x ; int + %define zCParser__ClearInstanceRefs 0x ; void * + %define zCPar_SymbolTable__Insert 0x ; zCPar_Symbol * + %define zCPar_SymbolTable__GetIndex 0x ; zCPar_Symbol * + %define zCPar_SymbolTable__GetIndex_str 0x ; zSTRING const & + %define zCPar_SymbolTable__GetSymbol_int 0x ; int + %define zCPar_SymbolTable__GetSymbol_str 0x ; zSTRING const & + %define zCPar_SymbolTable__cur_table 0x ; zCPar_SymbolTable * + %define zCPar_Symbol__zCPar_Symbol 0x ; void + %define zCPar_Symbol__SetFlag 0x ; int + %define zCPar_Symbol__GetValue 0x ; int &, int + %define zCPar_Symbol__SetValue_int 0x ; int, int + %define zCPar_Symbol__SetValue_str 0x ; zSTRING &, int + %define zCPar_Symbol__SetStackPos 0x ; int, int + %define zCMusicSys_DirectMusic__musicParser 0x ; zCParser * + %define zCSndSys_MSS__sfxParser 0x ; zCParser * + %define zCParticleFX__s_pfxParser 0x ; zCParser * + %define oCVisualFX__fxParser 0x ; zCParser * + %define zCMenu__menuParser 0x ; zCParser * + %define zCAICamera__cameraParser 0x ; zCParser * + %define zCSoundSystem_zsound 0x ; zCSoundSystem * + %define oCGame_ogame 0x ; oCGame * + %define oCGame__GetInfoManager 0x ; void + %define oCMissionManager_misMan 0x ; oCMissionManager* + %define oCNpc__classDef 0x ; zCClassDef + %define oCItem__classDef 0x ; zCClassDef + %define zCObject__CheckInheritance 0x ; zCClassDef const *, zCClassDef const * + %define oCWorld__InsertInLists 0x ; zCVob * + %define oCWorld__RemoveFromLists 0x ; zCVob * + %define zCConsole_zcon 0x ; zCConsole * + %define zCConsole__AddEvalFunc 0x ; int (*)(zSTRING const &, zSTRING &) + %define zCConsole__Register 0x ; zSTRING const &, zSTRING const & + %define zERROR_zerr 0x ; zERROR * + %define zERROR__SearchForSpy 0x ; void + %define zERROR__Report 0x ; zERROR_TYPE, int, zSTRING const &, signed char, uint, int, char *, char * + %define zERROR__Message 0x ; zSTRING const & + %define zERROR__Fatal 0x ; zSTRING const & + %define zCOption_zoptions 0x ; zCOption * + %define zCOption_zgameoptions 0x ; zCOption * + %define zCOption__ReadString 0x ; zSTRING const &, char const *, char const * + %define zCOption__GetDirString 0x ; zTOptionPaths + %define zCOption__ParmValue 0x ; zSTRING const & + %define zCObjectFactory_zfactory 0x ; zCObjectFactory * + %define zCModelPrototype__ReadModel 0x ; zCFileBIN & + %define zCModelPrototype__SearchAniIndex 0x ; zSTRING const & + %define zCModelAni__deleting_destructor 0x ; uint + %define zCArchiverFactory__CreateArchiverRead 0x ; zFILE *, int + %define zCArchiverFactory_zarcFactory 0x ; zCArchiverFactory + %define zCCSManager__LibValidateOU 0x ; zString * + %define zCCSManager__LibAddOU 0x ; zCCSBlock * + %define zCCSLib___CreateNewInstance 0x ; void + %define zCCSLib__deleting_destructor 0x ; uint + %define zCCSBlock__deleting_destructor 0x ; uint + %define zCListSort__GetNumInList 0x ; void + %define zCListSort__InsertSort 0x ; void * + %define oCInfo__oCInfo 0x ; void + %define oCInfo__SetInstance 0x ; int + %define oCInfo__DoCheck 0x ; void + %define oCNpc_RTTI_Type_Descriptor 0x ; TypeDescriptor + + %define SystemPack_version_info 0x ; char + %define NINJA_PATCH_ARRAY 0x ; zCArray + + %define char_NUL 0x ; 0 + %define char_space 0x ; ' ', 0 + %define char_cnpc 0x ; 'C_NPC', 0 + %define char_model 0x ; 'MODEL', 0 + %define char_mds 0x ; '.MDS', 0 + %define char_src 0x ; '.SRC', 0 + %define char_dot 0x ; '.', 0 + %define char_commaSpace 0x ; ', ', 0 + %define char_BSlash 0x ; '\', 0 + %define char_doubleFSlash 0x ; '//', 0 + %define char_lf 0x ; 0xA, 0 + %define char_line 0x ; ' line ( ', 0 + %define char_spaceClosingParanthesis 0x ; ' )', 0 + %define char_npc 0x ; 'npc', 0 + %define char_spawnPos 0x ; 'spawnPos', 0 + %define char_timer 0x ; 'timer', 0 + %define char_noOfEntries 0x ; 'NoOfEntries', 0 + %define char_spawningEnabled 0x ; 'spawningEnabled', 0 + %define char_spawnFlags 0x ; 'spawnFlags', 0 + %define char_zStartupWindowed 0x ; 'zStartupWindowed', 0 + %define char_settings 0x ; 'SETTINGS', 0 + %define char_meatbug_mds 0x ; 'Meatbug.mds', 0 + %define char_redefinedIdentifier 0x ; 'Redefined identifier : ', 0 + %define zSTRING_mdlBuffer 0x ; zSTRING * + %define zSTRING_infoClass 0x ; zSTRING + %define zSTRING_empty 0x ; zSTRING const + %define zOPT_SEC_GAME 0x ; zSTRING const + + %define zCObjectFactory__CreateZFile_offset 0x14 ; zSTRING const & + %define zFILE_VDFS__Exists_offset 0x94 ; void + %define zFILE_VDFS__Open_offset 0x8C ; bool + %define zFILE_VDFS__Eof_offset 0xB0 ; void + %define zFILE_VDFS__Read_offset 0xC4 ; zSTRING & + %define zFILE_VDFS__Close_offset 0x98 ; void + %define zFILE_VDFS__deleting_destructor_offset 0x0 ; uint + + %define zCArchiver__ReadObject_offset 0xB0 ; zCObject * + %define zCArchiver__Close_offset 0xE0 ; void + %define zCArchiver__deleting_destructor_offset 0xC ; uint + + %define zCParser_file_offset 0x4 + %define zCParser_table_offset 0x10 + %define zCParser_lastsym_offset 0x34 + %define zCParser_stackpos_offset 0x48 + %define zCParser_stringcount_offset 0x + %define zCParser_in_func_offset 0x ; zCPar_Symbol * + %define zCParser_in_class_offset 0x ; zCPar_Symbol * + %define zCParser_datsave_offset 0x + %define zCParser_mergemode_offset 0x + + + %define zCPar_Symbol_content_offset 0x18 + %define zCPar_Symbol_offset_offset 0x1C + %define zCPar_Symbol_bitfield_offset 0x20 + + %define zPAR_TOK_RET 0x3C + %define zPAR_TOK_JUMP 0x4B + + %define zPAR_TYPE_INT 2<<12 + %define zPAR_TYPE_STRING 3<<12 + %define zPAR_TYPE_PROTOTYPE 6<<12 + %define zPAR_TYPE_INSTANCE 7<<12 + + %define zPAR_FLAG_CONST 1<<16 + + %define char_sep 0x1A + %define INVALID_HANDLE_VALUE 0xFFFFFFFF + %define VDF_VIRTUAL 1 + %define VDF_PHYSICAL 2 + %define VDF_PHYSICALFIRST 4 + %define VDF_TYPE_DIR 0x80000000 + %define VDF_TYPE_LAST 0x40000000 + + %define DIR_ANIMS 4 + + %define SEEK_SET 0 + + struc zCArray + .array: resd 0x1 ; 0x0 T* + .numAlloc: resd 0x1 ; 0x4 int + .numInArray: resd 0x1 ; 0x8 int + endstruc + + struc zCArraySort + .array: resd 0x1 ; 0x0 T* + .numAlloc: resd 0x1 ; 0x4 int + .numInArray: resd 0x1 ; 0x8 int + .compare: resd 0x1 ; 0xC int (__cdecl *)(void *, void *) + endstruc + + struc finddata_t + .attrib resd 0x1 ; 0x00 + .time_create resd 0x1 ; 0x04 + .time_access resd 0x1 ; 0x08 + .time_write resd 0x1 ; 0x0C + .size resd 0x1 ; 0x10 + .name resb 0x104 ; 0x14 + endstruc + + struc VDFheader + .comment resb 0x100 ; 0x000 char[] + .signature resb 0x10 ; 0x100 char[] + .numEntries resd 0x1 ; 0x110 int + .numFiles resd 0x1 ; 0x114 int + .timestamp resd 0x1 ; 0x118 int + .datasize resd 0x1 ; 0x11C int + .rootOffset resd 0x1 ; 0x120 int + .entrySize resd 0x1 ; 0x124 int + endstruc + + struc VDFentry + .name resb 0x40 ; 0x00 char[] + .offset resd 0x1 ; 0x40 int + .size resd 0x1 ; 0x44 int + .type resd 0x1 ; 0x48 int + .attrib resd 0x1 ; 0x4C int + endstruc + +%endif diff --git a/src/inc/macros.inc b/src/inc/macros.inc index 6e99a61..58716d3 100644 --- a/src/inc/macros.inc +++ b/src/inc/macros.inc @@ -3,9 +3,9 @@ ; Sanity check %ifndef GOTHIC_BASE_VERSION - %fatal "Macro GOTHIC_BASE_VERSION must be defined (1, 112, or 2)." - %elif GOTHIC_BASE_VERSION != 1 && GOTHIC_BASE_VERSION != 112 && GOTHIC_BASE_VERSION != 2 - %fatal "GOTHIC_BASE_VERSION must either be 1, 112, or 2." + %fatal "Macro GOTHIC_BASE_VERSION must be defined (1, 112, 130, or 2)." + %elif GOTHIC_BASE_VERSION != 1 && GOTHIC_BASE_VERSION != 112 && GOTHIC_BASE_VERSION != 130 && GOTHIC_BASE_VERSION != 2 + %fatal "GOTHIC_BASE_VERSION must either be 1, 112, 130, or 2." %endif ; General macros @@ -16,11 +16,13 @@ %define LEGO_N_VERSION %!LEGO_N_VERSION %define MAX_VDF_TIME 0x7F9FBF7D ; 2043-12-23 23:59:58 %if GOTHIC_BASE_VERSION == 1 - %define g1g2(g1,g112,g2) g1 + %define g1g2(g1,g112,g130,g2) g1 %elif GOTHIC_BASE_VERSION == 112 - %define g1g2(g1,g112,g2) g112 + %define g1g2(g1,g112,g130,g2) g112 + %elif GOTHIC_BASE_VERSION == 130 + %define g1g2(g1,g112,g130,g2) g130 %elif GOTHIC_BASE_VERSION == 2 - %define g1g2(g1,g112,g2) g2 + %define g1g2(g1,g112,g130,g2) g2 %endif %include "inc/stackops.inc" diff --git a/src/inc/symbols.inc b/src/inc/symbols.inc index 1afd388..3d619b0 100644 --- a/src/inc/symbols.inc +++ b/src/inc/symbols.inc @@ -10,6 +10,10 @@ %include "inc/symbols_g112.inc" + %elif GOTHIC_BASE_VERSION == 130 + + %include "inc/symbols_g130.inc" + %elif GOTHIC_BASE_VERSION == 2 %include "inc/symbols_g2.inc" diff --git a/src/ow_ani.asm b/src/ow_ani.asm index 0787233..e374089 100644 --- a/src/ow_ani.asm +++ b/src/ow_ani.asm @@ -5,7 +5,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x57D639,0,0x59C406) + org g1g2(0x57D639,0,0,0x59C406) %endif bits 32 @@ -13,27 +13,27 @@ bits 32 section .text align=1 ; Prevent auto-alignment - resetStackoffset g1g2(0xF54,0,0x1310) + resetStackoffset g1g2(0xF54,0,0,0x1310) push eax ; Existing zCModelAni * - mov ecx, [esp+stackoffset+g1g2(-0xF24,0,-0x12C8)] + mov ecx, [esp+stackoffset+g1g2(-0xF24,0,0,-0x12C8)] push ecx - mov edx, [esp+stackoffset+g1g2(-0xF44,0,-0x12FC)] + mov edx, [esp+stackoffset+g1g2(-0xF44,0,0,-0x12FC)] add edx, 0x24 call zCModelPrototype__SearchAniIndex ; __fastcall pop ecx mov ecx, [ecx+0x48] - mov edx, [esp+stackoffset+g1g2(-0xF44,0,-0x12FC)] + mov edx, [esp+stackoffset+g1g2(-0xF44,0,0,-0x12FC)] mov [ecx+eax*0x4], edx ; New ani pop ecx ; Old ani mov eax, [ecx+0x4] dec eax ; Decrease refCtr mov [ecx+0x4], eax cmp eax, 0 - verifyStackoffset g1g2(0xF54,0,0x1310) - jg g1g2(0x57D8F8,0,0x59C6C3) ; Continue + verifyStackoffset g1g2(0xF54,0,0,0x1310) + jg g1g2(0x57D8F8,0,0,0x59C6C3) ; Continue push 0x1 ; If refCtr <= 0 then call zCModelAni__deleting_destructor addStack 4 - verifyStackoffset g1g2(0xF54,0,0x1310) - jmp g1g2(0x57D8F8,0,0x59C6C3) + verifyStackoffset g1g2(0xF54,0,0,0x1310) + jmp g1g2(0x57D8F8,0,0,0x59C6C3) ; Room to 0x57D69A (g1), 0x59C459 (g2) diff --git a/src/ow_aniAlias.asm b/src/ow_aniAlias.asm index 3101b4d..afdffd7 100644 --- a/src/ow_aniAlias.asm +++ b/src/ow_aniAlias.asm @@ -5,7 +5,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x579D54,0,0x597AA7) + org g1g2(0x579D54,0,0,0x597AA7) %endif bits 32 @@ -13,28 +13,28 @@ bits 32 section .text align=1 ; Prevent auto-alignment - resetStackoffset g1g2(0xF54,0,0x12E8) + resetStackoffset g1g2(0xF54,0,0,0x12E8) push eax ; Existing zCModelAni * - mov ecx, [esp+stackoffset+g1g2(-0xF24,0,-0x12A0)] ; zCModelPrototype * + mov ecx, [esp+stackoffset+g1g2(-0xF24,0,0,-0x12A0)] ; zCModelPrototype * push ecx - mov edx, g1g2(edi,0,ebp) ; New zCModelAni->name + mov edx, g1g2(edi,0,0,ebp) ; New zCModelAni->name call zCModelPrototype__SearchAniIndex ; __fastcall pop ecx mov ecx, [ecx+0x48] %if GOTHIC_BASE_VERSION == 1 mov edx, [esp+stackoffset-0xF38] ; New zCModelAni * %endif - mov [ecx+eax*0x4], g1g2(edx,0,edi) ; New ani + mov [ecx+eax*0x4], g1g2(edx,0,0,edi) ; New ani pop ecx ; Old ani mov eax, [ecx+0x4] dec eax ; Decrease refCtr mov [ecx+0x4], eax cmp eax, 0 - verifyStackoffset g1g2(0xF54,0,0x12E8) - jg g1g2(0x579DC2,0,0x597B10) ; Continue + verifyStackoffset g1g2(0xF54,0,0,0x12E8) + jg g1g2(0x579DC2,0,0,0x597B10) ; Continue push 0x1 ; If refCtr <= 0 then call zCModelAni__deleting_destructor addStack 4 - verifyStackoffset g1g2(0xF54,0,0x12E8) - jmp g1g2(0x579DC2,0,0x597B10) ; Continue + verifyStackoffset g1g2(0xF54,0,0,0x12E8) + jmp g1g2(0x579DC2,0,0,0x597B10) ; Continue ; Room to 0x579DB5 (g1), 0x597AFA (g2) diff --git a/src/ow_aniBatch.asm b/src/ow_aniBatch.asm index 2724c1e..0aae0c1 100644 --- a/src/ow_aniBatch.asm +++ b/src/ow_aniBatch.asm @@ -5,7 +5,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x57A72A,0,0x59875B) + org g1g2(0x57A72A,0,0,0x59875B) %endif bits 32 @@ -13,9 +13,9 @@ bits 32 section .text align=1 ; Prevent auto-alignment - resetStackoffset g1g2(0xF54,0,0x128C) + resetStackoffset g1g2(0xF54,0,0,0x128C) push eax ; Existing zCModelAni * - mov ecx, [esp+stackoffset+g1g2(-0xF24,0,-0x1244)] ; zCModelPrototype * + mov ecx, [esp+stackoffset+g1g2(-0xF24,0,0,-0x1244)] ; zCModelPrototype * push ecx %if GOTHIC_BASE_VERSION == 1 mov edx, [esp+stackoffset-0xF38] ; New zCModelAni * @@ -29,17 +29,17 @@ section .text align=1 ; Pre %if GOTHIC_BASE_VERSION == 1 mov edx, [esp+stackoffset-0xF38] %endif - mov [ecx+eax*0x4], g1g2(edx,0,ebp) ; New ani + mov [ecx+eax*0x4], g1g2(edx,0,0,ebp) ; New ani pop ecx ; Old ani mov eax, [ecx+0x4] dec eax ; Decrease refCtr mov [ecx+0x4], eax cmp eax, 0 - verifyStackoffset g1g2(0xF54,0,0x128C) - jg g1g2(0x57A795,0,0x5987C4) ; Continue + verifyStackoffset g1g2(0xF54,0,0,0x128C) + jg g1g2(0x57A795,0,0,0x5987C4) ; Continue push 0x1 ; If refCtr <= 0 then call zCModelAni__deleting_destructor addStack 4 - verifyStackoffset g1g2(0xF54,0,0x128C) - jmp g1g2(0x57A795,0,0x5987C4) ; Continue + verifyStackoffset g1g2(0xF54,0,0,0x128C) + jmp g1g2(0x57A795,0,0,0x5987C4) ; Continue ; Room to 0x57A783 (g1), 0x5987AE (g2) diff --git a/src/ow_aniBlend.asm b/src/ow_aniBlend.asm index 2b4b2c5..7c6aefb 100644 --- a/src/ow_aniBlend.asm +++ b/src/ow_aniBlend.asm @@ -5,7 +5,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x57A17C,0,0x598065) + org g1g2(0x57A17C,0,0,0x598065) %endif bits 32 @@ -13,28 +13,28 @@ bits 32 section .text align=1 ; Prevent auto-alignment - resetStackoffset g1g2(0xF54,0,0x12D4) + resetStackoffset g1g2(0xF54,0,0,0x12D4) push eax ; Existing zCModelAni * - mov ecx, [esp+stackoffset+g1g2(-0xF24,0,(-0x129C+0x10))] ; zCModelPrototype * + mov ecx, [esp+stackoffset+g1g2(-0xF24,0,0,(-0x129C+0x10))] ; zCModelPrototype * push ecx - mov edx, g1g2(edi,0,ebp) ; New zCModelAni->name + mov edx, g1g2(edi,0,0,ebp) ; New zCModelAni->name call zCModelPrototype__SearchAniIndex ; __fastcall pop ecx mov ecx, [ecx+0x48] %if GOTHIC_BASE_VERSION == 1 mov edx, [esp+stackoffset-0xF38] ; New zCModelAni * %endif - mov [ecx+eax*0x4], g1g2(edx,0,edi) ; New ani + mov [ecx+eax*0x4], g1g2(edx,0,0,edi) ; New ani pop ecx ; Old ani mov eax, [ecx+0x4] dec eax ; Decrease refCtr mov [ecx+0x4], eax cmp eax, 0 - verifyStackoffset g1g2(0xF54,0,0x12D4) - jg g1g2(0x57A1EA,0,0x5980CE) ; Continue + verifyStackoffset g1g2(0xF54,0,0,0x12D4) + jg g1g2(0x57A1EA,0,0,0x5980CE) ; Continue push 0x1 ; If refCtr <= 0 then call zCModelAni__deleting_destructor addStack 4 - verifyStackoffset g1g2(0xF54,0,0x12D4) - jmp g1g2(0x57A1EA,0,0x5980CE) ; Continue + verifyStackoffset g1g2(0xF54,0,0,0x12D4) + jmp g1g2(0x57A1EA,0,0,0x5980CE) ; Continue ; Room to 0x57A1C7 (g1), 0x5980A9 (g2) diff --git a/src/ow_aniComb.asm b/src/ow_aniComb.asm index 59e1d34..b9cf5fc 100644 --- a/src/ow_aniComb.asm +++ b/src/ow_aniComb.asm @@ -5,7 +5,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x57B169,0,0x599456) + org g1g2(0x57B169,0,0,0x599456) %endif bits 32 @@ -13,7 +13,7 @@ bits 32 section .text align=1 ; Prevent auto-alignment - resetStackoffset g1g2(0xF54,0,0x12EC) + resetStackoffset g1g2(0xF54,0,0,0x12EC) push eax ; Existing zCModelAni * %if GOTHIC_BASE_VERSION == 1 mov ecx, [esp+stackoffset-0xF24] ; zCModelPrototype * @@ -21,24 +21,24 @@ section .text align=1 ; Pre mov ecx, edi %endif push ecx - mov edx, g1g2(edi,0,ebx) ; New zCModelAni->name + mov edx, g1g2(edi,0,0,ebx) ; New zCModelAni->name call zCModelPrototype__SearchAniIndex ; __fastcall pop ecx mov ecx, [ecx+0x48] %if GOTHIC_BASE_VERSION == 1 mov edx, [esp+stackoffset-0xF38] ; New zCModelAni * %endif - mov [ecx+eax*0x4], g1g2(edx,0,ebp) ; New ani + mov [ecx+eax*0x4], g1g2(edx,0,0,ebp) ; New ani pop ecx ; Old ani mov eax, [ecx+0x4] dec eax ; Decrease refCtr mov [ecx+0x4], eax cmp eax, 0 - verifyStackoffset g1g2(0xF54,0,0x12EC) - jg g1g2(0x57A1EA,0,0x5994BB) ; Continue + verifyStackoffset g1g2(0xF54,0,0,0x12EC) + jg g1g2(0x57A1EA,0,0,0x5994BB) ; Continue push 0x1 ; If refCtr <= 0 then call zCModelAni__deleting_destructor addStack 4 - verifyStackoffset g1g2(0xF54,0,0x12EC) - jmp g1g2(0x57A1EA,0,0x5994BB) ; Continue + verifyStackoffset g1g2(0xF54,0,0,0x12EC) + jmp g1g2(0x57A1EA,0,0,0x5994BB) ; Continue ; Room to 0x57B1CA (g1), 0x5994A9 (g2) diff --git a/src/ow_aniDisable.asm b/src/ow_aniDisable.asm index 3641157..4e0fc18 100644 --- a/src/ow_aniDisable.asm +++ b/src/ow_aniDisable.asm @@ -5,7 +5,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x57B372,0,0x599783) + org g1g2(0x57B372,0,0,0x599783) %endif bits 32 @@ -13,28 +13,28 @@ bits 32 section .text align=1 ; Prevent auto-alignment - resetStackoffset g1g2(0xF54,0,0x12C0) + resetStackoffset g1g2(0xF54,0,0,0x12C0) push eax ; Existing zCModelAni * - mov ecx, [esp+stackoffset+g1g2(-0xF24,0,(-0x1284+0xC))] ; zCModelPrototype * + mov ecx, [esp+stackoffset+g1g2(-0xF24,0,0,(-0x1284+0xC))] ; zCModelPrototype * push ecx - mov edx, g1g2(edi,0,ebp) ; New zCModelAni->name + mov edx, g1g2(edi,0,0,ebp) ; New zCModelAni->name call zCModelPrototype__SearchAniIndex ; __fastcall pop ecx mov ecx, [ecx+0x48] %if GOTHIC_BASE_VERSION == 1 mov edx, [esp+stackoffset-0xF38] ; New zCModelAni * %endif - mov [ecx+eax*0x4], g1g2(edx,0,edi) ; New ani + mov [ecx+eax*0x4], g1g2(edx,0,0,edi) ; New ani pop ecx ; Old ani mov eax, [ecx+0x4] dec eax ; Decrease refCtr mov [ecx+0x4], eax cmp eax, 0 - verifyStackoffset g1g2(0xF54,0,0x12C0) - jg g1g2(0x57B3DD,0,0x5980CE) ; Continue + verifyStackoffset g1g2(0xF54,0,0,0x12C0) + jg g1g2(0x57B3DD,0,0,0x5980CE) ; Continue push 0x1 ; If refCtr <= 0 then call zCModelAni__deleting_destructor addStack 4 - verifyStackoffset g1g2(0xF54,0,0x12C0) - jmp g1g2(0x57B3DD,0,0x5980CE) ; Continue + verifyStackoffset g1g2(0xF54,0,0,0x12C0) + jmp g1g2(0x57B3DD,0,0,0x5980CE) ; Continue ; Room to 0x57B3CB (g1), 0x5997CE (g2) diff --git a/src/ow_aniSync.asm b/src/ow_aniSync.asm index ca2d804..984342c 100644 --- a/src/ow_aniSync.asm +++ b/src/ow_aniSync.asm @@ -5,7 +5,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x57A4A5,0,0x5984E1) + org g1g2(0x57A4A5,0,0,0x5984E1) %endif bits 32 @@ -13,28 +13,28 @@ bits 32 section .text align=1 ; Prevent auto-alignment - resetStackoffset g1g2(0xF54,0,0x12C4) + resetStackoffset g1g2(0xF54,0,0,0x12C4) push eax ; Existing zCModelAni * - mov ecx, [esp+stackoffset+g1g2(-0xF24,0,(-0x1284+0x8))] ; zCModelPrototype * + mov ecx, [esp+stackoffset+g1g2(-0xF24,0,0,(-0x1284+0x8))] ; zCModelPrototype * push ecx - mov edx, g1g2(edi,0,ebp) ; New zCModelAni->name + mov edx, g1g2(edi,0,0,ebp) ; New zCModelAni->name call zCModelPrototype__SearchAniIndex ; __fastcall pop ecx mov ecx, [ecx+0x48] %if GOTHIC_BASE_VERSION == 1 mov edx, [esp+stackoffset-0xF38] ; New zCModelAni * %endif - mov [ecx+eax*0x4], g1g2(edx,0,edi) ; New ani + mov [ecx+eax*0x4], g1g2(edx,0,0,edi) ; New ani pop ecx ; Old ani mov eax, [ecx+0x4] dec eax ; Decrease refCtr mov [ecx+0x4], eax cmp eax, 0 - verifyStackoffset g1g2(0xF54,0,0x12C4) - jg g1g2(0x57A1EA,0,0x59854A) ; Continue + verifyStackoffset g1g2(0xF54,0,0,0x12C4) + jg g1g2(0x57A1EA,0,0,0x59854A) ; Continue push 0x1 ; If refCtr <= 0 then call zCModelAni__deleting_destructor addStack 4 - verifyStackoffset g1g2(0xF54,0,0x12C4) - jmp g1g2(0x57A1EA,0,0x59854A) ; Continue + verifyStackoffset g1g2(0xF54,0,0,0x12C4) + jmp g1g2(0x57A1EA,0,0,0x59854A) ; Continue ; Room to 0x57A4FD (g1), 0x598534 (g2) diff --git a/src/ow_parserDeclareClass_showOverwrite.asm b/src/ow_parserDeclareClass_showOverwrite.asm index dbec3ac..8d3aadc 100644 --- a/src/ow_parserDeclareClass_showOverwrite.asm +++ b/src/ow_parserDeclareClass_showOverwrite.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6F2B99,0,0x79C4AA) + org g1g2(0x6F2B99,0,0,0x79C4AA) %endif bits 32 @@ -19,4 +19,4 @@ section .text align=1 ; Pre call ninja_allowRedefine addStack 2*4 verifyStackoffset 0x4C - jmp g1g2(0x6F2BEA,0,0x79C4FB) + jmp g1g2(0x6F2BEA,0,0,0x79C4FB) diff --git a/src/ow_parserDeclareFunc_showOverwrite.asm b/src/ow_parserDeclareFunc_showOverwrite.asm index 5056a5d..4a773f6 100644 --- a/src/ow_parserDeclareFunc_showOverwrite.asm +++ b/src/ow_parserDeclareFunc_showOverwrite.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6F49C1,0,0x79E212) + org g1g2(0x6F49C1,0,0,0x79E212) %endif bits 32 @@ -19,4 +19,4 @@ section .text align=1 ; Pre call ninja_allowRedefine addStack 2*4 verifyStackoffset 0xA4 - jmp g1g2(0x6F49FD,0,0x79E24E) + jmp g1g2(0x6F49FD,0,0,0x79E24E) diff --git a/src/ow_parserDeclarePrototype_showOverwrite.asm b/src/ow_parserDeclarePrototype_showOverwrite.asm index c4d289c..976f07c 100644 --- a/src/ow_parserDeclarePrototype_showOverwrite.asm +++ b/src/ow_parserDeclarePrototype_showOverwrite.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6F3753,0,0x79D004) + org g1g2(0x6F3753,0,0,0x79D004) %endif bits 32 @@ -19,4 +19,4 @@ section .text align=1 ; Pre call ninja_allowRedefine addStack 2*4 verifyStackoffset 0xB8 - jmp g1g2(0x6F3794,0,0x79D045) + jmp g1g2(0x6F3794,0,0,0x79D045) diff --git a/src/ow_parserDeclareVar_showOverwrite.asm b/src/ow_parserDeclareVar_showOverwrite.asm index c474a86..61f022d 100644 --- a/src/ow_parserDeclareVar_showOverwrite.asm +++ b/src/ow_parserDeclareVar_showOverwrite.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6F2113,0,0x79BABF) + org g1g2(0x6F2113,0,0,0x79BABF) %endif bits 32 @@ -12,11 +12,11 @@ bits 32 section .text align=1 ; Prevent auto-alignment - resetStackoffset g1g2(0x394,0,0x3EC) + resetStackoffset g1g2(0x394,0,0,0x3EC) mov eax, [ebp+0x8] push eax push esi call ninja_allowRedefine addStack 2*4 - verifyStackoffset g1g2(0x394,0,0x3EC) - jmp g1g2(0x6F215B,0,0x79BB07) + verifyStackoffset g1g2(0x394,0,0,0x3EC) + jmp g1g2(0x6F215B,0,0,0x79BB07) diff --git a/src/ow_playerInfoName1.asm b/src/ow_playerInfoName1.asm index 5fefe72..32d6ff6 100644 --- a/src/ow_playerInfoName1.asm +++ b/src/ow_playerInfoName1.asm @@ -5,7 +5,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x4618DB,0,0x466FCE) + org g1g2(0x4618DB,0,0,0x466FCE) %endif bits 32 diff --git a/src/ow_playerInfoName2.asm b/src/ow_playerInfoName2.asm index 332dd02..cf8040d 100644 --- a/src/ow_playerInfoName2.asm +++ b/src/ow_playerInfoName2.asm @@ -5,7 +5,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x462475,0,0x467B15) + org g1g2(0x462475,0,0,0x467B15) %endif bits 32 diff --git a/src/ow_playerInfoName3.asm b/src/ow_playerInfoName3.asm index 34e01ea..168b3ac 100644 --- a/src/ow_playerInfoName3.asm +++ b/src/ow_playerInfoName3.asm @@ -5,7 +5,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x4626FA,0,0x467DC2) + org g1g2(0x4626FA,0,0,0x467DC2) %endif bits 32 diff --git a/src/ow_playerInfoName4.asm b/src/ow_playerInfoName4.asm index d488471..2e4e958 100644 --- a/src/ow_playerInfoName4.asm +++ b/src/ow_playerInfoName4.asm @@ -5,7 +5,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x462F13,0,0x46860A) + org g1g2(0x462F13,0,0,0x46860A) %endif bits 32 diff --git a/src/ow_playerInfoName5.asm b/src/ow_playerInfoName5.asm index fc7949f..6b94777 100644 --- a/src/ow_playerInfoName5.asm +++ b/src/ow_playerInfoName5.asm @@ -5,7 +5,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x46AAD7,0,0x46FF1B) + org g1g2(0x46AAD7,0,0,0x46FF1B) %endif bits 32 diff --git a/src/ow_reopenFileWarning.asm b/src/ow_reopenFileWarning.asm index e5a7257..d086d2d 100644 --- a/src/ow_reopenFileWarning.asm +++ b/src/ow_reopenFileWarning.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x5CE925,0,0x5F9C15) + org g1g2(0x5CE925,0,0,0x5F9C15) %endif bits 32 diff --git a/verifySize.bat b/verifySize.bat index c1fcc8c..78569ff 100644 --- a/verifySize.bat +++ b/verifySize.bat @@ -1,7 +1,7 @@ :: :: Verify file size :: -:: Arguments: BINFILE GOTHIC-BASE-VERSION(1, 112, or 2) +:: Arguments: BINFILE GOTHIC-BASE-VERSION(1, 112, 130, or 2) :: @ECHO OFF @@ -10,6 +10,7 @@ IF [%1] == [] GOTO usage IF [%2] == [] GOTO usage IF %2 EQU 1 GOTO start IF %2 EQU 112 GOTO start +IF %2 EQU 130 GOTO start IF %2 NEQ 2 GOTO usage :start @@ -25,6 +26,7 @@ IF NOT EXIST %filefull% ECHO File '%filefull%' not found.&& EXIT /B 1 :: Set size limits in bytes corresponding to the available address range IF %gothic% == 1 SET SIZELIMIT=11280 IF %gothic% == 112 SET SIZELIMIT=12096 +IF %gothic% == 130 SET SIZELIMIT=0 IF %gothic% == 2 SET SIZELIMIT=11904 :: Check file size against limit @@ -34,4 +36,4 @@ IF %FILESIZE% GTR %SIZELIMIT% ECHO %filename% exceeds %SIZELIMIT% bytes (%FILESI EXIT /B :usage -ECHO Usage: %~nx0 BINFILE GOTHIC-BASE-VERSION(1, 112, or 2) +ECHO Usage: %~nx0 BINFILE GOTHIC-BASE-VERSION(1, 112, 130, or 2) From d16bebcf35f159af8aae516b42b59f294e5cad0c Mon Sep 17 00:00:00 2001 From: szapp Date: Thu, 20 Jul 2023 14:09:01 +0200 Subject: [PATCH 5/9] Get the core parsing running for 1.30 --- Makefile | 16 +- src/core.asm | 2 +- src/exec/createVdfArray.asm | 4 +- src/exec/deploy.asm | 86 +++---- src/exec/init.asm | 10 +- src/func/allowRedefine.asm | 2 +- src/func/armParser.asm | 4 +- src/func/conEvalFunc.asm | 2 +- src/func/oCSpawnManager__Archive_fix.asm | 6 +- src/hook_createVdfArray.asm | 2 +- src/hook_deploy_ani_ninja.asm | 4 +- src/hook_deploy_camera_ninja.asm | 8 +- src/hook_deploy_content_ninja.asm | 2 +- src/hook_deploy_fightai_ninja.asm | 8 +- src/hook_deploy_menu_ninja.asm | 2 +- src/hook_deploy_music_ninja.asm | 8 +- src/hook_deploy_ou_ninja.asm | 2 +- src/hook_deploy_pfx_ninja.asm | 8 +- src/hook_deploy_sfx_ninja.asm | 8 +- src/hook_deploy_vfx_ninja.asm | 10 +- src/hook_init_content.asm | 4 +- src/hook_init_menu.asm | 2 +- src/hook_zCPar_Symbol__GetNext.asm | 2 +- src/inc/engine_g130.inc | 304 +++++++++++------------ verifySize.bat | 2 +- 25 files changed, 261 insertions(+), 247 deletions(-) diff --git a/Makefile b/Makefile index 46fbb56..a432453 100644 --- a/Makefile +++ b/Makefile @@ -156,7 +156,21 @@ BIN_BASE_G112 := core \ hook_init_menu \ hook_init_content \ hook_zCPar_Symbol__GetNext -BIN_BASE_G130 := +BIN_BASE_G130 := core \ + hook_createVdfArray \ + hook_deploy_ani_ninja \ + hook_deploy_camera_ninja \ + hook_deploy_content_ninja \ + hook_deploy_fightai_ninja \ + hook_deploy_menu_ninja \ + hook_deploy_music_ninja \ + hook_deploy_ou_ninja \ + hook_deploy_pfx_ninja \ + hook_deploy_sfx_ninja \ + hook_deploy_vfx_ninja \ + hook_init_menu \ + hook_init_content \ + hook_zCPar_Symbol__GetNext BIN_BASE_G2 := ow_zCParser__LoadGlobalVars \ skip_writeAniBinFile_ModelTag \ skip_writeAniBinFile_ReadMeshAndTree \ diff --git a/src/core.asm b/src/core.asm index d5dcc23..557aacd 100644 --- a/src/core.asm +++ b/src/core.asm @@ -4,7 +4,7 @@ %include "inc/engine.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x452640,0x459190,0,0x457470) + org g1g2(0x452640,0x459190,0x456D20,0x457470) %endif bits 32 diff --git a/src/exec/createVdfArray.asm b/src/exec/createVdfArray.asm index fec1b2b..44a5b1f 100644 --- a/src/exec/createVdfArray.asm +++ b/src/exec/createVdfArray.asm @@ -50,7 +50,7 @@ createVdfArray: add esp, 0x14 %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 2 - mov al, [SystemPack_version_info+g1g2(0xD,0x0,0,0xB)] ; Check for old Ninja system + mov al, [SystemPack_version_info+g1g2(0xD,0x0,0x0,0xB)] ; Check for old Ninja system cmp al, 'N' jnz .checkScripts @@ -565,7 +565,7 @@ createVdfArray: verifyStackoffset push char_zStartupWindowed - jmp g1g2(0x6019C6,0x623783,0,0x630B61) + jmp g1g2(0x6019C1,0x62377E,0x6293DC,0x630B5C)+5 ; int __cdecl ninja_compareTimestampsUnsigned(void const *, void const *) diff --git a/src/exec/deploy.asm b/src/exec/deploy.asm index 4cbb08f..8cd4392 100644 --- a/src/exec/deploy.asm +++ b/src/exec/deploy.asm @@ -2,7 +2,7 @@ global deploy_music_ninja deploy_music_ninja: - resetStackoffset g1g2(0xD8,0xB0,0,0xC8) + resetStackoffset g1g2(0xD8,0xB0,0xB0,0xC8) pusha push ninja_injectSrc push NINJA_PATH_MUSIC @@ -11,17 +11,17 @@ deploy_music_ninja: call ninja_armParser addStack 3*4 popa - verifyStackoffset g1g2(0xD8,0xB0,0,0xC8) + verifyStackoffset g1g2(0xD8,0xB0,0xB0,0xC8) ; Jump back - lea g1g2(edx,eax,0,edx), [esp+stackoffset+g1g2(-0xC5,-0x9D,0,-0xB5)] - push g1g2(edx,eax,0,edx) - jmp g1g2(0x4DA448,0x4EB55C,0,0x4E765C)+5 + lea g1g2(edx,eax,eax,edx), [esp+stackoffset+g1g2(-0xC5,-0x9D,-0x9D,-0xB5)] + push g1g2(edx,eax,eax,edx) + jmp g1g2(0x4DA448,0x4EB55C,0x4E4B83,0x4E765C)+5 global deploy_sfx_ninja deploy_sfx_ninja: - resetStackoffset g1g2(0x304,0x2F8,0,0x308) + resetStackoffset g1g2(0x304,0x2F8,0x2F4,0x308) pusha push ninja_injectSrc push NINJA_PATH_SFX @@ -30,17 +30,17 @@ deploy_sfx_ninja: call ninja_armParser addStack 3*4 popa - verifyStackoffset g1g2(0x304,0x2F8,0,0x308) + verifyStackoffset g1g2(0x304,0x2F8,0x2F4,0x308) ; Jump back - lea g1g2(ecx,eax,0,eax), [esp+stackoffset+g1g2(-0x2F2,0x2E5,0,-0x2F6)] - push g1g2(ecx,eax,0,eax) - jmp g1g2(0x4DD88C,0x4EECDC,0,0x4EAE8B)+5 + lea g1g2(ecx,eax,edx,eax), [esp+stackoffset+g1g2(-0x2F2,-0x2E5,-0x2E2,-0x2F6)] + push g1g2(ecx,eax,edx,eax) + jmp g1g2(0x4DD88C,0x4EECDC,0x4E823F,0x4EAE8B)+5 global deploy_pfx_ninja deploy_pfx_ninja: - resetStackoffset g1g2(0x8C,0x7C,0,0xC8) + resetStackoffset g1g2(0x8C,0x7C,0xB0,0xC8) pusha push ninja_injectSrc push NINJA_PATH_PFX @@ -49,17 +49,17 @@ deploy_pfx_ninja: call ninja_armParser addStack 3*4 popa - verifyStackoffset g1g2(0x8C,0x7C,0,0xC8) + verifyStackoffset g1g2(0x8C,0x7C,0xB0,0xC8) ; Jump back - lea g1g2(eax,ecx,0,eax), [esp+stackoffset+g1g2(-0x79,-0x69,0,-0xB5)] - push g1g2(eax,ecx,0,eax) - jmp g1g2(0x58CA22,0x5A7F33,0,0x5AC7BC)+5 + lea g1g2(eax,ecx,eax,eax), [esp+stackoffset+g1g2(-0x79,-0x69,-0x9D,-0xB5)] + push g1g2(eax,ecx,eax,eax) + jmp g1g2(0x58CA22,0x5A7F33,0x5A7175,0x5AC7BC)+5 global deploy_vfx_ninja deploy_vfx_ninja: - resetStackoffset g1g2(0x248,0x234,0,0x250) + resetStackoffset g1g2(0x248,0x234,0x238,0x250) pusha push ninja_injectSrc push NINJA_PATH_VFX @@ -68,16 +68,16 @@ deploy_vfx_ninja: call ninja_armParser addStack 3*4 popa - verifyStackoffset g1g2(0x248,0x234,0,0x250) + verifyStackoffset g1g2(0x248,0x234,0x238,0x250) ; Jump back -%if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 2 - lea g1g2(edx,0,0,eax), [esp+stackoffset+g1g2(-0x239,0,0,-0x235)] +%if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 + lea g1g2(edx,0x0,eax,eax), [esp+stackoffset+g1g2(-0x239,0x0,-0x226,-0x235)] %elif GOTHIC_BASE_VERSION == 112 mov [esp+stackoffset-0x21C], cl %endif - push g1g2(edx,0,0,eax) - jmp g1g2(0x483A3C,0x48EB1F,0,0x48B6EF)+5 + push g1g2(edx,0x0,eax,eax) + jmp g1g2(0x483A3C,0x48EB1F,0x489D76,0x48B6EF)+5 global deploy_ou_ninja @@ -96,7 +96,7 @@ deploy_ou_ninja: global deploy_content_ninja deploy_content_ninja: - resetStackoffset g1g2(0x90,0x7C,0,0x80) + resetStackoffset g1g2(0x90,0x7C,0x7C,0x80) call sysEvent ; Overwritten pusha push ninja_injectSrc @@ -105,28 +105,28 @@ deploy_content_ninja: call ninja_armParser addStack 3*4 popa - verifyStackoffset g1g2(0x90,0x7C,0,0x80) + verifyStackoffset g1g2(0x90,0x7C,0x7C,0x80) ; Jump back - jmp g1g2(0x637208,0x65D5A1,0,0x6C12B7)+5 + jmp g1g2(0x637208,0x65D5A1,0x6647F2,0x6C12B7)+5 global deploy_fightai_ninja deploy_fightai_ninja: - resetStackoffset g1g2(0x7C,0x50,0,0x64) + resetStackoffset g1g2(0x7C,0x50,0x50,0x64) pusha push ninja_injectSrc push NINJA_PATH_FIGHT - push g1g2(ebx,ebp,0,ebx) + push g1g2(ebx,ebp,ebx,ebx) call ninja_armParser addStack 3*4 popa - verifyStackoffset g1g2(0x7C,0x50,0,0x64) + verifyStackoffset g1g2(0x7C,0x50,0x50,0x64) ; Jump back - lea g1g2(edx,edx,0,eax), [esp+stackoffset+g1g2(-0x69,-0x34,0,-0x51)] - push g1g2(edx,edx,0,eax) - jmp g1g2(0x747EBA,0x788F52,0,0x67C626)+5 + lea g1g2(edx,edx,ecx,eax), [esp+stackoffset+g1g2(-0x69,-0x34,-0x34,-0x51)] + push g1g2(edx,edx,ecx,eax) + jmp g1g2(0x747EBA,0x788F52,0x79318A,0x67C626)+5 global deploy_menu_ninja @@ -144,12 +144,12 @@ deploy_menu_ninja: ; Jump back mov eax, DWORD [zCSoundSystem_zsound] - jmp g1g2(0x4CD57A,0x4DDC34,0,0x4DA196)+5 + jmp g1g2(0x4CD57A,0x4DDC34,0x4D7ADA,0x4DA196)+5 global deploy_camera_ninja deploy_camera_ninja: - resetStackoffset g1g2(0xB4,0x9C,0,0xB8) + resetStackoffset g1g2(0xB4,0x9C,0x9C,0xB8) pusha push ninja_injectSrc push NINJA_PATH_CAMERA @@ -158,12 +158,12 @@ deploy_camera_ninja: call ninja_armParser addStack 3*4 popa - verifyStackoffset g1g2(0xB4,0x9C,0,0xB8) + verifyStackoffset g1g2(0xB4,0x9C,0x9C,0xB8) ; Jump back - lea g1g2(eax,edx,0,edx), [esp+stackoffset+g1g2(-0xA1,-0x89,0,-0xA5)] - push g1g2(eax,edx,0,edx) - jmp g1g2(0x49909E,0x4A6138,0,0x4A0554)+5 + lea g1g2(eax,edx,ecx,edx), [esp+stackoffset+g1g2(-0xA1,-0x89,-0x89,-0xA5)] + push g1g2(eax,edx,ecx,edx) + jmp g1g2(0x49909E,0x4A6138,0x49E09D,0x4A0554)+5 global deploy_ani_ninja @@ -171,7 +171,7 @@ deploy_ani_ninja: %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 - resetStackoffset g1g2(0xF54,0xFD8,0,0x0) + resetStackoffset g1g2(0xF54,0xFD8,0x0,0x0) pusha mov ebp, [esp+stackoffset-g1g2(0xF24,0xFA8,0,0x0)] ; zCModelPrototype * mov esi, [ebp+0x14] ; name->ptr @@ -182,7 +182,7 @@ deploy_ani_ninja: call DWORD [ds_lstrcmpiA] addStack 2*4 test eax, eax - verifyStackoffset g1g2(0xF54,0xFD8,0,0x0)+32 ; Base + pusha + verifyStackoffset g1g2(0xF54,0xFD8,0x0,0x0)+32 ; Base + pusha jnz .back sub esp, 0x120 mov eax, esp @@ -203,11 +203,11 @@ deploy_ani_ninja: .back: popa - verifyStackoffset g1g2(0xF54,0xFD8,0,0x0) - cmp [esp+stackoffset-g1g2(0xE88,0xF20,0,0x0)], ebp - jmp g1g2(0x57DC40,0x598474,0,0x0)+7 + verifyStackoffset g1g2(0xF54,0xFD8,0x0,0x0) + cmp [esp+stackoffset-g1g2(0xE88,0xF20,0x0,0x0)], ebp + jmp g1g2(0x57DC40,0x598474,0x0,0x0)+7 -%elif GOTHIC_BASE_VERSION == 2 +%elif GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 resetStackoffset 0x49C pusha @@ -233,6 +233,6 @@ deploy_ani_ninja: ; Jump back mov eax, [esp+stackoffset-0x3E0] - jmp 0x5961CD+7 + jmp g1g2(0x0,0x0,0x590C6D,0x5961CD)+7 %endif diff --git a/src/exec/init.asm b/src/exec/init.asm index 01d5c32..deaed9f 100644 --- a/src/exec/init.asm +++ b/src/exec/init.asm @@ -2,7 +2,7 @@ global init_menu init_menu: - resetStackoffset g1g2(0x34,0x3C,0,0x34) + resetStackoffset g1g2(0x34,0x3C,0x34,0x34) call zCArraySort_zCMenu___InsertSort ; Overwritten pusha push ninja_initMenu @@ -11,10 +11,10 @@ init_menu: call ninja_dispatch addStack 3*4 popa - verifyStackoffset g1g2(0x34,0x3C,0,0x34) + verifyStackoffset g1g2(0x34,0x3C,0x34,0x34) ; Jump back - jmp g1g2(0x4CE909,0x4DF1A6,0,0x4DB4F9)+5 + jmp g1g2(0x4CE909,0x4DF1A6,0x4D8E59,0x4DB4F9)+5 global init_content @@ -32,8 +32,8 @@ init_content: ; Jump back %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 mov DWORD [zCParser_parser+zCParser_progressBar_offset], edi -%elif GOTHIC_BASE_VERSION == 2 +%elif GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 add esp, 0x8 test eax, eax %endif - jmp g1g2(0x637F84,0x65E408,0,0x6C20C3)+5 + jmp g1g2(0x637F84,0x65E408,0x6655C3,0x6C20C3)+5 diff --git a/src/func/allowRedefine.asm b/src/func/allowRedefine.asm index 6878dfa..7fd295a 100644 --- a/src/func/allowRedefine.asm +++ b/src/func/allowRedefine.asm @@ -50,7 +50,7 @@ ninja_allowRedefine: push eax mov eax, [esp+stackoffset+arg_1] - mov eax, [eax+g1g2(0x10A4,0x10A4,0,0x20A4)] ; parser->line + mov eax, [eax+g1g2(0x10A4,0x10A4,0x10A4,0x20A4)] ; parser->line push 0xA push ecx push eax diff --git a/src/func/armParser.asm b/src/func/armParser.asm index ca5bbb5..9ff4fd9 100644 --- a/src/func/armParser.asm +++ b/src/func/armParser.asm @@ -14,8 +14,8 @@ ninja_armParser: push eax mov eax, DWORD [zCParser__ParseBlock+4] push eax - mov DWORD [zCParser__ParseBlock], g1g2(0xC868FF6A,0x1868FF6A,0,0x0868FF6A) - mov DWORD [zCParser__ParseBlock+4], g1g2(0x64007C4A,0x6400807C,0,0x640082A6) + mov DWORD [zCParser__ParseBlock], g1g2(0xC868FF6A,0x1868FF6A,0x2868FF6A,0x0868FF6A) + mov DWORD [zCParser__ParseBlock+4], g1g2(0x64007C4A,0x6400807C,0x64008159,0x640082A6) mov eax, DWORD [zCParser__cur_parser] push eax diff --git a/src/func/conEvalFunc.asm b/src/func/conEvalFunc.asm index 2911eb0..252852b 100644 --- a/src/func/conEvalFunc.asm +++ b/src/func/conEvalFunc.asm @@ -182,7 +182,7 @@ ninja_Y3JjMzI: push ecx mov ecx, esp push eax - call g1g2(0x5CE900,0x5ED6A0,0,0x5F9BF0) + call g1g2(0x5CE900,0x5ED6A0,0x5F2E00,0x5F9BF0) addStack 4 call _itoa add esp, 0xC diff --git a/src/func/oCSpawnManager__Archive_fix.asm b/src/func/oCSpawnManager__Archive_fix.asm index 3f34d15..48aebde 100644 --- a/src/func/oCSpawnManager__Archive_fix.asm +++ b/src/func/oCSpawnManager__Archive_fix.asm @@ -44,9 +44,9 @@ oCSpawnManager__Archive_fix: mov [esp+stackoffset+var_element], edx ; oTSpawnNode* mov ecx, [edx] ; oTSpawnNode.npc - %if GOTHIC_BASE_VERSION == 1 + %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 test BYTE [ecx+0xF5], 0x1 ; zCVob.dontwritetoarchive - %elif GOTHIC_BASE_VERSION == 2 + %elif GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 test BYTE [ecx+0x114], 0x10 ; zCVob.dontwritetoarchive %endif jnz .loc_next @@ -116,7 +116,7 @@ oCSpawnManager__Archive_fix: mov ecx, esi call DWORD [eax+0x20] ; arc->WriteBool(char const *,int) addStack 4 - %if GOTHIC_BASE_VERSION == 2 + %if GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 mov ecx, [ebx+0x20] ; oCSpawnManager.spawnFlags mov eax, [esi] push ecx diff --git a/src/hook_createVdfArray.asm b/src/hook_createVdfArray.asm index bf1407c..7f82869 100644 --- a/src/hook_createVdfArray.asm +++ b/src/hook_createVdfArray.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6019C1,0x62377E,0,0x630B5C) + org g1g2(0x6019C1,0x62377E,0x6293DC,0x630B5C) %endif bits 32 diff --git a/src/hook_deploy_ani_ninja.asm b/src/hook_deploy_ani_ninja.asm index a5ff81f..5526b23 100644 --- a/src/hook_deploy_ani_ninja.asm +++ b/src/hook_deploy_ani_ninja.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x57DC40,0x598474,0,0x5961CD) + org g1g2(0x57DC40,0x598474,0x590C6D,0x5961CD) %endif bits 32 @@ -19,7 +19,7 @@ section .text align=1 ; Pre ; %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 ; resetStackoffset g1g2(0xF54,0xFD8,0,0x0) ; cmp [esp+stackoffset-g1g2(0xE88,0xF20,0,0x0)], ebp - ; %elif GOTHIC_BASE_VERSION == 2 + ; %elif GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 ; resetStackoffset 0x49C ; mov eax, [esp+stackoffset-0x3E0] ; %endif diff --git a/src/hook_deploy_camera_ninja.asm b/src/hook_deploy_camera_ninja.asm index 135cecc..0a35155 100644 --- a/src/hook_deploy_camera_ninja.asm +++ b/src/hook_deploy_camera_ninja.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x49909E,0x4A6138,0,0x4A0554) + org g1g2(0x49909E,0x4A6138,0x49E09D,0x4A0554) %endif bits 32 @@ -15,6 +15,6 @@ section .text align=1 ; Pre jmp deploy_camera_ninja ; Overwrites - ; resetStackoffset g1g2(0xB4,0,0,0xB8) - ; lea g1g2(eax,edx,0,edx), [esp+stackoffset+g1g2(-0xA1,-0x89,0,-0xA5)] - ; push g1g2(eax,edx,0,edx) + ; resetStackoffset g1g2(0xB4,0x9C,0x9C,0xB8) + ; lea g1g2(eax,edx,ecx,edx), [esp+stackoffset+g1g2(-0xA1,-0x89,-0x89,-0xA5)] + ; push g1g2(eax,edx,ecx,edx) diff --git a/src/hook_deploy_content_ninja.asm b/src/hook_deploy_content_ninja.asm index 0e1c5a3..0792ebf 100644 --- a/src/hook_deploy_content_ninja.asm +++ b/src/hook_deploy_content_ninja.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x637208,0x65D5A1,0,0x6C12B7) + org g1g2(0x637208,0x65D5A1,0x6647F2,0x6C12B7) %endif bits 32 diff --git a/src/hook_deploy_fightai_ninja.asm b/src/hook_deploy_fightai_ninja.asm index 30ff1e6..30ddd04 100644 --- a/src/hook_deploy_fightai_ninja.asm +++ b/src/hook_deploy_fightai_ninja.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x747EBA,0x788F52,0,0x67C626) + org g1g2(0x747EBA,0x788F52,0x79318A,0x67C626) %endif bits 32 @@ -15,6 +15,6 @@ section .text align=1 ; Pre jmp deploy_fightai_ninja ; Overwrites - ; resetStackoffset g1g2(0x7C,0x50,0,0x64) - ; lea g1g2(edx,edx,0,eax), [esp+stackoffset+g1g2(-0x69,-0x34,0,-0x51)] - ; push g1g2(edx,edx,0,eax) + ; resetStackoffset g1g2(0x7C,0x50,0x50,0x64) + ; lea g1g2(edx,edx,ecx,eax), [esp+stackoffset+g1g2(-0x69,-0x34,-0x34,-0x51)] + ; push g1g2(edx,edx,ecx,eax) diff --git a/src/hook_deploy_menu_ninja.asm b/src/hook_deploy_menu_ninja.asm index bc2ad47..337cafc 100644 --- a/src/hook_deploy_menu_ninja.asm +++ b/src/hook_deploy_menu_ninja.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x4CD57A,0x4DDC34,0,0x4DA196) + org g1g2(0x4CD57A,0x4DDC34,0x4D7ADA,0x4DA196) %endif bits 32 diff --git a/src/hook_deploy_music_ninja.asm b/src/hook_deploy_music_ninja.asm index ad4d02c..15834d2 100644 --- a/src/hook_deploy_music_ninja.asm +++ b/src/hook_deploy_music_ninja.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x4DA448,0x4EB55C,0,0x4E765C) + org g1g2(0x4DA448,0x4EB55C,0x4E4B83,0x4E765C) %endif bits 32 @@ -15,6 +15,6 @@ section .text align=1 ; Pre jmp deploy_music_ninja ; Overwrites - ; resetStackoffset g1g2(0xD8,0xB0,0,0xC8) - ; lea g1g2(edx,eax,0,edx), [esp+stackoffset+g1g2(-0xC5,-0x9D,0,-0xB5)] - ; push g1g2(edx,eax,0,edx) + ; resetStackoffset g1g2(0xD8,0xB0,0xB0,0xC8) + ; lea g1g2(edx,eax,eax,edx), [esp+stackoffset+g1g2(-0xC5,-0x9D,-0x9D,-0xB5)] + ; push g1g2(edx,eax,eax,edx) diff --git a/src/hook_deploy_ou_ninja.asm b/src/hook_deploy_ou_ninja.asm index e77471d..854ef83 100644 --- a/src/hook_deploy_ou_ninja.asm +++ b/src/hook_deploy_ou_ninja.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x41BE77,0x41DCD7,0,0x41C407) + org g1g2(0x41BE77,0x41DCD7,0x41C0D7,0x41C407) %endif bits 32 diff --git a/src/hook_deploy_pfx_ninja.asm b/src/hook_deploy_pfx_ninja.asm index 2695844..f12d563 100644 --- a/src/hook_deploy_pfx_ninja.asm +++ b/src/hook_deploy_pfx_ninja.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x58CA22,0x5A7F33,0,0x5AC7BC) + org g1g2(0x58CA22,0x5A7F33,0x5A7175,0x5AC7BC) %endif bits 32 @@ -15,6 +15,6 @@ section .text align=1 ; Pre jmp deploy_pfx_ninja ; Overwrites - ; resetStackoffset g1g2(0x8C,0x7C,0,0xC8) - ; lea g1g2(eax,ecx,0,eax), [esp+stackoffset+g1g2(-0x79,-0x69,0,-0xB5)] - ; push g1g2(eax,ecx,0,eax) + ; resetStackoffset g1g2(0x8C,0x7C,0xB0,0xC8) + ; lea g1g2(eax,ecx,eax,eax), [esp+stackoffset+g1g2(-0x79,-0x69,-0x9D,-0xB5)] + ; push g1g2(eax,ecx,eax,eax) diff --git a/src/hook_deploy_sfx_ninja.asm b/src/hook_deploy_sfx_ninja.asm index 702910c..2f8563c 100644 --- a/src/hook_deploy_sfx_ninja.asm +++ b/src/hook_deploy_sfx_ninja.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x4DD88C,0x4EECDC,0,0x4EAE8B) + org g1g2(0x4DD88C,0x4EECDC,0x4E823F,0x4EAE8B) %endif bits 32 @@ -15,6 +15,6 @@ section .text align=1 ; Pre jmp deploy_sfx_ninja ; Overwrites - ; resetStackoffset g1g2(0x304,0x2F8,0,0x308) - ; lea g1g2(ecx,eax,0,eax), [esp+stackoffset+g1g2(-0x2F2,0x2E5,0,-0x2F6)] - ; push g1g2(ecx,eax,0,eax) + ; resetStackoffset g1g2(0x304,0x2F8,0x2F4,0x308) + ; lea g1g2(ecx,eax,edx,eax), [esp+stackoffset+g1g2(-0x2F2,-0x2E5,-0x2E2,-0x2F6)] + ; push g1g2(ecx,eax,edx,eax) diff --git a/src/hook_deploy_vfx_ninja.asm b/src/hook_deploy_vfx_ninja.asm index 3f6f2c3..3d63ea3 100644 --- a/src/hook_deploy_vfx_ninja.asm +++ b/src/hook_deploy_vfx_ninja.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x483A3C,0x48EB1F,0,0x48B6EF) + org g1g2(0x483A3C,0x48EB1F,0x489D76,0x48B6EF) %endif bits 32 @@ -18,10 +18,10 @@ section .text align=1 ; Pre %endif ; Overwrites - ; resetStackoffset g1g2(0x248,0x234,0,0x250) - ; %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 2 - ; lea g1g2(edx,0,0,eax), [esp+stackoffset+g1g2(-0x239,0,0,-0x235)] + ; resetStackoffset g1g2(0x248,0x234,0x238,0x250) + ; %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 + ; lea g1g2(edx,0x0,eax,eax), [esp+stackoffset+g1g2(-0x239,0x0,-0x226,-0x235)] ; %elif GOTHIC_BASE_VERSION == 112 ; mov [esp+stackoffset-0x21C], cl ; %endif - ; push g1g2(edx,0,0,eax) + ; push g1g2(edx,0,eax,eax) diff --git a/src/hook_init_content.asm b/src/hook_init_content.asm index dd3e482..1a708ed 100644 --- a/src/hook_init_content.asm +++ b/src/hook_init_content.asm @@ -5,7 +5,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x637F84,0x65E408,0,0x6C20C3) + org g1g2(0x637F84,0x65E408,0x6655C3,0x6C20C3) %endif bits 32 @@ -23,7 +23,7 @@ section .text align=1 ; Pre ; ; %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 ; mov DWORD [zCParser_parser+zCParser_progressBar_offset], edi - ; %elif GOTHIC_BASE_VERSION == 2 + ; %elif GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 ; add esp, 0x8 ; test eax, eax ; %endif diff --git a/src/hook_init_menu.asm b/src/hook_init_menu.asm index cfa99f6..26465bd 100644 --- a/src/hook_init_menu.asm +++ b/src/hook_init_menu.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x4CE909,0x4DF1A6,0,0x4DB4F9) + org g1g2(0x4CE909,0x4DF1A6,0x4D8E59,0x4DB4F9) %endif bits 32 diff --git a/src/hook_zCPar_Symbol__GetNext.asm b/src/hook_zCPar_Symbol__GetNext.asm index 97a2b70..a588b2f 100644 --- a/src/hook_zCPar_Symbol__GetNext.asm +++ b/src/hook_zCPar_Symbol__GetNext.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6F84D0,0x732740,0,0x7A1DD0) + org g1g2(0x6F84D0,0x732740,0x742390,0x7A1DD0) %endif bits 32 diff --git a/src/inc/engine_g130.inc b/src/inc/engine_g130.inc index cd03c5e..34a2393 100644 --- a/src/inc/engine_g130.inc +++ b/src/inc/engine_g130.inc @@ -1,153 +1,153 @@ %ifndef ENGINE_G130_INC %define ENGINE_G130_INC - %define _atexit 0x ; void (__cdecl *)() - %define _exit 0x ; void - %define operator_new 0x ; uint - - %define operator_delete 0x ; void * - %define _memset 0x ; void *, int, size_t - %define dynamic_cast 0x ; void **, int, TypeDescriptor *, TypeDescriptor *, int - %define operator_StrPlusChar 0x ; zSTRING const &, char const * - %define zCArray_int___zCArray_int_ 0x ; void - %define zCArray_int___InsertEnd 0x ; int const & - %define zCArray_int____zCArray_int_ 0x ; void - %define zCArraySort_zCMenu___InsertSort 0x ; zCMenu * - %define zCArraySort_int___QuickSort 0x ; void - %define _qsort 0x ; void *, size_t, size_t, int (__cdecl *)(const void *, const void *) - %define _fopen 0x ; const char *, const char * - %define _fseek 0x ; FILE *, __int32, int - %define _fread 0x ; void *, size_t, size_t, FILE * - %define _fclose 0x ; FILE * - %define _findfirst 0x ; const char *, finddata_t * - %define _findnext 0x ; int, _finddata_t * - %define _findclose 0x ; int - %define zFILE_VDFS__LockCriticalSection 0x ; void - %define zFILE_VDFS__UnlockCriticalSection 0x ; void - %define zFILE_cur_mds_file 0x ; zFILE * - %define zFILE_VDFS__DeinitFileSystem 0x ; void - %define std__basic_string__assign 0x ; char const *, uint - %define _atol 0x ; const char * - %define _itoa 0x ; int, char *, int - %define zSTRING__zSTRING 0x ; char const * - %define zSTRING__zSTRING_void 0x ; void - %define zSTRING___zSTRING 0x ; void - %define zSTRING__Sprintf 0x ; char const *, ... - %define zSTRING__Upper 0x ; void - %define zSTRING__Search 0x ; int, char const *, uint - %define zSTRING__TrimRight 0x ; char - %define zSTRING__Delete 0x ; uint, ulong - %define zSTRING__DeleteRight 0x ; uint - %define zSTRING__operator_eq 0x ; char const * - %define zSTRING__operator_plusEq 0x ; char const * - %define ds_lstrcatA 0x ; LPTSTR, LPTSTR - %define ds_lstrcpyA 0x ; LPTSTR, LPTSTR - %define ds_lstrlenA 0x ; LPCSTR - %define ds_lstrcmpiA 0x ; LPCSTR, LPCSTR - %define _strncmp 0x ; char *, char *, int - %define ds_vdf_fexists 0x ; const char*, long - %define sysEvent 0x ; void - %define zCParser_parser 0x ; zCParser - %define zCParser__CallFunc 0x ; zSTRING const & - %define zCParser__ParseBlock 0x ; void - %define zCParser__Error 0x ; zSTRING &, int - %define zCParser__MergeFile 0x ; zSTRING & - %define zCParser__GetIndex 0x ; zSTRING const & - %define zCParser__GetSymbol_str 0x ; zSTRING const & - %define zCParser__GetSymbolInfo 0x ; int, int &, int & - %define zCParser__GetInstance 0x ; int, int - %define zCParser__CreateInstance 0x ; int, void * - %define zCParser__cur_parser 0x ; zCParser * - %define zCParser__enableParsing 0x ; int - %define zCParser__ClearInstanceRefs 0x ; void * - %define zCPar_SymbolTable__Insert 0x ; zCPar_Symbol * - %define zCPar_SymbolTable__GetIndex 0x ; zCPar_Symbol * - %define zCPar_SymbolTable__GetIndex_str 0x ; zSTRING const & - %define zCPar_SymbolTable__GetSymbol_int 0x ; int - %define zCPar_SymbolTable__GetSymbol_str 0x ; zSTRING const & - %define zCPar_SymbolTable__cur_table 0x ; zCPar_SymbolTable * - %define zCPar_Symbol__zCPar_Symbol 0x ; void - %define zCPar_Symbol__SetFlag 0x ; int - %define zCPar_Symbol__GetValue 0x ; int &, int - %define zCPar_Symbol__SetValue_int 0x ; int, int - %define zCPar_Symbol__SetValue_str 0x ; zSTRING &, int - %define zCPar_Symbol__SetStackPos 0x ; int, int - %define zCMusicSys_DirectMusic__musicParser 0x ; zCParser * - %define zCSndSys_MSS__sfxParser 0x ; zCParser * - %define zCParticleFX__s_pfxParser 0x ; zCParser * - %define oCVisualFX__fxParser 0x ; zCParser * - %define zCMenu__menuParser 0x ; zCParser * - %define zCAICamera__cameraParser 0x ; zCParser * - %define zCSoundSystem_zsound 0x ; zCSoundSystem * - %define oCGame_ogame 0x ; oCGame * - %define oCGame__GetInfoManager 0x ; void - %define oCMissionManager_misMan 0x ; oCMissionManager* - %define oCNpc__classDef 0x ; zCClassDef - %define oCItem__classDef 0x ; zCClassDef - %define zCObject__CheckInheritance 0x ; zCClassDef const *, zCClassDef const * - %define oCWorld__InsertInLists 0x ; zCVob * - %define oCWorld__RemoveFromLists 0x ; zCVob * - %define zCConsole_zcon 0x ; zCConsole * - %define zCConsole__AddEvalFunc 0x ; int (*)(zSTRING const &, zSTRING &) - %define zCConsole__Register 0x ; zSTRING const &, zSTRING const & - %define zERROR_zerr 0x ; zERROR * - %define zERROR__SearchForSpy 0x ; void - %define zERROR__Report 0x ; zERROR_TYPE, int, zSTRING const &, signed char, uint, int, char *, char * - %define zERROR__Message 0x ; zSTRING const & - %define zERROR__Fatal 0x ; zSTRING const & - %define zCOption_zoptions 0x ; zCOption * - %define zCOption_zgameoptions 0x ; zCOption * - %define zCOption__ReadString 0x ; zSTRING const &, char const *, char const * - %define zCOption__GetDirString 0x ; zTOptionPaths - %define zCOption__ParmValue 0x ; zSTRING const & - %define zCObjectFactory_zfactory 0x ; zCObjectFactory * - %define zCModelPrototype__ReadModel 0x ; zCFileBIN & - %define zCModelPrototype__SearchAniIndex 0x ; zSTRING const & - %define zCModelAni__deleting_destructor 0x ; uint - %define zCArchiverFactory__CreateArchiverRead 0x ; zFILE *, int - %define zCArchiverFactory_zarcFactory 0x ; zCArchiverFactory - %define zCCSManager__LibValidateOU 0x ; zString * - %define zCCSManager__LibAddOU 0x ; zCCSBlock * - %define zCCSLib___CreateNewInstance 0x ; void - %define zCCSLib__deleting_destructor 0x ; uint - %define zCCSBlock__deleting_destructor 0x ; uint - %define zCListSort__GetNumInList 0x ; void - %define zCListSort__InsertSort 0x ; void * - %define oCInfo__oCInfo 0x ; void - %define oCInfo__SetInstance 0x ; int - %define oCInfo__DoCheck 0x ; void - %define oCNpc_RTTI_Type_Descriptor 0x ; TypeDescriptor - - %define SystemPack_version_info 0x ; char - %define NINJA_PATCH_ARRAY 0x ; zCArray - - %define char_NUL 0x ; 0 - %define char_space 0x ; ' ', 0 - %define char_cnpc 0x ; 'C_NPC', 0 - %define char_model 0x ; 'MODEL', 0 - %define char_mds 0x ; '.MDS', 0 - %define char_src 0x ; '.SRC', 0 - %define char_dot 0x ; '.', 0 - %define char_commaSpace 0x ; ', ', 0 - %define char_BSlash 0x ; '\', 0 - %define char_doubleFSlash 0x ; '//', 0 - %define char_lf 0x ; 0xA, 0 - %define char_line 0x ; ' line ( ', 0 - %define char_spaceClosingParanthesis 0x ; ' )', 0 - %define char_npc 0x ; 'npc', 0 - %define char_spawnPos 0x ; 'spawnPos', 0 - %define char_timer 0x ; 'timer', 0 - %define char_noOfEntries 0x ; 'NoOfEntries', 0 - %define char_spawningEnabled 0x ; 'spawningEnabled', 0 - %define char_spawnFlags 0x ; 'spawnFlags', 0 - %define char_zStartupWindowed 0x ; 'zStartupWindowed', 0 - %define char_settings 0x ; 'SETTINGS', 0 - %define char_meatbug_mds 0x ; 'Meatbug.mds', 0 - %define char_redefinedIdentifier 0x ; 'Redefined identifier : ', 0 - %define zSTRING_mdlBuffer 0x ; zSTRING * - %define zSTRING_infoClass 0x ; zSTRING - %define zSTRING_empty 0x ; zSTRING const - %define zOPT_SEC_GAME 0x ; zSTRING const + %define _atexit 0x7C3B05 ; void (__cdecl *)() + %define _exit 0x7C4DFA ; void + %define operator_new 0x560D30 ; uint + + %define operator_delete 0x560D40 ; void * + %define _memset 0x7D05D0 ; void *, int, size_t + %define dynamic_cast 0x7C457A ; void **, int, TypeDescriptor *, TypeDescriptor *, int + %define operator_StrPlusChar 0x404880 ; zSTRING const &, char const * + %define zCArray_int___zCArray_int_ 0x55B470 ; void + %define zCArray_int___InsertEnd 0x4D3470 ; int const & + %define zCArray_int____zCArray_int_ 0x53EBB0 ; void + %define zCArraySort_zCMenu___InsertSort 0x4DB750 ; zCMenu * + %define zCArraySort_int___QuickSort 0x6384B0 ; void + %define _qsort 0x7C4AAF ; void *, size_t, size_t, int (__cdecl *)(const void *, const void *) + %define _fopen 0x7C5B50 ; const char *, const char * + %define _fseek 0x7C5A66 ; FILE *, __int32, int + %define _fread 0x7C5F2F ; void *, size_t, size_t, FILE * + %define _fclose 0x7C5C9C ; FILE * + %define _findfirst 0x7C6046 ; const char *, finddata_t * + %define _findnext 0x7C6113 ; int, _finddata_t * + %define _findclose 0x7C61DB ; int + %define zFILE_VDFS__LockCriticalSection 0x44B090 ; void + %define zFILE_VDFS__UnlockCriticalSection 0x44B0B0 ; void + %define zFILE_cur_mds_file 0x8CA4FC ; zFILE * + %define zFILE_VDFS__DeinitFileSystem 0x44ACF0 ; void + %define std__basic_string__assign 0x402FC0 ; char const *, uint + %define _atol 0x7C4C7D ; const char * + %define _itoa 0x7D6997 ; int, char *, int + %define zSTRING__zSTRING 0x4010C0 ; char const * + %define zSTRING__zSTRING_void 0x402AF0 ; void + %define zSTRING___zSTRING 0x401160 ; void + %define zSTRING__Sprintf 0x46C030 ; char const *, ... + %define zSTRING__Upper 0x469ED0 ; void + %define zSTRING__Search 0x46BCF0 ; int, char const *, uint + %define zSTRING__TrimRight 0x46BB40 ; char + %define zSTRING__Delete 0x46AE70 ; uint, ulong + %define zSTRING__DeleteRight 0x46AD60 ; uint + %define zSTRING__operator_eq 0x4CD590 ; char const * + %define zSTRING__operator_plusEq 0x673100 ; char const * + %define ds_lstrcatA 0x82021C ; LPTSTR, LPTSTR + %define ds_lstrcpyA 0x820220 ; LPTSTR, LPTSTR + %define ds_lstrlenA 0x820224 ; LPCSTR + %define ds_lstrcmpiA 0x820174 ; LPCSTR, LPCSTR + %define _strncmp 0x7D2E00 ; char *, char *, int + %define ds_vdf_fexists 0x8204A0 ; const char*, long + %define sysEvent 0x5026F0 ; void + %define zCParser_parser 0x984C08 ; zCParser + %define zCParser__CallFunc 0x732F90 ; zSTRING const & + %define zCParser__ParseBlock 0x7303F0 ; void + %define zCParser__Error 0x72E830 ; zSTRING &, int + %define zCParser__MergeFile 0x731C10 ; zSTRING & + %define zCParser__GetIndex 0x733A30 ; zSTRING const & + %define zCParser__GetSymbol_str 0x733E90 ; zSTRING const & + %define zCParser__GetSymbolInfo 0x733DB0 ; int, int &, int & + %define zCParser__GetInstance 0x733CF0 ; int, int + %define zCParser__CreateInstance 0x733560 ; int, void * + %define zCParser__cur_parser 0x985DD4 ; zCParser * + %define zCParser__enableParsing 0x985DCC ; int + %define zCParser__ClearInstanceRefs 0x736F00 ; void * + %define zCPar_SymbolTable__Insert 0x7444C0 ; zCPar_Symbol * + %define zCPar_SymbolTable__GetIndex 0x744030 ; zCPar_Symbol * + %define zCPar_SymbolTable__GetIndex_str 0x744120 ; zSTRING const & + %define zCPar_SymbolTable__GetSymbol_int 0x7444A0 ; int + %define zCPar_SymbolTable__GetSymbol_str 0x744400 ; zSTRING const & + %define zCPar_SymbolTable__cur_table 0x985F70 ; zCPar_SymbolTable * + %define zCPar_Symbol__zCPar_Symbol 0x741C50 ; void + %define zCPar_Symbol__SetFlag 0x742310 ; int + %define zCPar_Symbol__GetValue 0x7425A0 ; int &, int + %define zCPar_Symbol__SetValue_int 0x7423F0 ; int, int + %define zCPar_Symbol__SetValue_str 0x742450 ; zSTRING &, int + %define zCPar_Symbol__SetStackPos 0x7423E0 ; int, int + %define zCMusicSys_DirectMusic__musicParser 0x8C3AF4 ; zCParser * + %define zCSndSys_MSS__sfxParser 0x8C442C ; zCParser * + %define zCParticleFX__s_pfxParser 0x8CAB60 ; zCParser * + %define oCVisualFX__fxParser 0x8C008C ; zCParser * + %define zCMenu__menuParser 0x8C3808 ; zCParser * + %define zCAICamera__cameraParser 0x8C0468 ; zCParser * + %define zCSoundSystem_zsound 0x9748E4 ; zCSoundSystem * + %define oCGame_ogame 0x9813DC ; oCGame * + %define oCGame__GetInfoManager 0x666190 ; void + %define oCMissionManager_misMan 0x981ED8 ; oCMissionManager* + %define oCNpc__classDef 0x982978 ; zCClassDef + %define oCItem__classDef 0x981CC0 ; zCClassDef + %define zCObject__CheckInheritance 0x475A90 ; zCClassDef const *, zCClassDef const * + %define oCWorld__InsertInLists 0x720E70 ; zCVob * + %define oCWorld__RemoveFromLists 0x720F50 ; zCVob * + %define zCConsole_zcon 0x9843A8 ; zCConsole * + %define zCConsole__AddEvalFunc 0x725540 ; int (*)(zSTRING const &, zSTRING &) + %define zCConsole__Register 0x7230A0 ; zSTRING const &, zSTRING const & + %define zERROR_zerr 0x8BF6B8 ; zERROR * + %define zERROR__SearchForSpy 0x44DEF0 ; void + %define zERROR__Report 0x44C180 ; zERROR_TYPE, int, zSTRING const &, signed char, uint, int, char *, char * + %define zERROR__Message 0x44D2C0 ; zSTRING const & + %define zERROR__Fatal 0x44D330 ; zSTRING const & + %define zCOption_zoptions 0x8BF378 ; zCOption * + + %define zCOption__ReadString 0x461FD0 ; zSTRING const &, char const *, char const * + %define zCOption__GetDirString 0x464630 ; zTOptionPaths + %define zCOption__ParmValue 0x464750 ; zSTRING const & + %define zCObjectFactory_zfactory 0x8CA720 ; zCObjectFactory * + %define zCModelPrototype__ReadModel 0x597F60 ; zCFileBIN & + %define zCModelPrototype__SearchAniIndex 0x584A60 ; zSTRING const & + %define zCModelAni__deleting_destructor 0x57FD70 ; uint + %define zCArchiverFactory__CreateArchiverRead 0x5172E0 ; zFILE *, int + %define zCArchiverFactory_zarcFactory 0x8C60F4 ; zCArchiverFactory + %define zCCSManager__LibValidateOU 0x41C0B0 ; zString * + %define zCCSManager__LibAddOU 0x41BD60 ; zCCSBlock * + %define zCCSLib___CreateNewInstance 0x418A00 ; void + %define zCCSLib__deleting_destructor 0x419400 ; uint + %define zCCSBlock__deleting_destructor 0x40D300 ; uint + %define zCListSort__GetNumInList 0x6B3480 ; void + %define zCListSort__InsertSort 0x721A40 ; void * + %define oCInfo__oCInfo 0x6A5920 ; void + %define oCInfo__SetInstance 0x6A5AB0 ; int + %define oCInfo__DoCheck 0x6A5C60 ; void + %define oCNpc_RTTI_Type_Descriptor 0x88335C ; TypeDescriptor + + + %define NINJA_PATCH_ARRAY 0x88610D ; zCArray + + %define char_NUL 0x8B3914 ; 0 + %define char_space 0x88715C ; ' ', 0 + %define char_cnpc 0x89E958 ; 'C_NPC', 0 + %define char_model 0x8962E4 ; 'MODEL', 0 + %define char_mds 0x888FA8 ; '.MDS', 0 + %define char_src 0x8A7FA0 ; '.SRC', 0 + %define char_dot 0x8811D8 ; '.', 0 + %define char_commaSpace 0x888008 ; ', ', 0 + %define char_BSlash 0x883CF8 ; '\', 0 + %define char_doubleFSlash 0x884C2C ; '//', 0 + %define char_lf 0x8834C0 ; 0xA, 0 + %define char_line 0x8A7F24 ; ' line ( ', 0 + %define char_spaceClosingParanthesis 0x8A7F20 ; ' )', 0 + %define char_npc 0x8A7004 ; 'npc', 0 + %define char_spawnPos 0x8A6FF8 ; 'spawnPos', 0 + %define char_timer 0x8A6FF0 ; 'timer', 0 + %define char_noOfEntries 0x8A7008 ; 'NoOfEntries', 0 + %define char_spawningEnabled 0x8A6FE0 ; 'spawningEnabled', 0 + %define char_spawnFlags 0x8A6FD4 ; 'spawnFlags', 0 + %define char_zStartupWindowed 0x89C760 ; 'zStartupWindowed', 0 + + %define char_meatbug_mds 0x8A47D0 ; 'Meatbug.mds', 0 + %define char_redefinedIdentifier 0x8A8410 ; 'Redefined identifier : ', 0 + %define zSTRING_mdlBuffer 0x8CA3F0 ; zSTRING * + %define zSTRING_infoClass 0x981924 ; zSTRING + %define zSTRING_empty 0x8BF658 ; zSTRING const + %define zOPT_SEC_GAME 0x8BF008 ; zSTRING const %define zCObjectFactory__CreateZFile_offset 0x14 ; zSTRING const & %define zFILE_VDFS__Exists_offset 0x94 ; void @@ -165,11 +165,11 @@ %define zCParser_table_offset 0x10 %define zCParser_lastsym_offset 0x34 %define zCParser_stackpos_offset 0x48 - %define zCParser_stringcount_offset 0x - %define zCParser_in_func_offset 0x ; zCPar_Symbol * - %define zCParser_in_class_offset 0x ; zCPar_Symbol * - %define zCParser_datsave_offset 0x - %define zCParser_mergemode_offset 0x + %define zCParser_stringcount_offset 0x10D0 + %define zCParser_in_func_offset 0x10D4 ; zCPar_Symbol * + %define zCParser_in_class_offset 0x10D8 ; zCPar_Symbol * + %define zCParser_datsave_offset 0x1090 + %define zCParser_mergemode_offset 0x109C %define zCPar_Symbol_content_offset 0x18 diff --git a/verifySize.bat b/verifySize.bat index 78569ff..3803dd0 100644 --- a/verifySize.bat +++ b/verifySize.bat @@ -26,7 +26,7 @@ IF NOT EXIST %filefull% ECHO File '%filefull%' not found.&& EXIT /B 1 :: Set size limits in bytes corresponding to the available address range IF %gothic% == 1 SET SIZELIMIT=11280 IF %gothic% == 112 SET SIZELIMIT=12096 -IF %gothic% == 130 SET SIZELIMIT=0 +IF %gothic% == 130 SET SIZELIMIT=11895 IF %gothic% == 2 SET SIZELIMIT=11904 :: Check file size against limit From 088d5fc0aae22c60725ff85e95c8c8ee5ca37612 Mon Sep 17 00:00:00 2001 From: szapp Date: Sun, 30 Jul 2023 11:05:14 +0200 Subject: [PATCH 6/9] Get merge-parsing working for 1.12f and 1.30 fix --- Makefile | 28 ++- src/core.asm | 2 +- src/exec/parse.asm | 165 +++++++++--------- src/func/allowRedefine.asm | 2 +- src/hook_linkerReplaceFunc.asm | 2 +- src/hook_parserDeclareClass.asm | 6 +- src/hook_parserDeclareFunc.asm | 12 +- src/hook_parserDeclarePrototype.asm | 10 +- src/hook_parserDeclareVar.asm | 8 +- src/hook_parserDeclareVar_constInt.asm | 2 +- src/hook_parserDeclareVar_constString.asm | 2 +- src/hook_parserParseSource.asm | 2 +- src/ow_parserDeclareClass_showOverwrite.asm | 8 +- src/ow_parserDeclareFunc_showOverwrite.asm | 4 +- ...w_parserDeclarePrototype_showOverwrite.asm | 4 +- src/ow_parserDeclareVar_showOverwrite.asm | 10 +- 16 files changed, 146 insertions(+), 121 deletions(-) diff --git a/Makefile b/Makefile index a432453..276a3f0 100644 --- a/Makefile +++ b/Makefile @@ -155,7 +155,19 @@ BIN_BASE_G112 := core \ hook_deploy_vfx_ninja \ hook_init_menu \ hook_init_content \ - hook_zCPar_Symbol__GetNext + hook_linkerReplaceFunc \ + hook_parserDeclareClass \ + hook_parserDeclareFunc \ + hook_parserDeclarePrototype \ + hook_parserDeclareVar \ + hook_parserDeclareVar_constInt \ + hook_parserDeclareVar_constString \ + hook_parserParseSource \ + hook_zCPar_Symbol__GetNext \ + ow_parserDeclareClass_showOverwrite \ + ow_parserDeclareFunc_showOverwrite \ + ow_parserDeclarePrototype_showOverwrite \ + ow_parserDeclareVar_showOverwrite BIN_BASE_G130 := core \ hook_createVdfArray \ hook_deploy_ani_ninja \ @@ -170,7 +182,19 @@ BIN_BASE_G130 := core \ hook_deploy_vfx_ninja \ hook_init_menu \ hook_init_content \ - hook_zCPar_Symbol__GetNext + hook_linkerReplaceFunc \ + hook_parserDeclareClass \ + hook_parserDeclareFunc \ + hook_parserDeclarePrototype \ + hook_parserDeclareVar \ + hook_parserDeclareVar_constInt \ + hook_parserDeclareVar_constString \ + hook_parserParseSource \ + hook_zCPar_Symbol__GetNext \ + ow_parserDeclareClass_showOverwrite \ + ow_parserDeclareFunc_showOverwrite \ + ow_parserDeclarePrototype_showOverwrite \ + ow_parserDeclareVar_showOverwrite BIN_BASE_G2 := ow_zCParser__LoadGlobalVars \ skip_writeAniBinFile_ModelTag \ skip_writeAniBinFile_ReadMeshAndTree \ diff --git a/src/core.asm b/src/core.asm index 557aacd..e60a35e 100644 --- a/src/core.asm +++ b/src/core.asm @@ -19,8 +19,8 @@ section .text %include "exec/createVdfArray.asm" %include "exec/deploy.asm" %include "exec/init.asm" -%if GOTHIC_BASE_VERSION != 112 && GOTHIC_BASE_VERSION != 130 %include "exec/parse.asm" +%if GOTHIC_BASE_VERSION != 112 && GOTHIC_BASE_VERSION != 130 %include "exec/misc.asm" %endif diff --git a/src/exec/parse.asm b/src/exec/parse.asm index 106b7b2..57ff6ef 100644 --- a/src/exec/parse.asm +++ b/src/exec/parse.asm @@ -18,21 +18,18 @@ parser_check_func: .back: test eax, eax mov ebp, eax - jnz g1g2(0x6F4980,0,0,0x79E1D1) + jnz g1g2(0x6F4980,0x72E610,0x73E791,0x79E1D1) -%if GOTHIC_BASE_VERSION == 1 - push 0x5AE - jmp 0x6F4953 -%elif GOTHIC_BASE_VERSION == 2 - push 0x3C + push g1g2(0x5AE, 0x5AE, 0x3C, 0x3C) +%if GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 call operator_new - jmp 0x79E1B5 %endif + jmp g1g2(0x6F494E,0x72E5DE,0x73E76E,0x79E1AE) + 5 global linker_replace_func linker_replace_func: - resetStackoffset g1g2(0xA8,0,0,0xE4) + resetStackoffset g1g2(0xA8,0xA8,0xE4,0xE4) %assign var_symb_content 0x4 %assign var_parser 0x0 push edi @@ -45,7 +42,7 @@ linker_replace_func: mov eax, [ecx+zCPar_Symbol_content_offset] test eax, eax - verifyStackoffset g1g2(0xA8,0,0,0xE4) + 0xC + verifyStackoffset g1g2(0xA8,0xA8,0xE4,0xE4) + 0xC jz .rf_back push eax ; symbol->content @@ -62,7 +59,7 @@ linker_replace_func: call DWORD [ds_lstrcmpiA] addStack 2*4 test eax, eax - verifyStackoffset g1g2(0xA8,0,0,0xE4) + 0x14 + verifyStackoffset g1g2(0xA8,0xA8,0xE4,0xE4) + 0x14 jz .no_rf_back push edi call DWORD [ds_lstrlenA] @@ -76,7 +73,7 @@ linker_replace_func: mov ecx, [ecx+zCParser_stackpos_offset] mov eax, [esp+var_symb_content] ; symbol->content cmp BYTE [eax+ecx], zPAR_TOK_RET - verifyStackoffset g1g2(0xA8,0,0,0xE4) + 0x14 + verifyStackoffset g1g2(0xA8,0xA8,0xE4,0xE4) + 0x14 jz .no_rf_back pop ebp ; parser @@ -87,14 +84,14 @@ linker_replace_func: mov BYTE [eax], zPAR_TOK_JUMP mov [eax+1], ecx sub esp, 0x4 - verifyStackoffset g1g2(0xA8,0,0,0xE4) + 0xC + verifyStackoffset g1g2(0xA8,0xA8,0xE4,0xE4) + 0xC .rf_back: add esp, 0x4 pop ecx pop edi call zCPar_Symbol__SetStackPos - jmp g1g2(0x6E8269,0,0,0x7915CC) + jmp g1g2(0x6E8269,0x7211EB,0x73126D,0x7915CC) .no_rf_back: sub esp, 0x14 @@ -114,13 +111,13 @@ linker_replace_func: pop ebp add esp, 0x14 pop edi - jmp g1g2(0x6E8269,0,0,0x7915CC) + jmp g1g2(0x6E8269,0x7211EB,0x73126D,0x7915CC) global parser_check_var parser_check_var: - resetStackoffset g1g2(0x394,0,0,0x3EC) - xor g1g2(edi,0,0,ebp), g1g2(edi,0,0,ebp) + resetStackoffset g1g2(0x394,0x388,0x3EC,0x3EC) + xor g1g2(edi,ebx,ebp,ebp), g1g2(edi,ebx,ebp,ebp) mov eax, DWORD [zCParser__enableParsing] ; Check if wrapped by Ninja cmp eax, 0x2A jnz .check_sym @@ -131,24 +128,24 @@ parser_check_var: mov eax, DWORD [esi+zCParser_in_class_offset] ; parser->in_class->name test eax, eax jnz .sub_var - lea ecx, [esp+stackoffset+g1g2(-0x354,0,0,-0x3BC)] ; Variable name + lea ecx, [esp+stackoffset+g1g2(-0x354,-0x40-0x4,-0x3BC,-0x3BC)] ; Variable name push ecx mov ecx, esi call zCParser__GetSymbol_str addStack 4 - mov g1g2(edi,0,0,ebp), eax - verifyStackoffset g1g2(0x394,0,0,0x3EC) + mov g1g2(edi,ebx,ebp,ebp), eax + verifyStackoffset g1g2(0x394,0x388,0x3EC,0x3EC) jmp .check_sym .sub_var: sub esp, 0x14 push char_dot push eax ; Prefix (function or class name) - lea eax, [esp+stackoffset+g1g2(-0x3A8,0,0,-0x400)] ; New string + lea eax, [esp+stackoffset+g1g2(-0x3A8,-0x39C,-0x400,-0x400)] ; New string push eax call operator_StrPlusChar ; __cdecl add esp, 0xC - mov ecx, DWORD [esp+stackoffset+g1g2(-0x34C,0,0,-0x3B4)] ; Variable name + mov ecx, DWORD [esp+stackoffset+g1g2(-0x34C,-0x38-0x4,-0x3B4,-0x3B4)] ; Variable name push ecx mov ecx, eax call zSTRING__operator_plusEq @@ -157,32 +154,27 @@ parser_check_var: mov ecx, esi call zCParser__GetSymbol_str addStack 4 - mov g1g2(edi,0,0,ebp), eax - lea ecx, [esp+stackoffset+g1g2(-0x3A8,0,0,-0x400)] ; New string + mov g1g2(edi,ebx,ebp,ebp), eax + lea ecx, [esp+stackoffset+g1g2(-0x3A8,-0x39C,-0x400,-0x400)] ; New string call zSTRING___zSTRING add esp, 0x14 .check_sym: - verifyStackoffset g1g2(0x394,0,0,0x3EC) - -%if GOTHIC_BASE_VERSION == 1 - test edi, edi - jnz 0x6F1903 - push 0x3BA - jmp 0x6F18D2 -%elif GOTHIC_BASE_VERSION == 2 - test ebp, ebp - jnz 0x79B3DC - push 0x3C + verifyStackoffset g1g2(0x394,0x388,0x3EC,0x3EC) + + test g1g2(edi,ebx,ebp,ebp), g1g2(edi,ebx,ebp,ebp) + jnz g1g2(0x6F1903, 0x72B33B, 0x73B99C, 0x79B3DC) + push g1g2(0x3BA, 0x3BA, 0x3C, 0x3C) +%if GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 call operator_new - jmp 0x79B3BC %endif + jmp g1g2(0x6F18CD,0x72B30A,0x73B975,0x79B3B5) + 5 global parser_check_class parser_check_class: - resetStackoffset g1g2(0x5C,0,0,0x50) -%if GOTHIC_BASE_VERSION == 2 + resetStackoffset g1g2(0x5C,0x60,0x50,0x50) +%if GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 pop ecx %endif mov ecx, DWORD [zCParser__enableParsing] ; Check if wrapped by Ninja @@ -195,25 +187,23 @@ parser_check_class: call zCPar_SymbolTable__GetSymbol_str addStack 4 test eax, eax - verifyStackoffset g1g2(0x5C,0,0,(0x50-0x4)) + verifyStackoffset g1g2(0x5C,0x60,(0x50-0x4),(0x50-0x4)) ; Jump back -%if GOTHIC_BASE_VERSION == 1 +%if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 jz .pcc_new add esp, 0x10 - jnz 0x6F2B41 +%endif + jnz g1g2(0x6F2B41,0x72C565,0x73CA12,0x79C452) .pcc_new: +%if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 call operator_new_len - jmp 0x6F2B26 -%elif GOTHIC_BASE_VERSION == 2 - jnz 0x79C452 - - .pcc_new: +%elif GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 push 0x3C call operator_new - jmp 0x79C437 %endif + jmp g1g2(0x6F2B21,0x72C545,0x73C9F2,0x79C432) + 5 global parser_check_prototype @@ -234,24 +224,26 @@ parser_check_prototype: test eax, eax verifyStackoffset 0xB8 -%if GOTHIC_BASE_VERSION == 1 - jnz 0x6F36E6 + jnz g1g2(0x6F36E6,0x72D21E,0x73D557,0x79CF97) +%if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 push 0x4DF - jmp 0x6F36B7 -%elif GOTHIC_BASE_VERSION == 2 - jnz 0x79CF97 +%elif GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 push 0x3C call operator_new - jmp 0x79CF79 %endif + jmp g1g2(0x6F36B2,0x72D1EA,0x73D532,0x79CF72) + 5 global parser_verify_ikarus_version parser_verify_ikarus_version: - resetStackoffset g1g2(0x398,0,0,0x3F0) - %assign var_newvalue 0x04 + resetStackoffset g1g2(0x398,0x38C,0x3F0,0x3F0) + %assign var_newvalue 0x08 push eax push ebx + push ebp +%if GOTHIC_BASE_VERSION == 112 + mov ebp, ebx +%endif mov ecx, DWORD [zCParser__enableParsing] ; Check if wrapped by Ninja cmp ecx, 0x2A @@ -259,7 +251,7 @@ parser_verify_ikarus_version: mov ecx, [esi+zCParser_mergemode_offset] test ecx, ecx - verifyStackoffset g1g2(0x398,0,0,0x3F0) + 0x8 + verifyStackoffset g1g2(0x398,0x38C,0x3F0,0x3F0) + 0xC jz .backClean mov ebx, keep_int_symbol_start @@ -272,7 +264,7 @@ parser_verify_ikarus_version: call DWORD [ds_lstrcmpiA] addStack 2*4 test eax, eax - verifyStackoffset g1g2(0x398,0,0,0x3F0) + 0x8 + verifyStackoffset g1g2(0x398,0x38C,0x3F0,0x3F0) + 0xC jz .skip push ebx call DWORD [ds_lstrlenA] @@ -288,7 +280,7 @@ parser_verify_ikarus_version: call DWORD [ds_lstrcmpiA] addStack 2*4 test eax, eax - verifyStackoffset g1g2(0x398,0,0,0x3F0) + 0x8 + verifyStackoffset g1g2(0x398,0x38C,0x3F0,0x3F0) + 0xC jnz .back reportToSpy NINJA_VERIFY_VERSION @@ -312,7 +304,7 @@ parser_verify_ikarus_version: ; mov ecx, esp ; Never reached: Safe some space ; call zSTRING___zSTRING add esp, 0x14 - verifyStackoffset g1g2(0x398,0,0,0x3F0) + 0x8 + verifyStackoffset g1g2(0x398,0x38C,0x3F0,0x3F0) + 0xC jmp .back .verifyFilePath: @@ -333,12 +325,12 @@ parser_verify_ikarus_version: addStack 2*4 pop eax test eax, eax - verifyStackoffset g1g2(0x398,0,0,0x3F0) + 0x8 + verifyStackoffset g1g2(0x398,0x38C,0x3F0,0x3F0) + 0xC jz .back reportToSpy NINJA_COMPARE_VERSIONS cmp ebx, eax - verifyStackoffset g1g2(0x398,0,0,0x3F0) + 0x8 + verifyStackoffset g1g2(0x398,0x38C,0x3F0,0x3F0) + 0xC jge .back push edi @@ -407,30 +399,35 @@ parser_verify_ikarus_version: call zCPar_Symbol__GetValue addStack 2*4 pop eax - verifyStackoffset g1g2(0x398,0,0,0x3F0) + 0x8 + verifyStackoffset g1g2(0x398,0x38C,0x3F0,0x3F0) + 0xC jmp .backClean .back: mov eax, ebx .backClean: + mov ecx, ebp + pop ebp pop ebx add esp, 0x4 - verifyStackoffset g1g2(0x398,0,0,0x3F0) + verifyStackoffset g1g2(0x398,0x38C,0x3F0,0x3F0) ; Jump back push eax - mov ecx, ebp call zCPar_Symbol__SetValue_int - jmp g1g2(0x6F2459,0,0,0x79BDD8) + jmp g1g2(0x6F2451,0x72BEA6,0x73C390,0x79BDD0) + 8 global parser_verify_lego_version parser_verify_lego_version: - resetStackoffset g1g2(0x394,0,0,0x3EC) + resetStackoffset g1g2(0x394,0x388,0x3EC,0x3EC) push eax push edx push ebx + push ebp +%if GOTHIC_BASE_VERSION == 112 + mov ebp, ebx +%endif mov ecx, DWORD [zCParser__enableParsing] ; Check if wrapped by Ninja cmp ecx, 0x2A @@ -438,7 +435,7 @@ parser_verify_lego_version: mov ecx, [esi+zCParser_mergemode_offset] test ecx, ecx - verifyStackoffset g1g2(0x394,0,0,0x3EC) + 0xC + verifyStackoffset g1g2(0x394,0x388,0x3EC,0x3EC) + 0x10 jz .back mov ebx, keep_string_symbol_start @@ -451,7 +448,7 @@ parser_verify_lego_version: call DWORD [ds_lstrcmpiA] addStack 2*4 test eax, eax - verifyStackoffset g1g2(0x394,0,0,0x3EC) + 0xC + verifyStackoffset g1g2(0x394,0x388,0x3EC,0x3EC) + 0x10 jz .skip push ebx call DWORD [ds_lstrlenA] @@ -466,15 +463,15 @@ parser_verify_lego_version: call DWORD [ds_lstrcmpiA] addStack 2*4 test eax, eax - verifyStackoffset g1g2(0x394,0,0,0x3EC) + 0xC + verifyStackoffset g1g2(0x394,0x388,0x3EC,0x3EC) + 0x10 jnz .back reportToSpy NINJA_VERIFY_VERSION - mov ecx, [esp+stackoffset+g1g2(-0x340,0,0,-0x394)+0x8] ; str->ptr + mov ecx, [esp+stackoffset+g1g2(-0x340,-0x58-0x4,-0x394,-0x394)+0x8] ; str->ptr push ecx call DWORD [ds_lstrlenA] addStack 4 - mov ecx, [esp+stackoffset+g1g2(-0x340,0,0,-0x394)+0x8] ; str->ptr + mov ecx, [esp+stackoffset+g1g2(-0x340,-0x58-0x4,-0x394,-0x394)+0x8] ; str->ptr sub eax, 0x5 ; Expects "...-Nxxx" add ecx, eax cmp BYTE [ecx], '-' @@ -507,7 +504,7 @@ parser_verify_lego_version: ; mov ecx, esp ; Never reached: Safe some space ; call zSTRING___zSTRING add esp, 0x14 - verifyStackoffset g1g2(0x394,0,0,0x3EC) + 0xC + verifyStackoffset g1g2(0x394,0x388,0x3EC,0x3EC) + 0x10 jmp .back .verifyFilePath: @@ -516,7 +513,7 @@ parser_verify_lego_version: call ninja_scriptPathInvalid addStack 2*4 test eax, eax - verifyStackoffset g1g2(0x394,0,0,0x3EC) + 0xC + verifyStackoffset g1g2(0x394,0x388,0x3EC,0x3EC) + 0x10 jnz .back .compareVersions: @@ -524,7 +521,7 @@ parser_verify_lego_version: lea edx, [eax+edi*0x4] mov eax, [edx+0x8] test eax, eax - verifyStackoffset g1g2(0x394,0,0,0x3EC) + 0xC + verifyStackoffset g1g2(0x394,0x388,0x3EC,0x3EC) + 0x10 jz .back reportToSpy NINJA_COMPARE_VERSIONS @@ -532,15 +529,15 @@ parser_verify_lego_version: call ninja_parseVersionString addStack 4 test eax, eax - verifyStackoffset g1g2(0x394,0,0,0x3EC) + 0xC + verifyStackoffset g1g2(0x394,0x388,0x3EC,0x3EC) + 0x10 jl .back mov ebx, eax - mov eax, [esp+stackoffset+g1g2(-0x340,0,0,-0x394)+0x8] ; str->ptr + mov eax, [esp+stackoffset+g1g2(-0x340,-0x58-0x4,-0x394,-0x394)+0x8] ; str->ptr push eax call ninja_parseVersionString addStack 4 cmp eax, ebx - verifyStackoffset g1g2(0x394,0,0,0x3EC) + 0xC + verifyStackoffset g1g2(0x394,0x388,0x3EC,0x3EC) + 0x10 jge .back push edi @@ -604,17 +601,21 @@ parser_verify_lego_version: jmp .backClean .back: - lea ecx, [esp+stackoffset+g1g2(-0x340,0,0,-0x394)] + lea ecx, [esp+stackoffset+g1g2(-0x340,-0x58-0x4,-0x394,-0x394)] .backClean: + pop ebp pop ebx pop edx pop eax - verifyStackoffset g1g2(0x394,0,0,0x3EC) + verifyStackoffset g1g2(0x394,0x388,0x3EC,0x3EC) ; Jump back push edi - jmp g1g2(0x6F24B1,0,0,0x79BE30) +%if GOTHIC_BASE_VERSION == 112 + push ecx +%endif + jmp g1g2(0x6F24AC,0x72BF00,0x73C3EB,0x79BE2B) + 5 global parser_resolve_path_src @@ -630,7 +631,7 @@ parser_resolve_path_src: push NINJA_PATH_IKARUSSRC call zSTRING__zSTRING addStack 4 - jmp g1g2(0x6E6100,0,0,0x78F380) + jmp g1g2(0x6E6100,0x71ECCD,0x72F940,0x78F380) verifyStackoffset 0x250 .checkLeGo: @@ -644,11 +645,11 @@ parser_resolve_path_src: push NINJA_PATH_LEGOSRC call zSTRING__zSTRING addStack 4 - jmp g1g2(0x6E6100,0,0,0x78F380) + jmp g1g2(0x6E6100,0x71ECCD,0x72F940,0x78F380) verifyStackoffset 0x250 .back: ; Jump back lea ecx, [esp+stackoffset-0x240] call zSTRING__Upper - jmp g1g2(0x6E5F1E,0,0,0x78F19E) + jmp g1g2(0x6E5F19,0x71EAB5,0x72F759,0x78F199) + 5 diff --git a/src/func/allowRedefine.asm b/src/func/allowRedefine.asm index 7fd295a..5e0c97d 100644 --- a/src/func/allowRedefine.asm +++ b/src/func/allowRedefine.asm @@ -50,7 +50,7 @@ ninja_allowRedefine: push eax mov eax, [esp+stackoffset+arg_1] - mov eax, [eax+g1g2(0x10A4,0x10A4,0x10A4,0x20A4)] ; parser->line + mov eax, [eax+g1g2(0x10A4,0x10A4,0x10A4,0x20A4)] ; parser->line push 0xA push ecx push eax diff --git a/src/hook_linkerReplaceFunc.asm b/src/hook_linkerReplaceFunc.asm index 216b5d1..f5e41a5 100644 --- a/src/hook_linkerReplaceFunc.asm +++ b/src/hook_linkerReplaceFunc.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6E79C1,0,0,0x790CA8) + org g1g2(0x6E79C1,0x7207A9,0x731268,0x790CA8) %endif bits 32 diff --git a/src/hook_parserDeclareClass.asm b/src/hook_parserDeclareClass.asm index 0afd966..acfa0a1 100644 --- a/src/hook_parserDeclareClass.asm +++ b/src/hook_parserDeclareClass.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6F2B21,0,0,0x79C432) + org g1g2(0x6F2B21,0x72C545,0x73C9F2,0x79C432) %endif bits 32 @@ -15,8 +15,8 @@ section .text align=1 ; Pre jmp parser_check_class ; Overwrites - ; %if GOTHIC_BASE_VERSION == 1 + ; %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 ; call operator_new_len - ; %elif GOTHIC_BASE_VERSION == 2 + ; %elif GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 ; call operator_new ; %endif diff --git a/src/hook_parserDeclareFunc.asm b/src/hook_parserDeclareFunc.asm index f3fd5a1..a2c5ee8 100644 --- a/src/hook_parserDeclareFunc.asm +++ b/src/hook_parserDeclareFunc.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6F494E,0,0,0x79E1AE) + org g1g2(0x6F494E,0x72E5DE,0x73E76E,0x79E1AE) %endif bits 32 @@ -14,14 +14,12 @@ section .text align=1 ; Pre jmp parser_check_func - %if GOTHIC_BASE_VERSION == 2 + %if GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 times 2 nop %endif ; Overwrites - ; %if GOTHIC_BASE_VERSION == 1 - ; push 0x5AE - ; %elif GOTHIC_BASE_VERSION == 2 - ; push 0x3C - ; call operator_new + ; push g1g2(0x5AE, 0x5AE, 0x3C, 0x3C) + ; %if GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 + ; call operator_new ; %endif diff --git a/src/hook_parserDeclarePrototype.asm b/src/hook_parserDeclarePrototype.asm index 619acf5..b720363 100644 --- a/src/hook_parserDeclarePrototype.asm +++ b/src/hook_parserDeclarePrototype.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6F36B2,0,0,0x79CF72) + org g1g2(0x6F36B2,0x72D1EA,0x73D532,0x79CF72) %endif bits 32 @@ -14,10 +14,14 @@ section .text align=1 ; Pre jmp parser_check_prototype + %if GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 + times 2 nop + %endif + ; Overwrites - ; %if GOTHIC_BASE_VERSION == 1 + ; %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 ; push 0x4DF - ; %elif GOTHIC_BASE_VERSION == 2 + ; %elif GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 ; push 0x3C ; call operator_new ; %endif diff --git a/src/hook_parserDeclareVar.asm b/src/hook_parserDeclareVar.asm index 1bf1fdd..199ff0d 100644 --- a/src/hook_parserDeclareVar.asm +++ b/src/hook_parserDeclareVar.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6F18CD,0,0,0x79B3B5) + org g1g2(0x6F18CD,0x72B30A,0x73B975,0x79B3B5) %endif bits 32 @@ -14,14 +14,12 @@ section .text align=1 ; Pre jmp parser_check_var - %if GOTHIC_BASE_VERSION == 2 + %if GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 times 2 nop %endif ; Overwrites - ; %if GOTHIC_BASE_VERSION == 1 - ; push 0x3BA + ; push g1g2(0x3BA, 0x3BA, 0x3C, 0x3C) ; %elif GOTHIC_BASE_VERSION == 2 - ; push 0x3C ; call operator_new ; %endif diff --git a/src/hook_parserDeclareVar_constInt.asm b/src/hook_parserDeclareVar_constInt.asm index baa36d5..1abc02e 100644 --- a/src/hook_parserDeclareVar_constInt.asm +++ b/src/hook_parserDeclareVar_constInt.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6F2451,0,0,0x79BDD0) + org g1g2(0x6F2451,0x72BEA6,0x73C390,0x79BDD0) %endif bits 32 diff --git a/src/hook_parserDeclareVar_constString.asm b/src/hook_parserDeclareVar_constString.asm index 2775a8e..03faf2e 100644 --- a/src/hook_parserDeclareVar_constString.asm +++ b/src/hook_parserDeclareVar_constString.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6F24AC,0,0,0x79BE2B) + org g1g2(0x6F24AC,0x72BF00,0x73C3EB,0x79BE2B) %endif bits 32 diff --git a/src/hook_parserParseSource.asm b/src/hook_parserParseSource.asm index cd096c0..c7a6660 100644 --- a/src/hook_parserParseSource.asm +++ b/src/hook_parserParseSource.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6E5F19,0,0,0x78F199) + org g1g2(0x6E5F19,0x71EAB5,0x72F759,0x78F199) %endif bits 32 diff --git a/src/ow_parserDeclareClass_showOverwrite.asm b/src/ow_parserDeclareClass_showOverwrite.asm index 8d3aadc..56b30ab 100644 --- a/src/ow_parserDeclareClass_showOverwrite.asm +++ b/src/ow_parserDeclareClass_showOverwrite.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6F2B99,0,0,0x79C4AA) + org g1g2(0x6F2B99,0x72C5CC,0x73CA6A,0x79C4AA) %endif bits 32 @@ -12,11 +12,11 @@ bits 32 section .text align=1 ; Prevent auto-alignment - resetStackoffset 0x4C + resetStackoffset mov eax, [eax+0x8] push eax push esi call ninja_allowRedefine addStack 2*4 - verifyStackoffset 0x4C - jmp g1g2(0x6F2BEA,0,0,0x79C4FB) + verifyStackoffset + jmp g1g2(0x6F2BEA,0x72C637,0x73CABB,0x79C4FB) diff --git a/src/ow_parserDeclareFunc_showOverwrite.asm b/src/ow_parserDeclareFunc_showOverwrite.asm index 4a773f6..f2e4f5d 100644 --- a/src/ow_parserDeclareFunc_showOverwrite.asm +++ b/src/ow_parserDeclareFunc_showOverwrite.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6F49C1,0,0,0x79E212) + org g1g2(0x6F49C1,0x72E65E,0x73E7D2,0x79E212) %endif bits 32 @@ -19,4 +19,4 @@ section .text align=1 ; Pre call ninja_allowRedefine addStack 2*4 verifyStackoffset 0xA4 - jmp g1g2(0x6F49FD,0,0,0x79E24E) + jmp g1g2(0x6F49FD,0x72E6A4,0x73E80E,0x79E24E) diff --git a/src/ow_parserDeclarePrototype_showOverwrite.asm b/src/ow_parserDeclarePrototype_showOverwrite.asm index 976f07c..3447930 100644 --- a/src/ow_parserDeclarePrototype_showOverwrite.asm +++ b/src/ow_parserDeclarePrototype_showOverwrite.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6F3753,0,0,0x79D004) + org g1g2(0x6F3753,0x72D29A,0x73D5C4,0x79D004) %endif bits 32 @@ -19,4 +19,4 @@ section .text align=1 ; Pre call ninja_allowRedefine addStack 2*4 verifyStackoffset 0xB8 - jmp g1g2(0x6F3794,0,0,0x79D045) + jmp g1g2(0x6F3794,0x72D2E5,0x73D605,0x79D045) diff --git a/src/ow_parserDeclareVar_showOverwrite.asm b/src/ow_parserDeclareVar_showOverwrite.asm index 61f022d..d9bb510 100644 --- a/src/ow_parserDeclareVar_showOverwrite.asm +++ b/src/ow_parserDeclareVar_showOverwrite.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6F2113,0,0,0x79BABF) + org g1g2(0x6F2113,0x72BBB3,0x73C07F,0x79BABF) %endif bits 32 @@ -12,11 +12,11 @@ bits 32 section .text align=1 ; Prevent auto-alignment - resetStackoffset g1g2(0x394,0,0,0x3EC) - mov eax, [ebp+0x8] + resetStackoffset g1g2(0x394,0x388,0x3EC,0x3EC) + mov eax, [g1g2(ebp,ebx,ebp,ebp)+0x8] push eax push esi call ninja_allowRedefine addStack 2*4 - verifyStackoffset g1g2(0x394,0,0,0x3EC) - jmp g1g2(0x6F215B,0,0,0x79BB07) + verifyStackoffset g1g2(0x394,0x388,0x3EC,0x3EC) + jmp g1g2(0x6F215B,0x72BBFC,0x73C0C7,0x79BB07) From 92d3c36dfd51eda29dee727109f00baeac78f66f Mon Sep 17 00:00:00 2001 From: szapp Date: Sun, 30 Jul 2023 23:29:43 +0200 Subject: [PATCH 7/9] Finalize bin-base for 1.12f and 1.30 fix The remaining part is the animations for 1.30 fix --- Makefile | 59 +------------ src/core.asm | 2 - src/exec/createVdfArray.asm | 2 +- src/exec/deploy.asm | 16 ++-- src/exec/misc.asm | 105 ++++++++++++----------- src/hook_CGameManager_destructor.asm | 2 +- src/hook_Hlp_GetNpc.asm | 2 +- src/hook_Hlp_IsValidItem.asm | 2 +- src/hook_Hlp_IsValidNpc.asm | 2 +- src/hook_archiveWorldCountLogicalNpc.asm | 2 +- src/hook_archiveWorldWriteLogicalNpc.asm | 2 +- src/hook_deploy_ani_ninja.asm | 4 +- src/hook_deploy_vfx_ninja.asm | 4 +- src/hook_fastexit.asm | 2 +- src/hook_libExit.asm | 2 +- src/hook_npcReference.asm | 2 +- src/hook_oCSpawnManager__Archive.asm | 2 +- src/hook_setVobToTransient.asm | 2 +- src/hook_unarchiveInfoMan.asm | 2 +- src/hook_unarchiveNpcs.asm | 2 +- src/hook_unarchiveVobs.asm | 4 +- src/hook_zCParser__LoadGlobalVars.asm | 5 +- src/ow_ani.asm | 20 ++--- src/ow_aniAlias.asm | 27 +++--- src/ow_aniBatch.asm | 30 +++---- src/ow_aniBlend.asm | 27 +++--- src/ow_aniComb.asm | 31 +++---- src/ow_aniDisable.asm | 27 +++--- src/ow_aniSync.asm | 27 +++--- src/ow_playerInfoName1.asm | 2 +- src/ow_playerInfoName2.asm | 2 +- src/ow_playerInfoName3.asm | 2 +- src/ow_playerInfoName4.asm | 2 +- src/ow_playerInfoName5.asm | 2 +- src/ow_reopenFileWarning.asm | 2 +- src/ow_zCParser__LoadGlobalVars.asm | 8 +- 36 files changed, 206 insertions(+), 230 deletions(-) diff --git a/Makefile b/Makefile index 276a3f0..005c14d 100644 --- a/Makefile +++ b/Makefile @@ -141,60 +141,7 @@ BIN_BASE := core \ ow_playerInfoName3 \ ow_playerInfoName4 \ ow_playerInfoName5 -BIN_BASE_G112 := core \ - hook_createVdfArray \ - hook_deploy_ani_ninja \ - hook_deploy_camera_ninja \ - hook_deploy_content_ninja \ - hook_deploy_fightai_ninja \ - hook_deploy_menu_ninja \ - hook_deploy_music_ninja \ - hook_deploy_ou_ninja \ - hook_deploy_pfx_ninja \ - hook_deploy_sfx_ninja \ - hook_deploy_vfx_ninja \ - hook_init_menu \ - hook_init_content \ - hook_linkerReplaceFunc \ - hook_parserDeclareClass \ - hook_parserDeclareFunc \ - hook_parserDeclarePrototype \ - hook_parserDeclareVar \ - hook_parserDeclareVar_constInt \ - hook_parserDeclareVar_constString \ - hook_parserParseSource \ - hook_zCPar_Symbol__GetNext \ - ow_parserDeclareClass_showOverwrite \ - ow_parserDeclareFunc_showOverwrite \ - ow_parserDeclarePrototype_showOverwrite \ - ow_parserDeclareVar_showOverwrite -BIN_BASE_G130 := core \ - hook_createVdfArray \ - hook_deploy_ani_ninja \ - hook_deploy_camera_ninja \ - hook_deploy_content_ninja \ - hook_deploy_fightai_ninja \ - hook_deploy_menu_ninja \ - hook_deploy_music_ninja \ - hook_deploy_ou_ninja \ - hook_deploy_pfx_ninja \ - hook_deploy_sfx_ninja \ - hook_deploy_vfx_ninja \ - hook_init_menu \ - hook_init_content \ - hook_linkerReplaceFunc \ - hook_parserDeclareClass \ - hook_parserDeclareFunc \ - hook_parserDeclarePrototype \ - hook_parserDeclareVar \ - hook_parserDeclareVar_constInt \ - hook_parserDeclareVar_constString \ - hook_parserParseSource \ - hook_zCPar_Symbol__GetNext \ - ow_parserDeclareClass_showOverwrite \ - ow_parserDeclareFunc_showOverwrite \ - ow_parserDeclarePrototype_showOverwrite \ - ow_parserDeclareVar_showOverwrite +BIN_BASE_G130 := ow_zCParser__LoadGlobalVars BIN_BASE_G2 := ow_zCParser__LoadGlobalVars \ skip_writeAniBinFile_ModelTag \ skip_writeAniBinFile_ReadMeshAndTree \ @@ -235,8 +182,8 @@ DATA_BASE := symbols \ messages BINARIES_G1 := $(BIN_BASE:%=$(BINDIR)%_g1) -BINARIES_G112 := $(BIN_BASE_G112:%=$(BINDIR)%_g112) -BINARIES_G130 := $(BIN_BASE_G130:%=$(BINDIR)%_g130) +BINARIES_G112 := $(BIN_BASE:%=$(BINDIR)%_g112) +BINARIES_G130 := $(BIN_BASE:%=$(BINDIR)%_g130) $(BIN_BASE_G130:%=$(BINDIR)%_g130) # $(BIN_BASE_G2:%=$(BINDIR)%_g130) BINARIES_G2 := $(BIN_BASE:%=$(BINDIR)%_g2) $(BIN_BASE_G2:%=$(BINDIR)%_g2) FUNC := $(FUNC_BASE:%=$(FUNCDIR)%$(ASMEXT)) EXEC := $(EXEC_BASE:%=$(EXECDIR)%$(ASMEXT)) diff --git a/src/core.asm b/src/core.asm index e60a35e..80c279e 100644 --- a/src/core.asm +++ b/src/core.asm @@ -20,9 +20,7 @@ section .text %include "exec/deploy.asm" %include "exec/init.asm" %include "exec/parse.asm" -%if GOTHIC_BASE_VERSION != 112 && GOTHIC_BASE_VERSION != 130 %include "exec/misc.asm" -%endif %include "func/freeVdfArray.asm" %include "func/dispatch.asm" diff --git a/src/exec/createVdfArray.asm b/src/exec/createVdfArray.asm index 44a5b1f..4dd4dfb 100644 --- a/src/exec/createVdfArray.asm +++ b/src/exec/createVdfArray.asm @@ -50,7 +50,7 @@ createVdfArray: add esp, 0x14 %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 2 - mov al, [SystemPack_version_info+g1g2(0xD,0x0,0x0,0xB)] ; Check for old Ninja system + mov al, [SystemPack_version_info+g1g2(0xD,,,0xB)] ; Check for old Ninja system cmp al, 'N' jnz .checkScripts diff --git a/src/exec/deploy.asm b/src/exec/deploy.asm index 8cd4392..05fe67e 100644 --- a/src/exec/deploy.asm +++ b/src/exec/deploy.asm @@ -72,7 +72,7 @@ deploy_vfx_ninja: ; Jump back %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 - lea g1g2(edx,0x0,eax,eax), [esp+stackoffset+g1g2(-0x239,0x0,-0x226,-0x235)] + lea g1g2(edx,,eax,eax), [esp+stackoffset+g1g2(-0x239,,-0x226,-0x235)] %elif GOTHIC_BASE_VERSION == 112 mov [esp+stackoffset-0x21C], cl %endif @@ -171,9 +171,9 @@ deploy_ani_ninja: %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 - resetStackoffset g1g2(0xF54,0xFD8,0x0,0x0) + resetStackoffset g1g2(0xF54,0xFD8,,) pusha - mov ebp, [esp+stackoffset-g1g2(0xF24,0xFA8,0,0x0)] ; zCModelPrototype * + mov ebp, [esp+stackoffset-g1g2(0xF24,0xFA8,,)] ; zCModelPrototype * mov esi, [ebp+0x14] ; name->ptr push esi mov esi, DWORD [zFILE_cur_mds_file] @@ -182,7 +182,7 @@ deploy_ani_ninja: call DWORD [ds_lstrcmpiA] addStack 2*4 test eax, eax - verifyStackoffset g1g2(0xF54,0xFD8,0x0,0x0)+32 ; Base + pusha + verifyStackoffset g1g2(0xF54,0xFD8,,)+32 ; Base + pusha jnz .back sub esp, 0x120 mov eax, esp @@ -203,9 +203,9 @@ deploy_ani_ninja: .back: popa - verifyStackoffset g1g2(0xF54,0xFD8,0x0,0x0) - cmp [esp+stackoffset-g1g2(0xE88,0xF20,0x0,0x0)], ebp - jmp g1g2(0x57DC40,0x598474,0x0,0x0)+7 + verifyStackoffset g1g2(0xF54,0xFD8,,) + cmp [esp+stackoffset-g1g2(0xE88,0xF20,,)], ebp + jmp g1g2(0x57DC40,0x598474,,)+7 %elif GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 @@ -233,6 +233,6 @@ deploy_ani_ninja: ; Jump back mov eax, [esp+stackoffset-0x3E0] - jmp g1g2(0x0,0x0,0x590C6D,0x5961CD)+7 + jmp g1g2(,,0x590C6D,0x5961CD)+7 %endif diff --git a/src/exec/misc.asm b/src/exec/misc.asm index e895f98..664d550 100644 --- a/src/exec/misc.asm +++ b/src/exec/misc.asm @@ -15,7 +15,7 @@ setVobToTransient: test eax, eax jz .back - mov eax, [esi+g1g2(0x7B0,0,0,0x770)] ; oCNpc.instanz + mov eax, [esi+g1g2(0x7B0,0x7B4,0x6E4,0x770)] ; oCNpc.instanz test eax, eax jl .back mov edi, eax @@ -49,9 +49,9 @@ setVobToTransient: cmp edi, eax jg .cleanup - %if GOTHIC_BASE_VERSION == 1 + %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 test BYTE [esi+0xF5], 0x1 ; zCVob.dontwritetoarchive - %elif GOTHIC_BASE_VERSION == 2 + %elif GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 test BYTE [esi+0x114], 0x10 ; zCVob.dontwritetoarchive %endif jnz .cleanup @@ -68,9 +68,9 @@ setVobToTransient: call zERROR__Message addStack 4 - %if GOTHIC_BASE_VERSION == 1 + %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 or BYTE [esi+0xF5], 0x1 ; zCVob.dontwritetoarchive = True - %elif GOTHIC_BASE_VERSION == 2 + %elif GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 or BYTE [esi+0x114], 0x10 ; zCVob.dontwritetoarchive = True %endif @@ -84,53 +84,56 @@ setVobToTransient: verifyStackoffset 0x68 ; Jump back - mov eax, [esi+g1g2(0x214,0,0,0x25C)] - jmp g1g2(0x68CB37,0,0,0x72F167) + mov eax, [esi+g1g2(0x214,0x214,0x248,0x25C)] +%if GOTHIC_BASE_VERSION == 112 + test eax, eax +%endif + jmp g1g2(0x68CB31,0x6BD2E0,0x6D0F01,0x72F161) + 6 global checkNpcTransient1 checkNpcTransient1: - resetStackoffset g1g2(0x5C,0x5C,0,0x94) + resetStackoffset g1g2(0x5C,0x5C,0x94,0x94) call DWORD [edx+0x104] ; oCNpc.IsSelfPlayer(void) test eax, eax jnz .back %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 test BYTE [ecx+0xF5], 0x1 ; zCVob.dontwritetoarchive - %elif GOTHIC_BASE_VERSION == 2 + %elif GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 test BYTE [ecx+0x114], 0x10 ; zCVob.dontwritetoarchive %endif jz .back mov eax, 0x1 - verifyStackoffset g1g2(0x5C,0x5C,0,0x94) + verifyStackoffset g1g2(0x5C,0x5C,0x94,0x94) .back: - jmp g1g2(0x6D652A,0x70DF35,0,0x77F66A)+6 + jmp g1g2(0x6D652A,0x70DF35,0x71FC2A,0x77F66A) + 6 global checkNpcTransient2 checkNpcTransient2: - resetStackoffset g1g2(0x5C,0x5C,0,0x94) + resetStackoffset g1g2(0x5C,0x5C,0x94,0x94) call DWORD [eax+0x104] ; oCNpc.IsSelfPlayer(void) test eax, eax jnz .back %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 test BYTE [ecx+0xF5], 0x1 ; zCVob.dontwritetoarchive - %elif GOTHIC_BASE_VERSION == 2 + %elif GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 test BYTE [ecx+0x114], 0x10 ; zCVob.dontwritetoarchive %endif jz .back mov eax, 0x1 - verifyStackoffset g1g2(0x5C,0x5C,0,0x94) + verifyStackoffset g1g2(0x5C,0x5C,0x94,0x94) .back: - jmp g1g2(0x6D65A3,0x70DFA6,0,0x77F6E1)+6 + jmp g1g2(0x6D65A3,0x70DFA6,0x71FCA1,0x77F6E1)+6 global removeInvalidNpcs removeInvalidNpcs: - resetStackoffset g1g2(0x58,0,0,0x8C) + resetStackoffset g1g2(0x58,0x58,0x8C,0x8C) push ebx push edx @@ -149,16 +152,16 @@ removeInvalidNpcs: pop ecx jz .back - mov eax, [esi+g1g2(0x7B0,0,0,0x770)] ; oCNpc.instance + mov eax, [esi+g1g2(0x7B0,0x7B4,0x6E4,0x770)] ; oCNpc.instanz test eax, eax jge .back reportToSpy NINJA_REMOVE_NPC push char_meatbug_mds - lea ecx, [esi+g1g2(0x07B4,0,0,0x774)] ; oCNpc.mds_name + lea ecx, [esi+g1g2(0x7B4,0x7C8,0x6E8,0x774)] ; oCNpc.mds_name call zSTRING__zSTRING addStack 4 - mov ecx, [esp+stackoffset+g1g2(-0x48,0,0,-0x7C)] + mov ecx, [esp+stackoffset+g1g2(-0x48,-0x10-0x4,-0x7C,-0x7C)] mov edx, esi call oCWorld__RemoveFromLists @@ -180,28 +183,28 @@ removeInvalidNpcs: .back: pop edx pop ebx - verifyStackoffset g1g2(0x58,0,0,0x8C) + verifyStackoffset g1g2(0x58,0x58,0x8C,0x8C) ; Jump back %if GOTHIC_BASE_VERSION == 1 test ebx, ebx jnz 0x5F81A2 test ecx, ecx - jmp 0x5F814F -%elif GOTHIC_BASE_VERSION == 2 - mov eax, [esp+stackoffset-0x78] + jmp 0x5F8149 + 5 +%elif GOTHIC_BASE_VERSION == 112 || GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 + mov eax, [esp+stackoffset+g1g2(,-0x14-0x4,-0x78,-0x78)] test eax, eax - jmp 0x626790 + jmp g1g2(,0x61959E,0x61EFFA,0x62678A) + 5 %endif global removeInvalidNpcs2 removeInvalidNpcs2: - resetStackoffset g1g2(0x5C,0,0,0x98) + resetStackoffset g1g2(0x5C,0x5C,0x98,0x98) test esi, esi jz .back - mov eax, [esi+g1g2(0x7B0,0,0,0x770)] ; oCNpc.instance + mov eax, [esi+g1g2(0x7B0,0x7B4,0x6E4,0x770)] ; oCNpc.instanz test eax, eax jl .remove call oCWorld__InsertInLists @@ -210,13 +213,14 @@ removeInvalidNpcs2: .remove: reportToSpy NINJA_REMOVE_NPC push char_meatbug_mds - lea ecx, [esi+g1g2(0x07B4,0,0,0x774)] ; oCNpc.mds_name + lea ecx, [esi+g1g2(0x7B4,0x7C8,0x6E8,0x774)] ; oCNpc.mds_name call zSTRING__zSTRING addStack 4 .back: - verifyStackoffset g1g2(0x5C,0,0,0x98) - jmp g1g2(0x6D6828,0,0,0x77F9C0) + verifyStackoffset g1g2(0x5C,0x5C,0x98,0x98) + jmp g1g2(0x6D6823,0x70E25F,0x71FF7B,0x77F9BB) + 5 + global removeNpcInstRef removeNpcInstRef: @@ -228,7 +232,7 @@ removeNpcInstRef: addStack 4 pop ecx verifyStackoffset 0x14 -%if GOTHIC_BASE_VERSION == 1 +%if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 || GOTHIC_BASE_VERSION == 130 pop esi pop ebp pop ebx @@ -236,7 +240,8 @@ removeNpcInstRef: %elif GOTHIC_BASE_VERSION == 2 cmp [esi+0x758], ebp %endif - jmp g1g2(0x68C0FC,0,0,0x72E62B) + jmp g1g2(0x68C0F6,0x6BC7DD,0x6D0445,0x72E625) + 5 + global ninja_injectInfo ninja_injectInfo: @@ -434,35 +439,35 @@ ninja_injectInfo: ; Jump back push esi mov ecx, oCMissionManager_misMan - jmp g1g2(0x63C7F4,0,0,0x6C6D24) + jmp g1g2(0x63C7EE,0x663348,0x66A0EE,0x6C6D1E) + 5 global createGlobalVarIfNotExist createGlobalVarIfNotExist: -%if GOTHIC_BASE_VERSION == 1 ; zCParser::LoadGlobalVars differs for g1/g2 - resetStackoffset 0xC4 +%if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 ; zCParser::LoadGlobalVars differs for g1/g2 + resetStackoffset g1g2(0xC4,0xBC,,) jz .createSymb mov eax, [esi+0x20] ; Rewritten what has been overwritten - jmp 0x6EDADA + jmp g1g2(0x6EDAD5,0x727105,,) + 5 .createSymb: push zPAR_TYPE_INT | 0x1 - lea ecx, [esp+stackoffset-0x8C] + lea ecx, [esp+stackoffset-g1g2(0x8C,0x84,,)] push DWORD [ecx+0x4] call ninja_createSymbol addStack 2*4 mov esi, eax - verifyStackoffset 0xC4 + verifyStackoffset g1g2(0xC4,0xBC,,) ; Jump back - jmp 0x6EDAF7 + jmp g1g2(0x6EDAF7,0x727128,,) -%elif GOTHIC_BASE_VERSION == 2 +%elif GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 resetStackoffset 0x1F0 - jle 0x797608 + jle g1g2(,,0x737BC8,0x797608) mov ecx, [esp+stackoffset-0x1B0] ; zCPar_Symbol * test ecx, ecx - jnz 0x7973E7 + jnz g1g2(,,0x7379A1,0x7973E1) + 5 or eax, zPAR_TYPE_INT push eax @@ -474,7 +479,7 @@ createGlobalVarIfNotExist: verifyStackoffset 0x1F0 ; Jump back - jmp 0x7973E7 + jmp g1g2(,,0x7379A1,0x7973E1) + 5 %endif @@ -483,7 +488,7 @@ fix_Hlp_GetNpc: resetStackoffset 0x10 mov eax, [esi+zCPar_Symbol_offset_offset] test eax, eax - jz g1g2(0x65880E,0,0,0x6EEE6E) + jz g1g2(0x65880E,0x682D4E,0x691BFE,0x6EEE6E) push ecx mov ecx, eax @@ -495,13 +500,13 @@ fix_Hlp_GetNpc: add esp, 0x8 test eax, eax pop ecx - jz g1g2(0x65880E,0,0,0x6EEE6E) + jz g1g2(0x65880E,0x682D4E,0x691BFE,0x6EEE6E) verifyStackoffset 0x10 ; Jump back push edi push oCNpc_RTTI_Type_Descriptor - jmp g1g2(0x6587F2,0,0,0x6EEE52) + jmp g1g2(0x6587EC,0x682D2C,0x691BDC,0x6EEE4C) + 5 global fix_Hlp_IsValidNpc @@ -527,7 +532,7 @@ fix_Hlp_IsValidNpc: ; Jump back call dynamic_cast .backClean: - jmp g1g2(0x658883,0,0,0x6EEEE3) + jmp g1g2(0x65887E,0x682DCE,0x691C6E,0x6EEEDE) + 5 global fix_Hlp_IsValidItem @@ -553,7 +558,7 @@ fix_Hlp_IsValidItem: ; Jump back call dynamic_cast .backClean: - jmp g1g2(0x658B43,0,0,0x6EF1D3) + jmp g1g2(0x658B3E,0x6830AE,0x691F5E,0x6EF1CE) + 5 ; Deinitialize VDFS on fast exit to ensure release of data file @@ -574,7 +579,7 @@ CGameMananager_destruction_deinit_vdfs: ; Jump back mov BYTE [esp+stackoffset-0x4], 0x4 - jmp g1g2(0x423BE1,0x4265C9,0,0x4247D1) + jmp g1g2(0x423BDC,0x4265C4,0x42449C,0x4247CC) + 5 ; Deinitialize VDFS on libExit (fatal error) @@ -587,5 +592,5 @@ libExit_deinit_vdfs: verifyStackoffset ; Jump back - mov eax, g1g2(0x86F51C,0,0,0x8D4294) - jmp g1g2(0x4F3C35,0,0,0x502AB5) + mov eax, g1g2(0x86F51C,0x8B5138,0x8C5C5C,0x8D4294) + jmp g1g2(0x4F3C30,0x506620,0x4FFE30,0x502AB0) + 5 diff --git a/src/hook_CGameManager_destructor.asm b/src/hook_CGameManager_destructor.asm index 193d29c..849a894 100644 --- a/src/hook_CGameManager_destructor.asm +++ b/src/hook_CGameManager_destructor.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x423BDC,0x4265C4,0,0x4247CC) + org g1g2(0x423BDC,0x4265C4,0x42449C,0x4247CC) %endif bits 32 diff --git a/src/hook_Hlp_GetNpc.asm b/src/hook_Hlp_GetNpc.asm index 466dadc..3992378 100644 --- a/src/hook_Hlp_GetNpc.asm +++ b/src/hook_Hlp_GetNpc.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6587EC,0,0,0x6EEE4C) + org g1g2(0x6587EC,0x682D2C,0x691BDC,0x6EEE4C) %endif bits 32 diff --git a/src/hook_Hlp_IsValidItem.asm b/src/hook_Hlp_IsValidItem.asm index 69ad8d5..540cd54 100644 --- a/src/hook_Hlp_IsValidItem.asm +++ b/src/hook_Hlp_IsValidItem.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x658B3E,0,0,0x6EF1CE) + org g1g2(0x658B3E,0x6830AE,0x691F5E,0x6EF1CE) %endif bits 32 diff --git a/src/hook_Hlp_IsValidNpc.asm b/src/hook_Hlp_IsValidNpc.asm index d8530ad..263226c 100644 --- a/src/hook_Hlp_IsValidNpc.asm +++ b/src/hook_Hlp_IsValidNpc.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x65887E,0,0,0x6EEEDE) + org g1g2(0x65887E,0x682DCE,0x691C6E,0x6EEEDE) %endif bits 32 diff --git a/src/hook_archiveWorldCountLogicalNpc.asm b/src/hook_archiveWorldCountLogicalNpc.asm index eb8c260..224f6cb 100644 --- a/src/hook_archiveWorldCountLogicalNpc.asm +++ b/src/hook_archiveWorldCountLogicalNpc.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6D652A,0x70DF35,0,0x77F66A) + org g1g2(0x6D652A,0x70DF35,0x71FC2A,0x77F66A) %endif bits 32 diff --git a/src/hook_archiveWorldWriteLogicalNpc.asm b/src/hook_archiveWorldWriteLogicalNpc.asm index fd1cfde..1414d60 100644 --- a/src/hook_archiveWorldWriteLogicalNpc.asm +++ b/src/hook_archiveWorldWriteLogicalNpc.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6D65A3,0x70DFA6,0,0x77F6E1) + org g1g2(0x6D65A3,0x70DFA6,0x71FCA1,0x77F6E1) %endif bits 32 diff --git a/src/hook_deploy_ani_ninja.asm b/src/hook_deploy_ani_ninja.asm index 5526b23..5685e3a 100644 --- a/src/hook_deploy_ani_ninja.asm +++ b/src/hook_deploy_ani_ninja.asm @@ -17,8 +17,8 @@ section .text align=1 ; Pre ; Overwrites ; %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 - ; resetStackoffset g1g2(0xF54,0xFD8,0,0x0) - ; cmp [esp+stackoffset-g1g2(0xE88,0xF20,0,0x0)], ebp + ; resetStackoffset g1g2(0xF54,0xFD8,,) + ; cmp [esp+stackoffset-g1g2(0xE88,0xF20,,)], ebp ; %elif GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 ; resetStackoffset 0x49C ; mov eax, [esp+stackoffset-0x3E0] diff --git a/src/hook_deploy_vfx_ninja.asm b/src/hook_deploy_vfx_ninja.asm index 3d63ea3..adac4d7 100644 --- a/src/hook_deploy_vfx_ninja.asm +++ b/src/hook_deploy_vfx_ninja.asm @@ -20,8 +20,8 @@ section .text align=1 ; Pre ; Overwrites ; resetStackoffset g1g2(0x248,0x234,0x238,0x250) ; %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 - ; lea g1g2(edx,0x0,eax,eax), [esp+stackoffset+g1g2(-0x239,0x0,-0x226,-0x235)] + ; lea g1g2(edx,,eax,eax), [esp+stackoffset+g1g2(-0x239,,-0x226,-0x235)] ; %elif GOTHIC_BASE_VERSION == 112 ; mov [esp+stackoffset-0x21C], cl ; %endif - ; push g1g2(edx,0,eax,eax) + ; push g1g2(edx,0x0,eax,eax) diff --git a/src/hook_fastexit.asm b/src/hook_fastexit.asm index 0c51baf..362df2d 100644 --- a/src/hook_fastexit.asm +++ b/src/hook_fastexit.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x4249B2,0,0,0x4256AF) + org g1g2(0x4249B2,0x42748D,0x42536F,0x4256AF) %endif bits 32 diff --git a/src/hook_libExit.asm b/src/hook_libExit.asm index 8c3e9e1..dad1c06 100644 --- a/src/hook_libExit.asm +++ b/src/hook_libExit.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x4F3C30,0,0,0x502AB0) + org g1g2(0x4F3C30,0x506620,0x4FFE30,0x502AB0) %endif bits 32 diff --git a/src/hook_npcReference.asm b/src/hook_npcReference.asm index a2bc968..f3e2d22 100644 --- a/src/hook_npcReference.asm +++ b/src/hook_npcReference.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x68C0F6,0,0,0x72E625) + org g1g2(0x68C0F6,0x6BC7DD,0x6D0445,0x72E625) %endif bits 32 diff --git a/src/hook_oCSpawnManager__Archive.asm b/src/hook_oCSpawnManager__Archive.asm index 89fcdf8..f6820f8 100644 --- a/src/hook_oCSpawnManager__Archive.asm +++ b/src/hook_oCSpawnManager__Archive.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6D0F40,0,0,0x7797F0) + org g1g2(0x6D0F40,0x707AC0,0x719DB0,0x7797F0) %endif bits 32 diff --git a/src/hook_setVobToTransient.asm b/src/hook_setVobToTransient.asm index f14add4..a594395 100644 --- a/src/hook_setVobToTransient.asm +++ b/src/hook_setVobToTransient.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x68CB31,0,0,0x72F161) + org g1g2(0x68CB31,0x6BD2E0,0x6D0F01,0x72F161) %endif bits 32 diff --git a/src/hook_unarchiveInfoMan.asm b/src/hook_unarchiveInfoMan.asm index bbcf433..34de2e3 100644 --- a/src/hook_unarchiveInfoMan.asm +++ b/src/hook_unarchiveInfoMan.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x63C7EE,0,0,0x6C6D1E) + org g1g2(0x63C7EE,0x663348,0x66A0EE,0x6C6D1E) %endif bits 32 diff --git a/src/hook_unarchiveNpcs.asm b/src/hook_unarchiveNpcs.asm index 4607519..41a95f1 100644 --- a/src/hook_unarchiveNpcs.asm +++ b/src/hook_unarchiveNpcs.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6D6823,0,0,0x77F9BB) + org g1g2(0x6D6823,0x70E25F,0x71FF7B,0x77F9BB) %endif bits 32 diff --git a/src/hook_unarchiveVobs.asm b/src/hook_unarchiveVobs.asm index f283ee6..00cbb73 100644 --- a/src/hook_unarchiveVobs.asm +++ b/src/hook_unarchiveVobs.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x5F8149,0,0,0x62678A) + org g1g2(0x5F8149,0x61959E,0x61EFFA,0x62678A) %endif bits 32 @@ -13,4 +13,6 @@ bits 32 section .text align=1 ; Prevent auto-alignment jmp removeInvalidNpcs + %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 nop + %endif diff --git a/src/hook_zCParser__LoadGlobalVars.asm b/src/hook_zCParser__LoadGlobalVars.asm index 7684d63..094a4f7 100644 --- a/src/hook_zCParser__LoadGlobalVars.asm +++ b/src/hook_zCParser__LoadGlobalVars.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x6EDAD5,0,0,0x7973E1) + org g1g2(0x6EDAD5,0x727105,0x7379A1,0x7973E1) %endif bits 32 @@ -13,3 +13,6 @@ bits 32 section .text align=1 ; Prevent auto-alignment jmp createGlobalVarIfNotExist +%if GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 + nop +%endif diff --git a/src/ow_ani.asm b/src/ow_ani.asm index e374089..1fb3f15 100644 --- a/src/ow_ani.asm +++ b/src/ow_ani.asm @@ -5,7 +5,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x57D639,0,0,0x59C406) + org g1g2(0x57D639,0x597D9E,0x596EA6,0x59C406) %endif bits 32 @@ -13,27 +13,27 @@ bits 32 section .text align=1 ; Prevent auto-alignment - resetStackoffset g1g2(0xF54,0,0,0x1310) + resetStackoffset g1g2(0xF54,0xF58,0x1310,0x1310) push eax ; Existing zCModelAni * - mov ecx, [esp+stackoffset+g1g2(-0xF24,0,0,-0x12C8)] + mov ecx, [esp+stackoffset+g1g2(-0xF24,-0xF28,-0x12C8,-0x12C8)] ; zCModelPrototype * push ecx - mov edx, [esp+stackoffset+g1g2(-0xF44,0,0,-0x12FC)] - add edx, 0x24 + mov edx, [esp+stackoffset+g1g2(-0xF44,-0xF48,-0x12FC,-0x12FC)] + add edx, 0x24 ; New zCModelAni->name call zCModelPrototype__SearchAniIndex ; __fastcall pop ecx mov ecx, [ecx+0x48] - mov edx, [esp+stackoffset+g1g2(-0xF44,0,0,-0x12FC)] + mov edx, [esp+stackoffset+g1g2(-0xF44,-0xF48,-0x12FC,-0x12FC)] ; New zCModelAni * mov [ecx+eax*0x4], edx ; New ani pop ecx ; Old ani mov eax, [ecx+0x4] dec eax ; Decrease refCtr mov [ecx+0x4], eax cmp eax, 0 - verifyStackoffset g1g2(0xF54,0,0,0x1310) - jg g1g2(0x57D8F8,0,0,0x59C6C3) ; Continue + verifyStackoffset g1g2(0xF54,0xF58,0x1310,0x1310) + jg g1g2(0x57D8F8,0x5980B5,0x597163,0x59C6C3) ; Continue push 0x1 ; If refCtr <= 0 then call zCModelAni__deleting_destructor addStack 4 - verifyStackoffset g1g2(0xF54,0,0,0x1310) - jmp g1g2(0x57D8F8,0,0,0x59C6C3) + verifyStackoffset g1g2(0xF54,0xF58,0x1310,0x1310) + jmp g1g2(0x57D8F8,0x5980B5,0x597163,0x59C6C3) ; Room to 0x57D69A (g1), 0x59C459 (g2) diff --git a/src/ow_aniAlias.asm b/src/ow_aniAlias.asm index afdffd7..de2c216 100644 --- a/src/ow_aniAlias.asm +++ b/src/ow_aniAlias.asm @@ -5,7 +5,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x579D54,0,0,0x597AA7) + org g1g2(0x579D54,0x593F2D,0x592547,0x597AA7) %endif bits 32 @@ -13,28 +13,33 @@ bits 32 section .text align=1 ; Prevent auto-alignment - resetStackoffset g1g2(0xF54,0,0,0x12E8) + resetStackoffset g1g2(0xF54,0xF58,0x12E8,0x12E8) push eax ; Existing zCModelAni * - mov ecx, [esp+stackoffset+g1g2(-0xF24,0,0,-0x12A0)] ; zCModelPrototype * + mov ecx, [esp+stackoffset+g1g2(-0xF24,-0xF28,-0x12A0,-0x12A0)] ; zCModelPrototype * push ecx - mov edx, g1g2(edi,0,0,ebp) ; New zCModelAni->name + %if GOTHIC_BASE_VERSION == 112 + mov edx, [esp+stackoffset-0xF48] + add edx, 0x24 ; New zCModelAni->name + %elif GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 + mov edx, g1g2(edi,,ebp,ebp) ; New zCModelAni->name + %endif call zCModelPrototype__SearchAniIndex ; __fastcall pop ecx mov ecx, [ecx+0x48] - %if GOTHIC_BASE_VERSION == 1 - mov edx, [esp+stackoffset-0xF38] ; New zCModelAni * + %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 + mov edx, [esp+stackoffset+g1g2(-0xF38,-0xF48,,)] ; New zCModelAni * %endif - mov [ecx+eax*0x4], g1g2(edx,0,0,edi) ; New ani + mov [ecx+eax*0x4], g1g2(edx,edx,edi,edi) ; New ani pop ecx ; Old ani mov eax, [ecx+0x4] dec eax ; Decrease refCtr mov [ecx+0x4], eax cmp eax, 0 - verifyStackoffset g1g2(0xF54,0,0,0x12E8) - jg g1g2(0x579DC2,0,0,0x597B10) ; Continue + verifyStackoffset g1g2(0xF54,0xF58,0x12E8,0x12E8) + jg g1g2(0x579DC2,0x593FA8,0x5925B0,0x597B10) ; Continue push 0x1 ; If refCtr <= 0 then call zCModelAni__deleting_destructor addStack 4 - verifyStackoffset g1g2(0xF54,0,0,0x12E8) - jmp g1g2(0x579DC2,0,0,0x597B10) ; Continue + verifyStackoffset g1g2(0xF54,0xF58,0x12E8,0x12E8) + jmp g1g2(0x579DC2,0x593FA8,0x5925B0,0x597B10) ; Continue ; Room to 0x579DB5 (g1), 0x597AFA (g2) diff --git a/src/ow_aniBatch.asm b/src/ow_aniBatch.asm index 0aae0c1..ec80797 100644 --- a/src/ow_aniBatch.asm +++ b/src/ow_aniBatch.asm @@ -5,7 +5,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x57A72A,0,0,0x59875B) + org g1g2(0x57A72A,0x594A4A,0x5931FB,0x59875B) %endif bits 32 @@ -13,33 +13,33 @@ bits 32 section .text align=1 ; Prevent auto-alignment - resetStackoffset g1g2(0xF54,0,0,0x128C) + resetStackoffset g1g2(0xF54,0xF58,0x128C,0x128C) push eax ; Existing zCModelAni * - mov ecx, [esp+stackoffset+g1g2(-0xF24,0,0,-0x1244)] ; zCModelPrototype * + mov ecx, [esp+stackoffset+g1g2(-0xF24,-0xF28,-0x1244,-0x1244)] ; zCModelPrototype * push ecx - %if GOTHIC_BASE_VERSION == 1 - mov edx, [esp+stackoffset-0xF38] ; New zCModelAni * - add edx, 0x24 - %elif GOTHIC_BASE_VERSION == 2 - mov edx, edi ; New zCModelAni * + %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 + mov edx, [esp+stackoffset+g1g2(-0xF38,-0xF48,,)] + add edx, 0x24 ; New zCModelAni->name + %elif GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 + mov edx, edi ; New zCModelAni->name %endif call zCModelPrototype__SearchAniIndex ; __fastcall pop ecx mov ecx, [ecx+0x48] - %if GOTHIC_BASE_VERSION == 1 - mov edx, [esp+stackoffset-0xF38] + %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 + mov edx, [esp+stackoffset+g1g2(-0xF38,-0xF48,,)] ; New zCModelAni * %endif - mov [ecx+eax*0x4], g1g2(edx,0,0,ebp) ; New ani + mov [ecx+eax*0x4], g1g2(edx,edx,ebp,ebp) ; New ani pop ecx ; Old ani mov eax, [ecx+0x4] dec eax ; Decrease refCtr mov [ecx+0x4], eax cmp eax, 0 - verifyStackoffset g1g2(0xF54,0,0,0x128C) - jg g1g2(0x57A795,0,0,0x5987C4) ; Continue + verifyStackoffset g1g2(0xF54,0xF58,0x128C,0x128C) + jg g1g2(0x57A795,0x594AC2,0,0x5987C4) ; Continue push 0x1 ; If refCtr <= 0 then call zCModelAni__deleting_destructor addStack 4 - verifyStackoffset g1g2(0xF54,0,0,0x128C) - jmp g1g2(0x57A795,0,0,0x5987C4) ; Continue + verifyStackoffset g1g2(0xF54,0xF58,0x128C,0x128C) + jmp g1g2(0x57A795,0x594AC2,0x593264,0x5987C4) ; Continue ; Room to 0x57A783 (g1), 0x5987AE (g2) diff --git a/src/ow_aniBlend.asm b/src/ow_aniBlend.asm index 7c6aefb..ca26c73 100644 --- a/src/ow_aniBlend.asm +++ b/src/ow_aniBlend.asm @@ -5,7 +5,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x57A17C,0,0,0x598065) + org g1g2(0x57A17C,0x5943EC,0x592B05,0x598065) %endif bits 32 @@ -13,28 +13,33 @@ bits 32 section .text align=1 ; Prevent auto-alignment - resetStackoffset g1g2(0xF54,0,0,0x12D4) + resetStackoffset g1g2(0xF54,0xF58,0x12D4,0x12D4) push eax ; Existing zCModelAni * - mov ecx, [esp+stackoffset+g1g2(-0xF24,0,0,(-0x129C+0x10))] ; zCModelPrototype * + mov ecx, [esp+stackoffset+g1g2(-0xF24,-0xF28,-0x128C,-0x128C)] ; zCModelPrototype * push ecx - mov edx, g1g2(edi,0,0,ebp) ; New zCModelAni->name + %if GOTHIC_BASE_VERSION == 112 + mov edx, [esp+stackoffset-0xF48] + add edx, 0x24 ; New zCModelAni->name + %elif GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 + mov edx, g1g2(edi,,ebp,ebp) ; New zCModelAni->name + %endif call zCModelPrototype__SearchAniIndex ; __fastcall pop ecx mov ecx, [ecx+0x48] - %if GOTHIC_BASE_VERSION == 1 - mov edx, [esp+stackoffset-0xF38] ; New zCModelAni * + %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 + mov edx, [esp+stackoffset+g1g2(-0xF38,-0xF48,,)] ; New zCModelAni * %endif - mov [ecx+eax*0x4], g1g2(edx,0,0,edi) ; New ani + mov [ecx+eax*0x4], g1g2(edx,edx,edi,edi) ; New ani pop ecx ; Old ani mov eax, [ecx+0x4] dec eax ; Decrease refCtr mov [ecx+0x4], eax cmp eax, 0 - verifyStackoffset g1g2(0xF54,0,0,0x12D4) - jg g1g2(0x57A1EA,0,0,0x5980CE) ; Continue + verifyStackoffset g1g2(0xF54,0xF58,0x12D4,0x12D4) + jg g1g2(0x57A1EA,0x594467,0x592B6E,0x5980CE) ; Continue push 0x1 ; If refCtr <= 0 then call zCModelAni__deleting_destructor addStack 4 - verifyStackoffset g1g2(0xF54,0,0,0x12D4) - jmp g1g2(0x57A1EA,0,0,0x5980CE) ; Continue + verifyStackoffset g1g2(0xF54,0xF58,0x12D4,0x12D4) + jmp g1g2(0x57A1EA,0x594467,0x592B6E,0x5980CE) ; Continue ; Room to 0x57A1C7 (g1), 0x5980A9 (g2) diff --git a/src/ow_aniComb.asm b/src/ow_aniComb.asm index b9cf5fc..d101346 100644 --- a/src/ow_aniComb.asm +++ b/src/ow_aniComb.asm @@ -5,7 +5,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x57B169,0,0,0x599456) + org g1g2(0x57B169,0x5955E3,0x593EF6,0x599456) %endif bits 32 @@ -13,32 +13,33 @@ bits 32 section .text align=1 ; Prevent auto-alignment - resetStackoffset g1g2(0xF54,0,0,0x12EC) + resetStackoffset g1g2(0xF54,0xF58,0x12EC,0x12EC) push eax ; Existing zCModelAni * - %if GOTHIC_BASE_VERSION == 1 - mov ecx, [esp+stackoffset-0xF24] ; zCModelPrototype * - %elif GOTHIC_BASE_VERSION == 2 - mov ecx, edi - %endif + mov ecx, [esp+stackoffset+g1g2(-0xF24,-0xF28,-0x12A4,-0x12A4)] ; zCModelPrototype * push ecx - mov edx, g1g2(edi,0,0,ebx) ; New zCModelAni->name + %if GOTHIC_BASE_VERSION == 112 + mov edx, [esp+stackoffset-0xF48] + add edx, 0x24 ; New zCModelAni->name + %elif GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 + mov edx, g1g2(edi,,ebx,ebx) ; New zCModelAni->name + %endif call zCModelPrototype__SearchAniIndex ; __fastcall pop ecx mov ecx, [ecx+0x48] - %if GOTHIC_BASE_VERSION == 1 - mov edx, [esp+stackoffset-0xF38] ; New zCModelAni * + %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 + mov edx, [esp+stackoffset+g1g2(-0xF38,-0xF48,,)] ; New zCModelAni * %endif - mov [ecx+eax*0x4], g1g2(edx,0,0,ebp) ; New ani + mov [ecx+eax*0x4], g1g2(edx,edx,ebp,ebp) ; New ani pop ecx ; Old ani mov eax, [ecx+0x4] dec eax ; Decrease refCtr mov [ecx+0x4], eax cmp eax, 0 - verifyStackoffset g1g2(0xF54,0,0,0x12EC) - jg g1g2(0x57A1EA,0,0,0x5994BB) ; Continue + verifyStackoffset g1g2(0xF54,0xF58,0x12EC,0x12EC) + jg g1g2(0x57A1EA,0x594467,0x593F5B,0x5994BB) ; Continue push 0x1 ; If refCtr <= 0 then call zCModelAni__deleting_destructor addStack 4 - verifyStackoffset g1g2(0xF54,0,0,0x12EC) - jmp g1g2(0x57A1EA,0,0,0x5994BB) ; Continue + verifyStackoffset g1g2(0xF54,0xF58,0x12EC,0x12EC) + jmp g1g2(0x57A1EA,0x594467,0x593F5B,0x5994BB) ; Continue ; Room to 0x57B1CA (g1), 0x5994A9 (g2) diff --git a/src/ow_aniDisable.asm b/src/ow_aniDisable.asm index 4e0fc18..ceadb5f 100644 --- a/src/ow_aniDisable.asm +++ b/src/ow_aniDisable.asm @@ -5,7 +5,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x57B372,0,0,0x599783) + org g1g2(0x57B372,0x595824,0x594223,0x599783) %endif bits 32 @@ -13,28 +13,33 @@ bits 32 section .text align=1 ; Prevent auto-alignment - resetStackoffset g1g2(0xF54,0,0,0x12C0) + resetStackoffset g1g2(0xF54,0xF58,0x12C0,0x12C0) push eax ; Existing zCModelAni * - mov ecx, [esp+stackoffset+g1g2(-0xF24,0,0,(-0x1284+0xC))] ; zCModelPrototype * + mov ecx, [esp+stackoffset+g1g2(-0xF24,-0xF28,-0x1278,-0x1278)] ; zCModelPrototype * push ecx - mov edx, g1g2(edi,0,0,ebp) ; New zCModelAni->name + %if GOTHIC_BASE_VERSION == 112 + mov edx, [esp+stackoffset-0xF48] + add edx, 0x24 ; New zCModelAni->name + %elif GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 + mov edx, g1g2(edi,,ebp,ebp) ; New zCModelAni->name + %endif call zCModelPrototype__SearchAniIndex ; __fastcall pop ecx mov ecx, [ecx+0x48] - %if GOTHIC_BASE_VERSION == 1 - mov edx, [esp+stackoffset-0xF38] ; New zCModelAni * + %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 + mov edx, [esp+stackoffset+g1g2(-0xF38,-0xF48,,)] ; New zCModelAni * %endif - mov [ecx+eax*0x4], g1g2(edx,0,0,edi) ; New ani + mov [ecx+eax*0x4], g1g2(edx,edx,edi,edi) ; New ani pop ecx ; Old ani mov eax, [ecx+0x4] dec eax ; Decrease refCtr mov [ecx+0x4], eax cmp eax, 0 - verifyStackoffset g1g2(0xF54,0,0,0x12C0) - jg g1g2(0x57B3DD,0,0,0x5980CE) ; Continue + verifyStackoffset g1g2(0xF54,0xF58,0x12C0,0x12C0) + jg g1g2(0x57B3DD,0x59589C,0x592B6E,0x5980CE) ; Continue push 0x1 ; If refCtr <= 0 then call zCModelAni__deleting_destructor addStack 4 - verifyStackoffset g1g2(0xF54,0,0,0x12C0) - jmp g1g2(0x57B3DD,0,0,0x5980CE) ; Continue + verifyStackoffset g1g2(0xF54,0xF58,0x12C0,0x12C0) + jmp g1g2(0x57B3DD,0x59589C,0x592B6E,0x5980CE) ; Continue ; Room to 0x57B3CB (g1), 0x5997CE (g2) diff --git a/src/ow_aniSync.asm b/src/ow_aniSync.asm index 984342c..d72e54e 100644 --- a/src/ow_aniSync.asm +++ b/src/ow_aniSync.asm @@ -5,7 +5,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x57A4A5,0,0,0x5984E1) + org g1g2(0x57A4AB,0x594784,0x592F81,0x5984E1) %endif bits 32 @@ -13,28 +13,33 @@ bits 32 section .text align=1 ; Prevent auto-alignment - resetStackoffset g1g2(0xF54,0,0,0x12C4) + resetStackoffset g1g2(0xF54,0xF58,0x12C4,0x12C4) push eax ; Existing zCModelAni * - mov ecx, [esp+stackoffset+g1g2(-0xF24,0,0,(-0x1284+0x8))] ; zCModelPrototype * + mov ecx, [esp+stackoffset+g1g2(-0xF24,-0xF28,-0x127C,-0x127C)] ; zCModelPrototype * push ecx - mov edx, g1g2(edi,0,0,ebp) ; New zCModelAni->name + %if GOTHIC_BASE_VERSION == 112 + mov edx, [esp+stackoffset-0xF48] + add edx, 0x24 ; New zCModelAni->name + %elif GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 + mov edx, g1g2(edi,,ebp,ebp) ; New zCModelAni->name + %endif call zCModelPrototype__SearchAniIndex ; __fastcall pop ecx mov ecx, [ecx+0x48] - %if GOTHIC_BASE_VERSION == 1 - mov edx, [esp+stackoffset-0xF38] ; New zCModelAni * + %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 + mov edx, [esp+stackoffset+g1g2(-0xF38,-0xF48,,)] ; New zCModelAni * %endif - mov [ecx+eax*0x4], g1g2(edx,0,0,edi) ; New ani + mov [ecx+eax*0x4], g1g2(edx,edx,edi,edi) ; New ani pop ecx ; Old ani mov eax, [ecx+0x4] dec eax ; Decrease refCtr mov [ecx+0x4], eax cmp eax, 0 - verifyStackoffset g1g2(0xF54,0,0,0x12C4) - jg g1g2(0x57A1EA,0,0,0x59854A) ; Continue + verifyStackoffset g1g2(0xF54,0xF58,0x12C4,0x12C4) + jg g1g2(0x57A1EA,0x594467,0x592FEA,0x59854A) ; Continue push 0x1 ; If refCtr <= 0 then call zCModelAni__deleting_destructor addStack 4 - verifyStackoffset g1g2(0xF54,0,0,0x12C4) - jmp g1g2(0x57A1EA,0,0,0x59854A) ; Continue + verifyStackoffset g1g2(0xF54,0xF58,0x12C4,0x12C4) + jmp g1g2(0x57A1EA,0x594467,0x592FEA,0x59854A) ; Continue ; Room to 0x57A4FD (g1), 0x598534 (g2) diff --git a/src/ow_playerInfoName1.asm b/src/ow_playerInfoName1.asm index 32d6ff6..2c31568 100644 --- a/src/ow_playerInfoName1.asm +++ b/src/ow_playerInfoName1.asm @@ -5,7 +5,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x4618DB,0,0,0x466FCE) + org g1g2(0x4618DB,0x4692B2,0x46639E,0x466FCE) %endif bits 32 diff --git a/src/ow_playerInfoName2.asm b/src/ow_playerInfoName2.asm index cf8040d..f588eac 100644 --- a/src/ow_playerInfoName2.asm +++ b/src/ow_playerInfoName2.asm @@ -5,7 +5,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x462475,0,0,0x467B15) + org g1g2(0x462475,0x469E72,0x466EE5,0x467B15) %endif bits 32 diff --git a/src/ow_playerInfoName3.asm b/src/ow_playerInfoName3.asm index 168b3ac..1a3b544 100644 --- a/src/ow_playerInfoName3.asm +++ b/src/ow_playerInfoName3.asm @@ -5,7 +5,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x4626FA,0,0,0x467DC2) + org g1g2(0x4626FA,0x46A139,0x467192,0x467DC2) %endif bits 32 diff --git a/src/ow_playerInfoName4.asm b/src/ow_playerInfoName4.asm index 2e4e958..26665a8 100644 --- a/src/ow_playerInfoName4.asm +++ b/src/ow_playerInfoName4.asm @@ -5,7 +5,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x462F13,0,0,0x46860A) + org g1g2(0x462F13,0x46A9CD,0x4679DA,0x46860A) %endif bits 32 diff --git a/src/ow_playerInfoName5.asm b/src/ow_playerInfoName5.asm index 6b94777..7d0264d 100644 --- a/src/ow_playerInfoName5.asm +++ b/src/ow_playerInfoName5.asm @@ -5,7 +5,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x46AAD7,0,0,0x46FF1B) + org g1g2(0x46AAD7,0x472CF6,0x46F2EB,0x46FF1B) %endif bits 32 diff --git a/src/ow_reopenFileWarning.asm b/src/ow_reopenFileWarning.asm index d086d2d..a15bc3d 100644 --- a/src/ow_reopenFileWarning.asm +++ b/src/ow_reopenFileWarning.asm @@ -4,7 +4,7 @@ %include "inc/symbols.inc" %ifidn __OUTPUT_FORMAT__, bin - org g1g2(0x5CE925,0,0,0x5F9C15) + org g1g2(0x5CE925,0x5ED6C5,0x5F2E25,0x5F9C15) %endif bits 32 diff --git a/src/ow_zCParser__LoadGlobalVars.asm b/src/ow_zCParser__LoadGlobalVars.asm index 6f45006..1b58ec4 100644 --- a/src/ow_zCParser__LoadGlobalVars.asm +++ b/src/ow_zCParser__LoadGlobalVars.asm @@ -2,12 +2,12 @@ %include "inc/macros.inc" -%if GOTHIC_BASE_VERSION == 1 - %fatal This file is for Gothic 2 only +%if GOTHIC_BASE_VERSION != 130 && GOTHIC_BASE_VERSION != 2 + %fatal This file is for Gothic 130 / 2 only %endif %ifidn __OUTPUT_FORMAT__, bin - org 0x797345 + org g1g2(0x000000,0x000000,0x737905,0x797345) %endif bits 32 @@ -15,4 +15,4 @@ bits 32 section .text align=1 ; Prevent auto-alignment - jz 0x797377 + jz g1g2(,,0x737937,0x797377) From 6122ac8a982674d2cc488c5b00e5bc54ff38abe2 Mon Sep 17 00:00:00 2001 From: szapp Date: Mon, 31 Jul 2023 10:14:07 +0200 Subject: [PATCH 8/9] Finish port for 1.12f and 1.30 fix --- Makefile | 3 +-- src/ow_zCParser__LoadGlobalVars.asm | 2 +- src/skip_writeAniBinFile_ModelTag.asm | 8 ++++---- src/skip_writeAniBinFile_ReadMeshAndTree.asm | 8 ++++---- src/skip_writeAniBinFile_RegisterMesh.asm | 8 ++++---- src/skip_writeAniBinFile_ani.asm | 8 ++++---- src/skip_writeAniBinFile_aniAlias.asm | 8 ++++---- src/skip_writeAniBinFile_aniBlend.asm | 8 ++++---- src/skip_writeAniBinFile_aniComb.asm | 8 ++++---- src/skip_writeAniBinFile_aniDisable.asm | 8 ++++---- src/skip_writeAniBinFile_aniSync.asm | 8 ++++---- src/skip_writeAniBinFile_other.asm | 8 ++++---- src/skip_zCFileBIN__BinWriteFloat.asm | 6 +++--- src/skip_zCFileBIN__BinWriteInt.asm | 6 +++--- src/skip_zCFileBIN__BinWriteString.asm | 6 +++--- 15 files changed, 51 insertions(+), 52 deletions(-) diff --git a/Makefile b/Makefile index 005c14d..3043fb8 100644 --- a/Makefile +++ b/Makefile @@ -141,7 +141,6 @@ BIN_BASE := core \ ow_playerInfoName3 \ ow_playerInfoName4 \ ow_playerInfoName5 -BIN_BASE_G130 := ow_zCParser__LoadGlobalVars BIN_BASE_G2 := ow_zCParser__LoadGlobalVars \ skip_writeAniBinFile_ModelTag \ skip_writeAniBinFile_ReadMeshAndTree \ @@ -183,7 +182,7 @@ DATA_BASE := symbols \ BINARIES_G1 := $(BIN_BASE:%=$(BINDIR)%_g1) BINARIES_G112 := $(BIN_BASE:%=$(BINDIR)%_g112) -BINARIES_G130 := $(BIN_BASE:%=$(BINDIR)%_g130) $(BIN_BASE_G130:%=$(BINDIR)%_g130) # $(BIN_BASE_G2:%=$(BINDIR)%_g130) +BINARIES_G130 := $(BIN_BASE:%=$(BINDIR)%_g130) $(BIN_BASE_G2:%=$(BINDIR)%_g130) BINARIES_G2 := $(BIN_BASE:%=$(BINDIR)%_g2) $(BIN_BASE_G2:%=$(BINDIR)%_g2) FUNC := $(FUNC_BASE:%=$(FUNCDIR)%$(ASMEXT)) EXEC := $(EXEC_BASE:%=$(EXECDIR)%$(ASMEXT)) diff --git a/src/ow_zCParser__LoadGlobalVars.asm b/src/ow_zCParser__LoadGlobalVars.asm index 1b58ec4..731f27b 100644 --- a/src/ow_zCParser__LoadGlobalVars.asm +++ b/src/ow_zCParser__LoadGlobalVars.asm @@ -3,7 +3,7 @@ %include "inc/macros.inc" %if GOTHIC_BASE_VERSION != 130 && GOTHIC_BASE_VERSION != 2 - %fatal This file is for Gothic 130 / 2 only + %fatal This file is for Gothic 1.30 and Gothic 2 only %endif %ifidn __OUTPUT_FORMAT__, bin diff --git a/src/skip_writeAniBinFile_ModelTag.asm b/src/skip_writeAniBinFile_ModelTag.asm index 7b1873f..30ae3fc 100644 --- a/src/skip_writeAniBinFile_ModelTag.asm +++ b/src/skip_writeAniBinFile_ModelTag.asm @@ -2,12 +2,12 @@ %include "inc/macros.inc" -%if GOTHIC_BASE_VERSION == 1 - %fatal This file is for Gothic 2 only +%if GOTHIC_BASE_VERSION != 130 && GOTHIC_BASE_VERSION != 2 + %fatal This file is for Gothic 1.30 and Gothic 2 only %endif %ifidn __OUTPUT_FORMAT__, bin - org 0x5999AE + org g1g2(0x000000,0x000000,0x59444E,0x5999AE) %endif bits 32 @@ -15,4 +15,4 @@ bits 32 section .text align=1 ; Prevent auto-alignment - jmp 0x599C65 + jmp g1g2(,,0x594705,0x599C65) diff --git a/src/skip_writeAniBinFile_ReadMeshAndTree.asm b/src/skip_writeAniBinFile_ReadMeshAndTree.asm index 11358c7..483d91b 100644 --- a/src/skip_writeAniBinFile_ReadMeshAndTree.asm +++ b/src/skip_writeAniBinFile_ReadMeshAndTree.asm @@ -2,12 +2,12 @@ %include "inc/macros.inc" -%if GOTHIC_BASE_VERSION == 1 - %fatal This file is for Gothic 2 only +%if GOTHIC_BASE_VERSION != 130 && GOTHIC_BASE_VERSION != 2 + %fatal This file is for Gothic 1.30 and Gothic 2 only %endif %ifidn __OUTPUT_FORMAT__, bin - org 0x5937DE + org g1g2(0x000000,0x000000,0x58E27E,0x5937DE) %endif bits 32 @@ -15,4 +15,4 @@ bits 32 section .text align=1 ; Prevent auto-alignment - jmp 0x59388B + jmp g1g2(,,0x58E32B,0x59388B) diff --git a/src/skip_writeAniBinFile_RegisterMesh.asm b/src/skip_writeAniBinFile_RegisterMesh.asm index d9f3fd8..0138369 100644 --- a/src/skip_writeAniBinFile_RegisterMesh.asm +++ b/src/skip_writeAniBinFile_RegisterMesh.asm @@ -2,12 +2,12 @@ %include "inc/macros.inc" -%if GOTHIC_BASE_VERSION == 1 - %fatal This file is for Gothic 2 only +%if GOTHIC_BASE_VERSION != 130 && GOTHIC_BASE_VERSION != 2 + %fatal This file is for Gothic 1.30 and Gothic 2 only %endif %ifidn __OUTPUT_FORMAT__, bin - org 0x593D72 + org g1g2(0x000000,0x000000,0x58E812,0x593D72) %endif bits 32 @@ -15,4 +15,4 @@ bits 32 section .text align=1 ; Prevent auto-alignment - jmp 0x593E2B + jmp g1g2(,,0x58E8CB,0x593E2B) diff --git a/src/skip_writeAniBinFile_ani.asm b/src/skip_writeAniBinFile_ani.asm index f209fc9..ab51fce 100644 --- a/src/skip_writeAniBinFile_ani.asm +++ b/src/skip_writeAniBinFile_ani.asm @@ -2,12 +2,12 @@ %include "inc/macros.inc" -%if GOTHIC_BASE_VERSION == 1 - %fatal This file is for Gothic 2 only +%if GOTHIC_BASE_VERSION != 130 && GOTHIC_BASE_VERSION != 2 + %fatal This file is for Gothic 1.30 and Gothic 2 only %endif %ifidn __OUTPUT_FORMAT__, bin - org 0x59BFA9 + org g1g2(0x000000,0x000000,0x596A49,0x59BFA9) %endif bits 32 @@ -18,4 +18,4 @@ section .text align=1 ; Pre resetStackoffset 0x12AC mov eax, [esp+stackoffset-0x129C+0x10] mov [esp+stackoffset-0x12C8], eax - jmp 0x59C247 + jmp g1g2(,,0x596CE7,0x59C247) diff --git a/src/skip_writeAniBinFile_aniAlias.asm b/src/skip_writeAniBinFile_aniAlias.asm index c46ee6d..8fccbba 100644 --- a/src/skip_writeAniBinFile_aniAlias.asm +++ b/src/skip_writeAniBinFile_aniAlias.asm @@ -2,12 +2,12 @@ %include "inc/macros.inc" -%if GOTHIC_BASE_VERSION == 1 - %fatal This file is for Gothic 2 only +%if GOTHIC_BASE_VERSION != 130 && GOTHIC_BASE_VERSION != 2 + %fatal This file is for Gothic 1.30 and Gothic 2 only %endif %ifidn __OUTPUT_FORMAT__, bin - org 0x597755 + org g1g2(0x000000,0x000000,0x5921F5,0x597755) %endif bits 32 @@ -15,4 +15,4 @@ bits 32 section .text align=1 ; Prevent auto-alignment - jmp 0x597956 + jmp g1g2(,,0x5923F6,0x597956) diff --git a/src/skip_writeAniBinFile_aniBlend.asm b/src/skip_writeAniBinFile_aniBlend.asm index 848fed2..bd3942a 100644 --- a/src/skip_writeAniBinFile_aniBlend.asm +++ b/src/skip_writeAniBinFile_aniBlend.asm @@ -2,12 +2,12 @@ %include "inc/macros.inc" -%if GOTHIC_BASE_VERSION == 1 - %fatal This file is for Gothic 2 only +%if GOTHIC_BASE_VERSION != 130 && GOTHIC_BASE_VERSION != 2 + %fatal This file is for Gothic 1.30 and Gothic 2 only %endif %ifidn __OUTPUT_FORMAT__, bin - org 0x597DCF + org g1g2(0x000000,0x000000,0x59286F,0x597DCF) %endif bits 32 @@ -15,4 +15,4 @@ bits 32 section .text align=1 ; Prevent auto-alignment - jmp 0x597F7F + jmp g1g2(,,0x592A1F,0x597F7F) diff --git a/src/skip_writeAniBinFile_aniComb.asm b/src/skip_writeAniBinFile_aniComb.asm index 01da3e8..2359caf 100644 --- a/src/skip_writeAniBinFile_aniComb.asm +++ b/src/skip_writeAniBinFile_aniComb.asm @@ -2,12 +2,12 @@ %include "inc/macros.inc" -%if GOTHIC_BASE_VERSION == 1 - %fatal This file is for Gothic 2 only +%if GOTHIC_BASE_VERSION != 130 && GOTHIC_BASE_VERSION != 2 + %fatal This file is for Gothic 1.30 and Gothic 2 only %endif %ifidn __OUTPUT_FORMAT__, bin - org 0x599003 + org g1g2(0x000000,0x000000,0x593AA3,0x599003) %endif bits 32 @@ -15,4 +15,4 @@ bits 32 section .text align=1 ; Prevent auto-alignment - jmp 0x59926D + jmp g1g2(,,0x593D0D,0x59926D) diff --git a/src/skip_writeAniBinFile_aniDisable.asm b/src/skip_writeAniBinFile_aniDisable.asm index 62f1ff7..b47bbb8 100644 --- a/src/skip_writeAniBinFile_aniDisable.asm +++ b/src/skip_writeAniBinFile_aniDisable.asm @@ -2,12 +2,12 @@ %include "inc/macros.inc" -%if GOTHIC_BASE_VERSION == 1 - %fatal This file is for Gothic 2 only +%if GOTHIC_BASE_VERSION != 130 && GOTHIC_BASE_VERSION != 2 + %fatal This file is for Gothic 1.30 and Gothic 2 only %endif %ifidn __OUTPUT_FORMAT__, bin - org 0x59966A + org g1g2(0x000000,0x000000,0x59410A,0x59966A) %endif bits 32 @@ -15,4 +15,4 @@ bits 32 section .text align=1 ; Prevent auto-alignment - jmp 0x599701 + jmp g1g2(,,0x5941A1,0x599701) diff --git a/src/skip_writeAniBinFile_aniSync.asm b/src/skip_writeAniBinFile_aniSync.asm index 62e4f65..be2d8a7 100644 --- a/src/skip_writeAniBinFile_aniSync.asm +++ b/src/skip_writeAniBinFile_aniSync.asm @@ -2,12 +2,12 @@ %include "inc/macros.inc" -%if GOTHIC_BASE_VERSION == 1 - %fatal This file is for Gothic 2 only +%if GOTHIC_BASE_VERSION != 130 && GOTHIC_BASE_VERSION != 2 + %fatal This file is for Gothic 1.30 and Gothic 2 only %endif %ifidn __OUTPUT_FORMAT__, bin - org 0x5982DC + org g1g2(0x000000,0x000000,0x592D7C,0x5982DC) %endif bits 32 @@ -15,4 +15,4 @@ bits 32 section .text align=1 ; Prevent auto-alignment - jmp 0x59844C + jmp g1g2(,,0x5923F6,0x59844C) diff --git a/src/skip_writeAniBinFile_other.asm b/src/skip_writeAniBinFile_other.asm index a4d22c1..ba3b7a1 100644 --- a/src/skip_writeAniBinFile_other.asm +++ b/src/skip_writeAniBinFile_other.asm @@ -2,12 +2,12 @@ %include "inc/macros.inc" -%if GOTHIC_BASE_VERSION == 1 - %fatal This file is for Gothic 2 only +%if GOTHIC_BASE_VERSION != 130 && GOTHIC_BASE_VERSION != 2 + %fatal This file is for Gothic 1.30 and Gothic 2 only %endif %ifidn __OUTPUT_FORMAT__, bin - org 0x597E63 + org g1g2(0x000000,0x000000,0x592903,0x597E63) %endif bits 32 @@ -15,4 +15,4 @@ bits 32 section .text align=1 ; Prevent auto-alignment - jmp 0x597F7F + jmp g1g2(,,0x592A1F,0x597F7F) diff --git a/src/skip_zCFileBIN__BinWriteFloat.asm b/src/skip_zCFileBIN__BinWriteFloat.asm index c76949b..76a8272 100644 --- a/src/skip_zCFileBIN__BinWriteFloat.asm +++ b/src/skip_zCFileBIN__BinWriteFloat.asm @@ -2,12 +2,12 @@ %include "inc/macros.inc" -%if GOTHIC_BASE_VERSION == 1 - %fatal This file is for Gothic 2 only +%if GOTHIC_BASE_VERSION != 130 && GOTHIC_BASE_VERSION != 2 + %fatal This file is for Gothic 1.30 and Gothic 2 only %endif %ifidn __OUTPUT_FORMAT__, bin - org 0x59D180 + org g1g2(0x000000,0x000000,0x597C20,0x59D180) %endif bits 32 diff --git a/src/skip_zCFileBIN__BinWriteInt.asm b/src/skip_zCFileBIN__BinWriteInt.asm index dfd0d8b..897c193 100644 --- a/src/skip_zCFileBIN__BinWriteInt.asm +++ b/src/skip_zCFileBIN__BinWriteInt.asm @@ -2,12 +2,12 @@ %include "inc/macros.inc" -%if GOTHIC_BASE_VERSION == 1 - %fatal This file is for Gothic 2 only +%if GOTHIC_BASE_VERSION != 130 && GOTHIC_BASE_VERSION != 2 + %fatal This file is for Gothic 1.30 and Gothic 2 only %endif %ifidn __OUTPUT_FORMAT__, bin - org 0x59D1A0 + org g1g2(0x000000,0x000000,0x597C40,0x59D1A0) %endif bits 32 diff --git a/src/skip_zCFileBIN__BinWriteString.asm b/src/skip_zCFileBIN__BinWriteString.asm index d404e66..88f9b23 100644 --- a/src/skip_zCFileBIN__BinWriteString.asm +++ b/src/skip_zCFileBIN__BinWriteString.asm @@ -2,12 +2,12 @@ %include "inc/macros.inc" -%if GOTHIC_BASE_VERSION == 1 - %fatal This file is for Gothic 2 only +%if GOTHIC_BASE_VERSION != 130 && GOTHIC_BASE_VERSION != 2 + %fatal This file is for Gothic 1.30 and Gothic 2 only %endif %ifidn __OUTPUT_FORMAT__, bin - org 0x5884C0 + org g1g2(0x000000,0x000000,0x582F60,0x5884C0) %endif bits 32 From 269f60f0f3ec44bae8a2ccce27e36d973a4717f9 Mon Sep 17 00:00:00 2001 From: szapp Date: Tue, 8 Aug 2023 16:31:15 +0200 Subject: [PATCH 9/9] Fix remaining issues on port --- src/exec/init.asm | 3 +++ src/func/dispatch.asm | 2 +- src/func/injectMds.asm | 8 ++++---- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/exec/init.asm b/src/exec/init.asm index deaed9f..080382a 100644 --- a/src/exec/init.asm +++ b/src/exec/init.asm @@ -5,6 +5,9 @@ init_menu: resetStackoffset g1g2(0x34,0x3C,0x34,0x34) call zCArraySort_zCMenu___InsertSort ; Overwritten pusha +%if GOTHIC_BASE_VERSION == 112 + mov ebp, ebx +%endif push ninja_initMenu push char_src push NINJA_PATH_CONTENT diff --git a/src/func/dispatch.asm b/src/func/dispatch.asm index 128f91c..8e376ba 100644 --- a/src/func/dispatch.asm +++ b/src/func/dispatch.asm @@ -120,7 +120,7 @@ ninja_dispatch: push esi call DWORD [ds_lstrlenA] addStack 4 - sub eax, 0x7 ; Cut off '_G*.EXT' + sub eax, g1g2(0x7,0x9,0x9,0x7) ; Cut off '_G*.EXT' mov BYTE [esi+eax], 0x0 push DWORD [esp+stackoffset+arg_2] push esi diff --git a/src/func/injectMds.asm b/src/func/injectMds.asm index 2413f16..156ba25 100644 --- a/src/func/injectMds.asm +++ b/src/func/injectMds.asm @@ -55,7 +55,7 @@ ninja_injectMds: push DWORD [zFILE_cur_mds_file] mov DWORD [zFILE_cur_mds_file], esi -%if GOTHIC_BASE_VERSION == 2 +%if GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 sub esp, 0xC ; Create fake zCFileBIN mov DWORD [esp], 0xFFFFFFFF ; -1 %endif @@ -90,19 +90,19 @@ ninja_injectMds: addStack 3*4 cmp eax, 0xFFFFFFFF jz .mds_loop_start -%if GOTHIC_BASE_VERSION == 2 +%if GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 mov ecx, esp ; zCFileBIN * (ignored in Gothic 1) push ecx %endif mov ecx, ebp call zCModelPrototype__ReadModel -%if GOTHIC_BASE_VERSION == 2 +%if GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 addStack 4 %endif jnz .mds_loop_start .eof: -%if GOTHIC_BASE_VERSION == 2 +%if GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 add esp, 0xC %endif