Keyboard Observator

Catch the entire keyboard's state at every frame the engine's map-screen is active and save the keys to variables #4001~#4256, this process will not start until variable #4256 is initialized in memory by setting it or a higher one to some value by event-command.

All variables in said area will have values of either 0 (not toggled or pressed), 1 (toggled), 128 (pressed) or 129 (toggled and pressed).

Originally made and first released by KotatsuAkira.

[Compatibility Warning] Do not use in combination with ExtendedKeyInput!

RPG2000
1.00UNKNOWN2000-05-072000-06-192000-07-112000-11-132000-11-152000-12-27
1.07
2001-05-05
1.10
2003-03-27
1.50
2003-06-25
1.51/1.52
2015-07-05
1.60
2015-09-15
1.61
2017-09-14
1.62
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/2

Offsets

RPG2000
2000-12-27
1.07
2001-05-05
1.10
2003-03-27
1.50
2003-06-25
1.51/1.52
2015-07-05
1.60
2015-09-15
1.61
2017-09-14
1.62
0047B758h
0007AB58h
0047B668h
0007AA68h
004805C0h
0007F9C0h
004806DCh
0007FADCh
00481488h
00080888h
00481E58h
00081258h
00481FD8h
000813D8h

Sourcecode

			CALL PROC__CatchKBState			; 00485BECh
			CALL PROC__CatchKBState			; 00485AFCh
			CALL PROC__CatchKBState			; 0048AB4Ch
			CALL PROC__CatchKBState			; 0048AC68h
			CALL PROC__CatchKBState			; 004894D8h
			CALL PROC__CatchKBState			; 00489EA8h
			CALL PROC__CatchKBState			; 0048C570h

Bytes

E88FA40000
E88FA40000
E887A50000
E887A50000
E84B800000
E84B800000
E893A50000

Segment 2/2

Offsets

RPG2000
2000-12-27
1.07
2001-05-05
1.10
2003-03-27
1.50
2003-06-25
1.51/1.52
2015-07-05
1.60
2015-09-15
1.61
2017-09-14
1.62
00485BB8h
00084FB8h
00485AC8h
00084EC8h
0048AB18h
00089F18h
0048AC34h
0008A034h
004894A4h
000888A4h
00489E74h
00089274h
0048C53Ch
0008B93Ch

Sourcecode

			PUSH ESI
			XOR ESI, ESI
			TEST DL, DL
			JZ __00485C5Ah
			CMP BYTE PTR [EAX+10h], 0
			JZ __SkipFirsts
			PUSH EDI
			MOV EDI, ESI
			INC EDI
			MOV ECX, EDI
__KeysLoop:
			MOV EDX, [0049AA04h]
			MOV EDX, [EDX]
			TEST BYTE PTR [EDX+15Eh], CL
			JE __DontSet
			MOV ESI, EDI
__DontSet:
			INC EDI
			SHL ECX, 1
			CMP ECX, 8
			JLE __KeysLoop
			POP EDI
			JMP __SkipFirsts
PROC__CatchKBState:
			MOV EAX, [0049ABA4h]			; TLcfgSystem
			MOV EAX, [EAX]
			CMP DWORD PTR [EAX+24h], 4256		; Does Variable 4256 exist?
			JB __SkipKBState
			MOV EAX, [EAX+28h]			; Variables Array
			ADD EAX, 16000				; Point to Address of Variable 4001
			PUSH EAX
			PUSH EAX
			CALL PROC__0040688Ch			; user32::GetKeyboardState
			POP EAX
			XOR ECX, ECX
			MOV CL, 255
__LoopRebuild:
			MOVZX EDX, BYTE PTR [EAX+ECX]
			MOV DWORD PTR [EAX+ECX*4], EDX
			DEC ECX
			JGE __LoopRebuild
__SkipKBState:
			MOV EAX, [0049ADF8h]
			RET
			NOP
__SkipFirsts:
			(...)
			PUSH ESI
			XOR ESI, ESI
			TEST DL, DL
			JZ __00485B6Ah
			CMP BYTE PTR [EAX+10h], 0
			JZ __SkipFirsts
			PUSH EDI
			MOV EDI, ESI
			INC EDI
			MOV ECX, EDI
