private void NewN64PluginSettings_Load(object sender, EventArgs e) { s = GetSettings(); ss = GetSyncSettings(); CoreTypeDropdown.PopulateFromEnum<N64SyncSettings.CoreType>(ss.Core); RspTypeDropdown.PopulateFromEnum<N64SyncSettings.RspType>(ss.Rsp); PluginComboBox.PopulateFromEnum<PluginType>(ss.VideoPlugin); VideoResolutionXTextBox.Text = s.VideoSizeX.ToString(); VideoResolutionYTextBox.Text = s.VideoSizeY.ToString(); var video_setting = s.VideoSizeX + " x " + s.VideoSizeY; var index = VideoResolutionComboBox.Items.IndexOf(video_setting); if (index >= 0) { VideoResolutionComboBox.SelectedIndex = index; } else if (PluginComboBox.SelectedIndex != 4) { VideoResolutionComboBox.SelectedIndex = 13; ShowCustomVideoResolutionControls(); } RicePropertyGrid.SelectedObject = ss.RicePlugin; Glidemk2PropertyGrid.SelectedObject = ss.Glide64mk2Plugin; GlidePropertyGrid.SelectedObject = ss.GlidePlugin; JaboPropertyGrid.SelectedObject = ss.JaboPlugin; }
public N64Input(mupen64plusApi core, CoreComm comm, N64SyncSettings.N64ControllerSettings[] controllerSettings) { api = new mupen64plusInputApi(core); CoreComm = comm; api.SetM64PInputCallback(new mupen64plusInputApi.InputCallback(GetControllerInput)); core.VInterrupt += ShiftInputPolledBools; for (int i = 0; i < controllerSettings.Length; ++i) { SetControllerConnected(i, controllerSettings[i].IsConnected); SetControllerPakType(i, controllerSettings[i].PakType); } }
private static void PutSyncSettings(N64SyncSettings s) { if (Global.Emulator is N64) { GlobalWin.MainForm.PutCoreSyncSettings(s); } else { Global.Config.PutCoreSyncSettings<N64>(s); } }
/// <summary> /// Sets the controller pak of the controller to the specified type /// </summary> /// <param name="controller">Id of the controller</param> /// <param name="type">Type to which the controller pak is set. Currently only NO_PAK and MEMORY_CARD are supported</param> public void SetControllerPakType(int controller, N64SyncSettings.N64ControllerSettings.N64ControllerPakType type) { api.SetM64PControllerPakType(controller, type); }
public bool PutSyncSettings(object o) { _syncSettings = (N64SyncSettings)o; SetControllerButtons(); return(true); }
/// <summary> /// Create mupen64plus Emulator /// </summary> /// <param name="comm">Core communication object</param> /// <param name="game">Game information of game to load</param> /// <param name="rom">Rom that should be loaded</param> /// <param name="SyncSettings">N64SyncSettings object</param> public N64(CoreComm comm, GameInfo game, byte[] rom, object settings, object syncSettings) { int SaveType = 0; if (game.OptionValue("SaveType") == "EEPROM_16K") { SaveType = 1; } CoreComm = comm; _syncSettings = (N64SyncSettings)syncSettings ?? new N64SyncSettings(); _settings = (N64Settings)settings ?? new N64Settings(); byte country_code = rom[0x3E]; switch (country_code) { // PAL codes case 0x44: case 0x46: case 0x49: case 0x50: case 0x53: case 0x55: case 0x58: case 0x59: _display_type = DisplayType.PAL; break; // NTSC codes case 0x37: case 0x41: case 0x45: case 0x4a: default: // Fallback for unknown codes _display_type = DisplayType.NTSC; break; } switch (DisplayType) { case DisplayType.NTSC: comm.VsyncNum = 60000; comm.VsyncDen = 1001; break; default: comm.VsyncNum = 50; comm.VsyncDen = 1; break; } StartThreadLoop(); var videosettings = _syncSettings.GetVPS(game, _settings.VideoSizeX, _settings.VideoSizeY); var coreType = _syncSettings.Core; //zero 19-apr-2014 - added this to solve problem with SDL initialization corrupting the main thread (I think) and breaking subsequent emulators (for example, NES) //not sure why this works... if we put the plugin initializations in here, we get deadlocks in some SDL initialization. doesnt make sense to me... RunThreadAction(() => { api = new mupen64plusApi(this, rom, videosettings, SaveType, (int)coreType); }); // Order is important because the register with the mupen core _videoProvider = new N64VideoProvider(api, videosettings); _audioProvider = new N64Audio(api); _inputProvider = new N64Input(api, comm, this._syncSettings.Controllers); string rsp = _syncSettings.Rsp == N64SyncSettings.RspType.Rsp_Hle ? "mupen64plus-rsp-hle.dll" : "mupen64plus-rsp-z64-hlevideo.dll"; api.AttachPlugin(mupen64plusApi.m64p_plugin_type.M64PLUGIN_RSP, rsp); InitMemoryDomains(); RefreshMemoryCallbacks(); api.AsyncExecuteEmulator(); SetControllerButtons(); }
public bool PutSyncSettings(object o) { _syncSettings = (N64SyncSettings)o; SetControllerButtons(); return true; }
private void N64VideoPluginconfig_Load(object sender, EventArgs e) { s = GetSettings(); ss = GetSyncSettings(); CoreTypeDropdown.PopulateFromEnum<N64SyncSettings.CoreType>(ss.Core); RspTypeDropdown.PopulateFromEnum<N64SyncSettings.RspType>(ss.Rsp); switch (ss.VideoPlugin) { case PluginType.GlideMk2: PluginComboBox.Text = "Glide64mk2"; break; case PluginType.Glide: PluginComboBox.Text = "Glide64"; break; case PluginType.Rice: PluginComboBox.Text = "Rice"; break; case PluginType.Jabo: PluginComboBox.Text = "Jabo 1.6.1"; break; } VideoResolutionXTextBox.Text = s.VideoSizeX.ToString(); VideoResolutionYTextBox.Text = s.VideoSizeY.ToString(); var video_setting = s.VideoSizeX + " x " + s.VideoSizeY; var index = VideoResolutionComboBox.Items.IndexOf(video_setting); if (index >= 0) { VideoResolutionComboBox.SelectedIndex = index; } else if (PluginComboBox.SelectedIndex != 4) { VideoResolutionComboBox.SelectedIndex = 13; ShowCustomVideoResolutionControls(); } // Jabo JaboUseForGameCheckbox.Checked = ss.JaboPlugin.UseDefaultHacks; JaboClearModeDropDown .PopulateFromEnum<N64SyncSettings.N64JaboPluginSettings.Direct3DClearMode>(ss.JaboPlugin.clear_mode); JaboResolutionWidthBox.Text = ss.JaboPlugin.resolution_width.ToString(); JaboResolutionHeightBox.Text = ss.JaboPlugin.resolution_height.ToString(); JaboUpdateHacksSection(); JaboAnisotropicFilteringLevelDropdown .PopulateFromEnum<N64SyncSettings.N64JaboPluginSettings.ANISOTROPIC_FILTERING_LEVEL>(ss.JaboPlugin.anisotropic_level); JaboAntialiasingLevelDropdown .PopulateFromEnum<N64SyncSettings.N64JaboPluginSettings.ANTIALIASING_LEVEL>(ss.JaboPlugin.antialiasing_level); JaboBrightnessBox.Value = ss.JaboPlugin.brightness; JaboSuper2xsalCheckbox.Checked = ss.JaboPlugin.super2xsal; JaboTextureFilterCheckbox.Checked = ss.JaboPlugin.texture_filter; JaboAdjustAspectRatioCheckbox.Checked = ss.JaboPlugin.adjust_aspect_ratio; JaboLegacyPixelPipelineCheckbox.Checked = ss.JaboPlugin.legacy_pixel_pipeline; JaboAlphaBlendingCheckbox.Checked = ss.JaboPlugin.alpha_blending; JaboDirect3DPipelineCheckbox.Checked = ss.JaboPlugin.direct3d_transformation_pipeline; JaboZCompareCheckbox.Checked = ss.JaboPlugin.z_compare; JaboCopyFrameBufferCheckbox.Checked = ss.JaboPlugin.copy_framebuffer; //Rice RiceNormalAlphaBlender_CB.Checked = ss.RicePlugin.NormalAlphaBlender; RiceFastTextureLoading_CB.Checked = ss.RicePlugin.FastTextureLoading; RiceAccurateTextureMapping_CB.Checked = ss.RicePlugin.AccurateTextureMapping; RiceInN64Resolution_CB.Checked = ss.RicePlugin.InN64Resolution; RiceSaveVRAM_CB.Checked = ss.RicePlugin.SaveVRAM; RiceDoubleSizeForSmallTxtrBuf_CB.Checked = ss.RicePlugin.DoubleSizeForSmallTxtrBuf; RiceDefaultCombinerDisable_CB.Checked = ss.RicePlugin.DefaultCombinerDisable; RiceEnableHacks_CB.Checked = ss.RicePlugin.EnableHacks; RiceWinFrameMode_CB.Checked = ss.RicePlugin.WinFrameMode; RiceFullTMEMEmulation_CB.Checked = ss.RicePlugin.FullTMEMEmulation; RiceOpenGLVertexClipper_CB.Checked = ss.RicePlugin.OpenGLVertexClipper; RiceEnableSSE_CB.Checked = ss.RicePlugin.EnableSSE; RiceEnableVertexShader_CB.Checked = ss.RicePlugin.EnableVertexShader; RiceSkipFrame_CB.Checked = ss.RicePlugin.SkipFrame; RiceTexRectOnly_CB.Checked = ss.RicePlugin.TexRectOnly; RiceSmallTextureOnly_CB.Checked = ss.RicePlugin.SmallTextureOnly; RiceLoadHiResCRCOnly_CB.Checked = ss.RicePlugin.LoadHiResCRCOnly; RiceLoadHiResTextures_CB.Checked = ss.RicePlugin.LoadHiResTextures; RiceDumpTexturesToFiles_CB.Checked = ss.RicePlugin.DumpTexturesToFiles; RiceFrameBufferSetting_Combo.SelectedIndex = ss.RicePlugin.FrameBufferSetting; RiceFrameBufferWriteBackControl_Combo.SelectedIndex = ss.RicePlugin.FrameBufferWriteBackControl; RiceRenderToTexture_Combo.SelectedIndex = ss.RicePlugin.RenderToTexture; RiceScreenUpdateSetting_Combo.SelectedIndex = ss.RicePlugin.ScreenUpdateSetting; RiceMipmapping_Combo.SelectedIndex = ss.RicePlugin.Mipmapping; RiceFogMethod_Combo.SelectedIndex = ss.RicePlugin.FogMethod; RiceForceTextureFilter_Combo.SelectedIndex = ss.RicePlugin.ForceTextureFilter; RiceTextureEnhancement_Combo.SelectedIndex = ss.RicePlugin.TextureEnhancement; RiceTextureEnhancementControl_Combo.SelectedIndex = ss.RicePlugin.TextureEnhancementControl; RiceTextureQuality_Combo.SelectedIndex = ss.RicePlugin.TextureQuality; RiceOpenGLDepthBufferSetting_Combo.SelectedIndex = (ss.RicePlugin.OpenGLDepthBufferSetting / 16) - 1; switch (ss.RicePlugin.MultiSampling) { case 0: RiceMultiSampling_Combo.SelectedIndex = 0; break; case 2: RiceMultiSampling_Combo.SelectedIndex = 1; break; case 4: RiceMultiSampling_Combo.SelectedIndex = 2; break; case 8: RiceMultiSampling_Combo.SelectedIndex = 3; break; case 16: RiceMultiSampling_Combo.SelectedIndex = 4; break; default: RiceMultiSampling_Combo.SelectedIndex = 0; break; } RiceColorQuality_Combo.SelectedIndex = ss.RicePlugin.ColorQuality; RiceOpenGLRenderSetting_Combo.SelectedIndex = ss.RicePlugin.OpenGLRenderSetting; RiceAnisotropicFiltering_TB.Value = ss.RicePlugin.AnisotropicFiltering; AnisotropicFiltering_LB.Text = "Anisotropic Filtering: " + RiceAnisotropicFiltering_TB.Value; RiceUseDefaultHacks_CB.Checked = ss.RicePlugin.UseDefaultHacks; UpdateRiceHacksSection(); if (!ss.RicePlugin.UseDefaultHacks) { RiceTexture1Hack_CB.Checked = ss.RicePlugin.Texture1Hack; RiceDisableTextureCRC_CB.Checked = ss.RicePlugin.DisableTextureCRC; RiceDisableCulling_CB.Checked = ss.RicePlugin.DisableCulling; RiceIncTexRectEdge_CB.Checked = ss.RicePlugin.IncTexRectEdge; RiceZHack_CB.Checked = ss.RicePlugin.ZHack; RiceTextureScaleHack_CB.Checked = ss.RicePlugin.TextureScaleHack; RicePrimaryDepthHack_CB.Checked = ss.RicePlugin.PrimaryDepthHack; RiceTexture1Hack_CB.Checked = ss.RicePlugin.Texture1Hack; RiceFastLoadTile_CB.Checked = ss.RicePlugin.FastLoadTile; RiceUseSmallerTexture_CB.Checked = ss.RicePlugin.UseSmallerTexture; RiceVIWidth_Text.Text = ss.RicePlugin.VIWidth.ToString(); RiceVIHeight_Text.Text = ss.RicePlugin.VIHeight.ToString(); RiceUseCIWidthAndRatio_Combo.SelectedIndex = ss.RicePlugin.UseCIWidthAndRatio; RiceFullTMEM_Combo.SelectedIndex = ss.RicePlugin.FullTMEM; RiceTxtSizeMethod2_CB.Checked = ss.RicePlugin.TxtSizeMethod2; RiceEnableTxtLOD_CB.Checked = ss.RicePlugin.EnableTxtLOD; RiceFastTextureCRC_Combo.SelectedIndex = ss.RicePlugin.FastTextureCRC; RiceEmulateClear_CB.Checked = ss.RicePlugin.EmulateClear; RiceForceScreenClear_CB.Checked = ss.RicePlugin.ForceScreenClear; RiceAccurateTextureMappingHack_Combo.SelectedIndex = ss.RicePlugin.AccurateTextureMappingHack; RiceNormalBlender_Combo.SelectedIndex = ss.RicePlugin.NormalBlender; RiceDisableBlender_CB.Checked = ss.RicePlugin.DisableBlender; RiceForceDepthBuffer_CB.Checked = ss.RicePlugin.ForceDepthBuffer; RiceDisableObjBG_CB.Checked = ss.RicePlugin.DisableObjBG; RiceFrameBufferOption_Combo.SelectedIndex = ss.RicePlugin.FrameBufferOption; RiceRenderToTextureOption_Combo.SelectedIndex = ss.RicePlugin.RenderToTextureOption; RiceScreenUpdateSettingHack_Combo.SelectedIndex = ss.RicePlugin.ScreenUpdateSettingHack; RiceEnableHacksForGame_Combo.SelectedIndex = ss.RicePlugin.EnableHacksForGame; } Glide_autodetect_ucode.Checked = ss.GlidePlugin.autodetect_ucode; Glide_ucode.SelectedIndex = ss.GlidePlugin.ucode; Glide_flame_corona.Checked = ss.GlidePlugin.flame_corona; Glide_card_id.SelectedIndex = ss.GlidePlugin.card_id; Glide_tex_filter.SelectedIndex = ss.GlidePlugin.tex_filter; Glide_wireframe.Checked = ss.GlidePlugin.wireframe; Glide_wfmode.SelectedIndex = ss.GlidePlugin.wfmode; Glide_fast_crc.Checked = ss.GlidePlugin.fast_crc; Glide_filter_cache.Checked = ss.GlidePlugin.filter_cache; Glide_unk_as_red.Checked = ss.GlidePlugin.unk_as_red; Glide_fb_read_always.Checked = ss.GlidePlugin.fb_read_always; Glide_motionblur.Checked = ss.GlidePlugin.motionblur; Glide_fb_render.Checked = ss.GlidePlugin.fb_render; Glide_noditheredalpha.Checked = ss.GlidePlugin.noditheredalpha; Glide_noglsl.Checked = ss.GlidePlugin.noglsl; Glide_fbo.Checked = ss.GlidePlugin.fbo; Glide_disable_auxbuf.Checked = ss.GlidePlugin.disable_auxbuf; Glide_fb_get_info.Checked = ss.GlidePlugin.fb_get_info; Glide_offset_x.Text = ss.GlidePlugin.offset_x.ToString(); Glide_offset_y.Text = ss.GlidePlugin.offset_y.ToString(); Glide_scale_x.Text = ss.GlidePlugin.scale_x.ToString(); Glide_scale_y.Text = ss.GlidePlugin.scale_y.ToString(); GlideUseDefaultHacks1.Checked = ss.GlidePlugin.UseDefaultHacks; GlideUseDefaultHacks2.Checked = ss.GlidePlugin.UseDefaultHacks; UpdateGlideHacksSection(); if (!ss.GlidePlugin.UseDefaultHacks) { Glide_alt_tex_size.Checked = ss.GlidePlugin.alt_tex_size; Glide_buff_clear.Checked = ss.GlidePlugin.buff_clear; Glide_decrease_fillrect_edge.Checked = ss.GlidePlugin.decrease_fillrect_edge; Glide_detect_cpu_write.Checked = ss.GlidePlugin.detect_cpu_write; Glide_fb_clear.Checked = ss.GlidePlugin.fb_clear; Glide_fb_hires.Checked = ss.GlidePlugin.fb_hires; Glide_fb_read_alpha.Checked = ss.GlidePlugin.fb_read_alpha; Glide_fb_smart.Checked = ss.GlidePlugin.fb_smart; Glide_fillcolor_fix.Checked = ss.GlidePlugin.fillcolor_fix; Glide_fog.Checked = ss.GlidePlugin.fog; Glide_force_depth_compare.Checked = ss.GlidePlugin.force_depth_compare; Glide_force_microcheck.Checked = ss.GlidePlugin.force_microcheck; Glide_fb_hires_buf_clear.Checked = ss.GlidePlugin.fb_hires_buf_clear; Glide_fb_ignore_aux_copy.Checked = ss.GlidePlugin.fb_ignore_aux_copy; Glide_fb_ignore_previous.Checked = ss.GlidePlugin.fb_ignore_previous; Glide_increase_primdepth.Checked = ss.GlidePlugin.increase_primdepth; Glide_increase_texrect_edge.Checked = ss.GlidePlugin.increase_texrect_edge; Glide_fb_optimize_texrect.Checked = ss.GlidePlugin.fb_optimize_texrect; Glide_fb_optimize_write.Checked = ss.GlidePlugin.fb_optimize_write; Glide_PPL.Checked = ss.GlidePlugin.PPL; Glide_soft_depth_compare.Checked = ss.GlidePlugin.soft_depth_compare; Glide_use_sts1_only.Checked = ss.GlidePlugin.use_sts1_only; Glide_wrap_big_tex.Checked = ss.GlidePlugin.wrap_big_tex; Glide_depth_bias.Text = ss.GlidePlugin.depth_bias.ToString(); Glide_filtering.SelectedIndex = ss.GlidePlugin.filtering; Glide_fix_tex_coord.Text = ss.GlidePlugin.fix_tex_coord.ToString(); Glide_lodmode.SelectedIndex = ss.GlidePlugin.lodmode; Glide_stipple_mode.Text = ss.GlidePlugin.stipple_mode.ToString(); Glide_stipple_pattern.Text = ss.GlidePlugin.stipple_pattern.ToString(); Glide_swapmode.SelectedIndex = ss.GlidePlugin.swapmode; Glide_enable_hacks_for_game.SelectedIndex = ss.GlidePlugin.enable_hacks_for_game; } Glide64mk2_card_id.SelectedIndex = ss.Glide64mk2Plugin.card_id; Glide64mk2_wrpFBO.Checked = ss.Glide64mk2Plugin.wrpFBO; Glide64mk2_wrpAnisotropic.Checked = ss.Glide64mk2Plugin.wrpAnisotropic; Glide64mk2_fb_get_info.Checked = ss.Glide64mk2Plugin.fb_get_info; Glide64mk2_fb_render.Checked = ss.Glide64mk2Plugin.fb_render; Glide64mk2_UseDefaultHacks1.Checked = ss.Glide64mk2Plugin.UseDefaultHacks; Glide64mk2_UseDefaultHacks2.Checked = ss.Glide64mk2Plugin.UseDefaultHacks; UpdateGlide64mk2HacksSection(); if (!ss.Glide64mk2Plugin.UseDefaultHacks) { Glide64mk2_use_sts1_only.Checked = ss.Glide64mk2Plugin.use_sts1_only; Glide64mk2_optimize_texrect.Checked = ss.Glide64mk2Plugin.optimize_texrect; Glide64mk2_increase_texrect_edge.Checked = ss.Glide64mk2Plugin.increase_texrect_edge; Glide64mk2_ignore_aux_copy.Checked = ss.Glide64mk2Plugin.ignore_aux_copy; Glide64mk2_hires_buf_clear.Checked = ss.Glide64mk2Plugin.hires_buf_clear; Glide64mk2_force_microcheck.Checked = ss.Glide64mk2Plugin.force_microcheck; Glide64mk2_fog.Checked = ss.Glide64mk2Plugin.fog; Glide64mk2_fb_smart.Checked = ss.Glide64mk2Plugin.fb_smart; Glide64mk2_fb_read_alpha.Checked = ss.Glide64mk2Plugin.fb_read_alpha; Glide64mk2_fb_hires.Checked = ss.Glide64mk2Plugin.fb_hires; Glide64mk2_detect_cpu_write.Checked = ss.Glide64mk2Plugin.detect_cpu_write; Glide64mk2_decrease_fillrect_edge.Checked = ss.Glide64mk2Plugin.decrease_fillrect_edge; Glide64mk2_buff_clear.Checked = ss.Glide64mk2Plugin.buff_clear; Glide64mk2_alt_tex_size.Checked = ss.Glide64mk2Plugin.alt_tex_size; Glide64mk2_swapmode.SelectedIndex = ss.Glide64mk2Plugin.swapmode; Glide64mk2_stipple_pattern.Text = ss.Glide64mk2Plugin.stipple_pattern.ToString(); Glide64mk2_stipple_mode.Text = ss.Glide64mk2Plugin.stipple_mode.ToString(); Glide64mk2_lodmode.SelectedIndex = ss.Glide64mk2Plugin.lodmode; Glide64mk2_filtering.SelectedIndex = ss.Glide64mk2Plugin.filtering; Glide64mk2_correct_viewport.Checked = ss.Glide64mk2Plugin.correct_viewport; Glide64mk2_force_calc_sphere.Checked = ss.Glide64mk2Plugin.force_calc_sphere; Glide64mk2_pal230.Checked = ss.Glide64mk2Plugin.pal230; Glide64mk2_texture_correction.Checked = ss.Glide64mk2Plugin.texture_correction; Glide64mk2_n64_z_scale.Checked = ss.Glide64mk2Plugin.n64_z_scale; Glide64mk2_old_style_adither.Checked = ss.Glide64mk2Plugin.old_style_adither; Glide64mk2_zmode_compare_less.Checked = ss.Glide64mk2Plugin.zmode_compare_less; Glide64mk2_adjust_aspect.Checked = ss.Glide64mk2Plugin.adjust_aspect; Glide64mk2_clip_zmax.Checked = ss.Glide64mk2Plugin.clip_zmax; Glide64mk2_clip_zmin.Checked = ss.Glide64mk2Plugin.clip_zmin; Glide64mk2_force_quad3d.Checked = ss.Glide64mk2Plugin.force_quad3d; Glide64mk2_useless_is_useless.Checked = ss.Glide64mk2Plugin.useless_is_useless; Glide64mk2_fb_read_always.Checked = ss.Glide64mk2Plugin.fb_read_always; Glide64mk2_aspectmode.SelectedIndex = ss.Glide64mk2Plugin.aspectmode; Glide64mk2_fb_crc_mode.SelectedIndex = ss.Glide64mk2Plugin.fb_crc_mode; Glide64mk2_enable_hacks_for_game.SelectedIndex = ss.Glide64mk2Plugin.enable_hacks_for_game; Glide64mk2_read_back_to_screen.SelectedIndex = ss.Glide64mk2Plugin.read_back_to_screen; Glide64mk2_fast_crc.Checked = ss.Glide64mk2Plugin.fast_crc; } }