Skip to content

Commit

Permalink
Get the core parsing running for 1.30
Browse files Browse the repository at this point in the history
  • Loading branch information
szapp committed Jul 20, 2023
1 parent da97015 commit d16bebc
Show file tree
Hide file tree
Showing 25 changed files with 261 additions and 247 deletions.
16 changes: 15 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,21 @@ BIN_BASE_G112 := core \
hook_init_menu \
hook_init_content \
hook_zCPar_Symbol__GetNext
BIN_BASE_G130 :=
BIN_BASE_G130 := core \
hook_createVdfArray \
hook_deploy_ani_ninja \
hook_deploy_camera_ninja \
hook_deploy_content_ninja \
hook_deploy_fightai_ninja \
hook_deploy_menu_ninja \
hook_deploy_music_ninja \
hook_deploy_ou_ninja \
hook_deploy_pfx_ninja \
hook_deploy_sfx_ninja \
hook_deploy_vfx_ninja \
hook_init_menu \
hook_init_content \
hook_zCPar_Symbol__GetNext
BIN_BASE_G2 := ow_zCParser__LoadGlobalVars \
skip_writeAniBinFile_ModelTag \
skip_writeAniBinFile_ReadMeshAndTree \
Expand Down
2 changes: 1 addition & 1 deletion src/core.asm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
%include "inc/engine.inc"

%ifidn __OUTPUT_FORMAT__, bin
org g1g2(0x452640,0x459190,0,0x457470)
org g1g2(0x452640,0x459190,0x456D20,0x457470)
%endif

bits 32
Expand Down
4 changes: 2 additions & 2 deletions src/exec/createVdfArray.asm
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ createVdfArray:
add esp, 0x14

%if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 2
mov al, [SystemPack_version_info+g1g2(0xD,0x0,0,0xB)] ; Check for old Ninja system
mov al, [SystemPack_version_info+g1g2(0xD,0x0,0x0,0xB)] ; Check for old Ninja system
cmp al, 'N'
jnz .checkScripts

Expand Down Expand Up @@ -565,7 +565,7 @@ createVdfArray:
verifyStackoffset

push char_zStartupWindowed
jmp g1g2(0x6019C6,0x623783,0,0x630B61)
jmp g1g2(0x6019C1,0x62377E,0x6293DC,0x630B5C)+5


; int __cdecl ninja_compareTimestampsUnsigned(void const *, void const *)
Expand Down
86 changes: 43 additions & 43 deletions src/exec/deploy.asm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

global deploy_music_ninja
deploy_music_ninja:
resetStackoffset g1g2(0xD8,0xB0,0,0xC8)
resetStackoffset g1g2(0xD8,0xB0,0xB0,0xC8)
pusha
push ninja_injectSrc
push NINJA_PATH_MUSIC
Expand All @@ -11,17 +11,17 @@ deploy_music_ninja:
call ninja_armParser
addStack 3*4
popa
verifyStackoffset g1g2(0xD8,0xB0,0,0xC8)
verifyStackoffset g1g2(0xD8,0xB0,0xB0,0xC8)

; Jump back
lea g1g2(edx,eax,0,edx), [esp+stackoffset+g1g2(-0xC5,-0x9D,0,-0xB5)]
push g1g2(edx,eax,0,edx)
jmp g1g2(0x4DA448,0x4EB55C,0,0x4E765C)+5
lea g1g2(edx,eax,eax,edx), [esp+stackoffset+g1g2(-0xC5,-0x9D,-0x9D,-0xB5)]
push g1g2(edx,eax,eax,edx)
jmp g1g2(0x4DA448,0x4EB55C,0x4E4B83,0x4E765C)+5


global deploy_sfx_ninja
deploy_sfx_ninja:
resetStackoffset g1g2(0x304,0x2F8,0,0x308)
resetStackoffset g1g2(0x304,0x2F8,0x2F4,0x308)
pusha
push ninja_injectSrc
push NINJA_PATH_SFX
Expand All @@ -30,17 +30,17 @@ deploy_sfx_ninja:
call ninja_armParser
addStack 3*4
popa
verifyStackoffset g1g2(0x304,0x2F8,0,0x308)
verifyStackoffset g1g2(0x304,0x2F8,0x2F4,0x308)

; Jump back
lea g1g2(ecx,eax,0,eax), [esp+stackoffset+g1g2(-0x2F2,0x2E5,0,-0x2F6)]
push g1g2(ecx,eax,0,eax)
jmp g1g2(0x4DD88C,0x4EECDC,0,0x4EAE8B)+5
lea g1g2(ecx,eax,edx,eax), [esp+stackoffset+g1g2(-0x2F2,-0x2E5,-0x2E2,-0x2F6)]
push g1g2(ecx,eax,edx,eax)
jmp g1g2(0x4DD88C,0x4EECDC,0x4E823F,0x4EAE8B)+5