__KeysLoop:
			MOV EDX, [0049AA04h]
			MOV EDX, [EDX]
			TEST BYTE PTR [EDX+15Eh], CL
			JE __DontSet
			MOV ESI, EDI
__DontSet:
			INC EDI
			SHL ECX, 1
			CMP ECX, 8
			JLE __KeysLoop
			POP EDI
			JMP __SkipFirsts
PROC__CatchKBState:
			MOV EAX, [0049ABA4h]			; TLcfgSystem
			MOV EAX, [EAX]
			CMP DWORD PTR [EAX+24h], 4256		; Does Variable 4256 exist?
			JB __SkipKBState
			MOV EAX, [EAX+28h]			; Variables Array
			ADD EAX, 16000				; Point to Address of Variable 4001
			PUSH EAX
			PUSH EAX
			CALL PROC__0040688Ch			; user32::GetKeyboardState
			POP EAX
			XOR ECX, ECX
			MOV CL, 255
__LoopRebuild:
			MOVZX EDX, BYTE PTR [EAX+ECX]
			MOV DWORD PTR [EAX+ECX*4], EDX
			DEC ECX
			JGE __LoopRebuild
__SkipKBState:
			MOV EAX, [0049ADF8h]
			RET
			NOP
__SkipFirsts:
			(...)
			PUSH ESI
			XOR ESI, ESI
			TEST DL, DL
			JZ __0048AC51h
			CMP BYTE PTR [EAX+10h], 0
			JZ __SkipFirsts
			PUSH EDI
			MOV EDI, ESI
			INC EDI
			MOV ECX, EDI
__KeysLoop:
			MOV EDX, [0049FA04h]
			MOV EDX, [EDX]
			TEST BYTE PTR [EDX+15Eh], CL
			JE __DontSet
			MOV ESI, EDI
__DontSet:
			INC EDI
			SHL ECX, 1
			CMP ECX, 8
			JLE __KeysLoop
			POP EDI
			JMP __SkipFirsts
PROC__CatchKBState:
			MOV EAX, [0049FB8Ch]			; TLcfgSystem
			MOV EAX, [EAX]
			CMP DWORD PTR [EAX+24h], 4256		; Does Variable 4256 exist?
			JB __SkipKBState
			MOV EAX, [EAX+28h]			; Variables Array
			ADD EAX, 16000				; Point to Address of Variable 4001
			PUSH EAX
			PUSH EAX
			CALL PROC__004068ACh			; user32::GetKeyboardState
			POP EAX
			XOR ECX, ECX
			MOV CL, 255
__LoopRebuild:
			MOVZX EDX, BYTE PTR [EAX+ECX]
			MOV DWORD PTR [EAX+ECX*4], EDX
			DEC ECX
			JGE __LoopRebuild
__SkipKBState:
			MOV EAX, [0049FDD0h]
			RET
			NOP
__SkipFirsts:
			(...)
			PUSH ESI
			XOR ESI, ESI
			TEST DL, DL
			JZ __0048AD6Dh
			CMP BYTE PTR [EAX+10h], 0
			JZ __SkipFirsts
			PUSH EDI
			MOV EDI, ESI
			INC EDI
			MOV ECX, EDI
__KeysLoop:
			MOV EDX, [0049FA04h]
			MOV EDX, [EDX]
			TEST BYTE PTR [EDX+15Eh], CL
			JE __DontSet
			MOV ESI, EDI
__DontSet:
			INC EDI
			SHL ECX, 1
			CMP ECX, 8
			JLE __KeysLoop
			POP EDI
			JMP __SkipFirsts
PROC__CatchKBState:
			MOV EAX, [0049FB8Ch]			; TLcfgSystem
			MOV EAX, [EAX]
			CMP DWORD PTR [EAX+24h], 4256		; Does Variable 4256 exist?
			JB __SkipKBState
			MOV EAX, [EAX+28h]			; Variables Array
			ADD EAX, 16000				; Point to Address of Variable 4001
			PUSH EAX
			PUSH EAX
			CALL PROC__004068B4h			; user32::GetKeyboardState
			POP EAX
			XOR ECX, ECX
			MOV CL, 255
