saturn: support input callback stuffs

This commit is contained in:
goyuken 2013-11-17 02:10:38 +00:00
parent d0969c208d
commit 5d4dc0630c
6 changed files with 527 additions and 489 deletions

View File

@ -73,6 +73,18 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn
[DllImport("libyabause.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void libyabause_hardreset();
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void InputCallback();
/// <summary>
/// set a fcn to call every time input is read
/// </summary>
/// <param name="cb">execxutes right before the input read. null to clear</param>
[DllImport("libyabause.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void libyabause_setinputcallback(InputCallback cb);
/// <summary>
///
/// </summary>

View File

@ -39,6 +39,8 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn
LibYabause.CDInterface.ReadSectorFAD ReadSectorFADH;
LibYabause.CDInterface.ReadAheadFAD ReadAheadFADH;
LibYabause.InputCallback InputCallbackH;
public Yabause(CoreComm CoreComm, DiscSystem.Disc CD, byte[] bios, bool GL = false)
{
CoreComm.RomStatusDetails = "Yeh";
@ -46,6 +48,9 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn
this.CD = CD;
ResetCounters();
Init(bios, GL);
InputCallbackH = new LibYabause.InputCallback(() => CoreComm.InputCallback.Call());
LibYabause.libyabause_setinputcallback(InputCallbackH);
}
void Init(byte[] bios, bool GL = false)

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -32,6 +32,8 @@
#include "yabause.h"
#include "movie.h"
#include "yui.h"
#ifdef _arch_dreamcast
# include "dreamcast/localtime.h"
#endif
@ -362,6 +364,10 @@ static void SmpcINTBACKPeripheral(void) {
if (SmpcInternalVars->port1.size == 0 && SmpcInternalVars->port2.size == 0)
{
/////
if (inputcallback)
inputcallback();
// Request data from the Peripheral Interface
port1 = &PORTDATA1;
port2 = &PORTDATA2;

View File

@ -52,6 +52,14 @@ int YuiSetVideoMode(int width, int height, int bpp, int fullscreen);
up being moved to the Video Core. */
void YuiSwapBuffers(void);
extern void (*inputcallback)(void);
//////////////////////////////////////////////////////////////////////////////
// Helper functions(you can use these in your own port)
//////////////////////////////////////////////////////////////////////////////