libretro: fix some scrambled framebuffers

This commit is contained in:
zeromus 2017-05-01 04:16:31 -05:00
parent ded1c2d7b7
commit 112e6ca1f2
7 changed files with 36 additions and 25 deletions

View File

@ -10,10 +10,6 @@ namespace BizHawk.Emulation.Cores.Libretro
{
switch (msg)
{
case eMessage.BRK_InputState:
comm->value = (uint)core.CB_InputState(comm->port, comm->device, comm->index, comm->id);
break;
default:
return false;

View File

@ -28,9 +28,8 @@ namespace BizHawk.Emulation.Cores.Libretro
CMD_Unserialize,
CMD_LAST,
SIG_InputState,
SIG_VideoUpdate,
BRK_InputState,
};

View File

@ -6,17 +6,11 @@ namespace BizHawk.Emulation.Cores.Libretro
{
unsafe partial class LibretroApi
{
bool Handle_SIG(eMessage msg)
public Tuple<IntPtr, int> QUERY_GetMemory(RETRO_MEMORY mem)
{
switch (msg)
{
default:
return false;
} //switch(msg)
Message(eMessage.Resume);
return true;
comm->value = (uint)mem;
Message(eMessage.QUERY_GetMemory);
return Tuple.Create(new IntPtr(comm->buf[(int)BufId.Param0]), comm->buf_size[(int)BufId.Param0]);
}
}
}

View File

@ -6,11 +6,29 @@ namespace BizHawk.Emulation.Cores.Libretro
{
unsafe partial class LibretroApi
{
public Tuple<IntPtr,int> QUERY_GetMemory(RETRO_MEMORY mem)
bool Handle_SIG(eMessage msg)
{
comm->value = (uint)mem;
Message(eMessage.QUERY_GetMemory);
return Tuple.Create(new IntPtr(comm->buf[(int)BufId.Param0]), comm->buf_size[(int)BufId.Param0]);
//I know, ive done this two completely different ways
//both ways are sloppy glue, anyway
//I havent decided on the final architecture yet
switch (msg)
{
case eMessage.SIG_InputState:
comm->value = (uint)core.CB_InputState(comm->port, comm->device, comm->index, comm->id);
break;
case eMessage.SIG_VideoUpdate:
core.SIG_VideoUpdate();
break;
default:
return false;
} //switch(msg)
Message(eMessage.Resume);
return true;
}
}
}

View File

@ -196,6 +196,11 @@ namespace BizHawk.Emulation.Cores.Libretro
}
}
public void SIG_VideoUpdate()
{
SetVideoBuffer(api.comm->env.fb_width, api.comm->env.fb_height);
}
int IVideoProvider.BufferWidth { get { return vidWidth; } }
int IVideoProvider.BufferHeight { get { return vidHeight; } }

View File

@ -93,9 +93,8 @@ enum eMessage : s32
CMD_Unserialize,
CMD_LAST,
SIG_InputState,
SIG_VideoUpdate,
BRK_InputState,
};
enum eStatus : s32
@ -558,11 +557,11 @@ void retro_video_refresh(const void *data, unsigned width, unsigned height, size
comm.env.fb_width = (s32)width;
comm.env.fb_height = (s32)height;
//stash pitch if needed
//notify c# of these new settings and let it allocate a buffer suitable for receiving the output (so we can work directly into c#'s int[])
//c# can read the settings right out of the comm env
//NOPE: not needed. for now, anyway. may want to notify later
//BREAK(eMessage::SIG_VideoUpdate);
BREAK(eMessage::SIG_VideoUpdate);
////if (BufferWidth != width) BufferWidth = (int)width;
@ -639,7 +638,7 @@ s16 retro_input_state(unsigned port, unsigned device, unsigned index, unsigned i
comm.index = index;
comm.id = id;
BREAK(eMessage::BRK_InputState);
BREAK(eMessage::SIG_InputState);
return (s16)comm.value;
}

Binary file not shown.