def gen_rodata_section(self): self.gen_line('.rodata . : AT(romPos) SUBALIGN(16)') self.gen_open_block() for file in self.files: f = file[0] if f not in LATE_DATA_FILES: self.gen_line(f + '(.rodata);') fname = f[f.rindex('/') + 1:f.rindex('.')] testName = DATA_DIR + '/' + fname + '.rodata.s' if FileUtil.does_file_exist(testName): self.gen_line(BUILD_DIR + '/data/' + fname + '.rodata.o(.rodata);') for f in LATE_DATA_FILES: self.gen_line(f + '(.rodata);') fname = f[f.rindex('/') + 1:f.rindex('.')] testName = DATA_DIR + '/' + fname + '.rodata.s' if FileUtil.does_file_exist(testName): self.gen_line(BUILD_DIR + '/data/' + fname + '.rodata.o(.rodata);') self.gen_close_block() self.gen_line('romPos += SIZEOF(.rodata);') self.gen_newline()
extractConfigsDirectory = './extract-ver' assetsDirectory = './assets' ucodeDirectory = './assets' extractConfigFilename = extractConfigsDirectory + '/' + version + '.config.json' configChecksumFilename = extractConfigFilename + '.md5' needToExtract = False def do_extraction(reason): global needToExtract needToExtract = True print(reason) if not FileUtil.does_file_exist(assetsDirectory): do_extraction("Extracting because /assets/ directory does not exist.") elif not FileUtil.does_file_exist(ucodeDirectory): do_extraction("Extracting because /ucode/ directory does not exist.") elif not FileUtil.does_file_exist(configChecksumFilename): do_extraction('Extracting because "' + configChecksumFilename + '" does not exist.') else: md5Calculated = hashlib.md5( FileUtil.get_bytes_from_file(extractConfigFilename)).hexdigest() md5Saved = FileUtil.get_text_from_file(configChecksumFilename) if md5Calculated != md5Saved: do_extraction('Extracting because "' + extractConfigFilename + '" has changed.')