gpgx: lag flag and on_snoop()
This commit is contained in:
parent
9a42da7bf1
commit
0c6e34b9da
|
@ -23,6 +23,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
bool disposed = false;
|
bool disposed = false;
|
||||||
|
|
||||||
LibGPGX.load_archive_cb LoadCallback = null;
|
LibGPGX.load_archive_cb LoadCallback = null;
|
||||||
|
LibGPGX.input_cb InputCallback = null;
|
||||||
|
|
||||||
LibGPGX.InputData input = new LibGPGX.InputData();
|
LibGPGX.InputData input = new LibGPGX.InputData();
|
||||||
|
|
||||||
|
@ -111,6 +112,9 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
update_video();
|
update_video();
|
||||||
|
|
||||||
SetMemoryDomains();
|
SetMemoryDomains();
|
||||||
|
|
||||||
|
InputCallback = new LibGPGX.input_cb(input_callback);
|
||||||
|
LibGPGX.gpgx_set_input_callback(InputCallback);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
@ -285,6 +289,13 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
ControllerDefinition = ControlConverter.ControllerDef;
|
ControllerDefinition = ControlConverter.ControllerDef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// core callback for input
|
||||||
|
void input_callback()
|
||||||
|
{
|
||||||
|
CoreComm.InputCallback.Call();
|
||||||
|
IsLagFrame = false;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
// TODO: use render and rendersound
|
// TODO: use render and rendersound
|
||||||
|
@ -310,7 +321,6 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
update_video();
|
update_video();
|
||||||
update_audio();
|
update_audio();
|
||||||
|
|
||||||
IsLagFrame = false; // TODO
|
|
||||||
if (IsLagFrame)
|
if (IsLagFrame)
|
||||||
LagCount++;
|
LagCount++;
|
||||||
}
|
}
|
||||||
|
@ -485,6 +495,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region debugging tools
|
||||||
|
|
||||||
public MemoryDomainList MemoryDomains { get; private set; }
|
public MemoryDomainList MemoryDomains { get; private set; }
|
||||||
|
|
||||||
unsafe void SetMemoryDomains()
|
unsafe void SetMemoryDomains()
|
||||||
|
@ -524,6 +536,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
return new List<KeyValuePair<string, int>>();
|
return new List<KeyValuePair<string, int>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
if (!disposed)
|
if (!disposed)
|
||||||
|
|
|
@ -122,6 +122,12 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
DEVICE_ACTIVATOR = 0x0a,// Activator
|
DEVICE_ACTIVATOR = 0x0a,// Activator
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||||
|
public delegate void input_cb();
|
||||||
|
|
||||||
|
[DllImport("libgenplusgx.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern void gpgx_set_input_callback(input_cb cb);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// not every flag is valid for every device!
|
/// not every flag is valid for every device!
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -136,6 +136,19 @@ void osd_input_update(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void (*input_callback_cb)(void);
|
||||||
|
|
||||||
|
void real_input_callback(void)
|
||||||
|
{
|
||||||
|
if (input_callback_cb)
|
||||||
|
input_callback_cb();
|
||||||
|
}
|
||||||
|
|
||||||
|
GPGX_EX void gpgx_set_input_callback(void (*fecb)(void))
|
||||||
|
{
|
||||||
|
input_callback_cb = fecb;
|
||||||
|
}
|
||||||
|
|
||||||
int (*load_archive_cb)(const char *filename, unsigned char *buffer, int maxsize);
|
int (*load_archive_cb)(const char *filename, unsigned char *buffer, int maxsize);
|
||||||
|
|
||||||
// return 0 on failure, else actual loaded size
|
// return 0 on failure, else actual loaded size
|
||||||
|
|
|
@ -377,8 +377,10 @@ unsigned int io_68k_read(unsigned int offset)
|
||||||
case 0x02: /* Port B Data */
|
case 0x02: /* Port B Data */
|
||||||
case 0x03: /* Port C Data */
|
case 0x03: /* Port C Data */
|
||||||
{
|
{
|
||||||
unsigned int mask = 0x80 | io_reg[offset + 3];
|
unsigned int mask, data;
|
||||||
unsigned int data = port[offset-1].data_r();
|
real_input_callback();
|
||||||
|
mask = 0x80 | io_reg[offset + 3];
|
||||||
|
data = port[offset-1].data_r();
|
||||||
return (io_reg[offset] & mask) | (data & ~mask);
|
return (io_reg[offset] & mask) | (data & ~mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -452,11 +454,13 @@ void io_z80_write(unsigned int offset, unsigned int data, unsigned int cycles)
|
||||||
|
|
||||||
unsigned int io_z80_read(unsigned int offset)
|
unsigned int io_z80_read(unsigned int offset)
|
||||||
{
|
{
|
||||||
|
unsigned int data, ctrl;
|
||||||
|
real_input_callback();
|
||||||
/* Read port A & port B input data */
|
/* Read port A & port B input data */
|
||||||
unsigned int data = (port[0].data_r()) | (port[1].data_r() << 8);
|
data = (port[0].data_r()) | (port[1].data_r() << 8);
|
||||||
|
|
||||||
/* I/O control register value */
|
/* I/O control register value */
|
||||||
unsigned int ctrl = io_reg[0x0F];
|
ctrl = io_reg[0x0F];
|
||||||
|
|
||||||
/* I/O ports */
|
/* I/O ports */
|
||||||
if (offset)
|
if (offset)
|
||||||
|
|
|
@ -80,5 +80,6 @@ extern char MS_BIOS_JP[256];
|
||||||
|
|
||||||
void osd_input_update(void);
|
void osd_input_update(void);
|
||||||
int load_archive(const char *filename, unsigned char *buffer, int maxsize, char *extension);
|
int load_archive(const char *filename, unsigned char *buffer, int maxsize, char *extension);
|
||||||
|
void real_input_callback(void);
|
||||||
|
|
||||||
#endif /* _OSD_H */
|
#endif /* _OSD_H */
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue