diff --git a/Source/Project64/N64 System/Mips/Audio.cpp b/Source/Project64/N64 System/Mips/Audio.cpp index e9a343d74..a5cc93b4d 100644 --- a/Source/Project64/N64 System/Mips/Audio.cpp +++ b/Source/Project64/N64 System/Mips/Audio.cpp @@ -14,7 +14,7 @@ void CAudio::Reset ( void ) m_SecondBuff = 0; m_Status = 0; m_BytesPerSecond = 0; - m_CountsPerByte = 500; // should be calculated ... see below + m_CountsPerByte = AiCountPerBytes(); // should be calculated ... see below, instead allow from user settings m_FramesPerSecond = 60; } diff --git a/Source/Project64/N64 System/Mips/Audio.h b/Source/Project64/N64 System/Mips/Audio.h index 2125d4014..e96ad32ea 100644 --- a/Source/Project64/N64 System/Mips/Audio.h +++ b/Source/Project64/N64 System/Mips/Audio.h @@ -1,4 +1,5 @@ -class CAudio +class CAudio : + private CGameSettings { public: CAudio (void); diff --git a/Source/Project64/Settings.h b/Source/Project64/Settings.h index 2c3e077f7..5d175da21 100644 --- a/Source/Project64/Settings.h +++ b/Source/Project64/Settings.h @@ -81,6 +81,7 @@ enum SettingID { Rdb_SMM_ValidFunc, Rdb_GameCheatFix, Rdb_ViRefreshRate, + Rdb_AiCountPerBytes, //Individual Game Settings Game_IniKey, @@ -122,6 +123,7 @@ enum SettingID { Game_UseHleAudio, Game_LoadRomToMemory, Game_ViRefreshRate, + Game_AiCountPerBytes, // General Game running info GameRunning_LoadingInProgress, diff --git a/Source/Project64/Settings/Game Settings.cpp b/Source/Project64/Settings/Game Settings.cpp index a11fddc2e..f3e3cf29a 100644 --- a/Source/Project64/Settings/Game Settings.cpp +++ b/Source/Project64/Settings/Game Settings.cpp @@ -6,6 +6,7 @@ bool CGameSettings::m_Registered = false; bool CGameSettings::m_bUseTlb; DWORD CGameSettings::m_CountPerOp = 2; DWORD CGameSettings::m_ViRefreshRate = 1500; +DWORD CGameSettings::m_AiCountPerBytes = 500; bool CGameSettings::m_DelayDP = false; bool CGameSettings::m_DelaySI = false; DWORD CGameSettings::m_RdramSize = 0; @@ -23,6 +24,7 @@ CGameSettings::CGameSettings() m_Registered = true; _Settings->RegisterChangeCB(Game_UseTlb,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); _Settings->RegisterChangeCB(Game_ViRefreshRate,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->RegisterChangeCB(Game_AiCountPerBytes,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); _Settings->RegisterChangeCB(Game_CounterFactor,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); _Settings->RegisterChangeCB(Game_RDRamSize,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); _Settings->RegisterChangeCB(Game_DelaySI,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); @@ -44,6 +46,7 @@ CGameSettings::~CGameSettings() { _Settings->UnregisterChangeCB(Game_UseTlb,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); _Settings->UnregisterChangeCB(Game_ViRefreshRate,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->UnregisterChangeCB(Game_AiCountPerBytes,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); _Settings->UnregisterChangeCB(Game_CounterFactor,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); _Settings->UnregisterChangeCB(Game_RDRamSize,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); _Settings->UnregisterChangeCB(Game_DelaySI,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); @@ -60,15 +63,16 @@ CGameSettings::~CGameSettings() void CGameSettings::RefreshSettings() { - m_bUseTlb = _Settings->LoadBool(Game_UseTlb); - m_ViRefreshRate = _Settings->LoadDword(Game_ViRefreshRate); - m_CountPerOp = _Settings->LoadDword(Game_CounterFactor); - m_RdramSize = _Settings->LoadDword(Game_RDRamSize); - m_DelaySI = _Settings->LoadBool(Game_DelaySI); - m_DelayDP = _Settings->LoadBool(Game_DelayDP); - m_bFixedAudio = _Settings->LoadBool(Game_FixedAudio); - m_bSyncToAudio = m_bFixedAudio ? _Settings->LoadBool(Game_SyncViaAudio) : false; - m_b32Bit = _Settings->LoadBool(Game_32Bit); - m_bFastSP = _Settings->LoadBool(Game_FastSP); - m_RspAudioSignal= _Settings->LoadBool(Game_RspAudioSignal); + m_bUseTlb = _Settings->LoadBool(Game_UseTlb); + m_ViRefreshRate = _Settings->LoadDword(Game_ViRefreshRate); + m_AiCountPerBytes = _Settings->LoadDword(Game_AiCountPerBytes); + m_CountPerOp = _Settings->LoadDword(Game_CounterFactor); + m_RdramSize = _Settings->LoadDword(Game_RDRamSize); + m_DelaySI = _Settings->LoadBool(Game_DelaySI); + m_DelayDP = _Settings->LoadBool(Game_DelayDP); + m_bFixedAudio = _Settings->LoadBool(Game_FixedAudio); + m_bSyncToAudio = m_bFixedAudio ? _Settings->LoadBool(Game_SyncViaAudio) : false; + m_b32Bit = _Settings->LoadBool(Game_32Bit); + m_bFastSP = _Settings->LoadBool(Game_FastSP); + m_RspAudioSignal = _Settings->LoadBool(Game_RspAudioSignal); } diff --git a/Source/Project64/Settings/Game Settings.h b/Source/Project64/Settings/Game Settings.h index b304f6691..1164a4d25 100644 --- a/Source/Project64/Settings/Game Settings.h +++ b/Source/Project64/Settings/Game Settings.h @@ -6,17 +6,18 @@ public: CGameSettings(); virtual ~CGameSettings(); - static inline bool bUseTlb ( void ) { return m_bUseTlb; } - inline static DWORD CountPerOp ( void ) { return m_CountPerOp; } - inline static DWORD ViRefreshRate ( void ) { return m_ViRefreshRate; } - inline static bool bDelayDP ( void ) { return m_DelayDP; } - inline static bool bDelaySI ( void ) { return m_DelaySI; } - inline static DWORD RdramSize ( void ) { return m_RdramSize; } - inline static bool bFixedAudio ( void ) { return m_bFixedAudio; } - inline static bool bSyncToAudio ( void ) { return m_bSyncToAudio; } - inline static bool b32BitCore ( void ) { return m_b32Bit; } - inline static bool bFastSP ( void ) { return m_bFastSP; } - inline static bool RspAudioSignal( void ) { return m_RspAudioSignal; } + static inline bool bUseTlb ( void ) { return m_bUseTlb; } + inline static DWORD CountPerOp ( void ) { return m_CountPerOp; } + inline static DWORD ViRefreshRate ( void ) { return m_ViRefreshRate; } + inline static DWORD AiCountPerBytes ( void ) { return m_AiCountPerBytes; } + inline static bool bDelayDP ( void ) { return m_DelayDP; } + inline static bool bDelaySI ( void ) { return m_DelaySI; } + inline static DWORD RdramSize ( void ) { return m_RdramSize; } + inline static bool bFixedAudio ( void ) { return m_bFixedAudio; } + inline static bool bSyncToAudio ( void ) { return m_bSyncToAudio; } + inline static bool b32BitCore ( void ) { return m_b32Bit; } + inline static bool bFastSP ( void ) { return m_bFastSP; } + inline static bool RspAudioSignal ( void ) { return m_RspAudioSignal; } private: static void StaticRefreshSettings (CGameSettings * _this) @@ -30,6 +31,7 @@ private: static bool m_bUseTlb; static DWORD m_CountPerOp; static DWORD m_ViRefreshRate; + static DWORD m_AiCountPerBytes; static bool m_DelayDP; static bool m_DelaySI; static DWORD m_RdramSize; diff --git a/Source/Project64/Settings/Settings Class.cpp b/Source/Project64/Settings/Settings Class.cpp index fd121184a..fd5901d23 100644 --- a/Source/Project64/Settings/Settings Class.cpp +++ b/Source/Project64/Settings/Settings Class.cpp @@ -137,6 +137,7 @@ void CSettings::AddHowToHandleSetting () AddHandler(Rdb_SMM_ValidFunc, new CSettingTypeRomDatabase("SMM-FUNC",true)); AddHandler(Rdb_GameCheatFix, new CSettingTypeRomDatabaseIndex("Cheat","","")); AddHandler(Rdb_ViRefreshRate, new CSettingTypeRomDatabase("ViRefresh",1500)); + AddHandler(Rdb_AiCountPerBytes, new CSettingTypeRomDatabase("AiCountPerBytes",500)); AddHandler(Game_IniKey, new CSettingTypeTempString("")); AddHandler(Game_GameName, new CSettingTypeTempString("")); @@ -177,6 +178,7 @@ void CSettings::AddHowToHandleSetting () AddHandler(Game_SMM_Protect, new CSettingTypeGame("SMM-Protect",Rdb_SMM_Protect)); AddHandler(Game_SMM_ValidFunc, new CSettingTypeGame("SMM-FUNC",Rdb_SMM_ValidFunc)); AddHandler(Game_ViRefreshRate, new CSettingTypeGame("ViRefresh",Rdb_ViRefreshRate)); + AddHandler(Game_AiCountPerBytes, new CSettingTypeGame("AiCountPerBytes",Rdb_AiCountPerBytes)); //User Interface AddHandler(UserInterface_BasicMode, new CSettingTypeApplication("","Basic Mode", (DWORD)true)); diff --git a/Source/Project64/User Interface/Settings/Settings Page - Game - General.cpp b/Source/Project64/User Interface/Settings/Settings Page - Game - General.cpp index ac98109ac..8945dac44 100644 --- a/Source/Project64/User Interface/Settings/Settings Page - Game - General.cpp +++ b/Source/Project64/User Interface/Settings/Settings Page - Game - General.cpp @@ -54,6 +54,9 @@ CGameGeneralPage::CGameGeneralPage (HWND hParent, const RECT & rcDispay ) CModifiedEditBox * TxtBox = AddModTextBox(GetDlgItem(IDC_VIREFRESH),Game_ViRefreshRate, false); TxtBox->SetTextField(GetDlgItem(IDC_VIREFESH_TEXT)); + TxtBox = AddModTextBox(GetDlgItem(IDC_COUNTPERBYTE),Game_AiCountPerBytes, false); + TxtBox->SetTextField(GetDlgItem(IDC_COUNTPERBYTE_TEXT)); + UpdatePageSettings(); } diff --git a/Source/Project64/User Interface/Settings/Settings Page - Game - General.h b/Source/Project64/User Interface/Settings/Settings Page - Game - General.h index ea329c4f5..b2bf96a94 100644 --- a/Source/Project64/User Interface/Settings/Settings Page - Game - General.h +++ b/Source/Project64/User Interface/Settings/Settings Page - Game - General.h @@ -20,6 +20,7 @@ class CGameGeneralPage : COMMAND_ID_HANDLER_EX(IDC_DELAY_SI,CheckBoxChanged) COMMAND_ID_HANDLER_EX(IDC_AUDIO_SIGNAL,CheckBoxChanged) COMMAND_HANDLER_EX(IDC_VIREFRESH,EN_UPDATE,EditBoxChanged) + COMMAND_HANDLER_EX(IDC_COUNTPERBYTE,EN_UPDATE,EditBoxChanged) END_MSG_MAP() enum { IDD = IDD_Settings_GameGeneral }; diff --git a/Source/Project64/User Interface/UI Resources.aps b/Source/Project64/User Interface/UI Resources.aps deleted file mode 100644 index 1c9f1f2e4..000000000 Binary files a/Source/Project64/User Interface/UI Resources.aps and /dev/null differ diff --git a/Source/Project64/User Interface/UI Resources.rc b/Source/Project64/User Interface/UI Resources.rc index ad998dddf..516a24231 100644 --- a/Source/Project64/User Interface/UI Resources.rc +++ b/Source/Project64/User Interface/UI Resources.rc @@ -200,16 +200,18 @@ BEGIN COMBOBOX IDC_SAVE_TYPE,102,47,109,49,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP LTEXT "Counter Factor:",IDC_COUNTFACT_TEXT,6,64,91,10 COMBOBOX IDC_COUNTFACT,102,61,109,49,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Sync using Audio",IDC_SYNC_AUDIO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,112,91,11 - CONTROL "Use TLB",IDC_USE_TLB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,98,91,11 - CONTROL "Delay SI Interrupt",IDC_DELAY_SI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,126,91,11 - CONTROL "RSP Audio Signal",IDC_AUDIO_SIGNAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,140,91,11 - CONTROL "Fixed Audio Timing",IDC_ROM_FIXEDAUDIO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,112,91,11 - CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,3,92,208,1 LTEXT "Vi Refresh Rate:",IDC_VIREFESH_TEXT,6,77,91,10 EDITTEXT IDC_VIREFRESH,102,75,109,12,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "32 Bit Engine",IDC_ROM_32BIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,98,91,11 - CONTROL "Delay DP Interrupt",IDC_DELAY_DP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,126,91,11 + LTEXT "AI Count Per Byte:",IDC_COUNTPERBYTE_TEXT,6,90,91,10 + EDITTEXT IDC_COUNTPERBYTE,102,88,109,12,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,3,103,208,1 + CONTROL "32 Bit Engine",IDC_ROM_32BIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,107,91,8 + CONTROL "Use TLB",IDC_USE_TLB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,107,91,8 + CONTROL "Fixed Audio Timing",IDC_ROM_FIXEDAUDIO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,118,91,8 + CONTROL "Sync using Audio",IDC_SYNC_AUDIO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,118,91,8 + CONTROL "Delay DP Interrupt",IDC_DELAY_DP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,129,91,8 + CONTROL "Delay SI Interrupt",IDC_DELAY_SI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,129,91,8 + CONTROL "RSP Audio Signal",IDC_AUDIO_SIGNAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,140,91,8 END IDD_Settings_Accelerator DIALOGEX 0, 0, 218, 183 diff --git a/Source/Project64/User Interface/resource.h b/Source/Project64/User Interface/resource.h index cb01ec7eb..0059b4ca2 100644 --- a/Source/Project64/User Interface/resource.h +++ b/Source/Project64/User Interface/resource.h @@ -242,7 +242,9 @@ #define IDC_VIREFRESH 1098 #define IDC_AUDIO_NAME 1099 #define IDC_ROM_REGCACHE 1099 +#define IDC_COUNTPERBYTE_TEXT 1099 #define IDC_CONT_NAME 1100 +#define IDC_COUNTPERBYTE 1100 #define IDC_DIR_FRAME1 1101 #define IDC_ROM_FASTSP 1101 #define IDC_AUDIO_SIGNAL 1102