public GBA(CoreComm comm, byte[] file) { ServiceProvider = new BasicServiceProvider(this); Tracer = new TraceBuffer { Header = " -Addr--- -Opcode- -Instruction------------------- -R0----- -R1----- -R2----- -R3----- -R4----- -R5----- -R6----- -R7----- -R8----- -R9----- -R10---- -R11---- -R12---- -R13(SP) -R14(LR) -R15(PC) -CPSR--- -SPSR---" }; (ServiceProvider as BasicServiceProvider).Register <ITraceable>(Tracer); CoreComm = comm; comm.VsyncNum = 262144; comm.VsyncDen = 4389; comm.NominalWidth = 240; comm.NominalHeight = 160; byte[] bios = CoreComm.CoreFileProvider.GetFirmware("GBA", "Bios", true, "GBA bios file is mandatory."); if (bios.Length != 16384) { throw new InvalidDataException("GBA bios must be exactly 16384 bytes!"); } if (file.Length > 32 * 1024 * 1024) { throw new InvalidDataException("Rom file is too big! No GBA game is larger than 32MB"); } Init(); LibMeteor.libmeteor_hardreset(); LibMeteor.libmeteor_loadbios(bios, (uint)bios.Length); LibMeteor.libmeteor_loadrom(file, (uint)file.Length); SetUpMemoryDomains(); }
public void Load(byte[] rom) { byte[] bios = CoreComm.CoreFileProvider.GetFirmware("GBA", "Bios", true, "GBA bios file is mandatory."); if (bios.Length != 16384) { throw new InvalidDataException("GBA bios must be exactly 16384 bytes!"); } if (rom.Length > 32 * 1024 * 1024) { throw new InvalidDataException("Rom file is too big! No GBA game is larger than 32MB"); } Init(); LibMeteor.libmeteor_hardreset(); LibMeteor.libmeteor_loadbios(bios, (uint)bios.Length); LibMeteor.libmeteor_loadrom(rom, (uint)rom.Length); SetUpMemoryDomains(); }
public void FrameAdvance(bool render, bool rendersound = true) { Frame++; IsLagFrame = true; if (Controller.IsPressed("Power")) { LibMeteor.libmeteor_hardreset(); } // due to the design of the tracing api, we have to poll whether it's active each frame LibMeteor.libmeteor_settracecallback(Tracer.Enabled ? tracecallback : null); if (!coredead) { LibMeteor.libmeteor_frameadvance(); } if (IsLagFrame) { LagCount++; } }