diff --git a/Makefile b/Makefile index e22eef7..3043fb8 100644 --- a/Makefile +++ b/Makefile @@ -81,6 +81,8 @@ 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_G130 := $(INC) $(INCDIR)engine_g130$(INCEXT) INC_G2 := $(INC) $(INCDIR)engine_g2$(INCEXT) # Intermediate files @@ -179,6 +181,8 @@ DATA_BASE := symbols \ messages BINARIES_G1 := $(BIN_BASE:%=$(BINDIR)%_g1) +BINARIES_G112 := $(BIN_BASE:%=$(BINDIR)%_g112) +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)) @@ -231,7 +235,7 @@ $(OBJ) : $(SRCDLL) $(CONTENT) $(IKLG) $(RSC) : $(RC) gorc $(FLAGS_RC) /fo $@ /r $^ -$(CONTENT) : $(BINARIES_G1) $(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) @@ -246,6 +250,14 @@ $(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)%_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 85f2142..8be1190 100644 --- a/README.md +++ b/README.md @@ -7,13 +7,15 @@ [![Steam Gothic 1](https://img.shields.io/badge/steam-Gothic%201-2a3f5a?logo=steam&labelColor=1b2838)](https://steamcommunity.com/sharedfiles/filedetails/?id=2786936496) [![Steam Gothic 2](https://img.shields.io/badge/steam-Gothic%202-2a3f5a?logo=steam&labelColor=1b2838)](https://steamcommunity.com/sharedfiles/filedetails/?id=2786910489) -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 the Gothic game series. 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). +[documentation](https://github.com/szapp/Ninja/wiki) and get started with the official [patch template](https://github.com/szapp/patch-template). # About +Ninja is supported by the games Gothic (1.08k_mod), Gothic Sequel (1.12f), Gothic 2 (1.30 fix report version), and Gothic 2 NotR (2.6 fix report version). + For information on Ninja, please visit the [documentation](https://github.com/szapp/Ninja/wiki). # Usage diff --git a/extractSymbols.bat b/extractSymbols.bat index 831ca4d..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 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 @@ -13,8 +13,12 @@ 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 EQU 130 GOTO start +IF %2 NEQ 2 GOTO usage + +:start SET gothic=%2 :: Write file header @@ -65,4 +69,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, 130, or 2) SOURCE.ASM [SOURCE.ASM ...] diff --git a/getAddress.bat b/getAddress.bat index 93898ca..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 or 2) +:: Arguments: SOURCE.ASM GOTHIC-BASE-VERSION(1, 112, 130, or 2) :: @ECHO OFF SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION @@ -9,8 +9,13 @@ 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 130 SET gId=3&& GOTO start +IF %2 EQU 2 SET gId=4&& GOTO start +GOTO usage + +:start :: Parse file name SET filefull=%~f1 @@ -32,10 +37,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 +52,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, 130, or 2) diff --git a/getBinList.bat b/getBinList.bat index 315a3db..41bbcd5 100644 --- a/getBinList.bat +++ b/getBinList.bat @@ -34,6 +34,12 @@ 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=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 89cfb3b..80c279e 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,0x456D20,0x457470) %endif bits 32 diff --git a/src/data/io.asm b/src/data/io.asm index 35ed931..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','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','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','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 06c340c..830d97b 100644 --- a/src/dll/Ninja.asm +++ b/src/dll/Ninja.asm @@ -10,6 +10,22 @@ %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_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 @@ -61,9 +77,13 @@ 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_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" @@ -167,6 +187,10 @@ inject: injectAll: cmp DWORD [verify_addr_g2], 'Goth' 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 @@ -188,7 +212,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 +229,50 @@ 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 + +.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 @@ -212,6 +280,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 +336,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..4dd4dfb 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,,,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(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 25848df..05fe67e 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,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,0xC8) + verifyStackoffset g1g2(0xD8,0xB0,0xB0,0xC8) ; Jump back - lea edx, [esp+stackoffset+g1g2(-0xC5,-0xB5)] - push edx - jmp g1g2(0x4DA44D,0x4E7661) + 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,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,0x308) + verifyStackoffset g1g2(0x304,0x2F8,0x2F4,0x308) ; Jump back - lea g1g2(ecx,eax), [esp+stackoffset+g1g2(-0x2F2,-0x2F6)] - push g1g2(ecx,eax) - jmp g1g2(0x4DD891,0x4EAE90) + 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,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,0xC8) + verifyStackoffset g1g2(0x8C,0x7C,0xB0,0xC8) ; Jump back - lea eax, [esp+stackoffset+g1g2(-0x79,-0xB5)] - push eax - jmp g1g2(0x58CA27,0x5AC7C1) + 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,0x250) + resetStackoffset g1g2(0x248,0x234,0x238,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,0x250) + verifyStackoffset g1g2(0x248,0x234,0x238,0x250) ; Jump back - lea g1g2(edx,eax), [esp+stackoffset+g1g2(-0x239,-0x235)] - push g1g2(edx,eax) - jmp g1g2(0x483A41,0x48B6F4) +%if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 + 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,0x0,eax,eax) + jmp g1g2(0x483A3C,0x48EB1F,0x489D76,0x48B6EF)+5 global deploy_ou_ninja @@ -92,7 +96,8 @@ deploy_ou_ninja: global deploy_content_ninja deploy_content_ninja: - resetStackoffset g1g2(0x90,0x80) + resetStackoffset g1g2(0x90,0x7C,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,0x80) + verifyStackoffset g1g2(0x90,0x7C,0x7C,0x80) ; Jump back - push 0x1 - lea ecx, [esp+stackoffset+g1g2(-0x44,-0x1C)] - jmp g1g2(0x6371F7,0x6C12A6) + jmp g1g2(0x637208,0x65D5A1,0x6647F2,0x6C12B7)+5 global deploy_fightai_ninja deploy_fightai_ninja: - resetStackoffset g1g2(0x7C,0x64) + resetStackoffset g1g2(0x7C,0x50,0x50,0x64) pusha push ninja_injectSrc push NINJA_PATH_FIGHT - push ebx + push g1g2(ebx,ebp,ebx,ebx) call ninja_armParser addStack 3*4 popa - verifyStackoffset g1g2(0x7C,0x64) + verifyStackoffset g1g2(0x7C,0x50,0x50,0x64) ; Jump back - lea g1g2(edx,eax), [esp+stackoffset+g1g2(-0x69,-0x51)] - push g1g2(edx,eax) - jmp g1g2(0x747EBF,0x67C62B) + 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 @@ -141,12 +144,12 @@ deploy_menu_ninja: ; Jump back mov eax, DWORD [zCSoundSystem_zsound] - jmp g1g2(0x4CD57F,0x4DA19B) + jmp g1g2(0x4CD57A,0x4DDC34,0x4D7ADA,0x4DA196)+5 global deploy_camera_ninja deploy_camera_ninja: - resetStackoffset g1g2(0xB4,0xB8) + resetStackoffset g1g2(0xB4,0x9C,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,0xB8) + verifyStackoffset g1g2(0xB4,0x9C,0x9C,0xB8) ; Jump back - lea g1g2(eax,edx), [esp+stackoffset+g1g2(-0xA1,-0xA5)] - push g1g2(eax,edx) - jmp g1g2(0x4990A3,0x4A0559) + 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 deploy_ani_ninja: -%if GOTHIC_BASE_VERSION == 1 +%if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 - resetStackoffset 0xF54 + resetStackoffset g1g2(0xF54,0xFD8,,) pusha - mov ebp, [esp+stackoffset-0xF24] ; zCModelPrototype * + mov ebp, [esp+stackoffset-g1g2(0xF24,0xFA8,,)] ; 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,,)+32 ; Base + pusha jnz .back sub esp, 0x120 mov eax, esp @@ -200,11 +203,11 @@ deploy_ani_ninja: .back: popa - verifyStackoffset 0xF54 - cmp [esp+stackoffset-0xE88], ebp - jmp 0x57DC47 + verifyStackoffset g1g2(0xF54,0xFD8,,) + cmp [esp+stackoffset-g1g2(0xE88,0xF20,,)], ebp + jmp g1g2(0x57DC40,0x598474,,)+7 -%elif GOTHIC_BASE_VERSION == 2 +%elif GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 resetStackoffset 0x49C pusha @@ -230,6 +233,6 @@ deploy_ani_ninja: ; Jump back mov eax, [esp+stackoffset-0x3E0] - jmp 0x5961D4 + jmp g1g2(,,0x590C6D,0x5961CD)+7 %endif diff --git a/src/exec/init.asm b/src/exec/init.asm index a54fc0a..080382a 100644 --- a/src/exec/init.asm +++ b/src/exec/init.asm @@ -2,20 +2,22 @@ global init_menu init_menu: - resetStackoffset 0x2C + 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 call ninja_dispatch addStack 3*4 popa - verifyStackoffset 0x2C + verifyStackoffset g1g2(0x34,0x3C,0x34,0x34) ; Jump back - pop ebp - mov ecx, [esp+stackoffset-0xC] - jmp g1g2(0x4CE914,0x4DB504) + jmp g1g2(0x4CE909,0x4DF1A6,0x4D8E59,0x4DB4F9)+5 global init_content @@ -31,10 +33,10 @@ init_content: verifyStackoffset ; Jump back -%if GOTHIC_BASE_VERSION == 1 - mov DWORD [0x8DDF90], edi -%elif GOTHIC_BASE_VERSION == 2 +%if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 + mov DWORD [zCParser_parser+zCParser_progressBar_offset], edi +%elif GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 add esp, 0x8 test eax, eax %endif - jmp g1g2(0x637F8A,0x6C20C8) + jmp g1g2(0x637F84,0x65E408,0x6655C3,0x6C20C3)+5 diff --git a/src/exec/misc.asm b/src/exec/misc.asm index a45977d..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,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,0x25C)] - jmp g1g2(0x68CB37,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,0x94) + resetStackoffset g1g2(0x5C,0x5C,0x94,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 + %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,0x94) + verifyStackoffset g1g2(0x5C,0x5C,0x94,0x94) .back: - jmp g1g2(0x6D652A,0x77F66A)+6 + jmp g1g2(0x6D652A,0x70DF35,0x71FC2A,0x77F66A) + 6 global checkNpcTransient2 checkNpcTransient2: - resetStackoffset g1g2(0x5C,0x94) + resetStackoffset g1g2(0x5C,0x5C,0x94,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 + %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,0x94) + verifyStackoffset g1g2(0x5C,0x5C,0x94,0x94) .back: - jmp g1g2(0x6D65A3,0x77F6E1)+6 + jmp g1g2(0x6D65A3,0x70DFA6,0x71FCA1,0x77F6E1)+6 global removeInvalidNpcs removeInvalidNpcs: - resetStackoffset g1g2(0x58,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,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,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,-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,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,0x98) + resetStackoffset g1g2(0x5C,0x5C,0x98,0x98) test esi, esi jz .back - mov eax, [esi+g1g2(0x7B0,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,0x774)] ; oCNpc.mds_name + lea ecx, [esi+g1g2(0x7B4,0x7C8,0x6E8,0x774)] ; oCNpc.mds_name call zSTRING__zSTRING addStack 4 .back: - verifyStackoffset g1g2(0x5C,0x98) - jmp g1g2(0x6D6828,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,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,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,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,0x6EEE6E) + jz g1g2(0x65880E,0x682D4E,0x691BFE,0x6EEE6E) verifyStackoffset 0x10 ; Jump back push edi push oCNpc_RTTI_Type_Descriptor - jmp g1g2(0x6587F2,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,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,0x6EF1D3) + jmp g1g2(0x658B3E,0x6830AE,0x691F5E,0x6EF1CE) + 5 ; Deinitialize VDFS on fast exit to ensure release of data file @@ -566,15 +571,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,0,0x3C) pusha call zFILE_VDFS__DeinitFileSystem popa - verifyStackoffset 0x3C + verifyStackoffset g1g2(0x3C,0x38,0,0x3C) ; Jump back mov BYTE [esp+stackoffset-0x4], 0x4 - jmp g1g2(0x423BE1,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,0x8D4294) - jmp g1g2(0x4F3C35,0x502AB5) + mov eax, g1g2(0x86F51C,0x8B5138,0x8C5C5C,0x8D4294) + jmp g1g2(0x4F3C30,0x506620,0x4FFE30,0x502AB0) + 5 diff --git a/src/exec/parse.asm b/src/exec/parse.asm index dc23091..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,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,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,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,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,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,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,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,0x7915CC) + jmp g1g2(0x6E8269,0x7211EB,0x73126D,0x7915CC) global parser_check_var parser_check_var: - resetStackoffset g1g2(0x394,0x3EC) - xor g1g2(edi,ebp), g1g2(edi,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,-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,ebp), eax - verifyStackoffset g1g2(0x394,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,-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,-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,ebp), eax - lea ecx, [esp+stackoffset+g1g2(-0x3A8,-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,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,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,(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,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,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,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,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,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,0x3F0) + 0x8 + verifyStackoffset g1g2(0x398,0x38C,0x3F0,0x3F0) + 0xC jz .back reportToSpy NINJA_COMPARE_VERSIONS cmp ebx, eax - verifyStackoffset g1g2(0x398,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,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,0x3F0) + verifyStackoffset g1g2(0x398,0x38C,0x3F0,0x3F0) ; Jump back push eax - mov ecx, ebp call zCPar_Symbol__SetValue_int - jmp g1g2(0x6F2459,0x79BDD8) + jmp g1g2(0x6F2451,0x72BEA6,0x73C390,0x79BDD0) + 8 global parser_verify_lego_version parser_verify_lego_version: - resetStackoffset g1g2(0x394,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,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,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,0x3EC) + 0xC + verifyStackoffset g1g2(0x394,0x388,0x3EC,0x3EC) + 0x10 jnz .back reportToSpy NINJA_VERIFY_VERSION - mov ecx, [esp+stackoffset+g1g2(-0x340,-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,-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,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,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,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,0x3EC) + 0xC + verifyStackoffset g1g2(0x394,0x388,0x3EC,0x3EC) + 0x10 jl .back mov ebx, eax - mov eax, [esp+stackoffset+g1g2(-0x340,-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,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,-0x394)] + lea ecx, [esp+stackoffset+g1g2(-0x340,-0x58-0x4,-0x394,-0x394)] .backClean: + pop ebp pop ebx pop edx pop eax - verifyStackoffset g1g2(0x394,0x3EC) + verifyStackoffset g1g2(0x394,0x388,0x3EC,0x3EC) ; Jump back push edi - jmp g1g2(0x6F24B1,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,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,0x78F380) + jmp g1g2(0x6E6100,0x71ECCD,0x72F940,0x78F380) verifyStackoffset 0x250 .back: ; Jump back lea ecx, [esp+stackoffset-0x240] call zSTRING__Upper - jmp g1g2(0x6E5F1E,0x78F19E) + jmp g1g2(0x6E5F19,0x71EAB5,0x72F759,0x78F199) + 5 diff --git a/src/func/allowRedefine.asm b/src/func/allowRedefine.asm index 65be6a4..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,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 f854395..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,0x0868FF6A) - mov DWORD [zCParser__ParseBlock+4], g1g2(0x64007C4A,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 eaea17f..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, 0x5F9BF0) + call g1g2(0x5CE900,0x5ED6A0,0x5F2E00,0x5F9BF0) addStack 4 call _itoa add esp, 0xC 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/initContent.asm b/src/func/initContent.asm index 1889168..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, 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 82709f2..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, 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/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 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_CGameManager_destructor.asm b/src/hook_CGameManager_destructor.asm index 872d69f..849a894 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,0x4265C4,0x42449C,0x4247CC) %endif bits 32 diff --git a/src/hook_Hlp_GetNpc.asm b/src/hook_Hlp_GetNpc.asm index 18f9bb1..3992378 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,0x682D2C,0x691BDC,0x6EEE4C) %endif bits 32 diff --git a/src/hook_Hlp_IsValidItem.asm b/src/hook_Hlp_IsValidItem.asm index 965284b..540cd54 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,0x6830AE,0x691F5E,0x6EF1CE) %endif bits 32 diff --git a/src/hook_Hlp_IsValidNpc.asm b/src/hook_Hlp_IsValidNpc.asm index c2a3d5f..263226c 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,0x682DCE,0x691C6E,0x6EEEDE) %endif bits 32 diff --git a/src/hook_archiveWorldCountLogicalNpc.asm b/src/hook_archiveWorldCountLogicalNpc.asm index 183112f..224f6cb 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,0x70DF35,0x71FC2A,0x77F66A) %endif bits 32 diff --git a/src/hook_archiveWorldWriteLogicalNpc.asm b/src/hook_archiveWorldWriteLogicalNpc.asm index b922279..1414d60 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,0x70DFA6,0x71FCA1,0x77F6E1) %endif bits 32 diff --git a/src/hook_createVdfArray.asm b/src/hook_createVdfArray.asm index 74be84d..7f82869 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,0x6293DC,0x630B5C) %endif bits 32 diff --git a/src/hook_deploy_ani_ninja.asm b/src/hook_deploy_ani_ninja.asm index 333099e..5685e3a 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,0x598474,0x590C6D,0x5961CD) %endif bits 32 @@ -21,10 +16,10 @@ section .text align=1 ; Pre times 2 nop ; Overwrites - ; %if GOTHIC_BASE_VERSION == 1 - ; resetStackoffset 0xF54 - ; cmp [esp+stackoffset-0xE88], ebp - ; %elif GOTHIC_BASE_VERSION == 2 + ; %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 + ; 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] ; %endif diff --git a/src/hook_deploy_camera_ninja.asm b/src/hook_deploy_camera_ninja.asm index 886eca6..0a35155 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,0x4A6138,0x49E09D,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,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 7f2eaf4..0792ebf 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(0x637208,0x65D5A1,0x6647F2,0x6C12B7) %endif bits 32 @@ -18,9 +13,6 @@ bits 32 section .text align=1 ; Prevent auto-alignment jmp deploy_content_ninja - nop ; Overwrites - ; resetStackoffset g1g2(0x94,0x84) - ; push 0x1 - ; lea ecx, [esp+stackoffset+g1g2(-0x44,-0x1C)] + ; call sysEvent diff --git a/src/hook_deploy_fightai_ninja.asm b/src/hook_deploy_fightai_ninja.asm index 8f1e7fc..30ddd04 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,0x788F52,0x79318A,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,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 ba622a9..337cafc 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,0x4DDC34,0x4D7ADA,0x4DA196) %endif bits 32 diff --git a/src/hook_deploy_music_ninja.asm b/src/hook_deploy_music_ninja.asm index e157238..15834d2 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,0x4EB55C,0x4E4B83,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)] - ; push 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 34e80e2..854ef83 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,0x41DCD7,0x41C0D7,0x41C407) %endif bits 32 diff --git a/src/hook_deploy_pfx_ninja.asm b/src/hook_deploy_pfx_ninja.asm index 3944093..f12d563 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,0x5A7F33,0x5A7175,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)] - ; push 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 515c1cf..2f8563c 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,0x4EECDC,0x4E823F,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,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 f60933d..adac4d7 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,0x48EB1F,0x489D76,0x48B6EF) %endif bits 32 @@ -18,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,0x250) - ; lea g1g2(edx,eax), [esp+stackoffset+g1g2(-0x239,0x235)] - ; push g1g2(edx,eax) + ; resetStackoffset g1g2(0x248,0x234,0x238,0x250) + ; %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2 + ; 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,0x0,eax,eax) diff --git a/src/hook_fastexit.asm b/src/hook_fastexit.asm index 4363ff2..362df2d 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,0x42748D,0x42536F,0x4256AF) %endif bits 32 diff --git a/src/hook_init_content.asm b/src/hook_init_content.asm index e913007..1a708ed 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,0x65E408,0x6655C3,0x6C20C3) %endif bits 32 @@ -20,15 +15,15 @@ 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 - ; %elif GOTHIC_BASE_VERSION == 2 + ; %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112 + ; mov DWORD [zCParser_parser+zCParser_progressBar_offset], edi + ; %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 b59e9c2..26465bd 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(0x4CE909,0x4DF1A6,0x4D8E59,0x4DB4F9) %endif bits 32 @@ -20,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_libExit.asm b/src/hook_libExit.asm index 826c941..dad1c06 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,0x506620,0x4FFE30,0x502AB0) %endif bits 32 diff --git a/src/hook_linkerReplaceFunc.asm b/src/hook_linkerReplaceFunc.asm index 1ffde26..f5e41a5 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,0x7207A9,0x731268,0x790CA8) %endif bits 32 diff --git a/src/hook_npcReference.asm b/src/hook_npcReference.asm index cb55a6e..f3e2d22 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,0x6BC7DD,0x6D0445,0x72E625) %endif bits 32 diff --git a/src/hook_oCSpawnManager__Archive.asm b/src/hook_oCSpawnManager__Archive.asm index 1f42b55..f6820f8 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,0x707AC0,0x719DB0,0x7797F0) %endif bits 32 diff --git a/src/hook_parserDeclareClass.asm b/src/hook_parserDeclareClass.asm index f56facd..acfa0a1 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,0x72C545,0x73C9F2,0x79C432) %endif bits 32 @@ -20,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 4708b3e..a2c5ee8 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,0x72E5DE,0x73E76E,0x79E1AE) %endif bits 32 @@ -19,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 2f125aa..b720363 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,0x72D1EA,0x73D532,0x79CF72) %endif bits 32 @@ -19,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 dab9f81..199ff0d 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,0x72B30A,0x73B975,0x79B3B5) %endif bits 32 @@ -19,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 01218fe..1abc02e 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,0x72BEA6,0x73C390,0x79BDD0) %endif bits 32 diff --git a/src/hook_parserDeclareVar_constString.asm b/src/hook_parserDeclareVar_constString.asm index a7ef37f..03faf2e 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,0x72BF00,0x73C3EB,0x79BE2B) %endif bits 32 diff --git a/src/hook_parserParseSource.asm b/src/hook_parserParseSource.asm index 7dd772c..c7a6660 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,0x71EAB5,0x72F759,0x78F199) %endif bits 32 diff --git a/src/hook_setVobToTransient.asm b/src/hook_setVobToTransient.asm index a406c83..a594395 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,0x6BD2E0,0x6D0F01,0x72F161) %endif bits 32 diff --git a/src/hook_unarchiveInfoMan.asm b/src/hook_unarchiveInfoMan.asm index 62d2490..34de2e3 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,0x663348,0x66A0EE,0x6C6D1E) %endif bits 32 diff --git a/src/hook_unarchiveNpcs.asm b/src/hook_unarchiveNpcs.asm index 7772550..41a95f1 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,0x70E25F,0x71FF7B,0x77F9BB) %endif bits 32 diff --git a/src/hook_unarchiveVobs.asm b/src/hook_unarchiveVobs.asm index 0b58d6c..00cbb73 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,0x61959E,0x61EFFA,0x62678A) %endif bits 32 @@ -18,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_zCPar_Symbol__GetNext.asm b/src/hook_zCPar_Symbol__GetNext.asm index 5380dc3..a588b2f 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,0x732740,0x742390,0x7A1DD0) %endif bits 32 diff --git a/src/hook_zCParser__LoadGlobalVars.asm b/src/hook_zCParser__LoadGlobalVars.asm index 1c4843f..094a4f7 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,0x727105,0x7379A1,0x7973E1) %endif bits 32 @@ -18,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/inc/engine.inc b/src/inc/engine.inc index eb33d45..3f8881f 100644 --- a/src/inc/engine.inc +++ b/src/inc/engine.inc @@ -6,6 +6,14 @@ %include "inc/engine_g1.inc" + %elif GOTHIC_BASE_VERSION == 112 + + %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_g1.inc b/src/inc/engine_g1.inc index 12e67c1..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 @@ -137,6 +139,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 @@ -167,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 new file mode 100644 index 0000000..e1b2d68 --- /dev/null +++ b/src/inc/engine_g112.inc @@ -0,0 +1,242 @@ +%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_ 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 * + %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 sysEvent 0x509530 ; void + %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 zCParser_progressBar_offset 0x1188 + + %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/engine_g130.inc b/src/inc/engine_g130.inc new file mode 100644 index 0000000..34a2393 --- /dev/null +++ b/src/inc/engine_g130.inc @@ -0,0 +1,242 @@ +%ifndef ENGINE_G130_INC + %define ENGINE_G130_INC + + %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 + %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/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 diff --git a/src/inc/macros.inc b/src/inc/macros.inc index 53f4e02..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 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, 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,9 +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,g2) g1 + %define g1g2(g1,g112,g130,g2) g1 + %elif GOTHIC_BASE_VERSION == 112 + %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,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 new file mode 100644 index 0000000..3d619b0 --- /dev/null +++ b/src/inc/symbols.inc @@ -0,0 +1,22 @@ +%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 == 130 + + %include "inc/symbols_g130.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..1fb3f15 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,0x597D9E,0x596EA6,0x59C406) %endif bits 32 @@ -18,27 +13,27 @@ bits 32 section .text align=1 ; Prevent auto-alignment - resetStackoffset g1g2(0xF54,0x1310) + resetStackoffset g1g2(0xF54,0xF58,0x1310,0x1310) push eax ; Existing zCModelAni * - mov ecx, [esp+stackoffset+g1g2(-0xF24,-0x12C8)] + mov ecx, [esp+stackoffset+g1g2(-0xF24,-0xF28,-0x12C8,-0x12C8)] ; zCModelPrototype * push ecx - mov edx, [esp+stackoffset+g1g2(-0xF44,-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,-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,0x1310) - jg g1g2(0x57D8F8,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,0x1310) - jmp g1g2(0x57D8F8,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 6c592b0..de2c216 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,0x593F2D,0x592547,0x597AA7) %endif bits 32 @@ -18,28 +13,33 @@ bits 32 section .text align=1 ; Prevent auto-alignment - resetStackoffset g1g2(0xF54,0x12E8) + resetStackoffset g1g2(0xF54,0xF58,0x12E8,0x12E8) push eax ; Existing zCModelAni * - mov ecx, [esp+stackoffset+g1g2(-0xF24,-0x12A0)] ; zCModelPrototype * + mov ecx, [esp+stackoffset+g1g2(-0xF24,-0xF28,-0x12A0,-0x12A0)] ; zCModelPrototype * push ecx - mov edx, g1g2(edi,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,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,0x12E8) - jg g1g2(0x579DC2,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,0x12E8) - jmp g1g2(0x579DC2,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 fc0a237..ec80797 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,0x594A4A,0x5931FB,0x59875B) %endif bits 32 @@ -18,33 +13,33 @@ bits 32 section .text align=1 ; Prevent auto-alignment - resetStackoffset g1g2(0xF54,0x128C) + resetStackoffset g1g2(0xF54,0xF58,0x128C,0x128C) push eax ; Existing zCModelAni * - mov ecx, [esp+stackoffset+g1g2(-0xF24,-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,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,0x128C) - jg g1g2(0x57A795,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,0x128C) - jmp g1g2(0x57A795,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 4f3b469..ca26c73 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,0x5943EC,0x592B05,0x598065) %endif bits 32 @@ -18,28 +13,33 @@ bits 32 section .text align=1 ; Prevent auto-alignment - resetStackoffset g1g2(0xF54,0x12D4) + resetStackoffset g1g2(0xF54,0xF58,0x12D4,0x12D4) push eax ; Existing zCModelAni * - mov ecx, [esp+stackoffset+g1g2(-0xF24,(-0x129C+0x10))] ; zCModelPrototype * + mov ecx, [esp+stackoffset+g1g2(-0xF24,-0xF28,-0x128C,-0x128C)] ; zCModelPrototype * push ecx - mov edx, g1g2(edi,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,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,0x12D4) - jg g1g2(0x57A1EA,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,0x12D4) - jmp g1g2(0x57A1EA,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 2fd1b21..d101346 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,0x5955E3,0x593EF6,0x599456) %endif bits 32 @@ -18,32 +13,33 @@ bits 32 section .text align=1 ; Prevent auto-alignment - resetStackoffset g1g2(0xF54,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,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,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,0x12EC) - jg g1g2(0x57A1EA,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,0x12EC) - jmp g1g2(0x57A1EA,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 f363ce2..ceadb5f 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,0x595824,0x594223,0x599783) %endif bits 32 @@ -18,28 +13,33 @@ bits 32 section .text align=1 ; Prevent auto-alignment - resetStackoffset g1g2(0xF54,0x12C0) + resetStackoffset g1g2(0xF54,0xF58,0x12C0,0x12C0) push eax ; Existing zCModelAni * - mov ecx, [esp+stackoffset+g1g2(-0xF24,(-0x1284+0xC))] ; zCModelPrototype * + mov ecx, [esp+stackoffset+g1g2(-0xF24,-0xF28,-0x1278,-0x1278)] ; zCModelPrototype * push ecx - mov edx, g1g2(edi,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,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,0x12C0) - jg g1g2(0x57B3DD,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,0x12C0) - jmp g1g2(0x57B3DD,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 32fa164..d72e54e 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(0x57A4AB,0x594784,0x592F81,0x5984E1) %endif bits 32 @@ -18,28 +13,33 @@ bits 32 section .text align=1 ; Prevent auto-alignment - resetStackoffset g1g2(0xF54,0x12C4) + resetStackoffset g1g2(0xF54,0xF58,0x12C4,0x12C4) push eax ; Existing zCModelAni * - mov ecx, [esp+stackoffset+g1g2(-0xF24,(-0x1284+0x8))] ; zCModelPrototype * + mov ecx, [esp+stackoffset+g1g2(-0xF24,-0xF28,-0x127C,-0x127C)] ; zCModelPrototype * push ecx - mov edx, g1g2(edi,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,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,0x12C4) - jg g1g2(0x57A1EA,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,0x12C4) - jmp g1g2(0x57A1EA,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_parserDeclareClass_showOverwrite.asm b/src/ow_parserDeclareClass_showOverwrite.asm index 7a919fb..56b30ab 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,0x72C5CC,0x73CA6A,0x79C4AA) %endif bits 32 @@ -17,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,0x79C4FB) + verifyStackoffset + jmp g1g2(0x6F2BEA,0x72C637,0x73CABB,0x79C4FB) diff --git a/src/ow_parserDeclareFunc_showOverwrite.asm b/src/ow_parserDeclareFunc_showOverwrite.asm index 8d101bb..f2e4f5d 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,0x72E65E,0x73E7D2,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,0x72E6A4,0x73E80E,0x79E24E) diff --git a/src/ow_parserDeclarePrototype_showOverwrite.asm b/src/ow_parserDeclarePrototype_showOverwrite.asm index 86d37e5..3447930 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,0x72D29A,0x73D5C4,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,0x72D2E5,0x73D605,0x79D045) diff --git a/src/ow_parserDeclareVar_showOverwrite.asm b/src/ow_parserDeclareVar_showOverwrite.asm index f965941..d9bb510 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,0x72BBB3,0x73C07F,0x79BABF) %endif bits 32 @@ -17,11 +12,11 @@ bits 32 section .text align=1 ; Prevent auto-alignment - resetStackoffset g1g2(0x394,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,0x3EC) - jmp g1g2(0x6F215B,0x79BB07) + verifyStackoffset g1g2(0x394,0x388,0x3EC,0x3EC) + jmp g1g2(0x6F215B,0x72BBFC,0x73C0C7,0x79BB07) diff --git a/src/ow_playerInfoName1.asm b/src/ow_playerInfoName1.asm index e39c75f..2c31568 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,0x4692B2,0x46639E,0x466FCE) %endif bits 32 diff --git a/src/ow_playerInfoName2.asm b/src/ow_playerInfoName2.asm index fcd5ad3..f588eac 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,0x469E72,0x466EE5,0x467B15) %endif bits 32 diff --git a/src/ow_playerInfoName3.asm b/src/ow_playerInfoName3.asm index 2d69610..1a3b544 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,0x46A139,0x467192,0x467DC2) %endif bits 32 diff --git a/src/ow_playerInfoName4.asm b/src/ow_playerInfoName4.asm index bff17f1..26665a8 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,0x46A9CD,0x4679DA,0x46860A) %endif bits 32 diff --git a/src/ow_playerInfoName5.asm b/src/ow_playerInfoName5.asm index 463ca3b..7d0264d 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,0x472CF6,0x46F2EB,0x46FF1B) %endif bits 32 diff --git a/src/ow_reopenFileWarning.asm b/src/ow_reopenFileWarning.asm index 2898f86..a15bc3d 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,0x5ED6C5,0x5F2E25,0x5F9C15) %endif bits 32 diff --git a/src/ow_zCParser__LoadGlobalVars.asm b/src/ow_zCParser__LoadGlobalVars.asm index 6f45006..731f27b 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 1.30 and Gothic 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) 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 diff --git a/verifySize.bat b/verifySize.bat index 1350dcc..3803dd0 100644 --- a/verifySize.bat +++ b/verifySize.bat @@ -1,15 +1,19 @@ :: :: Verify file size :: -:: Arguments: BINFILE GOTHIC-BASE-VERSION(1 or 2) +:: Arguments: BINFILE GOTHIC-BASE-VERSION(1, 112, 130, 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 EQU 130 GOTO start +IF %2 NEQ 2 GOTO usage + +:start SET gothic=%2 :: Parse file name @@ -20,8 +24,10 @@ 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% == 130 SET SIZELIMIT=11895 +IF %gothic% == 2 SET SIZELIMIT=11904 :: Check file size against limit SET FILESIZE=%~z1 @@ -30,4 +36,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, 130, or 2)