mirror of
https://github.com/JesseTG/melonds-ds.git
synced 2024-11-23 14:40:04 +00:00
Fix the cheat test
This commit is contained in:
parent
2cb4e55b8a
commit
5ea67dec7d
@ -1,20 +1,24 @@
|
||||
from sys import argv
|
||||
from libretro import default_session, RETRO_MEMORY_SYSTEM_RAM
|
||||
from libretro import Session
|
||||
from libretro.h import RETRO_MEMORY_SYSTEM_RAM
|
||||
|
||||
with default_session(argv[1]) as session:
|
||||
import prelude
|
||||
|
||||
session: Session
|
||||
with prelude.session() as session:
|
||||
memory = session.core.get_memory(RETRO_MEMORY_SYSTEM_RAM)
|
||||
|
||||
assert memory is not None
|
||||
|
||||
session.core.cheat_set(0, True, b'02000000-DEADBEEF')
|
||||
session.core.cheat_set(0, True, b'02000000 DEADBEEF')
|
||||
# A trivial cheat code with one instruction: 0XXXXXXX-YYYYYYYY,
|
||||
# where XXXXXXX (in this case, 02000000) is the address to write to
|
||||
# and YYYYYYYY (in this case, DEADBEEF) is the value to write.
|
||||
# See https://mgba-emu.github.io/gbatek/#dscartcheatactionreplayds for more details
|
||||
|
||||
assert memory[0:4].tobytes() == b'\xde\xad\xbe\xef'
|
||||
# Slicing reads the bytes in sequence, not as a word
|
||||
assert memory[0:4].tobytes() == b'\xef\xbe\xad\xde'
|
||||
|
||||
session.core.cheat_set(0, False, b'02000000-CAFEBABE')
|
||||
session.core.cheat_set(0, False, b'02000000 CAFEBABE')
|
||||
|
||||
assert memory[0:4].tobytes() == b'\xde\xad\xbe\xef'
|
||||
assert memory[0:4].tobytes() == b'\xef\xbe\xad\xde'
|
||||
# Passing False to enabled shouldn't apply the cheat
|
||||
|
Loading…
Reference in New Issue
Block a user