global deploy_pfx_ninja
deploy_pfx_ninja:
resetStackoffset g1g2(0x8C,0x7C,0,0xC8)
resetStackoffset g1g2(0x8C,0x7C,0xB0,0xC8)
pusha
push ninja_injectSrc
push NINJA_PATH_PFX
Expand All @@ -49,17 +49,17 @@ deploy_pfx_ninja:
call ninja_armParser
addStack 3*4
popa
verifyStackoffset g1g2(0x8C,0x7C,0,0xC8)
verifyStackoffset g1g2(0x8C,0x7C,0xB0,0xC8)

; Jump back
lea g1g2(eax,ecx,0,eax), [esp+stackoffset+g1g2(-0x79,-0x69,0,-0xB5)]
push g1g2(eax,ecx,0,eax)
jmp g1g2(0x58CA22,0x5A7F33,0,0x5AC7BC)+5
lea g1g2(eax,ecx,eax,eax), [esp+stackoffset+g1g2(-0x79,-0x69,-0x9D,-0xB5)]
push g1g2(eax,ecx,eax,eax)
jmp g1g2(0x58CA22,0x5A7F33,0x5A7175,0x5AC7BC)+5


global deploy_vfx_ninja
deploy_vfx_ninja:
resetStackoffset g1g2(0x248,0x234,0,0x250)
resetStackoffset g1g2(0x248,0x234,0x238,0x250)
pusha
push ninja_injectSrc
push NINJA_PATH_VFX
Expand All @@ -68,16 +68,16 @@ deploy_vfx_ninja:
call ninja_armParser
addStack 3*4
popa
verifyStackoffset g1g2(0x248,0x234,0,0x250)
verifyStackoffset g1g2(0x248,0x234,0x238,0x250)

; Jump back
%if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 2
lea g1g2(edx,0,0,eax), [esp+stackoffset+g1g2(-0x239,0,0,-0x235)]
%if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2
lea g1g2(edx,0x0,eax,eax), [esp+stackoffset+g1g2(-0x239,0x0,-0x226,-0x235)]
%elif GOTHIC_BASE_VERSION == 112
mov [esp+stackoffset-0x21C], cl
%endif
push g1g2(edx,0,0,eax)
jmp g1g2(0x483A3C,0x48EB1F,0,0x48B6EF)+5
push g1g2(edx,0x0,eax,eax)
jmp g1g2(0x483A3C,0x48EB1F,0x489D76,0x48B6EF)+5


global deploy_ou_ninja
Expand All @@ -96,7 +96,7 @@ deploy_ou_ninja:

global deploy_content_ninja
deploy_content_ninja:
resetStackoffset g1g2(0x90,0x7C,0,0x80)
resetStackoffset g1g2(0x90,0x7C,0x7C,0x80)
call sysEvent ; Overwritten
pusha
push ninja_injectSrc
Expand All @@ -105,28 +105,28 @@ deploy_content_ninja:
call ninja_armParser
addStack 3*4
popa
verifyStackoffset g1g2(0x90,0x7C,0,0x80)
verifyStackoffset g1g2(0x90,0x7C,0x7C,0x80)

; Jump back
jmp g1g2(0x637208,0x65D5A1,0,0x6C12B7)+5
jmp g1g2(0x637208,0x65D5A1,0x6647F2,0x6C12B7)+5


global deploy_fightai_ninja
deploy_fightai_ninja:
resetStackoffset g1g2(0x7C,0x50,0,0x64)
resetStackoffset g1g2(0x7C,0x50,0x50,0x64)
pusha
push ninja_injectSrc
push NINJA_PATH_FIGHT
push g1g2(ebx,ebp,0,ebx)
push g1g2(ebx,ebp,ebx,ebx)
call ninja_armParser
addStack 3*4
popa
verifyStackoffset g1g2(0x7C,0x50,0,0x64)
verifyStackoffset g1g2(0x7C,0x50,0x50,0x64)

; Jump back
lea g1g2(edx,edx,0,eax), [esp+stackoffset+g1g2(-0x69,-0x34,0,-0x51)]
push g1g2(edx,edx,0,eax)
jmp g1g2(0x747EBA,0x788F52,0,0x67C626)+5
lea g1g2(edx,edx,ecx,eax), [esp+stackoffset+g1g2(-0x69,-0x34,-0x34,-0x51)]
push g1g2(edx,edx,ecx,eax)
jmp g1g2(0x747EBA,0x788F52,0x79318A,0x67C626)+5


