Updated nintendo_ds.py and main.py

main.py - added `Game revision` (DSi only) and info pages.
nintendo_ds.py - added `gamerevision` and `region`
This commit is contained in:
Yuuki Chan 2023-10-22 17:13:56 +09:00
parent fe72c33c5e
commit 3b7e291904
2 changed files with 28 additions and 1 deletions

View file

@ -22,6 +22,12 @@ def nds_get_info(opt: str, inf: BinaryIO):
case 'devicecapacity':
inf.seek(0x014)
return _capacity_lookup(int.from_bytes(inf.read(1), 'little'))
case 'gamerevision':
inf.seek(0x01C)
return str(int.from_bytes(inf.read(2), 'little'))
case 'region':
inf.seek(0x01D)
return _region_lookup(int.from_bytes(inf.read(1), 'little'))
case _:
return 'Unknown'
@ -53,3 +59,15 @@ def _capacity_lookup(code: int) -> str: # 512Mbit (67108864 bytes) (09h)
return '{} MB ({})'.format(round(128 * pow(2, code) / 1024), '{}h'.format(str(code).zfill(2)))
case _:
return 'Unknown ({})'.format(code)
def _region_lookup(code: int) -> str:
match code:
case 0:
return 'All (0x00 (0))'
case 64:
return 'Korea (0x40 (64))'
case 128:
return 'China (0x80 (128))'
case _:
return 'Unknown ({})'.format(code)