__LoopRebuild:
			MOVZX EDX, BYTE PTR [EAX+ECX]
			MOV DWORD PTR [EAX+ECX*4], EDX
			DEC ECX
			JGE __LoopRebuild
__SkipKBState:
			MOV EAX, [0049FDD0h]
			RET
			NOP
__SkipFirsts:
			(...)
			PUSH ESI
			XOR ESI, ESI
			TEST DL, DL
			JZ __004895DDh
			CMP BYTE PTR [EAX+10h], 0
			JZ __SkipFirsts
			PUSH EDI
			MOV EDI, ESI
			INC EDI
			MOV ECX, EDI
__KeysLoop:
			MOV EDX, [0049FA04h]
			MOV EDX, [EDX]
			TEST BYTE PTR [EDX+15Eh], CL
			JE __DontSet
			MOV ESI, EDI
__DontSet:
			INC EDI
			SHL ECX, 1
			CMP ECX, 8
			JLE __KeysLoop
			POP EDI
			JMP __SkipFirsts
PROC__CatchKBState:
			MOV EAX, [0049FB8Ch]			; TLcfgSystem
			MOV EAX, [EAX]
			CMP DWORD PTR [EAX+24h], 4256		; Does Variable 4256 exist?
			JB __SkipKBState
			MOV EAX, [EAX+28h]			; Variables Array
			ADD EAX, 16000				; Point to Address of Variable 4001
			PUSH EAX
			PUSH EAX
			CALL PROC__004068BCh			; user32::GetKeyboardState
			POP EAX
			XOR ECX, ECX
			MOV CL, 255
__LoopRebuild:
			MOVZX EDX, BYTE PTR [EAX+ECX]
			MOV DWORD PTR [EAX+ECX*4], EDX
			DEC ECX
			JGE __LoopRebuild
__SkipKBState:
			MOV EAX, [0049FDD0h]
			RET
			NOP
__SkipFirsts:
			(...)
			PUSH ESI
			XOR ESI, ESI
			TEST DL, DL
			JZ __00489FADh
			CMP BYTE PTR [EAX+10h], 0
			JZ __SkipFirsts
			PUSH EDI
			MOV EDI, ESI
			INC EDI
			MOV ECX, EDI
__KeysLoop:
			MOV EDX, [004A0A04h]
			MOV EDX, [EDX]
			TEST BYTE PTR [EDX+15Eh], CL
			JE __DontSet
			MOV ESI, EDI
__DontSet:
			INC EDI
			SHL ECX, 1
			CMP ECX, 8
			JLE __KeysLoop
			POP EDI
			JMP __SkipFirsts
PROC__CatchKBState:
			MOV EAX, [004A0B8Ch]			; TLcfgSystem
			MOV EAX, [EAX]
			CMP DWORD PTR [EAX+24h], 4256		; Does Variable 4256 exist?
			JB __SkipKBState
			MOV EAX, [EAX+28h]			; Variables Array
			ADD EAX, 16000				; Point to Address of Variable 4001
			PUSH EAX
			PUSH EAX
			CALL PROC__004068D0h			; user32::GetKeyboardState
			POP EAX
			XOR ECX, ECX
			MOV CL, 255
__LoopRebuild:
			MOVZX EDX, BYTE PTR [EAX+ECX]
			MOV DWORD PTR [EAX+ECX*4], EDX
			DEC ECX
			JGE __LoopRebuild
__SkipKBState:
			MOV EAX, [004A0DD0h]
			RET
			NOP
__SkipFirsts:
			(...)
			PUSH ESI
			XOR ESI, ESI
			TEST DL, DL
			JZ __0048C675h
			CMP BYTE PTR [EAX+10h], 0
			JZ __SkipFirsts
			PUSH EDI
			MOV EDI, ESI
			INC EDI
			MOV ECX, EDI
__KeysLoop:
			MOV EDX, [004A0A04h]
			MOV EDX, [EDX]
			TEST BYTE PTR [EDX+15Eh], CL
			JE __DontSet
			MOV ESI, EDI
