def init_iso_data(self): print ("parsing iso") self.input_iso_file = IsoFS(self.input_iso_path) self.input_iso_file.read_iso() print("getting rom") rom_file = self.input_iso_file.get_file_from_path('SLUS_209.11;1') self.rom = Rom(rom_file) if not os.path.exists('out'): os.mkdir('out') if not os.path.exists('out/old_DDS3.DDT'): print("getting ddt") ddt_file = self.input_iso_file.get_file_from_path('DDS3.DDT;1') with open('out/old_DDS3.DDT', 'wb') as file: file.write(ddt_file.read()) if not os.path.exists('out/old_DDS3.IMG'): print("getting file system img") with open('out/old_DDS3.IMG', 'wb') as file: for chunk in self.input_iso_file.read_file_in_chunks('DDS3.IMG;1'): file.write(chunk) print("parsing dds3 fs") self.dds3 = DDS3FS('out/old_DDS3.DDT', 'out/old_DDS3.IMG') self.dds3.read_dds3()
def __init__(self, debug, graphicsScale): self.rom = Rom() self.gpu = Gpu(graphicsScale) self.cpu = Cpu(self.gpu) self.gpu.setCpu(self.cpu) self.debugger = None self.debugger = Debugger(self.cpu) if True == debug: self.debugger.activate()
def Run(self) -> None: (input_path, input_full_filename) = os.path.split(self.input_filename) (input_filename, input_extension) = os.path.splitext(input_full_filename) output_filename = os.path.join( self.output_location or input_path, "%s-randomized-%d%s" % (input_filename, self.seed, input_extension or ".nes")) output_rom = Rom(output_filename, src=self.input_filename) output_rom.OpenFile(write_mode=True) patch = self._GetPatch() for address in patch.GetAddresses(): data: List[int] data = patch.GetData(address) output_rom.WriteBytes(address, data)
#! /usr/bin/env python3 # coding=utf-8 """" :author joelcostamagna created on 2018-03-09 14:55 :version 0.1 """ from bus import Bus from Cpu import Cpu from rom import Rom if __name__ == '__main__': # Creation du bus a la base de l ’ ordinateur pour les communications bus = Bus() # Creation du cpu en le reliant au bus cpu = Cpu(bus) # Creation de la rom en la reliant au bus rom = Rom( bus ) # Creation du GUI # Connexion du GUI aux composants # Boucle sans fin du programme
label = f"pcm_{addr:X}" # find in E and J pat = mf_u.read_bytes(addr, size) addr_e = mf_e.find_bytes(pat) addr_j = mf_j.find_bytes(pat) ad = {"U": addr, "E": addr_e, "J": addr_j} y = yaml_data_entry(desc, label, "PcmSample", ad, None, size) print(y) if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("rom_dir", type=str) parser.add_argument("-g", "--game", type=str, choices=["mf", "zm"]) parser.add_argument("-r", "--region", type=str, choices=["U", "E", "J"]) args = parser.parse_args() # read rom files games = [args.game] if args.game else GAMES regions = [args.region] if args.region else REGIONS roms = {} for game in games: roms[game] = {} for region in regions: name = f"{game}_{region}.gba".lower() path = os.path.join(args.rom_dir, name) rom = Rom(path) roms[game][region] = rom dump_room_sprites(roms)
import logging import sys from memory import Memory from rom import Rom mem = Memory() romF = Rom() def init(): logging.basicConfig(level=logging.DEBUG) # inicializar memoria # mem = Memory() # abrir archivo de bios with open("bios.rom", mode="rb") as biosFile: boot = biosFile.read() # b para binario??? logging.debug("print boot") logging.debug(boot) # mem.load(boot, "C000") mem.load(boot, 49152) init() logging.debug("initializing...") logging.debug("init done...") logging.debug("Loading ROM...") if sys.argv[1]: logging.debug("argument supplied %s" % sys.argv[1])
from rom import Rom romFil = open("OJD-rom.csv", "r") alleRom = [] for linje in romFil : romData = linje.split(",") nyttRom = Rom(int(romData[0]), romData[1], romData[2], int(romData[3])) alleRom.append(nyttRom) for rom in alleRom : if rom.passer(8, "Linux"): rom.skrivLinje()
def __init__(self, data=None, fromq=None, toq=None): self.ram = Ram(32768, fromq, toq) self.rom = Rom(32768, data=data) self.register_a = Register() self.register_d = Register() self.program_counter = Register()
local_sprites.append(OWSprite(file)) return local_sprites try: asar.init(dll_path='./asar.dll') except OSError: print('asar.dll wasn\'t found') exit(-1) if len(sys.argv) == 1: romname = input('Insert the name of your rom here:\n') else: romname = sys.argv[1] rom = Rom(romname) try: rom.autoclean_rom('./global_ow_code/autoclean_routines.asm') routines = create_routines() sprites = create_sprites() m = open('./global_ow_code/routines.asm', 'w') with open('./global_ow_code/autoclean_routines.asm', 'w') as f, \ open('./global_ow_code/_OverworldInitPtr.bin', 'wb') as init_table, \ open('./global_ow_code/_OverworldMainPtr.bin', 'wb') as main_table: for routine in routines: routine.patch_routine(rom) f.write(routine.create_autoclean()) m.write(routine.create_macro()) m.close() for sprite in sprites: sprite.patch_sprite(rom)