From 4f4ebfb855d0119c96d2cf2a9e888e63cd15c8f6 Mon Sep 17 00:00:00 2001 From: Frank-74 Date: Mon, 17 Dec 2018 23:51:28 +0000 Subject: [PATCH 1/5] Fix #1510 --- Source/Project64/Settings/UISettings.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/Project64/Settings/UISettings.cpp b/Source/Project64/Settings/UISettings.cpp index de255b0c9..5b664d000 100644 --- a/Source/Project64/Settings/UISettings.cpp +++ b/Source/Project64/Settings/UISettings.cpp @@ -28,10 +28,10 @@ void RegisterUISettings (void) g_Settings->AddHandler((SettingID)(FirstUISettings + SupportFile_ShortCutsDefault), new CSettingTypeRelativePath("Config", "Project64.sc3")); //Settings location - g_Settings->AddHandler((SettingID)(FirstUISettings + Setting_PluginPageFirst), new CSettingTypeApplication("", "Plugin Page First", false)); - g_Settings->AddHandler((SettingID)(FirstUISettings + Setting_DisableScrSaver), new CSettingTypeApplication("", "Disable Screen Saver", (uint32_t)true)); - g_Settings->AddHandler((SettingID)(FirstUISettings + Setting_AutoSleep), new CSettingTypeApplication("", "Auto Sleep", (uint32_t)true)); - g_Settings->AddHandler((SettingID)(FirstUISettings + Setting_AutoFullscreen), new CSettingTypeApplication("", "Auto Full Screen", (uint32_t)false)); + g_Settings->AddHandler((SettingID)(FirstUISettings + Setting_PluginPageFirst), new CSettingTypeApplication("Settings", "Plugin Page First", false)); + g_Settings->AddHandler((SettingID)(FirstUISettings + Setting_DisableScrSaver), new CSettingTypeApplication("Settings", "Disable Screen Saver", (uint32_t)true)); + g_Settings->AddHandler((SettingID)(FirstUISettings + Setting_AutoSleep), new CSettingTypeApplication("Settings", "Auto Sleep", (uint32_t)true)); + g_Settings->AddHandler((SettingID)(FirstUISettings + Setting_AutoFullscreen), new CSettingTypeApplication("Settings", "Auto Full Screen", (uint32_t)false)); //RDB Settings g_Settings->AddHandler((SettingID)(FirstUISettings + Rdb_Status), new CSettingTypeRomDatabase("Status", "Unknown")); @@ -147,4 +147,4 @@ std::string UISettingsLoadStringVal(UISettingID Type) bool UISettingsLoadStringVal(UISettingID Type, char * Buffer, int32_t BufferSize) { return g_Settings->LoadStringVal((SettingID)(FirstUISettings + Type),Buffer,BufferSize); -} \ No newline at end of file +} From 9ab7a83c2686ee8e160fda22452de38aa986e7a1 Mon Sep 17 00:00:00 2001 From: zilmar Date: Thu, 20 Dec 2018 16:08:26 +1030 Subject: [PATCH 2/5] [Project64] Remove FR_None option --- Source/Project64-core/Multilanguage/LanguageClass.cpp | 3 +-- Source/Project64-core/N64System/N64Types.h | 2 +- Source/Project64-core/Settings.cpp | 6 +----- .../UserInterface/Settings/SettingsPage-AdvancedOptions.cpp | 5 ++--- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/Source/Project64-core/Multilanguage/LanguageClass.cpp b/Source/Project64-core/Multilanguage/LanguageClass.cpp index 8fd68e49a..e0ff1a3c8 100644 --- a/Source/Project64-core/Multilanguage/LanguageClass.cpp +++ b/Source/Project64-core/Multilanguage/LanguageClass.cpp @@ -354,8 +354,7 @@ void CLanguage::LoadDefaultStrings(void) DEF_STR(STR_FR_VIS, "Vertical interrupts per second"); DEF_STR(STR_FR_DLS, "Display lists per second"); DEF_STR(STR_FR_PERCENT, "Percentage of full speed"); - DEF_STR(STR_FR_DLS_VIS, "VI/s & DL/s"); - DEF_STR(STR_FR_NONE, "None"); + DEF_STR(STR_FR_DLS_VIS, "VI/s & DL/s"); // Increase speed DEF_STR(STR_INSREASE_SPEED, "Increase Game Speed"); diff --git a/Source/Project64-core/N64System/N64Types.h b/Source/Project64-core/N64System/N64Types.h index 0a4d80bf2..204c9adab 100644 --- a/Source/Project64-core/N64System/N64Types.h +++ b/Source/Project64-core/N64System/N64Types.h @@ -45,7 +45,7 @@ enum CPU_TYPE enum FRAMERATE_TYPE { - FR_VIs = 0, FR_DLs = 1, FR_PERCENT = 2, FR_VIs_DLs = 3, FR_None = 4, + FR_VIs = 0, FR_DLs = 1, FR_PERCENT = 2, FR_VIs_DLs = 3, }; enum SAVE_CHIP_TYPE diff --git a/Source/Project64-core/Settings.cpp b/Source/Project64-core/Settings.cpp index fb4cebfe3..9cf394fc8 100644 --- a/Source/Project64-core/Settings.cpp +++ b/Source/Project64-core/Settings.cpp @@ -241,12 +241,8 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory) //User Interface AddHandler(UserInterface_ShowCPUPer, new CSettingTypeApplication("Settings", "Display CPU Usage", (uint32_t)false)); -#ifdef ANDROID AddHandler(UserInterface_DisplayFrameRate, new CSettingTypeApplication("Settings", "Display Frame Rate", (uint32_t)false)); -#else - AddHandler(UserInterface_DisplayFrameRate, new CSettingTypeApplication("Settings", "Display Frame Rate", (uint32_t)true)); -#endif - AddHandler(UserInterface_FrameDisplayType, new CSettingTypeApplication("Settings", "Frame Rate Display Type", (uint32_t)FR_None)); + AddHandler(UserInterface_FrameDisplayType, new CSettingTypeApplication("Settings", "Frame Rate Display Type", (uint32_t)FR_VIs)); AddHandler(Directory_Plugin, new CSettingTypeSelectedDirectory("Dir:Plugin", Directory_PluginInitial, Directory_PluginSelected, Directory_PluginUseSelected, Directory_Plugin)); #ifndef _M_X64 AddHandler(Directory_PluginInitial, new CSettingTypeRelativePath("Plugin", "")); diff --git a/Source/Project64/UserInterface/Settings/SettingsPage-AdvancedOptions.cpp b/Source/Project64/UserInterface/Settings/SettingsPage-AdvancedOptions.cpp index f2085be65..a99b2d375 100644 --- a/Source/Project64/UserInterface/Settings/SettingsPage-AdvancedOptions.cpp +++ b/Source/Project64/UserInterface/Settings/SettingsPage-AdvancedOptions.cpp @@ -45,9 +45,8 @@ CAdvancedOptionsPage::CAdvancedOptionsPage(HWND hParent, const RECT & rcDispay) ComboBox->AddItemW(wGS(STR_FR_VIS).c_str(), FR_VIs); ComboBox->AddItemW(wGS(STR_FR_DLS).c_str(), FR_DLs); ComboBox->AddItemW(wGS(STR_FR_PERCENT).c_str(), FR_PERCENT); - ComboBox->AddItemW(wGS(STR_FR_DLS_VIS).c_str(), FR_VIs_DLs); - ComboBox->AddItemW(wGS(STR_FR_NONE).c_str(), FR_None); - } + ComboBox->AddItemW(wGS(STR_FR_DLS_VIS).c_str(), FR_VIs_DLs); + } m_IplDir.Attach(GetDlgItem(IDC_IPL_DIR)); From eddd90bbeb171efe68d7f6d39ce4f9193b521842 Mon Sep 17 00:00:00 2001 From: zilmar Date: Thu, 20 Dec 2018 20:49:14 +1030 Subject: [PATCH 3/5] [Project64] Try to fix sync to audio --- Source/Project64-audio/AudioMain.cpp | 4 ++++ Source/Project64-audio/AudioSettings.cpp | 15 ++++++++++----- Source/Project64-audio/AudioSettings.h | 10 ++++++---- Source/Project64-core/Plugins/AudioPlugin.cpp | 3 ++- Source/Project64-core/Plugins/PluginClass.cpp | 5 +++++ Source/Project64-core/Settings/GameSettings.cpp | 9 +++++++-- Source/Project64-core/Settings/GameSettings.h | 2 ++ 7 files changed, 36 insertions(+), 12 deletions(-) diff --git a/Source/Project64-audio/AudioMain.cpp b/Source/Project64-audio/AudioMain.cpp index 9d71f6ed5..47e9ce2c0 100644 --- a/Source/Project64-audio/AudioMain.cpp +++ b/Source/Project64-audio/AudioMain.cpp @@ -65,6 +65,10 @@ EXPORT void CALL PluginLoaded(void) { PluginInit(); WriteTrace(TraceAudioInterface, TraceDebug, "Called"); + if (g_settings != NULL) + { + g_settings->SetSyncViaAudioEnabled(true); + } } EXPORT void CALL AiDacrateChanged(int SystemType) diff --git a/Source/Project64-audio/AudioSettings.cpp b/Source/Project64-audio/AudioSettings.cpp index cef5a25ef..798e9d0aa 100644 --- a/Source/Project64-audio/AudioSettings.cpp +++ b/Source/Project64-audio/AudioSettings.cpp @@ -16,6 +16,7 @@ CSettings * g_settings = NULL; CSettings::CSettings() : + m_Set_SyncViaAudioEnabled(0), m_Set_EnableAudio(0), m_Set_FixedAudio(0), m_Set_SyncAudio(0), @@ -81,11 +82,7 @@ CSettings::~CSettings() void CSettings::RegisterSettings(void) { SetModuleName("default"); - short Set_SyncViaAudioEnabled = FindSystemSettingId("SyncViaAudioEnabled"); - if (Set_SyncViaAudioEnabled != 0) - { - SetSystemSetting(Set_SyncViaAudioEnabled, 1); - } + m_Set_SyncViaAudioEnabled = FindSystemSettingId("SyncViaAudioEnabled"); m_Set_EnableAudio = FindSystemSettingId("Enable Audio"); m_Set_FixedAudio = FindSystemSettingId("Fixed Audio"); m_Set_SyncAudio = FindSystemSettingId("Sync Audio"); @@ -109,6 +106,14 @@ void CSettings::RegisterSettings(void) LogLevelChanged(); } +void CSettings::SetSyncViaAudioEnabled(bool Enabled) +{ + if (m_Set_SyncViaAudioEnabled != 0) + { + SetSystemSetting(m_Set_SyncViaAudioEnabled, Enabled ? 1 : 0); + } +} + void CSettings::SetAudioEnabled(bool Enabled) { if (m_Set_EnableAudio != 0) diff --git a/Source/Project64-audio/AudioSettings.h b/Source/Project64-audio/AudioSettings.h index 2e3d254f5..334d74099 100644 --- a/Source/Project64-audio/AudioSettings.h +++ b/Source/Project64-audio/AudioSettings.h @@ -26,8 +26,9 @@ public: inline bool FlushLogs(void) const { return m_FlushLogs; } inline const char * log_dir(void) const { return m_log_dir; } - void SetAudioEnabled(bool Enabled); - void SetVolume(uint32_t Volume); + void SetSyncViaAudioEnabled(bool Enabled); + void SetAudioEnabled(bool Enabled); + void SetVolume(uint32_t Volume); void SetTinyBuffer(bool TinyBuffer); void SetFPSBuffer(bool FPSBuffer); void ReadSettings(); @@ -45,8 +46,9 @@ private: void RegisterSettings(void); void LogLevelChanged(void); - short m_Set_EnableAudio; - short m_Set_FixedAudio; + short m_Set_SyncViaAudioEnabled; + short m_Set_EnableAudio; + short m_Set_FixedAudio; short m_Set_SyncAudio; short m_Set_FullSpeed; short m_Set_LimitFPS; diff --git a/Source/Project64-core/Plugins/AudioPlugin.cpp b/Source/Project64-core/Plugins/AudioPlugin.cpp index df7f879e7..85324f1e4 100644 --- a/Source/Project64-core/Plugins/AudioPlugin.cpp +++ b/Source/Project64-core/Plugins/AudioPlugin.cpp @@ -37,6 +37,8 @@ CAudioPlugin::~CAudioPlugin() bool CAudioPlugin::LoadFunctions(void) { + g_Settings->SaveBool(Setting_SyncViaAudioEnabled, false); + // Find entries for functions in DLL void(CALL *InitiateAudio)(void); LoadFunction(InitiateAudio); @@ -62,7 +64,6 @@ bool CAudioPlugin::LoadFunctions(void) bool CAudioPlugin::Initiate(CN64System * System, RenderWindow * Window) { - g_Settings->SaveBool(Setting_SyncViaAudioEnabled, false); struct AUDIO_INFO { void * hwnd; diff --git a/Source/Project64-core/Plugins/PluginClass.cpp b/Source/Project64-core/Plugins/PluginClass.cpp index faefa5b33..845c9ebe4 100644 --- a/Source/Project64-core/Plugins/PluginClass.cpp +++ b/Source/Project64-core/Plugins/PluginClass.cpp @@ -363,6 +363,11 @@ bool CPlugins::Reset(CN64System * System) if (!m_RSP->Initiate(this, System)) { return false; } WriteTrace(TraceRSPPlugin, TraceDebug, "RSP Initiate Done"); } + + if (System) + { + System->RefreshSyncToAudio(); + } WriteTrace(TracePlugins, TraceDebug, "Done"); return true; } diff --git a/Source/Project64-core/Settings/GameSettings.cpp b/Source/Project64-core/Settings/GameSettings.cpp index 6ee003245..e4886016a 100644 --- a/Source/Project64-core/Settings/GameSettings.cpp +++ b/Source/Project64-core/Settings/GameSettings.cpp @@ -57,7 +57,6 @@ void CGameSettings::RefreshGameSettings() m_DelaySI = g_Settings->LoadBool(Game_DelaySI); m_DelayDP = g_Settings->LoadBool(Game_DelayDP); m_bFixedAudio = g_Settings->LoadBool(Game_FixedAudio); - m_bSyncToAudio = g_Settings->LoadBool(Game_SyncViaAudio) && g_Settings->LoadBool(Setting_SyncViaAudioEnabled); m_FullSpeed = g_Settings->LoadBool(Game_FullSpeed); m_b32Bit = g_Settings->LoadBool(Game_32Bit); #ifdef ANDROID @@ -79,6 +78,7 @@ void CGameSettings::RefreshGameSettings() } if (m_OverClockModifier < 1) { m_OverClockModifier = 1; } if (m_OverClockModifier > 20) { m_OverClockModifier = 20; } + RefreshSyncToAudio(); WriteTrace(TraceN64System, TraceDebug, "Done"); } @@ -86,4 +86,9 @@ void CGameSettings::SpeedChanged(int SpeedLimit) { m_FullSpeed = (g_System->m_SystemType == SYSTEM_PAL ? 50 : 60) == SpeedLimit; g_Settings->SaveBool(Game_FullSpeed, m_FullSpeed); -} \ No newline at end of file +} + +void CGameSettings::RefreshSyncToAudio(void) +{ + m_bSyncToAudio = g_Settings->LoadBool(Game_SyncViaAudio) && g_Settings->LoadBool(Setting_SyncViaAudioEnabled); +} diff --git a/Source/Project64-core/Settings/GameSettings.h b/Source/Project64-core/Settings/GameSettings.h index 3fe145d25..c1ac29849 100644 --- a/Source/Project64-core/Settings/GameSettings.h +++ b/Source/Project64-core/Settings/GameSettings.h @@ -45,6 +45,8 @@ public: inline static CPU_TYPE CpuType(void) { return m_CpuType; } inline static uint32_t OverClockModifier(void) { return m_OverClockModifier; } + void RefreshSyncToAudio(void); + protected: static void SpeedChanged(int32_t SpeedLimit); From 2408fa0f08526b1af50e33d172e59742175c440d Mon Sep 17 00:00:00 2001 From: shygoo Date: Thu, 27 Dec 2018 15:57:18 -0600 Subject: [PATCH 4/5] [Debugger] Fix opcode editor in the commands window --- Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp b/Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp index f6d5df47b..834e639d9 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp @@ -1253,7 +1253,7 @@ void CDebugCommandsView::GotoEnteredAddress() void CDebugCommandsView::BeginOpEdit(uint32_t address) { uint32_t opcode; - if (m_Debugger->DebugLW_VAddr(address, opcode)) + if (!m_Debugger->DebugLW_VAddr(address, opcode)) { return; } From 75cc0595014bb9e8ffe78e56855ce5af324ab767 Mon Sep 17 00:00:00 2001 From: shygoo Date: Thu, 27 Dec 2018 16:08:14 -0600 Subject: [PATCH 5/5] [Debugger] Fix issue with the address field ignoring first input --- Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp b/Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp index 834e639d9..32e807d55 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp @@ -124,6 +124,7 @@ LRESULT CDebugCommandsView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARA m_bIgnoreAddrChange = true; m_AddressEdit.SetValue(0x80000000, false, true); ShowAddress(0x80000000, TRUE); + m_bIgnoreAddrChange = false; if (isStepping()) {