Skip to content

Commit

Permalink
Revert "Recover last invalid spell item"
Browse files Browse the repository at this point in the history
This reverts commit 6234015.
This reverts commit ac5f940.
This reverst commit 61b8ad1.
  • Loading branch information
szapp committed Sep 6, 2024
1 parent 8742cd5 commit f45089b
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 68 deletions.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ BIN_BASE := core \
hook_oCSpawnManager__Archive \
hook_npcReference \
hook_recoverInvalidItem \
hook_recoverInvalidItem2 \
hook_fastexit \
hook_CGameManager_destructor \
hook_libExit \
Expand Down
4 changes: 2 additions & 2 deletions src/core.asm
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
%include "inc/engine.inc"

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

bits 32

; This address space spans multiple methods of the deprecated class
; 'zCNetEventManager' starting with zCNetEventManager::_CreateNewInstance.
; 'zCNetEventManager' starting with zCNetEventManager::HandleNetMessage.
; After a long testing period any safety checks for ensuring that the
; overwritten methods are indeed never called are now omitted.

Expand Down
45 changes: 0 additions & 45 deletions src/exec/misc.asm
Original file line number Diff line number Diff line change
Expand Up @@ -288,51 +288,6 @@ recoverInvalidItem:
jmp g1g2(0x66DC47,0x69B420,0x6AFBB9,0x70D6D9) + 6


global recoverInvalidItem2
recoverInvalidItem2:
resetStackoffset g1g2(0x110,0x110,0x158,0x15C)
%assign var_numInvSlots -g1g2(0xB8,0xA8,0x100,0xEC)
%assign var_loopIndex -g1g2(0xE8,0xD8,0x138,0x140)
%assign var_used -g1g2(0x38,0x38,0x6C,0x70)

mov eax, [esp+stackoffset+var_loopIndex] ; Check if first iteration (i.e. index == 0)
test eax, eax
jnz .backOriginal ; If not, jump back as original

mov eax, [esi] ; Read as integer and store it
call [eax+0x60] ; zCArchive->ReadInt
addStack 4

movzx ecx, BYTE [esp+stackoffset+var_used] ; Take only the lowest byte
cmp ecx, 0x1 ; Check if boolean (i.e. low byte <= 1)
verifyStackoffset g1g2(0x110,0x110,0x158,0x15C) - 0x4
jbe .backCorrect ; If so, continue as expected

mov eax, [esp+stackoffset+var_used] ; Fix the misread values
mov [esp+stackoffset+var_numInvSlots], eax ; Update maximum loop iterations

mov ecx, esi ; Read the next (correct) value from archive
lea eax, [esp+stackoffset+var_used]
push eax
mov eax, [esi]
call [eax+0x80] ; zCArchive->ReadBool
addStack 4
verifyStackoffset g1g2(0x110,0x110,0x158,0x15C) - 0x4
jmp .back

.backCorrect:
mov [esp+stackoffset+var_used], ecx ; Nothing to fix, continue as expected
jmp .back

.backOriginal:
mov eax, [esi] ; Re-write original instruction
call [eax+0x80] ; zCArchive->ReadBool
addStack 4

.back:
jmp g1g2(0x6A3DD9,0x6D67BB,0x6E96C1,0x748161) + 6


global ninja_injectInfo
ninja_injectInfo:
resetStackoffset ; 0xBC
Expand Down
19 changes: 0 additions & 19 deletions src/hook_recoverInvalidItem2.asm

This file was deleted.

2 changes: 1 addition & 1 deletion verifySize.bat
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ 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=11340
IF %gothic% == 1 SET SIZELIMIT=11280
IF %gothic% == 112 SET SIZELIMIT=12096
IF %gothic% == 130 SET SIZELIMIT=11895
IF %gothic% == 2 SET SIZELIMIT=11904
Expand Down

0 comments on commit f45089b

Please sign in to comment.