More refactoring
This commit is contained in:
parent
90b0f6d60d
commit
74ea476d05
|
@ -1,39 +1,18 @@
|
|||
#include "stdafx.h"
|
||||
#include "mempak.h"
|
||||
#include "Plugin.h"
|
||||
#include "Logging.h"
|
||||
|
||||
//settings
|
||||
BOOL g_HaveDebugger = false, g_AudioSignal = false;
|
||||
DWORD g_CountPerOp = 2, g_ViRefreshRate = 1500;
|
||||
enum CPU_TYPE g_CPU_Type;
|
||||
enum SAVE_CHIP_TYPE g_SaveUsing;
|
||||
|
||||
//Plugins
|
||||
DWORD * _AudioIntrReg = NULL;
|
||||
enum SystemType g_SystemType;
|
||||
|
||||
BOOL g_IndvidualBlock, g_Profiling;
|
||||
|
||||
void CC_Core::SetSettings ( )
|
||||
{
|
||||
if (_Settings)
|
||||
{
|
||||
g_HaveDebugger = _Settings->LoadBool(Debugger_Enabled);
|
||||
g_CPU_Type = (CPU_TYPE)_Settings->LoadDword(Game_CpuType);
|
||||
g_SaveUsing = (SAVE_CHIP_TYPE)_Settings->LoadDword(Game_SaveChip);
|
||||
g_AudioSignal = _Settings->LoadBool(Game_RspAudioSignal);
|
||||
g_CountPerOp = _Settings->LoadDword(Game_CounterFactor);
|
||||
g_ViRefreshRate = _Settings->LoadDword(Game_ViRefreshRate);
|
||||
}
|
||||
}
|
||||
|
||||
const char * GetAppName ( void )
|
||||
{
|
||||
static stdstr szAppName = _Settings->LoadString(Setting_ApplicationName);
|
||||
return szAppName.c_str();
|
||||
}
|
||||
|
||||
void CloseSaveChips ( void )
|
||||
{
|
||||
CloseMempak();
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include "..\\..\\N64 System.h"
|
||||
#include "..\\..\\User Interface.h"
|
||||
#include "..\\..\\Multilanguage.h"
|
||||
#include "..\\..\\Plugin.h"
|
||||
|
||||
class CC_Core
|
||||
{
|
||||
public:
|
||||
|
@ -13,26 +8,17 @@ public:
|
|||
};
|
||||
|
||||
#endif
|
||||
#include <common/memtest.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "..\\Types.h"
|
||||
|
||||
const char * GetAppName ( void );
|
||||
void CloseSaveChips ( void );
|
||||
|
||||
//settings
|
||||
extern BOOL g_HaveDebugger, g_AudioSignal;
|
||||
extern DWORD g_CountPerOp;
|
||||
extern enum CPU_TYPE g_CPU_Type;
|
||||
extern enum SAVE_CHIP_TYPE g_SaveUsing;
|
||||
|
||||
//Plugins
|
||||
extern enum SystemType g_SystemType;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -5,7 +5,7 @@ int GetStoredWinPos( char * WinName, DWORD * X, DWORD * Y ) {
|
|||
HKEY hKeyResults = 0;
|
||||
char String[200];
|
||||
|
||||
sprintf(String,"Software\\N64 Emulation\\%s\\Page Setup",GetAppName());
|
||||
sprintf(String,"Software\\N64 Emulation\\%s\\Page Setup",_Settings->LoadString(Setting_ApplicationName));
|
||||
lResult = RegOpenKeyEx( HKEY_CURRENT_USER,String,0, KEY_ALL_ACCESS,&hKeyResults);
|
||||
|
||||
if (lResult == ERROR_SUCCESS) {
|
||||
|
@ -42,7 +42,7 @@ void StoreCurrentWinPos ( char * WinName, HWND hWnd ) {
|
|||
char String[200];
|
||||
|
||||
GetWindowRect(hWnd, &WinRect );
|
||||
sprintf(String,"Software\\N64 Emulation\\%s\\Page Setup",GetAppName());
|
||||
sprintf(String,"Software\\N64 Emulation\\%s\\Page Setup",_Settings->LoadString(Setting_ApplicationName));
|
||||
lResult = RegCreateKeyEx( HKEY_CURRENT_USER, String,0,"", REG_OPTION_NON_VOLATILE,
|
||||
KEY_ALL_ACCESS,NULL, &hKeyResults,&Disposition);
|
||||
if (lResult == ERROR_SUCCESS) {
|
||||
|
|
|
@ -66,7 +66,7 @@ void LoadLogOptions (LOG_OPTIONS * LogOptions, BOOL AlwaysFill) {
|
|||
DWORD Disposition = 0;
|
||||
char String[200];
|
||||
|
||||
sprintf(String,"Software\\N64 Emulation\\%s\\Logging",GetAppName());
|
||||
sprintf(String,"Software\\N64 Emulation\\%s\\Logging",_Settings->LoadString(Setting_ApplicationName));
|
||||
lResult = RegOpenKeyEx( HKEY_CURRENT_USER,String,0,KEY_ALL_ACCESS,
|
||||
&hKeyResults);
|
||||
|
||||
|
@ -381,7 +381,7 @@ void __cdecl LogMessage (char * Message, ...) {
|
|||
char Msg[400];
|
||||
va_list ap;
|
||||
|
||||
if(!g_HaveDebugger) { return; }
|
||||
if(!_Settings->LoadBool(Debugger_Enabled)) { return; }
|
||||
if(hLogFile == NULL) { return; }
|
||||
|
||||
va_start( ap, Message );
|
||||
|
@ -643,7 +643,7 @@ void SaveLogOptions (void) {
|
|||
DWORD Disposition = 0;
|
||||
char String[200];
|
||||
|
||||
sprintf(String,"Software\\N64 Emulation\\%s\\Logging",GetAppName());
|
||||
sprintf(String,"Software\\N64 Emulation\\%s\\Logging",_Settings->LoadString(Setting_ApplicationName));
|
||||
lResult = RegCreateKeyEx( HKEY_CURRENT_USER,String,0,"", REG_OPTION_NON_VOLATILE,
|
||||
KEY_ALL_ACCESS,NULL,&hKeyResults,&Disposition);
|
||||
|
||||
|
|
|
@ -2205,11 +2205,11 @@ int CMipsMemoryVM::SW_NonMemory ( DWORD PAddr, DWORD Value ) {
|
|||
_Reg->CheckInterrupts();
|
||||
break;
|
||||
case 0x04500010:
|
||||
_Reg->AI_DACRATE_REG = Value;
|
||||
_Plugins->Audio()->DacrateChanged(g_SystemType);
|
||||
_Reg->AI_DACRATE_REG = Value;
|
||||
_Plugins->Audio()->DacrateChanged(_System->m_SystemType);
|
||||
if (bFixedAudio())
|
||||
{
|
||||
_Audio->SetFrequency(Value,g_SystemType);
|
||||
_Audio->SetFrequency(Value,_System->m_SystemType);
|
||||
}
|
||||
break;
|
||||
case 0x04500014: _Reg->AI_BITRATE_REG = Value; break;
|
||||
|
@ -2309,8 +2309,6 @@ int CMipsMemoryVM::SW_NonMemory ( DWORD PAddr, DWORD Value ) {
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
extern DWORD g_ViRefreshRate;
|
||||
|
||||
void CMipsMemoryVM::UpdateHalfLine (void)
|
||||
{
|
||||
if (*_NextTimer < 0) {
|
||||
|
@ -3830,7 +3828,7 @@ void CMipsMemoryVM::ChangeSpStatus (void)
|
|||
if ( ( RegModValue & SP_CLR_SIG7 ) != 0) { _Reg->SP_STATUS_REG &= ~SP_STATUS_SIG7; }
|
||||
if ( ( RegModValue & SP_SET_SIG7 ) != 0) { _Reg->SP_STATUS_REG |= SP_STATUS_SIG7; }
|
||||
|
||||
if ( ( RegModValue & SP_SET_SIG0 ) != 0 && g_AudioSignal)
|
||||
if ( ( RegModValue & SP_SET_SIG0 ) != 0 && _Settings->LoadBool(Game_RspAudioSignal))
|
||||
{
|
||||
_Reg->MI_INTR_REG |= MI_INTR_SP;
|
||||
_Reg->CheckInterrupts();
|
||||
|
|
|
@ -264,7 +264,7 @@ void CRegisters::SetAsCurrentSystem ( void )
|
|||
|
||||
void CRegisters::CheckInterrupts ( void )
|
||||
{
|
||||
if (!bFixedAudio() && g_CPU_Type != CPU_SyncCores) {
|
||||
if (!bFixedAudio() && (CPU_TYPE)_Settings->LoadDword(Game_CpuType) != CPU_SyncCores) {
|
||||
MI_INTR_REG &= ~MI_INTR_AI;
|
||||
MI_INTR_REG |= (m_AudioIntrReg & MI_INTR_AI);
|
||||
}
|
||||
|
|
|
@ -4,17 +4,17 @@
|
|||
|
||||
#include <windows.h>
|
||||
|
||||
void InitializeCPUCore ( void )
|
||||
void CN64System::InitializeCPUCore ( void )
|
||||
{
|
||||
switch (_Rom->GetCountry())
|
||||
{
|
||||
case Germany: case french: case Italian:
|
||||
case Europe: case Spanish: case Australia:
|
||||
case X_PAL: case Y_PAL:
|
||||
g_SystemType = SYSTEM_PAL;
|
||||
m_SystemType = SYSTEM_PAL;
|
||||
break;
|
||||
default:
|
||||
g_SystemType = SYSTEM_NTSC;
|
||||
m_SystemType = SYSTEM_NTSC;
|
||||
break;
|
||||
}
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
|
|
|
@ -31,6 +31,8 @@ public:
|
|||
|
||||
CProfiling m_Profile;
|
||||
CCheats m_Cheats;
|
||||
bool m_EndEmulation;
|
||||
enum SystemType m_SystemType;;
|
||||
|
||||
//Methods
|
||||
static bool CN64System::RunFileImage ( const char * FileLoc );
|
||||
|
@ -46,7 +48,6 @@ public:
|
|||
void IncreaseSpeed ( void ) { m_Limitor.IncreaeSpeed(10); }
|
||||
void DecreaeSpeed ( void ) { m_Limitor.DecreaeSpeed(10); }
|
||||
void Reset ( bool bInitReg, bool ClearMenory );
|
||||
bool m_EndEmulation;
|
||||
|
||||
void Pause ( void );
|
||||
void RunRSP ( void );
|
||||
|
@ -82,6 +83,7 @@ private:
|
|||
static void StartEmulationThread ( FileImageInfo * Info );
|
||||
static bool EmulationStarting ( HANDLE hThread, DWORD ThreadId );
|
||||
|
||||
void InitializeCPUCore( void );
|
||||
void ExecuteCPU ( void );
|
||||
void RefreshScreen ( void );
|
||||
bool InternalEvent ( void );
|
||||
|
|
|
@ -9,7 +9,6 @@ public:
|
|||
static inline bool bUseTlb ( void ) { return m_bUseTlb; }
|
||||
inline static DWORD CountPerOp ( void ) { return m_CountPerOp; }
|
||||
inline static DWORD ViRefreshRate ( void ) { return m_ViRefreshRate; }
|
||||
|
||||
private:
|
||||
static void StaticRefreshSettings (CGameSettings * _this)
|
||||
{
|
||||
|
@ -21,7 +20,6 @@ private:
|
|||
//Settings that can be changed on the fly
|
||||
static bool m_bUseTlb;
|
||||
static DWORD m_CountPerOp;
|
||||
static DWORD m_ViRefreshRate;
|
||||
|
||||
static DWORD m_ViRefreshRate;
|
||||
static int m_RefCount;
|
||||
};
|
Loading…
Reference in New Issue