__DontSet:
			INC EDI
			SHL ECX, 1
			CMP ECX, 8
			JLE __KeysLoop
			POP EDI
			JMP __SkipFirsts
PROC__CatchKBState:
			MOV EAX, [004A0B8Ch]			; TLcfgSystem
			MOV EAX, [EAX]
			CMP DWORD PTR [EAX+24h], 4256		; Does Variable 4256 exist?
			JB __SkipKBState
			MOV EAX, [EAX+28h]			; Variables Array
			ADD EAX, 16000				; Point to Address of Variable 4001
			PUSH EAX
			PUSH EAX
			CALL PROC__004068D0h			; user32::GetKeyboardState
			POP EAX
			XOR ECX, ECX
			MOV CL, 255
__LoopRebuild:
			MOVZX EDX, BYTE PTR [EAX+ECX]
			MOV DWORD PTR [EAX+ECX*4], EDX
			DEC ECX
			JGE __LoopRebuild
__SkipKBState:
			MOV EAX, [004A0DD0h]
			RET
			NOP
__SkipFirsts:
			(...)

Bytes

56 31F6 84D2 0F8497000000 80781000 7558
57 89F7 47 89F9 8B1504AA4900 8B12 848A5E010000 7402
89FE 47 D1E1 83F908 7EE6
5F EB35 A1A4AB4900 8B00 817824A0100000 721E
8B4028 05803E0000 50 50 E8810CF8FF
58 31C9 B1FF 0FB61408 891488 49 7DF6
A1F8AD4900 C3 90
56 31F6 84D2 0F8497000000 80781000 7558
57 89F7 47 89F9 8B1504AA4900 8B12 848A5E010000 7402
89FE 47 D1E1 83F908 7EE6
5F EB35 A1A4AB4900 8B00 817824A0100000 721E
8B4028 05803E0000 50 50 E8710DF8FF
58 31C9 B1FF 0FB61408 891488 49 7DF6
A1F8AD4900 C3 90
56 31F6 84D2 0F842E010000 80781000 7558
57 89F7 47 89F9 8B1504FA4900 8B12 848A5E010000 7402
89FE 47 D1E1 83F908 7EE6
5F EB35 A18CFB4900 8B00 817824A0100000 721E
8B4028 05803E0000 50 50 E841BDF7FF
58 31C9 B1FF 0FB61408 891488 49 7DF6
A1D0FD4900 C3 90
56 31F6 84D2 0F842E010000 80781000 7558
57 89F7 47 89F9 8B1504FA4900 8B12 848A5E010000 7402
89FE 47 D1E1 83F908 7EE6
5F EB35 A18CFB4900 8B00 817824A0100000 721E
8B4028 05803E0000 50 50 E82DBCF7FF
58 31C9 B1FF 0FB61408 891488 49 7DF6
A1D0FD4900 C3 90
56 31F6 84D2 0F842E010000 80781000 7558
57 89F7 47 89F9 8B1504FA4900 8B12 848A5E010000 7402
89FE 47 D1E1 83F908 7EE6
5F EB35 A18CFB4900 8B00 817824A0100000 721E
8B4028 05803E0000 50 50 E8C5D3F7FF
58 31C9 B1FF 0FB61408 891488 49 7DF6
A1D0FD4900 C3 90
56 31F6 84D2 0F842E010000 80781000 7558
57 89F7 47 89F9 8B15040A4A00 8B12 848A5E010000 7402
89FE 47 D1E1 83F908 7EE6
5F EB35 A18C0B4A00 8B00 817824A0100000 721E
8B4028 05803E0000 50 50 E809CAF7FF
58 31C9 B1FF 0FB61408 891488 49 7DF6
A1D00D4A00 C3 90
56 31F6 84D2 0F842E010000 80781000 7558
57 89F7 47 89F9 8B15040A4A00 8B12 848A5E010000 7402
89FE 47 D1E1 83F908 7EE6
5F EB35 A18C0B4A00 8B00 817824A0100000 721E
8B4028 05803E0000 50 50 E841A3F7FF
58 31C9 B1FF 0FB61408 891488 49 7DF6
A1D00D4A00 C3 90