git-svn-id: https://localhost/svn/Project64/trunk@34 111125ac-702d-7242-af9c-5ba8ae61c1ef
This commit is contained in:
parent
41d4f7ff04
commit
a5bfa92557
|
@ -3,52 +3,9 @@
|
|||
<pre>
|
||||
<h1>Build Log</h1>
|
||||
<h3>
|
||||
--------------------Configuration: 7zip - Win32 Release--------------------
|
||||
--------------------Configuration: 7zip - Win32 External Release--------------------
|
||||
</h3>
|
||||
<h3>Command Lines</h3>
|
||||
Creating temporary file "C:\DOCUME~1\NICHOL~1\LOCALS~1\Temp\RSPC52.tmp" with contents
|
||||
[
|
||||
/nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /Fp"../../Build/7zip/Release/7zip.pch" /YX /Fo"../../Build/7zip/Release/" /Fd"../../Build/7zip/Release/" /FD /c
|
||||
"D:\My Programs\Emulation\Projedt64\SOURCE\7zip\7zAlloc.c"
|
||||
"D:\My Programs\Emulation\Projedt64\SOURCE\7zip\7zBuffer.c"
|
||||
"D:\My Programs\Emulation\Projedt64\SOURCE\7zip\7zCrc.c"
|
||||
"D:\My Programs\Emulation\Projedt64\SOURCE\7zip\7zDecode.c"
|
||||
"D:\My Programs\Emulation\Projedt64\SOURCE\7zip\7zExtract.c"
|
||||
"D:\My Programs\Emulation\Projedt64\SOURCE\7zip\7zHeader.c"
|
||||
"D:\My Programs\Emulation\Projedt64\SOURCE\7zip\7zIn.c"
|
||||
"D:\My Programs\Emulation\Projedt64\SOURCE\7zip\7zItem.c"
|
||||
"D:\My Programs\Emulation\Projedt64\SOURCE\7zip\7zMethodID.c"
|
||||
"D:\My Programs\Emulation\Projedt64\SOURCE\7zip\Compress\LzmaDecode.c"
|
||||
]
|
||||
Creating command line "cl.exe @C:\DOCUME~1\NICHOL~1\LOCALS~1\Temp\RSPC52.tmp"
|
||||
Creating temporary file "C:\DOCUME~1\NICHOL~1\LOCALS~1\Temp\RSPC53.tmp" with contents
|
||||
[
|
||||
/nologo /out:"../../Build/7zip/Release\7zip.lib"
|
||||
"\My Programs\Emulation\Projedt64\Build\7zip\Release\7zAlloc.obj"
|
||||
"\My Programs\Emulation\Projedt64\Build\7zip\Release\7zBuffer.obj"
|
||||
"\My Programs\Emulation\Projedt64\Build\7zip\Release\7zCrc.obj"
|
||||
"\My Programs\Emulation\Projedt64\Build\7zip\Release\7zDecode.obj"
|
||||
"\My Programs\Emulation\Projedt64\Build\7zip\Release\7zExtract.obj"
|
||||
"\My Programs\Emulation\Projedt64\Build\7zip\Release\7zHeader.obj"
|
||||
"\My Programs\Emulation\Projedt64\Build\7zip\Release\7zIn.obj"
|
||||
"\My Programs\Emulation\Projedt64\Build\7zip\Release\7zItem.obj"
|
||||
"\My Programs\Emulation\Projedt64\Build\7zip\Release\7zMethodID.obj"
|
||||
"\My Programs\Emulation\Projedt64\Build\7zip\Release\LzmaDecode.obj"
|
||||
]
|
||||
Creating command line "link.exe -lib @C:\DOCUME~1\NICHOL~1\LOCALS~1\Temp\RSPC53.tmp"
|
||||
<h3>Output Window</h3>
|
||||
Compiling...
|
||||
7zAlloc.c
|
||||
7zBuffer.c
|
||||
7zCrc.c
|
||||
7zDecode.c
|
||||
7zExtract.c
|
||||
7zHeader.c
|
||||
7zIn.c
|
||||
7zItem.c
|
||||
7zMethodID.c
|
||||
LzmaDecode.c
|
||||
Creating library...
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -67,14 +67,14 @@ void CC_Core::SetSettings ( )
|
|||
|
||||
void CC_Core::PauseExecution ( void )
|
||||
{
|
||||
_N64System->Pause();
|
||||
_BaseSystem->Pause();
|
||||
}
|
||||
|
||||
void CC_Core::RunRsp ( void )
|
||||
{
|
||||
try
|
||||
{
|
||||
_N64System->RunRSP();
|
||||
_System->RunRSP();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -86,22 +86,22 @@ void CC_Core::RunRsp ( void )
|
|||
|
||||
void CC_Core::GenerateProfileLog ( void )
|
||||
{
|
||||
_N64System->m_Profile.GenerateLog();
|
||||
_BaseSystem->m_Profile.GenerateLog();
|
||||
}
|
||||
|
||||
void CC_Core::ResetTimer ( void )
|
||||
{
|
||||
_N64System->m_Profile.ResetCounters();
|
||||
_System->m_Profile.ResetCounters();
|
||||
}
|
||||
|
||||
DWORD CC_Core::StartTimer ( DWORD Address )
|
||||
{
|
||||
return _N64System->m_Profile.StartTimer(Address);
|
||||
return _System->m_Profile.StartTimer(Address);
|
||||
}
|
||||
|
||||
DWORD CC_Core::StopTimer ( void )
|
||||
{
|
||||
return _N64System->m_Profile.StopTimer();
|
||||
return _System->m_Profile.StopTimer();
|
||||
}
|
||||
|
||||
void PauseExecution ( void )
|
||||
|
@ -167,19 +167,6 @@ void DacrateChanged ( enum SystemType Type )
|
|||
_Plugins->Audio()->DacrateChanged(Type);
|
||||
}
|
||||
|
||||
BOOL Close_C_CPU ( void )
|
||||
{
|
||||
if (_Settings == NULL || !_Settings->LoadBool(GameRunning_CPU_Running))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
_N64System->m_EndEmulation = true;
|
||||
_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
// g_Main_CPU_Action->DoSomething = true;
|
||||
// g_Main_CPU_Action->CloseCPU = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void RunRsp( void )
|
||||
{
|
||||
CC_Core::RunRsp();
|
||||
|
@ -187,12 +174,12 @@ void RunRsp( void )
|
|||
|
||||
void SyncSystem (void)
|
||||
{
|
||||
_N64System->SyncCPU(_SyncSystem);
|
||||
_BaseSystem->SyncCPU(_SyncSystem);
|
||||
}
|
||||
|
||||
void ApplyGSButtonCheats ( void )
|
||||
{
|
||||
CC_Core::ApplyGSButtonCheats(_N64System);
|
||||
CC_Core::ApplyGSButtonCheats(_BaseSystem);
|
||||
}
|
||||
|
||||
void ChangePluginFunc ( void )
|
||||
|
@ -224,7 +211,7 @@ void ChangePluginFunc ( void )
|
|||
if (!_Plugins->Initiate())
|
||||
{
|
||||
_Notify->DisplayMessage(5,MSG_PLUGIN_NOT_INIT);
|
||||
_N64System->m_EndEmulation = true;
|
||||
_BaseSystem->m_EndEmulation = true;
|
||||
} else {
|
||||
//CC_Core::SetCurrentSystem(_N64System);
|
||||
}
|
||||
|
@ -238,7 +225,7 @@ void ChangeFullScreenFunc ( void )
|
|||
|
||||
BOOL Machine_LoadState ( void )
|
||||
{
|
||||
bool Result = CC_Core::LoadState(_N64System);
|
||||
bool Result = CC_Core::LoadState(_System);
|
||||
//CC_Core::SetCurrentSystem(_N64System);
|
||||
return Result;
|
||||
}
|
||||
|
@ -265,7 +252,7 @@ DWORD StopTimer ( void )
|
|||
|
||||
BOOL Machine_SaveState ( void )
|
||||
{
|
||||
return CC_Core::SaveState(_N64System);
|
||||
return CC_Core::SaveState(_BaseSystem);
|
||||
}
|
||||
|
||||
void BreakPoint(LPCSTR FileName, int LineNumber )
|
||||
|
@ -305,7 +292,7 @@ void CC_Core::ApplyCheats (CN64System * System)
|
|||
|
||||
void ApplyCheats (void)
|
||||
{
|
||||
CC_Core::ApplyCheats(_N64System);
|
||||
CC_Core::ApplyCheats(_BaseSystem);
|
||||
}
|
||||
|
||||
void ResetX86Logs ( void )
|
||||
|
|
|
@ -45,7 +45,6 @@ void DacrateChanged ( enum SystemType Type );
|
|||
void ChangePluginFunc ( void );
|
||||
void ApplyGSButtonCheats ( void );
|
||||
void ChangeFullScreenFunc ( void );
|
||||
BOOL Close_C_CPU ( void );
|
||||
void StartInterpreterCPU ( void );
|
||||
void SyncSystem ( void );
|
||||
BOOL Machine_LoadState ( void );
|
||||
|
|
|
@ -136,9 +136,9 @@ void PI_DMA_WRITE (void) {
|
|||
}
|
||||
_Reg->PI_CART_ADDR_REG += 0x10000000;
|
||||
|
||||
if (!_N64System->DmaUsed())
|
||||
if (!_System->DmaUsed())
|
||||
{
|
||||
_N64System->SetDmaUsed(true);
|
||||
_System->SetDmaUsed(true);
|
||||
OnFirstDMA();
|
||||
}
|
||||
if (_Recompiler && _Recompiler->bSMM_PIDMA())
|
||||
|
|
|
@ -54,7 +54,7 @@ LRESULT CDumpMemory::OnClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& b
|
|||
openfilename.lpstrInitialDir = Directory;
|
||||
openfilename.nMaxFile = MAX_PATH;
|
||||
openfilename.Flags = OFN_HIDEREADONLY;
|
||||
_N64System->ExternalEvent(SysEvent_PauseCPU_DumpMemory);
|
||||
_BaseSystem->ExternalEvent(SysEvent_PauseCPU_DumpMemory);
|
||||
if (GetOpenFileName (&openfilename))
|
||||
{
|
||||
char drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT];
|
||||
|
@ -65,7 +65,7 @@ LRESULT CDumpMemory::OnClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& b
|
|||
}
|
||||
SetDlgItemText(IDC_FILENAME,FileName);
|
||||
}
|
||||
_N64System->ExternalEvent(SysEvent_ResumeCPU_DumpMemory);
|
||||
_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_DumpMemory);
|
||||
}
|
||||
break;
|
||||
case IDOK:
|
||||
|
@ -97,14 +97,14 @@ LRESULT CDumpMemory::OnClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& b
|
|||
::EnableWindow(GetDlgItem(IDC_FORMAT),FALSE);
|
||||
::EnableWindow(GetDlgItem(IDOK),FALSE);
|
||||
::EnableWindow(GetDlgItem(IDCANCEL),FALSE);
|
||||
_N64System->ExternalEvent(SysEvent_PauseCPU_DumpMemory);
|
||||
_BaseSystem->ExternalEvent(SysEvent_PauseCPU_DumpMemory);
|
||||
if (!DumpMemory(FileName,Format,StartPC,EndPC,DumpPC))
|
||||
{
|
||||
//enable buttons
|
||||
_N64System->ExternalEvent(SysEvent_ResumeCPU_DumpMemory);
|
||||
_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_DumpMemory);
|
||||
return false;
|
||||
}
|
||||
_N64System->ExternalEvent(SysEvent_ResumeCPU_DumpMemory);
|
||||
_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_DumpMemory);
|
||||
}
|
||||
EndDialog(0);
|
||||
break;
|
||||
|
|
|
@ -178,7 +178,7 @@ void InPermLoop (void) {
|
|||
if (( _Reg->STATUS_REGISTER & 0xFF00) == 0) { goto InterruptsDisabled; }
|
||||
|
||||
/* check sound playing */
|
||||
_N64System->SyncToAudio();
|
||||
_System->SyncToAudio();
|
||||
|
||||
/* check RSP running */
|
||||
/* check RDP running */
|
||||
|
@ -196,7 +196,7 @@ InterruptsDisabled:
|
|||
//CurrentPercent = 0;
|
||||
//DisplayFPS();
|
||||
DisplayError(GS(MSG_PERM_LOOP));
|
||||
_N64System->CloseCpu();
|
||||
_System->CloseCpu();
|
||||
|
||||
}
|
||||
|
||||
|
@ -223,7 +223,7 @@ void CInterpreterCPU::BuildCPU (void )
|
|||
|
||||
void CInterpreterCPU::ExecuteCPU (void )
|
||||
{
|
||||
bool & Done = _N64System->m_EndEmulation;
|
||||
bool & Done = _System->m_EndEmulation;
|
||||
DWORD & PROGRAM_COUNTER = *_PROGRAM_COUNTER;
|
||||
OPCODE & Opcode = R4300iOp::m_Opcode;
|
||||
DWORD & JumpToLocation = R4300iOp::m_JumpToLocation;
|
||||
|
@ -290,7 +290,7 @@ void CInterpreterCPU::ExecuteCPU (void )
|
|||
|
||||
void CInterpreterCPU::ExecuteOps ( int Cycles )
|
||||
{
|
||||
bool & Done = _N64System->m_EndEmulation;
|
||||
bool & Done = _System->m_EndEmulation;
|
||||
DWORD & PROGRAM_COUNTER = *_PROGRAM_COUNTER;
|
||||
OPCODE & Opcode = R4300iOp::m_Opcode;
|
||||
DWORD & JumpToLocation = R4300iOp::m_JumpToLocation;
|
||||
|
|
|
@ -1,11 +1,3 @@
|
|||
#ifdef toremove
|
||||
#include <windows.h>
|
||||
|
||||
enum MemorySize { _8Bit, _16Bit, _32Bit, _64Bit };
|
||||
|
||||
class CC_Core;
|
||||
#endif
|
||||
|
||||
class CMipsMemory_CallBack {
|
||||
public:
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,38 +1,11 @@
|
|||
class CCodeSection;
|
||||
class CRegInfo;
|
||||
class CRSP_Plugin;
|
||||
|
||||
class CMipsMemoryVM :
|
||||
public CMipsMemory,
|
||||
public CTransVaddr,
|
||||
private CRecompilerOps,
|
||||
private R4300iOp
|
||||
{
|
||||
//Make sure plugins can directly access this information
|
||||
friend CGfxPlugin;
|
||||
friend CAudioPlugin;
|
||||
friend CRSP_Plugin;
|
||||
friend CControl_Plugin;
|
||||
friend CN64System; //Need to manipulate all memory in loading/saveing save state
|
||||
// friend CC_Core;
|
||||
|
||||
#ifdef toremove
|
||||
CNotification * const _Notify; //Original Notify member used to notify the user when something occurs
|
||||
CN64System * const _System;
|
||||
CN64Rom * const _Rom2; //Current loaded ROM
|
||||
CRegisters * const _Reg;
|
||||
#endif
|
||||
CMipsMemory_CallBack * const m_CBClass;
|
||||
|
||||
#ifdef toremove
|
||||
//Save Chips accessed by memory
|
||||
/*CSram * m_Sram;
|
||||
CFlashRam * m_FlashRam;
|
||||
bool m_SavesReadOnly;
|
||||
|
||||
*/
|
||||
#endif
|
||||
|
||||
//Memory Locations
|
||||
BYTE * m_RDRAM, * m_DMEM, * m_IMEM, m_PIF_Ram[0x40];
|
||||
DWORD m_AllocatedRdramSize;
|
||||
|
@ -44,29 +17,13 @@ class CMipsMemoryVM :
|
|||
bool m_RomWrittenTo;
|
||||
DWORD m_RomWroteValue;
|
||||
|
||||
// Recompiler
|
||||
void ** JumpTable/*, ** DelaySlotTable*/;
|
||||
BYTE * m_RecompCode;
|
||||
DWORD m_RecompSize;
|
||||
|
||||
enum { MaxCompileBufferSize = 0x03C00000 };
|
||||
enum { InitialCompileBufferSize = 0x00500000 };
|
||||
enum { IncreaseCompileBufferSize = 0x00100000 };
|
||||
|
||||
//Current Half line
|
||||
void UpdateHalfLine ( void );
|
||||
DWORD m_HalfLine;
|
||||
DWORD m_MemoryStack;
|
||||
DWORD m_TempValue;
|
||||
|
||||
//Searching memory
|
||||
BYTE * m_MemoryState;
|
||||
DWORD m_MemoryStateSize;
|
||||
|
||||
//Initilizing and reseting information about the memory system
|
||||
void AllocateSystemMemory ( void );
|
||||
void InitalizeSystem ( bool PostPif );
|
||||
void FixRDramSize ( void );
|
||||
void FreeMemory ( void );
|
||||
|
||||
public:
|
||||
|
@ -142,58 +99,16 @@ public:
|
|||
|
||||
// CTransVaddr interface
|
||||
bool TranslateVaddr ( DWORD VAddr, DWORD &PAddr) const;
|
||||
bool ValidVaddr ( DWORD VAddr ) const;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Recompiler Memory
|
||||
bool AllocateRecompilerMemory ( bool AllocateJumpTable );
|
||||
inline void ** GetJumpTable ( void ) const { return JumpTable; }
|
||||
inline BYTE * GetRecompCode ( void ) const { return m_RecompCode; }
|
||||
inline DWORD GetRecompBufferSize ( void ) const { return m_RecompSize; }
|
||||
|
||||
void CheckRecompMem ( BYTE * RecompPos );
|
||||
|
||||
#ifdef toremove
|
||||
bool LoadPhysical32 ( DWORD PAddr, DWORD & Variable, MemorySize Size, bool SignExtend );
|
||||
bool Load32 ( DWORD VAddr, DWORD & Variable, MemorySize Size, bool SignExtend );
|
||||
bool Load64 ( DWORD VAddr, QWORD & Variable, MemorySize Size, bool SignExtend );
|
||||
bool Store64 ( DWORD VAddr, QWORD Value, MemorySize Size );
|
||||
bool StorePhysical64 ( DWORD PAddr, QWORD Value, MemorySize Size );
|
||||
|
||||
inline DWORD RomFileSize ( void ) { return m_RomFileSize; }
|
||||
|
||||
//Win32 exception handler
|
||||
void MemoryFilterFailed ( char * FailureType, DWORD MipsAddress, DWORD x86Address, DWORD Value);
|
||||
int SystemMemoryFilter ( DWORD dwExptCode, void * lpExceptionPointer );
|
||||
DWORD GetExceptionCodeFn ( void );
|
||||
void * GetExceptionInformationFn ( void );
|
||||
|
||||
|
||||
//Searching for value
|
||||
enum SearchMemChangeState
|
||||
{
|
||||
SearchChangeState_Reset,
|
||||
SearchChangeState_Changed,
|
||||
SearchChangeState_Unchanged,
|
||||
SearchChangeState_Greater,
|
||||
SearchChangeState_Lessthan,
|
||||
};
|
||||
|
||||
bool SearchSetBaseForChanges ( void );
|
||||
bool SearchForChanges ( SearchMemChangeState SearchType, MemorySize Size,
|
||||
DWORD &StartAddress, DWORD &Len,
|
||||
DWORD &OldValue, DWORD &NewValue );
|
||||
bool SearchForValue (DWORD Value, MemorySize Size, DWORD &StartAddress, DWORD &Len);
|
||||
#endif
|
||||
bool ValidVaddr ( DWORD VAddr ) const;
|
||||
|
||||
// Labels
|
||||
LPCTSTR LabelName ( DWORD Address ) const;
|
||||
|
||||
private:
|
||||
static void RdramChanged ( CMipsMemoryVM * _this );
|
||||
static void ChangeSpStatus ( void );
|
||||
static void ChangeMiIntrMask ( void );
|
||||
|
||||
int LB_NonMemory ( DWORD PAddr, DWORD * Value, BOOL SignExtend );
|
||||
int LH_NonMemory ( DWORD PAddr, DWORD * Value, int SignExtend );
|
||||
int LW_NonMemory ( DWORD PAddr, DWORD * Value );
|
||||
|
@ -208,5 +123,3 @@ private:
|
|||
DWORD * m_TLB_ReadMap;
|
||||
DWORD * m_TLB_WriteMap;
|
||||
};
|
||||
|
||||
extern void ** JumpTable;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -228,8 +228,8 @@ void CRegisters::Reset()
|
|||
m_LO.DW = 0;
|
||||
m_RoundingModel = ROUND_NEAR;
|
||||
|
||||
//LLBit = 0;
|
||||
//LLAddr = 0;
|
||||
m_LLBit = 0;
|
||||
m_LLAddr = 0;
|
||||
|
||||
//Reset System Registers
|
||||
memset(m_RDRAM_Interface,0,sizeof(m_RDRAM_Interface));
|
||||
|
|
|
@ -49,6 +49,9 @@ void CSystemEvents::ExecuteEvents ( void )
|
|||
_Reg->CheckInterrupts();
|
||||
_Plugins->Gfx()->SoftReset();
|
||||
break;
|
||||
case SysEvent_ResetCPU_SoftDone:
|
||||
_System->SoftReset();
|
||||
break;
|
||||
case SysEvent_Profile_GenerateLogs:
|
||||
GenerateProfileLog();
|
||||
break;
|
||||
|
@ -158,6 +161,9 @@ void CSystemEvents::ExecuteEvents ( void )
|
|||
bPause = true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ enum SystemEvent {
|
|||
SysEvent_ExecuteInterrupt,
|
||||
SysEvent_GSButtonPressed,
|
||||
SysEvent_ResetCPU_Soft,
|
||||
SysEvent_ResetCPU_SoftDone,
|
||||
SysEvent_ResetCPU_Hard,
|
||||
SysEvent_CloseCPU,
|
||||
SysEvent_PauseCPU_FromMenu,
|
||||
|
|
|
@ -4,7 +4,6 @@ CSystemTimer::CSystemTimer( int & NextTimer ) :
|
|||
m_NextTimer(NextTimer)
|
||||
{
|
||||
Reset();
|
||||
SetTimer(ViTimer,50000,false);
|
||||
}
|
||||
|
||||
void CSystemTimer::Reset ( void )
|
||||
|
@ -18,6 +17,8 @@ void CSystemTimer::Reset ( void )
|
|||
m_Current = UnknownTimer;
|
||||
m_Timer = 0;
|
||||
m_NextTimer = 0;
|
||||
|
||||
SetTimer(ViTimer,50000,false);
|
||||
}
|
||||
|
||||
void CSystemTimer::SetTimer ( TimerType Type, DWORD Cycles, bool bRelative )
|
||||
|
@ -137,7 +138,7 @@ void CSystemTimer::TimerDone (void)
|
|||
break;
|
||||
case CSystemTimer::SoftResetTimer:
|
||||
_SystemTimer->StopTimer(CSystemTimer::SoftResetTimer);
|
||||
_N64System->SoftReset();
|
||||
_System->ExternalEvent(SysEvent_ResetCPU_SoftDone);
|
||||
break;
|
||||
case CSystemTimer::SiTimer:
|
||||
_SystemTimer->StopTimer(CSystemTimer::SiTimer);
|
||||
|
@ -154,7 +155,7 @@ void CSystemTimer::TimerDone (void)
|
|||
case CSystemTimer::ViTimer:
|
||||
try
|
||||
{
|
||||
_N64System->RefreshScreen();
|
||||
_System->RefreshScreen();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
|
|
@ -48,9 +48,6 @@ CN64System::CN64System ( CPlugins * Plugins, bool SavesReadOnly ) :
|
|||
{
|
||||
//InterpreterOpcode = NULL;
|
||||
m_hPauseEvent = CreateEvent(NULL,true,false,NULL);
|
||||
|
||||
//stop CPU and destroy current MMU
|
||||
Reset();
|
||||
|
||||
switch (_Rom->GetCountry())
|
||||
{
|
||||
|
@ -73,7 +70,6 @@ CN64System::~CN64System ( void ) {
|
|||
|
||||
void CN64System::ExternalEvent ( SystemEvent action )
|
||||
{
|
||||
|
||||
switch (action) {
|
||||
case SysEvent_Profile_GenerateLogs:
|
||||
case SysEvent_Profile_StartStop:
|
||||
|
@ -84,7 +80,7 @@ void CN64System::ExternalEvent ( SystemEvent action )
|
|||
case SysEvent_ChangePlugins:
|
||||
case SysEvent_ChangingFullScreen:
|
||||
case SysEvent_GSButtonPressed:
|
||||
case SysEvent_ResetCPU_Soft:
|
||||
case SysEvent_ResetCPU_SoftDone:
|
||||
case SysEvent_Interrupt_SP:
|
||||
case SysEvent_Interrupt_SI:
|
||||
case SysEvent_Interrupt_AI:
|
||||
|
@ -93,6 +89,13 @@ void CN64System::ExternalEvent ( SystemEvent action )
|
|||
case SysEvent_Interrupt_DP:
|
||||
QueueEvent(action);
|
||||
break;
|
||||
case SysEvent_ResetCPU_Soft:
|
||||
QueueEvent(action);
|
||||
if (m_SyncCPU)
|
||||
{
|
||||
m_SyncCPU->QueueEvent(action);
|
||||
}
|
||||
break;
|
||||
case SysEvent_PauseCPU_FromMenu:
|
||||
case SysEvent_PauseCPU_AppLostFocus:
|
||||
case SysEvent_PauseCPU_AppLostActive:
|
||||
|
@ -213,26 +216,26 @@ bool CN64System::EmulationStarting ( HANDLE hThread, DWORD ThreadId )
|
|||
{
|
||||
bool bRes = true;
|
||||
|
||||
if (_N64System)
|
||||
if (_BaseSystem)
|
||||
{
|
||||
WriteTrace(TraceDebug,"CN64System::stLoadFileImage: Destroying old N64 system");
|
||||
delete _N64System;
|
||||
_N64System = NULL;
|
||||
delete _BaseSystem;
|
||||
_BaseSystem = NULL;
|
||||
}
|
||||
WriteTrace(TraceDebug,"CN64System::stLoadFileImage: Creating N64 system");
|
||||
CN64System * System = new CN64System(_Plugins,false);
|
||||
_BaseSystem = new CN64System(_Plugins,false);
|
||||
WriteTrace(TraceDebug,"CN64System::stLoadFileImage: Setting N64 system as active");
|
||||
if (System->SetActiveSystem(true))
|
||||
if (_BaseSystem->SetActiveSystem(true))
|
||||
{
|
||||
System->m_CPU_Handle = hThread;
|
||||
System->m_CPU_ThreadID = ThreadId;
|
||||
_BaseSystem->m_CPU_Handle = hThread;
|
||||
_BaseSystem->m_CPU_ThreadID = ThreadId;
|
||||
WriteTrace(TraceDebug,"CN64System::stLoadFileImage: Setting up N64 system done");
|
||||
_Settings->SaveBool(GameRunning_LoadingInProgress,false);
|
||||
_Notify->RefreshMenu();
|
||||
try
|
||||
{
|
||||
WriteTrace(TraceDebug,"CN64System::stLoadFileImage: Game set to auto start, starting");
|
||||
System->StartEmulation2(false);
|
||||
_BaseSystem->StartEmulation2(false);
|
||||
WriteTrace(TraceDebug,"CN64System::stLoadFileImage: Game Done");
|
||||
}
|
||||
catch (...)
|
||||
|
@ -242,8 +245,8 @@ bool CN64System::EmulationStarting ( HANDLE hThread, DWORD ThreadId )
|
|||
sprintf(Message,"CN64System::LoadFileImage - Exception caught\nFile: %s\nLine: %d",__FILE__,__LINE__);
|
||||
MessageBox(NULL,Message,"Exception",MB_OK);
|
||||
}
|
||||
System->m_CPU_Handle = NULL;
|
||||
System->m_CPU_ThreadID = 0;
|
||||
_BaseSystem->m_CPU_Handle = NULL;
|
||||
_BaseSystem->m_CPU_ThreadID = 0;
|
||||
} else {
|
||||
WriteTrace(TraceError,"CN64System::stLoadFileImage: SetActiveSystem failed");
|
||||
_Notify->DisplayError("Failed to Initialize N64 System");
|
||||
|
@ -252,10 +255,10 @@ bool CN64System::EmulationStarting ( HANDLE hThread, DWORD ThreadId )
|
|||
bRes = false;
|
||||
}
|
||||
|
||||
if (System)
|
||||
if (_BaseSystem)
|
||||
{
|
||||
delete System;
|
||||
System = NULL;
|
||||
delete _BaseSystem;
|
||||
_BaseSystem = NULL;
|
||||
}
|
||||
return bRes;
|
||||
}
|
||||
|
@ -354,7 +357,6 @@ void CN64System::StartEmulation2 ( bool NewThread )
|
|||
_Notify->MakeWindowOnTop(_Settings->LoadBool(UserInterface_AlwaysOnTop));
|
||||
if (!_Settings->LoadBool(Beta_IsValidExe))
|
||||
{
|
||||
Reset();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -506,35 +508,12 @@ bool CN64System::IsDialogMsg( MSG * msg )
|
|||
return false;
|
||||
}
|
||||
|
||||
void CN64System::SoftReset()
|
||||
{
|
||||
if (GetRecompiler())
|
||||
{
|
||||
GetRecompiler()->ResetRecompCode();
|
||||
}
|
||||
//g_CPU_Action->DoSomething = TRUE;
|
||||
if (_Plugins) { _Plugins->GameReset(); }
|
||||
bool PostPif = true;
|
||||
|
||||
InitRegisters(PostPif,m_MMU_VM);
|
||||
if (PostPif)
|
||||
{
|
||||
memcpy((m_MMU_VM.Dmem()+0x40), (_Rom->GetRomAddress() + 0x040), 0xFBC);
|
||||
}
|
||||
m_SystemTimer.SetTimer(CSystemTimer::CompareTimer,m_Reg.COMPARE_REGISTER - m_Reg.COUNT_REGISTER,false);
|
||||
Debug_Reset();
|
||||
CloseSaveChips();
|
||||
m_CyclesToSkip = 0;
|
||||
m_AlistCount = 0;
|
||||
m_DlistCount = 0;
|
||||
m_UnknownCount = 0;
|
||||
|
||||
m_DMAUsed = false;
|
||||
//g_CPU_Action->InterruptExecuted = false;
|
||||
}
|
||||
|
||||
void CN64System::Reset (void)
|
||||
{
|
||||
if (m_Recomp)
|
||||
{
|
||||
m_Recomp->ResetRecompCode();
|
||||
}
|
||||
if (_Plugins) { _Plugins->GameReset(); }
|
||||
m_Audio.ResetAudioSettings();
|
||||
Debug_Reset();
|
||||
|
@ -545,6 +524,23 @@ void CN64System::Reset (void)
|
|||
m_DlistCount = 0;
|
||||
m_UnknownCount = 0;
|
||||
m_SystemType = SYSTEM_NTSC;
|
||||
m_DMAUsed = false;
|
||||
|
||||
m_Reg.Reset();
|
||||
m_SystemTimer.Reset();
|
||||
m_SystemTimer.SetTimer(CSystemTimer::CompareTimer,m_Reg.COMPARE_REGISTER - m_Reg.COUNT_REGISTER,false);
|
||||
}
|
||||
|
||||
void CN64System::SoftReset()
|
||||
{
|
||||
Reset();
|
||||
bool PostPif = true;
|
||||
|
||||
InitRegisters(PostPif,m_MMU_VM);
|
||||
if (PostPif)
|
||||
{
|
||||
memcpy((m_MMU_VM.Dmem()+0x40), (_Rom->GetRomAddress() + 0x040), 0xFBC);
|
||||
}
|
||||
}
|
||||
|
||||
bool CN64System::SetActiveSystem( bool bActive )
|
||||
|
@ -559,21 +555,14 @@ bool CN64System::SetActiveSystem( bool bActive )
|
|||
{
|
||||
return false;
|
||||
}
|
||||
bool PostPif = true;
|
||||
|
||||
InitRegisters(PostPif,m_MMU_VM);
|
||||
if (PostPif)
|
||||
{
|
||||
memcpy((m_MMU_VM.Dmem()+0x40), (_Rom->GetRomAddress() + 0x040), 0xFBC);
|
||||
}
|
||||
m_SystemTimer.SetTimer(CSystemTimer::CompareTimer,m_Reg.COMPARE_REGISTER - m_Reg.COUNT_REGISTER,false);
|
||||
SoftReset();
|
||||
m_bInitilized = true;
|
||||
bInitPlugin = true;
|
||||
}
|
||||
|
||||
m_Reg.SetAsCurrentSystem();
|
||||
|
||||
_N64System = this;
|
||||
_System = this;
|
||||
_SyncSystem = m_SyncCPU;
|
||||
_Recompiler = m_Recomp;
|
||||
_MMU = &m_MMU_VM;
|
||||
|
@ -587,9 +576,9 @@ bool CN64System::SetActiveSystem( bool bActive )
|
|||
_NextTimer = &m_NextTimer;
|
||||
_Plugins = m_Plugins;
|
||||
} else {
|
||||
if (_N64System == this)
|
||||
if (this == _BaseSystem)
|
||||
{
|
||||
_N64System = NULL;
|
||||
_System = NULL;
|
||||
_SyncSystem = NULL;
|
||||
_Recompiler = NULL;
|
||||
_MMU = NULL;
|
||||
|
@ -614,6 +603,8 @@ bool CN64System::SetActiveSystem( bool bActive )
|
|||
|
||||
void CN64System::InitRegisters( bool bPostPif, CMipsMemory & MMU )
|
||||
{
|
||||
m_Reg.Reset();
|
||||
|
||||
//COP0 Registers
|
||||
m_Reg.RANDOM_REGISTER = 0x1F;
|
||||
m_Reg.COUNT_REGISTER = 0x5000;
|
||||
|
@ -850,7 +841,6 @@ void CN64System::CpuStopped ( void ) {
|
|||
{
|
||||
_Plugins->ShutDownPlugins();
|
||||
}
|
||||
Reset();
|
||||
if (m_hPauseEvent)
|
||||
{
|
||||
CloseHandle(m_hPauseEvent);
|
||||
|
@ -1135,9 +1125,9 @@ bool CN64System::SaveState(void)
|
|||
//Open the file
|
||||
if (_Settings->LoadDword(Game_FuncLookupMode) == FuncFind_ChangeMemory)
|
||||
{
|
||||
if (GetRecompiler())
|
||||
if (m_Recomp)
|
||||
{
|
||||
GetRecompiler()->ResetRecompCode();
|
||||
m_Recomp->ResetRecompCode();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1332,15 +1322,11 @@ bool CN64System::LoadState(LPCSTR FileName) {
|
|||
MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2);
|
||||
if (result == IDNO) { return FALSE; }
|
||||
}
|
||||
m_Reg.Reset();
|
||||
|
||||
_MMU->UnProtectMemory(0x80000000,0x80000000 + _Settings->LoadDword(Game_RDRamSize) - 4);
|
||||
_MMU->UnProtectMemory(0xA4000000,0xA4001FFC);
|
||||
_Settings->SaveDword(Game_RDRamSize,SaveRDRAMSize);
|
||||
WriteTrace(TraceError,"Make sure memory is tracking changes to Game_RDRamSize");
|
||||
#ifdef tofix
|
||||
if (SaveRDRAMSize != _Settings->LoadDword(Game_RDRamSize)) {
|
||||
//_MMU->FixRDramSize();
|
||||
}
|
||||
#endif
|
||||
unzReadCurrentFile(file,&NextVITimer,sizeof(NextVITimer));
|
||||
unzReadCurrentFile(file,&m_Reg.m_PROGRAM_COUNTER,sizeof(m_Reg.m_PROGRAM_COUNTER));
|
||||
unzReadCurrentFile(file,m_Reg.m_GPR,sizeof(_int64)*32);
|
||||
|
@ -1388,6 +1374,7 @@ bool CN64System::LoadState(LPCSTR FileName) {
|
|||
MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2);
|
||||
if (result == IDNO) { return FALSE; }
|
||||
}
|
||||
m_Reg.Reset();
|
||||
_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
_MMU->UnProtectMemory(0x80000000,0x80000000 + _Settings->LoadDword(Game_RDRamSize) - 4);
|
||||
_MMU->UnProtectMemory(0xA4000000,0xA4001FFC);
|
||||
|
@ -1431,11 +1418,12 @@ bool CN64System::LoadState(LPCSTR FileName) {
|
|||
m_Reg.RANDOM_REGISTER += 32 - m_Reg.WIRED_REGISTER;
|
||||
}
|
||||
WriteTrace(TraceDebug,"CN64System::LoadState 1");
|
||||
if (GetRecompiler())
|
||||
if (m_Recomp)
|
||||
{
|
||||
GetRecompiler()->ResetRecompCode();
|
||||
m_Recomp->ResetRecompCode();
|
||||
}
|
||||
|
||||
SoftReset();
|
||||
//Fix up timer
|
||||
m_Reg.m_CP0[32] = 0;
|
||||
WriteTrace(TraceDebug,"CN64System::LoadState 2");
|
||||
|
|
|
@ -43,11 +43,7 @@ public:
|
|||
void SoftReset ( void );
|
||||
bool m_EndEmulation;
|
||||
|
||||
//Get the pointer to the Internal Classes
|
||||
CRecompiler * GetRecompiler ( void ) { return m_Recomp; }
|
||||
//CN64Rom * GetCurrentRom ( void ) { return _Rom; }
|
||||
|
||||
inline CPlugins * Plugins ( void ) const { return m_Plugins; }
|
||||
// inline CPlugins * Plugins ( void ) const { return m_Plugins; }
|
||||
inline bool DmaUsed ( void ) const { return m_DMAUsed; }
|
||||
inline void SetDmaUsed ( bool DMAUsed) { m_DMAUsed = DMAUsed; }
|
||||
|
||||
|
|
|
@ -88,7 +88,6 @@ CCodeSection::CCodeSection( CCodeBlock * CodeBlock, DWORD EnterPC, DWORD ID) :
|
|||
/*
|
||||
Test2 = 0;
|
||||
InLoop = false;
|
||||
DelaySlotSection = false;
|
||||
|
||||
*/
|
||||
if (&CodeBlock->EnterSection() == this)
|
||||
|
|
|
@ -1,77 +1,2 @@
|
|||
#include "stdafx.h"
|
||||
|
||||
CDelaySlotFunctionMap::CDelaySlotFunctionMap()
|
||||
{
|
||||
}
|
||||
|
||||
CDelaySlotFunctionMap::~CDelaySlotFunctionMap()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
CCompiledFunc * CDelaySlotFunctionMap::AddFunctionInfo ( DWORD vAddr, DWORD pAddr )
|
||||
{
|
||||
Notify().BreakPoint(__FILE__,__LINE__);
|
||||
#ifdef tofix
|
||||
if (FunctionMap.find(vAddr) != FunctionMap.end())
|
||||
{
|
||||
Notify().BreakPoint(__FILE__,__LINE__);
|
||||
}
|
||||
|
||||
CCompiledFunc * info = new CCompiledFunc(vAddr,pAddr);
|
||||
FunctionMap.insert(FUNCTION_MAP::value_type(vAddr,info));
|
||||
return info;
|
||||
|
||||
Notify().BreakPoint(__FILE__,__LINE__);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CCompiledFunc * CDelaySlotFunctionMap::FindFunction ( DWORD vAddr, int Length )
|
||||
{
|
||||
DWORD Start = ((vAddr + 0xFFF) >> 0xC);
|
||||
DWORD End = ((vAddr + Length) >> 0xC);
|
||||
for (DWORD i = Start; i < End; i++)
|
||||
{
|
||||
CCompiledFunc * info = FindFunction(i << 0xC);
|
||||
if (info)
|
||||
{
|
||||
return info;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CCompiledFunc * CDelaySlotFunctionMap::FindFunction ( DWORD vAddr ) const
|
||||
{
|
||||
FUNCTION_MAP::const_iterator iter = FunctionMap.find(vAddr);
|
||||
if (iter == FunctionMap.end())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return iter->second;
|
||||
}
|
||||
|
||||
|
||||
void CDelaySlotFunctionMap::Remove ( CCompiledFunc * info )
|
||||
{
|
||||
_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
#ifdef tofix
|
||||
FUNCTION_MAP::iterator iter = FunctionMap.find(info->VAddrEnter());
|
||||
if (iter != FunctionMap.end())
|
||||
{
|
||||
delete iter->second;
|
||||
FunctionMap.erase(iter);
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void CDelaySlotFunctionMap::Reset ( void )
|
||||
{
|
||||
for (FUNCTION_MAP::iterator iter = FunctionMap.begin(); iter != FunctionMap.end(); iter++)
|
||||
{
|
||||
delete iter->second;
|
||||
}
|
||||
FunctionMap.clear();
|
||||
}
|
||||
|
|
|
@ -8,23 +8,7 @@ CFunctionMap::CFunctionMap() :
|
|||
|
||||
CFunctionMap::~CFunctionMap()
|
||||
{
|
||||
if (m_FunctionTable)
|
||||
{
|
||||
for (int i = 0, n = 0x100000; i < n; i++)
|
||||
{
|
||||
if (m_FunctionTable[i] != NULL)
|
||||
{
|
||||
delete m_FunctionTable[i];
|
||||
}
|
||||
}
|
||||
VirtualFree( m_FunctionTable, 0 , MEM_RELEASE);
|
||||
m_FunctionTable = NULL;
|
||||
}
|
||||
if (m_DelaySlotTable)
|
||||
{
|
||||
VirtualFree( m_DelaySlotTable, 0 , MEM_RELEASE);
|
||||
m_DelaySlotTable = NULL;
|
||||
}
|
||||
CleanBuffers();
|
||||
}
|
||||
|
||||
bool CFunctionMap::AllocateMemory()
|
||||
|
@ -50,6 +34,37 @@ bool CFunctionMap::AllocateMemory()
|
|||
return true;
|
||||
}
|
||||
|
||||
void CFunctionMap::CleanBuffers ( void )
|
||||
{
|
||||
if (m_FunctionTable)
|
||||
{
|
||||
for (int i = 0, n = 0x100000; i < n; i++)
|
||||
{
|
||||
if (m_FunctionTable[i] != NULL)
|
||||
{
|
||||
delete m_FunctionTable[i];
|
||||
}
|
||||
}
|
||||
VirtualFree( m_FunctionTable, 0 , MEM_RELEASE);
|
||||
m_FunctionTable = NULL;
|
||||
}
|
||||
if (m_DelaySlotTable)
|
||||
{
|
||||
VirtualFree( m_DelaySlotTable, 0 , MEM_RELEASE);
|
||||
m_DelaySlotTable = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void CFunctionMap::Reset ( void )
|
||||
{
|
||||
bool bAllocate = m_FunctionTable != NULL;
|
||||
CleanBuffers();
|
||||
if (bAllocate)
|
||||
{
|
||||
AllocateMemory();
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
|
||||
CFunctionMap::~CFunctionMap()
|
||||
|
|
|
@ -8,6 +8,13 @@ protected:
|
|||
~CFunctionMap();
|
||||
|
||||
bool AllocateMemory ( void );
|
||||
void Reset ( void );
|
||||
|
||||
inline PCCompiledFunc_TABLE * FunctionTable ( void ) const { return m_FunctionTable; }
|
||||
inline BYTE ** DelaySlotTable ( void ) const { return m_DelaySlotTable; }
|
||||
|
||||
private:
|
||||
void CleanBuffers ( void );
|
||||
|
||||
PCCompiledFunc_TABLE * m_FunctionTable;
|
||||
BYTE ** m_DelaySlotTable;
|
||||
|
|
|
@ -3,10 +3,8 @@
|
|||
CRecompiler::CRecompiler(CProfiling & Profile, bool & EndEmulation ) :
|
||||
m_Profile(Profile),
|
||||
PROGRAM_COUNTER(_Reg->m_PROGRAM_COUNTER),
|
||||
m_EndEmulation(EndEmulation),
|
||||
m_FunctionsDelaySlot()
|
||||
m_EndEmulation(EndEmulation)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CRecompiler::~CRecompiler()
|
||||
|
@ -30,18 +28,6 @@ void CRecompiler::Run()
|
|||
WriteTrace(TraceError,"CRecompiler::Run: CRecompMemory::AllocateMemory failed");
|
||||
return;
|
||||
}
|
||||
|
||||
WriteTrace(TraceError,"CRecompiler::Run Fix _MMU->AllocateRecompilerMemory");
|
||||
#ifdef tofix
|
||||
if (!_MMU->AllocateRecompilerMemory(LookUpMode() != FuncFind_VirtualLookup && LookUpMode() != FuncFind_ChangeMemory))
|
||||
{
|
||||
return;
|
||||
}
|
||||
JumpTable = _MMU->GetJumpTable();
|
||||
RecompCode = _MMU->GetRecompCode();
|
||||
#endif
|
||||
|
||||
ResetRecompCode();
|
||||
m_EndEmulation = false;
|
||||
|
||||
WriteTrace(TraceError,"CRecompiler::Run Fix g_MemoryStack");
|
||||
|
@ -82,7 +68,7 @@ void CRecompiler::RecompilerMain_VirtualTable ( void )
|
|||
{
|
||||
while(!m_EndEmulation)
|
||||
{
|
||||
PCCompiledFunc_TABLE & table = m_FunctionTable[PROGRAM_COUNTER >> 0xC];
|
||||
PCCompiledFunc_TABLE & table = FunctionTable()[PROGRAM_COUNTER >> 0xC];
|
||||
DWORD TableEntry = (PROGRAM_COUNTER & 0xFFF) >> 2;
|
||||
if (table)
|
||||
{
|
||||
|
@ -461,77 +447,14 @@ void CRecompiler::RecompilerMain_Lookup( void )
|
|||
|
||||
void CRecompiler::ResetRecompCode()
|
||||
{
|
||||
/*
|
||||
RecompPos() = RecompCode;
|
||||
|
||||
m_Functions.Reset();
|
||||
m_FunctionsDelaySlot.Reset();
|
||||
if (JumpTable)
|
||||
{
|
||||
memset(JumpTable,0,_MMU->RdramSize());
|
||||
memset(JumpTable + (0x04000000 >> 2),0,0x1000);
|
||||
memset(JumpTable + (0x04001000 >> 2),0,0x1000);
|
||||
if (bRomInMemory())
|
||||
{
|
||||
memset(JumpTable + (0x10000000 >> 2),0,RomFileSize);
|
||||
}
|
||||
}
|
||||
#ifdef to_clean
|
||||
DWORD count, OldProtect;
|
||||
if (SelfModCheck == ModCode_ChangeMemory) {
|
||||
DWORD count, PAddr, Value;
|
||||
|
||||
for (count = 0; count < TargetIndex; count++) {
|
||||
PAddr = OrigMem[(WORD)(count)].PAddr;
|
||||
Value = *(DWORD *)(RDRAM + PAddr);
|
||||
if ( ((Value >> 16) == 0x7C7C) && ((Value & 0xFFFF) == count)) {
|
||||
*(DWORD *)(RDRAM + PAddr) = OrigMem[(WORD)(count)].OriginalValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
TargetIndex = 0;
|
||||
|
||||
//Jump Table
|
||||
for (count = 0; count < (RdramSize >> 12); count ++ ) {
|
||||
if (N64_Blocks.NoOfRDRamBlocks[count] > 0) {
|
||||
N64_Blocks.NoOfRDRamBlocks[count] = 0;
|
||||
memset(JumpTable + (count << 10),0,0x1000);
|
||||
*(DelaySlotTable + count) = NULL;
|
||||
|
||||
if (VirtualProtect((RDRAM + (count << 12)), 4, PAGE_READWRITE, &OldProtect) == 0) {
|
||||
DisplayError("Failed to unprotect %X\n1", (count << 12));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (N64_Blocks.NoOfDMEMBlocks > 0) {
|
||||
N64_Blocks.NoOfDMEMBlocks = 0;
|
||||
memset(JumpTable + (0x04000000 >> 2),0,0x1000);
|
||||
*(DelaySlotTable + (0x04000000 >> 12)) = NULL;
|
||||
if (VirtualProtect((RDRAM + 0x04000000), 4, PAGE_READWRITE, &OldProtect) == 0) {
|
||||
DisplayError("Failed to unprotect %X\n0", 0x04000000);
|
||||
}
|
||||
}
|
||||
if (N64_Blocks.NoOfIMEMBlocks > 0) {
|
||||
N64_Blocks.NoOfIMEMBlocks = 0;
|
||||
memset(JumpTable + (0x04001000 >> 2),0,0x1000);
|
||||
*(DelaySlotTable + (0x04001000 >> 12)) = NULL;
|
||||
if (VirtualProtect((RDRAM + 0x04001000), 4, PAGE_READWRITE, &OldProtect) == 0) {
|
||||
DisplayError("Failed to unprotect %X\n4", 0x04001000);
|
||||
}
|
||||
}
|
||||
// if (N64_Blocks.NoOfPifRomBlocks > 0) {
|
||||
// N64_Blocks.NoOfPifRomBlocks = 0;
|
||||
// memset(JumpTable + (0x1FC00000 >> 2),0,0x1000);
|
||||
// }
|
||||
#endif
|
||||
*/
|
||||
CRecompMemory::Reset();
|
||||
CFunctionMap::Reset();
|
||||
}
|
||||
|
||||
BYTE * CRecompiler::CompileDelaySlot(DWORD PC)
|
||||
{
|
||||
int Index = PC >> 0xC;
|
||||
BYTE * delayFunc = m_DelaySlotTable[Index];
|
||||
BYTE * delayFunc = DelaySlotTable()[Index];
|
||||
if (delayFunc)
|
||||
{
|
||||
return delayFunc;
|
||||
|
@ -553,7 +476,8 @@ BYTE * CRecompiler::CompileDelaySlot(DWORD PC)
|
|||
|
||||
CCompiledFunc * Func = new CCompiledFunc(CodeBlock);
|
||||
delayFunc = (BYTE *)Func->Function();
|
||||
m_DelaySlotTable[Index] = delayFunc;
|
||||
DelaySlotTable()[Index] = delayFunc;
|
||||
delete Func;
|
||||
return delayFunc;
|
||||
}
|
||||
|
||||
|
@ -1889,12 +1813,19 @@ void CRecompiler::ClearRecompCode_Virt(DWORD Address, int length,REMOVE_REASON R
|
|||
case FuncFind_VirtualLookup:
|
||||
{
|
||||
DWORD AddressIndex = Address >> 0xC;
|
||||
BYTE ** DelaySlotFuncs = DelaySlotTable();
|
||||
|
||||
if ((Address & 0xFFC) == 0 && DelaySlotFuncs[AddressIndex] != NULL)
|
||||
{
|
||||
DelaySlotFuncs[AddressIndex] = NULL;
|
||||
}
|
||||
|
||||
DWORD WriteStart = (Address & 0xFFC);
|
||||
DWORD DataInBlock = 0x1000 - WriteStart;
|
||||
int DataToWrite = length < DataInBlock ? length : DataInBlock;
|
||||
int DataLeft = length - DataToWrite;
|
||||
|
||||
PCCompiledFunc_TABLE & table = m_FunctionTable[AddressIndex];
|
||||
PCCompiledFunc_TABLE & table = FunctionTable()[AddressIndex];
|
||||
if (table)
|
||||
{
|
||||
memset(((BYTE *)table) + WriteStart,0,DataToWrite);
|
||||
|
|
|
@ -38,10 +38,6 @@ private:
|
|||
|
||||
//Quick access to registers
|
||||
DWORD & PROGRAM_COUNTER;
|
||||
|
||||
//Functions
|
||||
CDelaySlotFunctionMap m_FunctionsDelaySlot;
|
||||
//CFunctionMap m_Functions;
|
||||
|
||||
CCompiledFunc * CompilerCode ( void );
|
||||
bool Compiler4300iBlock ( CCompiledFunc * info );
|
||||
|
@ -54,7 +50,6 @@ private:
|
|||
bool FixConstants ( CCodeSection * Section, DWORD Test );
|
||||
bool InheritParentInfo ( CCodeSection * Section );
|
||||
void InheritConstants ( CCodeSection * Section );
|
||||
// bool IsAllParentLoops ( CCodeSection * Section, CCodeSection * Parent, bool IgnoreIfCompiled, DWORD Test );
|
||||
bool FillSectionInfo ( CCodeSection * Section, STEP_TYPE StartStepType );
|
||||
void SyncRegState ( CCodeSection * Section, CRegInfo * SyncTo );
|
||||
CCodeSection * ExistingSection( CCodeSection * StartSection, DWORD Addr, DWORD Test);
|
||||
|
|
|
@ -35,6 +35,7 @@ bool CRecompMemory::AllocateMemory()
|
|||
}
|
||||
m_RecompSize = InitialCompileBufferSize;
|
||||
m_RecompPos = m_RecompCode;
|
||||
memset(m_RecompCode,0,InitialCompileBufferSize);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -57,3 +58,8 @@ void CRecompMemory::CheckRecompMem ( void )
|
|||
_Notify->FatalError(MSG_MEM_ALLOC_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
void CRecompMemory::Reset()
|
||||
{
|
||||
m_RecompPos = m_RecompCode;
|
||||
}
|
|
@ -7,6 +7,7 @@ protected:
|
|||
|
||||
bool AllocateMemory ( void );
|
||||
void CheckRecompMem ( void );
|
||||
void Reset ( void );
|
||||
|
||||
inline BYTE * RecompPos ( void ) const { return m_RecompPos; }
|
||||
|
||||
|
|
|
@ -151,12 +151,8 @@ void CRecompilerOps::Compile_Branch (CRecompilerOps::BranchFunction CompareFunc,
|
|||
}
|
||||
if (FallInfo->TargetPC <= m_CompilePC)
|
||||
{
|
||||
_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
#ifdef tofix
|
||||
UpdateCounters(&(FallInfo->RegSet.BlockCycleCount()),&(FallInfo->RegSet.BlockRandomModifier()),true);
|
||||
m_Section->CompileSystemCheck(FallInfo->TargetPC,FallInfo->RegSet);
|
||||
UpdateCounters(m_RegWorkingSet,true,true);
|
||||
ResetX86Protection();
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
if (m_Section->m_ContinueSection != NULL) {
|
||||
|
@ -1427,7 +1423,7 @@ void CRecompilerOps::CACHE (void){
|
|||
AddConstToX86Reg(x86_EAX,(short)m_Opcode.offset);
|
||||
Push(x86_EAX);
|
||||
}
|
||||
MoveConstToX86reg((DWORD)_N64System->GetRecompiler(),x86_ECX);
|
||||
MoveConstToX86reg((DWORD)_Recompiler,x86_ECX);
|
||||
Call_Direct(AddressOf(CRecompiler::ClearRecompCode_Virt), "CRecompiler::ClearRecompCode_Virt");
|
||||
AfterCallDirect();
|
||||
break;
|
||||
|
@ -1748,21 +1744,13 @@ void CRecompilerOps::SPECIAL_JR (void) {
|
|||
}
|
||||
}
|
||||
if ((m_CompilePC & 0xFFC) == 0xFFC) {
|
||||
_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
#ifdef tofix
|
||||
if (IsMapped(m_Opcode.rs)) {
|
||||
MoveX86regToVariable(cMipsRegLo(m_Opcode.rs),&JumpToLocation, "JumpToLocation");
|
||||
if (IsMapped(m_Opcode.rs)) {
|
||||
Push(cMipsRegMapLo(m_Opcode.rs));
|
||||
} else {
|
||||
MoveX86regToVariable(Map_TempReg(x86_Any,m_Opcode.rs,FALSE),&JumpToLocation, "JumpToLocation");
|
||||
Push(Map_TempReg(x86_Any,m_Opcode.rs,FALSE));
|
||||
}
|
||||
MoveConstToVariable(m_CompilePC + 4,_PROGRAM_COUNTER,"PROGRAM_COUNTER");
|
||||
UpdateCounters(&m_RegWorkingSet.BlockCycleCount(),&m_RegWorkingSet.BlockRandomModifier(),FALSE);
|
||||
m_RegWorkingSet.WriteBackRegisters();
|
||||
if (CPU_Type == CPU_SyncCores) { Call_Direct(SyncToPC, "SyncToPC"); }
|
||||
MoveConstToVariable(DELAY_SLOT,&m_NextInstruction,"m_NextInstruction");
|
||||
Ret();
|
||||
m_Section->GenerateSectionLinkage();
|
||||
m_NextInstruction = END_BLOCK;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
if (DelaySlotEffectsCompare(m_CompilePC,m_Opcode.rs,0)) {
|
||||
|
@ -1979,8 +1967,6 @@ void CRecompilerOps::SPECIAL_DSLLV (void) {
|
|||
}
|
||||
|
||||
void CRecompilerOps::SPECIAL_DSRLV (void) {
|
||||
_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
#ifdef tofix
|
||||
BYTE * Jump[2];
|
||||
|
||||
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
|
||||
|
@ -2004,34 +1990,33 @@ void CRecompilerOps::SPECIAL_DSRLV (void) {
|
|||
//if (Shift < 0x20) {
|
||||
//} else {
|
||||
//}
|
||||
//CRecompilerOps::UnknownOpcode();
|
||||
//return;
|
||||
}
|
||||
Map_TempReg(x86_ECX,m_Opcode.rs,FALSE);
|
||||
AndConstToX86Reg(x86_ECX,0x3F);
|
||||
Map_GPR_64bit(m_Opcode.rd,m_Opcode.rt);
|
||||
CompConstToX86reg(x86_ECX,0x20);
|
||||
JaeLabel8("MORE32", 0);
|
||||
Jump[0] = m_RecompPos - 1;
|
||||
ShiftRightDouble(cMipsRegLo(m_Opcode.rd),MipsRegHi(m_Opcode.rd));
|
||||
ShiftRightUnsign(MipsRegHi(m_Opcode.rd));
|
||||
JmpLabel8("continue", 0);
|
||||
Jump[1] = m_RecompPos - 1;
|
||||
|
||||
//MORE32:
|
||||
CPU_Message("");
|
||||
CPU_Message(" MORE32:");
|
||||
*((BYTE *)(Jump[0]))=(BYTE)(m_RecompPos - Jump[0] - 1);
|
||||
MoveX86RegToX86Reg(MipsRegHi(m_Opcode.rd),cMipsRegLo(m_Opcode.rd));
|
||||
XorX86RegToX86Reg(MipsRegHi(m_Opcode.rd),MipsRegHi(m_Opcode.rd));
|
||||
AndConstToX86Reg(x86_ECX,0x1F);
|
||||
ShiftRightUnsign(cMipsRegLo(m_Opcode.rd));
|
||||
CRecompilerOps::UnknownOpcode();
|
||||
} else {
|
||||
Map_TempReg(x86_ECX,m_Opcode.rs,FALSE);
|
||||
AndConstToX86Reg(x86_ECX,0x3F);
|
||||
Map_GPR_64bit(m_Opcode.rd,m_Opcode.rt);
|
||||
CompConstToX86reg(x86_ECX,0x20);
|
||||
JaeLabel8("MORE32", 0);
|
||||
Jump[0] = m_RecompPos - 1;
|
||||
ShiftRightDouble(cMipsRegMapLo(m_Opcode.rd),cMipsRegMapHi(m_Opcode.rd));
|
||||
ShiftRightUnsign(cMipsRegMapHi(m_Opcode.rd));
|
||||
JmpLabel8("continue", 0);
|
||||
Jump[1] = m_RecompPos - 1;
|
||||
|
||||
//MORE32:
|
||||
CPU_Message("");
|
||||
CPU_Message(" MORE32:");
|
||||
*((BYTE *)(Jump[0]))=(BYTE)(m_RecompPos - Jump[0] - 1);
|
||||
MoveX86RegToX86Reg(cMipsRegMapHi(m_Opcode.rd),cMipsRegMapLo(m_Opcode.rd));
|
||||
XorX86RegToX86Reg(cMipsRegMapHi(m_Opcode.rd),cMipsRegMapHi(m_Opcode.rd));
|
||||
AndConstToX86Reg(x86_ECX,0x1F);
|
||||
ShiftRightUnsign(cMipsRegMapLo(m_Opcode.rd));
|
||||
|
||||
//continue:
|
||||
CPU_Message("");
|
||||
CPU_Message(" continue:");
|
||||
*((BYTE *)(Jump[1]))=(BYTE)(m_RecompPos - Jump[1] - 1);
|
||||
#endif
|
||||
//continue:
|
||||
CPU_Message("");
|
||||
CPU_Message(" continue:");
|
||||
*((BYTE *)(Jump[1]))=(BYTE)(m_RecompPos - Jump[1] - 1);
|
||||
}
|
||||
}
|
||||
|
||||
void CRecompilerOps::SPECIAL_DSRAV (void) {
|
||||
|
@ -2075,13 +2060,11 @@ void CRecompilerOps::SPECIAL_DSRAV (void) {
|
|||
}
|
||||
|
||||
void CRecompilerOps::SPECIAL_MULT ( void) {
|
||||
_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
#ifdef tofix
|
||||
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
|
||||
|
||||
cX86Protected(x86_EDX) = TRUE;
|
||||
X86Protected(x86_EDX) = TRUE;
|
||||
Map_TempReg(x86_EAX,m_Opcode.rs,FALSE);
|
||||
cX86Protected(x86_EDX) = FALSE;
|
||||
X86Protected(x86_EDX) = FALSE;
|
||||
Map_TempReg(x86_EDX,m_Opcode.rt,FALSE);
|
||||
|
||||
imulX86reg(x86_EDX);
|
||||
|
@ -2092,7 +2075,6 @@ void CRecompilerOps::SPECIAL_MULT ( void) {
|
|||
ShiftRightSignImmed(x86_EDX,31);
|
||||
MoveX86regToVariable(x86_EAX,&_RegLO->UW[1],"_RegLO->UW[1]");
|
||||
MoveX86regToVariable(x86_EDX,&_RegHI->UW[1],"_RegHI->UW[1]");
|
||||
#endif
|
||||
}
|
||||
|
||||
void CRecompilerOps::SPECIAL_MULTU (void) {
|
||||
|
@ -3867,9 +3849,8 @@ void CRecompilerOps::COP1_MF (void) {
|
|||
}
|
||||
|
||||
void CRecompilerOps::COP1_DMF (void) {
|
||||
_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
#ifdef tofix
|
||||
x86Reg TempReg;
|
||||
char Name[50];
|
||||
|
||||
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
|
||||
m_Section->CompileCop1Test();
|
||||
|
@ -3880,11 +3861,10 @@ void CRecompilerOps::COP1_DMF (void) {
|
|||
sprintf(Name,"_FPR_D[%d]",m_Opcode.fs);
|
||||
MoveVariableToX86reg((BYTE *)&_FPR_D[m_Opcode.fs],Name,TempReg);
|
||||
AddConstToX86Reg(TempReg,4);
|
||||
MoveX86PointerToX86reg(MipsRegHi(m_Opcode.rt),TempReg);
|
||||
MoveX86PointerToX86reg(cMipsRegMapHi(m_Opcode.rt),TempReg);
|
||||
sprintf(Name,"_FPR_D[%d]",m_Opcode.fs);
|
||||
MoveVariableToX86reg((BYTE *)&_FPR_D[m_Opcode.fs],Name,TempReg);
|
||||
MoveX86PointerToX86reg(cMipsRegLo(m_Opcode.rt),TempReg);
|
||||
#endif
|
||||
MoveX86PointerToX86reg(cMipsRegMapLo(m_Opcode.rt),TempReg);
|
||||
}
|
||||
|
||||
void CRecompilerOps::COP1_CF(void) {
|
||||
|
@ -3924,8 +3904,6 @@ void CRecompilerOps::COP1_MT( void) {
|
|||
}
|
||||
|
||||
void CRecompilerOps::COP1_DMT( void) {
|
||||
_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
#ifdef tofix
|
||||
x86Reg TempReg;
|
||||
|
||||
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
|
||||
|
@ -3938,22 +3916,23 @@ void CRecompilerOps::COP1_DMT( void) {
|
|||
}
|
||||
UnMap_FPR(m_Opcode.fs,TRUE);
|
||||
TempReg = Map_TempReg(x86_Any,-1,FALSE);
|
||||
char Name[50];
|
||||
sprintf(Name,"_FPR_D[%d]",m_Opcode.fs);
|
||||
MoveVariableToX86reg((BYTE *)&_FPR_D[m_Opcode.fs],Name,TempReg);
|
||||
|
||||
if (IsConst(m_Opcode.rt)) {
|
||||
MoveConstToX86Pointer(cMipsRegLo(m_Opcode.rt),TempReg);
|
||||
AddConstToX86Reg(TempReg,4);
|
||||
if (Section->Is64Bit(m_Opcode.rt)) {
|
||||
if (Is64Bit(m_Opcode.rt)) {
|
||||
MoveConstToX86Pointer(MipsRegHi(m_Opcode.rt),TempReg);
|
||||
} else {
|
||||
MoveConstToX86Pointer(Section->MipsRegLo_S(m_Opcode.rt) >> 31,TempReg);
|
||||
MoveConstToX86Pointer(MipsRegLo_S(m_Opcode.rt) >> 31,TempReg);
|
||||
}
|
||||
} else if (IsMapped(m_Opcode.rt)) {
|
||||
MoveX86regToX86Pointer(cMipsRegMapLo(m_Opcode.rt),TempReg);
|
||||
AddConstToX86Reg(TempReg,4);
|
||||
if (Section->Is64Bit(m_Opcode.rt)) {
|
||||
MoveX86regToX86Pointer(MipsRegHi(m_Opcode.rt),TempReg);
|
||||
if (Is64Bit(m_Opcode.rt)) {
|
||||
MoveX86regToX86Pointer(cMipsRegMapHi(m_Opcode.rt),TempReg);
|
||||
} else {
|
||||
MoveX86regToX86Pointer(Map_TempReg(x86_Any, m_Opcode.rt, TRUE),TempReg);
|
||||
}
|
||||
|
@ -3963,7 +3942,6 @@ void CRecompilerOps::COP1_DMT( void) {
|
|||
AddConstToX86Reg(TempReg,4);
|
||||
MoveX86regToX86Pointer(Map_TempReg(Reg, m_Opcode.rt, TRUE),TempReg);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -4149,8 +4127,6 @@ void CRecompilerOps::COP1_S_MOV (void) {
|
|||
}
|
||||
|
||||
void CRecompilerOps::COP1_S_TRUNC_L (void) {
|
||||
_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
#ifdef tofix
|
||||
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
|
||||
|
||||
m_Section->CompileCop1Test();
|
||||
|
@ -4158,7 +4134,6 @@ void CRecompilerOps::COP1_S_TRUNC_L (void) {
|
|||
Load_FPR_ToTop(m_Opcode.fd,m_Opcode.fs,CRegInfo::FPU_Float);
|
||||
}
|
||||
ChangeFPURegFormat(m_Opcode.fd,CRegInfo::FPU_Float,CRegInfo::FPU_Qword,CRegInfo::RoundTruncate);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CRecompilerOps::COP1_S_CEIL_L (void) { //added by Witten
|
||||
|
@ -4447,12 +4422,9 @@ void CRecompilerOps::COP1_D_ABS (void) {
|
|||
}
|
||||
|
||||
void CRecompilerOps::COP1_D_NEG (void) {
|
||||
_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
#ifdef tofix
|
||||
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
|
||||
Load_FPR_ToTop(m_Opcode.fd,m_Opcode.fs,CRegInfo::FPU_Double);
|
||||
fpuNeg();
|
||||
#endif
|
||||
}
|
||||
|
||||
void CRecompilerOps::COP1_D_SQRT (void) {
|
||||
|
@ -4700,8 +4672,6 @@ void CRecompilerOps::COP1_W_CVT_D (void) {
|
|||
|
||||
/************************** COP1: L functions ************************/
|
||||
void CRecompilerOps::COP1_L_CVT_S (void) {
|
||||
_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
#ifdef tofix
|
||||
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
|
||||
|
||||
m_Section->CompileCop1Test();
|
||||
|
@ -4709,7 +4679,6 @@ void CRecompilerOps::COP1_L_CVT_S (void) {
|
|||
Load_FPR_ToTop(m_Opcode.fd,m_Opcode.fs,CRegInfo::FPU_Qword);
|
||||
}
|
||||
ChangeFPURegFormat(m_Opcode.fd,CRegInfo::FPU_Qword,CRegInfo::FPU_Float,CRegInfo::RoundDefault);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CRecompilerOps::COP1_L_CVT_D (void) {
|
||||
|
@ -4783,7 +4752,7 @@ void CRecompilerOps::UpdateCounters ( CRegInfo & RegSet, bool CheckTimer, bool C
|
|||
BeforeCallDirect();
|
||||
PushImm32(stdstr_f("%d",RegSet.GetBlockCycleCount()).c_str(),RegSet.GetBlockCycleCount());
|
||||
PushImm32("_SyncSystem",(DWORD)_SyncSystem);
|
||||
MoveConstToX86reg((DWORD)_N64System,x86_ECX);
|
||||
MoveConstToX86reg((DWORD)_System,x86_ECX);
|
||||
Call_Direct(AddressOf(CN64System::UpdateSyncCPU),"CN64System::UpdateSyncCPU");
|
||||
AfterCallDirect();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "stdafx.h"
|
||||
|
||||
CN64System * _N64System = NULL;
|
||||
CN64System * _System = NULL;
|
||||
CN64System * _BaseSystem = NULL;
|
||||
CN64System * _SyncSystem = NULL;
|
||||
CRecompiler * _Recompiler = NULL;
|
||||
CMipsMemory * _MMU = NULL; //Memory of the n64
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
extern CNotification * _Notify;
|
||||
extern CSettings * _Settings;
|
||||
|
||||
extern CN64System * _N64System;
|
||||
extern CN64System * _System;
|
||||
extern CN64System * _BaseSystem;
|
||||
extern CN64System * _SyncSystem;
|
||||
extern CRecompiler * _Recompiler;
|
||||
extern CMipsMemory * _MMU; //Memory of the n64
|
||||
|
|
|
@ -43,7 +43,7 @@ void CPlugins::PluginChanged ( CPlugins * _this )
|
|||
{
|
||||
if (_Settings->LoadBool(GameRunning_CPU_Running) != 0)
|
||||
{
|
||||
if (_N64System) { _N64System->ExternalEvent(SysEvent_ChangePlugins); }
|
||||
if (_BaseSystem) { _BaseSystem->ExternalEvent(SysEvent_ChangePlugins); }
|
||||
} else {
|
||||
_this->Reset();
|
||||
_Notify->RefreshMenu();
|
||||
|
@ -160,14 +160,14 @@ bool CPlugins::InitiateMainThread( void )
|
|||
WriteTrace(TraceDebug,"CPlugins::Initiate 6");
|
||||
|
||||
WriteTrace(TraceGfxPlugin,"Initiate: Starting");
|
||||
if (!m_Gfx->Initiate(_N64System,_RenderWindow)) { return false; }
|
||||
if (!m_Gfx->Initiate(_System,_RenderWindow)) { return false; }
|
||||
WriteTrace(TraceGfxPlugin,"Initiate: Done");
|
||||
WriteTrace(TraceDebug,"CPlugins::Initiate 7");
|
||||
if (!m_Audio->Initiate(_N64System,_RenderWindow)) { return false; }
|
||||
if (!m_Audio->Initiate(_System,_RenderWindow)) { return false; }
|
||||
WriteTrace(TraceDebug,"CPlugins::Initiate 8");
|
||||
if (!m_Control->Initiate(_N64System,_RenderWindow)) { return false; }
|
||||
if (!m_Control->Initiate(_System,_RenderWindow)) { return false; }
|
||||
WriteTrace(TraceRSP ,"Initiate: Starting");
|
||||
if (!m_RSP->Initiate(this,_N64System)) { return false; }
|
||||
if (!m_RSP->Initiate(this,_System)) { return false; }
|
||||
WriteTrace(TraceRSP,"Initiate: Done");
|
||||
WriteTrace(TraceDebug,"CPlugins::Initiate 10");
|
||||
|
||||
|
|
|
@ -586,6 +586,8 @@ SOURCE="3rd Party\zlib\UNZIP.C"
|
|||
|
||||
!IF "$(CFG)" == "Project64 - Win32 Release"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "Project64 - Win32 Debug"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
@ -601,6 +603,8 @@ SOURCE="3rd Party\zlib\zip.c"
|
|||
|
||||
!IF "$(CFG)" == "Project64 - Win32 Release"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "Project64 - Win32 Debug"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
@ -617,6 +621,8 @@ SOURCE="3rd Party\7zip.cpp"
|
|||
|
||||
!IF "$(CFG)" == "Project64 - Win32 Release"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "Project64 - Win32 Debug"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
@ -632,6 +638,8 @@ SOURCE="3rd Party\Processor Info.cpp"
|
|||
|
||||
!IF "$(CFG)" == "Project64 - Win32 Release"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "Project64 - Win32 Debug"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
|
|
@ -430,23 +430,6 @@ void CSettings::RegisterSetting ( CSettings * _this, SettingID ID, SettingID Def
|
|||
}
|
||||
}
|
||||
|
||||
/*#include <windows.h>
|
||||
|
||||
*/
|
||||
|
||||
/*CSettings::CSettings() :
|
||||
RomIniFile(NULL),
|
||||
CheatIniFile(NULL),
|
||||
SettingsIniFile(NULL),
|
||||
UnknownSetting_RSP(NULL),
|
||||
UnknownSetting_GFX(NULL),
|
||||
UnknownSetting_AUDIO(NULL),
|
||||
UnknownSetting_CTRL(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
bool CSettings::Initilize( const char * AppName )
|
||||
{
|
||||
AddHowToHandleSetting();
|
||||
|
@ -964,709 +947,6 @@ void CSettings::UnknownSetting (SettingID Type)
|
|||
#endif
|
||||
}
|
||||
|
||||
/*CSettings::~CSettings() {
|
||||
if (RomIniFile) {
|
||||
delete RomIniFile;
|
||||
RomIniFile = NULL;
|
||||
}
|
||||
if (CheatIniFile) {
|
||||
delete CheatIniFile;
|
||||
CheatIniFile = NULL;
|
||||
}
|
||||
if (SettingsIniFile)
|
||||
{
|
||||
delete SettingsIniFile;
|
||||
SettingsIniFile = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void CSettings::Load(SettingID Type, char * Buffer, int BufferSize) {
|
||||
if (Type != IsValidExe)
|
||||
{
|
||||
WriteTraceF(TraceSettings,"CSettings::Load 1 - %d",Type);
|
||||
}
|
||||
|
||||
//Find out the information for handling the setting type from the list
|
||||
SETTING_MAP::iterator FindInfo = SettingInfo.find(Type);
|
||||
if (FindInfo == SettingInfo.end())
|
||||
{ //if not found do nothing
|
||||
UnknownSetting(Type);
|
||||
return;
|
||||
}
|
||||
CSettingInfo * Info = &FindInfo->second;
|
||||
|
||||
if (Info->DefaultValue != Default_None) {
|
||||
Load(Info->DefaultValue,Buffer, BufferSize);
|
||||
}
|
||||
//Copy Default String
|
||||
|
||||
if (Info->Location == ConstString) {
|
||||
strncpy(Buffer,Info->Name.c_str(),BufferSize);
|
||||
} else if (Info->Location == RelativePath) {
|
||||
char path_buffer[_MAX_PATH], drive[_MAX_DRIVE] ,dir[_MAX_DIR];
|
||||
char fname[_MAX_FNAME],ext[_MAX_EXT];
|
||||
|
||||
GetModuleFileName(NULL,path_buffer,sizeof(path_buffer));
|
||||
_splitpath( path_buffer, drive, dir, fname, ext );
|
||||
sprintf(path_buffer,"%s%s",drive,dir);
|
||||
if (Info->SubNode.size() > 0) {
|
||||
strncat(path_buffer,Info->SubNode.c_str(),sizeof(path_buffer));
|
||||
strncat(path_buffer,"\\",sizeof(path_buffer));
|
||||
}
|
||||
if (Info->Name.size() > 0) {
|
||||
strncat(path_buffer,Info->Name.c_str(),sizeof(path_buffer));
|
||||
}
|
||||
strncpy(Buffer,path_buffer,BufferSize);
|
||||
} else if (Info->Location == TemporarySetting) {
|
||||
CGuard Guard(m_CS);
|
||||
|
||||
TEMP_SETTING_MAP::iterator TempInfo = TempKeys.find(Type);
|
||||
if (TempInfo != TempKeys.end()) {
|
||||
CTempInfo * temp = &TempInfo->second;
|
||||
if (temp->DataType == Data_String) {
|
||||
strncpy(Buffer,temp->String,BufferSize);
|
||||
}
|
||||
}
|
||||
} else if (Info->Location == LocalSettings) {
|
||||
if (SettingsIniFile == NULL) { return; }
|
||||
if (Info->DataType == Data_String)
|
||||
{
|
||||
stdstr_f Ident("%s",Info->SubNode.c_str());
|
||||
if (Ident.empty())
|
||||
{
|
||||
Ident = "default";
|
||||
}
|
||||
Ident.replace("\\","-");
|
||||
SettingsIniFile->GetString(Ident.c_str(),Info->Name.c_str(),Buffer,Buffer,BufferSize);
|
||||
} else {
|
||||
#ifdef _DEBUG
|
||||
Notify().BreakPoint(__FILE__,__LINE__);
|
||||
#endif
|
||||
}
|
||||
} else if (Info->Location == InRegistry) {
|
||||
char String[255];
|
||||
|
||||
//Get the location in the registry we are writing to
|
||||
strncpy(String,Registrylocation,sizeof(String));
|
||||
if (Info->SubNode.size() > 0) {
|
||||
strncat(String,"\\",sizeof(String));
|
||||
strncat(String,Info->SubNode.c_str(),sizeof(String));
|
||||
}
|
||||
|
||||
//Open the registry key
|
||||
long lResult;
|
||||
HKEY hKeyResults = 0;
|
||||
lResult = RegOpenKeyEx( (HKEY)RegistryKey,String,0, KEY_ALL_ACCESS,&hKeyResults);
|
||||
|
||||
if (lResult == ERROR_SUCCESS) {
|
||||
//Get the value from the registry
|
||||
DWORD RegType, Bytes = BufferSize;
|
||||
|
||||
lResult = RegQueryValueEx(hKeyResults,Info->Name.c_str(),0,&RegType,(LPBYTE)(Buffer),&Bytes);
|
||||
if (RegType != REG_SZ || lResult != ERROR_SUCCESS) {
|
||||
//Reload Defaults just in case data has changed
|
||||
if (Info->DefaultValue != Default_None) {
|
||||
Load(Info->DefaultValue,Buffer, BufferSize);
|
||||
}
|
||||
}
|
||||
RegCloseKey(hKeyResults);
|
||||
}
|
||||
} else if (Info->Location == RomSetting) {
|
||||
if (RomIniFile == NULL) { return; }
|
||||
if (Info->DataType == Data_String) {
|
||||
RomIniFile->GetString(LoadString(ROM_IniKey).c_str(),Info->Name.c_str(),Buffer,Buffer,BufferSize);
|
||||
}
|
||||
} else if (Info->Location == CheatSetting) {
|
||||
if (CheatIniFile == NULL) { return; }
|
||||
if (Info->DataType == Data_String) {
|
||||
CheatIniFile->GetString(LoadString(ROM_IniKey).c_str(),Info->Name.c_str(),Buffer,Buffer,BufferSize);
|
||||
}
|
||||
} else if (Info->Location == GameSetting) {
|
||||
if (SettingsIniFile == NULL) { return; }
|
||||
if (Info->DataType == Data_String)
|
||||
{
|
||||
char Ident[400];
|
||||
//Get the location in the registry we are writing to
|
||||
sprintf(Ident,"%s%s%s",LoadString(ROM_IniKey).c_str(),Info->SubNode.empty()?"":"-",Info->SubNode.c_str());
|
||||
|
||||
int len = strlen(Ident);
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
if (Ident[i] == '\\')
|
||||
{
|
||||
Ident[i] = '-';
|
||||
}
|
||||
}
|
||||
SettingsIniFile->GetString(Ident,Info->Name.c_str(),Buffer,Buffer,BufferSize);
|
||||
} else {
|
||||
#ifdef _DEBUG
|
||||
Notify().BreakPoint(__FILE__,__LINE__);
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
//unknown ??
|
||||
#ifdef _DEBUG
|
||||
Notify().BreakPoint(__FILE__,__LINE__);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
DWORD CSettings::LoadDword(SettingID Type ) {
|
||||
if (Type != IsValidExe)
|
||||
{
|
||||
WriteTraceF(TraceSettings,"CSettings::Load 2 - %d",Type);
|
||||
}
|
||||
DWORD Value = 0;
|
||||
Load(Type,Value);
|
||||
return Value;
|
||||
}
|
||||
|
||||
stdstr CSettings::LoadString ( SettingID Type ) {
|
||||
if (Type != IsValidExe)
|
||||
{
|
||||
WriteTraceF(TraceSettings,"CSettings::Load 3 - %d",Type);
|
||||
}
|
||||
|
||||
char Buffer[8000] = "";
|
||||
Load(Type,Buffer,sizeof(Buffer));
|
||||
return stdstr_f("%s",Buffer);
|
||||
}
|
||||
|
||||
void CSettings::UnknownSetting (SettingID Type)
|
||||
{
|
||||
if (UnknownSetting_RSP)
|
||||
{
|
||||
if (Type >= FirstRSPDefaultSet && Type < LastRSPDefaultSet)
|
||||
{
|
||||
UnknownSetting_RSP(Type - FirstRSPDefaultSet);
|
||||
return;
|
||||
}
|
||||
if (Type >= FirstRSPSettings && Type < LastRSPSettings)
|
||||
{
|
||||
UnknownSetting_RSP(Type - FirstRSPSettings);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (UnknownSetting_GFX)
|
||||
{
|
||||
if (Type >= FirstGfxDefaultSet && Type < LastGfxDefaultSet)
|
||||
{
|
||||
UnknownSetting_GFX(Type - FirstGfxDefaultSet);
|
||||
return;
|
||||
}
|
||||
if (Type >= FirstGfxSettings && Type < LastGfxSettings)
|
||||
{
|
||||
UnknownSetting_GFX(Type - FirstGfxSettings);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (UnknownSetting_AUDIO)
|
||||
{
|
||||
if (Type >= FirstAudioDefaultSet && Type < LastAudioDefaultSet)
|
||||
{
|
||||
UnknownSetting_AUDIO(Type - FirstAudioDefaultSet);
|
||||
return;
|
||||
}
|
||||
if (Type >= FirstAudioSettings && Type < LastAudioSettings)
|
||||
{
|
||||
UnknownSetting_AUDIO(Type - FirstAudioSettings);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (UnknownSetting_CTRL)
|
||||
{
|
||||
if (Type >= FirstCtrlDefaultSet && Type < LastCtrlDefaultSet)
|
||||
{
|
||||
UnknownSetting_CTRL(Type - FirstCtrlDefaultSet);
|
||||
return;
|
||||
}
|
||||
if (Type >= FirstCtrlSettings && Type < LastCtrlSettings)
|
||||
{
|
||||
UnknownSetting_CTRL(Type - FirstCtrlSettings);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
Notify().BreakPoint(__FILE__,__LINE__);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CSettings::Load(SettingID Type, DWORD & Value)
|
||||
{
|
||||
if (Type == Default_False || Type == Default_True)
|
||||
{
|
||||
Value = (Type == Default_True);
|
||||
return;
|
||||
}
|
||||
if (Type != IsValidExe)
|
||||
{
|
||||
WriteTraceF(TraceSettings,"CSettings::Load 4 - %d",Type);
|
||||
}
|
||||
|
||||
//Find out the information for handling the setting type from the list
|
||||
SETTING_MAP::iterator FindInfo = SettingInfo.find(Type);
|
||||
if (FindInfo == SettingInfo.end())
|
||||
{
|
||||
//if not found do nothing
|
||||
UnknownSetting(Type);
|
||||
return;
|
||||
}
|
||||
CSettingInfo * Info = &FindInfo->second;
|
||||
|
||||
if (Info->DefaultValue != Default_None) {
|
||||
Load(Info->DefaultValue,Value);
|
||||
}
|
||||
if (Info->Location == ConstValue) {
|
||||
Value = Info->Value;
|
||||
}
|
||||
else if (Info->Location == TemporarySetting)
|
||||
{
|
||||
CGuard Guard(m_CS);
|
||||
|
||||
TEMP_SETTING_MAP::iterator TempInfo = TempKeys.find(Type);
|
||||
if (TempInfo != TempKeys.end()) {
|
||||
CTempInfo * temp = &TempInfo->second;
|
||||
if (temp->DataType == Data_DWORD) {
|
||||
Value = temp->Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (Info->Location == InRegistry)
|
||||
{
|
||||
char String[255];
|
||||
|
||||
//Get the location in the registry we are writing to
|
||||
strncpy(String,Registrylocation,sizeof(String));
|
||||
if (Info->SubNode.size() > 0) {
|
||||
strncat(String,"\\",sizeof(String));
|
||||
strncat(String,Info->SubNode.c_str(),sizeof(String));
|
||||
}
|
||||
|
||||
//Open the registry key
|
||||
long lResult;
|
||||
HKEY hKeyResults = 0;
|
||||
lResult = RegOpenKeyEx( (HKEY)RegistryKey,String,0, KEY_ALL_ACCESS,&hKeyResults);
|
||||
|
||||
if (lResult == ERROR_SUCCESS) {
|
||||
//Get the value from the registry
|
||||
DWORD RegValue, RegType, Bytes = 4;
|
||||
|
||||
lResult = RegQueryValueEx(hKeyResults,Info->Name.c_str(),0,&RegType,(LPBYTE)(&RegValue),&Bytes);
|
||||
if (RegType == REG_DWORD && lResult == ERROR_SUCCESS) {
|
||||
Value = RegValue;
|
||||
}
|
||||
RegCloseKey(hKeyResults);
|
||||
}
|
||||
}
|
||||
else if (Info->Location == RomSetting)
|
||||
{
|
||||
if (RomIniFile == NULL) { return; }
|
||||
if (Info->DataType == Data_DWORD) {
|
||||
Value = RomIniFile->GetNumber(LoadString(ROM_IniKey).c_str(),Info->Name.c_str(),Value);
|
||||
} else if (Info->DataType == Data_CPUTYPE) {
|
||||
char String [100];
|
||||
strcpy(String,"");
|
||||
RomIniFile->GetString(LoadString(ROM_IniKey).c_str(),Info->Name.c_str(),String,String,sizeof(String));
|
||||
if (strcmp(String,"Interpreter") == 0) { Value = CPU_Interpreter; }
|
||||
else if (strcmp(String,"Recompiler") == 0) { Value = CPU_Recompiler; }
|
||||
else if (strcmp(String,"SyncCores") == 0) { Value = CPU_SyncCores; }
|
||||
else { Value = CPU_Default; }
|
||||
// } else if (Info->DataType == Data_SelfMod) {
|
||||
// char String [100];
|
||||
// strcpy(String,"");
|
||||
// RomIniFile->GetString(LoadString(ROM_IniKey).c_str(),Info->Name.c_str(),String,String,sizeof(String));
|
||||
// if (strcmp(String,"None") == 0) { *Value = ModCode_None; }
|
||||
// else if (strcmp(String,"Cache") == 0) { *Value = ModCode_Cache; }
|
||||
// else if (strcmp(String,"Protected Memory") == 0) { *Value = ModCode_ProtectedMemory; }
|
||||
// else if (strcmp(String,"Check Memory") == 0) { *Value = ModCode_CheckMemoryCache; }
|
||||
// else if (strcmp(String,"Check Memory & cache") == 0) { *Value = ModCode_CheckMemoryCache; }
|
||||
// else if (strcmp(String,"Check Memory Advance") == 0) { *Value = ModCode_CheckMemory2; }
|
||||
// else if (strcmp(String,"Change Memory") == 0) { *Value = ModCode_ChangeMemory; }
|
||||
} else if (Info->DataType == Data_SaveChip) {
|
||||
char String [100];
|
||||
strcpy(String,"");
|
||||
RomIniFile->GetString(LoadString(ROM_IniKey).c_str(),Info->Name.c_str(),String,String,sizeof(String));
|
||||
if (strcmp(String,"4kbit Eeprom") == 0) { Value = SaveChip_Eeprom_4K; }
|
||||
else if (strcmp(String,"16kbit Eeprom") == 0) { Value = SaveChip_Eeprom_16K; }
|
||||
else if (strcmp(String,"Sram") == 0) { Value = SaveChip_Sram; }
|
||||
else if (strcmp(String,"FlashRam") == 0) { Value = SaveChip_FlashRam; }
|
||||
} else if (Info->DataType == Data_OnOff) {
|
||||
char String [100];
|
||||
strcpy(String,"");
|
||||
RomIniFile->GetString(LoadString(ROM_IniKey).c_str(),Info->Name.c_str(),String,String,sizeof(String));
|
||||
if (strcmp(String,"On") == 0) { Value = 1; }
|
||||
if (strcmp(String,"Off") == 0) { Value = 0; }
|
||||
} else if (Info->DataType == Data_YesNo) {
|
||||
char String [100];
|
||||
strcpy(String,"");
|
||||
RomIniFile->GetString(LoadString(ROM_IniKey).c_str(),Info->Name.c_str(),String,String,sizeof(String));
|
||||
if (strcmp(String,"Yes") == 0) { Value = true; }
|
||||
if (strcmp(String,"No") == 0) { Value = false; }
|
||||
} else {
|
||||
#ifdef _DEBUG
|
||||
Notify().BreakPoint(__FILE__,__LINE__);
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
else if (Info->Location == GameSetting)
|
||||
{
|
||||
char Ident[400];
|
||||
//Get the location in the registry we are writing to
|
||||
sprintf(Ident,"%s%s%s",LoadString(ROM_IniKey).c_str(),Info->SubNode.empty()?"":"-",Info->SubNode.c_str());
|
||||
|
||||
int len = strlen(Ident);
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
if (Ident[i] == '\\')
|
||||
{
|
||||
Ident[i] = '-';
|
||||
}
|
||||
}
|
||||
|
||||
if (Info->DataType == Data_DWORD)
|
||||
{
|
||||
Value = SettingsIniFile->GetNumber(Ident,Info->Name.c_str(),Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
Notify().BreakPoint(__FILE__,__LINE__);
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
else if (Info->Location == LocalSettings)
|
||||
{
|
||||
if (SettingsIniFile == NULL) { return; }
|
||||
stdstr_f Ident("%s",Info->SubNode.c_str());
|
||||
if (Ident.empty())
|
||||
{
|
||||
Ident = "default";
|
||||
}
|
||||
Ident.replace("\\","-");
|
||||
if (Info->DataType == Data_DWORD)
|
||||
{
|
||||
Value = SettingsIniFile->GetNumber(Ident.c_str(),Info->Name.c_str(),Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
Notify().BreakPoint(__FILE__,__LINE__);
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
#ifdef _DEBUG
|
||||
Notify().BreakPoint(__FILE__,__LINE__);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void CSettings::SaveString(SettingID Type, const char * Buffer) {
|
||||
//Find out the information for handling the setting type from the list
|
||||
SETTING_MAP::iterator FindInfo = SettingInfo.find(Type);
|
||||
if (FindInfo == SettingInfo.end())
|
||||
{ //if not found do nothing
|
||||
UnknownSetting(Type);
|
||||
return;
|
||||
}
|
||||
CSettingInfo * Info = &FindInfo->second;
|
||||
|
||||
//make sure the setting type is a string
|
||||
if (Info->DataType != Data_String)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
Notify().BreakPoint(__FILE__,__LINE__);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
//create an entry in the temporary settings
|
||||
if (Info->Location == TemporarySetting) {
|
||||
CGuard Guard(m_CS);
|
||||
|
||||
TEMP_SETTING_MAP::iterator TempInfo = TempKeys.find(Type);
|
||||
if (TempInfo != TempKeys.end()) { TempKeys.erase(TempInfo); } //free the previous memory
|
||||
|
||||
TempKeys.insert(TEMP_SETTING_MAP::value_type(Type,CTempInfo(Type,Buffer)));
|
||||
}
|
||||
|
||||
//Save data to the registry
|
||||
else if (Info->Location == InRegistry) {
|
||||
char String[255];
|
||||
|
||||
//Get the location in the registry we are writing to
|
||||
strncpy(String,Registrylocation,sizeof(String));
|
||||
if (Info->SubNode.size() > 0) {
|
||||
strncat(String,"\\",sizeof(String));
|
||||
strncat(String,Info->SubNode.c_str(),sizeof(String));
|
||||
}
|
||||
|
||||
//Create the target Key
|
||||
DWORD Disposition = 0;
|
||||
HKEY hKeyResults = 0;
|
||||
long lResult;
|
||||
|
||||
lResult = RegCreateKeyEx( (HKEY)RegistryKey, String,0,"", REG_OPTION_NON_VOLATILE,
|
||||
KEY_ALL_ACCESS,NULL, &hKeyResults,&Disposition);
|
||||
if (lResult == ERROR_SUCCESS) {
|
||||
RegSetValueEx(hKeyResults,Info->Name.c_str(),0, REG_SZ,(CONST BYTE *)(Buffer),strlen(Buffer));
|
||||
}
|
||||
RegCloseKey(hKeyResults);
|
||||
}
|
||||
else if (Info->Location == RomSetting) {
|
||||
if (RomIniFile == NULL) { return; }
|
||||
RomIniFile->SaveString(LoadString(ROM_IniKey).c_str(),Info->Name.c_str(),Buffer);
|
||||
}
|
||||
else if (Info->Location == CheatSetting) {
|
||||
if (CheatIniFile == NULL) { return; }
|
||||
if (Info->DataType == Data_String) {
|
||||
stdstr DefaultValue;
|
||||
if (Info->DefaultValue != Default_None) {
|
||||
DefaultValue = LoadString(Info->DefaultValue);
|
||||
}
|
||||
if (DefaultValue == Buffer) {
|
||||
CheatIniFile->SaveString(LoadString(ROM_IniKey).c_str(),Info->Name.c_str(),NULL);
|
||||
} else {
|
||||
CheatIniFile->SaveString(LoadString(ROM_IniKey).c_str(),Info->Name.c_str(),Buffer);
|
||||
}
|
||||
} else {
|
||||
Notify().BreakPoint(__FILE__,__LINE__);
|
||||
}
|
||||
}
|
||||
else if (Info->Location == GameSetting) {
|
||||
char Ident[400];
|
||||
//Get the location in the registry we are writing to
|
||||
sprintf(Ident,"%s%s%s",LoadString(ROM_IniKey).c_str(),Info->SubNode.empty()?"":"-",Info->SubNode.c_str());
|
||||
|
||||
int len = strlen(Ident);
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
if (Ident[i] == '\\')
|
||||
{
|
||||
Ident[i] = '-';
|
||||
}
|
||||
}
|
||||
|
||||
stdstr DefaultValue;
|
||||
if (Info->DefaultValue != Default_None) {
|
||||
DefaultValue = LoadString(Info->DefaultValue);
|
||||
}
|
||||
|
||||
if (Info->DataType == Data_String)
|
||||
{
|
||||
if (DefaultValue == Buffer) {
|
||||
SettingsIniFile->SaveString(Ident,Info->Name.c_str(),NULL);
|
||||
} else {
|
||||
SettingsIniFile->SaveString(Ident,Info->Name.c_str(),Buffer);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
Notify().BreakPoint(__FILE__,__LINE__);
|
||||
#endif
|
||||
}
|
||||
} else if (Info->Location == LocalSettings) {
|
||||
if (SettingsIniFile == NULL) { return; }
|
||||
stdstr DefaultValue;
|
||||
if (Info->DefaultValue != Default_None) {
|
||||
DefaultValue = LoadString(Info->DefaultValue);
|
||||
}
|
||||
stdstr_f Ident("%s",Info->SubNode.c_str());
|
||||
Ident.replace("\\","-");
|
||||
if (Ident.empty())
|
||||
{
|
||||
Ident = "default";
|
||||
}
|
||||
|
||||
if (DefaultValue == Buffer) {
|
||||
SettingsIniFile->SaveString(Ident.c_str(),Info->Name.c_str(),NULL);
|
||||
} else {
|
||||
SettingsIniFile->SaveString(Ident.c_str(),Info->Name.c_str(),Buffer);
|
||||
}
|
||||
}
|
||||
else {
|
||||
#ifdef _DEBUG
|
||||
Notify().BreakPoint(__FILE__,__LINE__);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void CSettings::SaveDword(SettingID Type, DWORD Value) {
|
||||
//Find out the information for handling the setting type from the list
|
||||
SETTING_MAP::iterator FindInfo = SettingInfo.find(Type);
|
||||
if (FindInfo == SettingInfo.end())
|
||||
{ //if not found do nothing
|
||||
UnknownSetting(Type);
|
||||
return;
|
||||
}
|
||||
CSettingInfo * Info = &FindInfo->second;
|
||||
|
||||
//create an entry in the temporary settings
|
||||
if (Info->Location == TemporarySetting) {
|
||||
CGuard Guard(m_CS);
|
||||
|
||||
TEMP_SETTING_MAP::iterator TempInfo = TempKeys.find(Type);
|
||||
if (TempInfo != TempKeys.end()) { TempKeys.erase(TempInfo); } //free the previous memory
|
||||
TempKeys.insert(TEMP_SETTING_MAP::value_type(Type,CTempInfo(Type,Value)));
|
||||
} else if (Info->Location == LocalSettings) {
|
||||
if (SettingsIniFile == NULL) { return; }
|
||||
|
||||
DWORD DefaultValue = 0;
|
||||
if (Info->DefaultValue != Default_None) {
|
||||
Load(Info->DefaultValue,DefaultValue);
|
||||
}
|
||||
stdstr_f Ident("%s",Info->SubNode.c_str());
|
||||
if (Ident.empty())
|
||||
{
|
||||
Ident = "default";
|
||||
}
|
||||
Ident.replace("\\","-");
|
||||
|
||||
if (Info->DefaultValue != Default_None && Value == DefaultValue) {
|
||||
SettingsIniFile->SaveString(Ident.c_str(),Info->Name.c_str(),NULL);
|
||||
} else {
|
||||
SettingsIniFile->SaveNumber(Ident.c_str(),Info->Name.c_str(),Value);
|
||||
}
|
||||
} else if (Info->Location == InRegistry) {
|
||||
char String[255];
|
||||
|
||||
//Get the location in the registry we are writing to
|
||||
strncpy(String,Registrylocation,sizeof(String));
|
||||
if (Info->SubNode.size() > 0) {
|
||||
strncat(String,"\\",sizeof(String));
|
||||
strncat(String,Info->SubNode.c_str(),sizeof(String));
|
||||
}
|
||||
|
||||
//Create the target Key
|
||||
DWORD Disposition = 0;
|
||||
HKEY hKeyResults = 0;
|
||||
long lResult;
|
||||
|
||||
lResult = RegCreateKeyEx( (HKEY)RegistryKey, String,0,"", REG_OPTION_NON_VOLATILE,
|
||||
KEY_ALL_ACCESS,NULL, &hKeyResults,&Disposition);
|
||||
if (lResult == ERROR_SUCCESS) {
|
||||
RegSetValueEx(hKeyResults,Info->Name.c_str(),0, REG_DWORD,(CONST BYTE *)(&Value),sizeof(DWORD));
|
||||
}
|
||||
RegCloseKey(hKeyResults);
|
||||
} else if (Info->Location == RomSetting) {
|
||||
if (RomIniFile == NULL) { return; }
|
||||
if (Info->DataType == Data_DWORD) {
|
||||
DWORD DefaultValue = 0;
|
||||
if (Info->DefaultValue != Default_None) {
|
||||
Load(Info->DefaultValue,DefaultValue);
|
||||
}
|
||||
if (Info->DefaultValue != Default_None && Value == DefaultValue) {
|
||||
RomIniFile->SaveString(LoadString(ROM_IniKey).c_str(),Info->Name.c_str(),NULL);
|
||||
} else {
|
||||
RomIniFile->SaveNumber(LoadString(ROM_IniKey).c_str(),Info->Name.c_str(),Value);
|
||||
}
|
||||
} else if (Info->DataType == Data_CPUTYPE) {
|
||||
const char * String;
|
||||
switch (Value) {
|
||||
case CPU_Interpreter: String = "Interpreter"; break;
|
||||
case CPU_Recompiler: String = "Recompiler"; break;
|
||||
case CPU_SyncCores: String = "SyncCores"; break;
|
||||
default: String = NULL; break;
|
||||
}
|
||||
RomIniFile->SaveString(LoadString(ROM_IniKey).c_str(),Info->Name.c_str(),String);
|
||||
} else if (Info->DataType == Data_SaveChip) {
|
||||
const char * String;
|
||||
switch (Value) {
|
||||
case SaveChip_Eeprom_4K: String = "4kbit Eeprom"; break;
|
||||
case SaveChip_Eeprom_16K: String = "16kbit Eeprom"; break;
|
||||
case SaveChip_Sram: String = "Sram"; break;
|
||||
case SaveChip_FlashRam: String = "FlashRam"; break;
|
||||
default: String = NULL; break;
|
||||
}
|
||||
RomIniFile->SaveString(LoadString(ROM_IniKey).c_str(),Info->Name.c_str(),String);
|
||||
// } else if (Info->DataType == Data_SelfMod) {
|
||||
// const char * String;
|
||||
// switch (Value) {
|
||||
// case ModCode_None: String = "None"; break;
|
||||
// case ModCode_Cache: String = "Cache"; break;
|
||||
// case ModCode_ProtectedMemory: String = "Protected Memory"; break;
|
||||
// case ModCode_CheckMemoryCache: String = "Check Memory & cache"; break;
|
||||
// case ModCode_CheckMemory2: String = "Check Memory Advance"; break;
|
||||
// case ModCode_ChangeMemory: String = "Change Memory"; break;
|
||||
// default: String = NULL; break;
|
||||
// }
|
||||
// RomIniFile->SaveString(LoadString(ROM_IniKey).c_str(),Info->Name.c_str(),String);
|
||||
} else if (Info->DataType == Data_YesNo) {
|
||||
DWORD DefaultValue = 0;
|
||||
if (Info->DefaultValue != Default_None) {
|
||||
Load(Info->DefaultValue,DefaultValue);
|
||||
}
|
||||
if (Info->DefaultValue != Default_None && Value == DefaultValue) {
|
||||
RomIniFile->SaveString(LoadString(ROM_IniKey).c_str(),Info->Name.c_str(),NULL);
|
||||
} else {
|
||||
RomIniFile->SaveString(LoadString(ROM_IniKey).c_str(),Info->Name.c_str(),Value ? "Yes" : "No");
|
||||
}
|
||||
} else if (Info->DataType == Data_OnOff) {
|
||||
const char * String;
|
||||
switch (Value) {
|
||||
case 0: String = "Off"; break;
|
||||
case 1: String = "On"; break;
|
||||
default: String = NULL; break;
|
||||
}
|
||||
RomIniFile->SaveString(LoadString(ROM_IniKey).c_str(),Info->Name.c_str(),String);
|
||||
|
||||
} else {
|
||||
#ifdef _DEBUG
|
||||
Notify().BreakPoint(__FILE__,__LINE__);
|
||||
#endif
|
||||
}
|
||||
} else if (Info->Location == GameSetting) {
|
||||
if (SettingsIniFile == NULL) { return; }
|
||||
if (Info->DataType == Data_DWORD)
|
||||
{
|
||||
char Ident[400];
|
||||
//Get the location in the registry we are writing to
|
||||
sprintf(Ident,"%s%s%s",LoadString(ROM_IniKey).c_str(),Info->SubNode.empty()?"":"-",Info->SubNode.c_str());
|
||||
|
||||
int len = strlen(Ident);
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
if (Ident[i] == '\\')
|
||||
{
|
||||
Ident[i] = '-';
|
||||
}
|
||||
}
|
||||
|
||||
DWORD DefaultValue = 0;
|
||||
if (Info->DefaultValue != Default_None) {
|
||||
Load(Info->DefaultValue,DefaultValue);
|
||||
}
|
||||
|
||||
if (Info->DefaultValue != Default_None && Value == DefaultValue) {
|
||||
SettingsIniFile->SaveString(Ident,Info->Name.c_str(),NULL);
|
||||
} else {
|
||||
SettingsIniFile->SaveNumber(Ident,Info->Name.c_str(),Value);
|
||||
}
|
||||
} else{
|
||||
#ifdef _DEBUG
|
||||
Notify().BreakPoint(__FILE__,__LINE__);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
#ifdef _DEBUG
|
||||
Notify().BreakPoint(__FILE__,__LINE__);
|
||||
#endif
|
||||
}
|
||||
|
||||
for (SETTING_CHANGED_CB_LIST::iterator iter = m_CBDwordList.begin(); iter != m_CBDwordList.end(); iter ++)
|
||||
{
|
||||
SETTING_CHANGED_CB & item = *iter;
|
||||
if (item.Type != Type) { continue; }
|
||||
item.Func(item.Data);
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
void CSettings::NotifyCallBacks( SettingID Type )
|
||||
{
|
||||
SETTING_CALLBACK::iterator Callback = m_Callback.find(Type);
|
||||
|
|
|
@ -298,7 +298,7 @@ int CMainGui::ProcessAllMessages (void) {
|
|||
MSG msg;
|
||||
|
||||
while (GetMessage(&msg,NULL,0,0)) {
|
||||
if (_N64System && _N64System->IsDialogMsg(&msg))
|
||||
if (_BaseSystem && _BaseSystem->IsDialogMsg(&msg))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -518,11 +518,10 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam
|
|||
}
|
||||
}
|
||||
}
|
||||
if (CGuiSettings::bCPURunning() && _N64System) {
|
||||
CPlugins * Plugins = _N64System->Plugins();
|
||||
if (Plugins->Gfx() && Plugins->Gfx()->MoveScreen) {
|
||||
if (CGuiSettings::bCPURunning() && _BaseSystem) {
|
||||
if (_Plugins->Gfx() && _Plugins->Gfx()->MoveScreen) {
|
||||
WriteTrace(TraceGfxPlugin,"MoveScreen: Starting");
|
||||
Plugins->Gfx()->MoveScreen((int)(short) LOWORD(lParam), (int)(short) HIWORD(lParam));
|
||||
_Plugins->Gfx()->MoveScreen((int)(short) LOWORD(lParam), (int)(short) HIWORD(lParam));
|
||||
WriteTrace(TraceGfxPlugin,"MoveScreen: Done");
|
||||
}
|
||||
}
|
||||
|
@ -612,11 +611,10 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam
|
|||
|
||||
if (_this->m_bMainWindow && bCPURunning())
|
||||
{
|
||||
if (_N64System)
|
||||
if (_BaseSystem)
|
||||
{
|
||||
CPlugins * Plugins = _N64System->Plugins();
|
||||
if (Plugins && Plugins->Control()->WM_KeyUp) {
|
||||
Plugins->Control()->WM_KeyUp(wParam, lParam);
|
||||
if (_Plugins && _Plugins->Control()->WM_KeyUp) {
|
||||
_Plugins->Control()->WM_KeyUp(wParam, lParam);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -628,12 +626,11 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam
|
|||
|
||||
if (_this->m_bMainWindow && bCPURunning())
|
||||
{
|
||||
if (_N64System)
|
||||
if (_BaseSystem)
|
||||
{
|
||||
CPlugins * Plugins = _N64System->Plugins();
|
||||
if (Plugins && Plugins->Control()->WM_KeyDown)
|
||||
if (_Plugins && _Plugins->Control()->WM_KeyDown)
|
||||
{
|
||||
Plugins->Control()->WM_KeyDown(wParam, lParam);
|
||||
_Plugins->Control()->WM_KeyDown(wParam, lParam);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -650,9 +647,9 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam
|
|||
|
||||
if (_this->m_bMainWindow && bCPURunning() && bAutoSleep())
|
||||
{
|
||||
if (_N64System)
|
||||
if (_BaseSystem)
|
||||
{
|
||||
_N64System->ExternalEvent( SysEvent_ResumeCPU_AppGainedFocus );
|
||||
_BaseSystem->ExternalEvent( SysEvent_ResumeCPU_AppGainedFocus );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -667,9 +664,9 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam
|
|||
|
||||
if (_this->m_bMainWindow && bCPURunning() && bAutoSleep())
|
||||
{
|
||||
if (_N64System)
|
||||
if (_BaseSystem)
|
||||
{
|
||||
_N64System->ExternalEvent( SysEvent_PauseCPU_AppLostFocus );
|
||||
_BaseSystem->ExternalEvent( SysEvent_PauseCPU_AppLostFocus );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -687,7 +684,7 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam
|
|||
if (!fActive && _Settings->LoadBool(UserInterface_InFullScreen))
|
||||
{
|
||||
_Notify->WindowMode();
|
||||
if (bAutoSleep() && _N64System)
|
||||
if (bAutoSleep() && _BaseSystem)
|
||||
{
|
||||
//System->ExternalEvent(PauseCPU_AppLostActiveDelayed );
|
||||
}
|
||||
|
@ -695,9 +692,9 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam
|
|||
}
|
||||
if (bAutoSleep())
|
||||
{
|
||||
if (_N64System)
|
||||
if (_BaseSystem)
|
||||
{
|
||||
_N64System->ExternalEvent(fActive ? SysEvent_ResumeCPU_AppGainedActive : SysEvent_PauseCPU_AppLostActive );
|
||||
_BaseSystem->ExternalEvent(fActive ? SysEvent_ResumeCPU_AppGainedActive : SysEvent_PauseCPU_AppLostActive );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -729,7 +726,7 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam
|
|||
if (_this == NULL) { break; }
|
||||
|
||||
switch (LOWORD(wParam)) {
|
||||
case ID_POPUPMENU_PLAYGAME: _N64System->RunFileImage(_this->CurrentedSelectedRom()); break;
|
||||
case ID_POPUPMENU_PLAYGAME: _BaseSystem->RunFileImage(_this->CurrentedSelectedRom()); break;
|
||||
case ID_POPUPMENU_ROMDIRECTORY: _this->SelectRomDir(); break;
|
||||
case ID_POPUPMENU_REFRESHROMLIST: _this->RefreshRomBrowser(); break;
|
||||
case ID_POPUPMENU_ROMINFORMATION:
|
||||
|
@ -771,20 +768,17 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam
|
|||
default:
|
||||
if (_this->m_Menu) {
|
||||
if (LOWORD(wParam) > 5000 && LOWORD(wParam) <= 5100 ) {
|
||||
CPlugins * Plugins = _N64System->Plugins();
|
||||
if (Plugins->RSP() && Plugins->RSP()->ProcessMenuItem != NULL) {
|
||||
Plugins->RSP()->ProcessMenuItem(LOWORD(wParam));
|
||||
if (_Plugins->RSP() && _Plugins->RSP()->ProcessMenuItem != NULL) {
|
||||
_Plugins->RSP()->ProcessMenuItem(LOWORD(wParam));
|
||||
}
|
||||
} else if (LOWORD(wParam) > 5100 && LOWORD(wParam) <= 5200 ) {
|
||||
CPlugins * Plugins = _N64System->Plugins();
|
||||
if (Plugins->Gfx() && Plugins->Gfx()->ProcessMenuItem != NULL) {
|
||||
if (_Plugins->Gfx() && _Plugins->Gfx()->ProcessMenuItem != NULL) {
|
||||
WriteTrace(TraceGfxPlugin,"ProcessMenuItem: Starting");
|
||||
Plugins->Gfx()->ProcessMenuItem(LOWORD(wParam));
|
||||
_Plugins->Gfx()->ProcessMenuItem(LOWORD(wParam));
|
||||
WriteTrace(TraceGfxPlugin,"ProcessMenuItem: Done");
|
||||
}
|
||||
} else if (LOWORD(wParam) > 5200 && LOWORD(wParam) <= 5300 ) {
|
||||
CPlugins * Plugins = _N64System->Plugins();
|
||||
if (Plugins->Gfx() && Plugins->Gfx()->OnRomBrowserMenuItem != NULL)
|
||||
if (_Plugins->Gfx() && _Plugins->Gfx()->OnRomBrowserMenuItem != NULL)
|
||||
{
|
||||
CN64Rom Rom;
|
||||
if (!Rom.LoadN64Image(_this->CurrentedSelectedRom(),true))
|
||||
|
@ -795,7 +789,7 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam
|
|||
_Notify->DisplayMessage(0,"");
|
||||
BYTE * RomHeader = Rom.GetRomAddress();
|
||||
WriteTrace(TraceGfxPlugin,"OnRomBrowserMenuItem: Starting");
|
||||
Plugins->Gfx()->OnRomBrowserMenuItem(LOWORD(wParam),hWnd,RomHeader);
|
||||
_Plugins->Gfx()->OnRomBrowserMenuItem(LOWORD(wParam),hWnd,RomHeader);
|
||||
WriteTrace(TraceGfxPlugin,"OnRomBrowserMenuItem: Done");
|
||||
if (_Rom) {
|
||||
_Rom->SaveRomSettingID();
|
||||
|
@ -840,7 +834,7 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam
|
|||
{
|
||||
if (uMsg == _this->m_InvalidExeMsg)
|
||||
{
|
||||
_N64System->CloseCpu();
|
||||
_BaseSystem->CloseCpu();
|
||||
MessageBox((HWND)hWnd,GS(MSG_INVALID_EXE),GS(MSG_INVALID_EXE_TITLE),MB_OK|MB_ICONERROR);
|
||||
PostQuitMessage(0);
|
||||
}
|
||||
|
|
|
@ -63,24 +63,24 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men
|
|||
switch (MenuID) {
|
||||
case ID_FILE_OPEN_ROM:
|
||||
{
|
||||
stdstr File = _N64System->ChooseFileToOpen(hWnd);
|
||||
stdstr File = _BaseSystem->ChooseFileToOpen(hWnd);
|
||||
if (File.length() > 0) {
|
||||
_N64System->RunFileImage(File.c_str());
|
||||
_BaseSystem->RunFileImage(File.c_str());
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ID_FILE_ROM_INFO:
|
||||
{
|
||||
_N64System->DisplayRomInfo(hWnd);
|
||||
_BaseSystem->DisplayRomInfo(hWnd);
|
||||
}
|
||||
break;
|
||||
case ID_FILE_STARTEMULATION:
|
||||
_Gui->SaveWindowLoc();
|
||||
_N64System->StartEmulation(true);
|
||||
_BaseSystem->StartEmulation(true);
|
||||
break;
|
||||
case ID_FILE_ENDEMULATION:
|
||||
WriteTrace(TraceDebug,"ID_FILE_ENDEMULATION");
|
||||
_N64System->CloseCpu();
|
||||
_BaseSystem->CloseCpu();
|
||||
_Gui->SaveWindowLoc();
|
||||
break;
|
||||
case ID_FILE_ROMDIRECTORY:
|
||||
|
@ -94,20 +94,20 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men
|
|||
case ID_FILE_EXIT: DestroyWindow((HWND)hWnd); break;
|
||||
case ID_SYSTEM_RESET_SOFT:
|
||||
WriteTrace(TraceDebug,"ID_SYSTEM_RESET_SOFT");
|
||||
_N64System->ExternalEvent(SysEvent_ResetCPU_Soft);
|
||||
_BaseSystem->ExternalEvent(SysEvent_ResetCPU_Soft);
|
||||
break;
|
||||
case ID_SYSTEM_RESET_HARD:
|
||||
WriteTrace(TraceDebug,"ID_SYSTEM_RESET_HARD");
|
||||
_N64System->ExternalEvent(SysEvent_ResetCPU_Hard);
|
||||
_BaseSystem->ExternalEvent(SysEvent_ResetCPU_Hard);
|
||||
break;
|
||||
case ID_SYSTEM_PAUSE:
|
||||
_Gui->SaveWindowLoc();
|
||||
WriteTrace(TraceDebug,"ID_SYSTEM_PAUSE");
|
||||
if (_Settings->LoadBool(GameRunning_CPU_Paused))
|
||||
{
|
||||
_N64System->ExternalEvent(SysEvent_ResumeCPU_FromMenu);
|
||||
_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_FromMenu);
|
||||
} else {
|
||||
_N64System->ExternalEvent(SysEvent_PauseCPU_FromMenu);
|
||||
_BaseSystem->ExternalEvent(SysEvent_PauseCPU_FromMenu);
|
||||
}
|
||||
WriteTrace(TraceDebug,"ID_SYSTEM_PAUSE 1");
|
||||
break;
|
||||
|
@ -124,7 +124,7 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men
|
|||
_Settings->SaveBool(GameRunning_LimitFPS,!_Settings->LoadBool(GameRunning_LimitFPS));
|
||||
WriteTrace(TraceDebug,"ID_SYSTEM_LIMITFPS 1");
|
||||
break;
|
||||
case ID_SYSTEM_SAVE: WriteTrace(TraceDebug,"ID_SYSTEM_SAVE"); _N64System->ExternalEvent(SysEvent_SaveMachineState); break;
|
||||
case ID_SYSTEM_SAVE: WriteTrace(TraceDebug,"ID_SYSTEM_SAVE"); _BaseSystem->ExternalEvent(SysEvent_SaveMachineState); break;
|
||||
case ID_SYSTEM_SAVEAS:
|
||||
{
|
||||
char drive[_MAX_DRIVE] ,dir[_MAX_DIR], fname[_MAX_FNAME],ext[_MAX_EXT];
|
||||
|
@ -144,7 +144,7 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men
|
|||
openfilename.nMaxFile = MAX_PATH;
|
||||
openfilename.Flags = OFN_HIDEREADONLY;
|
||||
|
||||
_N64System->ExternalEvent(SysEvent_PauseCPU_SaveGame);
|
||||
_BaseSystem->ExternalEvent(SysEvent_PauseCPU_SaveGame);
|
||||
|
||||
if (GetSaveFileName (&openfilename))
|
||||
{
|
||||
|
@ -164,13 +164,13 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men
|
|||
_makepath( SaveDir, drive, dir, NULL, NULL );
|
||||
_Settings->SaveString(Directory_LastSave,SaveDir);
|
||||
|
||||
_N64System->ExternalEvent(SysEvent_SaveMachineState);
|
||||
_BaseSystem->ExternalEvent(SysEvent_SaveMachineState);
|
||||
}
|
||||
|
||||
_N64System->ExternalEvent(SysEvent_ResumeCPU_SaveGame);
|
||||
_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_SaveGame);
|
||||
}
|
||||
break;
|
||||
case ID_SYSTEM_RESTORE: WriteTrace(TraceDebug,"ID_SYSTEM_RESTORE"); _N64System->ExternalEvent(SysEvent_LoadMachineState); break;
|
||||
case ID_SYSTEM_RESTORE: WriteTrace(TraceDebug,"ID_SYSTEM_RESTORE"); _BaseSystem->ExternalEvent(SysEvent_LoadMachineState); break;
|
||||
case ID_SYSTEM_LOAD:
|
||||
{
|
||||
char Directory[255], SaveFile[255];
|
||||
|
@ -189,7 +189,7 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men
|
|||
openfilename.nMaxFile = MAX_PATH;
|
||||
openfilename.Flags = OFN_HIDEREADONLY;
|
||||
|
||||
_N64System->ExternalEvent(SysEvent_PauseCPU_LoadGame);
|
||||
_BaseSystem->ExternalEvent(SysEvent_PauseCPU_LoadGame);
|
||||
|
||||
if (GetOpenFileName (&openfilename)) {
|
||||
_Settings->SaveString(GameRunning_InstantSaveFile,SaveFile);
|
||||
|
@ -199,18 +199,18 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men
|
|||
_makepath( SaveDir, drive, dir, NULL, NULL );
|
||||
_Settings->SaveString(Directory_LastSave,SaveDir);
|
||||
|
||||
_N64System->ExternalEvent(SysEvent_LoadMachineState);
|
||||
_BaseSystem->ExternalEvent(SysEvent_LoadMachineState);
|
||||
}
|
||||
_N64System->ExternalEvent(SysEvent_ResumeCPU_LoadGame);
|
||||
_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_LoadGame);
|
||||
}
|
||||
break;
|
||||
case ID_SYSTEM_CHEAT:
|
||||
{
|
||||
_N64System->SelectCheats(hWnd);
|
||||
_BaseSystem->SelectCheats(hWnd);
|
||||
}
|
||||
break;
|
||||
case ID_SYSTEM_GSBUTTON:
|
||||
_N64System->ExternalEvent(SysEvent_GSButtonPressed);
|
||||
_BaseSystem->ExternalEvent(SysEvent_GSButtonPressed);
|
||||
break;
|
||||
case ID_OPTIONS_DISPLAY_FR:
|
||||
_Settings->SaveBool(UserInterface_DisplayFrameRate,!_Settings->LoadBool(UserInterface_DisplayFrameRate));
|
||||
|
@ -229,13 +229,13 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men
|
|||
}
|
||||
break;
|
||||
case ID_OPTIONS_INCREASE_SPEED:
|
||||
_N64System->IncreaseSpeed();
|
||||
_BaseSystem->IncreaseSpeed();
|
||||
break;
|
||||
case ID_OPTIONS_DECREASE_SPEED:
|
||||
_N64System->DecreaeSpeed();
|
||||
_BaseSystem->DecreaeSpeed();
|
||||
break;
|
||||
case ID_OPTIONS_FULLSCREEN:
|
||||
_N64System->ExternalEvent(SysEvent_ChangingFullScreen);
|
||||
_BaseSystem->ExternalEvent(SysEvent_ChangingFullScreen);
|
||||
break;
|
||||
case ID_OPTIONS_FULLSCREEN2:
|
||||
if (_Settings->LoadBool(UserInterface_InFullScreen))
|
||||
|
@ -300,7 +300,7 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men
|
|||
} else {
|
||||
_Settings->SaveBool(UserInterface_ShowCPUPer,true);
|
||||
}
|
||||
_N64System->ExternalEvent(SysEvent_CPUUsageTimerChanged);
|
||||
_BaseSystem->ExternalEvent(SysEvent_CPUUsageTimerChanged);
|
||||
break;
|
||||
case ID_OPTIONS_SETTINGS:
|
||||
{
|
||||
|
@ -310,10 +310,10 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men
|
|||
break;
|
||||
case ID_PROFILE_PROFILE:
|
||||
_Settings->SaveBool(Debugger_ProfileCode,!_Settings->LoadBool(Debugger_ProfileCode));
|
||||
_N64System->ExternalEvent(SysEvent_Profile_StartStop);
|
||||
_BaseSystem->ExternalEvent(SysEvent_Profile_StartStop);
|
||||
break;
|
||||
case ID_PROFILE_RESETCOUNTER: _N64System->ExternalEvent(SysEvent_Profile_ResetLogs); break;
|
||||
case ID_PROFILE_GENERATELOG: _N64System->ExternalEvent(SysEvent_Profile_GenerateLogs); break;
|
||||
case ID_PROFILE_RESETCOUNTER: _BaseSystem->ExternalEvent(SysEvent_Profile_ResetLogs); break;
|
||||
case ID_PROFILE_GENERATELOG: _BaseSystem->ExternalEvent(SysEvent_Profile_GenerateLogs); break;
|
||||
case ID_DEBUG_SHOW_UNHANDLED_MEM:
|
||||
_Settings->SaveBool(Debugger_ShowUnhandledMemory,!_Settings->LoadBool(Debugger_ShowUnhandledMemory));
|
||||
break;
|
||||
|
@ -435,17 +435,17 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men
|
|||
_Settings->SaveBool(Debugger_GenerateDebugLog,!_Settings->LoadBool(Debugger_GenerateDebugLog));
|
||||
break;
|
||||
case ID_DEBUGGER_DUMPMEMORY:
|
||||
_N64System->Debug_ShowMemoryDump();
|
||||
_BaseSystem->Debug_ShowMemoryDump();
|
||||
break;
|
||||
case ID_DEBUGGER_SEARCHMEMORY: _N64System->Debug_ShowMemorySearch(); break;
|
||||
case ID_DEBUGGER_MEMORY: _N64System->Debug_ShowMemoryWindow(); break;
|
||||
case ID_DEBUGGER_TLBENTRIES: _N64System->Debug_ShowTLBWindow(); break;
|
||||
case ID_DEBUGGER_INTERRUPT_SP: _N64System->ExternalEvent(SysEvent_Interrupt_SP); break;
|
||||
case ID_DEBUGGER_INTERRUPT_SI: _N64System->ExternalEvent(SysEvent_Interrupt_SI); break;
|
||||
case ID_DEBUGGER_INTERRUPT_AI: _N64System->ExternalEvent(SysEvent_Interrupt_AI); break;
|
||||
case ID_DEBUGGER_INTERRUPT_VI: _N64System->ExternalEvent(SysEvent_Interrupt_VI); break;
|
||||
case ID_DEBUGGER_INTERRUPT_PI: _N64System->ExternalEvent(SysEvent_Interrupt_PI); break;
|
||||
case ID_DEBUGGER_INTERRUPT_DP: _N64System->ExternalEvent(SysEvent_Interrupt_DP); break;
|
||||
case ID_DEBUGGER_SEARCHMEMORY: _BaseSystem->Debug_ShowMemorySearch(); break;
|
||||
case ID_DEBUGGER_MEMORY: _BaseSystem->Debug_ShowMemoryWindow(); break;
|
||||
case ID_DEBUGGER_TLBENTRIES: _BaseSystem->Debug_ShowTLBWindow(); break;
|
||||
case ID_DEBUGGER_INTERRUPT_SP: _BaseSystem->ExternalEvent(SysEvent_Interrupt_SP); break;
|
||||
case ID_DEBUGGER_INTERRUPT_SI: _BaseSystem->ExternalEvent(SysEvent_Interrupt_SI); break;
|
||||
case ID_DEBUGGER_INTERRUPT_AI: _BaseSystem->ExternalEvent(SysEvent_Interrupt_AI); break;
|
||||
case ID_DEBUGGER_INTERRUPT_VI: _BaseSystem->ExternalEvent(SysEvent_Interrupt_VI); break;
|
||||
case ID_DEBUGGER_INTERRUPT_PI: _BaseSystem->ExternalEvent(SysEvent_Interrupt_PI); break;
|
||||
case ID_DEBUGGER_INTERRUPT_DP: _BaseSystem->ExternalEvent(SysEvent_Interrupt_DP); break;
|
||||
case ID_CURRENT_SAVE_DEFAULT:
|
||||
Notify().DisplayMessage(3,"Save Slot (%s) selected",GetSaveSlotString(MenuID - ID_CURRENT_SAVE_DEFAULT).c_str());
|
||||
_Settings->SaveDword(Game_CurrentSaveState,(DWORD)(MenuID - ID_CURRENT_SAVE_DEFAULT));
|
||||
|
@ -503,7 +503,7 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men
|
|||
if (_Settings->LoadStringIndex(File_RecentGameFileIndex,MenuID - ID_RECENT_ROM_START,FileName) &&
|
||||
FileName.length() > 0)
|
||||
{
|
||||
_N64System->RunFileImage(FileName.c_str());
|
||||
_BaseSystem->RunFileImage(FileName.c_str());
|
||||
}
|
||||
}
|
||||
if (MenuID >= ID_RECENT_DIR_START && MenuID < ID_RECENT_DIR_END) {
|
||||
|
@ -653,6 +653,8 @@ stdstr CMainMenu::GetSaveSlotString (int Slot)
|
|||
}
|
||||
|
||||
void CMainMenu::FillOutMenu ( MENU_HANDLE hMenu ) {
|
||||
CGuard Guard(m_CS);
|
||||
|
||||
MENU_ITEM Item;
|
||||
|
||||
//Get all flags
|
||||
|
@ -1142,6 +1144,8 @@ void CMainMenu::FillOutMenu ( MENU_HANDLE hMenu ) {
|
|||
}
|
||||
|
||||
void CMainMenu::RebuildAccelerators(void) {
|
||||
CGuard Guard(m_CS);
|
||||
|
||||
//Delete the old accel list
|
||||
WriteTrace(TraceDebug,"CMainMenu::RebuildAccelerators - Start");
|
||||
|
||||
|
@ -1154,6 +1158,7 @@ void CMainMenu::RebuildAccelerators(void) {
|
|||
}
|
||||
|
||||
void CMainMenu::ResetMenu(void) {
|
||||
CGuard Guard(m_CS);
|
||||
WriteTrace(TraceDebug,"CMainMenu::ResetMenu - Start");
|
||||
|
||||
m_ShortCuts.Load();
|
||||
|
|
|
@ -60,6 +60,7 @@ class CMainMenu:public CBaseMenu
|
|||
bool m_ResetAccelerators;
|
||||
CShortCuts m_ShortCuts;
|
||||
SettingList m_ChangeSettingList;
|
||||
CriticalSection m_CS;
|
||||
|
||||
void FillOutMenu ( MENU_HANDLE hMenu );
|
||||
//stdstr ShortCutString(MSC_MAP & ShortCuts, int MenuID, CMenuShortCutKey::ACCESS_MODE AccessLevel);
|
||||
|
|
|
@ -1332,7 +1332,7 @@ void CRomBrowser::RomList_OpenRom(DWORD pnmh) {
|
|||
|
||||
if (!pRomInfo) { return; }
|
||||
m_StopRefresh = true;
|
||||
_N64System->RunFileImage(pRomInfo->szFullFileName);
|
||||
_BaseSystem->RunFileImage(pRomInfo->szFullFileName);
|
||||
}
|
||||
|
||||
void CRomBrowser::RomList_PopupMenu(DWORD pnmh) {
|
||||
|
|
|
@ -317,11 +317,11 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszArgs,
|
|||
MainWindow.ProcessAllMessages();
|
||||
WriteTrace(TraceDebug,"WinMain - Message Loop Finished");
|
||||
|
||||
if (_N64System)
|
||||
if (_BaseSystem)
|
||||
{
|
||||
_N64System->CloseCpu();
|
||||
delete _N64System;
|
||||
_N64System = NULL;
|
||||
_BaseSystem->CloseCpu();
|
||||
delete _BaseSystem;
|
||||
_BaseSystem = NULL;
|
||||
}
|
||||
WriteTrace(TraceDebug,"WinMain - System Closed");
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#pragma warning(disable:4247)
|
||||
#pragma warning(disable:4786)
|
||||
|
||||
#include <common/MemTest.h>
|
||||
#include <common/CriticalSection.h>
|
||||
#include "Multilanguage.h"
|
||||
#include "User Interface.h"
|
||||
#include "N64 System.h"
|
||||
|
|
Loading…
Reference in New Issue