N64: Added a video plugin settings class, filled it with the values from the rice settings screen, and wired it up to the core
This commit is contained in:
parent
0d4ed449e1
commit
0a3dfa697e
|
@ -215,13 +215,13 @@ namespace BizHawk.Emulation.Consoles.Nintendo.N64
|
|||
|
||||
mupen64plusApi api;
|
||||
|
||||
public N64(CoreComm comm, GameInfo game, byte[] rom, int vidX, int vidY, string PluginName)
|
||||
public N64(CoreComm comm, GameInfo game, byte[] rom, VideoPluginSettings video_settings)
|
||||
{
|
||||
CoreComm = comm;
|
||||
this.rom = rom;
|
||||
this.game = game;
|
||||
|
||||
api = new mupen64plusApi(this, rom, vidX, vidY, PluginName);
|
||||
api = new mupen64plusApi(this, rom, video_settings);
|
||||
|
||||
MemoryDomains = new List<MemoryDomain>();
|
||||
MemoryDomains.Add(new MemoryDomain("RDRAM", 0x400000, Endian.Little, api.getRDRAMByte, api.setRDRAMByte));
|
||||
|
|
|
@ -394,7 +394,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo.N64
|
|||
IntPtr AudDll;
|
||||
IntPtr InpDll;
|
||||
|
||||
public mupen64plusApi(N64 bizhawkCore, byte[] rom, int vidX, int vidY, string PluginName)
|
||||
public mupen64plusApi(N64 bizhawkCore, byte[] rom, VideoPluginSettings video_settings)
|
||||
{
|
||||
if (AttachedCore != null)
|
||||
{
|
||||
|
@ -405,17 +405,17 @@ namespace BizHawk.Emulation.Consoles.Nintendo.N64
|
|||
this.bizhawkCore = bizhawkCore;
|
||||
|
||||
string VidDllName;
|
||||
if (PluginName == "Rice")
|
||||
if (video_settings.PluginName == "Rice")
|
||||
{
|
||||
VidDllName = "mupen64plus-video-rice.dll";
|
||||
}
|
||||
else if (PluginName == "Glide64")
|
||||
else if (video_settings.PluginName == "Glide64")
|
||||
{
|
||||
VidDllName = "mupen64plus-video-glide64.dll";
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException(string.Format("Unknown plugin \"" + PluginName));
|
||||
throw new InvalidOperationException(string.Format("Unknown plugin \"" + video_settings.PluginName));
|
||||
}
|
||||
|
||||
// Load each of the DLLs
|
||||
|
@ -444,15 +444,17 @@ namespace BizHawk.Emulation.Consoles.Nintendo.N64
|
|||
result = m64pCoreDoCommandByteArray(m64p_command.M64CMD_ROM_OPEN, rom.Length, rom);
|
||||
|
||||
// Resize the video to the size in bizhawk's settings
|
||||
SetVideoSize(vidX, vidY);
|
||||
SetVideoSize(video_settings.Width, video_settings.Height);
|
||||
|
||||
// Open the general video settings section in the config system
|
||||
IntPtr video_section = IntPtr.Zero;
|
||||
m64pConfigOpenSection("Video-General", ref video_section);
|
||||
|
||||
// Set the desired width and height for mupen64plus
|
||||
result = m64pConfigSetParameter(video_section, "ScreenWidth", m64p_type.M64TYPE_INT, ref vidX);
|
||||
result = m64pConfigSetParameter(video_section, "ScreenHeight", m64p_type.M64TYPE_INT, ref vidY);
|
||||
result = m64pConfigSetParameter(video_section, "ScreenWidth", m64p_type.M64TYPE_INT, ref video_settings.Width);
|
||||
result = m64pConfigSetParameter(video_section, "ScreenHeight", m64p_type.M64TYPE_INT, ref video_settings.Height);
|
||||
|
||||
set_video_parameters(video_settings);
|
||||
|
||||
// Set up and connect the graphics plugin
|
||||
result = GfxPluginStartup(CoreDll, "Video", (IntPtr foo, int level, string Message) => { });
|
||||
|
@ -562,6 +564,37 @@ namespace BizHawk.Emulation.Consoles.Nintendo.N64
|
|||
m64p_FrameBuffer = new int[vidX * vidY];
|
||||
}
|
||||
|
||||
public void set_video_parameters(VideoPluginSettings video_settings)
|
||||
{
|
||||
IntPtr video_plugin_section = IntPtr.Zero;
|
||||
if (video_settings.PluginName == "Rice")
|
||||
{
|
||||
m64pConfigOpenSection("Video-Rice", ref video_plugin_section);
|
||||
}
|
||||
else if (video_settings.PluginName == "Glide64")
|
||||
{
|
||||
m64pConfigOpenSection("Video-Glide64", ref video_plugin_section);
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (string Parameter in video_settings.Parameters.Keys)
|
||||
{
|
||||
int value = 0;
|
||||
if (video_settings.Parameters[Parameter].GetType() == typeof(int))
|
||||
{
|
||||
value = (int)video_settings.Parameters[Parameter];
|
||||
}
|
||||
else if (video_settings.Parameters[Parameter].GetType() == typeof(bool))
|
||||
{
|
||||
value = (bool)video_settings.Parameters[Parameter] ? 1 : 0;
|
||||
}
|
||||
m64pConfigSetParameter(video_plugin_section, Parameter, m64p_type.M64TYPE_INT, ref value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int[] m64p_FrameBuffer;
|
||||
|
||||
|
@ -749,4 +782,22 @@ namespace BizHawk.Emulation.Consoles.Nintendo.N64
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class VideoPluginSettings
|
||||
{
|
||||
public string PluginName;
|
||||
//public Dictionary<string, int> IntParameters = new Dictionary<string,int>();
|
||||
//public Dictionary<string, string> StringParameters = new Dictionary<string,string>();
|
||||
|
||||
public Dictionary<string, object> Parameters = new Dictionary<string, object>();
|
||||
public int Height;
|
||||
public int Width;
|
||||
|
||||
public VideoPluginSettings (string Name, int Width, int Height)
|
||||
{
|
||||
this.PluginName = Name;
|
||||
this.Width = Width;
|
||||
this.Height = Height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2455,7 +2455,45 @@ namespace BizHawk.MultiClient
|
|||
case "N64":
|
||||
if (INTERIM)
|
||||
{
|
||||
nextEmulator = new N64(nextComm, game, rom.RomData, Global.Config.N64VideoSizeX, Global.Config.N64VideoSizeY, Global.Config.N64VidPlugin);
|
||||
BizHawk.Emulation.Consoles.Nintendo.N64.VideoPluginSettings video_settings = new BizHawk.Emulation.Consoles.Nintendo.N64.VideoPluginSettings(Global.Config.N64VidPlugin, Global.Config.N64VideoSizeX, Global.Config.N64VideoSizeY);
|
||||
if (Global.Config.N64VidPlugin == "Rice")
|
||||
{
|
||||
video_settings.Parameters.Add("NormalAlphaBlender", Global.Config.RiceNormalAlphaBlender);
|
||||
video_settings.Parameters.Add("FastTextureLoading", Global.Config.RiceFastTextureLoading);
|
||||
video_settings.Parameters.Add("AccurateTextureMapping", Global.Config.RiceAccurateTextureMapping);
|
||||
video_settings.Parameters.Add("InN64Resolution", Global.Config.RiceInN64Resolution);
|
||||
video_settings.Parameters.Add("SaveVRAM", Global.Config.RiceSaveVRAM);
|
||||
video_settings.Parameters.Add("DoubleSizeForSmallTxtrBuf", Global.Config.RiceDoubleSizeForSmallTxtrBuf);
|
||||
video_settings.Parameters.Add("DefaultCombinerDisable", Global.Config.RiceDefaultCombinerDisable);
|
||||
video_settings.Parameters.Add("EnableHacks", Global.Config.RiceEnableHacks);
|
||||
video_settings.Parameters.Add("WinFrameMode", Global.Config.RiceWinFrameMode);
|
||||
video_settings.Parameters.Add("FullTMEMEmulation", Global.Config.RiceFullTMEMEmulation);
|
||||
video_settings.Parameters.Add("OpenGLVertexClipper", Global.Config.RiceOpenGLVertexClipper);
|
||||
video_settings.Parameters.Add("EnableSSE", Global.Config.RiceEnableSSE);
|
||||
video_settings.Parameters.Add("EnableVertexShader", Global.Config.RiceEnableVertexShader);
|
||||
video_settings.Parameters.Add("SkipFrame", Global.Config.RiceSkipFrame);
|
||||
video_settings.Parameters.Add("TexRectOnly", Global.Config.RiceTexRectOnly);
|
||||
video_settings.Parameters.Add("SmallTextureOnly", Global.Config.RiceSmallTextureOnly);
|
||||
video_settings.Parameters.Add("LoadHiResCRCOnly", Global.Config.RiceLoadHiResCRCOnly);
|
||||
video_settings.Parameters.Add("LoadHiResTextures", Global.Config.RiceLoadHiResTextures);
|
||||
video_settings.Parameters.Add("DumpTexturesToFiles", Global.Config.RiceDumpTexturesToFiles);
|
||||
video_settings.Parameters.Add("FrameBufferSetting", Global.Config.RiceFrameBufferSetting);
|
||||
video_settings.Parameters.Add("FrameBufferWriteBackControl", Global.Config.RiceFrameBufferWriteBackControl);
|
||||
video_settings.Parameters.Add("RenderToTexture", Global.Config.RiceRenderToTexture);
|
||||
video_settings.Parameters.Add("ScreenUpdateSetting", Global.Config.RiceScreenUpdateSetting);
|
||||
video_settings.Parameters.Add("Mipmapping", Global.Config.RiceMipmapping);
|
||||
video_settings.Parameters.Add("FogMethod", Global.Config.RiceFogMethod);
|
||||
video_settings.Parameters.Add("ForceTextureFilter", Global.Config.RiceForceTextureFilter);
|
||||
video_settings.Parameters.Add("TextureEnhancement", Global.Config.RiceTextureEnhancement);
|
||||
video_settings.Parameters.Add("TextureEnhancementControl", Global.Config.RiceTextureEnhancementControl);
|
||||
video_settings.Parameters.Add("TextureQuality", Global.Config.RiceTextureQuality);
|
||||
video_settings.Parameters.Add("OpenGLDepthBufferSetting", Global.Config.RiceOpenGLDepthBufferSetting);
|
||||
video_settings.Parameters.Add("MultiSampling", Global.Config.RiceMultiSampling);
|
||||
video_settings.Parameters.Add("ColorQuality", Global.Config.RiceColorQuality);
|
||||
video_settings.Parameters.Add("OpenGLRenderSetting", Global.Config.RiceOpenGLRenderSetting);
|
||||
video_settings.Parameters.Add("AnisotropicFiltering", Global.Config.RiceAnisotropicFiltering);
|
||||
}
|
||||
nextEmulator = new N64(nextComm, game, rom.RomData, video_settings);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue