Audio: Add AI Count Per Byte setting

This commit is contained in:
zilmar 2012-11-13 16:44:13 +11:00
parent 1383699fac
commit d396763b71
11 changed files with 51 additions and 32 deletions

View File

@ -14,7 +14,7 @@ void CAudio::Reset ( void )
m_SecondBuff = 0; m_SecondBuff = 0;
m_Status = 0; m_Status = 0;
m_BytesPerSecond = 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; m_FramesPerSecond = 60;
} }

View File

@ -1,4 +1,5 @@
class CAudio class CAudio :
private CGameSettings
{ {
public: public:
CAudio (void); CAudio (void);

View File

@ -81,6 +81,7 @@ enum SettingID {
Rdb_SMM_ValidFunc, Rdb_SMM_ValidFunc,
Rdb_GameCheatFix, Rdb_GameCheatFix,
Rdb_ViRefreshRate, Rdb_ViRefreshRate,
Rdb_AiCountPerBytes,
//Individual Game Settings //Individual Game Settings
Game_IniKey, Game_IniKey,
@ -122,6 +123,7 @@ enum SettingID {
Game_UseHleAudio, Game_UseHleAudio,
Game_LoadRomToMemory, Game_LoadRomToMemory,
Game_ViRefreshRate, Game_ViRefreshRate,
Game_AiCountPerBytes,
// General Game running info // General Game running info
GameRunning_LoadingInProgress, GameRunning_LoadingInProgress,

View File

@ -6,6 +6,7 @@ bool CGameSettings::m_Registered = false;
bool CGameSettings::m_bUseTlb; bool CGameSettings::m_bUseTlb;
DWORD CGameSettings::m_CountPerOp = 2; DWORD CGameSettings::m_CountPerOp = 2;
DWORD CGameSettings::m_ViRefreshRate = 1500; DWORD CGameSettings::m_ViRefreshRate = 1500;
DWORD CGameSettings::m_AiCountPerBytes = 500;
bool CGameSettings::m_DelayDP = false; bool CGameSettings::m_DelayDP = false;
bool CGameSettings::m_DelaySI = false; bool CGameSettings::m_DelaySI = false;
DWORD CGameSettings::m_RdramSize = 0; DWORD CGameSettings::m_RdramSize = 0;
@ -23,6 +24,7 @@ CGameSettings::CGameSettings()
m_Registered = true; m_Registered = true;
_Settings->RegisterChangeCB(Game_UseTlb,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); _Settings->RegisterChangeCB(Game_UseTlb,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->RegisterChangeCB(Game_ViRefreshRate,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_CounterFactor,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->RegisterChangeCB(Game_RDRamSize,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); _Settings->RegisterChangeCB(Game_RDRamSize,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->RegisterChangeCB(Game_DelaySI,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_UseTlb,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->UnregisterChangeCB(Game_ViRefreshRate,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_CounterFactor,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->UnregisterChangeCB(Game_RDRamSize,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); _Settings->UnregisterChangeCB(Game_RDRamSize,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->UnregisterChangeCB(Game_DelaySI,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); _Settings->UnregisterChangeCB(Game_DelaySI,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
@ -60,15 +63,16 @@ CGameSettings::~CGameSettings()
void CGameSettings::RefreshSettings() void CGameSettings::RefreshSettings()
{ {
m_bUseTlb = _Settings->LoadBool(Game_UseTlb); m_bUseTlb = _Settings->LoadBool(Game_UseTlb);
m_ViRefreshRate = _Settings->LoadDword(Game_ViRefreshRate); m_ViRefreshRate = _Settings->LoadDword(Game_ViRefreshRate);
m_CountPerOp = _Settings->LoadDword(Game_CounterFactor); m_AiCountPerBytes = _Settings->LoadDword(Game_AiCountPerBytes);
m_RdramSize = _Settings->LoadDword(Game_RDRamSize); m_CountPerOp = _Settings->LoadDword(Game_CounterFactor);
m_DelaySI = _Settings->LoadBool(Game_DelaySI); m_RdramSize = _Settings->LoadDword(Game_RDRamSize);
m_DelayDP = _Settings->LoadBool(Game_DelayDP); m_DelaySI = _Settings->LoadBool(Game_DelaySI);
m_bFixedAudio = _Settings->LoadBool(Game_FixedAudio); m_DelayDP = _Settings->LoadBool(Game_DelayDP);
m_bSyncToAudio = m_bFixedAudio ? _Settings->LoadBool(Game_SyncViaAudio) : false; m_bFixedAudio = _Settings->LoadBool(Game_FixedAudio);
m_b32Bit = _Settings->LoadBool(Game_32Bit); m_bSyncToAudio = m_bFixedAudio ? _Settings->LoadBool(Game_SyncViaAudio) : false;
m_bFastSP = _Settings->LoadBool(Game_FastSP); m_b32Bit = _Settings->LoadBool(Game_32Bit);
m_RspAudioSignal= _Settings->LoadBool(Game_RspAudioSignal); m_bFastSP = _Settings->LoadBool(Game_FastSP);
m_RspAudioSignal = _Settings->LoadBool(Game_RspAudioSignal);
} }

View File

@ -6,17 +6,18 @@ public:
CGameSettings(); CGameSettings();
virtual ~CGameSettings(); virtual ~CGameSettings();
static inline bool bUseTlb ( void ) { return m_bUseTlb; } static inline bool bUseTlb ( void ) { return m_bUseTlb; }
inline static DWORD CountPerOp ( void ) { return m_CountPerOp; } inline static DWORD CountPerOp ( void ) { return m_CountPerOp; }
inline static DWORD ViRefreshRate ( void ) { return m_ViRefreshRate; } inline static DWORD ViRefreshRate ( void ) { return m_ViRefreshRate; }
inline static bool bDelayDP ( void ) { return m_DelayDP; } inline static DWORD AiCountPerBytes ( void ) { return m_AiCountPerBytes; }
inline static bool bDelaySI ( void ) { return m_DelaySI; } inline static bool bDelayDP ( void ) { return m_DelayDP; }
inline static DWORD RdramSize ( void ) { return m_RdramSize; } inline static bool bDelaySI ( void ) { return m_DelaySI; }
inline static bool bFixedAudio ( void ) { return m_bFixedAudio; } inline static DWORD RdramSize ( void ) { return m_RdramSize; }
inline static bool bSyncToAudio ( void ) { return m_bSyncToAudio; } inline static bool bFixedAudio ( void ) { return m_bFixedAudio; }
inline static bool b32BitCore ( void ) { return m_b32Bit; } inline static bool bSyncToAudio ( void ) { return m_bSyncToAudio; }
inline static bool bFastSP ( void ) { return m_bFastSP; } inline static bool b32BitCore ( void ) { return m_b32Bit; }
inline static bool RspAudioSignal( void ) { return m_RspAudioSignal; } inline static bool bFastSP ( void ) { return m_bFastSP; }
inline static bool RspAudioSignal ( void ) { return m_RspAudioSignal; }
private: private:
static void StaticRefreshSettings (CGameSettings * _this) static void StaticRefreshSettings (CGameSettings * _this)
@ -30,6 +31,7 @@ private:
static bool m_bUseTlb; static bool m_bUseTlb;
static DWORD m_CountPerOp; static DWORD m_CountPerOp;
static DWORD m_ViRefreshRate; static DWORD m_ViRefreshRate;
static DWORD m_AiCountPerBytes;
static bool m_DelayDP; static bool m_DelayDP;
static bool m_DelaySI; static bool m_DelaySI;
static DWORD m_RdramSize; static DWORD m_RdramSize;

View File

@ -137,6 +137,7 @@ void CSettings::AddHowToHandleSetting ()
AddHandler(Rdb_SMM_ValidFunc, new CSettingTypeRomDatabase("SMM-FUNC",true)); AddHandler(Rdb_SMM_ValidFunc, new CSettingTypeRomDatabase("SMM-FUNC",true));
AddHandler(Rdb_GameCheatFix, new CSettingTypeRomDatabaseIndex("Cheat","","")); AddHandler(Rdb_GameCheatFix, new CSettingTypeRomDatabaseIndex("Cheat","",""));
AddHandler(Rdb_ViRefreshRate, new CSettingTypeRomDatabase("ViRefresh",1500)); AddHandler(Rdb_ViRefreshRate, new CSettingTypeRomDatabase("ViRefresh",1500));
AddHandler(Rdb_AiCountPerBytes, new CSettingTypeRomDatabase("AiCountPerBytes",500));
AddHandler(Game_IniKey, new CSettingTypeTempString("")); AddHandler(Game_IniKey, new CSettingTypeTempString(""));
AddHandler(Game_GameName, 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_Protect, new CSettingTypeGame("SMM-Protect",Rdb_SMM_Protect));
AddHandler(Game_SMM_ValidFunc, new CSettingTypeGame("SMM-FUNC",Rdb_SMM_ValidFunc)); AddHandler(Game_SMM_ValidFunc, new CSettingTypeGame("SMM-FUNC",Rdb_SMM_ValidFunc));
AddHandler(Game_ViRefreshRate, new CSettingTypeGame("ViRefresh",Rdb_ViRefreshRate)); AddHandler(Game_ViRefreshRate, new CSettingTypeGame("ViRefresh",Rdb_ViRefreshRate));
AddHandler(Game_AiCountPerBytes, new CSettingTypeGame("AiCountPerBytes",Rdb_AiCountPerBytes));
//User Interface //User Interface
AddHandler(UserInterface_BasicMode, new CSettingTypeApplication("","Basic Mode", (DWORD)true)); AddHandler(UserInterface_BasicMode, new CSettingTypeApplication("","Basic Mode", (DWORD)true));

View File

@ -54,6 +54,9 @@ CGameGeneralPage::CGameGeneralPage (HWND hParent, const RECT & rcDispay )
CModifiedEditBox * TxtBox = AddModTextBox(GetDlgItem(IDC_VIREFRESH),Game_ViRefreshRate, false); CModifiedEditBox * TxtBox = AddModTextBox(GetDlgItem(IDC_VIREFRESH),Game_ViRefreshRate, false);
TxtBox->SetTextField(GetDlgItem(IDC_VIREFESH_TEXT)); TxtBox->SetTextField(GetDlgItem(IDC_VIREFESH_TEXT));
TxtBox = AddModTextBox(GetDlgItem(IDC_COUNTPERBYTE),Game_AiCountPerBytes, false);
TxtBox->SetTextField(GetDlgItem(IDC_COUNTPERBYTE_TEXT));
UpdatePageSettings(); UpdatePageSettings();
} }

View File

@ -20,6 +20,7 @@ class CGameGeneralPage :
COMMAND_ID_HANDLER_EX(IDC_DELAY_SI,CheckBoxChanged) COMMAND_ID_HANDLER_EX(IDC_DELAY_SI,CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_AUDIO_SIGNAL,CheckBoxChanged) COMMAND_ID_HANDLER_EX(IDC_AUDIO_SIGNAL,CheckBoxChanged)
COMMAND_HANDLER_EX(IDC_VIREFRESH,EN_UPDATE,EditBoxChanged) COMMAND_HANDLER_EX(IDC_VIREFRESH,EN_UPDATE,EditBoxChanged)
COMMAND_HANDLER_EX(IDC_COUNTPERBYTE,EN_UPDATE,EditBoxChanged)
END_MSG_MAP() END_MSG_MAP()
enum { IDD = IDD_Settings_GameGeneral }; enum { IDD = IDD_Settings_GameGeneral };

View File

@ -200,16 +200,18 @@ BEGIN
COMBOBOX IDC_SAVE_TYPE,102,47,109,49,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_SAVE_TYPE,102,47,109,49,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Counter Factor:",IDC_COUNTFACT_TEXT,6,64,91,10 LTEXT "Counter Factor:",IDC_COUNTFACT_TEXT,6,64,91,10
COMBOBOX IDC_COUNTFACT,102,61,109,49,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP 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 LTEXT "Vi Refresh Rate:",IDC_VIREFESH_TEXT,6,77,91,10
EDITTEXT IDC_VIREFRESH,102,75,109,12,ES_AUTOHSCROLL | ES_NUMBER 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 LTEXT "AI Count Per Byte:",IDC_COUNTPERBYTE_TEXT,6,90,91,10
CONTROL "Delay DP Interrupt",IDC_DELAY_DP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,126,91,11 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 END
IDD_Settings_Accelerator DIALOGEX 0, 0, 218, 183 IDD_Settings_Accelerator DIALOGEX 0, 0, 218, 183

View File

@ -242,7 +242,9 @@
#define IDC_VIREFRESH 1098 #define IDC_VIREFRESH 1098
#define IDC_AUDIO_NAME 1099 #define IDC_AUDIO_NAME 1099
#define IDC_ROM_REGCACHE 1099 #define IDC_ROM_REGCACHE 1099
#define IDC_COUNTPERBYTE_TEXT 1099
#define IDC_CONT_NAME 1100 #define IDC_CONT_NAME 1100
#define IDC_COUNTPERBYTE 1100
#define IDC_DIR_FRAME1 1101 #define IDC_DIR_FRAME1 1101
#define IDC_ROM_FASTSP 1101 #define IDC_ROM_FASTSP 1101
#define IDC_AUDIO_SIGNAL 1102 #define IDC_AUDIO_SIGNAL 1102