sms - nitpick code cleanup
This commit is contained in:
parent
7fbed8d3e5
commit
44064d86d2
|
@ -75,7 +75,10 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
|
||||||
RomData = rom;
|
RomData = rom;
|
||||||
|
|
||||||
if (RomData.Length % BankSize != 0)
|
if (RomData.Length % BankSize != 0)
|
||||||
|
{
|
||||||
Array.Resize(ref RomData, ((RomData.Length / BankSize) + 1) * BankSize);
|
Array.Resize(ref RomData, ((RomData.Length / BankSize) + 1) * BankSize);
|
||||||
|
}
|
||||||
|
|
||||||
RomBanks = (byte)(RomData.Length / BankSize);
|
RomBanks = (byte)(RomData.Length / BankSize);
|
||||||
|
|
||||||
Region = DetermineDisplayType(SyncSettings.DisplayType, game.Region);
|
Region = DetermineDisplayType(SyncSettings.DisplayType, game.Region);
|
||||||
|
@ -84,13 +87,20 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
|
||||||
Region = DisplayType.PAL;
|
Region = DisplayType.PAL;
|
||||||
CoreComm.Notify("Display was forced to PAL mode for game compatibility.");
|
CoreComm.Notify("Display was forced to PAL mode for game compatibility.");
|
||||||
}
|
}
|
||||||
if (IsGameGear)
|
|
||||||
|
if (IsGameGear)
|
||||||
|
{
|
||||||
Region = DisplayType.NTSC; // all game gears run at 60hz/NTSC mode
|
Region = DisplayType.NTSC; // all game gears run at 60hz/NTSC mode
|
||||||
|
}
|
||||||
|
|
||||||
CoreComm.VsyncNum = Region == DisplayType.NTSC ? 60 : 50;
|
CoreComm.VsyncNum = Region == DisplayType.NTSC ? 60 : 50;
|
||||||
CoreComm.VsyncDen = 1;
|
CoreComm.VsyncDen = 1;
|
||||||
|
|
||||||
RegionStr = SyncSettings.ConsoleRegion;
|
RegionStr = SyncSettings.ConsoleRegion;
|
||||||
if (RegionStr == "Auto") RegionStr = DetermineRegion(game.Region);
|
if (RegionStr == "Auto")
|
||||||
|
{
|
||||||
|
RegionStr = DetermineRegion(game.Region);
|
||||||
|
}
|
||||||
|
|
||||||
if (game["Japan"] && RegionStr != "Japan")
|
if (game["Japan"] && RegionStr != "Japan")
|
||||||
{
|
{
|
||||||
|
@ -99,18 +109,22 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((game.NotInDatabase || game["FM"]) && SyncSettings.EnableFM && !IsGameGear)
|
if ((game.NotInDatabase || game["FM"]) && SyncSettings.EnableFM && !IsGameGear)
|
||||||
|
{
|
||||||
HasYM2413 = true;
|
HasYM2413 = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (Controller == null)
|
if (Controller == null)
|
||||||
{
|
{
|
||||||
Controller = NullController.Instance;
|
Controller = NullController.Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
Cpu = new Z80A();
|
Cpu = new Z80A
|
||||||
Cpu.RegisterSP = 0xDFF0;
|
{
|
||||||
Cpu.ReadHardware = ReadPort;
|
RegisterSP = 0xDFF0,
|
||||||
Cpu.WriteHardware = WritePort;
|
ReadHardware = ReadPort,
|
||||||
Cpu.MemoryCallbacks = MemoryCallbacks;
|
WriteHardware = WritePort,
|
||||||
|
MemoryCallbacks = MemoryCallbacks
|
||||||
|
};
|
||||||
|
|
||||||
Vdp = new VDP(this, Cpu, IsGameGear ? VdpMode.GameGear : VdpMode.SMS, Region);
|
Vdp = new VDP(this, Cpu, IsGameGear ? VdpMode.GameGear : VdpMode.SMS, Region);
|
||||||
(ServiceProvider as BasicServiceProvider).Register<IVideoProvider>(Vdp);
|
(ServiceProvider as BasicServiceProvider).Register<IVideoProvider>(Vdp);
|
||||||
|
@ -118,7 +132,10 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
|
||||||
YM2413 = new YM2413();
|
YM2413 = new YM2413();
|
||||||
SoundMixer = new SoundMixer(YM2413, PSG);
|
SoundMixer = new SoundMixer(YM2413, PSG);
|
||||||
if (HasYM2413 && game["WhenFMDisablePSG"])
|
if (HasYM2413 && game["WhenFMDisablePSG"])
|
||||||
|
{
|
||||||
SoundMixer.DisableSource(PSG);
|
SoundMixer.DisableSource(PSG);
|
||||||
|
}
|
||||||
|
|
||||||
ActiveSoundProvider = HasYM2413 ? (IAsyncSoundProvider)SoundMixer : PSG;
|
ActiveSoundProvider = HasYM2413 ? (IAsyncSoundProvider)SoundMixer : PSG;
|
||||||
_fakeSyncSound = new FakeSyncSound(ActiveSoundProvider, 735);
|
_fakeSyncSound = new FakeSyncSound(ActiveSoundProvider, 735);
|
||||||
(ServiceProvider as BasicServiceProvider).Register<ISoundProvider>(_fakeSyncSound);
|
(ServiceProvider as BasicServiceProvider).Register<ISoundProvider>(_fakeSyncSound);
|
||||||
|
@ -148,6 +165,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
|
||||||
{
|
{
|
||||||
ForceStereoByte = byte.Parse(game.OptionValue("StereoByte"));
|
ForceStereoByte = byte.Parse(game.OptionValue("StereoByte"));
|
||||||
}
|
}
|
||||||
|
|
||||||
PSG.StereoPanning = ForceStereoByte;
|
PSG.StereoPanning = ForceStereoByte;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue