From 6f05e7a2f225f1005d723351dafac603263c3475 Mon Sep 17 00:00:00 2001 From: LuigiBlood Date: Fri, 29 Jan 2021 23:37:27 +0100 Subject: [PATCH 1/4] [Settings] Add Disk Seek Timing choice --- Source/Project64-core/Multilanguage.h | 4 + .../Multilanguage/LanguageClass.cpp | 4 + Source/Project64-core/N64System/Mips/Disk.cpp | 107 ++++++++++-------- Source/Project64-core/N64System/N64Types.h | 5 + Source/Project64-core/Settings.cpp | 3 + Source/Project64-core/Settings/SettingsID.h | 3 + Source/Project64/Project64.vcxproj | 2 + Source/Project64/Project64.vcxproj.filters | 6 + .../Settings/SettingsPage-Defaults.cpp | 10 ++ .../Settings/SettingsPage-Defaults.h | 1 + .../Settings/SettingsPage-Game-DiskDrive.cpp | 62 ++++++++++ .../Settings/SettingsPage-Game-DiskDrive.h | 35 ++++++ .../UserInterface/Settings/SettingsPage.h | 1 + .../UserInterface/SettingsConfig.cpp | 1 + Source/Project64/UserInterface/UIResources.rc | 22 ++++ Source/Project64/UserInterface/resource.h | 9 +- 16 files changed, 226 insertions(+), 49 deletions(-) create mode 100644 Source/Project64/UserInterface/Settings/SettingsPage-Game-DiskDrive.cpp create mode 100644 Source/Project64/UserInterface/Settings/SettingsPage-Game-DiskDrive.h diff --git a/Source/Project64-core/Multilanguage.h b/Source/Project64-core/Multilanguage.h index d26caf743..78857dab1 100644 --- a/Source/Project64-core/Multilanguage.h +++ b/Source/Project64-core/Multilanguage.h @@ -236,6 +236,7 @@ enum LanguageStringID TAB_RECOMPILER = 411, TAB_DEFAULTS = 412, TAB_DISKDRIVE = 413, + TAB_DISKSETTINGS = 414, //Plugin Dialog PLUG_ABOUT = 420, @@ -337,6 +338,9 @@ enum LanguageStringID ROM_UNALIGNED_DMA = 5410, ROM_RANDOMIZE_SIPI_INTERRUPTS = 5420, ROM_MEM_SIZE_NOTE = 5430, + ROM_DISK_SEEK_TIMING = 5440, + ROM_DISK_SEEK_TIMING_TURBO = 5441, + ROM_DISK_SEEK_TIMING_SLOW = 5442, //Core Styles CORE_INTERPTER = 540, diff --git a/Source/Project64-core/Multilanguage/LanguageClass.cpp b/Source/Project64-core/Multilanguage/LanguageClass.cpp index 44cf6cd41..bce40ac70 100644 --- a/Source/Project64-core/Multilanguage/LanguageClass.cpp +++ b/Source/Project64-core/Multilanguage/LanguageClass.cpp @@ -203,6 +203,7 @@ void CLanguage::LoadDefaultStrings(void) DEF_STR(TAB_RECOMPILER, "Recompiler"); DEF_STR(TAB_DEFAULTS, "Defaults"); DEF_STR(TAB_DISKDRIVE, "64DD"); + DEF_STR(TAB_DISKSETTINGS, "64DD"); //Plugin Dialog DEF_STR(PLUG_ABOUT, "About"); @@ -303,6 +304,9 @@ void CLanguage::LoadDefaultStrings(void) DEF_STR(ROM_UNALIGNED_DMA, "Unaligned DMA"); DEF_STR(ROM_RANDOMIZE_SIPI_INTERRUPTS, "Randomize SI/PI interrupts"); DEF_STR(ROM_MEM_SIZE_NOTE, "Note: 8 MB is forced for Unknown ROMs."); + DEF_STR(ROM_DISK_SEEK_TIMING, "Disk Seek Timing:"); + DEF_STR(ROM_DISK_SEEK_TIMING_TURBO, "Turbo"); + DEF_STR(ROM_DISK_SEEK_TIMING_SLOW, "Slow"); //Core Styles DEF_STR(CORE_INTERPTER, "Interpreter"); diff --git a/Source/Project64-core/N64System/Mips/Disk.cpp b/Source/Project64-core/N64System/Mips/Disk.cpp index d62eb1021..6ebb9f6a5 100644 --- a/Source/Project64-core/N64System/Mips/Disk.cpp +++ b/Source/Project64-core/N64System/Mips/Disk.cpp @@ -107,60 +107,73 @@ void DiskCommand() if (isSeek) { - //Emulate Seek Times, send interrupt later - uint32_t seektime = 0; - - //Start Motor, can take half a second, delay the response - if (g_Reg->ASIC_STATUS & DD_STATUS_MTR_N_SPIN) + if ((DISK_SEEK_TYPE)g_Settings->LoadDword(Game_DiskSeekTiming) == DiskSeek_Turbo) { - seektime += (0x5A00000 / 2); - g_Reg->ASIC_STATUS &= ~DD_STATUS_MTR_N_SPIN; + //Instant Response for Turbo + + //Set timer for seek response + g_SystemTimer->SetTimer(g_SystemTimer->DDSeekTimer, 0, false); + + //Set timer for motor + g_SystemTimer->SetTimer(g_SystemTimer->DDMotorTimer, 0, false); } - - //Get Zone to calculate seek times - uint32_t track = g_Reg->ASIC_CUR_TK >> 16 & 0x0FFF; - uint32_t zone = 0; - uint32_t zonebound = 0; - for (uint8_t i = 0; i < 8; i++) + else /* if ((DISK_SEEK_TYPE)g_Settings->LoadDword(Game_DiskSeekTiming) == DiskSeek_Slow) */ { - zonebound += ddZoneTrackSize[i]; - if (track < zonebound) + //Emulate Seek Times, send interrupt later + uint32_t seektime = 0; + + //Start Motor, can take half a second, delay the response + if (g_Reg->ASIC_STATUS & DD_STATUS_MTR_N_SPIN) { - zone = i; - if (g_Reg->ASIC_CUR_TK & 0x10000000) - zone++; + seektime += (0x5A00000 / 2); + g_Reg->ASIC_STATUS &= ~DD_STATUS_MTR_N_SPIN; + } + + //Get Zone to calculate seek times + uint32_t track = g_Reg->ASIC_CUR_TK >> 16 & 0x0FFF; + uint32_t zone = 0; + uint32_t zonebound = 0; + for (uint8_t i = 0; i < 8; i++) + { + zonebound += ddZoneTrackSize[i]; + if (track < zonebound) + { + zone = i; + if (g_Reg->ASIC_CUR_TK & 0x10000000) + zone++; + break; + } + } + + //Add seek delay depending on the zone (this is inaccurate timing, but close enough) + seektime += 0x179200; + + switch (zone) + { + case 0: + case 1: + default: + seektime += track * 38; + break; + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + seektime += 0x13C * 38 + (track - 0x13C) * 46; + break; + case 8: + seektime += 0x13C * 38 + 0x2E9 * 46 + (track - 0x425) * 58; break; } + + //Set timer for seek response + g_SystemTimer->SetTimer(g_SystemTimer->DDSeekTimer, seektime, false); + + //Set timer for motor to shutdown in 5 seconds, reset the timer if other seek commands were sent + g_SystemTimer->SetTimer(g_SystemTimer->DDMotorTimer, 0x5A00000 * 5, false); } - - //Add seek delay depending on the zone (this is inaccurate timing, but close enough) - seektime += 0x179200; - - switch (zone) - { - case 0: - case 1: - default: - seektime += track * 38; - break; - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - seektime += 0x13C * 38 + (track - 0x13C) * 46; - break; - case 8: - seektime += 0x13C * 38 + 0x2E9 * 46 + (track - 0x425) * 58; - break; - } - - //Set timer for seek response - g_SystemTimer->SetTimer(g_SystemTimer->DDSeekTimer, seektime, false); - - //Set timer for motor to shutdown in 5 seconds, reset the timer if other seek commands were sent - g_SystemTimer->SetTimer(g_SystemTimer->DDMotorTimer, 0x5A00000 * 5, false); } else { diff --git a/Source/Project64-core/N64System/N64Types.h b/Source/Project64-core/N64System/N64Types.h index ce5f585d2..558cb171f 100644 --- a/Source/Project64-core/N64System/N64Types.h +++ b/Source/Project64-core/N64System/N64Types.h @@ -59,6 +59,11 @@ enum SAVE_DISK_TYPE SaveDisk_ShadowFile = 0, SaveDisk_RAMFile = 1, }; +enum DISK_SEEK_TYPE +{ + DiskSeek_Turbo = 0, DiskSeek_Slow = 1, +}; + enum FUNC_LOOKUP_METHOD { FuncFind_Default = -1, FuncFind_PhysicalLookup = 1, FuncFind_VirtualLookup = 2, FuncFind_ChangeMemory = 3, diff --git a/Source/Project64-core/Settings.cpp b/Source/Project64-core/Settings.cpp index ed979963e..1e4bcada5 100644 --- a/Source/Project64-core/Settings.cpp +++ b/Source/Project64-core/Settings.cpp @@ -148,6 +148,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory) AddHandler(Default_UnalignedDMA, new CSettingTypeApplication("Defaults", "Unaligned DMA", false)); AddHandler(Default_RandomizeSIPIInterrupts, new CSettingTypeApplication("Defaults", "Randomize SI/PI Interrupts", true)); AddHandler(Default_SMM_Protect_Memory, new CSettingTypeApplication("Defaults", "SMM-Protect", false)); + AddHandler(Default_DiskSeekTiming, new CSettingTypeApplication("Defaults", "Disk Seek Timing", (uint32_t)DiskSeek_Turbo)); AddHandler(Rdb_GoodName, new CSettingTypeRomDatabase("Good Name", Game_GameName)); AddHandler(Rdb_RPCKey, new CSettingTypeRomDatabase("RPC Key", Game_RPCKey)); @@ -192,6 +193,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory) AddHandler(Rdb_CRC_Recalc, new CSettingTypeRDBYesNo("CRC-Recalc", false)); AddHandler(Rdb_UnalignedDMA, new CSettingTypeRomDatabase("Unaligned DMA", Default_UnalignedDMA)); AddHandler(Rdb_RandomizeSIPIInterrupts, new CSettingTypeRomDatabase("Randomize SI/PI Interrupts", Default_RandomizeSIPIInterrupts)); + AddHandler(Rdb_DiskSeekTiming, new CSettingTypeRomDatabase("DiskSeekTiming", Default_DiskSeekTiming)); AddHandler(Game_IniKey, new CSettingTypeTempString("")); AddHandler(Game_File, new CSettingTypeTempString("")); @@ -253,6 +255,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory) AddHandler(Game_UnalignedDMA, new CSettingTypeGame("Unaligned DMA", Rdb_UnalignedDMA)); AddHandler(Game_RandomizeSIPIInterrupts, new CSettingTypeGame("Randomize SI/PI Interrupts", Rdb_RandomizeSIPIInterrupts)); AddHandler(Game_RPCKey, new CSettingTypeTempString("")); + AddHandler(Game_DiskSeekTiming, new CSettingTypeGame("DiskSeekTiming", Rdb_DiskSeekTiming)); //User Interface AddHandler(UserInterface_ShowCPUPer, new CSettingTypeApplication("Settings", "Display CPU Usage", (uint32_t)false)); diff --git a/Source/Project64-core/Settings/SettingsID.h b/Source/Project64-core/Settings/SettingsID.h index 2303646e9..95b56dd10 100644 --- a/Source/Project64-core/Settings/SettingsID.h +++ b/Source/Project64-core/Settings/SettingsID.h @@ -84,6 +84,7 @@ enum SettingID Default_UnalignedDMA, Default_RandomizeSIPIInterrupts, Default_SMM_Protect_Memory, + Default_DiskSeekTiming, //RDB Settings Rdb_GoodName, @@ -125,6 +126,7 @@ enum SettingID Rdb_UnalignedDMA, Rdb_RandomizeSIPIInterrupts, Rdb_RPCKey, + Rdb_DiskSeekTiming, //Individual Game Settings Game_IniKey, @@ -183,6 +185,7 @@ enum SettingID Game_UnalignedDMA, Game_RandomizeSIPIInterrupts, Game_RPCKey, + Game_DiskSeekTiming, // General Game running info GameRunning_LoadingInProgress, diff --git a/Source/Project64/Project64.vcxproj b/Source/Project64/Project64.vcxproj index b7413f36d..d41d6a15a 100644 --- a/Source/Project64/Project64.vcxproj +++ b/Source/Project64/Project64.vcxproj @@ -100,6 +100,7 @@ + @@ -175,6 +176,7 @@ + diff --git a/Source/Project64/Project64.vcxproj.filters b/Source/Project64/Project64.vcxproj.filters index f9ab4a7d2..560a0ede5 100644 --- a/Source/Project64/Project64.vcxproj.filters +++ b/Source/Project64/Project64.vcxproj.filters @@ -252,6 +252,9 @@ Source Files\User Interface Source + + Source Files\User Interface Source\Settings Source + @@ -488,6 +491,9 @@ Header Files\User Interface Headers + + Header Files\User Interface Headers\Settings Header + diff --git a/Source/Project64/UserInterface/Settings/SettingsPage-Defaults.cpp b/Source/Project64/UserInterface/Settings/SettingsPage-Defaults.cpp index 12636e3ee..03917b704 100644 --- a/Source/Project64/UserInterface/Settings/SettingsPage-Defaults.cpp +++ b/Source/Project64/UserInterface/Settings/SettingsPage-Defaults.cpp @@ -32,6 +32,7 @@ CDefaultsOptionsPage::CDefaultsOptionsPage(HWND hParent, const RECT & rcDispay) SetDlgItemText(IDC_UNALIGNED_DMA, wGS(ROM_UNALIGNED_DMA).c_str()); SetDlgItemText(IDC_RANDOMIZE_SIPI_INTERRUPTS, wGS(ROM_RANDOMIZE_SIPI_INTERRUPTS).c_str()); SetDlgItemText(IDC_PROTECT_MEMORY, wGS(ADVANCE_SMM_PROTECT).c_str()); + SetDlgItemText(IDC_DISKSEEKTIMING_TEXT1, wGS(ROM_DISK_SEEK_TIMING).c_str()); CModifiedComboBox * ComboBox; ComboBox = AddModComboBox(GetDlgItem(IDC_RDRAM_SIZE), Default_RDRamSize); @@ -67,6 +68,15 @@ CDefaultsOptionsPage::CDefaultsOptionsPage(HWND hParent, const RECT & rcDispay) AddModCheckBox(GetDlgItem(IDC_UNALIGNED_DMA), Default_UnalignedDMA); AddModCheckBox(GetDlgItem(IDC_RANDOMIZE_SIPI_INTERRUPTS), Default_RandomizeSIPIInterrupts); AddModCheckBox(GetDlgItem(IDC_PROTECT_MEMORY), Default_SMM_Protect_Memory); + AddModCheckBox(GetDlgItem(IDC_DISKSEEKTIMING), Default_DiskSeekTiming); + + ComboBox = AddModComboBox(GetDlgItem(IDC_DISKSEEKTIMING), Default_DiskSeekTiming); + if (ComboBox) + { + //ComboBox->SetTextField(GetDlgItem(IDC_COUNTFACT_TEXT)); + ComboBox->AddItem(wGS(ROM_DISK_SEEK_TIMING_TURBO).c_str(), DiskSeek_Turbo); + ComboBox->AddItem(wGS(ROM_DISK_SEEK_TIMING_SLOW).c_str(), DiskSeek_Slow); + } if (!g_Settings->LoadBool(Setting_SyncViaAudioEnabled)) { diff --git a/Source/Project64/UserInterface/Settings/SettingsPage-Defaults.h b/Source/Project64/UserInterface/Settings/SettingsPage-Defaults.h index e53872327..9cbd98ab0 100644 --- a/Source/Project64/UserInterface/Settings/SettingsPage-Defaults.h +++ b/Source/Project64/UserInterface/Settings/SettingsPage-Defaults.h @@ -25,6 +25,7 @@ class CDefaultsOptionsPage : COMMAND_ID_HANDLER_EX(IDC_PROTECT_MEMORY, CheckBoxChanged) COMMAND_HANDLER_EX(IDC_RDRAM_SIZE, LBN_SELCHANGE, ComboBoxChanged) COMMAND_HANDLER_EX(IDC_COUNTFACT, LBN_SELCHANGE, ComboBoxChanged) + COMMAND_HANDLER_EX(IDC_DISKSEEKTIMING, LBN_SELCHANGE, ComboBoxChanged) COMMAND_HANDLER_EX(IDC_VIREFRESH, EN_UPDATE, EditBoxChanged) COMMAND_HANDLER_EX(IDC_COUNTPERBYTE, EN_UPDATE, EditBoxChanged) COMMAND_HANDLER_EX(IDC_RDRAM_SIZE, EN_UPDATE, EditBoxChanged) diff --git a/Source/Project64/UserInterface/Settings/SettingsPage-Game-DiskDrive.cpp b/Source/Project64/UserInterface/Settings/SettingsPage-Game-DiskDrive.cpp new file mode 100644 index 000000000..f91d45682 --- /dev/null +++ b/Source/Project64/UserInterface/Settings/SettingsPage-Game-DiskDrive.cpp @@ -0,0 +1,62 @@ +/**************************************************************************** +* * +* Project64 - A Nintendo 64 emulator. * +* http://www.pj64-emu.com/ * +* Copyright (C) 2012 Project64. All rights reserved. * +* * +* License: * +* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html * +* * +****************************************************************************/ +#include "stdafx.h" + +#include "SettingsPage.h" +#include "SettingsPage-Game-DiskDrive.h" + +CGameDiskDrivePage::CGameDiskDrivePage(HWND hParent, const RECT & rcDispay) +{ + if (!Create(hParent, rcDispay)) + { + return; + } + + //Set the text for all gui Items + SetDlgItemText(IDC_DISKSEEKTIMING_TEXT2, wGS(ROM_DISK_SEEK_TIMING).c_str()); + + CModifiedComboBox* ComboBox; + ComboBox = AddModComboBox(GetDlgItem(IDC_DISKSEEKTIMING2), Game_DiskSeekTiming); + if (ComboBox) + { + //ComboBox->SetTextField(GetDlgItem(IDC_MEMORY_SIZE_TEXT)); + ComboBox->AddItem(wGS(ROM_DISK_SEEK_TIMING_TURBO).c_str(), DiskSeek_Turbo); + ComboBox->AddItem(wGS(ROM_DISK_SEEK_TIMING_SLOW).c_str(), DiskSeek_Slow); + } + + UpdatePageSettings(); +} + +void CGameDiskDrivePage::ShowPage() +{ + ShowWindow(SW_SHOW); +} + +void CGameDiskDrivePage::HidePage() +{ + ShowWindow(SW_HIDE); +} + +void CGameDiskDrivePage::ApplySettings(bool UpdateScreen) +{ + CSettingsPageImpl::ApplySettings(UpdateScreen); +} + +bool CGameDiskDrivePage::EnableReset(void) +{ + if (CSettingsPageImpl::EnableReset()) { return true; } + return false; +} + +void CGameDiskDrivePage::ResetPage() +{ + CSettingsPageImpl::ResetPage(); +} diff --git a/Source/Project64/UserInterface/Settings/SettingsPage-Game-DiskDrive.h b/Source/Project64/UserInterface/Settings/SettingsPage-Game-DiskDrive.h new file mode 100644 index 000000000..f066f491c --- /dev/null +++ b/Source/Project64/UserInterface/Settings/SettingsPage-Game-DiskDrive.h @@ -0,0 +1,35 @@ +/**************************************************************************** +* * +* Project64 - A Nintendo 64 emulator. * +* http://www.pj64-emu.com/ * +* Copyright (C) 2012 Project64. All rights reserved. * +* * +* License: * +* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html * +* * +****************************************************************************/ +#pragma once + +#include "../WTLControls/ModifiedCheckBox.h" +#include + +class CGameDiskDrivePage : + public CSettingsPageImpl, + public CSettingsPage +{ + BEGIN_MSG_MAP_EX(CGameDiskDrivePage) + COMMAND_HANDLER_EX(IDC_DISKSEEKTIMING2, LBN_SELCHANGE, ComboBoxChanged) + END_MSG_MAP() + + enum { IDD = IDD_Settings_GameDiskDrive }; + +public: + CGameDiskDrivePage(HWND hParent, const RECT & rcDispay); + + LanguageStringID PageTitle(void) { return TAB_DISKSETTINGS; } + void HidePage(void); + void ShowPage(void); + void ApplySettings(bool UpdateScreen); + bool EnableReset(void); + void ResetPage(void); +}; diff --git a/Source/Project64/UserInterface/Settings/SettingsPage.h b/Source/Project64/UserInterface/Settings/SettingsPage.h index 68e78974c..2a1520aaa 100644 --- a/Source/Project64/UserInterface/Settings/SettingsPage.h +++ b/Source/Project64/UserInterface/Settings/SettingsPage.h @@ -587,6 +587,7 @@ public: #include "SettingsPage-Game-General.h" #include "SettingsPage-Game-Plugin.h" #include "SettingsPage-Game-Recompiler.h" +#include "SettingsPage-Game-DiskDrive.h" #include "SettingsPage-Game-Status.h" #include "SettingsPage-GameBrowser.h" #include "SettingsPage-KeyboardShortcuts.h" diff --git a/Source/Project64/UserInterface/SettingsConfig.cpp b/Source/Project64/UserInterface/SettingsConfig.cpp index bae5001a5..b35eaeedc 100644 --- a/Source/Project64/UserInterface/SettingsConfig.cpp +++ b/Source/Project64/UserInterface/SettingsConfig.cpp @@ -164,6 +164,7 @@ LRESULT CSettingConfig::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /* GameSettings->AddPage(new CGameGeneralPage(this->m_hWnd, rcSettingInfo)); GameSettings->AddPage(new CGameRecompilePage(this->m_hWnd, rcSettingInfo)); GameSettings->AddPage(new CGamePluginPage(this->m_hWnd, rcSettingInfo)); + GameSettings->AddPage(new CGameDiskDrivePage(this->m_hWnd, rcSettingInfo)); if (g_Settings->LoadBool(Setting_RdbEditor)) { GameSettings->AddPage(new CGameStatusPage(this->m_hWnd, rcSettingInfo)); diff --git a/Source/Project64/UserInterface/UIResources.rc b/Source/Project64/UserInterface/UIResources.rc index eafefe6dd..c74e24d1b 100644 --- a/Source/Project64/UserInterface/UIResources.rc +++ b/Source/Project64/UserInterface/UIResources.rc @@ -1243,6 +1243,8 @@ BEGIN CONTROL "Unaligned DMA",IDC_UNALIGNED_DMA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,118,91,10 CONTROL "Protect Memory",IDC_PROTECT_MEMORY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,118,91,10 RTEXT "Note: 8 MB is forced for Unknown ROMs.",IDC_MEMORY_SIZE_NOTE,6,22,205,8 + COMBOBOX IDC_DISKSEEKTIMING,102,132,109,49,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Disk Seek Timing:",IDC_DISKSEEKTIMING_TEXT1,6,134,91,10 END IDD_Enhancement_Config DIALOGEX 0, 0, 206, 214 @@ -1390,6 +1392,14 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,109,62,50,14 END +IDD_Settings_GameDiskDrive DIALOGEX 0, 0, 218, 182 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + COMBOBOX IDC_DISKSEEKTIMING2,102,8,109,49,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Disk Seek Timing:",IDC_DISKSEEKTIMING_TEXT2,6,10,91,10 +END ///////////////////////////////////////////////////////////////////////////// // @@ -1849,6 +1859,14 @@ BEGIN TOPMARGIN, 7 BOTTOMMARGIN, 76 END + + IDD_Settings_GameDiskDrive, DIALOG + BEGIN + LEFTMARGIN, 4 + RIGHTMARGIN, 216 + TOPMARGIN, 4 + BOTTOMMARGIN, 176 + END END #endif // APSTUDIO_INVOKED @@ -2221,6 +2239,10 @@ BEGIN 0 END +IDD_Settings_GameDiskDrive AFX_DIALOG_LAYOUT +BEGIN + 0 +END ///////////////////////////////////////////////////////////////////////////// // diff --git a/Source/Project64/UserInterface/resource.h b/Source/Project64/UserInterface/resource.h index 366596330..e0631398a 100644 --- a/Source/Project64/UserInterface/resource.h +++ b/Source/Project64/UserInterface/resource.h @@ -80,6 +80,7 @@ #define IDD_Debugger_Search_SetValue 210 #define IDD_Settings_DiskDrive 215 #define IDD_Support_RequestCode 216 +#define IDD_Settings_GameDiskDrive 217 #define IDC_MENU_ITEM_TEXT 1000 #define IDC_CLOSE_BUTTON 1001 #define IDC_LIST2 1003 @@ -265,6 +266,7 @@ #define IDC_ROM_FASTSP 1101 #define IDC_INFO 1101 #define IDC_OVER_CLOCK_MODIFIER_TEXT 1101 +#define IDC_DISKSEEKTIMING_TEXT1 1101 #define IDC_AUDIO_SIGNAL 1102 #define IDC_DIR_TEXTURE_FRAME 1102 #define IDC_ENTER_CODE 1102 @@ -707,9 +709,12 @@ #define IDC_SCRIPTS_GRP 1578 #define IDC_F4_LBL 1579 #define IDC_OUTPUT_GRP 1579 +#define IDC_DISKSEEKTIMING_TEXT2 1579 #define IDC_F5_LBL 1580 #define IDC_EVAL_LBL 1580 +#define IDC_DISKSEEKTIMING 1580 #define IDC_F6_LBL 1581 +#define IDC_DISKSEEKTIMING2 1581 #define IDC_F7_LBL 1582 #define IDC_F8_LBL 1583 #define IDC_F9_LBL 1584 @@ -922,9 +927,9 @@ // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 222 +#define _APS_NEXT_RESOURCE_VALUE 225 #define _APS_NEXT_COMMAND_VALUE 40121 -#define _APS_NEXT_CONTROL_VALUE 1578 +#define _APS_NEXT_CONTROL_VALUE 1582 #define _APS_NEXT_SYMED_VALUE 102 #endif #endif From 5bdc3e11b12cbc44d79e29956d76f64b4500f6e0 Mon Sep 17 00:00:00 2001 From: LuigiBlood Date: Fri, 29 Jan 2021 23:43:42 +0100 Subject: [PATCH 2/4] [RDB] Force Slower Timing for Paint Studio Prototype (Else Gnat Attack will crash.) --- Config/Project64.rdb | 1 + 1 file changed, 1 insertion(+) diff --git a/Config/Project64.rdb b/Config/Project64.rdb index 5568563ba..9c1a7f823 100644 --- a/Config/Project64.rdb +++ b/Config/Project64.rdb @@ -7289,6 +7289,7 @@ Good Name=Mario Artist Paint Studio (J) (1999-02-11 Proto) RDRAM Size=8 Status=Compatible Counter Factor=1 +DiskSeekTiming=1 //================ PD ================ From 90d68dae5228887ac1e0c91cecf6ed37066e611b Mon Sep 17 00:00:00 2001 From: LuigiBlood Date: Sat, 30 Jan 2021 00:29:09 +0100 Subject: [PATCH 3/4] Cache Disk Seek Timing Type into a global variable for optimization --- Source/Project64-core/N64System/Mips/Disk.cpp | 5 +++-- Source/Project64-core/Settings/GameSettings.cpp | 2 ++ Source/Project64-core/Settings/GameSettings.h | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Source/Project64-core/N64System/Mips/Disk.cpp b/Source/Project64-core/N64System/Mips/Disk.cpp index 6ebb9f6a5..8adf9e094 100644 --- a/Source/Project64-core/N64System/Mips/Disk.cpp +++ b/Source/Project64-core/N64System/Mips/Disk.cpp @@ -11,6 +11,7 @@ // Based from MAME's N64DD driver code by Happy_ #include "stdafx.h" #include "Disk.h" +#include #include #include #include @@ -107,7 +108,7 @@ void DiskCommand() if (isSeek) { - if ((DISK_SEEK_TYPE)g_Settings->LoadDword(Game_DiskSeekTiming) == DiskSeek_Turbo) + if (g_System->DiskSeekTimingType() == DiskSeek_Turbo) { //Instant Response for Turbo @@ -117,7 +118,7 @@ void DiskCommand() //Set timer for motor g_SystemTimer->SetTimer(g_SystemTimer->DDMotorTimer, 0, false); } - else /* if ((DISK_SEEK_TYPE)g_Settings->LoadDword(Game_DiskSeekTiming) == DiskSeek_Slow) */ + else /* if (g_System->DiskSeekTimingType() == DiskSeek_Slow) */ { //Emulate Seek Times, send interrupt later uint32_t seektime = 0; diff --git a/Source/Project64-core/Settings/GameSettings.cpp b/Source/Project64-core/Settings/GameSettings.cpp index 778e6410f..0c9bd24be 100644 --- a/Source/Project64-core/Settings/GameSettings.cpp +++ b/Source/Project64-core/Settings/GameSettings.cpp @@ -40,6 +40,7 @@ uint32_t CGameSettings::m_LookUpMode; //FUNC_LOOKUP_METHOD SYSTEM_TYPE CGameSettings::m_SystemType = SYSTEM_NTSC; CPU_TYPE CGameSettings::m_CpuType = CPU_Recompiler; uint32_t CGameSettings::m_OverClockModifier = 1; +DISK_SEEK_TYPE CGameSettings::m_DiskSeekTimingType = DiskSeek_Turbo; void CGameSettings::RefreshGameSettings() { @@ -80,6 +81,7 @@ void CGameSettings::RefreshGameSettings() } if (m_OverClockModifier < 1) { m_OverClockModifier = 1; } if (m_OverClockModifier > 20) { m_OverClockModifier = 20; } + m_DiskSeekTimingType = (DISK_SEEK_TYPE)g_Settings->LoadDword(Game_DiskSeekTiming); RefreshSyncToAudio(); WriteTrace(TraceN64System, TraceDebug, "Done"); } diff --git a/Source/Project64-core/Settings/GameSettings.h b/Source/Project64-core/Settings/GameSettings.h index 210c1c1fd..1d42a4bd4 100644 --- a/Source/Project64-core/Settings/GameSettings.h +++ b/Source/Project64-core/Settings/GameSettings.h @@ -45,6 +45,7 @@ public: inline static SYSTEM_TYPE SystemType(void) { return m_SystemType; } inline static CPU_TYPE CpuType(void) { return m_CpuType; } inline static uint32_t OverClockModifier(void) { return m_OverClockModifier; } + inline static DISK_SEEK_TYPE DiskSeekTimingType(void) { return m_DiskSeekTimingType; }; void RefreshSyncToAudio(void); @@ -80,4 +81,5 @@ private: static SYSTEM_TYPE m_SystemType; static CPU_TYPE m_CpuType; static uint32_t m_OverClockModifier; + static DISK_SEEK_TYPE m_DiskSeekTimingType; }; From f5af8f5261b04cbd204b606eccb6e192ed1319e2 Mon Sep 17 00:00:00 2001 From: Vincent Cunningham Date: Mon, 1 Feb 2021 20:31:45 -0500 Subject: [PATCH 4/4] Fix games not being FPS limited when Audio is muted --- Source/Project64-core/Plugins/PluginClass.cpp | 4 ++++ Source/Project64-core/Settings/GameSettings.cpp | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/Project64-core/Plugins/PluginClass.cpp b/Source/Project64-core/Plugins/PluginClass.cpp index 845c9ebe4..2da69b926 100644 --- a/Source/Project64-core/Plugins/PluginClass.cpp +++ b/Source/Project64-core/Plugins/PluginClass.cpp @@ -413,6 +413,10 @@ void CPlugins::ConfigPlugin(void* hParent, PLUGIN_TYPE Type) } } m_Audio->DllConfig(hParent); + if (g_BaseSystem) + { + g_BaseSystem->RefreshSyncToAudio(); + } break; case PLUGIN_TYPE_CONTROLLER: if (m_Control == NULL || m_Control->DllConfig == NULL) { break; } diff --git a/Source/Project64-core/Settings/GameSettings.cpp b/Source/Project64-core/Settings/GameSettings.cpp index 0c9bd24be..7abb02006 100644 --- a/Source/Project64-core/Settings/GameSettings.cpp +++ b/Source/Project64-core/Settings/GameSettings.cpp @@ -94,5 +94,5 @@ void CGameSettings::SpeedChanged(int SpeedLimit) void CGameSettings::RefreshSyncToAudio(void) { - m_bSyncToAudio = g_Settings->LoadBool(Game_SyncViaAudio) && g_Settings->LoadBool(Setting_SyncViaAudioEnabled); + m_bSyncToAudio = g_Settings->LoadBool(Game_SyncViaAudio) && g_Settings->LoadBool(Setting_SyncViaAudioEnabled) && g_Settings->LoadBool(Plugin_EnableAudio); }