global deploy_menu_ninja
Expand All @@ -144,12 +144,12 @@ deploy_menu_ninja:

; Jump back
mov eax, DWORD [zCSoundSystem_zsound]
jmp g1g2(0x4CD57A,0x4DDC34,0,0x4DA196)+5
jmp g1g2(0x4CD57A,0x4DDC34,0x4D7ADA,0x4DA196)+5


global deploy_camera_ninja
deploy_camera_ninja:
resetStackoffset g1g2(0xB4,0x9C,0,0xB8)
resetStackoffset g1g2(0xB4,0x9C,0x9C,0xB8)
pusha
push ninja_injectSrc
push NINJA_PATH_CAMERA
Expand All @@ -158,20 +158,20 @@ deploy_camera_ninja:
call ninja_armParser
addStack 3*4
popa
verifyStackoffset g1g2(0xB4,0x9C,0,0xB8)
verifyStackoffset g1g2(0xB4,0x9C,0x9C,0xB8)

; Jump back
lea g1g2(eax,edx,0,edx), [esp+stackoffset+g1g2(-0xA1,-0x89,0,-0xA5)]
push g1g2(eax,edx,0,edx)
jmp g1g2(0x49909E,0x4A6138,0,0x4A0554)+5
lea g1g2(eax,edx,ecx,edx), [esp+stackoffset+g1g2(-0xA1,-0x89,-0x89,-0xA5)]
push g1g2(eax,edx,ecx,edx)
jmp g1g2(0x49909E,0x4A6138,0x49E09D,0x4A0554)+5


global deploy_ani_ninja
deploy_ani_ninja:

%if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112

resetStackoffset g1g2(0xF54,0xFD8,0,0x0)
resetStackoffset g1g2(0xF54,0xFD8,0x0,0x0)
pusha
mov ebp, [esp+stackoffset-g1g2(0xF24,0xFA8,0,0x0)] ; zCModelPrototype *
mov esi, [ebp+0x14] ; name->ptr
Expand All @@ -182,7 +182,7 @@ deploy_ani_ninja:
call DWORD [ds_lstrcmpiA]
addStack 2*4
test eax, eax
verifyStackoffset g1g2(0xF54,0xFD8,0,0x0)+32 ; Base + pusha
verifyStackoffset g1g2(0xF54,0xFD8,0x0,0x0)+32 ; Base + pusha
jnz .back
sub esp, 0x120
mov eax, esp
Expand All @@ -203,11 +203,11 @@ deploy_ani_ninja:

.back:
popa
verifyStackoffset g1g2(0xF54,0xFD8,0,0x0)
cmp [esp+stackoffset-g1g2(0xE88,0xF20,0,0x0)], ebp
jmp g1g2(0x57DC40,0x598474,0,0x0)+7
verifyStackoffset g1g2(0xF54,0xFD8,0x0,0x0)
cmp [esp+stackoffset-g1g2(0xE88,0xF20,0x0,0x0)], ebp
jmp g1g2(0x57DC40,0x598474,0x0,0x0)+7

%elif GOTHIC_BASE_VERSION == 2
%elif GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2

resetStackoffset 0x49C
pusha
Expand All @@ -233,6 +233,6 @@ deploy_ani_ninja:

; Jump back
mov eax, [esp+stackoffset-0x3E0]
jmp 0x5961CD+7
jmp g1g2(0x0,0x0,0x590C6D,0x5961CD)+7

%endif
10 changes: 5 additions & 5 deletions src/exec/init.asm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

global init_menu
init_menu:
resetStackoffset g1g2(0x34,0x3C,0,0x34)
resetStackoffset g1g2(0x34,0x3C,0x34,0x34)
call zCArraySort_zCMenu___InsertSort ; Overwritten
pusha
push ninja_initMenu
Expand All @@ -11,10 +11,10 @@ init_menu:
call ninja_dispatch
addStack 3*4
popa
verifyStackoffset g1g2(0x34,0x3C,0,0x34)
verifyStackoffset g1g2(0x34,0x3C,0x34,0x34)

; Jump back
jmp g1g2(0x4CE909,0x4DF1A6,0,0x4DB4F9)+5
jmp g1g2(0x4CE909,0x4DF1A6,0x4D8E59,0x4DB4F9)+5


