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