Conflicts:
	Source/Project64/N64 System/Interpreter/Interpreter Ops.cpp
This commit is contained in:
Emmet Young 2012-10-01 00:52:47 +10:00
commit ee3abe73a8
11 changed files with 222 additions and 60 deletions

View File

@ -3,6 +3,7 @@
Auto Sleep=0
Basic Mode=0
Cheats=..\..\Config\Project64.cht
Current Language=English
ExtInfo=..\..\Config\Project64.rdx
Notes=..\..\Config\Project64.rdn
RomDatabase=..\..\Config\Project64.rdb
@ -13,10 +14,164 @@ ShortCuts=..\..\Config\Project64.sc3
Debugger=1
[Directory]
Instant Save=..\..\Save\
Game=E:\Roms\Nintendo 64\
Game - Use Selected=1
Instant Save=E:\Programming Stuff\Programming Projects\project64.development\Bin\Debug\..\..\Save\
Instant Save - Use Selected=1
Lang=..\..\Lang
Plugin=..\..\Plugin\
Plugin=E:\Programming Stuff\Programming Projects\project64.development\Bin\Debug\..\..\Plugin\
Plugin - Use Selected=1
Save=..\..\Save\
Save=E:\Programming Stuff\Programming Projects\project64.development\Bin\Debug\..\..\Save\
Save - Use Selected=1
[Plugin]
Audio Dll=Audio\Jabo_Dsound.dll
Audio Dll Ver=Jabo's DirectSound 1.7
Controller Dll=Input\Jabo_DInput.dll
Controller Dll Ver=Jabo's DirectInput7 1.7.0.8
Graphics Dll=GFX\Jabo_Direct3D8.dll
Graphics Dll Ver=Jabo's Direct3D8 1.7.0.57-ver5
RSP Dll=RSP\RSP_d 1.7.dll
RSP Dll Ver=RSP Debug Plugin 1.7.0.3
[Rom Browser]
Left=666
Maximized=1
Top=-12
[Recent Dir]
Recent Dir 0=E:\Roms\Nintendo 64\
[Recent File]
Recent Rom 0=E:\Roms\Nintendo 64\Banjo-Kazooie (U) [!].zip
Recent Rom 1=E:\Roms\Nintendo 64\F-Zero X (E) [h1] (cartname).zip
Recent Rom 2=E:\Roms\Nintendo 64\Banjo-Tooie (U) [!].zip
Recent Rom 3=E:\Roms\Nintendo 64\Blast Corps (USA).zip
Recent Rom 4=E:\Roms\Nintendo 64\Mario Kart 64.zip
Recent Rom 5=E:\Roms\Nintendo 64\Donkey Kong 64 (U) [!].zip
Recent Rom 6=E:\Roms\Nintendo 64\Conkers Bad Fur Day.zip
[Main Window]
Left=773
Top=99
[Direct3D8]
Anisotropic=0
DumpTextures=0
EmulateBuffer=0
ForceBlend=0
ForceCombiner=0
FullscreenHeight=1050
FullscreenWidth=1680
Multisample=0
SoftwareEmu=0
Vsync=0
WindowType=3
[DirectInput-Controller 0]
A=46
Analog Down=208
Analog Left=203
Analog Right=205
Analog Up=200
B=45
C-Down=207
C-Left=211
C-Right=209
C-Up=199
Dead Zone=2500
Digital Down=37
Digital Left=36
Digital Right=38
Digital Up=23
GUID=00000000-0000-0000-0000-000000000000
L=30
Present=1
R=31
Range=100
Start=28
Type=2
Z=44
[DirectInput-Controller 1]
A=0
Analog Down=0
Analog Left=0
Analog Right=0
Analog Up=0
B=0
C-Down=0
C-Left=0
C-Right=0
C-Up=0
Dead Zone=2500
Digital Down=0
Digital Left=0
Digital Right=0
Digital Up=0
GUID=00000000-0000-0000-0000-000000000000
L=0
Present=0
R=0
Range=100
Start=0
Type=2
Z=0
[DirectInput-Controller 2]
A=0
Analog Down=0
Analog Left=0
Analog Right=0
Analog Up=0
B=0
C-Down=0
C-Left=0
C-Right=0
C-Up=0
Dead Zone=2500
Digital Down=0
Digital Left=0
Digital Right=0
Digital Up=0
GUID=00000000-0000-0000-0000-000000000000
L=0
Present=0
R=0
Range=100
Start=0
Type=2
Z=0
[DirectInput-Controller 3]
A=0
Analog Down=0
Analog Left=0
Analog Right=0
Analog Up=0
B=0
C-Down=0
C-Left=0
C-Right=0
C-Up=0
Dead Zone=2500
Digital Down=0
Digital Left=0
Digital Right=0
Digital Up=0
GUID=00000000-0000-0000-0000-000000000000
L=0
Present=0
R=0
Range=100
Start=0
Type=2
Z=0
[A4BF9306-BF0CDFD1-C:45]
[Dsound]
Volume=40
[EC58EABF-AD7C7169-C:45]
Dsound-SyncAudio=1