global init_content
Expand All @@ -32,8 +32,8 @@ init_content:
; Jump back
%if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112
mov DWORD [zCParser_parser+zCParser_progressBar_offset], edi
%elif GOTHIC_BASE_VERSION == 2
%elif GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2
add esp, 0x8
test eax, eax
%endif
jmp g1g2(0x637F84,0x65E408,0,0x6C20C3)+5
jmp g1g2(0x637F84,0x65E408,0x6655C3,0x6C20C3)+5
2 changes: 1 addition & 1 deletion src/func/allowRedefine.asm
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ ninja_allowRedefine:
push eax

mov eax, [esp+stackoffset+arg_1]
mov eax, [eax+g1g2(0x10A4,0x10A4,0,0x20A4)] ; parser->line
mov eax, [eax+g1g2(0x10A4,0x10A4,0x10A4,0x20A4)] ; parser->line
push 0xA
push ecx
push eax
Expand Down
4 changes: 2 additions & 2 deletions src/func/armParser.asm
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ ninja_armParser:
push eax
mov eax, DWORD [zCParser__ParseBlock+4]
push eax
mov DWORD [zCParser__ParseBlock], g1g2(0xC868FF6A,0x1868FF6A,0,0x0868FF6A)
mov DWORD [zCParser__ParseBlock+4], g1g2(0x64007C4A,0x6400807C,0,0x640082A6)
mov DWORD [zCParser__ParseBlock], g1g2(0xC868FF6A,0x1868FF6A,0x2868FF6A,0x0868FF6A)
mov DWORD [zCParser__ParseBlock+4], g1g2(0x64007C4A,0x6400807C,0x64008159,0x640082A6)

mov eax, DWORD [zCParser__cur_parser]
push eax
Expand Down
2 changes: 1 addition & 1 deletion src/func/conEvalFunc.asm
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ ninja_Y3JjMzI:
push ecx
mov ecx, esp
push eax
call g1g2(0x5CE900,0x5ED6A0,0,0x5F9BF0)
call g1g2(0x5CE900,0x5ED6A0,0x5F2E00,0x5F9BF0)
addStack 4
call _itoa
add esp, 0xC
Expand Down
6 changes: 3 additions & 3 deletions src/func/oCSpawnManager__Archive_fix.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/hook_createVdfArray.asm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
%include "inc/symbols.inc"

%ifidn __OUTPUT_FORMAT__, bin
org g1g2(0x6019C1,0x62377E,0,0x630B5C)
org g1g2(0x6019C1,0x62377E,0x6293DC,0x630B5C)
%endif

bits 32
Expand Down
4 changes: 2 additions & 2 deletions src/hook_deploy_ani_ninja.asm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
%include "inc/symbols.inc"

%ifidn __OUTPUT_FORMAT__, bin
org g1g2(0x57DC40,0x598474,0,0x5961CD)
org g1g2(0x57DC40,0x598474,0x590C6D,0x5961CD)
%endif

bits 32
Expand All @@ -19,7 +19,7 @@ section .text align=1 ; Pre
; %if GOTHIC_BASE_VERSION == 1 || GOTHIC_BASE_VERSION == 112
; resetStackoffset g1g2(0xF54,0xFD8,0,0x0)
; cmp [esp+stackoffset-g1g2(0xE88,0xF20,0,0x0)], ebp
; %elif GOTHIC_BASE_VERSION == 2
; %elif GOTHIC_BASE_VERSION == 130 || GOTHIC_BASE_VERSION == 2
; resetStackoffset 0x49C
; mov eax, [esp+stackoffset-0x3E0]
; %endif
8 changes: 4 additions & 4 deletions src/hook_deploy_camera_ninja.asm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
%include "inc/symbols.inc"

%ifidn __OUTPUT_FORMAT__, bin
org g1g2(0x49909E,0x4A6138,0,0x4A0554)
org g1g2(0x49909E,0x4A6138,0x49E09D,0x4A0554)
%endif

bits 32
Expand All @@ -15,6 +15,6 @@ section .text align=1 ; Pre
jmp deploy_camera_ninja

; Overwrites
; resetStackoffset g1g2(0xB4,0,0,0xB8)
; lea g1g2(eax,edx,0,edx), [esp+stackoffset+g1g2(-0xA1,-0x89,0,-0xA5)]
; push g1g2(eax,edx,0,edx)
; resetStackoffset g1g2(0xB4,0x9C,0x9C,0xB8)
; lea g1g2(eax,edx,ecx,edx), [esp+stackoffset+g1g2(-0xA1,-0x89,-0x89,-0xA5)]
; push g1g2(eax,edx,ecx,edx)

0 comments on commit d16bebc

Please sign in to comment.