LinkToEventFix

Makes the actor's command-window closing correctly when an event-linked command is chosen in the engine's default battle-system instead of leaving it open.

Originally made and first released by bugmenot.

RPG2003
1.00UNKNOWN1UNKNOWN21.0.2.1
1.0.2.1
1.0.3.0
1.0.4.0
1.0.5.0
1.0.5.0
1.0.6.0
1.0.6.0
1.0.7.0
1.0.7.0
1.0.8.0
1.0.8.0
1.0.9.1
1.0.9.1
1.101.111.12mp210414

Segment 1/1

Offsets

RPG2003
1.0.8.0
1.0.8.0
00496262h
00095662h

Sourcecode

			CMP EAX, 6
			JA __004964BCh
			JMP [CASETABLE__00496272h+EAX*4]
CASETABLE__00496272h:
			dd CASE__Attack
			dd CASE__Skill				; Normal
			dd CASE__Skill				; Special
			dd CASE__Defend
			dd CASE__Item
			dd CASE__Escape
			dd CASE__Event
CASE__Attack:
			CALL PROC__00496380h
			PUSH EAX
			CALL PROC__004963B3h
			POP EAX
			MOV BYTE PTR [EAX+04h], 0
			MOV BYTE PTR [EAX+05h], 0
			MOV EAX, [EBP]
			CALL PROC__00498044h
__004962AAh:
			TEST AL, AL
			JL __004962B5h
__004962AEh:
			MOV BYTE PTR [ESP+10h], 1
			JMP __004962BAh
__004962B5h:
			MOV BYTE PTR [ESP+10h], 0
__004962BAh:
			JMP __004964C1h
CASE__Skill:
			CALL PROC__00496380h
			PUSH EAX
			CALL PROC__004963B3h
			POP EAX
			MOV BYTE PTR [EAX+04h], 1
			MOV BYTE PTR [EAX+05h], 7
			MOV EAX, EDI
			MOV EDX, [EAX]
			CALL [EDX+28h]
			MOV EAX, [EBP]
			MOV EDX, [ESP+0Ch]
			CALL PROC__00498328h
			JMP __004962AAh
CASE__Defend:
			CALL PROC__00496380h
			PUSH EAX
			CALL PROC__004963B3h
			POP EAX
			MOV BYTE PTR [EAX+04h], 0
			MOV BYTE PTR [EAX+05h], 2
			XOR EDX, EDX
			MOV EAX, EDI
			CALL PROC__004C6F9Ch
__00496305h:
			JMP __004962AEh
CASE__Item:
			CALL PROC__00496380h
			PUSH EAX
			CALL PROC__004963B3h
			POP EAX
			MOV BYTE PTR [EAX+04h], 3
			MOV EAX, EDI
			MOV EDX, [EAX]
			CALL [EDX+28h]
			MOV EAX, [EBP]
			CALL PROC__00498598h
			TEST AL, AL
			JZ __004962B5h
			MOV EAX, [EBP]
			MOV EAX, [EAX+4Ch]
			MOV EAX, [EAX+10h]
			MOV BYTE PTR [EAX+05h], 0
__00496337h:
			JMP __00496305h
CASE__Escape:
			MOV EAX, [EBP]
			CALL PROC__00495050h
			TEST AL, AL
			JZ __004963BDh
			CALL PROC__00496380h
			MOV BYTE PTR [EAX+04h], 0
			MOV EDX, [EBP]
			MOV EDX, [EDX+4Ch]
			MOV BYTE PTR [EAX+05h], 6
			MOV BYTE PTR [EDX+50h], 15
			XOR EDX, EDX
			MOV EAX, EDI
			CALL PROC__004C6F9Ch
			JMP __00496337h
CASE__Event:
			CALL PROC__00496380h
			PUSH EAX
			CALL PROC__004963B3h
			POP EAX
			MOV BYTE PTR [EAX+04h], 4
			MOV BYTE PTR [EAX+05h], 7
			JMP __004962FCh
PROC__00496380h:
			MOV EAX, [004CDC7Ch]			; TLcfgSystem
			MOV EAX, [EAX]
			PUSH EAX
			CALL PROC__0048B924h
			MOV EDX, EAX
			POP EAX
			CALL PROC__0048B538h
			MOV EAX, [004CDD60h]
			MOV EAX, [EAX]
			CMP DWORD PTR [EAX+08h], 1
			JE __004963A9h
			MOV EAX, EDI
			MOV EDX, [EAX]
			CALL [EDX+28h]
__004963A9h:
			MOV EAX, [EBP]
			MOV EAX, [EAX+4Ch]
			MOV EAX, [EAX+10h]
			RET
PROC__004963B3h:
			XOR EDX, EDX
			MOV EAX, EDI
			CALL PROC__004C6FBCh
			RET
__004963BDh:
			MOV EAX, [004CDC7Ch]			; TLcfgSystem
			MOV EAX, [EAX]
			PUSH EAX
			CALL PROC__0048BAE4h
			MOV EDX, EAX
			POP EAX
			CALL PROC__0048B538h
			JMP __00496710h

Bytes

83F806 0F8751020000
FF248572624900

8E624900 BF624900 BF624900 E8624900 07634900 39634900 67634900

E8ED000000
50 E81A010000
58 C6400400 C6400500 8B4500 E89A1D0000
84C0 7407
C644241001 EB05
C644241000 E902020000

E8BC000000
50 E8E9000000
58 C6400401 C6400507 8BC7 8B10 FF5228 8B4500 8B54240C E842200000
EBC2

E893000000
50 E8C0000000
58 C6400400 C6400502 33D2 8BC7 E8970C0300
EBA7

E874000000
50 E8A1000000
58 C6400403 8BC7 8B10 FF5228 8B4500 E872220000
84C0 748B
8B4500 8B404C 8B4010 C6400500 EBCC

8B4500 E80FEDFFFF
84C0 7478
E836000000
C6400400 8B5500 8B524C C6400506 C642500F 33D2 8BC7 E8370C0300
EBD0

E814000000
50 E841000000
58 C6400404 C6400507 E97CFFFFFF

A17CDC4C00 8B00 50 E89755FFFF
8BD0 58 E8A351FFFF
A160DD4C00 8B00 83780801 7407
8BC7 8B10 FF5228 8B4500 8B404C 8B4010 C3

33D2 8BC7 E8000C0300 C3

A17CDC4C00 8B00 50 E81A57FFFF
8BD0 58 E86651FFFF E939030000