handle pal system frequency better

This commit is contained in:
Nicholas 2015-01-26 14:43:37 +11:00
parent a08def5504
commit 8c1852afa0
13 changed files with 50 additions and 40 deletions

View File

@ -2523,10 +2523,10 @@ int CMipsMemoryVM::SW_NonMemory ( DWORD PAddr, DWORD Value ) {
break;
case 0x04500010:
g_Reg->AI_DACRATE_REG = Value;
g_Plugins->Audio()->DacrateChanged(g_System->m_SystemType);
g_Plugins->Audio()->DacrateChanged(g_System->SystemType());
if (g_System->bFixedAudio())
{
g_Audio->SetFrequency(Value,g_System->m_SystemType);
g_Audio->SetFrequency(Value,g_System->SystemType());
}
break;
case 0x04500014: g_Reg->AI_BITRATE_REG = Value; break;

View File

@ -40,25 +40,18 @@ CN64System::CN64System ( CPlugins * Plugins, bool SavesReadOnly ) :
m_TLBLoadAddress(0),
m_TLBStoreAddress(0),
m_SaveUsing((SAVE_CHIP_TYPE)g_Settings->LoadDword(Game_SaveChip)),
m_SystemType(SYSTEM_NTSC),
m_RspBroke(true),
m_SyncCount(0)
{
m_hPauseEvent = CreateEvent(NULL,true,false,NULL);
m_Limitor.SetHertz(g_Settings->LoadDword(Game_ScreenHertz));
m_Cheats.LoadCheats(!g_Settings->LoadDword(Setting_RememberCheats));
switch (g_Rom->GetCountry())
DWORD gameHertz = 60;
if (!g_Settings->LoadDword(Game_ScreenHertz), gameHertz)
{
case Germany: case french: case Italian:
case Europe: case Spanish: case Australia:
case X_PAL: case Y_PAL:
m_SystemType = SYSTEM_PAL;
break;
default:
m_SystemType = SYSTEM_NTSC;
break;
gameHertz = (SystemType() == SYSTEM_PAL) ? 50 : 60;
}
m_hPauseEvent = CreateEvent(NULL,true,false,NULL);
m_Limitor.SetHertz(gameHertz);
g_Settings->SaveDword(GameRunning_ScreenHertz,gameHertz);
m_Cheats.LoadCheats(!g_Settings->LoadDword(Setting_RememberCheats));
}
CN64System::~CN64System ( void )

View File

@ -41,7 +41,6 @@ public:
CCheats m_Cheats;
bool m_EndEmulation;
SAVE_CHIP_TYPE m_SaveUsing;
SystemType m_SystemType;
//Methods
static bool RunFileImage ( const char * FileLoc );

View File

@ -466,6 +466,18 @@ void CN64Rom::SaveRomSettingID ( void )
{
g_Settings->SaveString(Game_GameName,m_RomName.c_str());
g_Settings->SaveString(Game_IniKey,m_RomIdent.c_str());
switch (GetCountry())
{
case Germany: case french: case Italian:
case Europe: case Spanish: case Australia:
case X_PAL: case Y_PAL:
g_Settings->SaveDword(Game_SystemType,SYSTEM_PAL);
break;
default:
g_Settings->SaveDword(Game_SystemType,SYSTEM_NTSC);
break;
}
}
void CN64Rom::ClearRomSettingID ( void )

View File

@ -44,7 +44,7 @@ enum FUNC_LOOKUP_METHOD
FuncFind_Default = -1, FuncFind_PhysicalLookup = 1, FuncFind_VirtualLookup = 2, FuncFind_ChangeMemory = 3,
};
enum SystemType {
enum SYSTEM_TYPE {
SYSTEM_NTSC = 0, SYSTEM_PAL = 1, SYSTEM_MPAL = 2
};

View File

@ -60,7 +60,7 @@ void CAudioPlugin::Init ( const char * FileName )
//Find entries for functions in DLL
void (__cdecl *InitFunc) ( void );
m_DacrateChanged = (void (__cdecl *)(SystemType)) GetProcAddress( (HMODULE)m_hDll, "AiDacrateChanged" );
m_DacrateChanged = (void (__cdecl *)(SYSTEM_TYPE)) GetProcAddress( (HMODULE)m_hDll, "AiDacrateChanged" );
LenChanged = (void (__cdecl *)(void)) GetProcAddress( (HMODULE)m_hDll, "AiLenChanged" );
Config = (void (__cdecl *)(DWORD))GetProcAddress( (HMODULE)m_hDll, "DllConfig" );
ReadLength = (DWORD (__cdecl *)(void))GetProcAddress( (HMODULE)m_hDll, "AiReadLength" );
@ -226,7 +226,7 @@ bool CAudioPlugin::Initiate ( CN64System * System, CMainGui * RenderWindow ) {
}
if (g_Reg->AI_DACRATE_REG != 0) {
DacrateChanged(SYSTEM_NTSC);
DacrateChanged(System->SystemType());
}
return m_Initilized;
}
@ -295,7 +295,7 @@ void CAudioPlugin::UnloadPlugin(void) {
CloseDLL = NULL;
}
void CAudioPlugin::DacrateChanged (SystemType Type)
void CAudioPlugin::DacrateChanged (SYSTEM_TYPE Type)
{
if (!Initilized()) { return; }
WriteTraceF(TraceAudio,__FUNCTION__ ": SystemType: %s", Type == SYSTEM_NTSC ? "SYSTEM_NTSC" : "SYSTEM_PAL");

View File

@ -16,7 +16,7 @@ public:
CAudioPlugin ( const char * FileName);
~CAudioPlugin ( void );
void DacrateChanged ( SystemType Type );
void DacrateChanged ( SYSTEM_TYPE Type );
bool Initiate ( CN64System * System, CMainGui * RenderWindow );
void Close ( void );
void GameReset ( void );
@ -44,7 +44,7 @@ private:
void (__cdecl *RomOpen) ( void );
void (__cdecl *RomClosed) ( void );
void (__cdecl *Update) ( BOOL Wait );
void (__cdecl *m_DacrateChanged) ( SystemType Type );
void (__cdecl *m_DacrateChanged) ( SYSTEM_TYPE Type );
void (__cdecl *PluginOpened) ( void );
void (__cdecl *SetSettingInfo) ( PLUGIN_SETTINGS * info );
void (__cdecl *SetSettingInfo2) ( PLUGIN_SETTINGS2 * info );

View File

@ -97,6 +97,7 @@ enum SettingID {
Game_IniKey,
Game_GameName,
Game_GoodName,
Game_SystemType,
Game_EditPlugin_Gfx,
Game_EditPlugin_Audio,
Game_EditPlugin_Contr,

View File

@ -32,6 +32,7 @@ bool CGameSettings::m_bRomInMemory;
bool CGameSettings::m_RegCaching;
bool CGameSettings::m_bLinkBlocks;
DWORD CGameSettings::m_LookUpMode; //FUNC_LOOKUP_METHOD
SYSTEM_TYPE CGameSettings::m_SystemType = SYSTEM_NTSC;
void CGameSettings::RefreshGameSettings()
{
@ -59,6 +60,7 @@ void CGameSettings::RefreshGameSettings()
m_RegCaching = g_Settings->LoadBool(Game_RegCache);
m_bLinkBlocks = g_Settings->LoadBool(Game_BlockLinking);
m_LookUpMode = g_Settings->LoadDword(Game_FuncLookupMode);
m_SystemType = (SYSTEM_TYPE)g_Settings->LoadDword(Game_SystemType);
m_bSyncingToAudio = m_bSyncToAudio;
if (m_CountPerOp == 0)

View File

@ -38,6 +38,7 @@ public:
static inline bool bSMM_ValidFunc ( void ) { return m_bSMM_ValidFunc; }
static inline bool bSMM_PIDMA ( void ) { return m_bSMM_PIDMA; }
static inline bool bSMM_TLB ( void ) { return m_bSMM_TLB; }
inline static SYSTEM_TYPE SystemType ( void ) { return m_SystemType; }
protected:
static void SpeedChanged (int SpeedLimit );
@ -66,4 +67,5 @@ private:
static bool m_bSMM_ValidFunc;
static bool m_bSMM_PIDMA;
static bool m_bSMM_TLB;
static SYSTEM_TYPE m_SystemType;
};

View File

@ -16,23 +16,23 @@ protected:
CN64SystemSettings();
virtual ~CN64SystemSettings();
inline static bool bBasicMode ( void ) { return m_bBasicMode; }
inline static bool bDisplayFrameRate ( void ) { return m_bDisplayFrameRate; }
inline static bool bShowCPUPer ( void ) { return m_bShowCPUPer; }
inline static bool bProfiling ( void ) { return m_bProfiling; }
inline static bool bShowDListAListCount ( void ) { return m_bShowDListAListCount; }
inline static bool bLimitFPS ( void ) { return m_bLimitFPS; }
inline static bool bBasicMode ( void ) { return m_bBasicMode; }
inline static bool bDisplayFrameRate ( void ) { return m_bDisplayFrameRate; }
inline static bool bShowCPUPer ( void ) { return m_bShowCPUPer; }
inline static bool bProfiling ( void ) { return m_bProfiling; }
inline static bool bShowDListAListCount ( void ) { return m_bShowDListAListCount; }
inline static bool bLimitFPS ( void ) { return m_bLimitFPS; }
private:
static void RefreshSettings ( void * );
static bool m_bShowCPUPer;
static bool m_bProfiling;
static bool m_bBasicMode;
static bool m_bLimitFPS;
static bool m_bShowDListAListCount;
static bool m_bDisplayFrameRate;
static bool m_bShowCPUPer;
static bool m_bProfiling;
static bool m_bBasicMode;
static bool m_bLimitFPS;
static bool m_bShowDListAListCount;
static bool m_bDisplayFrameRate;
static int m_RefCount;
static int m_RefCount;
};

View File

@ -43,7 +43,7 @@ CSettingTypeRomDatabaseSetting::~CSettingTypeRomDatabaseSetting()
{
}
bool CSettingTypeRomDatabaseSetting::Load ( int Index, bool & Value ) const
bool CSettingTypeRomDatabaseSetting::Load ( int /*Index*/, bool & /*Value*/ ) const
{
g_Notify->BreakPoint(__FILE__,__LINE__);
/* DWORD temp_value = Value;
@ -63,7 +63,7 @@ bool CSettingTypeRomDatabaseSetting::Load ( int Index, ULONG & Value ) const
return bRes;
}
bool CSettingTypeRomDatabaseSetting::Load ( int Index, stdstr & Value ) const
bool CSettingTypeRomDatabaseSetting::Load ( int /*Index*/, stdstr & /*Value*/ ) const
{
g_Notify->BreakPoint(__FILE__,__LINE__);
/*stdstr temp_value;
@ -137,7 +137,7 @@ void CSettingTypeRomDatabaseSetting::Save ( int /*Index*/, bool Value )
*/
}
void CSettingTypeRomDatabaseSetting::Save ( int Index, ULONG Value )
void CSettingTypeRomDatabaseSetting::Save ( int /*Index*/, ULONG /*Value*/ )
{
g_Notify->BreakPoint(__FILE__,__LINE__);
/*if (!g_Settings->LoadBool(Setting_RdbEditor))
@ -158,7 +158,7 @@ void CSettingTypeRomDatabaseSetting::Save ( int Index, ULONG Value )
*/
}
void CSettingTypeRomDatabaseSetting::Save ( int /*Index*/, const stdstr & Value )
void CSettingTypeRomDatabaseSetting::Save ( int /*Index*/, const stdstr & /*Value*/ )
{
g_Notify->BreakPoint(__FILE__,__LINE__);
/*if (!g_Settings->LoadBool(Setting_RdbEditor))

View File

@ -159,6 +159,7 @@ void CSettings::AddHowToHandleSetting ()
AddHandler(Game_IniKey, new CSettingTypeTempString(""));
AddHandler(Game_GameName, new CSettingTypeTempString(""));
AddHandler(Game_GoodName, new CSettingTypeGame("Good Name",Rdb_GoodName));
AddHandler(Game_SystemType, new CSettingTypeTempNumber(SYSTEM_NTSC));
AddHandler(Game_EditPlugin_Gfx, new CSettingTypeGame("Plugin-Gfx",Default_None));
AddHandler(Game_EditPlugin_Audio, new CSettingTypeGame("Plugin-Audio",Default_None));
AddHandler(Game_EditPlugin_Contr, new CSettingTypeGame("Plugin-Controller",Default_None));