View File

@ -1513,9 +1513,9 @@ void R4300iOp::SPECIAL_DIV (void) {
_RegLO->DW = _GPR[m_Opcode.rs].W[0] / _GPR[m_Opcode.rt].W[0];
_RegHI->DW = _GPR[m_Opcode.rs].W[0] % _GPR[m_Opcode.rt].W[0];
} else {
#ifndef EXTERNAL_RELEASE
_Notify->DisplayError("DIV by 0 ???");
#endif
if (bShowDivByZero()) { _Notify->DisplayError("DIV by 0 ???"); }
_RegLO->DW = 0;
_RegHI->DW = 0;
}
}
@ -1524,9 +1524,9 @@ void R4300iOp::SPECIAL_DIVU (void) {
_RegLO->DW = (int)(_GPR[m_Opcode.rs].UW[0] / _GPR[m_Opcode.rt].UW[0]);
_RegHI->DW = (int)(_GPR[m_Opcode.rs].UW[0] % _GPR[m_Opcode.rt].UW[0]);
} else {
#ifndef EXTERNAL_RELEASE
_Notify->DisplayError("DIVU by 0 ???");
#endif
if (bShowDivByZero()) { _Notify->DisplayError("DIVU by 0 ???"); }
_RegLO->DW = 0;
_RegHI->DW = 0;
}
}

View File

@ -307,6 +307,21 @@ void CCodeSection::CompileExit ( DWORD JumpPC, DWORD TargetPC, CRegInfo &ExitReg
}
ExitCodeBlock();
break;
case CExitInfo::DivByZero:
AddConstToVariable(4,_PROGRAM_COUNTER,"PROGRAM_COUNTER");
if (!b32BitCore())
{
MoveConstToVariable(0,&_RegHI->UW[1],"_RegHI->UW[1]");
MoveConstToVariable(0,&_RegLO->UW[1],"_RegLO->UW[1]");
}
MoveConstToVariable(0,&_RegHI->UW[0],"_RegHI->UW[0]");
MoveConstToVariable(0,&_RegLO->UW[0],"_RegLO->UW[0]");
if (_SyncSystem) {
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
ExitCodeBlock();
break;
default:
_Notify->DisplayError("how did you want to exit on reason (%d) ???",reason);
}

View File

@ -10,7 +10,8 @@ public:
DoSysCall = 4,
TLBReadMiss = 5,
TLBWriteMiss = 6,
ExitResetRecompCode = 7,
DivByZero = 7,
ExitResetRecompCode = 8,
};
DWORD ID;

View File

