From 9dfdcdc631c39020adb9fce62f10d471ee63af5b Mon Sep 17 00:00:00 2001 From: Polprzewodnikowy Date: Mon, 3 Oct 2022 22:31:39 +0200 Subject: [PATCH] CIC5167 support --- sw/bootloader/src/boot.c | 1 + sw/pc/dd64.py | 2 +- sw/pc/sc64.py | 22 +++++++++++----------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/sw/bootloader/src/boot.c b/sw/bootloader/src/boot.c index 660fb39..0b540d4 100644 --- a/sw/bootloader/src/boot.c +++ b/sw/bootloader/src/boot.c @@ -20,6 +20,7 @@ static const ipl3_crc32_t ipl3_crc32[] = { { .crc32 = 0x0B050EE0, .seed = 0x78, .version = 0 }, // x103 { .crc32 = 0x98BC2C86, .seed = 0x91, .version = 0 }, // x105 { .crc32 = 0xACC8580A, .seed = 0x85, .version = 0 }, // x106 + { .crc32 = 0x0E018159, .seed = 0xDD, .version = 0 }, // 5167 { .crc32 = 0x10C68B18, .seed = 0xDD, .version = 0 }, // NDXJ0 { .crc32 = 0xBC605D0A, .seed = 0xDD, .version = 0 }, // NDDJ0 { .crc32 = 0x502C4466, .seed = 0xDD, .version = 0 }, // NDDJ1 diff --git a/sw/pc/dd64.py b/sw/pc/dd64.py index bd1e75b..d16aac3 100755 --- a/sw/pc/dd64.py +++ b/sw/pc/dd64.py @@ -226,7 +226,7 @@ if __name__ == '__main__': except BadBlockError: print(f'Bad ID block [track: {track}, head: {head}, block: {block}]') 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() for block in block_info_table: offset = 0xFFFFFFFF if block == None else block[0] diff --git a/sw/pc/sc64.py b/sw/pc/sc64.py index 8e7da1f..60ad7a9 100755 --- a/sw/pc/sc64.py +++ b/sw/pc/sc64.py @@ -393,7 +393,7 @@ class SC64: 'save_type': self.SaveType(self.__get_config(self.__CfgId.SAVE_TYPE)), 'cic_seed': self.CICSeed(self.__get_config(self.__CfgId.CIC_SEED)), '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_disk_state': self.__DDDiskState(self.__get_config(self.__CfgId.DD_DISK_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='') elif (datatype == self.__DebugDatatype.RAWBINARY): filename = self.__generate_filename('binaryout', 'bin') - with open(filename, 'wb+') as f: + with open(filename, 'wb') as f: f.write(packet) print(f'Wrote {len(packet)} bytes to {filename}') elif (datatype == self.__DebugDatatype.HEADER): @@ -658,7 +658,7 @@ class SC64: break if (dd): 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, { 'retail': self.__DDDriveType.RETAIL, 'development': self.__DDDriveType.DEVELOPMENT @@ -760,20 +760,20 @@ if __name__ == '__main__': sc64 = SC64() 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) f.write(sc64.backup_firmware()) print('done') 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) status_callback = lambda status: print(f'{status} ', end='', flush=True) sc64.update_firmware(f.read(), status_callback) print('done') if (args.bootloader): - with open(args.bootloader, 'rb+') as f: + with open(args.bootloader, 'rb') as f: print('Uploading Bootloader... ', end='', flush=True) sc64.upload_bootloader(f.read()) print('done') @@ -808,7 +808,7 @@ if __name__ == '__main__': print(f'RTC set to [{value.strftime("%Y-%m-%d %H:%M:%S")}]') if (args.rom): - with open(args.rom, 'rb+') as f: + with open(args.rom, 'rb') as f: print('Uploading ROM... ', end='', flush=True) sc64.upload_rom(f.read(), use_shadow=args.no_shadow) print('done') @@ -818,13 +818,13 @@ if __name__ == '__main__': print(f'Save type set to [{args.save_type.name}]') if (args.save): - with open(args.save, 'rb+') as f: + with open(args.save, 'rb') as f: print('Uploading save... ', end='', flush=True) sc64.upload_save(f.read()) print('done') if (args.ddipl): - with open(args.ddipl, 'rb+') as f: + with open(args.ddipl, 'rb') as f: print('Uploading 64DD IPL... ', end='', flush=True) sc64.upload_ddipl(f.read()) print('done') @@ -833,13 +833,13 @@ if __name__ == '__main__': sc64.debug_loop(isv=args.isv, disks=args.disk) 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) f.write(sc64.download_save()) print('done') 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) f.write(sc64.download_memory()) print('done')