CIC5167 support

This commit is contained in:
Polprzewodnikowy 2022-10-03 22:31:39 +02:00
parent 567818ce35
commit 9dfdcdc631
3 changed files with 13 additions and 12 deletions

View File

@ -20,6 +20,7 @@ static const ipl3_crc32_t ipl3_crc32[] = {
{ .crc32 = 0x0B050EE0, .seed = 0x78, .version = 0 }, // x103 { .crc32 = 0x0B050EE0, .seed = 0x78, .version = 0 }, // x103
{ .crc32 = 0x98BC2C86, .seed = 0x91, .version = 0 }, // x105 { .crc32 = 0x98BC2C86, .seed = 0x91, .version = 0 }, // x105
{ .crc32 = 0xACC8580A, .seed = 0x85, .version = 0 }, // x106 { .crc32 = 0xACC8580A, .seed = 0x85, .version = 0 }, // x106
{ .crc32 = 0x0E018159, .seed = 0xDD, .version = 0 }, // 5167
{ .crc32 = 0x10C68B18, .seed = 0xDD, .version = 0 }, // NDXJ0 { .crc32 = 0x10C68B18, .seed = 0xDD, .version = 0 }, // NDXJ0
{ .crc32 = 0xBC605D0A, .seed = 0xDD, .version = 0 }, // NDDJ0 { .crc32 = 0xBC605D0A, .seed = 0xDD, .version = 0 }, // NDDJ0
{ .crc32 = 0x502C4466, .seed = 0xDD, .version = 0 }, // NDDJ1 { .crc32 = 0x502C4466, .seed = 0xDD, .version = 0 }, // NDDJ1

View File

@ -226,7 +226,7 @@ if __name__ == '__main__':
except BadBlockError: except BadBlockError:
print(f'Bad ID block [track: {track}, head: {head}, block: {block}]') print(f'Bad ID block [track: {track}, head: {head}, block: {block}]')
if (len(sys.argv) >= 3): if (len(sys.argv) >= 3):
with open(sys.argv[2], 'wb+') as f: with open(sys.argv[2], 'wb') as f:
block_info_table = dd.get_block_info_table() block_info_table = dd.get_block_info_table()
for block in block_info_table: for block in block_info_table:
offset = 0xFFFFFFFF if block == None else block[0] offset = 0xFFFFFFFF if block == None else block[0]

View File

@ -393,7 +393,7 @@ class SC64:
'save_type': self.SaveType(self.__get_config(self.__CfgId.SAVE_TYPE)), 'save_type': self.SaveType(self.__get_config(self.__CfgId.SAVE_TYPE)),
'cic_seed': self.CICSeed(self.__get_config(self.__CfgId.CIC_SEED)), 'cic_seed': self.CICSeed(self.__get_config(self.__CfgId.CIC_SEED)),
'tv_type': self.TVType(self.__get_config(self.__CfgId.TV_TYPE)), 'tv_type': self.TVType(self.__get_config(self.__CfgId.TV_TYPE)),
'dd_sd_mode': bool(self.__get_config(self.__CfgId.DD_SD_MODE)), 'dd_sd_enable': bool(self.__get_config(self.__CfgId.DD_SD_ENABLE)),
'dd_drive_type': self.__DDDriveType(self.__get_config(self.__CfgId.DD_DRIVE_TYPE)), 'dd_drive_type': self.__DDDriveType(self.__get_config(self.__CfgId.DD_DRIVE_TYPE)),
'dd_disk_state': self.__DDDiskState(self.__get_config(self.__CfgId.DD_DISK_STATE)), 'dd_disk_state': self.__DDDiskState(self.__get_config(self.__CfgId.DD_DISK_STATE)),
'button_state': bool(self.__get_config(self.__CfgId.BUTTON_STATE)), 'button_state': bool(self.__get_config(self.__CfgId.BUTTON_STATE)),
@ -571,7 +571,7 @@ class SC64:
print(packet.decode('UTF-8', errors='backslashreplace'), end='') print(packet.decode('UTF-8', errors='backslashreplace'), end='')
elif (datatype == self.__DebugDatatype.RAWBINARY): elif (datatype == self.__DebugDatatype.RAWBINARY):
filename = self.__generate_filename('binaryout', 'bin') filename = self.__generate_filename('binaryout', 'bin')
with open(filename, 'wb+') as f: with open(filename, 'wb') as f:
f.write(packet) f.write(packet)
print(f'Wrote {len(packet)} bytes to {filename}') print(f'Wrote {len(packet)} bytes to {filename}')
elif (datatype == self.__DebugDatatype.HEADER): elif (datatype == self.__DebugDatatype.HEADER):
@ -658,7 +658,7 @@ class SC64:
break break
if (dd): if (dd):
self.__set_config(self.__CfgId.DD_MODE, self.__DDMode.FULL) self.__set_config(self.__CfgId.DD_MODE, self.__DDMode.FULL)
self.__set_config(self.__CfgId.DD_SD_MODE, False) self.__set_config(self.__CfgId.DD_SD_ENABLE, False)
self.__set_config(self.__CfgId.DD_DRIVE_TYPE, { self.__set_config(self.__CfgId.DD_DRIVE_TYPE, {
'retail': self.__DDDriveType.RETAIL, 'retail': self.__DDDriveType.RETAIL,
'development': self.__DDDriveType.DEVELOPMENT 'development': self.__DDDriveType.DEVELOPMENT
@ -760,20 +760,20 @@ if __name__ == '__main__':
sc64 = SC64() sc64 = SC64()
if (args.backup_firmware): if (args.backup_firmware):
with open(args.backup_firmware, 'wb+') as f: with open(args.backup_firmware, 'wb') as f:
print('Generating backup, this might take a while... ', end='', flush=True) print('Generating backup, this might take a while... ', end='', flush=True)
f.write(sc64.backup_firmware()) f.write(sc64.backup_firmware())
print('done') print('done')
if (args.update_firmware): if (args.update_firmware):
with open(args.update_firmware, 'rb+') as f: with open(args.update_firmware, 'rb') as f:
print('Updating firmware, this might take a while... ', end='', flush=True) print('Updating firmware, this might take a while... ', end='', flush=True)
status_callback = lambda status: print(f'{status} ', end='', flush=True) status_callback = lambda status: print(f'{status} ', end='', flush=True)
sc64.update_firmware(f.read(), status_callback) sc64.update_firmware(f.read(), status_callback)
print('done') print('done')
if (args.bootloader): if (args.bootloader):
with open(args.bootloader, 'rb+') as f: with open(args.bootloader, 'rb') as f:
print('Uploading Bootloader... ', end='', flush=True) print('Uploading Bootloader... ', end='', flush=True)
sc64.upload_bootloader(f.read()) sc64.upload_bootloader(f.read())
print('done') print('done')
@ -808,7 +808,7 @@ if __name__ == '__main__':
print(f'RTC set to [{value.strftime("%Y-%m-%d %H:%M:%S")}]') print(f'RTC set to [{value.strftime("%Y-%m-%d %H:%M:%S")}]')
if (args.rom): if (args.rom):
with open(args.rom, 'rb+') as f: with open(args.rom, 'rb') as f:
print('Uploading ROM... ', end='', flush=True) print('Uploading ROM... ', end='', flush=True)
sc64.upload_rom(f.read(), use_shadow=args.no_shadow) sc64.upload_rom(f.read(), use_shadow=args.no_shadow)
print('done') print('done')
@ -818,13 +818,13 @@ if __name__ == '__main__':
print(f'Save type set to [{args.save_type.name}]') print(f'Save type set to [{args.save_type.name}]')
if (args.save): if (args.save):
with open(args.save, 'rb+') as f: with open(args.save, 'rb') as f:
print('Uploading save... ', end='', flush=True) print('Uploading save... ', end='', flush=True)
sc64.upload_save(f.read()) sc64.upload_save(f.read())
print('done') print('done')
if (args.ddipl): if (args.ddipl):
with open(args.ddipl, 'rb+') as f: with open(args.ddipl, 'rb') as f:
print('Uploading 64DD IPL... ', end='', flush=True) print('Uploading 64DD IPL... ', end='', flush=True)
sc64.upload_ddipl(f.read()) sc64.upload_ddipl(f.read())
print('done') print('done')
@ -833,13 +833,13 @@ if __name__ == '__main__':
sc64.debug_loop(isv=args.isv, disks=args.disk) sc64.debug_loop(isv=args.isv, disks=args.disk)
if (args.backup_save): if (args.backup_save):
with open(args.backup_save, 'wb+') as f: with open(args.backup_save, 'wb') as f:
print('Downloading save... ', end='', flush=True) print('Downloading save... ', end='', flush=True)
f.write(sc64.download_save()) f.write(sc64.download_save())
print('done') print('done')
if (args.download_memory): if (args.download_memory):
with open(args.download_memory, 'wb+') as f: with open(args.download_memory, 'wb') as f:
print('Downloading memory... ', end='', flush=True) print('Downloading memory... ', end='', flush=True)
f.write(sc64.download_memory()) f.write(sc64.download_memory())
print('done') print('done')