m64p: Changed the output formula for the framebuffer from glide64 to actually be correct. We actually don't need a formula... Changed glide64 to not force vsync. You apparently need to read the back buffer or else you get choppy video.

N64: Changed the hardcoded video plugin to use glide. Glide apparently requires you to set the video mode before initializing the plugin
This commit is contained in:
pjgat09 2013-05-04 23:51:50 +00:00
parent 74817e740b
commit a374641460
4 changed files with 18 additions and 16 deletions

View File

@ -497,9 +497,9 @@ namespace BizHawk.Emulation.Consoles.Nintendo.N64
CoreDll = LoadLibrary("mupen64plus.dll");
if (CoreDll == IntPtr.Zero)
throw new InvalidOperationException(string.Format("Failed to load mupen64plus.dll"));
GfxDll = LoadLibrary("mupen64plus-video-rice.dll");
GfxDll = LoadLibrary("mupen64plus-video-glide64.dll");
if (GfxDll == IntPtr.Zero)
throw new InvalidOperationException(string.Format("Failed to load mupen64plus-video-rice.dll"));
throw new InvalidOperationException(string.Format("Failed to load mupen64plus-video-glide64.dll"));
RspDll = LoadLibrary("mupen64plus-rsp-hle.dll");
if (RspDll == IntPtr.Zero)
throw new InvalidOperationException(string.Format("Failed to load mupen64plus-rsp-hle.dll"));
@ -543,13 +543,9 @@ namespace BizHawk.Emulation.Consoles.Nintendo.N64
RspPluginShutdown = (PluginShutdown)Marshal.GetDelegateForFunctionPointer(GetProcAddress(RspDll, "PluginShutdown"), typeof(PluginShutdown));
// Set up the core
m64p_error result = m64pCoreStartup(0x20001, "", "", "Core", (IntPtr foo, int level, string Message) => { }, "", IntPtr.Zero);
m64p_error result = m64pCoreStartup(0x20001, "", "", "Core", (IntPtr foo, int level, string Message) => { Console.WriteLine(Message); }, "", IntPtr.Zero);
result = m64pCoreDoCommandByteArray(m64p_command.M64CMD_ROM_OPEN, rom.Length, rom);
// Set up and connect the graphics plugin
result = GfxPluginStartup(CoreDll, "Video", (IntPtr foo, int level, string Message) => { });
result = m64pCoreAttachPlugin(m64p_plugin_type.M64PLUGIN_GFX, GfxDll);
SetVideoSize(vidX, vidY);
// Configure the video plugin
IntPtr video_section = IntPtr.Zero;
@ -557,16 +553,20 @@ namespace BizHawk.Emulation.Consoles.Nintendo.N64
result = m64pConfigSetParameter(video_section, "ScreenWidth", m64p_type.M64TYPE_INT, ref vidX);
result = m64pConfigSetParameter(video_section, "ScreenHeight", m64p_type.M64TYPE_INT, ref vidY);
// Set up and connect the graphics plugin
result = GfxPluginStartup(CoreDll, "Video", (IntPtr foo, int level, string Message) => { /*Console.WriteLine(Message);*/ });
result = m64pCoreAttachPlugin(m64p_plugin_type.M64PLUGIN_GFX, GfxDll);
// Set up a null audio plugin
result = AudPluginStartup(CoreDll, "Audio", (IntPtr foo, int level, string Message) => { });
result = AudPluginStartup(CoreDll, "Audio", (IntPtr foo, int level, string Message) => { Console.WriteLine(Message); });
result = m64pCoreAttachPlugin(m64p_plugin_type.M64PLUGIN_AUDIO, AudDll);
// Set up a null input plugin
result = AudPluginStartup(CoreDll, "Input", (IntPtr foo, int level, string Message) => { });
result = AudPluginStartup(CoreDll, "Input", (IntPtr foo, int level, string Message) => { Console.WriteLine(Message); });
result = m64pCoreAttachPlugin(m64p_plugin_type.M64PLUGIN_INPUT, InpDll);
// Set up and connect the graphics plugin
result = RspPluginStartup(CoreDll, "RSP", (IntPtr foo, int level, string Message) => { });
result = RspPluginStartup(CoreDll, "RSP", (IntPtr foo, int level, string Message) => { Console.WriteLine(Message); });
result = m64pCoreAttachPlugin(m64p_plugin_type.M64PLUGIN_RSP, RspDll);
// Set up the frame callback function

View File

@ -898,7 +898,7 @@ EXPORT void CALL ReadScreen2(void *dest, int *width, int *height, int front)
GrLfbInfo_t info;
info.size = sizeof(GrLfbInfo_t);
if (grLfbLock(GR_LFB_READ_ONLY, GR_BUFFER_FRONTBUFFER, GR_LFBWRITEMODE_888, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info))
if (grLfbLock(GR_LFB_READ_ONLY, GR_BUFFER_BACKBUFFER, GR_LFBWRITEMODE_888, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info))
{
// Copy the screen
for (DWORD y=0; y<settings.res_y; y++)
@ -906,16 +906,16 @@ EXPORT void CALL ReadScreen2(void *dest, int *width, int *height, int front)
BYTE *ptr = (BYTE*) info.lfbPtr + (info.strideInBytes * y);
for (DWORD x=0; x<settings.res_x; x++)
{
line[x*3] = ptr[2]; // red
line[x*3+1] = ptr[1]; // green
line[x*3+2] = ptr[0]; // blue
line[x*4+2] = ptr[2]; // red
line[x*4+1] = ptr[1]; // green
line[x*4] = ptr[0]; // blue
ptr += 4;
}
line += settings.res_x * 3;
line += settings.res_x * 4;
}
// Unlock the frontbuffer
grLfbUnlock (GR_LFB_READ_ONLY, GR_BUFFER_FRONTBUFFER);
grLfbUnlock (GR_LFB_READ_ONLY, GR_BUFFER_BACKBUFFER);
}
LOG ("ReadScreen. Success.\n");
}

View File

@ -423,6 +423,8 @@ grSstWinOpen(
return 0;
}
CoreVideo_GL_SetAttribute(M64P_GL_SWAP_CONTROL, 0);
if (CoreVideo_SetVideoMode(width, height, 0, screen_mode) != M64ERR_SUCCESS)
{
WriteLog(M64MSG_ERROR, "Could not set video mode.");