public Rby(string rom, string savFile = null, SpeedupFlags speedupFlags = SpeedupFlags.None) : base(rom, savFile, speedupFlags) { IsYellow = ROM.Title == "POKEMON YELLOW"; // If a ROM with the same checksum has already been parsed, the data will be shared. if (ParsedROMs.ContainsKey(ROM.GlobalChecksum)) { Data = ParsedROMs[ROM.GlobalChecksum]; } else { // Otherwise the new ROM will be parsed. Data = new RbyData(); LoadTypeEffectivenessTable(); LoadMoves(); LoadSpecies(); LoadItems(); LoadTrainerClasses(); LoadLedges(); LoadTilesets(); LoadTilePairCollisions(); LoadMaps(); LoadMissableSprites(); LoadDirectionalWarpTiles(); ParsedROMs[ROM.GlobalChecksum] = Data; } OverworldLoopAddress = SYM["JoypadOverworld"]; }
public Rby(string rom, SpeedupFlags speedupFlags = SpeedupFlags.None) : base("roms/gbc_bios.bin", rom, speedupFlags) { // If a ROM with the same checksum has already been parsed, the data will be shared. if (ParsedROMs.ContainsKey(ROM.GlobalChecksum)) { Data = ParsedROMs[ROM.GlobalChecksum]; } else { // Otherwise the new ROM will be parsed. Data = new RbyData(); LoadTypeEffectivenessTable(); LoadMoves(); LoadSpecies(); LoadItems(); LoadTrainerClasses(); LoadLedges(); LoadTilesets(); LoadTilePairCollisions(); LoadMaps(); ParsedROMs[ROM.GlobalChecksum] = Data; } OverworldLoopAddress = SYM["JoypadOverworld"]; }
public GameBoy(string biosFile, string romFile, SpeedupFlags speedupFlags = SpeedupFlags.None) { ROM = new ROM(romFile); Debug.Assert(ROM.HeaderChecksumMatches(), "Cartridge header checksum mismatch!"); Handle = Libgambatte.gambatte_create(); Debug.Assert(Libgambatte.gambatte_loadbios(Handle, biosFile, 0x900, 0x31672598) == 0, "Unable to load BIOS!"); Debug.Assert(Libgambatte.gambatte_load(Handle, romFile, LoadFlags.GbaFlag | LoadFlags.GcbMode | LoadFlags.ReadOnlySav) == 0, "Unable to load ROM!"); VideoBuffer = new byte[160 * 144 * 4]; AudioBuffer = new byte[(SamplesPerFrame + 2064) * 2 * 2]; // Stereo 16-bit samples InputGetter = () => CurrentJoypad; Libgambatte.gambatte_setinputgetter(Handle, InputGetter); string symPath = "symfiles/" + Path.GetFileNameWithoutExtension(romFile) + ".sym"; if (File.Exists(symPath)) { SYM = new SYM(symPath); ROM.Symbols = SYM; } SetSpeedupFlags(speedupFlags); StateSize = Libgambatte.gambatte_savestate(Handle, null, 160, null); SaveStateLabels = new Dictionary <string, int>(); byte[] state = SaveState(); ByteStream data = new ByteStream(state); data.Seek(3); data.Seek(data.u24be()); while (data.Position < state.Length) { string label = ""; byte character; while ((character = data.u8()) != 0x00) { label += Convert.ToChar(character); } int size = data.u24be(); SaveStateLabels[label] = (int)data.Position; data.Seek(size); } }
public Gsc(string rom, SpeedupFlags flags = SpeedupFlags.None) : base("roms/gbc_bios.bin", rom, flags) { // If a ROM with the same checksum has already been parsed, the data will be shared. if (ParsedROMs.ContainsKey(ROM.GlobalChecksum)) { Data = ParsedROMs[ROM.GlobalChecksum]; } else { // Otherwise the new ROM will be parsed. Data = new GscData(); LoadSpecies(); LoadMoves(); LoadItems(); LoadTilesets(); LoadMaps(); ParsedROMs[ROM.GlobalChecksum] = Data; } OverworldLoopAddress = SYM["OWPlayerInput"]; }
public Gsc(string rom, string savFile = null, SpeedupFlags flags = SpeedupFlags.None) : base(rom, savFile, flags) { IsCrystal = ROM.Title == "PM_CRYSTAL"; // If a ROM with the same checksum has already been parsed, the data will be shared. if (ParsedROMs.ContainsKey(ROM.GlobalChecksum)) { Data = ParsedROMs[ROM.GlobalChecksum]; } else { // Otherwise the new ROM will be parsed. Data = new GscData(); LoadSpecies(); LoadMoves(); LoadItems(); LoadTilesets(); LoadMaps(); ParsedROMs[ROM.GlobalChecksum] = Data; } OverworldLoopAddress = SYM["OWPlayerInput"]; }
public GameBoy(string biosFile, string romFile, string savFile = null, SpeedupFlags speedupFlags = SpeedupFlags.None) { ROM = new ROM(romFile); Debug.Assert(ROM.HeaderChecksumMatches(), "Cartridge header checksum mismatch!"); string romName = Path.GetFileNameWithoutExtension(romFile); if (savFile == null || savFile == "") { File.Delete("roms/" + romName + ".sav"); } else { File.WriteAllBytes("roms/" + romName + ".sav", File.ReadAllBytes(savFile)); } Handle = Libgambatte.gambatte_create(); Debug.Assert(Libgambatte.gambatte_loadbios(Handle, biosFile, 0x900, 0x31672598) == 0, "Unable to load BIOS!"); Debug.Assert(Libgambatte.gambatte_load(Handle, romFile, LoadFlags.GbaFlag | LoadFlags.GcbMode | LoadFlags.ReadOnlySav) == 0, "Unable to load ROM!"); VideoBuffer = new byte[160 * 144 * 4]; AudioBuffer = new byte[(SamplesPerFrame + 2064) * 2 * 2]; // Stereo 16-bit samples InputGetter = () => CurrentJoypad; Libgambatte.gambatte_setinputgetter(Handle, InputGetter); string symPath = "symfiles/" + romName + ".sym"; if (File.Exists(symPath)) { SYM = new SYM(symPath); ROM.Symbols = SYM; } SetSpeedupFlags(speedupFlags); StateSize = Libgambatte.gambatte_savestate(Handle, null, 160, null); }
public PokemonGame(string rom, string savFile = null, SpeedupFlags speedupFlags = SpeedupFlags.None) : base("roms/gbc_bios.bin", rom, savFile, speedupFlags) { }
public static extern void gambatte_setspeedupflags(IntPtr gb, SpeedupFlags falgs);
// Sets flags to control non-critical processes for CPU-concerned emulation. public void SetSpeedupFlags(SpeedupFlags flags) { Libgambatte.gambatte_setspeedupflags(Handle, flags); }
public RbyForce(string rom, SpeedupFlags speedupFlags) : base(rom, null, speedupFlags) { NumSpriteSlots = IsYellow ? 15 : 16; StateCacher = new StateCacher(GetType().Name); }