gpgx: fix video size after loading a frame 0 savestate. misc cleanup

This commit is contained in:
nattthebear 2017-05-21 09:27:29 -04:00
parent 10cfab4710
commit 1fe77d7f32
6 changed files with 41 additions and 22 deletions

View File

@ -66,13 +66,13 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx64
public void Dispose()
{
if (!disposed)
if (!_disposed)
{
if (Elf != null)
Elf.Dispose();
if (_elf != null)
_elf.Dispose();
if (CD != null)
CD.Dispose();
disposed = true;
_disposed = true;
}
}
}

View File

@ -81,7 +81,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx64
Core.gpgx_write_s68k_bus(a, val);
}, 2);
if (IsSegaCD)
if (IsMegaCD)
{
mm.Add(s68Bus);
}

View File

@ -31,7 +31,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx64
public void LoadStateBinary(BinaryReader reader)
{
Elf.LoadStateBinary(reader);
_elf.LoadStateBinary(reader);
// other variables
Frame = reader.ReadInt32();
LagCount = reader.ReadInt32();
@ -46,7 +46,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx64
public void SaveStateBinary(BinaryWriter writer)
{
Elf.SaveStateBinary(writer);
_elf.SaveStateBinary(writer);
// other variables
writer.Write(Frame);
writer.Write(LagCount);

View File

@ -41,6 +41,12 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx64
private unsafe void UpdateVideo()
{
if (Frame == 0)
{
UpdateVideoInitial();
return;
}
int gppitch, gpwidth, gpheight;
IntPtr src = IntPtr.Zero;
@ -59,7 +65,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx64
vidbuff = new int[vwidth * vheight];
int rinc = (gppitch / 4) - gpwidth;
fixed (int* pdst_ = &vidbuff[0])
fixed (int* pdst_ = vidbuff)
{
int* pdst = pdst_;
int* psrc = (int*)src;
@ -69,7 +75,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx64
for (int i = 0; i < xpad; i++)
*pdst++ = unchecked((int)0xff000000);
for (int i = 0; i < gpwidth; i++)
*pdst++ = *psrc++;// | unchecked((int)0xff000000);
*pdst++ = *psrc++;;
for (int i = 0; i < xpad2; i++)
*pdst++ = unchecked((int)0xff000000);
psrc += rinc;

View File

@ -42,12 +42,12 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx64
try
{
Elf = new PeRunner(comm.CoreFileProvider.DllPath(), "gpgx.exe", 8 * 1024 * 1024, 36 * 1024 * 1024, 4 * 1024 * 1024);
_elf = new PeRunner(comm.CoreFileProvider.DllPath(), "gpgx.exe", 8 * 1024 * 1024, 36 * 1024 * 1024, 4 * 1024 * 1024);
if (Elf.ShouldMonitor)
Core = BizInvoker.GetInvoker<LibGPGX>(Elf, Elf);
if (_elf.ShouldMonitor)
Core = BizInvoker.GetInvoker<LibGPGX>(_elf, _elf);
else
Core = BizInvoker.GetInvoker<LibGPGX>(Elf);
Core = BizInvoker.GetInvoker<LibGPGX>(_elf);
_syncSettings = (GPGXSyncSettings)syncSettings ?? new GPGXSyncSettings();
_settings = (GPGXSettings)settings ?? new GPGXSettings();
@ -121,7 +121,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx64
SetControllerDefinition();
// pull the default video size from the core
UpdateVideoInitial();
UpdateVideo();
SetMemoryDomains();
@ -143,7 +143,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx64
Tracer = new GPGXTraceBuffer(this, MemoryDomains, this);
(ServiceProvider as BasicServiceProvider).Register<ITraceable>(Tracer);
Elf.Seal();
_elf.Seal();
}
catch
{
@ -152,14 +152,14 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx64
}
}
LibGPGX Core;
PeRunner Elf;
private LibGPGX Core;
private PeRunner _elf;
DiscSystem.Disc CD;
DiscSystem.DiscSectorReader DiscSectorReader;
byte[] romfile;
bool disposed = false;
private bool _disposed = false;
LibGPGX.load_archive_cb LoadCallback = null;
@ -272,9 +272,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx64
}
else
{
throw new Exception();
//Console.WriteLine("Couldn't satisfy firmware request {0} for unknown reasons", filename);
//return 0;
throw new InvalidOperationException("Unknown error processing firmware");
}
}
@ -367,7 +365,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx64
return (LibGPGX.INPUT_DEVICE[])input.dev.Clone();
}
public bool IsSegaCD { get { return CD != null; } }
public bool IsMegaCD { get { return CD != null; } }
public void UpdateVDPViewContext(LibGPGX.VDPView view)
{

View File

@ -183,6 +183,21 @@ namespace BizHawk.Emulation.Cores.Waterbox
}
module.Add(import.Name, Z.US(Start + import.Thunk));
}
Console.WriteLine($"Mounted `{ModuleName}` @{Start:x16}");
foreach (var s in _pe.ImageSectionHeaders.OrderBy(s => s.VirtualAddress))
{
var r = (s.Characteristics & (uint)Constants.SectionFlags.IMAGE_SCN_MEM_READ) != 0;
var w = (s.Characteristics & (uint)Constants.SectionFlags.IMAGE_SCN_MEM_WRITE) != 0;
var x = (s.Characteristics & (uint)Constants.SectionFlags.IMAGE_SCN_MEM_EXECUTE) != 0;
Console.WriteLine(" @{0:x16} {1}{2}{3} `{4}` {5} bytes",
Start + s.VirtualAddress,
r ? "R" : " ",
w ? "W" : " ",
x ? "X" : " ",
Encoding.ASCII.GetString(s.Name),
s.VirtualSize);
}
}
public IntPtr Resolve(string entryPoint)