Пример #1
0
        public Atari2600(CoreComm comm, GameInfo game, byte[] rom, object settings, object syncSettings)
        {
            var ser = new BasicServiceProvider(this);

            ServiceProvider = ser;

            Tracer          = new TraceBuffer();
            MemoryCallbacks = new MemoryCallbackSystem();
            InputCallbacks  = new InputCallbackSystem();

            Ram          = new byte[128];
            CoreComm     = comm;
            Settings     = (A2600Settings)settings ?? new A2600Settings();
            SyncSettings = (A2600SyncSettings)syncSettings ?? new A2600SyncSettings();

            Rom   = rom;
            _game = game;

            if (!game.GetOptionsDict().ContainsKey("m"))
            {
                game.AddOption("m", DetectMapper(rom));
            }

            Console.WriteLine("Game uses mapper " + game.GetOptionsDict()["m"]);
            RebootCore();
            SetupMemoryDomains();


            ser.Register <IDisassemblable>(Cpu);
            ser.Register <ITraceable>(Tracer);
            ser.Register <IVideoProvider>(_tia);
        }
Пример #2
0
        public Atari2600(CoreComm comm, GameInfo game, byte[] rom, object settings, object syncSettings)
        {
            var ser = new BasicServiceProvider(this);

            ServiceProvider = ser;

            _ram         = new byte[128];
            CoreComm     = comm;
            Settings     = (A2600Settings)settings ?? new A2600Settings();
            SyncSettings = (A2600SyncSettings)syncSettings ?? new A2600SyncSettings();

            _controllerDeck = new Atari2600ControllerDeck(SyncSettings.Port1, SyncSettings.Port2);

            _leftDifficultySwitchPressed  = SyncSettings.LeftDifficulty;
            _rightDifficultySwitchPressed = SyncSettings.RightDifficulty;

            Rom   = rom;
            _game = game;

            if (!game.GetOptionsDict().ContainsKey("m"))
            {
                game.AddOption("m", DetectMapper(rom));
            }

            if (Rom.HashSHA1() == "3A77DB43B6583E8689435F0F14AA04B9E57BDDED" ||
                Rom.HashSHA1() == "E986E1818E747BEB9B33CE4DFF1CDC6B55BDB620" ||
                Rom.HashSHA1() == "982B8016B393A9AA7DD110295A53C4612ECF2141")
            {
                game.RemoveOption("m");
                game.AddOption("m", "F8_sega");
            }

            Console.WriteLine("Game uses mapper " + game.GetOptionsDict()["m"]);
            Console.WriteLine(Rom.HashSHA1());
            RebootCore();
            SetupMemoryDomains();

            Tracer = new TraceBuffer {
                Header = Cpu.TraceHeader
            };

            ser.Register <IDisassemblable>(Cpu);
            ser.Register <ITraceable>(Tracer);
            ser.Register <IVideoProvider>(_tia);
            ser.Register <ISoundProvider>(_dcfilter);
            ser.Register <IStatable>(new StateSerializer(SyncState));
        }
Пример #3
0
        public Atari2600(CoreComm comm, GameInfo game, byte[] rom, object settings, object syncSettings)
        {
            var ser = new BasicServiceProvider(this);

            ServiceProvider = ser;

            MemoryCallbacks = new MemoryCallbackSystem();
            InputCallbacks  = new InputCallbackSystem();

            Ram          = new byte[128];
            CoreComm     = comm;
            Settings     = (A2600Settings)settings ?? new A2600Settings();
            SyncSettings = (A2600SyncSettings)syncSettings ?? new A2600SyncSettings();

            _leftDifficultySwitchPressed  = SyncSettings.LeftDifficulty;
            _rightDifficultySwitchPressed = SyncSettings.RightDifficulty;

            Rom   = rom;
            _game = game;

            if (!game.GetOptionsDict().ContainsKey("m"))
            {
                game.AddOption("m", DetectMapper(rom));
            }

            if (Rom.HashSHA1() == "3A77DB43B6583E8689435F0F14AA04B9E57BDDED" ||
                Rom.HashSHA1() == "E986E1818E747BEB9B33CE4DFF1CDC6B55BDB620")
            {
                game.RemoveOption("m");
                game.AddOption("m", "F8_sega");
            }

            Console.WriteLine("Game uses mapper " + game.GetOptionsDict()["m"]);
            Console.WriteLine(Rom.HashSHA1());
            RebootCore();
            SetupMemoryDomains();

            Tracer = new TraceBuffer {
                Header = Cpu.TraceHeader
            };

            ser.Register <IDisassemblable>(Cpu);
            ser.Register <ITraceable>(Tracer);
            ser.Register <IVideoProvider>(_tia);
        }
