Example #1
0
        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();
        }
Example #2
0
        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();
        }