@ -2282,7 +2282,7 @@ void CRecompilerOps::SPECIAL_DSRLV (void) {
}
void CRecompilerOps::SPECIAL_DSRAV (void) {
_Notify->BreakPoint(__FILE__,__LINE__);
_Notify->BreakPoint(__FILE__,__LINE__); //F-zero X
#ifdef tofix
BYTE * Jump[2];
@ -2357,9 +2357,8 @@ void CRecompilerOps::SPECIAL_MULTU (void) {
MoveX86regToVariable(x86_EDX,&_RegHI->UW[1],"_RegHI->UW[1]");
}
void CRecompilerOps::SPECIAL_DIV (void) {
BYTE *Jump[2];
void CRecompilerOps::SPECIAL_DIV (void)
{
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
if (IsConst(m_Opcode.rt)) {
@ -2370,27 +2369,13 @@ void CRecompilerOps::SPECIAL_DIV (void) {
MoveConstToVariable(0, &_RegHI->UW[1], "_RegHI->UW[1]");
return;
}
Jump[1] = NULL;
} else {
if (IsMapped(m_Opcode.rt)) {
CompConstToX86reg(cMipsRegMapLo(m_Opcode.rt),0);
} else {
CompConstToVariable(0, &_GPR[m_Opcode.rt].W[0], CRegName::GPR_Lo[m_Opcode.rt]);
}
JneLabel8("NoExcept", 0);
Jump[0] = m_RecompPos - 1;
MoveConstToVariable(0, &_RegLO->UW[0], "_RegLO->UW[0]");
MoveConstToVariable(0, &_RegLO->UW[1], "_RegLO->UW[1]");
MoveConstToVariable(0, &_RegHI->UW[0], "_RegHI->UW[0]");
MoveConstToVariable(0, &_RegHI->UW[1], "_RegHI->UW[1]");
JmpLabel8("EndDivu", 0);
Jump[1] = m_RecompPos - 1;
CPU_Message("");
CPU_Message(" NoExcept:");
*((BYTE *)(Jump[0]))=(BYTE)(m_RecompPos - Jump[0] - 1);
m_Section->CompileExit(m_CompilePC, m_CompilePC,m_RegWorkingSet,CExitInfo::DivByZero,FALSE,JeLabel32);
}
/* lo = (SD)rs / (SD)rt;
hi = (SD)rs % (SD)rt; */
@ -2418,12 +2403,6 @@ void CRecompilerOps::SPECIAL_DIV (void) {
ShiftRightSignImmed(x86_EDX,31);
MoveX86regToVariable(x86_EAX,&_RegLO->UW[1],"_RegLO->UW[1]");
MoveX86regToVariable(x86_EDX,&_RegHI->UW[1],"_RegHI->UW[1]");
if( Jump[1] != NULL ) {
CPU_Message("");
CPU_Message(" EndDivu:");
*((BYTE *)(Jump[1]))=(BYTE)(m_RecompPos - Jump[1] - 1);
}
}
void CRecompilerOps::SPECIAL_DIVU ( void) {

View File

@ -192,7 +192,7 @@ enum SettingID {
Debugger_ShowTLBMisses,
Debugger_ShowUnhandledMemory,
Debugger_ShowPifErrors,
Debugger_ShowCheckOpUsageErrors,
Debugger_ShowDivByZero,
Debugger_GenerateLogFiles,
Debugger_ProfileCode,
Debugger_DisableGameFixes,

View File

@ -5,6 +5,7 @@ int CDebugSettings::m_RefCount = 0;
bool CDebugSettings::m_bHaveDebugger = false;
bool CDebugSettings::m_bLogX86Code = false;
bool CDebugSettings::m_bShowTLBMisses = false;
bool CDebugSettings::m_bShowDivByZero = false;
CDebugSettings::CDebugSettings()
{
@ -14,6 +15,7 @@ CDebugSettings::CDebugSettings()
_Settings->RegisterChangeCB(Debugger_Enabled,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->RegisterChangeCB(Debugger_GenerateLogFiles,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->RegisterChangeCB(Debugger_ShowTLBMisses,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->RegisterChangeCB(Debugger_ShowDivByZero,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
RefreshSettings();
}
@ -27,12 +29,14 @@ CDebugSettings::~CDebugSettings()
_Settings->UnregisterChangeCB(Debugger_Enabled,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->UnregisterChangeCB(Debugger_GenerateLogFiles,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->UnregisterChangeCB(Debugger_ShowTLBMisses,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->UnregisterChangeCB(Debugger_ShowDivByZero,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
}
}
void CDebugSettings::RefreshSettings()
{
m_bHaveDebugger = _Settings->LoadBool(Debugger_Enabled);
m_bLogX86Code = _Settings->LoadBool(Debugger_GenerateLogFiles);
m_bShowTLBMisses = _Settings->LoadBool(Debugger_ShowTLBMisses);
m_bLogX86Code = m_bHaveDebugger && _Settings->LoadBool(Debugger_GenerateLogFiles);
m_bShowTLBMisses = m_bHaveDebugger && _Settings->LoadBool(Debugger_ShowTLBMisses);
m_bShowDivByZero = m_bHaveDebugger && _Settings->LoadBool(Debugger_ShowDivByZero);
}

View File

@ -9,6 +9,7 @@ public:
static inline bool bHaveDebugger ( void ) { return m_bHaveDebugger; }
static inline bool bLogX86Code ( void ) { return m_bLogX86Code; }
static inline bool bShowTLBMisses ( void ) { return m_bShowTLBMisses; }
static inline bool bShowDivByZero ( void ) { return m_bShowDivByZero; }
private:
static void StaticRefreshSettings (CDebugSettings * _this)
@ -22,6 +23,7 @@ private:
static bool m_bHaveDebugger;
static bool m_bLogX86Code;
static bool m_bShowTLBMisses;
static bool m_bShowDivByZero;
static int m_RefCount;
};

View File

@ -254,7 +254,7 @@ void CSettings::AddHowToHandleSetting ()
AddHandler(Debugger_DisableGameFixes, new CSettingTypeApplication("Debugger","Disable Game Fixes",false));
AddHandler(Debugger_ShowDListAListCount, new CSettingTypeApplication("Debugger","Show Dlist Alist Count",false));
AddHandler(Debugger_ShowRecompMemSize, new CSettingTypeApplication("Debugger","Show Recompiler Memory size",false));
AddHandler(Debugger_ShowCheckOpUsageErrors, new CSettingTypeApplication("Debugger","Show Check Op Usage Errors",false));
AddHandler(Debugger_ShowDivByZero, new CSettingTypeApplication("Debugger","Show Div by zero",false));
AddHandler(Debugger_GenerateDebugLog, new CSettingTypeApplication("Debugger","Generate Debug Code",false));
AddHandler(Debugger_ProfileCode, new CSettingTypeApplication("Debugger","Profile Code", (DWORD)false));
AddHandler(Debugger_AppLogLevel, new CSettingTypeApplication("Logging","Log Level",(DWORD)TraceError));

View File

@ -21,7 +21,7 @@ CMainMenu::CMainMenu ( CMainGui * hMainWindow ):
m_ChangeSettingList.push_back(Debugger_ShowPifErrors);
m_ChangeSettingList.push_back(Debugger_ShowDListAListCount);
m_ChangeSettingList.push_back(Debugger_ShowRecompMemSize);
m_ChangeSettingList.push_back(Debugger_ShowCheckOpUsageErrors);
m_ChangeSettingList.push_back(Debugger_ShowDivByZero);
m_ChangeSettingList.push_back(Debugger_GenerateLogFiles);
m_ChangeSettingList.push_back(Debugger_DisableGameFixes);
m_ChangeSettingList.push_back(Debugger_AppLogLevel);
@ -334,8 +334,8 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men
_Notify->DisplayMessage(0,"");
_Settings->SaveBool(Debugger_ShowRecompMemSize,!_Settings->LoadBool(Debugger_ShowRecompMemSize));
break;
case ID_DEBUG_SHOW_CHECK_OPUSAGE:
_Settings->SaveBool(Debugger_ShowCheckOpUsageErrors,!_Settings->LoadBool(Debugger_ShowCheckOpUsageErrors));
case ID_DEBUG_SHOW_DIV_BY_ZERO:
_Settings->SaveBool(Debugger_ShowDivByZero,!_Settings->LoadBool(Debugger_ShowDivByZero));
break;
case ID_DEBUG_GENERATE_LOG_FILES:
_Settings->SaveBool(Debugger_GenerateLogFiles,!_Settings->LoadBool(Debugger_GenerateLogFiles));
@ -942,6 +942,7 @@ void CMainMenu::FillOutMenu ( MENU_HANDLE hMenu ) {
MenuItemList DebugR4300Menu;
MenuItemList DebugMemoryMenu;
MenuItemList DebugInterrupt;
MenuItemList DebugNotificationMenu;
if (bHaveDebugger()) {
/* Debug - Interrupt
*******************/
@ -1069,6 +1070,24 @@ void CMainMenu::FillOutMenu ( MENU_HANDLE hMenu ) {
DebugMenu.push_back(Item);
}
/* Notification Menu
*******************/
Item.Reset(ID_DEBUG_SHOW_UNHANDLED_MEM,EMPTY_STRING,EMPTY_STDSTR,NULL,"On Unhandled Memory Actions" );
if (_Settings->LoadBool(Debugger_ShowUnhandledMemory)) {
Item.ItemTicked = true;
}
DebugNotificationMenu.push_back(Item);
Item.Reset(ID_DEBUG_SHOW_PIF_ERRORS,EMPTY_STRING,EMPTY_STDSTR,NULL,"On PIF Errors" );
if (_Settings->LoadBool(Debugger_ShowPifErrors)) {
Item.ItemTicked = true;
}
DebugNotificationMenu.push_back(Item);
Item.Reset(ID_DEBUG_SHOW_DIV_BY_ZERO,EMPTY_STRING,EMPTY_STDSTR,NULL,"On Div By Zero" );
if (_Settings->LoadBool(Debugger_ShowDivByZero)) {
Item.ItemTicked = true;
}
DebugNotificationMenu.push_back(Item);
Item.Reset(SUB_MENU, EMPTY_STRING,EMPTY_STDSTR, &DebugR4300Menu,"&R4300i");
DebugMenu.push_back(Item);
Item.Reset(SUB_MENU, EMPTY_STRING,EMPTY_STDSTR, &DebugMemoryMenu,"Memory");
@ -1081,36 +1100,23 @@ void CMainMenu::FillOutMenu ( MENU_HANDLE hMenu ) {
DebugMenu.push_back(Item);
Item.Reset(SUB_MENU, EMPTY_STRING,EMPTY_STDSTR, &DebugLoggingMenu,"Logging");
DebugMenu.push_back(Item);
Item.Reset(SUB_MENU, EMPTY_STRING,EMPTY_STDSTR, &DebugNotificationMenu,"Notification");
DebugMenu.push_back(Item);
DebugMenu.push_back(MENU_ITEM(SPLITER));
Item.Reset(ID_DEBUG_SHOW_TLB_MISSES,EMPTY_STRING,EMPTY_STDSTR,NULL,"Show TLB Misses" );
if (_Settings->LoadBool(Debugger_ShowTLBMisses)) {
Item.ItemTicked = true;
}
Item.Reset(ID_DEBUG_SHOW_UNHANDLED_MEM,EMPTY_STRING,EMPTY_STDSTR,NULL,"Show Unhandled Memory Actions" );
if (_Settings->LoadBool(Debugger_ShowUnhandledMemory)) {
Item.ItemTicked = true;
}
DebugMenu.push_back(Item);
Item.Reset(ID_DEBUG_SHOW_PIF_ERRORS,EMPTY_STRING,EMPTY_STDSTR,NULL,"Show PIF Errors" );
if (_Settings->LoadBool(Debugger_ShowPifErrors)) {
Item.ItemTicked = true;
}
DebugMenu.push_back(Item);
Item.Reset(ID_DEBUG_SHOW_DLIST_COUNT,EMPTY_STRING,EMPTY_STDSTR,NULL,"Show Alist/Dlist Counters" );
Item.Reset(ID_DEBUG_SHOW_DLIST_COUNT,EMPTY_STRING,EMPTY_STDSTR,NULL,"Display Alist/Dlist Count" );
if (_Settings->LoadBool(Debugger_ShowDListAListCount)) {
Item.ItemTicked = true;
}
DebugMenu.push_back(Item);
Item.Reset(ID_DEBUG_SHOW_RECOMP_MEM_SIZE,EMPTY_STRING,EMPTY_STDSTR,NULL,"Show Recompile Memory Buffer size" );
Item.Reset(ID_DEBUG_SHOW_RECOMP_MEM_SIZE,EMPTY_STRING,EMPTY_STDSTR,NULL,"Display Recompiler Code Buffer Size" );
if (_Settings->LoadBool(Debugger_ShowRecompMemSize)) {
Item.ItemTicked = true;
}
DebugMenu.push_back(Item);
Item.Reset(ID_DEBUG_SHOW_CHECK_OPUSAGE,EMPTY_STRING,EMPTY_STDSTR,NULL,"Show Check Opcode Usage Errors" );
if (_Settings->LoadBool(Debugger_ShowCheckOpUsageErrors)) {
Item.ItemTicked = true;
}
DebugMenu.push_back(Item);
DebugMenu.push_back(MENU_ITEM(SPLITER));
Item.Reset(ID_DEBUG_GENERATE_LOG_FILES,EMPTY_STRING,EMPTY_STDSTR,NULL,"Generate Log Files" );
if (_Settings->LoadBool(Debugger_GenerateLogFiles)) {

View File

@ -30,7 +30,7 @@ enum MainMenuID {
//Debugger Menu
ID_DEBUG_SHOW_TLB_MISSES, ID_DEBUG_SHOW_UNHANDLED_MEM, ID_DEBUG_SHOW_PIF_ERRORS,
ID_DEBUG_SHOW_DLIST_COUNT, ID_DEBUG_SHOW_RECOMP_MEM_SIZE,ID_DEBUG_SHOW_CHECK_OPUSAGE,
ID_DEBUG_SHOW_DLIST_COUNT, ID_DEBUG_SHOW_RECOMP_MEM_SIZE,ID_DEBUG_SHOW_DIV_BY_ZERO,
ID_DEBUG_GENERATE_LOG_FILES, ID_DEBUG_DISABLE_GAMEFIX,
ID_DEBUGGER_LOGOPTIONS, ID_DEBUGGER_GENERATELOG, ID_DEBUGGER_DUMPMEMORY, ID_DEBUGGER_SEARCHMEMORY,
ID_DEBUGGER_TLBENTRIES, ID_DEBUGGER_BREAKPOINTS, ID_DEBUGGER_MEMORY, ID_DEBUGGER_R4300REGISTERS,