Пример #4
0
        public PCEngine(CoreComm comm, GameInfo game, Disc disc, object settings, object syncSettings)
        {
            CoreComm      = comm;
            SystemId      = "PCECD";
            Type          = NecSystemType.TurboCD;
            this.disc     = disc;
            Settings      = (PCESettings)settings ?? new PCESettings();
            _syncSettings = (PCESyncSettings)syncSettings ?? new PCESyncSettings();

            byte[] rom = CoreComm.CoreFileProvider.GetFirmwareWithGameInfo("PCECD", "Bios", true, out var biosInfo,
                                                                           "PCE-CD System Card not found. Please check the BIOS settings in Config->Firmwares.");

            if (biosInfo.Status == RomStatus.BadDump)
            {
                CoreComm.ShowMessage(
                    "The PCE-CD System Card you have selected is known to be a bad dump. This may cause problems playing PCE-CD games.\n\n"
                    + "It is recommended that you find a good dump of the system card. Sorry to be the bearer of bad news!");
            }
            else if (biosInfo.NotInDatabase)
            {
                CoreComm.ShowMessage(
                    "The PCE-CD System Card you have selected is not recognized in our database. That might mean it's a bad dump, or isn't the correct rom.");
            }
            else if (biosInfo["BIOS"] == false)
            {
                // zeromus says: someone please write a note about how this could possibly happen.
                // it seems like this is a relic of using gameDB for storing whether something is a bios? firmwareDB should be handling it now.
                CoreComm.ShowMessage(
                    "The PCE-CD System Card you have selected is not a BIOS image. You may have selected the wrong rom. FYI-Please report this to developers, I don't think this error message should happen.");
            }

            if (biosInfo["SuperSysCard"])
            {
                game.AddOption("SuperSysCard");
            }

            if (game["NeedSuperSysCard"] && game["SuperSysCard"] == false)
            {
                CoreComm.ShowMessage(
                    "This game requires a version 3.0 System card and won't run with the system card you've selected. Try selecting a 3.0 System Card in the firmware configuration.");
                throw new Exception();
            }

            game.FirmwareHash = rom.HashSHA1();

            Init(game, rom);

            // the default RomStatusDetails don't do anything with Disc
            CoreComm.RomStatusDetails = $"{game.Name}\r\nDisk partial hash:{new DiscHasher(disc).OldHash()}";

            _controllerDeck = new PceControllerDeck(
                _syncSettings.Port1,
                _syncSettings.Port2,
                _syncSettings.Port3,
                _syncSettings.Port4,
                _syncSettings.Port5);
        }
Пример #5
0
        public Atari2600(GameInfo game, byte[] rom, Atari2600.A2600Settings settings, Atari2600.A2600SyncSettings syncSettings)
        {
            var ser = new BasicServiceProvider(this);

            ServiceProvider = ser;

            _ram         = new byte[128];
            Settings     = (A2600Settings)settings ?? new A2600Settings();
            SyncSettings = (A2600SyncSettings)syncSettings ?? new A2600SyncSettings();

            _controllerDeck = new Atari2600ControllerDeck(SyncSettings.Port1, SyncSettings.Port2);

            _leftDifficultySwitchPressed  = SyncSettings.LeftDifficulty;
            _rightDifficultySwitchPressed = SyncSettings.RightDifficulty;

            Rom   = rom;
            _game = game;

            if (!game.GetOptions().ContainsKey("m"))
            {
                game.AddOption("m", DetectMapper(rom));
            }

            var romHashSHA1 = SHA1Checksum.ComputePrefixedHex(Rom);

            if (romHashSHA1 is RomChecksums.CongoBongo or RomChecksums.Tapper or RomChecksums.KangarooNotInGameDB)
            {
                game.RemoveOption("m");
                game.AddOption("m", "F8_sega");
            }

            Console.WriteLine("Game uses mapper " + game.GetOptions()["m"]);
            Console.WriteLine(romHashSHA1);
            RebootCore();
            SetupMemoryDomains();

            Tracer = new TraceBuffer(Cpu.TraceHeader);

            ser.Register <IDisassemblable>(Cpu);
            ser.Register <ITraceable>(Tracer);
            ser.Register <IVideoProvider>(_tia);
            ser.Register <ISoundProvider>(_dcfilter);
            ser.Register <IStatable>(new StateSerializer(SyncState));
        }
Пример #6
0
        public Atari2600(CoreComm comm, GameInfo game, byte[] rom, object settings, object syncSettings)
        {
            Ram          = new byte[128];
            CoreComm     = comm;
            Settings     = (A2600Settings)settings ?? new A2600Settings();
            SyncSettings = (A2600SyncSettings)syncSettings ?? new A2600SyncSettings();

            var domains = new List <MemoryDomain>
            {
                new MemoryDomain(
                    "Main RAM",
                    128,
                    MemoryDomain.Endian.Little,
                    addr => Ram[addr],
                    (addr, value) => Ram[addr] = value),
                new MemoryDomain(
                    "TIA",
                    16,
                    MemoryDomain.Endian.Little,
                    addr => _tia.ReadMemory((ushort)addr, true),
                    (addr, value) => this._tia.WriteMemory((ushort)addr, value)),
                new MemoryDomain(
                    "PIA",
                    1024,
                    MemoryDomain.Endian.Little,
                    addr => M6532.ReadMemory((ushort)addr, true),
                    (addr, value) => M6532.WriteMemory((ushort)addr, value)),
                new MemoryDomain(
                    "System Bus",
                    8192,
                    MemoryDomain.Endian.Little,
                    addr => _mapper.PeekMemory((ushort)addr),
                    (addr, value) => _mapper.PokeMemory((ushort)addr, value))
            };

            CoreComm.CpuTraceAvailable = true;
            Rom   = rom;
            _game = game;

            if (!game.GetOptionsDict().ContainsKey("m"))
            {
                game.AddOption("m", DetectMapper(rom));
            }

            Console.WriteLine("Game uses mapper " + game.GetOptionsDict()["m"]);
            RebootCore();

            if (_mapper is mDPC)             // TODO: also mDPCPlus
            {
                domains.Add(new MemoryDomain(
                                "DPC",
                                2048,
                                MemoryDomain.Endian.Little,
                                addr => (_mapper as mDPC).DspData[addr],
                                (addr, value) => (_mapper as mDPC).DspData[addr] = value));
            }

            if (_mapper.HasCartRam)
            {
                domains.Add(new MemoryDomain(
                                "Cart Ram",
                                _mapper.CartRam.Len,
                                MemoryDomain.Endian.Little,
                                addr => _mapper.CartRam[addr],
                                (addr, value) => _mapper.CartRam[addr] = value));
            }

            MemoryDomains = new MemoryDomainList(domains);
        }