Updated main.py and added nintendo_switch.py and super_famicom.py, both W.I.P.

This commit is contained in:
Yuuki Chan 2024-05-28 21:06:41 +09:00
parent b344c6c05a
commit aa584d5dc4
3 changed files with 58 additions and 0 deletions

View file

@ -0,0 +1,34 @@
from typing import BinaryIO
# TODO: Implement hactool to fetch more XCI info
def switch_get_info(opt: str, inf: BinaryIO):
match opt.lower():
case 'title':
inf.seek(0x1000)
return inf.read(0x100)
case 'capacity':
inf.seek(0x10D)
return _get_rom_size(inf.read(0x1))
case 'magic':
inf.seek(0x100)
return inf.read(0x4)
def _get_rom_size(size):
match size:
case b'\xfa':
return '1 GB ({})'.format(size)
case b'\xf8':
return '2 GB ({})'.format(size)
case b'\xf0':
return '4 GB ({})'.format(size)
case b'\xe0':
return '8 GB ({})'.format(size)
case b'\xe1':
return '16 GB ({})'.format(size)
case b'\xe2':
return '32 GB ({})'.format(size)
case _:
return size

10
rominfo/super_famicom.py Normal file
View file

@ -0,0 +1,10 @@
from typing import BinaryIO
def sfc_get_info(opt: str, inf: BinaryIO):
match opt:
case 'title':
inf.seek(4016)
return inf.read(2)
case _:
return 'Unknown'