vgturtle127's Beautification 14 - Source\Project64-video directory and final cleanup
This commit is contained in:
parent
d6bf03bf20
commit
ee864797ab
|
@ -40,7 +40,7 @@ void JavaBridge::GfxThreadDone()
|
|||
JNIEnv *env = Android_JNI_GetEnv();
|
||||
if (g_GLThread != NULL && env != NULL)
|
||||
{
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "calling java GLThread::ThreadExiting");
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "Calling java GLThread::ThreadExiting");
|
||||
jclass GLThreadClass = env->GetObjectClass(g_GLThread);
|
||||
jmethodID midThreadExiting = env->GetMethodID(GLThreadClass, "ThreadExiting", "()V");
|
||||
env->CallVoidMethod(g_GLThread, midThreadExiting);
|
||||
|
|
|
@ -16,7 +16,7 @@ public:
|
|||
void GfxThreadDone();
|
||||
void SwapWindow();
|
||||
|
||||
// ROM List
|
||||
// ROM list
|
||||
void RomListReset(void);
|
||||
void RomListAddItem(const char * FullFileName, const char * FileName, const char * GoodName, uint32_t TextColor);
|
||||
void RomListLoaded(void);
|
||||
|
|
|
@ -125,7 +125,7 @@ void CNotificationImp::BreakPoint(const char * FileName, int32_t LineNumber)
|
|||
}
|
||||
else
|
||||
{
|
||||
FatalError("Fatal Error: Emulation stopped");
|
||||
FatalError("Fatal error: emulation stopped");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -210,7 +210,7 @@ void AddRecentRom(const char * ImagePath)
|
|||
|
||||
if (g_JavaBridge)
|
||||
{
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "calling RecentRomsUpdated");
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "Calling RecentRomsUpdated");
|
||||
g_JavaBridge->RecentRomsUpdated();
|
||||
}
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "Done");
|
||||
|
@ -220,7 +220,7 @@ void GameCpuRunning(void * /*NotUsed*/)
|
|||
{
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "Start");
|
||||
bool Running = g_Settings->LoadBool(GameRunning_CPU_Running);
|
||||
WriteTrace(TraceUserInterface, TraceDebug, Running ? "Game Started" : "Game Stopped");
|
||||
WriteTrace(TraceUserInterface, TraceDebug, Running ? "Game started" : "Game stopped");
|
||||
JNIEnv *env = Android_JNI_GetEnv();
|
||||
if (Running)
|
||||
{
|
||||
|
@ -232,7 +232,7 @@ void GameCpuRunning(void * /*NotUsed*/)
|
|||
g_System->RefreshGameSettings();
|
||||
|
||||
int RunCount = UISettingsLoadDword(Game_RunCount);
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "Setting Run Count to %d", RunCount + 1);
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "Setting run count to %d", RunCount + 1);
|
||||
UISettingsSaveDword(Game_RunCount, RunCount + 1);
|
||||
if (env != NULL)
|
||||
{
|
||||
|
@ -265,12 +265,12 @@ void GameCpuRunning(void * /*NotUsed*/)
|
|||
WriteTrace(TraceUserInterface, TraceError, "No Java bridge");
|
||||
}
|
||||
|
||||
// call in to java that emulation done
|
||||
// Call in to java that emulation done
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "Clean up global activity");
|
||||
env->DeleteGlobalRef(g_Activity);
|
||||
g_Activity = NULL;
|
||||
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "Clean up global gl thread");
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "Clean up global GL thread");
|
||||
if (g_JavaBridge)
|
||||
{
|
||||
g_JavaBridge->GfxThreadDone();
|
||||
|
@ -300,7 +300,7 @@ EXPORT jboolean CALL Java_emu_project64_jni_NativeExports_appInit(JNIEnv* env, j
|
|||
Notify().DisplayMessage(10, " / ____/ / / /_/ / / / __/ /__/ /_/ /_/ /__ __/");
|
||||
Notify().DisplayMessage(10, "/_/ /_/ \\____/_/ /\\___/\\___/\\__/\\____/ /_/");
|
||||
Notify().DisplayMessage(10, " /___/");
|
||||
Notify().DisplayMessage(10, "http://www.pj64-emu.com/");
|
||||
Notify().DisplayMessage(10, "https://www.pj64-emu.com/");
|
||||
Notify().DisplayMessage(10, stdstr_f("%s Version %s", VER_FILE_DESCRIPTION_STR, VER_FILE_VERSION_STR).c_str());
|
||||
Notify().DisplayMessage(10, "");
|
||||
|
||||
|
|
|
@ -89,8 +89,8 @@ typedef struct
|
|||
Function: CloseDLL
|
||||
Purpose: This function is called when the emulator is closing
|
||||
down allowing the DLL to de-initialize.
|
||||
input: none
|
||||
output: none
|
||||
Input: None
|
||||
Output: None
|
||||
*/
|
||||
|
||||
EXPORT void CALL CloseDLL(void);
|
||||
|
@ -99,15 +99,15 @@ EXPORT void CALL CloseDLL(void);
|
|||
Function: ControllerCommand
|
||||
Purpose: To process the raw data that has just been sent to a
|
||||
specific controller.
|
||||
input: - Controller Number (0 to 3) and -1 signaling end of
|
||||
Input: Controller Number (0 to 3) and -1 signaling end of
|
||||
processing the PIF RAM.
|
||||
- Pointer of data to be processed.
|
||||
output: none
|
||||
Output: None
|
||||
|
||||
note: This function is only needed if the DLL is allowing raw
|
||||
Note: This function is only needed if the DLL is allowing raw
|
||||
data, or the plugin is set to raw
|
||||
|
||||
the data that is being processed looks like this:
|
||||
The data that is being processed looks like this:
|
||||
initialize controller: 01 03 00 FF FF FF
|
||||
read controller: 01 04 01 FF FF FF FF
|
||||
*/
|
||||
|
@ -118,8 +118,8 @@ EXPORT void CALL ControllerCommand(int Control, uint8_t * Command);
|
|||
Function: DllAbout
|
||||
Purpose: This function is optional function that is provided
|
||||
to give further information about the DLL.
|
||||
input: a handle to the window that calls this function
|
||||
output: none
|
||||
Input: A handle to the window that calls this function
|
||||
Output: None
|
||||
*/
|
||||
|
||||
EXPORT void CALL DllAbout(void * hParent);
|
||||
|
@ -128,8 +128,8 @@ EXPORT void CALL DllAbout(void * hParent);
|
|||
Function: DllConfig
|
||||
Purpose: This function is optional function that is provided
|
||||
to allow the user to configure the DLL
|
||||
input: a handle to the window that calls this function
|
||||
output: none
|
||||
Input: A handle to the window that calls this function
|
||||
Output: None
|
||||
*/
|
||||
|
||||
EXPORT void CALL DllConfig(void * hParent);
|
||||
|
@ -138,8 +138,8 @@ EXPORT void CALL DllConfig(void * hParent);
|
|||
Function: DllTest
|
||||
Purpose: This function is optional function that is provided
|
||||
to allow the user to test the DLL
|
||||
input: a handle to the window that calls this function
|
||||
output: none
|
||||
Input: A handle to the window that calls this function
|
||||
Output: None
|
||||
*/
|
||||
|
||||
EXPORT void CALL DllTest(void * hParent);
|
||||
|
@ -148,9 +148,9 @@ EXPORT void CALL DllTest(void * hParent);
|
|||
Function: GetDllInfo
|
||||
Purpose: This function allows the emulator to gather information
|
||||
about the DLL by filling in the PluginInfo structure.
|
||||
input: a pointer to a PLUGIN_INFO structure that needs to be
|
||||
filled by the function. (see def above)
|
||||
output: none
|
||||
Input: A pointer to a PLUGIN_INFO structure that needs to be
|
||||
filled by the function (see def above)
|
||||
Output: None
|
||||
*/
|
||||
|
||||
EXPORT void CALL GetDllInfo(PLUGIN_INFO * PluginInfo);
|
||||
|
@ -158,10 +158,10 @@ EXPORT void CALL GetDllInfo(PLUGIN_INFO * PluginInfo);
|
|||
/*
|
||||
Function: GetKeys
|
||||
Purpose: To get the current state of the controllers buttons.
|
||||
input: - Controller Number (0 to 3)
|
||||
Input: Controller Number (0 to 3)
|
||||
- A pointer to a BUTTONS structure to be filled with
|
||||
the controller state.
|
||||
output: none
|
||||
Output: None
|
||||
*/
|
||||
|
||||
EXPORT void CALL GetKeys(int32_t Control, BUTTONS * Keys);
|
||||
|
@ -170,10 +170,10 @@ EXPORT void CALL GetKeys(int32_t Control, BUTTONS * Keys);
|
|||
Function: InitiateControllers
|
||||
Purpose: This function initializes how each of the controllers
|
||||
should be handled.
|
||||
input: - The handle to the main window.
|
||||
Input: - The handle to the main window.
|
||||
- A controller structure that needs to be filled for
|
||||
the emulator to know how to handle each controller.
|
||||
output: none
|
||||
Output: None
|
||||
*/
|
||||
|
||||
EXPORT void CALL InitiateControllers(CONTROL_INFO ControlInfo);
|
||||
|
@ -182,11 +182,11 @@ EXPORT void CALL InitiateControllers(CONTROL_INFO ControlInfo);
|
|||
Function: ReadController
|
||||
Purpose: To process the raw data in the PIF RAM that is about to
|
||||
be read.
|
||||
input: - Controller Number (0 to 3) and -1 signaling end of
|
||||
Input: Controller Number (0 to 3) and -1 signaling end of
|
||||
processing the PIF RAM.
|
||||
- Pointer of data to be processed.
|
||||
output: none
|
||||
note: This function is only needed if the DLL is allowing raw
|
||||
Output: None
|
||||
Note: This function is only needed if the DLL is allowing raw
|
||||
data.
|
||||
*/
|
||||
|
||||
|
@ -195,18 +195,18 @@ EXPORT void CALL ReadController(int Control, uint8_t * Command);
|
|||
/*
|
||||
Function: RomClosed
|
||||
Purpose: This function is called when a ROM is closed.
|
||||
input: none
|
||||
output: none
|
||||
Input: None
|
||||
Output: None
|
||||
*/
|
||||
|
||||
EXPORT void CALL RomClosed(void);
|
||||
|
||||
/*
|
||||
Function: RomOpen
|
||||
Purpose: This function is called when a ROM is open. (from the
|
||||
Purpose: This function is called when a ROM is open (from the
|
||||
emulation thread)
|
||||
input: none
|
||||
output: none
|
||||
Input: None
|
||||
Output: None
|
||||
*/
|
||||
|
||||
EXPORT void CALL RomOpen(void);
|
||||
|
@ -215,8 +215,8 @@ EXPORT void CALL RomOpen(void);
|
|||
Function: WM_KeyDown
|
||||
Purpose: To pass the WM_KeyDown message from the emulator to the
|
||||
plugin.
|
||||
input: wParam and lParam of the WM_KEYDOWN message.
|
||||
output: none
|
||||
Input: wParam and lParam of the WM_KEYDOWN message.
|
||||
Output: None
|
||||
*/
|
||||
|
||||
EXPORT void CALL WM_KeyDown(uint32_t wParam, uint32_t lParam);
|
||||
|
@ -225,8 +225,8 @@ EXPORT void CALL WM_KeyDown(uint32_t wParam, uint32_t lParam);
|
|||
Function: WM_KeyUp
|
||||
Purpose: To pass the WM_KEYUP message from the emulator to the
|
||||
plugin.
|
||||
input: wParam and lParam of the WM_KEYDOWN message.
|
||||
output: none
|
||||
Input: wParam and lParam of the WM_KEYDOWN message.
|
||||
Output: None
|
||||
*/
|
||||
|
||||
EXPORT void CALL WM_KeyUp(uint32_t wParam, uint32_t lParam);
|
||||
|
|
|
@ -12,46 +12,46 @@ BUTTONS g_buttons;
|
|||
|
||||
void ShowAboutWindow (void * hParent);
|
||||
|
||||
/******************************************************************
|
||||
/*
|
||||
Function: CloseDLL
|
||||
Purpose: This function is called when the emulator is closing
|
||||
down allowing the DLL to de-initialize.
|
||||
input: none
|
||||
output: none
|
||||
*******************************************************************/
|
||||
Input: None
|
||||
Output: None
|
||||
*/
|
||||
|
||||
EXPORT void CALL CloseDLL (void)
|
||||
{
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
/*
|
||||
Function: ControllerCommand
|
||||
Purpose: To process the raw data that has just been sent to a
|
||||
specific controller.
|
||||
input: - Controller Number (0 to 3) and -1 signaling end of
|
||||
Input: Controller Number (0 to 3) and -1 signaling end of
|
||||
processing the PIF RAM.
|
||||
- Pointer of data to be processed.
|
||||
output: none
|
||||
Output: None
|
||||
|
||||
note: This function is only needed if the DLL is allowing raw
|
||||
Note: This function is only needed if the DLL is allowing raw
|
||||
data, or the plugin is set to raw
|
||||
|
||||
the data that is being processed looks like this:
|
||||
initialize controller: 01 03 00 FF FF FF
|
||||
read controller: 01 04 01 FF FF FF FF
|
||||
*******************************************************************/
|
||||
The data that is being processed looks like this:
|
||||
Initialize controller: 01 03 00 FF FF FF
|
||||
Read controller: 01 04 01 FF FF FF FF
|
||||
*/
|
||||
|
||||
EXPORT void CALL ControllerCommand ( int /*Control*/, uint8_t * /*Command*/)
|
||||
{
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
/*
|
||||
Function: DllAbout
|
||||
Purpose: This function is optional function that is provided
|
||||
to give further information about the DLL.
|
||||
input: a handle to the window that calls this function
|
||||
output: none
|
||||
*******************************************************************/
|
||||
Input: A handle to the window that calls this function
|
||||
Output: None
|
||||
*/
|
||||
|
||||
EXPORT void CALL DllAbout ( void * hParent )
|
||||
{
|
||||
|
@ -60,38 +60,38 @@ EXPORT void CALL DllAbout ( void * hParent )
|
|||
#endif
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
/*
|
||||
Function: DllConfig
|
||||
Purpose: This function is optional function that is provided
|
||||
to allow the user to configure the DLL
|
||||
input: a handle to the window that calls this function
|
||||
output: none
|
||||
*******************************************************************/
|
||||
Input: A handle to the window that calls this function
|
||||
Output: None
|
||||
*/
|
||||
|
||||
EXPORT void CALL DllConfig ( void * /*hParent*/ )
|
||||
{
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
/*
|
||||
Function: DllTest
|
||||
Purpose: This function is optional function that is provided
|
||||
to allow the user to test the DLL
|
||||
input: a handle to the window that calls this function
|
||||
output: none
|
||||
*******************************************************************/
|
||||
Input: A handle to the window that calls this function
|
||||
Output: None
|
||||
*/
|
||||
|
||||
EXPORT void CALL DllTest ( void * /*hParent*/ )
|
||||
{
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
/*
|
||||
Function: GetDllInfo
|
||||
Purpose: This function allows the emulator to gather information
|
||||
about the DLL by filling in the PluginInfo structure.
|
||||
input: a pointer to a PLUGIN_INFO structure that needs to be
|
||||
Input: A pointer to a PLUGIN_INFO structure that needs to be
|
||||
filled by the function. (see def above)
|
||||
output: none
|
||||
*******************************************************************/
|
||||
Output: None
|
||||
*/
|
||||
|
||||
EXPORT void CALL GetDllInfo ( PLUGIN_INFO * PluginInfo )
|
||||
{
|
||||
|
@ -104,14 +104,14 @@ EXPORT void CALL GetDllInfo ( PLUGIN_INFO * PluginInfo )
|
|||
#endif
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
/*
|
||||
Function: GetKeys
|
||||
Purpose: To get the current state of the controllers buttons.
|
||||
input: - Controller Number (0 to 3)
|
||||
Input: Controller Number (0 to 3)
|
||||
- A pointer to a BUTTONS structure to be filled with
|
||||
the controller state.
|
||||
output: none
|
||||
*******************************************************************/
|
||||
Output: None
|
||||
*/
|
||||
|
||||
EXPORT void CALL GetKeys(int Control, BUTTONS * Keys )
|
||||
{
|
||||
|
@ -121,15 +121,15 @@ EXPORT void CALL GetKeys(int Control, BUTTONS * Keys )
|
|||
}
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
/*
|
||||
Function: InitiateControllers
|
||||
Purpose: This function initializes how each of the controllers
|
||||
should be handled.
|
||||
input: - The handle to the main window.
|
||||
Input: The handle to the main window.
|
||||
- A controller structure that needs to be filled for
|
||||
the emulator to know how to handle each controller.
|
||||
output: none
|
||||
*******************************************************************/
|
||||
Output: None
|
||||
*/
|
||||
|
||||
EXPORT void CALL InitiateControllers (CONTROL_INFO ControlInfo)
|
||||
{
|
||||
|
@ -138,65 +138,65 @@ EXPORT void CALL InitiateControllers (CONTROL_INFO ControlInfo)
|
|||
g_control_info.Controls[0].Plugin = PLUGIN_MEMPAK;
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
/*
|
||||
Function: ReadController
|
||||
Purpose: To process the raw data in the PIF RAM that is about to
|
||||
be read.
|
||||
input: - Controller Number (0 to 3) and -1 signaling end of
|
||||
Input: Controller Number (0 to 3) and -1 signaling end of
|
||||
processing the PIF RAM.
|
||||
- Pointer of data to be processed.
|
||||
output: none
|
||||
note: This function is only needed if the DLL is allowing raw
|
||||
Output: None
|
||||
Note: This function is only needed if the DLL is allowing raw
|
||||
data.
|
||||
*******************************************************************/
|
||||
*/
|
||||
|
||||
EXPORT void CALL ReadController ( int /*Control*/, uint8_t * /*Command*/ )
|
||||
{
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
/*
|
||||
Function: RomClosed
|
||||
Purpose: This function is called when a ROM is closed.
|
||||
input: none
|
||||
output: none
|
||||
*******************************************************************/
|
||||
Input: None
|
||||
Output: None
|
||||
*/
|
||||
|
||||
EXPORT void CALL RomClosed (void)
|
||||
{
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
/*
|
||||
Function: RomOpen
|
||||
Purpose: This function is called when a ROM is open. (from the
|
||||
Purpose: This function is called when a ROM is open (from the
|
||||
emulation thread)
|
||||
input: none
|
||||
output: none
|
||||
*******************************************************************/
|
||||
Input: None
|
||||
Output: None
|
||||
*/
|
||||
|
||||
EXPORT void CALL RomOpen (void)
|
||||
{
|
||||
memset(&g_buttons, 0, sizeof(g_buttons));
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
/*
|
||||
Function: WM_KeyDown
|
||||
Purpose: To pass the WM_KeyDown message from the emulator to the
|
||||
plugin.
|
||||
input: wParam and lParam of the WM_KEYDOWN message.
|
||||
output: none
|
||||
*******************************************************************/
|
||||
Input: wParam and lParam of the WM_KEYDOWN message.
|
||||
Output: None
|
||||
*/
|
||||
|
||||
EXPORT void CALL WM_KeyDown( uint32_t /*wParam*/, uint32_t /*lParam*/ )
|
||||
{
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
/*
|
||||
Function: WM_KeyUp
|
||||
Purpose: To pass the WM_KEYUP message from the emulator to the
|
||||
plugin.
|
||||
input: wParam and lParam of the WM_KEYDOWN message.
|
||||
output: none
|
||||
*******************************************************************/
|
||||
Input: wParam and lParam of the WM_KEYDOWN message.
|
||||
Output: None
|
||||
*/
|
||||
|
||||
EXPORT void CALL WM_KeyUp( uint32_t /*wParam*/, uint32_t /*lParam*/ )
|
||||
{
|
||||
|
|
|
@ -5,6 +5,6 @@
|
|||
void ShowAboutWindow (void * hParent)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
MessageBox((HWND)hParent,L"Android Input Plugin",L"Dll About",MB_OK);
|
||||
MessageBox((HWND)hParent,L"Android input plugin",L"Dll About",MB_OK);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Project64 - A Nintendo 64 emulator
|
||||
// http://www.pj64-emu.com/
|
||||
// https://www.pj64-emu.com/
|
||||
// Copyright(C) 2001-2021 Project64
|
||||
// Copyright(C) 2014 Bobby Smiles
|
||||
// Copyright(C) 2009 Richard Goedeken
|
||||
|
@ -286,7 +286,7 @@ void alist_envmix_exp( CHle * hle, bool init, bool aux, uint16_t dmem_dl, uint16
|
|||
ramps[1].value = *(int32_t *)(save_buffer + 18); // 14-15
|
||||
}
|
||||
|
||||
// init which ensure ramp.step != 0 iff ramp.value == ramp.target
|
||||
// Initialize which ensure ramp.step != 0 iff ramp.value == ramp.target
|
||||
ramps[0].step = ramps[0].target - ramps[0].value;
|
||||
ramps[1].step = ramps[1].target - ramps[1].value;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Project64 - A Nintendo 64 emulator
|
||||
// http://www.pj64-emu.com/
|
||||
// https://www.pj64-emu.com/
|
||||
// Copyright(C) 2001-2021 Project64
|
||||
// Copyright(C) 2014 Bobby Smiles
|
||||
// GNU/GPLv2 licensed: https://gnu.org/licenses/gpl-2.0.html
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Project64 - A Nintendo 64 emulator
|
||||
// http://www.pj64-emu.com/
|
||||
// https://www.pj64-emu.com/
|
||||
// Copyright(C) 2001-2021 Project64
|
||||
// Copyright(C) 2014 Bobby Smiles
|
||||
// Copyright(C) 2009 Richard Goedeken
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Project64 - A Nintendo 64 emulator
|
||||
// http://www.pj64-emu.com/
|
||||
// https://www.pj64-emu.com/
|
||||
// Copyright(C) 2001-2021 Project64
|
||||
// Copyright(C) 2014 Bobby Smiles
|
||||
// Copyright(C) 2009 Richard Goedeken
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Project64 - A Nintendo 64 emulator
|
||||
// http://www.pj64-emu.com/
|
||||
// https://www.pj64-emu.com/
|
||||
// Copyright(C) 2001-2021 Project64
|
||||
// Copyright(C) 2014 Bobby Smiles
|
||||
// Copyright(C) 2009 Richard Goedeken
|
||||
|
@ -284,12 +284,12 @@ static void FILTER(CHle * hle, uint32_t w1, uint32_t w2)
|
|||
|
||||
if (flags > 1) {
|
||||
hle->alist_nead().filter_count = w1;
|
||||
hle->alist_nead().filter_lut_address[0] = address; // t6
|
||||
hle->alist_nead().filter_lut_address[0] = address; // T6
|
||||
}
|
||||
else {
|
||||
uint16_t dmem = w1;
|
||||
|
||||
hle->alist_nead().filter_lut_address[1] = address + 0x10; // t5
|
||||
hle->alist_nead().filter_lut_address[1] = address + 0x10; // T5
|
||||
alist_filter(hle, dmem, hle->alist_nead().filter_count, address, hle->alist_nead().filter_lut_address);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Project64 - A Nintendo 64 emulator
|
||||
// http://www.pj64-emu.com/
|
||||
// https://www.pj64-emu.com/
|
||||
// Copyright(C) 2001-2021 Project64
|
||||
// Copyright(C) 2014 Bobby Smiles
|
||||
// GNU/GPLv2 licensed: https://gnu.org/licenses/gpl-2.0.html
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Project64 - A Nintendo 64 emulator
|
||||
// http://www.pj64-emu.com/
|
||||
// https://www.pj64-emu.com/
|
||||
// Copyright(C) 2001-2021 Project64
|
||||
// Copyright(C) 2014 Bobby Smiles
|
||||
// GNU/GPLv2 licensed: https://gnu.org/licenses/gpl-2.0.html
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Project64 - A Nintendo 64 emulator
|
||||
// http://www.pj64-emu.com/
|
||||
// https://www.pj64-emu.com/
|
||||
// Copyright(C) 2001-2021 Project64
|
||||
// Copyright(C) 2014 Bobby Smiles
|
||||
// GNU/GPLv2 licensed: https://gnu.org/licenses/gpl-2.0.html
|
||||
|
@ -14,7 +14,7 @@ static inline int16_t adpcm_predict_sample(uint8_t byte, uint8_t mask,
|
|||
unsigned lshift, unsigned rshift)
|
||||
{
|
||||
int16_t sample = (uint16_t)(byte & mask) << lshift;
|
||||
sample >>= rshift; // signed
|
||||
sample >>= rshift; // Signed
|
||||
return sample;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Project64 - A Nintendo 64 emulator
|
||||
// http://www.pj64-emu.com/
|
||||
// https://www.pj64-emu.com/
|
||||
// Copyright(C) 2001-2021 Project64
|
||||
// Copyright(C) 2012 Bobby Smiles
|
||||
// Copyright(C) 2009 Richard Goedeken
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Project64 - A Nintendo 64 emulator
|
||||
// http://www.pj64-emu.com/
|
||||
// https://www.pj64-emu.com/
|
||||
// Copyright(C) 2001-2021 Project64
|
||||
// Copyright(C) 2014 Bobby Smiles
|
||||
// Copyright(C) 2009 Richard Goedeken
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Project64 - A Nintendo 64 emulator
|
||||
// http://www.pj64-emu.com/
|
||||
// https://www.pj64-emu.com/
|
||||
// Copyright(C) 2001-2021 Project64
|
||||
// Copyright(C) 2012 Bobby Smiles
|
||||
// Copyright(C) 2009 Richard Goedeken
|
||||
|
@ -294,7 +294,7 @@ void CHle::normal_task_dispatching(void)
|
|||
return;
|
||||
}
|
||||
|
||||
WarnMessage("unknown OSTask: sum: %x PC:%x", sum, *m_sp_pc);
|
||||
WarnMessage("Unknown OSTask: sum: %x PC:%x", sum, *m_sp_pc);
|
||||
#ifdef ENABLE_TASK_DUMP
|
||||
dump_unknown_task(this, sum);
|
||||
#endif
|
||||
|
@ -311,7 +311,7 @@ void CHle::non_task_dispatching(void)
|
|||
return;
|
||||
}
|
||||
|
||||
WarnMessage("unknown RSP code: sum: %x PC:%x", sum, *m_sp_pc);
|
||||
WarnMessage("Unknown RSP code: sum: %x PC:%x", sum, *m_sp_pc);
|
||||
#ifdef ENABLE_TASK_DUMP
|
||||
dump_unknown_non_task(hle, sum);
|
||||
#endif
|
||||
|
@ -324,7 +324,7 @@ void CHle::non_task_dispatching(void)
|
|||
void CHle::VerboseMessage(const char *message, ...)
|
||||
{
|
||||
#if defined(_WIN32) && defined(_DEBUG)
|
||||
// These can get annoying.
|
||||
// These can get annoying
|
||||
#if 0
|
||||
MessageBox(NULL, message, "HLE verbose message", MB_OK);
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Project64 - A Nintendo 64 emulator
|
||||
// http://www.pj64-emu.com/
|
||||
// https://www.pj64-emu.com/
|
||||
// Copyright(C) 2001-2021 Project64
|
||||
// Copyright(C) 2014 Bobby Smiles
|
||||
// GNU/GPLv2 licensed: https://gnu.org/licenses/gpl-2.0.html
|
||||
|
@ -13,59 +13,59 @@
|
|||
|
||||
enum
|
||||
{
|
||||
SP_CLR_HALT = 0x00001, /* Bit 0: Clear halt */
|
||||
SP_SET_HALT = 0x00002, /* Bit 1: Set halt */
|
||||
SP_CLR_BROKE = 0x00004, /* Bit 2: Clear broke */
|
||||
SP_CLR_INTR = 0x00008, /* Bit 3: Clear INTR */
|
||||
SP_SET_INTR = 0x00010, /* Bit 4: Set INTR */
|
||||
SP_CLR_SSTEP = 0x00020, /* Bit 5: Clear SSTEP */
|
||||
SP_SET_SSTEP = 0x00040, /* Bit 6: Set SSTEP */
|
||||
SP_CLR_INTR_BREAK = 0x00080, /* Bit 7: Clear INTR on break */
|
||||
SP_SET_INTR_BREAK = 0x00100, /* Bit 8: Set INTR on break */
|
||||
SP_CLR_SIG0 = 0x00200, /* Bit 9: Clear signal 0 */
|
||||
SP_SET_SIG0 = 0x00400, /* Bit 10: Set signal 0 */
|
||||
SP_CLR_SIG1 = 0x00800, /* Bit 11: Clear signal 1 */
|
||||
SP_SET_SIG1 = 0x01000, /* Bit 12: Set signal 1 */
|
||||
SP_CLR_SIG2 = 0x02000, /* Bit 13: Clear signal 2 */
|
||||
SP_SET_SIG2 = 0x04000, /* Bit 14: Set signal 2 */
|
||||
SP_CLR_SIG3 = 0x08000, /* Bit 15: Clear signal 3 */
|
||||
SP_SET_SIG3 = 0x10000, /* Bit 16: Set signal 3 */
|
||||
SP_CLR_SIG4 = 0x20000, /* Bit 17: Clear signal 4 */
|
||||
SP_SET_SIG4 = 0x40000, /* Bit 18: Set signal 4 */
|
||||
SP_CLR_SIG5 = 0x80000, /* Bit 19: Clear signal 5 */
|
||||
SP_SET_SIG5 = 0x100000, /* Bit 20: Set signal 5 */
|
||||
SP_CLR_SIG6 = 0x200000, /* Bit 21: Clear signal 6 */
|
||||
SP_SET_SIG6 = 0x400000, /* Bit 22: Set signal 6 */
|
||||
SP_CLR_SIG7 = 0x800000, /* Bit 23: Clear signal 7 */
|
||||
SP_SET_SIG7 = 0x1000000, /* Bit 24: Set signal 7 */
|
||||
SP_CLR_HALT = 0x00001, // Bit 0: Clear halt
|
||||
SP_SET_HALT = 0x00002, // Bit 1: Set halt
|
||||
SP_CLR_BROKE = 0x00004, // Bit 2: Clear broke
|
||||
SP_CLR_INTR = 0x00008, // Bit 3: Clear INTR
|
||||
SP_SET_INTR = 0x00010, // Bit 4: Set INTR
|
||||
SP_CLR_SSTEP = 0x00020, // Bit 5: Clear SSTEP
|
||||
SP_SET_SSTEP = 0x00040, // Bit 6: Set SSTEP
|
||||
SP_CLR_INTR_BREAK = 0x00080, // Bit 7: Clear INTR on break
|
||||
SP_SET_INTR_BREAK = 0x00100, // Bit 8: Set INTR on break
|
||||
SP_CLR_SIG0 = 0x00200, // Bit 9: Clear signal 0
|
||||
SP_SET_SIG0 = 0x00400, // Bit 10: Set signal 0
|
||||
SP_CLR_SIG1 = 0x00800, // Bit 11: Clear signal 1
|
||||
SP_SET_SIG1 = 0x01000, // Bit 12: Set signal 1
|
||||
SP_CLR_SIG2 = 0x02000, // Bit 13: Clear signal 2
|
||||
SP_SET_SIG2 = 0x04000, // Bit 14: Set signal 2
|
||||
SP_CLR_SIG3 = 0x08000, // Bit 15: Clear signal 3
|
||||
SP_SET_SIG3 = 0x10000, // Bit 16: Set signal 3
|
||||
SP_CLR_SIG4 = 0x20000, // Bit 17: Clear signal 4
|
||||
SP_SET_SIG4 = 0x40000, // Bit 18: Set signal 4
|
||||
SP_CLR_SIG5 = 0x80000, // Bit 19: Clear signal 5
|
||||
SP_SET_SIG5 = 0x100000, // Bit 20: Set signal 5
|
||||
SP_CLR_SIG6 = 0x200000, // Bit 21: Clear signal 6
|
||||
SP_SET_SIG6 = 0x400000, // Bit 22: Set signal 6
|
||||
SP_CLR_SIG7 = 0x800000, // Bit 23: Clear signal 7
|
||||
SP_SET_SIG7 = 0x1000000, // Bit 24: Set signal 7
|
||||
|
||||
SP_STATUS_HALT = 0x001, /* Bit 0: Halt */
|
||||
SP_STATUS_BROKE = 0x002, /* Bit 1: Broke */
|
||||
SP_STATUS_DMA_BUSY = 0x004, /* Bit 2: DMA busy */
|
||||
SP_STATUS_DMA_FULL = 0x008, /* Bit 3: DMA full */
|
||||
SP_STATUS_IO_FULL = 0x010, /* Bit 4: IO full */
|
||||
SP_STATUS_SSTEP = 0x020, /* Bit 5: Single step */
|
||||
SP_STATUS_INTR_BREAK = 0x040, /* Bit 6: Interrupt on break */
|
||||
SP_STATUS_SIG0 = 0x080, /* Bit 7: Signal 0 set */
|
||||
SP_STATUS_SIG1 = 0x100, /* Bit 8: Signal 1 set */
|
||||
SP_STATUS_SIG2 = 0x200, /* Bit 9: Signal 2 set */
|
||||
SP_STATUS_SIG3 = 0x400, /* Bit 10: Signal 3 set */
|
||||
SP_STATUS_SIG4 = 0x800, /* Bit 11: Signal 4 set */
|
||||
SP_STATUS_SIG5 = 0x1000, /* Bit 12: Signal 5 set */
|
||||
SP_STATUS_SIG6 = 0x2000, /* Bit 13: Signal 6 set */
|
||||
SP_STATUS_SIG7 = 0x4000, /* Bit 14: Signal 7 set */
|
||||
SP_STATUS_HALT = 0x001, // Bit 0: Halt
|
||||
SP_STATUS_BROKE = 0x002, // Bit 1: Broke
|
||||
SP_STATUS_DMA_BUSY = 0x004, // Bit 2: DMA busy
|
||||
SP_STATUS_DMA_FULL = 0x008, // Bit 3: DMA full
|
||||
SP_STATUS_IO_FULL = 0x010, // Bit 4: IO full
|
||||
SP_STATUS_SSTEP = 0x020, // Bit 5: Single step
|
||||
SP_STATUS_INTR_BREAK = 0x040, // Bit 6: Interrupt on break
|
||||
SP_STATUS_SIG0 = 0x080, // Bit 7: Signal 0 set
|
||||
SP_STATUS_SIG1 = 0x100, // Bit 8: Signal 1 set
|
||||
SP_STATUS_SIG2 = 0x200, // Bit 9: Signal 2 set
|
||||
SP_STATUS_SIG3 = 0x400, // Bit 10: Signal 3 set
|
||||
SP_STATUS_SIG4 = 0x800, // Bit 11: Signal 4 set
|
||||
SP_STATUS_SIG5 = 0x1000, // Bit 12: Signal 5 set
|
||||
SP_STATUS_SIG6 = 0x2000, // Bit 13: Signal 6 set
|
||||
SP_STATUS_SIG7 = 0x4000, // Bit 14: Signal 7 set
|
||||
};
|
||||
|
||||
// MIPS interface flags
|
||||
|
||||
enum
|
||||
{
|
||||
MI_INTR_SP = 0x01, /* Bit 0: SP INTR */
|
||||
MI_INTR_SI = 0x02, /* Bit 1: SI INTR */
|
||||
MI_INTR_AI = 0x04, /* Bit 2: AI INTR */
|
||||
MI_INTR_VI = 0x08, /* Bit 3: VI INTR */
|
||||
MI_INTR_PI = 0x10, /* Bit 4: PI INTR */
|
||||
MI_INTR_DP = 0x20, /* Bit 5: DP INTR */
|
||||
MI_INTR_SP = 0x01, // Bit 0: SP INTR
|
||||
MI_INTR_SI = 0x02, // Bit 1: SI INTR
|
||||
MI_INTR_AI = 0x04, // Bit 2: AI INTR
|
||||
MI_INTR_VI = 0x08, // Bit 3: VI INTR
|
||||
MI_INTR_PI = 0x10, // Bit 4: PI INTR
|
||||
MI_INTR_DP = 0x20, // Bit 5: DP INTR
|
||||
};
|
||||
|
||||
class CHle
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Project64 - A Nintendo 64 emulator
|
||||
// http://www.pj64-emu.com/
|
||||
// https://www.pj64-emu.com/
|
||||
// Copyright(C) 2001-2021 Project64
|
||||
// Copyright(C) 2012 Bobby Smiles
|
||||
// Copyright(C) 2009 Richard Goedeken
|
||||
|
@ -373,7 +373,7 @@ static void decode_macroblock_ob(int16_t *macroblock, int32_t *y_dc, int32_t *u_
|
|||
for (sb = 0; sb < 6; ++sb) {
|
||||
int16_t tmp_sb[SUBBLOCK_SIZE];
|
||||
|
||||
// Update DC
|
||||
// Update decode
|
||||
int32_t dc = (int32_t)macroblock[0];
|
||||
switch (sb) {
|
||||
case 0:
|
||||
|
|
|
@ -19,8 +19,8 @@ BOOL WINAPI DllMain(void * hinst, DWORD /*fdwReason*/, LPVOID /*lpvReserved*/)
|
|||
Function: CloseDLL
|
||||
Purpose: This function is called when the emulator is closing
|
||||
down allowing the DLL to de-initialize.
|
||||
input: none
|
||||
output: none
|
||||
Input: None
|
||||
Output: None
|
||||
*/
|
||||
|
||||
void CloseDLL(void)
|
||||
|
@ -36,8 +36,8 @@ void CloseDLL(void)
|
|||
Function: DllAbout
|
||||
Purpose: This function is optional function that is provided
|
||||
to give further information about the DLL.
|
||||
input: a handle to the window that calls this function
|
||||
output: none
|
||||
Input: A handle to the window that calls this function
|
||||
Output: None
|
||||
*/
|
||||
|
||||
void DllAbout(void * hParent)
|
||||
|
@ -52,8 +52,8 @@ Function: DoRspCycles
|
|||
Purpose: This function is to allow the RSP to run in parallel with
|
||||
the r4300 switching control back to the r4300 once the
|
||||
function ends.
|
||||
input: The number of cycles that is meant to be executed
|
||||
output: The number of cycles that was executed. This value can
|
||||
Input: The number of cycles that is meant to be executed
|
||||
Output: The number of cycles that was executed. This value can
|
||||
be greater than the number of cycles that the RSP
|
||||
should have performed.
|
||||
(this value is ignored if the RSP is stopped)
|
||||
|
@ -72,9 +72,9 @@ uint32_t DoRspCycles(uint32_t Cycles)
|
|||
Function: GetDllInfo
|
||||
Purpose: This function allows the emulator to gather information
|
||||
about the DLL by filling in the PluginInfo structure.
|
||||
input: a pointer to a PLUGIN_INFO structure that needs to be
|
||||
Input: A pointer to a PLUGIN_INFO structure that needs to be
|
||||
filled by the function. (see def above)
|
||||
output: none
|
||||
Output: None
|
||||
*/
|
||||
|
||||
void GetDllInfo(PLUGIN_INFO * PluginInfo)
|
||||
|
@ -95,11 +95,11 @@ Function: InitiateRSP
|
|||
Purpose: This function is called when the DLL is started to give
|
||||
information from the emulator that the N64 RSP
|
||||
interface needs
|
||||
input: Rsp_Info is passed to this function which is defined
|
||||
Input: Rsp_Info is passed to this function which is defined
|
||||
above.
|
||||
CycleCount is the number of cycles between switching
|
||||
control between the RSP and r4300i core.
|
||||
output: none
|
||||
Output: None
|
||||
*/
|
||||
|
||||
void InitiateRSP(RSP_INFO Rsp_Info, uint32_t * /*CycleCount*/)
|
||||
|
@ -114,9 +114,9 @@ void InitiateRSP(RSP_INFO Rsp_Info, uint32_t * /*CycleCount*/)
|
|||
|
||||
/*
|
||||
Function: RomOpen
|
||||
Purpose: This function is called when a ROM is opened.
|
||||
input: none
|
||||
output: none
|
||||
Purpose: This function is called when a ROM is opened
|
||||
Input: None
|
||||
Output: None
|
||||
*/
|
||||
|
||||
void RomOpen(void)
|
||||
|
@ -125,9 +125,9 @@ void RomOpen(void)
|
|||
|
||||
/*
|
||||
Function: RomClosed
|
||||
Purpose: This function is called when a ROM is closed.
|
||||
input: none
|
||||
output: none
|
||||
Purpose: This function is called when a ROM is closed
|
||||
Input: None
|
||||
Output: None
|
||||
*/
|
||||
|
||||
void RomClosed(void)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Project64 - A Nintendo 64 emulator
|
||||
// http://www.pj64-emu.com/
|
||||
// https://www.pj64-emu.com/
|
||||
// Copyright(C) 2001-2021 Project64
|
||||
// Copyright(C) 2012 Bobby Smiles
|
||||
// GNU/GPLv2 licensed: https://gnu.org/licenses/gpl-2.0.html
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Project64 - A Nintendo 64 emulator
|
||||
// http://www.pj64-emu.com/
|
||||
// https://www.pj64-emu.com/
|
||||
// Copyright(C) 2001-2021 Project64
|
||||
// Copyright(C) 2014 Bobby Smiles
|
||||
// GNU/GPLv2 licensed: https://gnu.org/licenses/gpl-2.0.html
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Project64 - A Nintendo 64 emulator
|
||||
// http://www.pj64-emu.com/
|
||||
// https://www.pj64-emu.com/
|
||||
// Copyright(C) 2001-2021 Project64
|
||||
// Copyright(C) 2014 Bobby Smiles
|
||||
// Copyright(C) 2009 Richard Goedeken
|
||||
|
@ -197,8 +197,8 @@ void mp3_task(CHle * hle, unsigned int index, uint32_t address)
|
|||
uint32_t t4;// = (w1 & 0x1E);
|
||||
|
||||
// Initialization code
|
||||
uint32_t readPtr; // s5
|
||||
uint32_t writePtr; // s6
|
||||
uint32_t readPtr; // S5
|
||||
uint32_t writePtr; // S6
|
||||
uint32_t tmp;
|
||||
int cnt, cnt2;
|
||||
|
||||
|
@ -210,16 +210,16 @@ void mp3_task(CHle * hle, unsigned int index, uint32_t address)
|
|||
writePtr = readPtr = address;
|
||||
// TODO: Just do that for efficiency...may remove and use directly later anyway
|
||||
memcpy(hle->mp3_buffer() + 0xCE8, hle->dram() + readPtr, 8);
|
||||
// This must be a header byte or whatnot
|
||||
// This must be a header byte or what not
|
||||
readPtr += 8;
|
||||
|
||||
for (cnt = 0; cnt < 0x480; cnt += 0x180)
|
||||
{
|
||||
// DMA: 0xCF0 <- RDRAM[s5] : 0x180
|
||||
memcpy(hle->mp3_buffer() + 0xCF0, hle->dram() + readPtr, 0x180);
|
||||
inPtr = 0xCF0; // s7
|
||||
outPtr = 0xE70; // s3
|
||||
// --------------- Inner Loop Start --------------------
|
||||
inPtr = 0xCF0; // S7
|
||||
outPtr = 0xE70; // S3
|
||||
// Inner loop start
|
||||
for (cnt2 = 0; cnt2 < 0x180; cnt2 += 0x40)
|
||||
{
|
||||
t6 &= 0xFFE0;
|
||||
|
@ -234,7 +234,7 @@ void mp3_task(CHle * hle, unsigned int index, uint32_t address)
|
|||
inPtr += 0x40;
|
||||
outPtr += 0x40;
|
||||
}
|
||||
// --------------- Inner Loop End --------------------
|
||||
// Inner loop end
|
||||
memcpy(hle->dram() + writePtr, hle->mp3_buffer() + 0xe70, 0x180);
|
||||
writePtr += 0x180;
|
||||
readPtr += 0x180;
|
||||
|
@ -326,7 +326,7 @@ static void InnerLoop(CHle * hle, uint32_t outPtr, uint32_t inPtr, uint32_t t6,
|
|||
|
||||
MP3AB0(v);
|
||||
|
||||
// Part 5 - 1-Wide Butterflies - 100% accurate but need SSVs!
|
||||
// Part 5 - 1-wide butterflies - 100% accurate but need SSVs!
|
||||
|
||||
t0 = t6 + 0x100;
|
||||
t1 = t6 + 0x200;
|
||||
|
@ -485,7 +485,7 @@ static void InnerLoop(CHle * hle, uint32_t outPtr, uint32_t inPtr, uint32_t t6,
|
|||
|
||||
MP3AB0(v);
|
||||
|
||||
// Part 7: - 100% accurate + SSV - Unoptimized
|
||||
// Part 7: - 100% accurate + SSV - unoptimized (TODO: optimize?)
|
||||
|
||||
v[0] = (v[17] + v[16]) >> 1;
|
||||
v[1] = ((v[17] * (int)((short)0xA57E * 2)) + (v[16] * 0xB504)) >> 0x10;
|
||||
|
@ -582,7 +582,7 @@ static void InnerLoop(CHle * hle, uint32_t outPtr, uint32_t inPtr, uint32_t t6,
|
|||
v18 = v6 + v8;
|
||||
// Clamp(v0);
|
||||
// Clamp(v18);
|
||||
// clamp???
|
||||
// Clamp?
|
||||
*(int16_t *)(hle->mp3_buffer() + (outPtr ^ S16)) = v0;
|
||||
*(int16_t *)(hle->mp3_buffer() + ((outPtr + 2)^S16)) = v18;
|
||||
outPtr += 4;
|
||||
|
@ -643,7 +643,7 @@ static void InnerLoop(CHle * hle, uint32_t outPtr, uint32_t inPtr, uint32_t t6,
|
|||
v18 = v6 + v8;
|
||||
// Clamp(v0);
|
||||
// Clamp(v18);
|
||||
// clamp???
|
||||
// Clamp?
|
||||
*(int16_t *)(hle->mp3_buffer() + ((outPtr + 2)^S16)) = v0;
|
||||
*(int16_t *)(hle->mp3_buffer() + ((outPtr + 4)^S16)) = v18;
|
||||
outPtr += 4;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Project64 - A Nintendo 64 emulator
|
||||
// http://www.pj64-emu.com/
|
||||
// https://www.pj64-emu.com/
|
||||
// Copyright(C) 2001-2021 Project64
|
||||
// Copyright(C) 2013 Bobby Smiles
|
||||
// GNU/GPLv2 licensed: https://gnu.org/licenses/gpl-2.0.html
|
||||
|
@ -252,7 +252,6 @@ void musyx_v2_task(CHle * hle)
|
|||
|
||||
if (ptr_10)
|
||||
{
|
||||
// TODO:
|
||||
hle->WarnMessage("ptr_10=%08x mask_14=%02x ptr_24=%08x", ptr_10, mask_14, ptr_24);
|
||||
}
|
||||
|
||||
|
@ -320,7 +319,7 @@ static void update_base_vol(CHle * hle, int32_t *base_vol,
|
|||
hle->VerboseMessage("base_vol voice_mask = %08x", voice_mask);
|
||||
hle->VerboseMessage("BEFORE: base_vol = %08x %08x %08x %08x", base_vol[0], base_vol[1], base_vol[2], base_vol[3]);
|
||||
|
||||
// optimization: skip voices contributions entirely if voice_mask is empty
|
||||
// Optimization: skip voices contributions entirely if voice_mask is empty
|
||||
if (voice_mask != 0)
|
||||
{
|
||||
for (i = 0, mask = 1; i < MAX_VOICES; ++i, mask <<= 1, last_sample_ptr += 8)
|
||||
|
@ -337,7 +336,7 @@ static void update_base_vol(CHle * hle, int32_t *base_vol,
|
|||
}
|
||||
}
|
||||
|
||||
// optimization: skip contributions entirely if mask_15 is empty
|
||||
// Optimization: skip contributions entirely if mask_15 is empty
|
||||
if (mask_15 != 0)
|
||||
{
|
||||
for(i = 0, mask = 1; i < 4; ++i, mask <<= 1, ptr_24 += 8)
|
||||
|
@ -846,7 +845,7 @@ static void interleave_stage_v1(CHle * hle, musyx_t *musyx, uint32_t output_ptr)
|
|||
int16_t *right;
|
||||
uint32_t *dst;
|
||||
|
||||
hle->VerboseMessage("interleave: %08x", output_ptr);
|
||||
hle->VerboseMessage("Interleave: %08x", output_ptr);
|
||||
|
||||
base_left = clamp_s16(musyx->base_vol[0]);
|
||||
base_right = clamp_s16(musyx->base_vol[1]);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Project64 - A Nintendo 64 emulator
|
||||
// http://www.pj64-emu.com/
|
||||
// https://www.pj64-emu.com/
|
||||
// Copyright(C) 2001-2021 Project64
|
||||
// Copyright(C) 2014 Bobby Smiles
|
||||
// GNU/GPLv2 licensed: https://gnu.org/licenses/gpl-2.0.html
|
||||
|
|
|
@ -72,10 +72,10 @@ private:
|
|||
|
||||
std::string m_CurrentSection;
|
||||
bool m_CurrentSectionDirty;
|
||||
int m_CurrentSectionFilePos; // Where in the file is the current section
|
||||
int m_CurrentSectionFilePos;
|
||||
KeyValueList m_CurrentSectionData;
|
||||
|
||||
long m_lastSectionSearch; // When scanning for a section, what was the last scanned POS
|
||||
long m_lastSectionSearch;
|
||||
|
||||
bool m_ReadOnly;
|
||||
bool m_InstantFlush;
|
||||
|
|
|
@ -141,7 +141,7 @@ uint32_t CThread::GetCurrentThreadId(void)
|
|||
#ifdef _WIN32
|
||||
return ::GetCurrentThreadId();
|
||||
#elif defined(SYS_gettid) || defined(__NR_gettid)
|
||||
return syscall(__NR_gettid); /* GLIBC has no implementation of gettid(). */
|
||||
return syscall(__NR_gettid); // GLIBC has no implementation of gettid()
|
||||
#else
|
||||
return gettid();
|
||||
#endif
|
||||
|
|
|
@ -207,7 +207,7 @@ CTraceFileLog::CTraceFileLog(const char * FileName, bool FlushFile, CLog::LOG_OP
|
|||
m_hLogFile.SetTruncateFile(true);
|
||||
|
||||
if (dwMaxFileSize < 3 || dwMaxFileSize > 2047)
|
||||
{ /* Clamp file size to 5 MB if it exceeds 2047 or falls short of 3. */
|
||||
{ // Clamp file size to 5MB if it exceeds 2047 or falls short of 3
|
||||
dwMaxFileSize = 5;
|
||||
}
|
||||
m_hLogFile.SetMaxFileSize((uint32_t)(dwMaxFileSize * MB));
|
||||
|
|
|
@ -53,7 +53,7 @@ bool pjutil::TerminatedExistingExe()
|
|||
}
|
||||
if (!AskedUser)
|
||||
{
|
||||
stdstr_f Message("%s currently running\n\nTerminate pid %d now?", ModuleName.c_str(), lppe.th32ProcessID);
|
||||
stdstr_f Message("%s currently running\n\nTerminate PID %d now?", ModuleName.c_str(), lppe.th32ProcessID);
|
||||
stdstr_f Caption("Terminate %s", ModuleName.c_str());
|
||||
|
||||
AskedUser = true;
|
||||
|
@ -73,7 +73,7 @@ bool pjutil::TerminatedExistingExe()
|
|||
}
|
||||
else
|
||||
{
|
||||
stdstr_f Message("Failed to terminate pid %d", lppe.th32ProcessID);
|
||||
stdstr_f Message("Failed to terminate PID %d", lppe.th32ProcessID);
|
||||
stdstr_f Caption("Terminate %s failed!", ModuleName.c_str());
|
||||
MessageBox(nullptr, Message.ToUTF16().c_str(), Caption.ToUTF16().c_str(), MB_YESNO | MB_ICONEXCLAMATION);
|
||||
}
|
||||
|
|
|
@ -9,15 +9,15 @@ implied warranty of any kind.
|
|||
|
||||
The translator/ modifier does not claim (1) that MD5 will do what you think
|
||||
it does; (2) that this translation/ modification is accurate; or (3) that
|
||||
this software is "merchantable." (Language for this disclaimer partially
|
||||
copied from the disclaimer below).
|
||||
this software is "merchantable." (language for this disclaimer partially
|
||||
copied from the disclaimer below)
|
||||
|
||||
based on:
|
||||
|
||||
MD5.H - header file for MD5C.C
|
||||
MDDRIVER.C - test driver for MD2, MD4 and MD5
|
||||
|
||||
Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All rights reserved.
|
||||
Copyright (C) 1991-1992, RSA Data Security, Inc. Created 1991. All rights reserved.
|
||||
|
||||
License to copy and use this software is granted provided that it
|
||||
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
|
||||
|
@ -59,7 +59,7 @@ MD5::~MD5()
|
|||
void MD5::update(const uint1 *input, uint4 input_length)
|
||||
{
|
||||
uint4 input_index, buffer_index;
|
||||
uint4 buffer_space; // How much space is left in the buffer
|
||||
uint4 buffer_space;
|
||||
|
||||
if (finalized) // So we can't update!
|
||||
{
|
||||
|
@ -78,7 +78,7 @@ void MD5::update(const uint1 *input, uint4 input_length)
|
|||
|
||||
count[1] += ((uint4)input_length >> 29);
|
||||
|
||||
buffer_space = 64 - buffer_index; // How much space is left in the buffer
|
||||
buffer_space = 64 - buffer_index;
|
||||
|
||||
// Transform as many times as possible
|
||||
if (input_length >= buffer_space) // i.e. we have enough to fill the buffer
|
||||
|
@ -93,11 +93,11 @@ void MD5::update(const uint1 *input, uint4 input_length)
|
|||
transform((unsigned char *)(input + input_index));
|
||||
}
|
||||
|
||||
buffer_index = 0; // So we can buffer remaining
|
||||
buffer_index = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
input_index = 0; // So we can buffer the whole input
|
||||
input_index = 0;
|
||||
}
|
||||
|
||||
// Here we do the buffering:
|
||||
|
@ -246,7 +246,7 @@ const char *MD5::hex_digest()
|
|||
return m_hex_digest.c_str();
|
||||
}
|
||||
|
||||
// PRIVATE METHODS:
|
||||
// Private methods:
|
||||
|
||||
void MD5::init()
|
||||
{
|
||||
|
|
|
@ -9,15 +9,15 @@ implied warranty of any kind.
|
|||
|
||||
The translator/ modifier does not claim (1) that MD5 will do what you think
|
||||
it does; (2) that this translation/ modification is accurate; or (3) that
|
||||
this software is "merchantable." (Language for this disclaimer partially
|
||||
copied from the disclaimer below).
|
||||
this software is "merchantable." (language for this disclaimer partially
|
||||
copied from the disclaimer below)
|
||||
|
||||
based on:
|
||||
|
||||
MD5.H - header file for MD5C.C
|
||||
MDDRIVER.C - test driver for MD2, MD4 and MD5
|
||||
|
||||
Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All rights reserved.
|
||||
Copyright (C) 1991-1992, RSA Data Security, Inc. Created 1991. All rights reserved.
|
||||
|
||||
License to copy and use this software is granted provided that it
|
||||
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
|
||||
|
|
|
@ -233,7 +233,7 @@ CPath& CPath::operator =(const std::string& strPath)
|
|||
/*
|
||||
Post: Converts path to string
|
||||
Task: Convert path to string
|
||||
Warning: because this pointer to string point in the data
|
||||
Warning: Because this pointer to string point in the data
|
||||
of this class, it is possible to cast the result of this
|
||||
function in any non-constant pointer and alter the data.
|
||||
Very dangerous!
|
||||
|
@ -281,7 +281,7 @@ Task: Return the individual components of this path.
|
|||
For any given argument, you can pass nullptr if you are not
|
||||
interested in that component.
|
||||
Do not rely on pNames being <= 8 characters, extensions
|
||||
being <= 3 characters, or drives being 1 character
|
||||
being <= 3 characters, or drives being 1 character.
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -922,7 +922,7 @@ Task: To determine if the directory exists, we need to
|
|||
create a test path with a wildcard (*.*) extension
|
||||
and see if FindFirstFile returns anything. We don't
|
||||
use CPath::FindFirst() because that routine parses out
|
||||
'.' and '..', which fails for empty directories
|
||||
'.' and '..', which fails for empty directories.
|
||||
*/
|
||||
|
||||
bool CPath::DirectoryExists() const
|
||||
|
@ -1041,10 +1041,10 @@ bool CPath::Delete(bool bEvenIfReadOnly) const
|
|||
|
||||
/*
|
||||
Post: Return TRUE on success, false if there is such a target file
|
||||
and we weren't granted permission to overwrite file or if we get an error
|
||||
and we weren't granted permission to overwrite file or if we get an error.
|
||||
Task: Copy file
|
||||
Since ::CopyFile will not overwrite read-only files
|
||||
we will make sure the target file is writable first
|
||||
we will make sure the target file is writable first.
|
||||
*/
|
||||
|
||||
bool CPath::CopyTo(const char * lpcszTargetFile, bool bOverwrite)
|
||||
|
@ -1053,7 +1053,7 @@ bool CPath::CopyTo(const char * lpcszTargetFile, bool bOverwrite)
|
|||
{
|
||||
return false;
|
||||
}
|
||||
WriteTrace(TracePath, TraceDebug, "copy \"%s\" to \"%s\"",m_strPath.c_str(),lpcszTargetFile);
|
||||
WriteTrace(TracePath, TraceDebug, "Copy \"%s\" to \"%s\"",m_strPath.c_str(),lpcszTargetFile);
|
||||
#ifdef _WIN32
|
||||
// Check if the target file exists
|
||||
CPath TargetFile(lpcszTargetFile);
|
||||
|
@ -1164,7 +1164,7 @@ bool CPath::CopyTo(const char * lpcszTargetFile, bool bOverwrite)
|
|||
}
|
||||
|
||||
// Post: Return TRUE on success, false if there is such a target file
|
||||
// and we weren't granted permission to overwrite file or get an error
|
||||
// and we weren't granted permission to overwrite file or get an error.
|
||||
// Task: Move file
|
||||
|
||||
bool CPath::MoveTo(const char * lpcszTargetFile, bool bOverwrite)
|
||||
|
@ -1228,7 +1228,7 @@ These attributes do not follow a simple additive logic.
|
|||
Note that FIND_ATTRIBUTE_FILES is 0x00, so it effectively cannot be
|
||||
removed from the attribute set. You will therefore always
|
||||
get normal files, and may also get Archive, Hidden, etc.
|
||||
if you specify those attributes
|
||||
if you specify those attributes.
|
||||
See also: FindFirstFile, FindNextFile
|
||||
*/
|
||||
|
||||
|
@ -1287,8 +1287,8 @@ bool CPath::FindFirst(uint32_t dwAttributes /*= FIND_ATTRIBUTE_FILES*/)
|
|||
return false;
|
||||
}
|
||||
|
||||
// Post : Return TRUE if a new match found
|
||||
// Task : Find the next file that meets the conditions specified in the last FindFirst call
|
||||
// Post: Return TRUE if a new match found
|
||||
// Task: Find the next file that meets the conditions specified in the last FindFirst call
|
||||
|
||||
bool CPath::FindNext()
|
||||
{
|
||||
|
@ -1347,12 +1347,12 @@ bool CPath::FindNext()
|
|||
strcmp(pEntry->d_name,"..") == 0 ||
|
||||
!wildcmp(m_FindWildcard.c_str(),pEntry->d_name))
|
||||
{
|
||||
WriteTrace(TracePath, TraceVerbose, "continue, d_name = %s",pEntry->d_name);
|
||||
WriteTrace(TracePath, TraceVerbose, "Continue, d_name = %s",pEntry->d_name);
|
||||
continue;
|
||||
}
|
||||
if ((FIND_ATTRIBUTE_SUBDIR & dwFileAttributes) == FIND_ATTRIBUTE_SUBDIR)
|
||||
{
|
||||
WriteTrace(TracePath, TraceVerbose, "is dir");
|
||||
WriteTrace(TracePath, TraceVerbose, "is a directory");
|
||||
if (IsDirectory())
|
||||
{
|
||||
// Found a directory
|
||||
|
@ -1366,7 +1366,7 @@ bool CPath::FindNext()
|
|||
}
|
||||
else
|
||||
{
|
||||
WriteTrace(TracePath, TraceVerbose, "is file");
|
||||
WriteTrace(TracePath, TraceVerbose, "is a file");
|
||||
// Found a file
|
||||
if (IsDirectory())
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Project64 - A Nintendo 64 emulator
|
||||
// http://www.pj64-emu.com/
|
||||
// https://www.pj64-emu.com/
|
||||
// Copyright(C) 2001-2021 Project64.
|
||||
// Copyright(C) 2015 Gilles Siberlin
|
||||
// Copyright(C) 2007-2009 Richard Goedeken
|
||||
|
|
|
@ -56,7 +56,7 @@ typedef struct
|
|||
|
||||
int32_t MemoryBswaped; // If this is set to TRUE, then the memory has been pre-bswap'd on a DWORD (32-bit) boundary
|
||||
// eg. the first 8 bytes are stored like this:
|
||||
// 4 3 2 1 8 7 6 5
|
||||
// 4 3 2 1 8 7 6 5
|
||||
uint8_t * HEADER; // This is the ROM header (first 40h bytes of the ROM)
|
||||
// This will be in the same memory format as the rest of the memory.
|
||||
uint8_t * RDRAM;
|
||||
|
@ -77,99 +77,99 @@ typedef struct
|
|||
|
||||
/*
|
||||
Function: AiDacrateChanged
|
||||
Purpose: This function is called to notify the DLL that the
|
||||
Purpose: This function is called to notify the DLL that the
|
||||
AiDacrate registers value has been changed.
|
||||
input: The System type:
|
||||
Input: The system type:
|
||||
SYSTEM_NTSC 0
|
||||
SYSTEM_PAL 1
|
||||
SYSTEM_MPAL 2
|
||||
output: none
|
||||
Output: None
|
||||
*/
|
||||
|
||||
EXPORT void CALL AiDacrateChanged(int32_t SystemType);
|
||||
|
||||
/*
|
||||
Function: AiLenChanged
|
||||
Purpose: This function is called to notify the DLL that the
|
||||
Purpose: This function is called to notify the DLL that the
|
||||
AiLen registers value has been changed.
|
||||
input: none
|
||||
output: none
|
||||
Input: None
|
||||
Output: None
|
||||
*/
|
||||
|
||||
EXPORT void CALL AiLenChanged(void);
|
||||
|
||||
/*
|
||||
Function: AiReadLength
|
||||
Purpose: This function is called to allow the DLL to return the
|
||||
Purpose: This function is called to allow the DLL to return the
|
||||
value that AI_LEN_REG should equal
|
||||
input: none
|
||||
output: The amount of bytes still left to play.
|
||||
Input: None
|
||||
Output: The amount of bytes still left to play.
|
||||
*/
|
||||
|
||||
EXPORT uint32_t CALL AiReadLength(void);
|
||||
|
||||
/*
|
||||
Function: AiUpdate
|
||||
Purpose: This function is called to allow the DLL to update
|
||||
Purpose: This function is called to allow the DLL to update
|
||||
things on a regular basis (check how long to sound to
|
||||
go, copy more stuff to the buffer, anything you like).
|
||||
The function is designed to go in to the message loop
|
||||
of the main window...but can be placed anywhere you
|
||||
like.
|
||||
input: if Wait is set to true, then this function should wait
|
||||
Input: If wait is set to true, then this function should wait
|
||||
till there is a message in its message queue.
|
||||
output: none
|
||||
Output: None
|
||||
*/
|
||||
|
||||
EXPORT void CALL AiUpdate(int32_t Wait);
|
||||
|
||||
/*
|
||||
Function: CloseDLL
|
||||
Purpose: This function is called when the emulator is closing
|
||||
Purpose: This function is called when the emulator is closing
|
||||
down allowing the DLL to de-initialize.
|
||||
input: none
|
||||
output: none
|
||||
Input: None
|
||||
Output: None
|
||||
*/
|
||||
|
||||
EXPORT void CALL CloseDLL(void);
|
||||
|
||||
/*
|
||||
Function: DllAbout
|
||||
Purpose: This function is optional function that is provided
|
||||
Purpose: This function is optional function that is provided
|
||||
to give further information about the DLL.
|
||||
input: a handle to the window that calls this function
|
||||
output: none
|
||||
Input: A handle to the window that calls this function.
|
||||
Output: None
|
||||
*/
|
||||
|
||||
EXPORT void CALL DllAbout(void * hParent);
|
||||
|
||||
/*
|
||||
Function: DllConfig
|
||||
Purpose: This function is optional function that is provided
|
||||
Purpose: This function is optional function that is provided
|
||||
to allow the user to configure the DLL
|
||||
input: a handle to the window that calls this function
|
||||
output: none
|
||||
Input: A handle to the window that calls this function
|
||||
Output: None
|
||||
*/
|
||||
|
||||
EXPORT void CALL DllConfig(void * hParent);
|
||||
|
||||
/*
|
||||
Function: DllTest
|
||||
Purpose: This function is optional function that is provided
|
||||
Purpose: This function is optional function that is provided
|
||||
to allow the user to test the DLL
|
||||
input: a handle to the window that calls this function
|
||||
output: none
|
||||
Input: A handle to the window that calls this function
|
||||
Output: None
|
||||
*/
|
||||
|
||||
EXPORT void CALL DllTest(void * hParent);
|
||||
|
||||
/*
|
||||
Function: GetDllInfo
|
||||
Purpose: This function allows the emulator to gather information
|
||||
Purpose: This function allows the emulator to gather information
|
||||
about the DLL by filling in the PluginInfo structure.
|
||||
input: a pointer to a PLUGIN_INFO structure that needs to be
|
||||
Input: A pointer to a PLUGIN_INFO structure that needs to be
|
||||
filled by the function. (see def above)
|
||||
output: none
|
||||
Output: None
|
||||
*/
|
||||
|
||||
EXPORT void CALL GetDllInfo(PLUGIN_INFO * PluginInfo);
|
||||
|
@ -179,12 +179,11 @@ Function: InitiateSound
|
|||
Purpose: This function is called when the DLL is started to give
|
||||
information from the emulator that the N64 audio
|
||||
interface needs
|
||||
Input: Audio_Info is passed to this function which is defined
|
||||
Input: Audio_Info is passed to this function which is defined
|
||||
above.
|
||||
Output: TRUE on success
|
||||
Output: True on success
|
||||
FALSE on failure to initialize
|
||||
|
||||
** Note on interrupts **:
|
||||
Note on interrupts:
|
||||
To generate an interrupt set the appropriate bit in MI_INTR_REG
|
||||
and then call the function CheckInterrupts to tell the emulator
|
||||
that there is a waiting interrupt.
|
||||
|
@ -194,20 +193,20 @@ EXPORT int32_t CALL InitiateAudio(AUDIO_INFO Audio_Info);
|
|||
|
||||
/*
|
||||
Function: ProcessAList
|
||||
Purpose: This function is called when there is a Alist to be
|
||||
Purpose: This function is called when there is a Alist to be
|
||||
processed. The DLL will have to work out all the info
|
||||
about the AList itself.
|
||||
input: none
|
||||
output: none
|
||||
Input: None
|
||||
Output: None
|
||||
*/
|
||||
|
||||
EXPORT void CALL ProcessAList(void);
|
||||
|
||||
/*
|
||||
Function: RomClosed
|
||||
Purpose: This function is called when a ROM is closed.
|
||||
input: none
|
||||
output: none
|
||||
Purpose: This function is called when a ROM is closed.
|
||||
Input: None
|
||||
Output: None
|
||||
*/
|
||||
|
||||
EXPORT void CALL RomClosed(void);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Project64 - A Nintendo 64 emulator
|
||||
// http://www.pj64-emu.com/
|
||||
// https://www.pj64-emu.com/
|
||||
// Copyright(C) 2001-2021 Project64.
|
||||
// Copyright(C) 2000-2015 Azimer
|
||||
// GNU/GPLv2 licensed: https://gnu.org/licenses/gpl-2.0.html
|
||||
|
@ -88,7 +88,7 @@ void DirectSoundDriver::StopAudio()
|
|||
m_AudioIsDone = true;
|
||||
if (WaitForSingleObject((HANDLE)m_handleAudioThread, 5000) == WAIT_TIMEOUT)
|
||||
{
|
||||
WriteTrace(TraceAudioDriver, TraceError, "Time out on close");
|
||||
WriteTrace(TraceAudioDriver, TraceError, "Timeout on close");
|
||||
|
||||
TerminateThread((HANDLE)m_handleAudioThread, 1);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Project64 - A Nintendo 64 emulator
|
||||
// http://www.pj64-emu.com/
|
||||
// https://www.pj64-emu.com/
|
||||
// Copyright(C) 2001-2021 Project64.
|
||||
// Copyright(C) 2015 Gilles Siberlin
|
||||
// Copyright(C) 2007 - 2009 Richard Goedeken
|
||||
|
@ -45,7 +45,7 @@ enum { SECONDARY_BUFFER_NBR = 2 };
|
|||
// This sets default frequency what is used if ROM doesn't want to change it.
|
||||
// Probably only game that needs this is Zelda: Ocarina Of Time Master Quest
|
||||
// TODO: We should try to find out why Demos' frequencies are always wrong
|
||||
// They tend to rely on a default frequency, but apparently never the same one ;)
|
||||
// They tend to rely on a default frequency, but apparently never the same one
|
||||
|
||||
enum { DEFAULT_FREQUENCY = 33600 };
|
||||
|
||||
|
@ -87,7 +87,7 @@ int g_OutputFreq = 44100;
|
|||
bool g_critical_failure = false;
|
||||
|
||||
#ifdef ANDROID
|
||||
// Thread Lock
|
||||
// Thread lock
|
||||
threadLock g_lock;
|
||||
|
||||
// Engine interfaces
|
||||
|
@ -192,7 +192,7 @@ static void CloseAudio(void)
|
|||
g_engineEngine = nullptr;
|
||||
}
|
||||
|
||||
// Destroy thread Locks
|
||||
// Destroy thread locks
|
||||
pthread_cond_signal(&(g_lock.cond));
|
||||
pthread_mutex_unlock(&(g_lock.mutex));
|
||||
pthread_cond_destroy(&(g_lock.cond));
|
||||
|
@ -379,7 +379,7 @@ void OpenSLESDriver::AI_SetFrequency(uint32_t freq, uint32_t BufferSize)
|
|||
|
||||
if (g_critical_failure)
|
||||
{
|
||||
WriteTrace(TraceAudioInitShutdown, TraceInfo, "Critical failure in setting up plugin, ignoring init...");
|
||||
WriteTrace(TraceAudioInitShutdown, TraceInfo, "Critical failure in setting up plugin, ignoring initialization...");
|
||||
WriteTrace(TraceAudioInitShutdown, TraceDebug, "Done");
|
||||
return;
|
||||
}
|
||||
|
@ -437,7 +437,7 @@ void OpenSLESDriver::AI_SetFrequency(uint32_t freq, uint32_t BufferSize)
|
|||
}
|
||||
|
||||
#ifdef ANDROID
|
||||
// Create thread Locks to ensure synchronization between callback and processing code
|
||||
// Create thread locks to ensure synchronization between callback and processing code
|
||||
if (pthread_mutex_init(&(g_lock.mutex), (pthread_mutexattr_t*)nullptr) != 0)
|
||||
{
|
||||
WriteTrace(TraceAudioInitShutdown, TraceError, "pthread_mutex_init failed");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Project64 - A Nintendo 64 emulator
|
||||
// http://www.pj64-emu.com/
|
||||
// https://www.pj64-emu.com/
|
||||
// Copyright(C) 2001-2021 Project64.
|
||||
// Copyright(C) 2015 Gilles Siberlin
|
||||
// Copyright(C) 2007 - 2009 Richard Goedeken
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Project64 - A Nintendo 64 emulator
|
||||
// http://www.pj64-emu.com/
|
||||
// https://www.pj64-emu.com/
|
||||
// Copyright(C) 2001-2021 Project64
|
||||
// Copyright(C) 2000-2015 Azimer
|
||||
// GNU/GPLv2 licensed: https://gnu.org/licenses/gpl-2.0.html
|
||||
|
@ -119,7 +119,7 @@ void SoundDriverBase::LoadAiBuffer(uint8_t *start, uint32_t length)
|
|||
bool DMAEnabled = (*g_AudioInfo.AI_CONTROL_REG & AI_CONTROL_DMA_ON) == AI_CONTROL_DMA_ON;
|
||||
if (!DMAEnabled)
|
||||
{
|
||||
WriteTrace(TraceAudioDriver, TraceVerbose, "Return silence -- DMA is disabled");
|
||||
WriteTrace(TraceAudioDriver, TraceVerbose, "Return silence - DMA is disabled");
|
||||
memset(ptrStart, 0, bytesToMove);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Project64 - A Nintendo 64 emulator
|
||||
// http://www.pj64-emu.com/
|
||||
// https://www.pj64-emu.com/
|
||||
// Copyright(C) 2001-2021 Project64
|
||||
// Copyright(C) 2000-2015 Azimer
|
||||
// GNU/GPLv2 licensed: https://gnu.org/licenses/gpl-2.0.html
|
||||
|
|
|
@ -196,7 +196,7 @@ static bool ParseCommand(int32_t argc, char **argv)
|
|||
}
|
||||
else
|
||||
{
|
||||
WriteTrace(TraceAppInit, TraceError, "not enough parameters for '%d: %s'", i, argv[i]);
|
||||
WriteTrace(TraceAppInit, TraceError, "Not enough parameters for '%d: %s'", i, argv[i]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ static bool ParseCommand(int32_t argc, char **argv)
|
|||
}
|
||||
else
|
||||
{
|
||||
WriteTrace(TraceAppInit, TraceError, "unrecognized command-line parameter '%d: %s'", i, argv[i]);
|
||||
WriteTrace(TraceAppInit, TraceError, "Unrecognized command-line parameter '%d: %s'", i, argv[i]);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
@ -222,17 +222,17 @@ bool AppInit(CNotification * Notify, const char * BaseDirectory, int argc, char
|
|||
WriteTrace(TraceAppInit, TraceDebug, "Starting (BaseDirectory: %s)", BaseDirectory ? BaseDirectory : "null");
|
||||
if (Notify == nullptr)
|
||||
{
|
||||
WriteTrace(TraceAppInit, TraceError, "No Notification class passed");
|
||||
WriteTrace(TraceAppInit, TraceError, "No notification class passed");
|
||||
return false;
|
||||
}
|
||||
WriteTrace(TraceAppInit, TraceDebug, "Settings up settings");
|
||||
WriteTrace(TraceAppInit, TraceDebug, "Setting up settings");
|
||||
g_Settings = new CSettings;
|
||||
g_Settings->Initialize(BaseDirectory, AppName());
|
||||
|
||||
WriteTrace(TraceAppInit, TraceDebug, "Parse Commands");
|
||||
WriteTrace(TraceAppInit, TraceDebug, "Parse commands");
|
||||
if (!ParseCommand(argc, argv))
|
||||
{
|
||||
WriteTrace(TraceAppInit, TraceError, "Failed to Parse Commands, exiting now");
|
||||
WriteTrace(TraceAppInit, TraceError, "Failed to parse commands, exiting now");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -254,33 +254,33 @@ bool AppInit(CNotification * Notify, const char * BaseDirectory, int argc, char
|
|||
#else
|
||||
if (!CMipsMemoryVM::SetupSegvHandler())
|
||||
{
|
||||
WriteTrace(TraceAppInit, TraceDebug, "Setup Segv Handler Failed");
|
||||
WriteTrace(TraceAppInit, TraceDebug, "Setup SEGV handler failed");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
g_Enhancements = new CEnhancements();
|
||||
|
||||
//Create the plugin container
|
||||
WriteTrace(TraceAppInit, TraceInfo, "Create Plugins");
|
||||
WriteTrace(TraceAppInit, TraceInfo, "Create plugins");
|
||||
g_Plugins = new CPlugins(Directory_Plugin, false);
|
||||
|
||||
g_Lang = new CLanguage();
|
||||
g_Lang->LoadCurrentStrings();
|
||||
g_Notify->AppInitDone();
|
||||
WriteTrace(TraceAppInit, TraceDebug, "Initialized Successfully");
|
||||
WriteTrace(TraceAppInit, TraceDebug, "Initialized successfully");
|
||||
return true;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Exception caught\nFile: %s\nLine: %d", __FILE__, __LINE__).c_str());
|
||||
WriteTrace(TraceAppInit, TraceError, "Exception caught, Init was not successfull");
|
||||
WriteTrace(TraceAppInit, TraceError, "Exception caught, initialization was not successful");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void AppCleanup(void)
|
||||
{
|
||||
WriteTrace(TraceAppCleanup, TraceDebug, "cleaning up global objects");
|
||||
WriteTrace(TraceAppCleanup, TraceDebug, "Cleaning up global objects");
|
||||
CleanupTrace();
|
||||
|
||||
if (g_Enhancements) { delete g_Enhancements; g_Enhancements = nullptr; }
|
||||
|
|
|
@ -188,7 +188,7 @@ bool CMipsMemoryVM::FilterX86Exception(uint32_t MemAddress, X86_CONTEXT & contex
|
|||
{
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Failed to load byte\n\nMIPS Address: %08X\nX86 Address: %08X", MemAddress, (uint8_t *)*context.Eip).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Failed to load byte\n\nMIPS address: %08X\nX86 address: %08X", MemAddress, (uint8_t *)*context.Eip).c_str());
|
||||
}
|
||||
}
|
||||
*context.Eip = (uint32_t)ReadPos;
|
||||
|
@ -198,7 +198,7 @@ bool CMipsMemoryVM::FilterX86Exception(uint32_t MemAddress, X86_CONTEXT & contex
|
|||
{
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Failed to load half word\n\nMIPS Address: %08X\nX86 Address: %08X", MemAddress, (uint8_t *)*context.Eip).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Failed to load half word\n\nMIPS address: %08X\nX86 address: %08X", MemAddress, (uint8_t *)*context.Eip).c_str());
|
||||
}
|
||||
}
|
||||
*context.Eip = (uint32_t)ReadPos;
|
||||
|
@ -208,7 +208,7 @@ bool CMipsMemoryVM::FilterX86Exception(uint32_t MemAddress, X86_CONTEXT & contex
|
|||
{
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Failed to load byte\n\nMIPS Address: %08X\nX86 Address: %08X", MemAddress, (uint8_t *)*context.Eip).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Failed to load byte\n\nMIPS address: %08X\nX86 address: %08X", MemAddress, (uint8_t *)*context.Eip).c_str());
|
||||
}
|
||||
}
|
||||
*context.Eip = (uint32_t)ReadPos;
|
||||
|
@ -218,7 +218,7 @@ bool CMipsMemoryVM::FilterX86Exception(uint32_t MemAddress, X86_CONTEXT & contex
|
|||
{
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Failed to load half word\n\nMIPS Address: %08X\nX86 Address: %08X", MemAddress, (uint8_t *)*context.Eip).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Failed to load half word\n\nMIPS address: %08X\nX86 address: %08X", MemAddress, (uint8_t *)*context.Eip).c_str());
|
||||
}
|
||||
}
|
||||
*context.Eip = (uint32_t)ReadPos;
|
||||
|
@ -239,7 +239,7 @@ bool CMipsMemoryVM::FilterX86Exception(uint32_t MemAddress, X86_CONTEXT & contex
|
|||
{
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Failed to half word\n\nMIPS Address: %08X\nX86 Address: %08X", MemAddress, (uint8_t *)*context.Eip).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Failed to half word\n\nMIPS address: %08X\nX86 address: %08X", MemAddress, (uint8_t *)*context.Eip).c_str());
|
||||
}
|
||||
}
|
||||
*context.Eip = (uint32_t)ReadPos;
|
||||
|
@ -249,7 +249,7 @@ bool CMipsMemoryVM::FilterX86Exception(uint32_t MemAddress, X86_CONTEXT & contex
|
|||
{
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store half word\n\nMIPS Address: %08X\nX86 Address: %08X", MemAddress,
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store half word\n\nMIPS address: %08X\nX86 address: %08X", MemAddress,
|
||||
(uint8_t *)*context.Eip).c_str());
|
||||
}
|
||||
}
|
||||
|
@ -268,7 +268,7 @@ bool CMipsMemoryVM::FilterX86Exception(uint32_t MemAddress, X86_CONTEXT & contex
|
|||
{
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store half word\n\nMIPS Address: %08X\nX86 Address: %08X", MemAddress, (uint8_t *)*context.Eip).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store half word\n\nMIPS address: %08X\nX86 address: %08X", MemAddress, (uint8_t *)*context.Eip).c_str());
|
||||
}
|
||||
}
|
||||
*context.Eip = (uint32_t)(ReadPos + 2);
|
||||
|
@ -286,7 +286,7 @@ bool CMipsMemoryVM::FilterX86Exception(uint32_t MemAddress, X86_CONTEXT & contex
|
|||
{
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store byte\n\nMIPS Address: %08X\nX86 Address: %08X", MemAddress, (uint8_t *)*context.Eip).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store byte\n\nMIPS address: %08X\nX86 address: %08X", MemAddress, (uint8_t *)*context.Eip).c_str());
|
||||
}
|
||||
}
|
||||
*context.Eip = (uint32_t)ReadPos;
|
||||
|
@ -296,7 +296,7 @@ bool CMipsMemoryVM::FilterX86Exception(uint32_t MemAddress, X86_CONTEXT & contex
|
|||
{
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Failed to load byte\n\nMIPS Address: %08X\nX86 Address: %08X", MemAddress, (uint8_t *)*context.Eip).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Failed to load byte\n\nMIPS address: %08X\nX86 address: %08X", MemAddress, (uint8_t *)*context.Eip).c_str());
|
||||
}
|
||||
}
|
||||
*context.Eip = (uint32_t)ReadPos;
|
||||
|
@ -306,7 +306,7 @@ bool CMipsMemoryVM::FilterX86Exception(uint32_t MemAddress, X86_CONTEXT & contex
|
|||
{
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Failed to load word\n\nMIPS Address: %08X\nX86 Address: %08X", MemAddress, (uint8_t *)*context.Eip).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Failed to load word\n\nMIPS address: %08X\nX86 address: %08X", MemAddress, (uint8_t *)*context.Eip).c_str());
|
||||
}
|
||||
}
|
||||
*context.Eip = (uint32_t)ReadPos;
|
||||
|
@ -316,7 +316,7 @@ bool CMipsMemoryVM::FilterX86Exception(uint32_t MemAddress, X86_CONTEXT & contex
|
|||
{
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store word\n\nMIPS Address: %08X\nX86 Address: %08X", MemAddress, (uint8_t *)*context.Eip).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store word\n\nMIPS address: %08X\nX86 address: %08X", MemAddress, (uint8_t *)*context.Eip).c_str());
|
||||
}
|
||||
}
|
||||
*context.Eip = (uint32_t)ReadPos;
|
||||
|
@ -334,7 +334,7 @@ bool CMipsMemoryVM::FilterX86Exception(uint32_t MemAddress, X86_CONTEXT & contex
|
|||
{
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store byte\n\nMIPS Address: %08X\nX86 Address: %08X", MemAddress, (uint8_t *)*context.Eip).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store byte\n\nMIPS address: %08X\nX86 address: %08X", MemAddress, (uint8_t *)*context.Eip).c_str());
|
||||
}
|
||||
}
|
||||
*context.Eip = (uint32_t)(ReadPos + 1);
|
||||
|
@ -352,7 +352,7 @@ bool CMipsMemoryVM::FilterX86Exception(uint32_t MemAddress, X86_CONTEXT & contex
|
|||
{
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store word\n\nMIPS Address: %08X\nX86 Address: %08X", MemAddress, (uint8_t *)*context.Eip).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store word\n\nMIPS address: %08X\nX86 address: %08X", MemAddress, (uint8_t *)*context.Eip).c_str());
|
||||
}
|
||||
}
|
||||
*context.Eip = (uint32_t)(ReadPos + 4);
|
||||
|
@ -371,7 +371,7 @@ void CMipsMemoryVM::DumpArmExceptionInfo(uint32_t MemAddress, mcontext_t & conte
|
|||
{
|
||||
ArmThumbOpcode * OpCode = (ArmThumbOpcode *)context.arm_pc;
|
||||
Arm32Opcode * OpCode32 = (Arm32Opcode *)context.arm_pc;
|
||||
WriteTrace(TraceExceptionHandler, TraceError, "Program Counter 0x%lx", g_Reg->m_PROGRAM_COUNTER);
|
||||
WriteTrace(TraceExceptionHandler, TraceError, "Program counter 0x%lx", g_Reg->m_PROGRAM_COUNTER);
|
||||
for (int i = 0, n = (sizeof(g_BaseSystem->m_LastSuccessSyncPC) / sizeof(g_BaseSystem->m_LastSuccessSyncPC[0])); i < n; i++)
|
||||
{
|
||||
WriteTrace(TraceExceptionHandler, TraceError, "m_LastSuccessSyncPC[%d] = 0x%lx", i, g_BaseSystem->m_LastSuccessSyncPC[i]);
|
||||
|
@ -467,7 +467,7 @@ bool CMipsMemoryVM::FilterArmException(uint32_t MemAddress, mcontext_t & context
|
|||
{
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Failed to load word\n\nMIPS Address: %08X\nPC Address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Failed to load word\n\nMIPS address: %08X\nPC address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
}
|
||||
}
|
||||
context.arm_pc = context.arm_pc + 2;
|
||||
|
@ -479,7 +479,7 @@ bool CMipsMemoryVM::FilterArmException(uint32_t MemAddress, mcontext_t & context
|
|||
{
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store word\n\nMIPS Address: %08X\nPC Address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store word\n\nMIPS address: %08X\nPC address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
}
|
||||
}
|
||||
context.arm_pc = context.arm_pc + 2;
|
||||
|
@ -493,7 +493,7 @@ bool CMipsMemoryVM::FilterArmException(uint32_t MemAddress, mcontext_t & context
|
|||
{
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store word\n\nMIPS Address: %08X\nPC Address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store word\n\nMIPS address: %08X\nPC address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
}
|
||||
}
|
||||
context.arm_pc = context.arm_pc + 4;
|
||||
|
@ -507,7 +507,7 @@ bool CMipsMemoryVM::FilterArmException(uint32_t MemAddress, mcontext_t & context
|
|||
{
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store word\n\nMIPS Address: %08X\nPC Address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store word\n\nMIPS address: %08X\nPC address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
}
|
||||
}
|
||||
context.arm_pc = context.arm_pc + 4;
|
||||
|
@ -521,7 +521,7 @@ bool CMipsMemoryVM::FilterArmException(uint32_t MemAddress, mcontext_t & context
|
|||
{
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Failed to load word\n\nMIPS Address: %08X\nPC Address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Failed to load word\n\nMIPS address: %08X\nPC address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
}
|
||||
}
|
||||
context.arm_pc = context.arm_pc + 4;
|
||||
|
@ -536,7 +536,7 @@ bool CMipsMemoryVM::FilterArmException(uint32_t MemAddress, mcontext_t & context
|
|||
{
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store word\n\nMIPS Address: %08X\nPC Address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store word\n\nMIPS address: %08X\nPC address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
}
|
||||
}
|
||||
context.arm_pc = context.arm_pc + 4;
|
||||
|
@ -549,7 +549,7 @@ bool CMipsMemoryVM::FilterArmException(uint32_t MemAddress, mcontext_t & context
|
|||
{
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store byte\n\nMIPS Address: %08X\nPC Address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store byte\n\nMIPS address: %08X\nPC address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
}
|
||||
}
|
||||
context.arm_pc = context.arm_pc + 2;
|
||||
|
@ -563,7 +563,7 @@ bool CMipsMemoryVM::FilterArmException(uint32_t MemAddress, mcontext_t & context
|
|||
{
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store byte\n\nMIPS Address: %08X\nPC Address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store byte\n\nMIPS address: %08X\nPC address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
}
|
||||
}
|
||||
context.arm_pc = context.arm_pc + 4;
|
||||
|
@ -577,7 +577,7 @@ bool CMipsMemoryVM::FilterArmException(uint32_t MemAddress, mcontext_t & context
|
|||
{
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store half word\n\nMIPS Address: %08X\nPC Address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store half word\n\nMIPS address: %08X\nPC address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
}
|
||||
}
|
||||
context.arm_pc = context.arm_pc + 4;
|
||||
|
@ -591,7 +591,7 @@ bool CMipsMemoryVM::FilterArmException(uint32_t MemAddress, mcontext_t & context
|
|||
{
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store half word\n\nMIPS Address: %08X\nPC Address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store half word\n\nMIPS address: %08X\nPC address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
}
|
||||
}
|
||||
context.arm_pc = context.arm_pc + 2;
|
||||
|
@ -605,7 +605,7 @@ bool CMipsMemoryVM::FilterArmException(uint32_t MemAddress, mcontext_t & context
|
|||
{
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store half word\n\nMIPS Address: %08X\nPC Address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store half word\n\nMIPS address: %08X\nPC address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
}
|
||||
}
|
||||
context.arm_pc = context.arm_pc + 2;
|
||||
|
@ -619,7 +619,7 @@ bool CMipsMemoryVM::FilterArmException(uint32_t MemAddress, mcontext_t & context
|
|||
{
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store word\n\nMIPS Address: %08X\nPC Address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store word\n\nMIPS address: %08X\nPC address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
}
|
||||
}
|
||||
context.arm_pc = context.arm_pc + 2;
|
||||
|
@ -633,7 +633,7 @@ bool CMipsMemoryVM::FilterArmException(uint32_t MemAddress, mcontext_t & context
|
|||
{
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Failed to load word\n\nMIPS Address: %08X\nPC Address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Failed to load word\n\nMIPS address: %08X\nPC address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
}
|
||||
}
|
||||
context.arm_pc = context.arm_pc + 2;
|
||||
|
@ -647,7 +647,7 @@ bool CMipsMemoryVM::FilterArmException(uint32_t MemAddress, mcontext_t & context
|
|||
{
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store byte\n\nMIPS Address: %08X\nPC Address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store byte\n\nMIPS address: %08X\nPC address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
}
|
||||
}
|
||||
context.arm_pc = context.arm_pc + 2;
|
||||
|
@ -661,7 +661,7 @@ bool CMipsMemoryVM::FilterArmException(uint32_t MemAddress, mcontext_t & context
|
|||
{
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store half word\n\nMIPS Address: %08X\nPC Address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store half word\n\nMIPS address: %08X\nPC address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
}
|
||||
}
|
||||
context.arm_pc = context.arm_pc + 4;
|
||||
|
@ -675,7 +675,7 @@ bool CMipsMemoryVM::FilterArmException(uint32_t MemAddress, mcontext_t & context
|
|||
{
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store word\n\nMIPS Address: %08X\nPC Address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Failed to store word\n\nMIPS address: %08X\nPC address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
}
|
||||
}
|
||||
context.arm_pc = context.arm_pc + 4;
|
||||
|
@ -689,7 +689,7 @@ bool CMipsMemoryVM::FilterArmException(uint32_t MemAddress, mcontext_t & context
|
|||
{
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Failed to load half word\n\nMIPS Address: %08X\nPC Address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Failed to load half word\n\nMIPS address: %08X\nPC address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
}
|
||||
}
|
||||
context.arm_pc = context.arm_pc + 4;
|
||||
|
@ -703,7 +703,7 @@ bool CMipsMemoryVM::FilterArmException(uint32_t MemAddress, mcontext_t & context
|
|||
{
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Failed to load half word\n\nMIPS Address: %08X\nPC Address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Failed to load half word\n\nMIPS address: %08X\nPC address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
}
|
||||
}
|
||||
context.arm_pc = context.arm_pc + 4;
|
||||
|
@ -718,7 +718,7 @@ bool CMipsMemoryVM::FilterArmException(uint32_t MemAddress, mcontext_t & context
|
|||
{
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Failed to load half word\n\nMIPS Address: %08X\nPC Address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Failed to load half word\n\nMIPS address: %08X\nPC address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
}
|
||||
}
|
||||
context.arm_pc = context.arm_pc + 4;
|
||||
|
@ -732,7 +732,7 @@ bool CMipsMemoryVM::FilterArmException(uint32_t MemAddress, mcontext_t & context
|
|||
{
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Failed to load word\n\nMIPS Address: %08X\nPC Address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Failed to load word\n\nMIPS address: %08X\nPC address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
}
|
||||
}
|
||||
context.arm_pc = context.arm_pc + 4;
|
||||
|
@ -746,7 +746,7 @@ bool CMipsMemoryVM::FilterArmException(uint32_t MemAddress, mcontext_t & context
|
|||
{
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Failed to load word\n\nMIPS Address: %08X\nPC Address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Failed to load word\n\nMIPS address: %08X\nPC address: %08X", MemAddress, context.arm_pc).c_str());
|
||||
}
|
||||
}
|
||||
context.arm_pc = context.arm_pc + 4;
|
||||
|
|
|
@ -4,7 +4,7 @@ enum LanguageStringID
|
|||
{
|
||||
EMPTY_STRING = 0,
|
||||
|
||||
// Meta Information
|
||||
// Meta information
|
||||
|
||||
// About DLL
|
||||
LANGUAGE_NAME = 1,
|
||||
|
@ -110,7 +110,7 @@ enum LanguageStringID
|
|||
MENU_SLOT_10 = 200,
|
||||
MENU_SLOT_SAVE = 201,
|
||||
|
||||
// Pop up menu
|
||||
// Pop-up menu
|
||||
POPUP_PLAY = 210,
|
||||
POPUP_INFO = 211,
|
||||
POPUP_SETTINGS = 212,
|
||||
|
@ -171,7 +171,6 @@ enum LanguageStringID
|
|||
MENUDES_GAME_SETTINGS = 285,
|
||||
MENUDES_GAME_CHEATS = 286,
|
||||
|
||||
|
||||
// ROM browser
|
||||
|
||||
// ROM browser fields
|
||||
|
@ -197,7 +196,6 @@ enum LanguageStringID
|
|||
RB_FILE_FORMAT = 319,
|
||||
RB_NAME = 321,
|
||||
|
||||
|
||||
// Select ROM
|
||||
SELECT_ROM_DIR = 320,
|
||||
|
||||
|
|
|
@ -373,7 +373,7 @@ void CLanguage::LoadDefaultStrings(void)
|
|||
DEF_STR(DISKSAVE_SHADOW, "Full Disk Copy");
|
||||
DEF_STR(DISKSAVE_RAM, "Save Area Only");
|
||||
|
||||
// ROM Information
|
||||
// ROM information
|
||||
|
||||
// ROM info title
|
||||
DEF_STR(INFO_TITLE, "ROM Information");
|
||||
|
@ -434,7 +434,7 @@ void CLanguage::LoadDefaultStrings(void)
|
|||
DEF_STR(CHEAT_CHANGED_MSG, "Cheat has been changed.\n\nDo you want to update?");
|
||||
DEF_STR(CHEAT_CHANGED_TITLE, "Cheat updated");
|
||||
|
||||
// Cheat Pop-up menu
|
||||
// Cheat pop-up menu
|
||||
DEF_STR(CHEAT_ADDNEW, "Add New Cheat...");
|
||||
DEF_STR(CHEAT_EDIT, "Edit");
|
||||
DEF_STR(CHEAT_DELETE, "Delete");
|
||||
|
|
|
@ -44,7 +44,7 @@ void CN64System::CloseCpu()
|
|||
m_EndEmulation = true;
|
||||
if (g_Settings->LoadBool(GameRunning_CPU_Paused))
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceDebug, "Resume cpu");
|
||||
WriteTrace(TraceN64System, TraceDebug, "Resume CPU");
|
||||
m_hPauseEvent.Trigger();
|
||||
}
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ CEnhancement::CEnhancement(const char * Ident, const char * Entry) :
|
|||
m_Name = &(Lines[0][CurrentLine]);
|
||||
m_NameAndExtension = m_Name;
|
||||
|
||||
//key=value
|
||||
// Key=value
|
||||
while (CurrentLine < Lines.size())
|
||||
{
|
||||
const char * Pos = strchr(Lines[CurrentLine].c_str(), '=');
|
||||
|
@ -189,7 +189,7 @@ CEnhancement::CEnhancement(const char * Ident, const char * Entry) :
|
|||
}
|
||||
}
|
||||
|
||||
//Gameshark Code
|
||||
// Gameshark code
|
||||
while (CurrentLine < Lines.size())
|
||||
{
|
||||
char TempFormat[128] = { 0 };
|
||||
|
@ -231,7 +231,7 @@ CEnhancement::CEnhancement(const char * Ident, const char * Entry) :
|
|||
m_Entries.push_back(GSEntry);
|
||||
}
|
||||
|
||||
//Options
|
||||
// Options
|
||||
uint32_t OptionSize = 0;
|
||||
while (CurrentLine < Lines.size())
|
||||
{
|
||||
|
|
|
@ -164,7 +164,7 @@ bool CEnhancmentFile::MoveToSection(const char * Section, bool ChangeCurrentSect
|
|||
}
|
||||
|
||||
std::unique_ptr<char> Data;
|
||||
char *Input = nullptr;
|
||||
char * Input = nullptr;
|
||||
int MaxDataSize = 0, DataSize = 0, ReadPos = 0, result;
|
||||
|
||||
FILELOC_ITR iter = m_SectionsPos.find(std::string(Section));
|
||||
|
@ -183,7 +183,7 @@ bool CEnhancmentFile::MoveToSection(const char * Section, bool ChangeCurrentSect
|
|||
{
|
||||
m_File.Seek(m_lastSectionSearch, CFileBase::begin);
|
||||
|
||||
//long Fpos;
|
||||
// Long Fpos;
|
||||
uint8_t pUTF8[3];
|
||||
pUTF8[0] = 0xef;
|
||||
pUTF8[1] = 0xbb;
|
||||
|
@ -195,7 +195,7 @@ bool CEnhancmentFile::MoveToSection(const char * Section, bool ChangeCurrentSect
|
|||
if (result <= 1) { continue; }
|
||||
if (strlen(CleanLine(Input)) <= 1) { continue; }
|
||||
|
||||
//We Only care about sections
|
||||
// We only care about sections
|
||||
char * CurrentSection = Input;
|
||||
|
||||
if (m_lastSectionSearch == 0 && !memcmp(CurrentSection, pUTF8, 3))
|
||||
|
@ -206,7 +206,7 @@ bool CEnhancmentFile::MoveToSection(const char * Section, bool ChangeCurrentSect
|
|||
if (CurrentSection[0] != '[') { continue; }
|
||||
int lineEndPos = (int)strlen(CurrentSection) - 1;
|
||||
if (CurrentSection[lineEndPos] != ']') { continue; }
|
||||
//take off the ']' from the end of the string
|
||||
// Take off the ']' from the end of the string
|
||||
CurrentSection[lineEndPos] = 0;
|
||||
CurrentSection += 1;
|
||||
m_lastSectionSearch = (m_File.GetPosition() - DataSize) + ReadPos;
|
||||
|
@ -385,9 +385,9 @@ void CEnhancmentFile::SaveCurrentSection(void)
|
|||
|
||||
int MaxDataSize = 0, DataSize = 0, ReadPos = 0, result;
|
||||
std::unique_ptr<char> Data;
|
||||
char *Input = nullptr;
|
||||
char * Input = nullptr;
|
||||
|
||||
//Skip first line as it is the section name
|
||||
// Skip first line as it is the section name
|
||||
int StartPos = m_CurrentSectionFilePos;
|
||||
int EndPos = StartPos;
|
||||
do
|
||||
|
@ -457,7 +457,7 @@ int CEnhancmentFile::GetStringFromFile(char * & String, std::unique_ptr<char> &
|
|||
}
|
||||
else
|
||||
{
|
||||
//Increase buffer size
|
||||
// Increase buffer size
|
||||
int NewMaxDataSize = MaxDataSize + BufferIncrease;
|
||||
char * NewBuffer = new char[NewMaxDataSize];
|
||||
if (NewBuffer == nullptr)
|
||||
|
@ -491,7 +491,7 @@ const char * CEnhancmentFile::CleanLine(char * Line)
|
|||
{
|
||||
char * Pos = Line;
|
||||
|
||||
//Remove any comment from the line
|
||||
// Remove any comment from the line
|
||||
while (Pos != nullptr)
|
||||
{
|
||||
Pos = strchr(Pos, '/');
|
||||
|
@ -524,7 +524,7 @@ const char * CEnhancmentFile::CleanLine(char * Line)
|
|||
}
|
||||
}
|
||||
|
||||
//strip any spaces or line feeds from the end of the line
|
||||
// Strip any spaces or line feeds from the end of the line
|
||||
for (int32_t i = (int32_t)strlen(&Line[0]) - 1; i >= 0; i--)
|
||||
{
|
||||
if (Line[i] != ' ' && Line[i] != '\r')
|
||||
|
@ -620,4 +620,3 @@ void CEnhancmentFile::ClearSectionPosList(long FilePos)
|
|||
m_lastSectionSearch = FilePos;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -411,7 +411,7 @@ void CEnhancements::ApplyGameSharkCodes(CMipsMemoryVM & MMU, CODES & CodeEntry,
|
|||
|
||||
switch (Code.Command() & 0xFF000000)
|
||||
{
|
||||
case 0x50000000: // Gameshark / AR
|
||||
case 0x50000000: // Gameshark / Action Replay
|
||||
if ((CurrentEntry + 1) >= (int)CodeEntry.size())
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
|
@ -532,7 +532,7 @@ void CEnhancements::ApplyGameSharkCodes(CMipsMemoryVM & MMU, CODES & CodeEntry,
|
|||
case 0x89000000:
|
||||
case 0xA8000000:
|
||||
case 0xA9000000:
|
||||
//Ignore - GS Button
|
||||
// Ignore - Gameshark (GS) button
|
||||
break;
|
||||
default:
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
|
@ -681,7 +681,7 @@ void CEnhancements::ScanFileThread(void)
|
|||
{
|
||||
do
|
||||
{
|
||||
CEnhancmentFile EnhancmentFile(File, "Enhancment");
|
||||
CEnhancmentFile EnhancmentFile(File, CEnhancement::EnhancementIdent);
|
||||
CEnhancmentFile::SectionList Sections;
|
||||
EnhancmentFile.GetSections(Sections);
|
||||
for (CEnhancmentFile::SectionList::const_iterator itr = Sections.begin(); itr != Sections.end(); itr++)
|
||||
|
@ -699,7 +699,7 @@ void CEnhancements::ScanFileThread(void)
|
|||
{
|
||||
do
|
||||
{
|
||||
CEnhancmentFile EnhancmentFile(File, "Enhancment");
|
||||
CEnhancmentFile EnhancmentFile(File, CEnhancement::EnhancementIdent);
|
||||
CEnhancmentFile::SectionList Sections;
|
||||
EnhancmentFile.GetSections(Sections);
|
||||
for (CEnhancmentFile::SectionList::const_iterator itr = Sections.begin(); itr != Sections.end(); itr++)
|
||||
|
|
|
@ -32,7 +32,7 @@ private:
|
|||
int32_t m_ViFrameRateWhole;
|
||||
uint32_t m_ViFrameRateFraction;
|
||||
|
||||
//Dlist
|
||||
// Dlist
|
||||
HighResTimeStamp m_LastDlistFrame;
|
||||
uint64_t m_FramesDlist[NoOfFrames];
|
||||
uint32_t m_CurrentDlistFrame;
|
||||
|
|
|
@ -88,7 +88,7 @@ bool DelaySlotEffectsCompare(uint32_t PC, uint32_t Reg1, uint32_t Reg2)
|
|||
default:
|
||||
if (CDebugSettings::HaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Does %s effect Delay slot at %X?", R4300iOpcodeName(Command.Hex, PC + 4), PC).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Does %s effect delay slot at %X?", R4300iOpcodeName(Command.Hex, PC + 4), PC).c_str());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ bool DelaySlotEffectsCompare(uint32_t PC, uint32_t Reg1, uint32_t Reg2)
|
|||
default:
|
||||
if (CDebugSettings::HaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Does %s effect Delay slot at %X?\n6", R4300iOpcodeName(Command.Hex, PC + 4), PC).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Does %s effect delay slot at %X?\n6", R4300iOpcodeName(Command.Hex, PC + 4), PC).c_str());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ bool DelaySlotEffectsCompare(uint32_t PC, uint32_t Reg1, uint32_t Reg2)
|
|||
{
|
||||
if (CDebugSettings::HaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Does %s effect Delay slot at %X?\n7", R4300iOpcodeName(Command.Hex, PC + 4), PC).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Does %s effect delay slot at %X?\n7", R4300iOpcodeName(Command.Hex, PC + 4), PC).c_str());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ bool DelaySlotEffectsCompare(uint32_t PC, uint32_t Reg1, uint32_t Reg2)
|
|||
default:
|
||||
if (CDebugSettings::HaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Does %s effect Delay slot at %X?", R4300iOpcodeName(Command.Hex, PC + 4), PC).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Does %s effect delay slot at %X?", R4300iOpcodeName(Command.Hex, PC + 4), PC).c_str());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ bool DelaySlotEffectsCompare(uint32_t PC, uint32_t Reg1, uint32_t Reg2)
|
|||
default:
|
||||
if (CDebugSettings::HaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Does %s effect Delay slot at %X?", R4300iOpcodeName(Command.Hex, PC + 4), PC).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Does %s effect delay slot at %X?", R4300iOpcodeName(Command.Hex, PC + 4), PC).c_str());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -230,13 +230,13 @@ void CInterpreterCPU::BuildCPU()
|
|||
|
||||
void CInterpreterCPU::InPermLoop()
|
||||
{
|
||||
// *** Changed ***/
|
||||
// Changed
|
||||
//if (CPU_Type == CPU_SyncCores)
|
||||
//{
|
||||
// SyncRegisters.CP0[9] +=5;
|
||||
//}
|
||||
|
||||
/* Interrupts enabled */
|
||||
// Interrupts enabled
|
||||
if ((g_Reg->STATUS_REGISTER & STATUS_IE) == 0 ||
|
||||
(g_Reg->STATUS_REGISTER & STATUS_EXL) != 0 ||
|
||||
(g_Reg->STATUS_REGISTER & STATUS_ERL) != 0 ||
|
||||
|
@ -294,7 +294,7 @@ void CInterpreterCPU::ExecuteCPU()
|
|||
g_Settings->SaveBool(Debugger_SteppingOps, true);
|
||||
}
|
||||
|
||||
g_Debugger->CPUStepStarted(); // may set stepping ops/skip op
|
||||
g_Debugger->CPUStepStarted(); // May set stepping ops/skip op
|
||||
|
||||
if (isStepping())
|
||||
{
|
||||
|
@ -320,7 +320,7 @@ void CInterpreterCPU::ExecuteCPU()
|
|||
} */
|
||||
|
||||
m_R4300i_Opcode[Opcode.op]();
|
||||
_GPR[0].DW = 0; /* MIPS $zero hard-wired to 0 */
|
||||
_GPR[0].DW = 0; // MIPS $zero hard-wired to 0
|
||||
NextTimer -= CountPerOp;
|
||||
|
||||
if (CDebugSettings::HaveDebugger()) { g_Debugger->CPUStepEnded(); }
|
||||
|
|
|
@ -739,7 +739,8 @@ void TestInterpreterJump(uint32_t PC, uint32_t TargetPC, int32_t Reg1, int32_t R
|
|||
R4300iOp::m_TestTimer = true;
|
||||
}
|
||||
|
||||
/************************* Opcode functions *************************/
|
||||
// Opcode functions
|
||||
|
||||
void R4300iOp::J()
|
||||
{
|
||||
m_NextInstruction = DELAY_SLOT;
|
||||
|
@ -1686,7 +1687,9 @@ void R4300iOp::SD()
|
|||
TLB_WRITE_EXCEPTION(Address);
|
||||
}
|
||||
}
|
||||
/********************** R4300i OpCodes: Special **********************/
|
||||
|
||||
// R4300i opcodes: Special
|
||||
|
||||
void R4300iOp::SPECIAL_SLL()
|
||||
{
|
||||
_GPR[m_Opcode.rd].DW = (_GPR[m_Opcode.rt].W[0] << m_Opcode.sa);
|
||||
|
@ -1810,7 +1813,7 @@ void R4300iOp::SPECIAL_DIV()
|
|||
{
|
||||
if (bShowDivByZero())
|
||||
{
|
||||
g_Notify->DisplayError("DIV by 0 ???");
|
||||
g_Notify->DisplayError("DIV by 0");
|
||||
}
|
||||
_RegLO->DW = 0;
|
||||
_RegHI->DW = 0;
|
||||
|
@ -1828,7 +1831,7 @@ void R4300iOp::SPECIAL_DIVU()
|
|||
{
|
||||
if (bShowDivByZero())
|
||||
{
|
||||
g_Notify->DisplayError("DIVU by 0 ???");
|
||||
g_Notify->DisplayError("DIVU by 0");
|
||||
}
|
||||
_RegLO->DW = 0;
|
||||
_RegHI->DW = 0;
|
||||
|
@ -1874,7 +1877,7 @@ void R4300iOp::SPECIAL_DDIV()
|
|||
{
|
||||
if (HaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError("DDIV by 0 ???");
|
||||
g_Notify->DisplayError("DDIV by 0");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1890,7 +1893,7 @@ void R4300iOp::SPECIAL_DDIVU()
|
|||
{
|
||||
if (HaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError("DDIVU by 0 ???");
|
||||
g_Notify->DisplayError("DDIVU by 0");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2063,7 +2066,8 @@ void R4300iOp::SPECIAL_DSRA32()
|
|||
_GPR[m_Opcode.rd].DW = (_GPR[m_Opcode.rt].DW >> (m_Opcode.sa + 32));
|
||||
}
|
||||
|
||||
/********************** R4300i OpCodes: RegImm **********************/
|
||||
// R4300i opcodes: RegImm
|
||||
|
||||
void R4300iOp::REGIMM_BLTZ()
|
||||
{
|
||||
m_NextInstruction = DELAY_SLOT;
|
||||
|
@ -2256,12 +2260,13 @@ void R4300iOp::REGIMM_TNEI()
|
|||
}
|
||||
}
|
||||
|
||||
/************************** COP0 functions **************************/
|
||||
// COP0 functions
|
||||
|
||||
void R4300iOp::COP0_MF()
|
||||
{
|
||||
if (LogCP0reads())
|
||||
{
|
||||
LogMessage("%08X: R4300i Read from %s (0x%08X)", (*_PROGRAM_COUNTER), CRegName::Cop0[m_Opcode.rd], _CP0[m_Opcode.rd]);
|
||||
LogMessage("%08X: R4300i read from %s (0x%08X)", (*_PROGRAM_COUNTER), CRegName::Cop0[m_Opcode.rd], _CP0[m_Opcode.rd]);
|
||||
}
|
||||
|
||||
if (m_Opcode.rd == 9)
|
||||
|
@ -2275,8 +2280,8 @@ void R4300iOp::COP0_MT()
|
|||
{
|
||||
if (LogCP0changes())
|
||||
{
|
||||
LogMessage("%08X: Writing 0x%X to %s register (Originally: 0x%08X)", (*_PROGRAM_COUNTER), _GPR[m_Opcode.rt].UW[0], CRegName::Cop0[m_Opcode.rd], _CP0[m_Opcode.rd]);
|
||||
if (m_Opcode.rd == 11) //Compare
|
||||
LogMessage("%08X: Writing 0x%X to %s register (originally: 0x%08X)", (*_PROGRAM_COUNTER), _GPR[m_Opcode.rt].UW[0], CRegName::Cop0[m_Opcode.rd], _CP0[m_Opcode.rd]);
|
||||
if (m_Opcode.rd == 11) // Compare
|
||||
{
|
||||
LogMessage("%08X: Cause register changed from %08X to %08X", (*_PROGRAM_COUNTER), g_Reg->CAUSE_REGISTER, (g_Reg->CAUSE_REGISTER & ~CAUSE_IP7));
|
||||
}
|
||||
|
@ -2284,39 +2289,39 @@ void R4300iOp::COP0_MT()
|
|||
|
||||
switch (m_Opcode.rd)
|
||||
{
|
||||
case 0: //Index
|
||||
case 2: //EntryLo0
|
||||
case 3: //EntryLo1
|
||||
case 5: //PageMask
|
||||
case 10: //Entry Hi
|
||||
case 14: //EPC
|
||||
case 16: //Config
|
||||
case 18: //WatchLo
|
||||
case 19: //WatchHi
|
||||
case 28: //Tag lo
|
||||
case 29: //Tag Hi
|
||||
case 30: //ErrEPC
|
||||
case 0: // Index
|
||||
case 2: // EntryLo0
|
||||
case 3: // EntryLo1
|
||||
case 5: // PageMask
|
||||
case 10: // Entry Hi
|
||||
case 14: // EPC
|
||||
case 16: // Config
|
||||
case 18: // WatchLo
|
||||
case 19: // WatchHi
|
||||
case 28: // Tag lo
|
||||
case 29: // Tag Hi
|
||||
case 30: // ErrEPC
|
||||
_CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0];
|
||||
break;
|
||||
case 6: //Wired
|
||||
case 6: // Wired
|
||||
g_SystemTimer->UpdateTimers();
|
||||
_CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0];
|
||||
break;
|
||||
case 4: //Context
|
||||
case 4: // Context
|
||||
_CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0] & 0xFF800000;
|
||||
break;
|
||||
case 9: //Count
|
||||
case 9: // Count
|
||||
g_SystemTimer->UpdateTimers();
|
||||
_CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0];
|
||||
g_SystemTimer->UpdateCompareTimer();
|
||||
break;
|
||||
case 11: //Compare
|
||||
case 11: // Compare
|
||||
g_SystemTimer->UpdateTimers();
|
||||
_CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0];
|
||||
g_Reg->FAKE_CAUSE_REGISTER &= ~CAUSE_IP7;
|
||||
g_SystemTimer->UpdateCompareTimer();
|
||||
break;
|
||||
case 12: //Status
|
||||
case 12: // Status
|
||||
if ((_CP0[m_Opcode.rd] & STATUS_FR) != (_GPR[m_Opcode.rt].UW[0] & STATUS_FR))
|
||||
{
|
||||
_CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0];
|
||||
|
@ -2332,7 +2337,7 @@ void R4300iOp::COP0_MT()
|
|||
}
|
||||
g_Reg->CheckInterrupts();
|
||||
break;
|
||||
case 13: //cause
|
||||
case 13: // Cause
|
||||
_CP0[m_Opcode.rd] &= 0xFFFFCFF;
|
||||
if ((_GPR[m_Opcode.rt].UW[0] & 0x300) != 0 && HaveDebugger())
|
||||
{
|
||||
|
@ -2344,7 +2349,8 @@ void R4300iOp::COP0_MT()
|
|||
}
|
||||
}
|
||||
|
||||
/************************** COP0 CO functions ***********************/
|
||||
// COP0 CO functions
|
||||
|
||||
void R4300iOp::COP0_CO_TLBR()
|
||||
{
|
||||
if (!g_System->bUseTlb())
|
||||
|
@ -2399,7 +2405,8 @@ void R4300iOp::COP0_CO_ERET()
|
|||
m_TestTimer = true;
|
||||
}
|
||||
|
||||
/************************** COP1 functions **************************/
|
||||
// COP1 functions
|
||||
|
||||
void R4300iOp::COP1_MF()
|
||||
{
|
||||
TEST_COP1_USABLE_EXCEPTION();
|
||||
|
@ -2419,7 +2426,7 @@ void R4300iOp::COP1_CF()
|
|||
{
|
||||
if (HaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError("CFC1 what register are you writing to ?");
|
||||
g_Notify->DisplayError("CFC1: what register are you writing to?");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -2455,11 +2462,12 @@ void R4300iOp::COP1_CT()
|
|||
}
|
||||
if (HaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError("CTC1 what register are you writing to ?");
|
||||
g_Notify->DisplayError("CTC1: what register are you writing to?");
|
||||
}
|
||||
}
|
||||
|
||||
/************************* COP1: BC1 functions ***********************/
|
||||
// COP1: BC1 functions
|
||||
|
||||
void R4300iOp::COP1_BCF()
|
||||
{
|
||||
TEST_COP1_USABLE_EXCEPTION();
|
||||
|
@ -2517,18 +2525,20 @@ void R4300iOp::COP1_BCTL()
|
|||
m_JumpToLocation = (*_PROGRAM_COUNTER) + 8;
|
||||
}
|
||||
}
|
||||
/************************** COP1: S functions ************************/
|
||||
|
||||
// COP1: S functions
|
||||
|
||||
__inline void Float_RoundToInteger32(int32_t * Dest, const float * Source, int RoundType)
|
||||
{
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4244) //warning C4244: disabe conversion from 'float' to 'int32_t', possible loss of data
|
||||
#pragma warning(disable:4244) // warning C4244: disable conversion from 'float' to 'int32_t', possible loss of data
|
||||
|
||||
if (RoundType == FE_TONEAREST)
|
||||
{
|
||||
float reminder = *Source - floorf(*Source);
|
||||
if (reminder == 0.5)
|
||||
{
|
||||
//make any decimal point in even to go to odd and any decimal point in odd stay as odd
|
||||
// Make any decimal point that is even odd, and any decimal point that is odd stay odd
|
||||
if (*Source < 0)
|
||||
{
|
||||
*Dest = (int)truncf(*Source) % 2 != 0 ? floorf(*Source) : ceilf(*Source);
|
||||
|
@ -2553,14 +2563,14 @@ __inline void Float_RoundToInteger32(int32_t * Dest, const float * Source, int R
|
|||
__inline void Float_RoundToInteger64(int64_t * Dest, const float * Source, int RoundType)
|
||||
{
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4244) //warning C4244: disabe conversion from 'float' to 'int64_t', possible loss of data
|
||||
#pragma warning(disable:4244) // warning C4244: disable conversion from 'float' to 'int64_t', possible loss of data
|
||||
|
||||
if (RoundType == FE_TONEAREST)
|
||||
{
|
||||
float reminder = *Source - floorf(*Source);
|
||||
if (reminder == 0.5)
|
||||
{
|
||||
//make any decimal point in even to go to odd and any decimal point in odd stay as odd
|
||||
// Make any decimal point that is even odd, and any decimal point that is odd stay odd
|
||||
if (*Source < 0)
|
||||
{
|
||||
*Dest = (int)truncf(*Source) % 2 != 0 ? floorf(*Source) : ceilf(*Source);
|
||||
|
@ -2753,18 +2763,19 @@ void R4300iOp::COP1_S_CMP()
|
|||
}
|
||||
}
|
||||
|
||||
/************************** COP1: D functions ************************/
|
||||
// COP1: D functions
|
||||
|
||||
__inline void Double_RoundToInteger32(int32_t * Dest, const double * Source, int RoundType)
|
||||
{
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4244) //warning C4244: disabe conversion from 'double' to 'uint32_t', possible loss of data
|
||||
#pragma warning(disable:4244) // warning C4244: disable conversion from 'double' to 'uint32_t', possible loss of data
|
||||
|
||||
if (RoundType == FE_TONEAREST)
|
||||
{
|
||||
double reminder = *Source - floor(*Source);
|
||||
if (reminder == 0.5)
|
||||
{
|
||||
//make any decimal point in even to go to odd and any decimal point in odd stay as odd
|
||||
// Make any decimal point that is even odd, and any decimal point that is odd stay odd
|
||||
if (*Source < 0)
|
||||
{
|
||||
*Dest = (int)truncf(*Source) % 2 != 0 ? floor(*Source) : ceil(*Source);
|
||||
|
@ -2793,14 +2804,14 @@ __inline void Double_RoundToInteger32(int32_t * Dest, const double * Source, int
|
|||
__inline void Double_RoundToInteger64(int64_t * Dest, const double * Source, int RoundType)
|
||||
{
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4244) //warning C4244: disabe conversion from 'double' to 'uint64_t', possible loss of data
|
||||
#pragma warning(disable:4244) // warning C4244: disable conversion from 'double' to 'uint64_t', possible loss of data
|
||||
|
||||
if (RoundType == FE_TONEAREST)
|
||||
{
|
||||
double reminder = *Source - floor(*Source);
|
||||
if (reminder == 0.5)
|
||||
{
|
||||
//make any decimal point in even to go to odd and any decimal point in odd stay as odd
|
||||
// Make any decimal point that is even odd, and any decimal point that is odd stay odd
|
||||
if (*Source < 0)
|
||||
{
|
||||
*Dest = (int)truncf(*Source) % 2 != 0 ? floor(*Source) : ceil(*Source);
|
||||
|
@ -2997,7 +3008,8 @@ void R4300iOp::COP1_D_CMP()
|
|||
}
|
||||
}
|
||||
|
||||
/************************** COP1: W functions ************************/
|
||||
// COP1: W functions
|
||||
|
||||
void R4300iOp::COP1_W_CVT_S()
|
||||
{
|
||||
TEST_COP1_USABLE_EXCEPTION();
|
||||
|
@ -3012,7 +3024,8 @@ void R4300iOp::COP1_W_CVT_D()
|
|||
*(double *)_FPR_D[m_Opcode.fd] = (double)*(int32_t *)_FPR_S[m_Opcode.fs];
|
||||
}
|
||||
|
||||
/************************** COP1: L functions ************************/
|
||||
// COP1: L functions
|
||||
|
||||
void R4300iOp::COP1_L_CVT_S()
|
||||
{
|
||||
TEST_COP1_USABLE_EXCEPTION();
|
||||
|
@ -3027,10 +3040,11 @@ void R4300iOp::COP1_L_CVT_D()
|
|||
*(double *)_FPR_D[m_Opcode.fd] = (double)*(int64_t *)_FPR_D[m_Opcode.fs];
|
||||
}
|
||||
|
||||
/************************** Other functions **************************/
|
||||
// Other functions
|
||||
|
||||
void R4300iOp::UnknownOpcode()
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("%s: %08X\n%s\n\nStopping Emulation !", GS(MSG_UNHANDLED_OP), (*_PROGRAM_COUNTER),
|
||||
g_Notify->DisplayError(stdstr_f("%s: %08X\n%s\n\nStopping emulation", GS(MSG_UNHANDLED_OP), (*_PROGRAM_COUNTER),
|
||||
R4300iOpcodeName(m_Opcode.Hex, (*_PROGRAM_COUNTER))).c_str());
|
||||
g_System->m_EndEmulation = true;
|
||||
|
||||
|
@ -3040,7 +3054,7 @@ void R4300iOp::UnknownOpcode()
|
|||
{
|
||||
int32_t response;
|
||||
|
||||
strcat(Message, "\n\nDo you wish to enter the debugger ?");
|
||||
strcat(Message, "\n\nDo you wish to enter the debugger?");
|
||||
|
||||
response = MessageBox(nullptr, Message, GS(MSG_MSGBOX_ERROR_TITLE), MB_YESNO | MB_ICONERROR);
|
||||
if (response == IDYES)
|
||||
|
|
|
@ -12,7 +12,7 @@ class R4300iOp :
|
|||
public:
|
||||
typedef void(*Func)();
|
||||
|
||||
/************************* OpCode functions *************************/
|
||||
// Opcode functions
|
||||
static void J();
|
||||
static void JAL();
|
||||
static void BNE();
|
||||
|
@ -59,7 +59,7 @@ public:
|
|||
static void SDC1();
|
||||
static void SD();
|
||||
|
||||
/********************** R4300i OpCodes: Special **********************/
|
||||
// R4300i opcodes: Special
|
||||
static void SPECIAL_SLL();
|
||||
static void SPECIAL_SRL();
|
||||
static void SPECIAL_SRA();
|
||||
|
@ -113,7 +113,7 @@ public:
|
|||
static void SPECIAL_DSRL32();
|
||||
static void SPECIAL_DSRA32();
|
||||
|
||||
/********************** R4300i OpCodes: RegImm **********************/
|
||||
// R4300i opcodes: RegImm
|
||||
static void REGIMM_BLTZ();
|
||||
static void REGIMM_BGEZ();
|
||||
static void REGIMM_BLTZL();
|
||||
|
@ -127,18 +127,18 @@ public:
|
|||
static void REGIMM_TLTIU();
|
||||
static void REGIMM_TNEI();
|
||||
|
||||
/************************** COP0 functions **************************/
|
||||
// COP0 functions
|
||||
static void COP0_MF();
|
||||
static void COP0_MT();
|
||||
|
||||
/************************** COP0 CO functions ***********************/
|
||||
// COP0 CO functions
|
||||
static void COP0_CO_TLBR();
|
||||
static void COP0_CO_TLBWI();
|
||||
static void COP0_CO_TLBWR();
|
||||
static void COP0_CO_TLBP();
|
||||
static void COP0_CO_ERET();
|
||||
|
||||
/************************** COP1 functions **************************/
|
||||
// COP1 functions
|
||||
static void COP1_MF();
|
||||
static void COP1_DMF();
|
||||
static void COP1_CF();
|
||||
|
@ -146,13 +146,13 @@ public:
|
|||
static void COP1_DMT();
|
||||
static void COP1_CT();
|
||||
|
||||
/************************* COP1: BC1 functions ***********************/
|
||||
// COP1: BC1 functions
|
||||
static void COP1_BCF();
|
||||
static void COP1_BCT();
|
||||
static void COP1_BCFL();
|
||||
static void COP1_BCTL();
|
||||
|
||||
/************************** COP1: S functions ************************/
|
||||
// COP1: S functions
|
||||
static void COP1_S_ADD();
|
||||
static void COP1_S_SUB();
|
||||
static void COP1_S_MUL();
|
||||
|
@ -174,7 +174,7 @@ public:
|
|||
static void COP1_S_CVT_L();
|
||||
static void COP1_S_CMP();
|
||||
|
||||
/************************** COP1: D functions ************************/
|
||||
// COP1: D functions
|
||||
static void COP1_D_ADD();
|
||||
static void COP1_D_SUB();
|
||||
static void COP1_D_MUL();
|
||||
|
@ -196,15 +196,15 @@ public:
|
|||
static void COP1_D_CVT_L();
|
||||
static void COP1_D_CMP();
|
||||
|
||||
/************************** COP1: W functions ************************/
|
||||
// COP1: W functions
|
||||
static void COP1_W_CVT_S();
|
||||
static void COP1_W_CVT_D();
|
||||
|
||||
/************************** COP1: L functions ************************/
|
||||
// COP1: L functions
|
||||
static void COP1_L_CVT_S();
|
||||
static void COP1_L_CVT_D();
|
||||
|
||||
/************************** Other functions **************************/
|
||||
// Other functions
|
||||
static void UnknownOpcode();
|
||||
|
||||
static Func* BuildInterpreter();
|
||||
|
|
|
@ -622,7 +622,8 @@ R4300iOp32::Func * R4300iOp32::BuildInterpreter()
|
|||
return Jump_Opcode;
|
||||
}
|
||||
|
||||
/************************* Opcode functions *************************/
|
||||
// Opcode functions
|
||||
|
||||
void R4300iOp32::JAL()
|
||||
{
|
||||
m_NextInstruction = DELAY_SLOT;
|
||||
|
@ -1103,7 +1104,8 @@ void R4300iOp32::LL()
|
|||
}
|
||||
}
|
||||
|
||||
/********************** R4300i OpCodes: Special **********************/
|
||||
// R4300i opcodes: Special
|
||||
|
||||
void R4300iOp32::SPECIAL_SLL()
|
||||
{
|
||||
_GPR[m_Opcode.rd].W[0] = (_GPR[m_Opcode.rt].W[0] << m_Opcode.sa);
|
||||
|
@ -1211,11 +1213,12 @@ void R4300iOp32::SPECIAL_TEQ()
|
|||
{
|
||||
if (_GPR[m_Opcode.rs].W[0] == _GPR[m_Opcode.rt].W[0] && CDebugSettings::HaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError("Should trap this ???");
|
||||
g_Notify->DisplayError("Should we trap this?");
|
||||
}
|
||||
}
|
||||
|
||||
/********************** R4300i OpCodes: RegImm **********************/
|
||||
// R4300i opcodes: RegImm
|
||||
|
||||
void R4300iOp32::REGIMM_BLTZ()
|
||||
{
|
||||
m_NextInstruction = DELAY_SLOT;
|
||||
|
@ -1352,12 +1355,13 @@ void R4300iOp32::REGIMM_BGEZAL()
|
|||
_GPR[31].W[0] = (int32_t)((*_PROGRAM_COUNTER) + 8);
|
||||
}
|
||||
|
||||
/************************** COP0 functions **************************/
|
||||
// COP0 functions
|
||||
|
||||
void R4300iOp32::COP0_MF()
|
||||
{
|
||||
if (LogCP0reads())
|
||||
{
|
||||
LogMessage("%08X: R4300i Read from %s (0x%08X)", (*_PROGRAM_COUNTER), CRegName::Cop0[m_Opcode.rd], _CP0[m_Opcode.rd]);
|
||||
LogMessage("%08X: R4300i read from %s (0x%08X)", (*_PROGRAM_COUNTER), CRegName::Cop0[m_Opcode.rd], _CP0[m_Opcode.rd]);
|
||||
}
|
||||
|
||||
if (m_Opcode.rd == 9)
|
||||
|
@ -1372,7 +1376,7 @@ void R4300iOp32::COP0_MT()
|
|||
if (LogCP0changes())
|
||||
{
|
||||
LogMessage("%08X: Writing 0x%X to %s register (Originally: 0x%08X)", (*_PROGRAM_COUNTER), _GPR[m_Opcode.rt].UW[0], CRegName::Cop0[m_Opcode.rd], _CP0[m_Opcode.rd]);
|
||||
if (m_Opcode.rd == 11) //Compare
|
||||
if (m_Opcode.rd == 11) // Compare
|
||||
{
|
||||
LogMessage("%08X: Cause register changed from %08X to %08X", (*_PROGRAM_COUNTER), g_Reg->CAUSE_REGISTER, (g_Reg->CAUSE_REGISTER & ~CAUSE_IP7));
|
||||
}
|
||||
|
@ -1380,39 +1384,39 @@ void R4300iOp32::COP0_MT()
|
|||
|
||||
switch (m_Opcode.rd)
|
||||
{
|
||||
case 0: //Index
|
||||
case 2: //EntryLo0
|
||||
case 3: //EntryLo1
|
||||
case 5: //PageMask
|
||||
case 10: //Entry Hi
|
||||
case 14: //EPC
|
||||
case 16: //Config
|
||||
case 18: //WatchLo
|
||||
case 19: //WatchHi
|
||||
case 28: //Tag lo
|
||||
case 29: //Tag Hi
|
||||
case 30: //ErrEPC
|
||||
case 0: // Index
|
||||
case 2: // EntryLo0
|
||||
case 3: // EntryLo1
|
||||
case 5: // PageMask
|
||||
case 10: // Entry Hi
|
||||
case 14: // EPC
|
||||
case 16: // Config
|
||||
case 18: // WatchLo
|
||||
case 19: // WatchHi
|
||||
case 28: // Tag Lo
|
||||
case 29: // Tag Hi
|
||||
case 30: // ErrEPC
|
||||
_CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0];
|
||||
break;
|
||||
case 6: //Wired
|
||||
case 6: // Wired
|
||||
g_SystemTimer->UpdateTimers();
|
||||
_CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0];
|
||||
break;
|
||||
case 4: //Context
|
||||
case 4: // Context
|
||||
_CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0] & 0xFF800000;
|
||||
break;
|
||||
case 9: //Count
|
||||
case 9: // Count
|
||||
g_SystemTimer->UpdateTimers();
|
||||
_CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0];
|
||||
g_SystemTimer->UpdateCompareTimer();
|
||||
break;
|
||||
case 11: //Compare
|
||||
case 11: // Compare
|
||||
g_SystemTimer->UpdateTimers();
|
||||
_CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0];
|
||||
g_Reg->FAKE_CAUSE_REGISTER &= ~CAUSE_IP7;
|
||||
g_SystemTimer->UpdateCompareTimer();
|
||||
break;
|
||||
case 12: //Status
|
||||
case 12: // Status
|
||||
if ((_CP0[m_Opcode.rd] & STATUS_FR) != (_GPR[m_Opcode.rt].UW[0] & STATUS_FR))
|
||||
{
|
||||
_CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0];
|
||||
|
@ -1424,11 +1428,11 @@ void R4300iOp32::COP0_MT()
|
|||
}
|
||||
if ((_CP0[m_Opcode.rd] & 0x18) != 0 && CDebugSettings::HaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError("Left kernel mode ??");
|
||||
g_Notify->DisplayError("Left kernel mode?");
|
||||
}
|
||||
g_Reg->CheckInterrupts();
|
||||
break;
|
||||
case 13: //cause
|
||||
case 13: // Cause
|
||||
_CP0[m_Opcode.rd] &= 0xFFFFCFF;
|
||||
if ((_GPR[m_Opcode.rt].UW[0] & 0x300) != 0 && CDebugSettings::HaveDebugger())
|
||||
{
|
||||
|
@ -1440,7 +1444,8 @@ void R4300iOp32::COP0_MT()
|
|||
}
|
||||
}
|
||||
|
||||
/************************** COP1 functions **************************/
|
||||
// COP1 functions
|
||||
|
||||
void R4300iOp32::COP1_MF()
|
||||
{
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
|
@ -1452,7 +1457,7 @@ void R4300iOp32::COP1_CF()
|
|||
TEST_COP1_USABLE_EXCEPTION
|
||||
if (m_Opcode.fs != 31 && m_Opcode.fs != 0)
|
||||
{
|
||||
if (CDebugSettings::HaveDebugger()) { g_Notify->DisplayError("CFC1 what register are you writing to ?"); }
|
||||
if (CDebugSettings::HaveDebugger()) { g_Notify->DisplayError("CFC1: what register are you writing to?"); }
|
||||
return;
|
||||
}
|
||||
_GPR[m_Opcode.rt].W[0] = (int32_t)_FPCR[m_Opcode.fs];
|
||||
|
|
|
@ -6,7 +6,7 @@ class R4300iOp32 :
|
|||
public R4300iOp
|
||||
{
|
||||
public:
|
||||
/************************* OpCode functions *************************/
|
||||
// Opcode functions
|
||||
static void JAL();
|
||||
static void BEQ();
|
||||
static void BNE();
|
||||
|
@ -34,7 +34,7 @@ public:
|
|||
static void LWU();
|
||||
static void LL();
|
||||
|
||||
/********************** R4300i OpCodes: Special **********************/
|
||||
// R4300i opcodes: Special
|
||||
static void SPECIAL_SLL();
|
||||
static void SPECIAL_SRL();
|
||||
static void SPECIAL_SRA();
|
||||
|
@ -53,7 +53,7 @@ public:
|
|||
static void SPECIAL_SLTU();
|
||||
static void SPECIAL_TEQ();
|
||||
|
||||
/********************** R4300i OpCodes: RegImm **********************/
|
||||
// R4300i opcodes: RegImm
|
||||
static void REGIMM_BLTZ();
|
||||
static void REGIMM_BGEZ();
|
||||
static void REGIMM_BLTZL();
|
||||
|
@ -61,11 +61,11 @@ public:
|
|||
static void REGIMM_BLTZAL();
|
||||
static void REGIMM_BGEZAL();
|
||||
|
||||
/************************** COP0 functions **************************/
|
||||
// COP0 functions
|
||||
static void COP0_MF();
|
||||
static void COP0_MT();
|
||||
|
||||
/************************** COP1 functions **************************/
|
||||
// COP1 functions
|
||||
static void COP1_MF();
|
||||
static void COP1_CF();
|
||||
static void COP1_DMT();
|
||||
|
|
|
@ -17,7 +17,7 @@ void CAudio::Reset()
|
|||
m_SecondBuff = 0;
|
||||
m_Status = 0;
|
||||
m_BytesPerSecond = 0;
|
||||
m_CountsPerByte = g_System->AiCountPerBytes(); // should be calculated ... see below, instead allow from user settings
|
||||
m_CountsPerByte = g_System->AiCountPerBytes(); // Should be calculated, see below, instead allow from user settings
|
||||
if (m_CountsPerByte == 0) m_CountsPerByte = 500; // If the user has no defined value, grant a default and we will calculate
|
||||
m_FramesPerSecond = 60;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ void CAudio::LenChanged()
|
|||
{
|
||||
if (g_Reg->AI_LEN_REG >= 0x40000)
|
||||
{
|
||||
WriteTrace(TraceAudio, TraceDebug, "*** Ignoring Write, To Large (%X)", g_Reg->AI_LEN_REG);
|
||||
WriteTrace(TraceAudio, TraceDebug, "Ignoring write, to large (%X)", g_Reg->AI_LEN_REG);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -57,12 +57,12 @@ void CAudio::LenChanged()
|
|||
{
|
||||
if (AudioLeft == 0)
|
||||
{
|
||||
WriteTrace(TraceAudio, TraceDebug, "Set Timer AI_LEN_REG: %d m_CountsPerByte: %d", g_Reg->AI_LEN_REG, m_CountsPerByte);
|
||||
WriteTrace(TraceAudio, TraceDebug, "Set timer AI_LEN_REG: %d m_CountsPerByte: %d", g_Reg->AI_LEN_REG, m_CountsPerByte);
|
||||
g_SystemTimer->SetTimer(CSystemTimer::AiTimerInterrupt, g_Reg->AI_LEN_REG * m_CountsPerByte, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteTrace(TraceAudio, TraceDebug, "Increasing Second Buffer (m_SecondBuff %d Increase: %d)", m_SecondBuff, g_Reg->AI_LEN_REG);
|
||||
WriteTrace(TraceAudio, TraceDebug, "Increasing second buffer (m_SecondBuff %d Increase: %d)", m_SecondBuff, g_Reg->AI_LEN_REG);
|
||||
m_SecondBuff += g_Reg->AI_LEN_REG;
|
||||
m_Status |= ai_full;
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ void CAudio::LenChanged()
|
|||
}
|
||||
else
|
||||
{
|
||||
WriteTrace(TraceAudio, TraceDebug, "*** Reset Timer to 0");
|
||||
WriteTrace(TraceAudio, TraceDebug, "Reset timer to 0");
|
||||
g_SystemTimer->StopTimer(CSystemTimer::AiTimerBusy);
|
||||
g_SystemTimer->StopTimer(CSystemTimer::AiTimerInterrupt);
|
||||
m_SecondBuff = 0;
|
||||
|
@ -86,7 +86,7 @@ void CAudio::LenChanged()
|
|||
{
|
||||
WriteTrace(TraceAudio, TraceDebug, "Calling plugin AiLenChanged");
|
||||
g_Plugins->Audio()->AiLenChanged();
|
||||
WriteTrace(TraceAudio, TraceDebug, "plugin AiLenChanged Done");
|
||||
WriteTrace(TraceAudio, TraceDebug, "Plugin AiLenChanged Done");
|
||||
}
|
||||
WriteTrace(TraceAudio, TraceDebug, "Done");
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Based from MAME's N64DD driver code by Happy_
|
||||
// Based on MAME's N64DD driver code by Happy_
|
||||
#include "stdafx.h"
|
||||
#include "Disk.h"
|
||||
#include <Project64-core/N64System/N64System.h>
|
||||
|
@ -24,13 +24,13 @@ void DiskCommand()
|
|||
{
|
||||
//ASIC_CMD_STATUS - Commands
|
||||
uint32_t cmd = g_Reg->ASIC_CMD;
|
||||
WriteTrace(TraceN64System, TraceDebug, "DD CMD %08X - DATA %08X", cmd, g_Reg->ASIC_DATA);
|
||||
WriteTrace(TraceN64System, TraceDebug, "N64DD CMD %08X - DATA %08X", cmd, g_Reg->ASIC_DATA);
|
||||
|
||||
#ifdef _WIN32
|
||||
SYSTEMTIME sysTime;
|
||||
::GetLocalTime(&sysTime);
|
||||
|
||||
//BCD format needed for 64DD RTC
|
||||
// BCD format needed for 64DD RTC
|
||||
uint8_t year = (uint8_t)(((sysTime.wYear / 10 % 10) << 4) | (sysTime.wYear % 10));
|
||||
uint8_t month = (uint8_t)(((sysTime.wMonth / 10) << 4) | (sysTime.wMonth % 10));
|
||||
uint8_t day = (uint8_t)(((sysTime.wDay / 10) << 4) | (sysTime.wDay % 10));
|
||||
|
@ -44,7 +44,7 @@ void DiskCommand()
|
|||
struct tm result = { 0 };
|
||||
localtime_r(<ime, &result);
|
||||
|
||||
//BCD format needed for 64DD RTC
|
||||
// BCD format needed for 64DD RTC
|
||||
uint8_t year = (uint8_t)(((result.tm_year / 10 % 10) << 4) | (result.tm_year % 10));
|
||||
uint8_t month = (uint8_t)((((result.tm_mon + 1) / 10) << 4) | ((result.tm_mon + 1) % 10));
|
||||
uint8_t day = (uint8_t)(((result.tm_mday / 10) << 4) | (result.tm_mday % 10));
|
||||
|
@ -53,46 +53,46 @@ void DiskCommand()
|
|||
uint8_t second = (uint8_t)(((result.tm_sec / 10) << 4) | (result.tm_sec % 10));
|
||||
#endif
|
||||
|
||||
//Used for seek times
|
||||
// Used for seek times
|
||||
bool isSeek = false;
|
||||
|
||||
switch (cmd & 0xFFFF0000)
|
||||
{
|
||||
case 0x00010000:
|
||||
//Seek Read
|
||||
// Seek read
|
||||
g_Reg->ASIC_CUR_TK = g_Reg->ASIC_DATA | 0x60000000;
|
||||
dd_write = false;
|
||||
isSeek = true;
|
||||
break;
|
||||
case 0x00020000:
|
||||
//Seek Write
|
||||
// Seek write
|
||||
g_Reg->ASIC_CUR_TK = g_Reg->ASIC_DATA | 0x60000000;
|
||||
dd_write = true;
|
||||
isSeek = true;
|
||||
break;
|
||||
case 0x00080000:
|
||||
//Unset Disk Changed Bit
|
||||
// Unset disk changed bit
|
||||
g_Reg->ASIC_STATUS &= ~DD_STATUS_DISK_CHNG; break;
|
||||
case 0x00090000:
|
||||
//Unset Reset & Disk Changed bit Bit
|
||||
// Unset reset and disk changed bit bit
|
||||
g_Reg->ASIC_STATUS &= ~DD_STATUS_RST_STATE;
|
||||
g_Reg->ASIC_STATUS &= ~DD_STATUS_DISK_CHNG;
|
||||
//F-Zero X + Expansion Kit fix so it doesn't enable "swapping" at boot
|
||||
// F-Zero X + Expansion Kit fix so it doesn't enable "swapping" at boot
|
||||
dd_swapdelay = 0;
|
||||
if (g_Disk != nullptr)
|
||||
g_Reg->ASIC_STATUS |= DD_STATUS_DISK_PRES;
|
||||
break;
|
||||
case 0x00120000:
|
||||
//RTC Get Year & Month
|
||||
// RTC get year and month
|
||||
g_Reg->ASIC_DATA = (year << 24) | (month << 16); break;
|
||||
case 0x00130000:
|
||||
//RTC Get Day & Hour
|
||||
// RTC get day and hour
|
||||
g_Reg->ASIC_DATA = (day << 24) | (hour << 16); break;
|
||||
case 0x00140000:
|
||||
//RTC Get Minute & Second
|
||||
// RTC get minute and second
|
||||
g_Reg->ASIC_DATA = (minute << 24) | (second << 16); break;
|
||||
case 0x001B0000:
|
||||
//Disk Inquiry
|
||||
// Disk inquiry
|
||||
g_Reg->ASIC_DATA = 0x00000000; break;
|
||||
}
|
||||
|
||||
|
@ -100,27 +100,27 @@ void DiskCommand()
|
|||
{
|
||||
if (g_System->DiskSeekTimingType() == DiskSeek_Turbo)
|
||||
{
|
||||
//Instant Response for Turbo
|
||||
// Instant response for turbo
|
||||
|
||||
//Set timer for seek response
|
||||
// Set timer for seek response
|
||||
g_SystemTimer->SetTimer(g_SystemTimer->DDSeekTimer, 0, false);
|
||||
|
||||
//Set timer for motor
|
||||
// Set timer for motor
|
||||
g_SystemTimer->SetTimer(g_SystemTimer->DDMotorTimer, 0, false);
|
||||
}
|
||||
else /* if (g_System->DiskSeekTimingType() == DiskSeek_Slow) */
|
||||
{
|
||||
//Emulate Seek Times, send interrupt later
|
||||
// Emulate seek times, send interrupt later
|
||||
uint32_t seektime = 0;
|
||||
|
||||
//Start Motor, can take half a second, delay the response
|
||||
// Start motor, can take half a second, delay the response
|
||||
if (g_Reg->ASIC_STATUS & DD_STATUS_MTR_N_SPIN)
|
||||
{
|
||||
seektime += (0x5A00000 / 2);
|
||||
g_Reg->ASIC_STATUS &= ~DD_STATUS_MTR_N_SPIN;
|
||||
}
|
||||
|
||||
//Get Zone to calculate seek times
|
||||
// Get zone to calculate seek times
|
||||
uint32_t track = g_Reg->ASIC_CUR_TK >> 16 & 0x0FFF;
|
||||
uint32_t zone = 0;
|
||||
uint32_t zonebound = 0;
|
||||
|
@ -136,7 +136,7 @@ void DiskCommand()
|
|||
}
|
||||
}
|
||||
|
||||
//Add seek delay depending on the zone (this is inaccurate timing, but close enough)
|
||||
// Add seek delay depending on the zone (this is inaccurate timing, but close enough)
|
||||
seektime += 0x179200;
|
||||
|
||||
switch (zone)
|
||||
|
@ -159,16 +159,16 @@ void DiskCommand()
|
|||
break;
|
||||
}
|
||||
|
||||
//Set timer for seek response
|
||||
// Set timer for seek response
|
||||
g_SystemTimer->SetTimer(g_SystemTimer->DDSeekTimer, seektime, false);
|
||||
|
||||
//Set timer for motor to shutdown in 5 seconds, reset the timer if other seek commands were sent
|
||||
// Set timer for motor to shutdown in 5 seconds, reset the timer if other seek commands were sent
|
||||
g_SystemTimer->SetTimer(g_SystemTimer->DDMotorTimer, 0x5A00000 * 5, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Other commands are basically instant
|
||||
// Other commands are basically instant
|
||||
g_Reg->ASIC_STATUS |= DD_STATUS_MECHA_INT;
|
||||
g_Reg->FAKE_CAUSE_REGISTER |= CAUSE_IP3;
|
||||
g_Reg->CheckInterrupts();
|
||||
|
@ -178,7 +178,7 @@ void DiskCommand()
|
|||
void DiskReset(void)
|
||||
{
|
||||
//ASIC_HARD_RESET 0xAAAA0000
|
||||
WriteTrace(TraceN64System, TraceDebug, "DD RESET");
|
||||
WriteTrace(TraceN64System, TraceDebug, "N64DD reset");
|
||||
g_Reg->ASIC_STATUS |= DD_STATUS_RST_STATE;
|
||||
dd_swapdelay = 0;
|
||||
if (g_Disk != nullptr)
|
||||
|
@ -231,9 +231,9 @@ void DiskBMControl(void)
|
|||
|
||||
void DiskGapSectorCheck()
|
||||
{
|
||||
//On 64DD Status Register Read
|
||||
// On 64DD status register read
|
||||
|
||||
//Buffer Manager Interrupt, Gap Sector Check
|
||||
// Buffer manager interrupt, gap sector check
|
||||
if (g_Reg->ASIC_STATUS & DD_STATUS_BM_INT)
|
||||
{
|
||||
if (SECTORS_PER_BLOCK < dd_current)
|
||||
|
@ -245,7 +245,7 @@ void DiskGapSectorCheck()
|
|||
}
|
||||
}
|
||||
|
||||
//Delay Disk Swapping by removing the disk for a certain amount of time, then insert the newly loaded disk (after 50 Status Register reads, here).
|
||||
// Delay disk swapping by removing the disk for a certain amount of time, then insert the newly loaded disk (after 50 status register reads, here)
|
||||
if (!(g_Reg->ASIC_STATUS & DD_STATUS_DISK_PRES) && g_Disk != nullptr && g_Settings->LoadBool(GameRunning_LoadingInProgress) == false)
|
||||
{
|
||||
dd_swapdelay++;
|
||||
|
@ -253,7 +253,7 @@ void DiskGapSectorCheck()
|
|||
{
|
||||
g_Reg->ASIC_STATUS |= (DD_STATUS_DISK_PRES | DD_STATUS_DISK_CHNG);
|
||||
dd_swapdelay = 0;
|
||||
WriteTrace(TraceN64System, TraceDebug, "DD SWAP DONE");
|
||||
WriteTrace(TraceN64System, TraceDebug, "N64DD swap done");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -277,7 +277,7 @@ void DiskBMUpdate()
|
|||
}
|
||||
else if (dd_current < SECTORS_PER_BLOCK + 1)
|
||||
{
|
||||
//C2 Sector
|
||||
// C2 sector
|
||||
if (g_Reg->ASIC_BM_STATUS & DD_BM_STATUS_BLOCK)
|
||||
{
|
||||
dd_start_block = 1 - dd_start_block;
|
||||
|
@ -303,16 +303,16 @@ void DiskBMUpdate()
|
|||
}
|
||||
else
|
||||
{
|
||||
//Read Data
|
||||
// Read data
|
||||
if (((g_Reg->ASIC_CUR_TK >> 16) & 0x1FFF) == 6 && g_Reg->ASIC_CUR_SECTOR == 0 && g_Disk->GetCountry() != Country_Unknown)
|
||||
{
|
||||
//Copy Protection if Retail Disk
|
||||
// Copy protection if retail disk
|
||||
g_Reg->ASIC_STATUS &= ~DD_STATUS_DATA_RQ;
|
||||
g_Reg->ASIC_BM_STATUS |= DD_BM_STATUS_MICRO;
|
||||
}
|
||||
else if (dd_current < SECTORS_PER_BLOCK)
|
||||
{
|
||||
//User Sector
|
||||
// User sector
|
||||
if (!DiskBMReadWrite(false))
|
||||
g_Reg->ASIC_STATUS |= DD_STATUS_DATA_RQ;
|
||||
else
|
||||
|
@ -321,14 +321,14 @@ void DiskBMUpdate()
|
|||
}
|
||||
else if (dd_current < SECTORS_PER_BLOCK + 4)
|
||||
{
|
||||
//C2 sectors (All 00s)
|
||||
// C2 sectors (all 00s)
|
||||
dd_current += 1;
|
||||
if (dd_current == SECTORS_PER_BLOCK + 4)
|
||||
g_Reg->ASIC_STATUS |= DD_STATUS_C2_XFER;
|
||||
}
|
||||
else if (dd_current == SECTORS_PER_BLOCK + 4)
|
||||
{
|
||||
//Gap Sector
|
||||
// Gap sector
|
||||
if (g_Reg->ASIC_BM_STATUS & DD_BM_STATUS_BLOCK)
|
||||
{
|
||||
dd_start_block = 1 - dd_start_block;
|
||||
|
@ -349,7 +349,7 @@ void DiskBMUpdate()
|
|||
|
||||
bool DiskBMReadWrite(bool /*write*/)
|
||||
{
|
||||
//Returns true if error
|
||||
// Returns true if error
|
||||
uint16_t head = ((g_Reg->ASIC_CUR_TK >> 16) / 0x1000) & 1;
|
||||
uint16_t track = (g_Reg->ASIC_CUR_TK >> 16) & 0xFFF;
|
||||
uint16_t block = (uint16_t)dd_start_block;
|
||||
|
@ -360,7 +360,7 @@ bool DiskBMReadWrite(bool /*write*/)
|
|||
|
||||
if (addr == 0xFFFFFFFF)
|
||||
{
|
||||
//Error
|
||||
// Error
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Based from MAME's N64DD driver code by Happy_
|
||||
// Based on MAME's N64DD driver code by Happy_
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
|
|
|
@ -63,17 +63,17 @@ void CDMA::PI_DMA_READ()
|
|||
return;
|
||||
}
|
||||
|
||||
//64DD Buffers Write
|
||||
// 64DD buffers write
|
||||
if (g_Reg->PI_CART_ADDR_REG >= 0x05000000 && g_Reg->PI_CART_ADDR_REG <= 0x050003FF)
|
||||
{
|
||||
//64DD C2 Sectors (don't care)
|
||||
// 64DD C2 sectors (don't care)
|
||||
g_SystemTimer->SetTimer(g_SystemTimer->DDPiTimer, (PI_RD_LEN_REG * 63) / 25, false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_Reg->PI_CART_ADDR_REG >= 0x05000400 && g_Reg->PI_CART_ADDR_REG <= 0x050004FF)
|
||||
{
|
||||
//64DD User Sector
|
||||
// 64DD user sector
|
||||
uint32_t i;
|
||||
uint8_t * RDRAM = g_MMU->Rdram();
|
||||
uint8_t * DISK = g_Disk->GetDiskAddressBuffer();
|
||||
|
@ -87,14 +87,14 @@ void CDMA::PI_DMA_READ()
|
|||
|
||||
if (g_Reg->PI_CART_ADDR_REG >= 0x05000580 && g_Reg->PI_CART_ADDR_REG <= 0x050005BF)
|
||||
{
|
||||
//64DD MSEQ (don't care)
|
||||
// 64DD MSEQ (don't care)
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
return;
|
||||
}
|
||||
|
||||
//Write ROM Area (for 64DD Convert)
|
||||
// Write ROM area (for 64DD conversion)
|
||||
if (g_Reg->PI_CART_ADDR_REG >= 0x10000000 && g_Reg->PI_CART_ADDR_REG <= 0x1FBFFFFF && g_Settings->LoadBool(Game_AllowROMWrites))
|
||||
{
|
||||
uint32_t i;
|
||||
|
@ -172,7 +172,7 @@ void CDMA::PI_DMA_READ()
|
|||
}
|
||||
if (g_System->m_SaveUsing == SaveChip_FlashRam)
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("**** FLashRam DMA Read address %08X *****", g_Reg->PI_CART_ADDR_REG).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("**** FlashRAM DMA read address %08X ****", g_Reg->PI_CART_ADDR_REG).c_str());
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
|
@ -180,7 +180,7 @@ void CDMA::PI_DMA_READ()
|
|||
}
|
||||
if (HaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("PI_DMA_READ where are you dmaing to ? : %08X", g_Reg->PI_CART_ADDR_REG).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("PI_DMA_READ where are you DMAing to? : %08X", g_Reg->PI_CART_ADDR_REG).c_str());
|
||||
}
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
|
@ -190,24 +190,24 @@ void CDMA::PI_DMA_READ()
|
|||
|
||||
void CDMA::PI_DMA_WRITE()
|
||||
{
|
||||
/* rounding PI_WR_LEN_REG up to the nearest even number fixes AI Shougi 3, Doraemon 3, etc. */
|
||||
// Rounding PI_WR_LEN_REG up to the nearest even number fixes AI Shougi 3, Doraemon 3, etc.
|
||||
uint32_t PI_WR_LEN_REG = ((g_Reg->PI_WR_LEN_REG) & 0x00FFFFFEul) + 2;
|
||||
uint32_t PI_CART_ADDR_REG = !g_Settings->LoadBool(Game_UnalignedDMA) ? g_Reg->PI_CART_ADDR_REG & ~1 : g_Reg->PI_CART_ADDR_REG;
|
||||
|
||||
g_Reg->PI_STATUS_REG |= PI_STATUS_DMA_BUSY;
|
||||
if (g_Reg->PI_DRAM_ADDR_REG + PI_WR_LEN_REG > g_MMU->RdramSize())
|
||||
{
|
||||
if (ShowUnhandledMemory()) { g_Notify->DisplayError(stdstr_f("PI_DMA_WRITE not in Memory: %08X", g_Reg->PI_DRAM_ADDR_REG + PI_WR_LEN_REG).c_str()); }
|
||||
if (ShowUnhandledMemory()) { g_Notify->DisplayError(stdstr_f("PI_DMA_WRITE not in memory: %08X", g_Reg->PI_DRAM_ADDR_REG + PI_WR_LEN_REG).c_str()); }
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
return;
|
||||
}
|
||||
|
||||
//64DD Buffers Read
|
||||
// 64DD buffers read
|
||||
if (PI_CART_ADDR_REG >= 0x05000000 && PI_CART_ADDR_REG <= 0x050003FF)
|
||||
{
|
||||
//64DD C2 Sectors (just read 0)
|
||||
// 64DD C2 sectors (just read 0)
|
||||
uint32_t i;
|
||||
uint8_t * RDRAM = g_MMU->Rdram();
|
||||
for (i = 0; i < PI_WR_LEN_REG; i++)
|
||||
|
@ -215,14 +215,14 @@ void CDMA::PI_DMA_WRITE()
|
|||
*(RDRAM + ((g_Reg->PI_DRAM_ADDR_REG + i) ^ 3)) = 0;
|
||||
}
|
||||
|
||||
//Timer is needed for Track Read
|
||||
// Timer is needed for track read
|
||||
g_SystemTimer->SetTimer(g_SystemTimer->DDPiTimer, (PI_WR_LEN_REG * 63) / 25, false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (PI_CART_ADDR_REG >= 0x05000400 && PI_CART_ADDR_REG <= 0x050004FF)
|
||||
{
|
||||
//64DD User Sector
|
||||
// 64DD user sector
|
||||
uint32_t i;
|
||||
uint8_t * RDRAM = g_MMU->Rdram();
|
||||
uint8_t * DISK = g_Disk->GetDiskAddressBuffer();
|
||||
|
@ -231,21 +231,21 @@ void CDMA::PI_DMA_WRITE()
|
|||
*(RDRAM + ((g_Reg->PI_DRAM_ADDR_REG + i) ^ 3)) = *(DISK + (i ^ 3));
|
||||
}
|
||||
|
||||
//Timer is needed for Track Read
|
||||
// Timer is needed for track read
|
||||
g_SystemTimer->SetTimer(g_SystemTimer->DDPiTimer, (PI_WR_LEN_REG * 63) / 25, false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (PI_CART_ADDR_REG >= 0x05000580 && PI_CART_ADDR_REG <= 0x050005BF)
|
||||
{
|
||||
//64DD MSEQ (don't care)
|
||||
// 64DD MSEQ (don't care)
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
return;
|
||||
}
|
||||
|
||||
//64DD IPL ROM
|
||||
// 64DD IPL ROM
|
||||
if (PI_CART_ADDR_REG >= 0x06000000 && PI_CART_ADDR_REG <= 0x063FFFFF)
|
||||
{
|
||||
uint32_t i;
|
||||
|
@ -483,7 +483,7 @@ void CDMA::SP_DMA_READ()
|
|||
{
|
||||
if (HaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("%s\nSP_DRAM_ADDR_REG not in RDRam space : % 08X", __FUNCTION__, g_Reg->SP_DRAM_ADDR_REG).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("%s\nSP_DRAM_ADDR_REG not in RDRAM space: % 08X", __FUNCTION__, g_Reg->SP_DRAM_ADDR_REG).c_str());
|
||||
}
|
||||
g_Reg->SP_DMA_BUSY_REG = 0;
|
||||
g_Reg->SP_STATUS_REG &= ~SP_STATUS_DMA_BUSY;
|
||||
|
@ -525,7 +525,7 @@ void CDMA::SP_DMA_WRITE()
|
|||
{
|
||||
if (HaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("%s\nSP_DRAM_ADDR_REG not in RDRam space : %08X", __FUNCTION__, g_Reg->SP_DRAM_ADDR_REG).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("%s\nSP_DRAM_ADDR_REG not in RDRAM space: %08X", __FUNCTION__, g_Reg->SP_DRAM_ADDR_REG).c_str());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -534,7 +534,7 @@ void CDMA::SP_DMA_WRITE()
|
|||
{
|
||||
if (HaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError("SP DMA WRITE\ncould not fit copy in memory segement");
|
||||
g_Notify->DisplayError("SP DMA WRITE\nCould not fit copy in memory segment");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ void CEeprom::EepromCommand(uint8_t * Command)
|
|||
|
||||
switch (Command[2])
|
||||
{
|
||||
case 0: // check
|
||||
case 0: // Check
|
||||
if (g_System->m_SaveUsing != SaveChip_Eeprom_4K && g_System->m_SaveUsing != SaveChip_Eeprom_16K)
|
||||
{
|
||||
Command[1] |= 0x80;
|
||||
|
@ -61,7 +61,7 @@ void CEeprom::EepromCommand(uint8_t * Command)
|
|||
Command[5] = 0x00;
|
||||
}
|
||||
break;
|
||||
case 4: // Read from Eeprom
|
||||
case 4: // Read from EEPROM
|
||||
if (Command[0] != 2 && HaveDebugger())
|
||||
{
|
||||
ProcessingError(Command);
|
||||
|
@ -72,7 +72,7 @@ void CEeprom::EepromCommand(uint8_t * Command)
|
|||
}
|
||||
ReadFrom(&Command[4], Command[3]);
|
||||
break;
|
||||
case 5: //Write to Eeprom
|
||||
case 5: // Write to EEPROM
|
||||
if (Command[0] != 10 && HaveDebugger())
|
||||
{
|
||||
ProcessingError(Command);
|
||||
|
@ -83,25 +83,25 @@ void CEeprom::EepromCommand(uint8_t * Command)
|
|||
}
|
||||
WriteTo(&Command[4], Command[3]);
|
||||
break;
|
||||
case 6: //RTC Status query
|
||||
case 6: // RTC status query
|
||||
Command[3] = 0x00;
|
||||
Command[4] = 0x10;
|
||||
Command[5] = 0x00;
|
||||
break;
|
||||
case 7: //Read RTC block
|
||||
case 7: // Read RTC block
|
||||
switch (Command[3])
|
||||
{
|
||||
case 0: //Block number
|
||||
case 0: // Block number
|
||||
Command[4] = 0x00;
|
||||
Command[5] = 0x02;
|
||||
Command[12] = 0x00;
|
||||
break;
|
||||
case 1:
|
||||
//read block, Command[2], Unimplemented
|
||||
// Read block, Command[2], unimplemented
|
||||
break;
|
||||
case 2: //Set RTC Time
|
||||
case 2: // Set RTC time
|
||||
time(&curtime_time);
|
||||
memcpy(&curtime, localtime(&curtime_time), sizeof(curtime)); // fd's fix
|
||||
memcpy(&curtime, localtime(&curtime_time), sizeof(curtime));
|
||||
Command[4] = byte2bcd(curtime.tm_sec);
|
||||
Command[5] = byte2bcd(curtime.tm_min);
|
||||
Command[6] = 0x80 + byte2bcd(curtime.tm_hour);
|
||||
|
@ -110,12 +110,12 @@ void CEeprom::EepromCommand(uint8_t * Command)
|
|||
Command[9] = byte2bcd(curtime.tm_mon + 1);
|
||||
Command[10] = byte2bcd(curtime.tm_year);
|
||||
Command[11] = byte2bcd(curtime.tm_year / 100);
|
||||
Command[12] = 0x00; // status
|
||||
Command[12] = 0x00; // Status
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
//Write RTC, unimplemented
|
||||
// Write RTC, unimplemented
|
||||
if (bShowPifRamErrors())
|
||||
{
|
||||
g_Notify->DisplayError("Write RTC, unimplemented");
|
||||
|
@ -199,6 +199,6 @@ void CEeprom::ProcessingError(uint8_t * /*Command*/)
|
|||
{
|
||||
if (bShowPifRamErrors())
|
||||
{
|
||||
g_Notify->DisplayError("What am I meant to do with this Eeprom Command");
|
||||
g_Notify->DisplayError("What am I meant to do with this EEPROM command?");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ void CFlashram::DmaFromFlashram(uint8_t * dest, int32_t StartOffset, int32_t len
|
|||
{
|
||||
if (HaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("%s: Unaligned flash ram read ???", __FUNCTION__).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("%s: Unaligned flash RAM read?", __FUNCTION__).c_str());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ void CFlashram::WriteToFlashCommand(uint32_t FlashRAM_Command)
|
|||
}
|
||||
break;
|
||||
default:
|
||||
g_Notify->DisplayError(stdstr_f("Writing %X to flash ram command register\nm_FlashFlag: %d", FlashRAM_Command, m_FlashFlag).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Writing %X to flash RAM command register\nm_FlashFlag: %d", FlashRAM_Command, m_FlashFlag).c_str());
|
||||
}
|
||||
m_FlashFlag = FLASHRAM_MODE_NOPES;
|
||||
break;
|
||||
|
@ -199,7 +199,7 @@ void CFlashram::WriteToFlashCommand(uint32_t FlashRAM_Command)
|
|||
m_FlashStatus = 0x1111800800C2001E;
|
||||
break;
|
||||
case 0xB4000000:
|
||||
m_FlashFlag = FLASHRAM_MODE_WRITE; //????
|
||||
m_FlashFlag = FLASHRAM_MODE_WRITE;
|
||||
break;
|
||||
case 0xA5000000:
|
||||
m_FlashRAM_Offset = (FlashRAM_Command & 0xFFFF) * sizeof(EmptyBlock);
|
||||
|
@ -208,7 +208,7 @@ void CFlashram::WriteToFlashCommand(uint32_t FlashRAM_Command)
|
|||
default:
|
||||
if (HaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Writing %X to flash ram command register", FlashRAM_Command).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Writing %X to flash RAM command register", FlashRAM_Command).c_str());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,8 +1,9 @@
|
|||
// Project64 - A Nintendo 64 emulator
|
||||
// http://www.pj64-emu.com/
|
||||
// https://www.pj64-emu.com/
|
||||
// Copyright(C) 2001-2021 Project64
|
||||
// Copyright(C) 2015 Bobby Smiles
|
||||
// GNU/GPLv2 licensed: https://gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "GBCart.h"
|
||||
|
||||
|
@ -15,27 +16,27 @@ static void read_gb_cart_normal(struct gb_cart* gb_cart, uint16_t address, uint8
|
|||
|
||||
if ((address >= 0x0000) && (address <= 0x7FFF))
|
||||
{
|
||||
//Read GB Cart
|
||||
// Read Game Boy cart
|
||||
if (address >= gb_cart->rom_size)
|
||||
{
|
||||
//If address is larger then our rome size, bail out
|
||||
// If address is larger then our ROM size, bail out
|
||||
return;
|
||||
}
|
||||
memcpy(data, &gb_cart->rom[address], 0x20);
|
||||
}
|
||||
else if ((address >= 0xA000) && (address <= 0xBFFF))
|
||||
{
|
||||
//Read from RAM
|
||||
// Read from RAM
|
||||
if (gb_cart->ram == nullptr)
|
||||
{
|
||||
//No RAM to write to
|
||||
// No RAM to write to
|
||||
return;
|
||||
}
|
||||
|
||||
offset = address - 0xA000;
|
||||
if (offset >= gb_cart->ram_size)
|
||||
{
|
||||
//Offset is larger then our ram size
|
||||
// Offset is larger then our RAM size
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -49,17 +50,17 @@ static void write_gb_cart_normal(struct gb_cart* gb_cart, uint16_t address, cons
|
|||
uint16_t offset;
|
||||
if ((address >= 0xA000) && (address <= 0xBFFF))
|
||||
{
|
||||
//Write to RAM
|
||||
// Write to RAM
|
||||
if (gb_cart->ram == nullptr)
|
||||
{
|
||||
//No RAM to write to
|
||||
// No RAM to write to
|
||||
return;
|
||||
}
|
||||
|
||||
offset = address - 0xa000;
|
||||
if (offset >= gb_cart->ram_size)
|
||||
{
|
||||
//Offset is larger then our ram size
|
||||
// Offset is larger then our RAM size
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -71,11 +72,11 @@ static void read_gb_cart_mbc1(struct gb_cart* gb_cart, uint16_t address, uint8_t
|
|||
{
|
||||
size_t offset;
|
||||
|
||||
if ((address >= 0x0000) && (address <= 0x3FFF)) //No nbanked memory
|
||||
if ((address >= 0x0000) && (address <= 0x3FFF)) // No unbanked memory
|
||||
{
|
||||
memcpy(data, &gb_cart->rom[address], 0x20);
|
||||
}
|
||||
else if ((address >= 0x4000) && (address <= 0x7FFF)) //Read from ROM
|
||||
else if ((address >= 0x4000) && (address <= 0x7FFF)) // Read from ROM
|
||||
{
|
||||
offset = (address - 0x4000) + (gb_cart->rom_bank * 0x4000);
|
||||
if (offset < gb_cart->rom_size)
|
||||
|
@ -83,7 +84,7 @@ static void read_gb_cart_mbc1(struct gb_cart* gb_cart, uint16_t address, uint8_t
|
|||
memcpy(data, &gb_cart->rom[offset], 0x20);
|
||||
}
|
||||
}
|
||||
else if ((address >= 0xA000) && (address <= 0xBFFF)) //Read from RAM
|
||||
else if ((address >= 0xA000) && (address <= 0xBFFF)) // Read from RAM
|
||||
{
|
||||
if (gb_cart->ram != nullptr)
|
||||
{
|
||||
|
@ -102,15 +103,15 @@ static void write_gb_cart_mbc1(struct gb_cart* gb_cart, uint16_t address, const
|
|||
|
||||
if ((address >= 0x0000) && (address <= 0x1FFF)) // RAM enable
|
||||
{
|
||||
//Enable/disable RAM
|
||||
// Enable/disable RAM
|
||||
gb_cart->ram_enabled = (data[0] & 0x0F) == 0x0A;
|
||||
}
|
||||
else if ((address >= 0x2000) && (address <= 0x3FFF)) // ROM bank select
|
||||
{
|
||||
gb_cart->rom_bank &= 0x60; // keep MSB
|
||||
gb_cart->rom_bank &= 0x60; // Keep MSB
|
||||
gb_cart->rom_bank |= data[0] & 0x1F;
|
||||
|
||||
// emulate quirk: 0x00 -> 0x01, 0x20 -> 0x21, 0x40->0x41, 0x60 -> 0x61
|
||||
// Emulate quirk: 0x00 -> 0x01, 0x20 -> 0x21, 0x40->0x41, 0x60 -> 0x61
|
||||
if ((gb_cart->rom_bank & 0x1F) == 0)
|
||||
{
|
||||
gb_cart->rom_bank |= 0x01;
|
||||
|
@ -125,27 +126,27 @@ static void write_gb_cart_mbc1(struct gb_cart* gb_cart, uint16_t address, const
|
|||
else
|
||||
{
|
||||
gb_cart->rom_bank &= 0x1F;
|
||||
gb_cart->rom_bank |= ((data[0] & 0x03) << 5); // set bits 5 and 6 of ROM bank
|
||||
gb_cart->rom_bank |= ((data[0] & 0x03) << 5); // Set bits 5 and 6 of ROM bank
|
||||
}
|
||||
}
|
||||
else if ((address >= 0x6000) && (address <= 0x7FFF)) // MBC1 mode select
|
||||
{
|
||||
// this is overly complicated, but it keeps us from having to do bitwise math later
|
||||
// Basically we shuffle the 2 "magic bits" between rom_bank and ram_bank as necessary.
|
||||
// This is overly complicated, but it keeps us from having to do bitwise math later
|
||||
// Basically we shuffle the 2 "magic bits" between rom_bank and ram_bank as necessary
|
||||
if (gb_cart->ram_bank_mode != (data[0] & 0x01))
|
||||
{
|
||||
// we should only alter the ROM and RAM bank numbers if we have changed modes
|
||||
// We should only alter the ROM and RAM bank numbers if we have changed modes
|
||||
gb_cart->ram_bank_mode = data[0] & 0x01;
|
||||
if (gb_cart->ram_bank_mode)
|
||||
{
|
||||
gb_cart->ram_bank = gb_cart->rom_bank >> 5; // set the ram bank to the "magic bits"
|
||||
gb_cart->rom_bank &= 0x1F; // zero out bits 5 and 6 to keep consistency
|
||||
gb_cart->ram_bank = gb_cart->rom_bank >> 5; // Set the RAM bank to the "magic bits"
|
||||
gb_cart->rom_bank &= 0x1F; // Zero out bits 5 and 6 to keep consistency
|
||||
}
|
||||
else
|
||||
{
|
||||
gb_cart->rom_bank &= 0x1F;
|
||||
gb_cart->rom_bank |= (gb_cart->ram_bank << 5);
|
||||
gb_cart->ram_bank = 0x00; // we can only reach RAM page 0
|
||||
gb_cart->ram_bank = 0x00; // We can only reach RAM page 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -166,11 +167,11 @@ static void read_gb_cart_mbc2(struct gb_cart* gb_cart, uint16_t address, uint8_t
|
|||
{
|
||||
size_t offset;
|
||||
|
||||
if ((address < 0x4000)) //Rom Bank 0
|
||||
if ((address < 0x4000)) // ROM bank 0
|
||||
{
|
||||
memcpy(data, &gb_cart->rom[address], 0x20);
|
||||
}
|
||||
else if ((address >= 0x4000) && (address < 0x8000)) //Switchable Rom Bank
|
||||
else if ((address >= 0x4000) && (address < 0x8000)) // Switchable ROM bank
|
||||
{
|
||||
offset = (address - 0x4000) + (gb_cart->rom_bank * 0x4000);
|
||||
if (offset < gb_cart->rom_size)
|
||||
|
@ -178,7 +179,7 @@ static void read_gb_cart_mbc2(struct gb_cart* gb_cart, uint16_t address, uint8_t
|
|||
memcpy(data, &gb_cart->rom[offset], 0x20);
|
||||
}
|
||||
}
|
||||
else if ((address >= 0xA000) && (address <= 0xC000)) //Upper Bounds of memory map
|
||||
else if ((address >= 0xA000) && (address <= 0xC000)) // Upper bounds of memory map
|
||||
{
|
||||
if (gb_cart->ram != nullptr)
|
||||
{
|
||||
|
@ -232,7 +233,7 @@ void memoryUpdateMBC3Clock(struct gb_cart* gb_cart)
|
|||
time_t now = time(nullptr);
|
||||
time_t diff = now - gb_cart->rtc_last_time;
|
||||
if (diff > 0) {
|
||||
// update the clock according to the last update time
|
||||
// Update the clock according to the last update time
|
||||
gb_cart->rtc_data[0] += (int)(diff % 60);
|
||||
if (gb_cart->rtc_data[0] > 59) {
|
||||
gb_cart->rtc_data[0] -= 60;
|
||||
|
@ -270,11 +271,11 @@ static void read_gb_cart_mbc3(struct gb_cart* gb_cart, uint16_t address, uint8_t
|
|||
{
|
||||
size_t offset;
|
||||
|
||||
if ((address < 0x4000)) //Rom Bank 0
|
||||
if ((address < 0x4000)) // ROM bank 0
|
||||
{
|
||||
memcpy(data, &gb_cart->rom[address], 0x20);
|
||||
}
|
||||
else if ((address >= 0x4000) && (address < 0x8000)) //Switchable Rom Bank
|
||||
else if ((address >= 0x4000) && (address < 0x8000)) // Switchable ROM bank
|
||||
{
|
||||
offset = (address - 0x4000) + (gb_cart->rom_bank * 0x4000);
|
||||
if (offset < gb_cart->rom_size)
|
||||
|
@ -282,7 +283,7 @@ static void read_gb_cart_mbc3(struct gb_cart* gb_cart, uint16_t address, uint8_t
|
|||
memcpy(data, &gb_cart->rom[offset], 0x20);
|
||||
}
|
||||
}
|
||||
else if ((address >= 0xA000) && (address <= 0xC000)) //Upper Bounds of memory map
|
||||
else if ((address >= 0xA000) && (address <= 0xC000)) // Upper bounds of memory map
|
||||
{
|
||||
if (gb_cart->ram != nullptr)
|
||||
{
|
||||
|
@ -323,7 +324,7 @@ static void write_gb_cart_mbc3(struct gb_cart* gb_cart, uint16_t address, const
|
|||
|
||||
if ((address >= 0x0000) && (address <= 0x1FFF)) // We shouldn't be able to read/write to RAM unless this is toggled on
|
||||
{
|
||||
//Enable / Disable RAM -- NOT WORKING -- FIXME
|
||||
// Enable / Disable RAM -- NOT WORKING --
|
||||
gb_cart->ram_enabled = (data[0] & 0x0F) == 0x0A;
|
||||
}
|
||||
else if ((address >= 0x2000) && (address <= 0x3FFF)) // ROM bank select
|
||||
|
@ -331,14 +332,14 @@ static void write_gb_cart_mbc3(struct gb_cart* gb_cart, uint16_t address, const
|
|||
bank = data[0] & 0x7F;
|
||||
gb_cart->rom_bank = (bank == 0) ? 1 : bank;
|
||||
}
|
||||
else if ((address >= 0x4000) && (address <= 0x5FFF)) // RAM/Clock bank select
|
||||
else if ((address >= 0x4000) && (address <= 0x5FFF)) // RAM/clock bank select
|
||||
{
|
||||
if (gb_cart->ram != nullptr)
|
||||
{
|
||||
bank = data[0];
|
||||
if (gb_cart->has_rtc && (bank >= 0x8 && bank <= 0xc))
|
||||
{
|
||||
//Set the bank for the timer
|
||||
// Set the bank for the timer
|
||||
gb_cart->ram_bank = bank;
|
||||
}
|
||||
else
|
||||
|
@ -349,10 +350,10 @@ static void write_gb_cart_mbc3(struct gb_cart* gb_cart, uint16_t address, const
|
|||
}
|
||||
else if ((address >= 0x6000) && (address <= 0x7FFF)) // Latch timer data
|
||||
{
|
||||
//Implement RTC timer / latch
|
||||
// Implement RTC timer / latch
|
||||
if (gb_cart->rtc_latch == 0 && data[0] == 1)
|
||||
{
|
||||
//Update time
|
||||
// Update time
|
||||
memoryUpdateMBC3Clock(gb_cart);
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
|
@ -375,7 +376,7 @@ static void write_gb_cart_mbc3(struct gb_cart* gb_cart, uint16_t address, const
|
|||
}
|
||||
else if (gb_cart->has_rtc)
|
||||
{
|
||||
/* RTC write */
|
||||
// RTC write
|
||||
gb_cart->rtc_data[gb_cart->ram_bank - 0x08] = data[0];
|
||||
}
|
||||
}
|
||||
|
@ -396,11 +397,11 @@ static void read_gb_cart_mbc5(struct gb_cart * gb_cart, uint16_t address, uint8_
|
|||
{
|
||||
size_t offset;
|
||||
|
||||
if ((address < 0x4000)) //Rom Bank 0
|
||||
if ((address < 0x4000)) // ROM bank 0
|
||||
{
|
||||
memcpy(data, &gb_cart->rom[address], 0x20);
|
||||
}
|
||||
else if ((address >= 0x4000) && (address < 0x8000)) //Switchable ROM BANK
|
||||
else if ((address >= 0x4000) && (address < 0x8000)) // Switchable ROM bank
|
||||
{
|
||||
offset = (address - 0x4000) + (gb_cart->rom_bank * 0x4000);
|
||||
if (offset < gb_cart->rom_size)
|
||||
|
@ -408,7 +409,7 @@ static void read_gb_cart_mbc5(struct gb_cart * gb_cart, uint16_t address, uint8_
|
|||
memcpy(data, &gb_cart->rom[offset], 0x20);
|
||||
}
|
||||
}
|
||||
else if ((address >= 0xA000) && (address <= 0xC000)) //Upper bounds of memory map
|
||||
else if ((address >= 0xA000) && (address <= 0xC000)) // Upper bounds of memory map
|
||||
{
|
||||
if (gb_cart->ram != nullptr)
|
||||
{
|
||||
|
@ -427,7 +428,7 @@ static void write_gb_cart_mbc5(struct gb_cart* gb_cart, uint16_t address, const
|
|||
|
||||
if ((address >= 0x0000) && (address <= 0x1FFF)) // We shouldn't be able to read/write to RAM unless this is toggled on
|
||||
{
|
||||
//Enable / Disable RAM -- NOT WORKING -- CHECK ME
|
||||
// Enable / Disable RAM -- NOT WORKING --
|
||||
gb_cart->ram_enabled = (data[0] & 0x0F) == 0x0A;
|
||||
}
|
||||
else if ((address >= 0x2000) && (address <= 0x2FFF)) // ROM bank select, low bits
|
||||
|
@ -474,11 +475,11 @@ static void read_gb_cart_pocket_cam(struct gb_cart * gb_cart, uint16_t address,
|
|||
{
|
||||
size_t offset;
|
||||
|
||||
if ((address < 0x4000)) //Rom Bank 0
|
||||
if ((address < 0x4000)) // ROM bank 0
|
||||
{
|
||||
memcpy(data, &gb_cart->rom[address], 0x20);
|
||||
}
|
||||
else if ((address >= 0x4000) && (address < 0x8000)) //Switchable ROM BANK
|
||||
else if ((address >= 0x4000) && (address < 0x8000)) // Switchable ROM bank
|
||||
{
|
||||
offset = (address - 0x4000) + (gb_cart->rom_bank * 0x4000);
|
||||
if (offset < gb_cart->rom_size)
|
||||
|
@ -486,20 +487,20 @@ static void read_gb_cart_pocket_cam(struct gb_cart * gb_cart, uint16_t address,
|
|||
memcpy(data, &gb_cart->rom[offset], 0x20);
|
||||
}
|
||||
}
|
||||
else if ((address >= 0xA000) && (address <= 0xC000)) //Upper bounds of memory map
|
||||
else if ((address >= 0xA000) && (address <= 0xC000)) // Upper bounds of memory map
|
||||
{
|
||||
//Check to see if where currently in register mode
|
||||
// Check to see if where currently in register mode
|
||||
if (gb_cart->ram != nullptr)
|
||||
{
|
||||
if (gb_cart->ram_bank & 0x10)
|
||||
{
|
||||
//Where in register mode, based off NRAGE we just fill the memory with Zeroes.
|
||||
//Seems to be incorrect behaviour but need to find more doccumentation
|
||||
// When in register mode, based off of N-Rage code we just fill the memory with zeroes
|
||||
// Seems to be incorrect behavior, but need to find more documentation
|
||||
memset(data, 0x00, 0x20);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Read RAM normally
|
||||
// Read RAM normally
|
||||
offset = (address - 0xA000) + (gb_cart->ram_bank * 0x2000);
|
||||
if (offset < gb_cart->ram_size)
|
||||
{
|
||||
|
@ -516,7 +517,7 @@ static void write_gb_cart_pocket_cam(struct gb_cart* gb_cart, uint16_t address,
|
|||
|
||||
if ((address >= 0x0000) && (address <= 0x1FFF)) // We shouldn't be able to read/write to RAM unless this is toggled on
|
||||
{
|
||||
//Enable / Disable RAM
|
||||
// Enable / Disable RAM
|
||||
gb_cart->ram_enabled = (data[0] & 0x0F) == 0x0A;
|
||||
}
|
||||
else if ((address >= 0x2000) && (address <= 0x2FFF)) // ROM bank select, low bits
|
||||
|
@ -524,18 +525,18 @@ static void write_gb_cart_pocket_cam(struct gb_cart* gb_cart, uint16_t address,
|
|||
gb_cart->rom_bank &= 0xFF00;
|
||||
gb_cart->rom_bank |= data[0];
|
||||
}
|
||||
else if ((address >= 0x4000) && (address <= 0x4FFF)) // Camera Register & RAM bank select
|
||||
else if ((address >= 0x4000) && (address <= 0x4FFF)) // Camera register and RAM bank select
|
||||
{
|
||||
if (gb_cart->ram != nullptr)
|
||||
{
|
||||
if (data[0] & 0x10)
|
||||
{
|
||||
//REGISTER MODE
|
||||
// Register mode
|
||||
gb_cart->ram_bank = data[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
//RAM MODE
|
||||
// RAM mode
|
||||
gb_cart->ram_bank = data[0] & 0x0F;
|
||||
}
|
||||
}
|
||||
|
@ -546,11 +547,11 @@ static void write_gb_cart_pocket_cam(struct gb_cart* gb_cart, uint16_t address,
|
|||
{
|
||||
if (gb_cart->ram_bank & 0x10)
|
||||
{
|
||||
//REGISTER MODE (DO NOTHING)
|
||||
// Register mode (do nothing)
|
||||
}
|
||||
else
|
||||
{
|
||||
//RAM MODE
|
||||
// RAM mode
|
||||
offset = (address - 0xA000) + (gb_cart->ram_bank * 0x2000);
|
||||
if (offset < gb_cart->ram_size)
|
||||
{
|
||||
|
@ -688,10 +689,10 @@ bool GBCart::init_gb_cart(struct gb_cart* gb_cart, const char* gb_file)
|
|||
size_t ram_size = 0;
|
||||
CFile tempFile;
|
||||
|
||||
/* load GB cart ROM */
|
||||
// Load Game Boy cart ROM
|
||||
if (!tempFile.Open(gb_file, CFileBase::modeRead))
|
||||
{
|
||||
g_Notify->DisplayError("Failed to open Transferpak ROM");
|
||||
g_Notify->DisplayError("Failed to open Transfer Pak ROM");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -706,7 +707,7 @@ bool GBCart::init_gb_cart(struct gb_cart* gb_cart, const char* gb_file)
|
|||
return false;
|
||||
}
|
||||
|
||||
/* get and parse cart type */
|
||||
// Get and parse cart type
|
||||
uint8_t cart_type = rom.get()[0x147];
|
||||
type = parse_cart_type(cart_type);
|
||||
if (type == nullptr)
|
||||
|
@ -714,7 +715,7 @@ bool GBCart::init_gb_cart(struct gb_cart* gb_cart, const char* gb_file)
|
|||
return false;
|
||||
}
|
||||
|
||||
/* load ram (if present) */
|
||||
// Load RAM (if present)
|
||||
if (type->extra_devices & GED_RAM)
|
||||
{
|
||||
ram_size = 0;
|
||||
|
@ -737,14 +738,14 @@ bool GBCart::init_gb_cart(struct gb_cart* gb_cart, const char* gb_file)
|
|||
|
||||
if (!tempFile.Open(g_Settings->LoadStringVal(Game_Transferpak_Sav).c_str(), CFileBase::modeRead))
|
||||
{
|
||||
g_Notify->DisplayError("Failed to open Transferpak SAV File");
|
||||
g_Notify->DisplayError("Failed to open Transfer Pak SAV file");
|
||||
return false;
|
||||
}
|
||||
|
||||
tempFile.Read(ram.get(), ram_size);
|
||||
}
|
||||
|
||||
//If we have RTC we need to load in the data, we assume the save will use the VBA-M format
|
||||
// If we have RTC we need to load in the data, we assume the save will use the VBA-M format
|
||||
if (type->extra_devices & GED_RTC)
|
||||
{
|
||||
tempFile.Read(&gb_cart->rtc_data[0], 4);
|
||||
|
@ -763,7 +764,7 @@ bool GBCart::init_gb_cart(struct gb_cart* gb_cart, const char* gb_file)
|
|||
tempFile.Close();
|
||||
}
|
||||
|
||||
/* update gb_cart */
|
||||
// Update gb_cart
|
||||
gb_cart->rom = rom.release();
|
||||
gb_cart->ram = ram.release();
|
||||
gb_cart->rom_size = rom_size;
|
||||
|
|
|
@ -38,6 +38,3 @@ public:
|
|||
static void read_gb_cart(struct gb_cart* gb_cart, uint16_t address, uint8_t* data);
|
||||
static void write_gb_cart(struct gb_cart* gb_cart, uint16_t address, const uint8_t* data);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ bool CMipsMemoryVM::Initialize(bool SyncSystem)
|
|||
}
|
||||
if (m_RDRAM == nullptr)
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceError, "Failed to Reserve RDRAM (Size: 0x%X)", 0x20000000);
|
||||
WriteTrace(TraceN64System, TraceError, "Failed to reserve RDRAM (Size: 0x%X)", 0x20000000);
|
||||
FreeMemory();
|
||||
return false;
|
||||
}
|
||||
|
@ -149,14 +149,14 @@ bool CMipsMemoryVM::Initialize(bool SyncSystem)
|
|||
m_AllocatedRdramSize = g_Settings->LoadDword(Game_RDRamSize);
|
||||
if (CommitMemory(m_RDRAM, m_AllocatedRdramSize, MEM_READWRITE) == nullptr)
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceError, "Failed to Allocate RDRAM (Size: 0x%X)", m_AllocatedRdramSize);
|
||||
WriteTrace(TraceN64System, TraceError, "Failed to allocate RDRAM (Size: 0x%X)", m_AllocatedRdramSize);
|
||||
FreeMemory();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (CommitMemory(m_RDRAM + 0x04000000, 0x2000, MEM_READWRITE) == nullptr)
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceError, "Failed to Allocate DMEM/IMEM (Size: 0x%X)", 0x2000);
|
||||
WriteTrace(TraceN64System, TraceError, "Failed to allocate DMEM/IMEM (Size: 0x%X)", 0x2000);
|
||||
FreeMemory();
|
||||
return false;
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ bool CMipsMemoryVM::Initialize(bool SyncSystem)
|
|||
m_RomSize = g_Rom->GetRomSize();
|
||||
if (CommitMemory(m_Rom, g_Rom->GetRomSize(), MEM_READWRITE) == nullptr)
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceError, "Failed to Allocate Rom (Size: 0x%X)", g_Rom->GetRomSize());
|
||||
WriteTrace(TraceN64System, TraceError, "Failed to allocate ROM (Size: 0x%X)", g_Rom->GetRomSize());
|
||||
FreeMemory();
|
||||
return false;
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ bool CMipsMemoryVM::Initialize(bool SyncSystem)
|
|||
m_RomSize = g_Rom->GetRomSize();
|
||||
}
|
||||
|
||||
//64DD IPL
|
||||
// 64DD IPL
|
||||
if (g_DDRom != nullptr)
|
||||
{
|
||||
if (g_Settings->LoadBool(Game_LoadRomToMemory))
|
||||
|
@ -196,7 +196,7 @@ bool CMipsMemoryVM::Initialize(bool SyncSystem)
|
|||
m_DDRomSize = g_DDRom->GetRomSize();
|
||||
if (CommitMemory(m_DDRom, g_DDRom->GetRomSize(), MEM_READWRITE) == nullptr)
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceError, "Failed to Allocate Rom (Size: 0x%X)", g_DDRom->GetRomSize());
|
||||
WriteTrace(TraceN64System, TraceError, "Failed to allocate ROM (Size: 0x%X)", g_DDRom->GetRomSize());
|
||||
FreeMemory();
|
||||
return false;
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ bool CMipsMemoryVM::Initialize(bool SyncSystem)
|
|||
m_TLB_ReadMap = new size_t[0x100000];
|
||||
if (m_TLB_ReadMap == nullptr)
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceError, "Failed to Allocate m_TLB_ReadMap (Size: 0x%X)", 0x100000 * sizeof(size_t));
|
||||
WriteTrace(TraceN64System, TraceError, "Failed to allocate m_TLB_ReadMap (Size: 0x%X)", 0x100000 * sizeof(size_t));
|
||||
FreeMemory();
|
||||
return false;
|
||||
}
|
||||
|
@ -225,7 +225,7 @@ bool CMipsMemoryVM::Initialize(bool SyncSystem)
|
|||
m_TLB_WriteMap = new size_t[0x100000];
|
||||
if (m_TLB_WriteMap == nullptr)
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceError, "Failed to Allocate m_TLB_WriteMap (Size: 0x%X)", 0xFFFFF * sizeof(size_t));
|
||||
WriteTrace(TraceN64System, TraceError, "Failed to allocate m_TLB_WriteMap (Size: 0x%X)", 0xFFFFF * sizeof(size_t));
|
||||
FreeMemory();
|
||||
return false;
|
||||
}
|
||||
|
@ -583,7 +583,7 @@ bool CMipsMemoryVM::VAddrToRealAddr(uint32_t VAddr, void * &RealAddress) const
|
|||
|
||||
bool CMipsMemoryVM::TranslateVaddr(uint32_t VAddr, uint32_t &PAddr) const
|
||||
{
|
||||
//Change the Virtual address to a Physical Address
|
||||
// Change the virtual address to a physical address
|
||||
if (m_TLB_ReadMap[VAddr >> 12] == 0)
|
||||
{
|
||||
return false;
|
||||
|
@ -807,7 +807,7 @@ bool CMipsMemoryVM::SW_NonMemory(uint32_t PAddr, uint32_t Value)
|
|||
VirtualProtect(ROM, RomFileSize, PAGE_NOACCESS, &OldProtect);
|
||||
}
|
||||
#endif
|
||||
//LogMessage("%X: Wrote To Rom %08X from %08X",PROGRAM_COUNTER,Value,PAddr);
|
||||
//LogMessage("%X: Wrote To ROM %08X from %08X",PROGRAM_COUNTER,Value,PAddr);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -916,7 +916,7 @@ void CMipsMemoryVM::ProtectMemory(uint32_t StartVaddr, uint32_t EndVaddr)
|
|||
return;
|
||||
}
|
||||
|
||||
//Get Physical Addresses passed
|
||||
// Get physical addresses passed
|
||||
uint32_t StartPAddr, EndPAddr;
|
||||
if (!TranslateVaddr(StartVaddr, StartPAddr))
|
||||
{
|
||||
|
@ -927,14 +927,14 @@ void CMipsMemoryVM::ProtectMemory(uint32_t StartVaddr, uint32_t EndVaddr)
|
|||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
//Get Length of memory being protected
|
||||
// Get length of memory being protected
|
||||
int32_t Length = ((EndPAddr + 3) - StartPAddr) & ~3;
|
||||
if (Length < 0)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
//Protect that memory address space
|
||||
// Protect that memory address space
|
||||
uint8_t * MemLoc = Rdram() + StartPAddr;
|
||||
WriteTrace(TraceProtectedMem, TraceDebug, "Paddr: %08X Length: %X", StartPAddr, Length);
|
||||
|
||||
|
@ -946,7 +946,7 @@ void CMipsMemoryVM::UnProtectMemory(uint32_t StartVaddr, uint32_t EndVaddr)
|
|||
WriteTrace(TraceProtectedMem, TraceDebug, "StartVaddr: %08X EndVaddr: %08X", StartVaddr, EndVaddr);
|
||||
if (!ValidVaddr(StartVaddr) || !ValidVaddr(EndVaddr)) { return; }
|
||||
|
||||
//Get Physical Addresses passed
|
||||
// Get physical addresses passed
|
||||
uint32_t StartPAddr, EndPAddr;
|
||||
if (!TranslateVaddr(StartVaddr, StartPAddr))
|
||||
{
|
||||
|
@ -957,7 +957,7 @@ void CMipsMemoryVM::UnProtectMemory(uint32_t StartVaddr, uint32_t EndVaddr)
|
|||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
//Get Length of memory being protected
|
||||
// Get length of memory being protected
|
||||
int32_t Length = ((EndPAddr + 3) - StartPAddr) & ~3;
|
||||
if (Length < 0)
|
||||
{
|
||||
|
@ -1028,15 +1028,15 @@ void CMipsMemoryVM::RdramChanged(CMipsMemoryVM * _this)
|
|||
void * result = CommitMemory(_this->m_RDRAM + old_size, new_size - old_size, MEM_READWRITE);
|
||||
if (result == nullptr)
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceError, "failed to allocate extended memory");
|
||||
WriteTrace(TraceN64System, TraceError, "Failed to allocate extended memory");
|
||||
g_Notify->FatalError(GS(MSG_MEM_ALLOC_ERROR));
|
||||
}
|
||||
}
|
||||
|
||||
if (new_size > 0xFFFFFFFFul)
|
||||
{ // should be unreachable because: size_t new_size = g_Settings->(uint32_t)
|
||||
{ // Should be unreachable because: size_t new_size = g_Settings->(uint32_t)
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
} // ...However, FFFFFFFF also is a limit to RCP addressing, so we care.
|
||||
} // However, FFFFFFFF also is a limit to RCP addressing, so we care
|
||||
_this->m_AllocatedRdramSize = (uint32_t)new_size;
|
||||
}
|
||||
|
||||
|
@ -1432,7 +1432,7 @@ void CMipsMemoryVM::Load32SerialInterface(void)
|
|||
|
||||
void CMipsMemoryVM::Load32CartridgeDomain1Address1(void)
|
||||
{
|
||||
//64DD IPL ROM
|
||||
// 64DD IPL ROM
|
||||
if (g_DDRom != nullptr && (m_MemLookupAddress & 0xFFFFFF) < g_MMU->m_DDRomSize)
|
||||
{
|
||||
m_MemLookupValue.UW[0] = *(uint32_t *)&g_MMU->m_DDRom[(m_MemLookupAddress & 0xFFFFFF)];
|
||||
|
@ -1452,7 +1452,7 @@ void CMipsMemoryVM::Load32CartridgeDomain1Address3(void)
|
|||
|
||||
void CMipsMemoryVM::Load32CartridgeDomain2Address1(void)
|
||||
{
|
||||
//64DD REGISTERS
|
||||
// 64DD registers
|
||||
if (g_Settings->LoadBool(Setting_EnableDisk))
|
||||
{
|
||||
switch (m_MemLookupAddress & 0x1FFFFFFF)
|
||||
|
@ -1509,7 +1509,7 @@ void CMipsMemoryVM::Load32CartridgeDomain2Address2(void)
|
|||
}
|
||||
if (g_System->m_SaveUsing == SaveChip_Sram)
|
||||
{
|
||||
//Load Sram
|
||||
// Load SRAM
|
||||
uint8_t tmp[4] = "";
|
||||
g_MMU->DmaFromSram(tmp, offset, 4);
|
||||
m_MemLookupValue.UW[0] = tmp[3] << 24 | tmp[2] << 16 | tmp[1] << 8 | tmp[0];
|
||||
|
@ -1561,7 +1561,7 @@ void CMipsMemoryVM::Load32Rom(void)
|
|||
if (g_MMU->m_RomWrittenTo)
|
||||
{
|
||||
m_MemLookupValue.UW[0] = g_MMU->m_RomWroteValue;
|
||||
//LogMessage("%X: Read crap from Rom %08X from %08X",PROGRAM_COUNTER,*Value,PAddr);
|
||||
//LogMessage("%X: Read crap from ROM %08X from %08X",PROGRAM_COUNTER,*Value,PAddr);
|
||||
g_MMU->m_RomWrittenTo = false;
|
||||
#ifdef ROM_IN_MAPSPACE
|
||||
{
|
||||
|
@ -2021,7 +2021,7 @@ void CMipsMemoryVM::Write32AudioInterface(void)
|
|||
break;
|
||||
case 0x04500008: g_Reg->AI_CONTROL_REG = (m_MemLookupValue.UW[0] & 1); break;
|
||||
case 0x0450000C:
|
||||
/* Clear Interrupt */;
|
||||
// Clear interrupt
|
||||
g_Reg->MI_INTR_REG &= ~MI_INTR_AI;
|
||||
g_Reg->m_AudioIntrReg &= ~MI_INTR_AI;
|
||||
g_Reg->CheckInterrupts();
|
||||
|
@ -2138,7 +2138,7 @@ void CMipsMemoryVM::Write32SerialInterface(void)
|
|||
|
||||
void CMipsMemoryVM::Write32CartridgeDomain2Address1(void)
|
||||
{
|
||||
//64DD Registers
|
||||
// 64DD registers
|
||||
if (g_Settings->LoadBool(Setting_EnableDisk))
|
||||
{
|
||||
switch (m_MemLookupAddress & 0xFFFFFFF)
|
||||
|
@ -2174,7 +2174,7 @@ void CMipsMemoryVM::Write32CartridgeDomain2Address2(void)
|
|||
uint32_t offset = (m_MemLookupAddress & 0x1FFFFFFF) - 0x08000000;
|
||||
if (g_System->m_SaveUsing == SaveChip_Sram && offset < 0x8000)
|
||||
{
|
||||
//Store Sram
|
||||
// Store SRAM
|
||||
uint8_t tmp[4] = "";
|
||||
tmp[0] = 0xFF & (m_MemLookupValue.UW[0]);
|
||||
tmp[1] = 0xFF & (m_MemLookupValue.UW[0] >> 8);
|
||||
|
|
|
@ -14,14 +14,14 @@
|
|||
|
||||
#ifndef _WIN32
|
||||
#include <signal.h>
|
||||
/* siginfo_t */
|
||||
// siginfo_t
|
||||
#endif
|
||||
|
||||
/*
|
||||
* To do: Have address translation functions here?
|
||||
* TODO: Have address translation functions here?
|
||||
* `return` either the translated address or the mask to XOR by?
|
||||
*
|
||||
* This will help us gradually be able to port Project64 for big-endian CPUs.
|
||||
* This will help us gradually be able to port Project64 to big-endian CPUs.
|
||||
* Currently it is written to assume 32-bit little-endian, like so:
|
||||
*
|
||||
* 0xAABBCCDD EEFFGGHH --> 0xDDCCBBAA HHGGFFEE
|
||||
|
@ -88,11 +88,11 @@ public:
|
|||
static void segv_handler(int signal, siginfo_t *siginfo, void *sigcontext);
|
||||
#endif
|
||||
|
||||
//Protect the Memory from being written to
|
||||
// Protect the memory from being written to
|
||||
void ProtectMemory(uint32_t StartVaddr, uint32_t EndVaddr);
|
||||
void UnProtectMemory(uint32_t StartVaddr, uint32_t EndVaddr);
|
||||
|
||||
//Functions for TLB notification
|
||||
// Functions for TLB notification
|
||||
void TLB_Mapped(uint32_t VAddr, uint32_t Len, uint32_t PAddr, bool bReadOnly);
|
||||
void TLB_Unmaped(uint32_t Vaddr, uint32_t Len);
|
||||
|
||||
|
@ -179,35 +179,35 @@ private:
|
|||
static bool FilterArmException(uint32_t MemAddress, mcontext_t & context);
|
||||
#endif
|
||||
|
||||
//Memory Locations
|
||||
// Memory locations
|
||||
static uint8_t * m_Reserve1, *m_Reserve2;
|
||||
uint8_t * m_RDRAM, *m_DMEM, *m_IMEM;
|
||||
uint32_t m_AllocatedRdramSize;
|
||||
|
||||
//Rom Information
|
||||
// ROM information
|
||||
bool m_RomMapped;
|
||||
uint8_t * m_Rom;
|
||||
uint32_t m_RomSize;
|
||||
bool m_RomWrittenTo;
|
||||
uint32_t m_RomWroteValue;
|
||||
|
||||
//DDRom Information
|
||||
// DDRom information
|
||||
bool m_DDRomMapped;
|
||||
uint8_t * m_DDRom;
|
||||
uint32_t m_DDRomSize;
|
||||
|
||||
//Current Half line
|
||||
//Current half line
|
||||
void UpdateHalfLine();
|
||||
uint32_t m_HalfLine;
|
||||
uint32_t m_HalfLineCheck;
|
||||
uint32_t m_FieldSerration;
|
||||
|
||||
//Initializing and resetting information about the memory system
|
||||
// Initializing and resetting information about the memory system
|
||||
void FreeMemory();
|
||||
|
||||
mutable char m_strLabelName[100];
|
||||
|
||||
//BIG look up table to quickly translate the tlb to real mem address
|
||||
// Big look up table to quickly translate the TLB to real memory addresses
|
||||
size_t * m_TLB_ReadMap;
|
||||
size_t * m_TLB_WriteMap;
|
||||
|
||||
|
|
|
@ -165,7 +165,7 @@ void CMempak::ReadFrom(int32_t Control, uint32_t address, uint8_t * data)
|
|||
else
|
||||
{
|
||||
memset(data, 0x00, 0x20);
|
||||
/* Rumble pack area */
|
||||
// Rumble pack area
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -192,6 +192,6 @@ void CMempak::WriteTo(int32_t Control, uint32_t address, uint8_t * data)
|
|||
}
|
||||
else
|
||||
{
|
||||
/* Rumble pack area */
|
||||
// Rumble pack area
|
||||
}
|
||||
}
|
|
@ -557,7 +557,7 @@ const char * R4300iOpcodeName(uint32_t OpCode, uint32_t PC)
|
|||
sprintf(CommandName, "ADDI\t%s, %s, 0x%04X", CRegName::GPR[command.rt], CRegName::GPR[command.rs], command.immediate);
|
||||
break;
|
||||
case R4300i_ADDIU:
|
||||
// special case for stack
|
||||
// Special case for stack
|
||||
if (command.rt == 29)
|
||||
{
|
||||
short imm = (short)command.immediate;
|
||||
|
|
|
@ -84,7 +84,7 @@ void CPifRam::PifRamRead()
|
|||
case 0xFD: CurPos = 0x40; break;
|
||||
case 0xFE: CurPos = 0x40; break;
|
||||
case 0xFF: break;
|
||||
case 0xB4: case 0x56: case 0xB8: break; /* ??? */
|
||||
case 0xB4: case 0x56: case 0xB8: break;
|
||||
default:
|
||||
if ((m_PifRam[CurPos] & 0xC0) == 0)
|
||||
{
|
||||
|
@ -109,7 +109,7 @@ void CPifRam::PifRamRead()
|
|||
{
|
||||
if (CurPos != 0x27 && bShowPifRamErrors())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Unknown Command in PifRamRead(%X)", m_PifRam[CurPos]).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Unknown command in PifRamRead(%X)", m_PifRam[CurPos]).c_str());
|
||||
}
|
||||
CurPos = 0x40;
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ void CPifRam::PifRamWrite()
|
|||
switch (m_PifRam[0x3F])
|
||||
{
|
||||
case 0x02:
|
||||
// format the 'challenge' message into 30 nibbles for X-Scale's CIC code
|
||||
// Format the 'challenge' message into 30 nibbles for X-Scale's CIC code
|
||||
{
|
||||
char Challenge[30], Response[30];
|
||||
for (int32_t i = 0; i < 15; i++)
|
||||
|
@ -174,7 +174,7 @@ void CPifRam::PifRamWrite()
|
|||
default:
|
||||
if (bShowPifRamErrors())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Unkown PifRam control: %d", m_PifRam[0x3F]).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Unknown PifRam control: %d", m_PifRam[0x3F]).c_str());
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
@ -194,7 +194,7 @@ void CPifRam::PifRamWrite()
|
|||
case 0xFD: CurPos = 0x40; break;
|
||||
case 0xFE: CurPos = 0x40; break;
|
||||
case 0xFF: break;
|
||||
case 0xB4: case 0x56: case 0xB8: break; /* ??? */
|
||||
case 0xB4: case 0x56: case 0xB8: break; // ???
|
||||
default:
|
||||
if ((m_PifRam[CurPos] & 0xC0) == 0)
|
||||
{
|
||||
|
@ -254,7 +254,7 @@ void CPifRam::SI_DMA_READ()
|
|||
{
|
||||
if (bShowPifRamErrors())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("%s\nSI_DRAM_ADDR_REG not in RDRam space", __FUNCTION__).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("%s\nSI_DRAM_ADDR_REG not in RDRAM space", __FUNCTION__).c_str());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -354,7 +354,7 @@ void CPifRam::SI_DMA_WRITE()
|
|||
{
|
||||
if (bShowPifRamErrors())
|
||||
{
|
||||
g_Notify->DisplayError("SI DMA\nSI_DRAM_ADDR_REG not in RDRam space");
|
||||
g_Notify->DisplayError("SI DMA\nSI_DRAM_ADDR_REG not in RDRAM space");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -388,7 +388,7 @@ void CPifRam::SI_DMA_WRITE()
|
|||
int32_t count;
|
||||
char HexData[100], AsciiData[100], Addon[20];
|
||||
LogMessage("");
|
||||
LogMessage("\tData DMAed to the Pif Ram:");
|
||||
LogMessage("\tData DMAed to the PIF RAM:");
|
||||
LogMessage("\t--------------------------");
|
||||
for (count = 0; count < 16; count++)
|
||||
{
|
||||
|
@ -440,8 +440,8 @@ void CPifRam::ProcessControllerCommand(int32_t Control, uint8_t * Command)
|
|||
|
||||
switch (Command[2])
|
||||
{
|
||||
case 0x00: // check
|
||||
case 0xFF: // reset & check ?
|
||||
case 0x00: // Check
|
||||
case 0xFF: // Reset and check?
|
||||
if ((Command[1] & 0x80) != 0)
|
||||
{
|
||||
break;
|
||||
|
@ -450,7 +450,7 @@ void CPifRam::ProcessControllerCommand(int32_t Control, uint8_t * Command)
|
|||
{
|
||||
if (Command[0] != 1 || Command[1] != 3)
|
||||
{
|
||||
g_Notify->DisplayError("What am I meant to do with this Controller Command");
|
||||
g_Notify->DisplayError("What am I meant to do with this controller command?");
|
||||
}
|
||||
}
|
||||
if (Controllers[Control].Present != 0)
|
||||
|
@ -472,12 +472,12 @@ void CPifRam::ProcessControllerCommand(int32_t Control, uint8_t * Command)
|
|||
Command[1] |= 0x80;
|
||||
}
|
||||
break;
|
||||
case 0x01: // read controller
|
||||
case 0x01: // Read controller
|
||||
if (bShowPifRamErrors())
|
||||
{
|
||||
if (Command[0] != 1 || Command[1] != 4)
|
||||
{
|
||||
g_Notify->DisplayError("What am I meant to do with this Controller Command");
|
||||
g_Notify->DisplayError("What am I meant to do with this controller command?");
|
||||
}
|
||||
}
|
||||
if (Controllers[Control].Present == false)
|
||||
|
@ -485,16 +485,16 @@ void CPifRam::ProcessControllerCommand(int32_t Control, uint8_t * Command)
|
|||
Command[1] |= 0x80;
|
||||
}
|
||||
break;
|
||||
case 0x02: //read from controller pack
|
||||
case 0x02: // Read from controller pak
|
||||
if (LogControllerPak())
|
||||
{
|
||||
LogControllerPakData("Read: Before Gettting Results");
|
||||
LogControllerPakData("Read: before getting results");
|
||||
}
|
||||
if (bShowPifRamErrors())
|
||||
{
|
||||
if (Command[0] != 3 || Command[1] != 33)
|
||||
{
|
||||
g_Notify->DisplayError("What am I meant to do with this Controller Command");
|
||||
g_Notify->DisplayError("What am I meant to do with this controller command?");
|
||||
}
|
||||
}
|
||||
if (Controllers[Control].Present != 0)
|
||||
|
@ -523,19 +523,19 @@ void CPifRam::ProcessControllerCommand(int32_t Control, uint8_t * Command)
|
|||
}
|
||||
if (LogControllerPak())
|
||||
{
|
||||
LogControllerPakData("Read: After Gettting Results");
|
||||
LogControllerPakData("Read: after getting results");
|
||||
}
|
||||
break;
|
||||
case 0x03: //write controller pak
|
||||
case 0x03: // Write controller pak
|
||||
if (LogControllerPak())
|
||||
{
|
||||
LogControllerPakData("Write: Before Processing");
|
||||
LogControllerPakData("Write: before processing");
|
||||
}
|
||||
if (bShowPifRamErrors())
|
||||
{
|
||||
if (Command[0] != 35 || Command[1] != 1)
|
||||
{
|
||||
g_Notify->DisplayError("What am I meant to do with this Controller Command");
|
||||
g_Notify->DisplayError("What am I meant to do with this controller command?");
|
||||
}
|
||||
}
|
||||
if (Controllers[Control].Present != 0)
|
||||
|
@ -562,7 +562,7 @@ void CPifRam::ProcessControllerCommand(int32_t Control, uint8_t * Command)
|
|||
}
|
||||
if (LogControllerPak())
|
||||
{
|
||||
LogControllerPakData("Write: After Processing");
|
||||
LogControllerPakData("Write: after processing");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -579,19 +579,19 @@ void CPifRam::ReadControllerCommand(int32_t Control, uint8_t * Command)
|
|||
|
||||
switch (Command[2])
|
||||
{
|
||||
case 0x01: // read controller
|
||||
case 0x01: // Read controller
|
||||
if (Controllers[Control].Present != 0)
|
||||
{
|
||||
if (bShowPifRamErrors())
|
||||
{
|
||||
if (Command[0] != 1 || Command[1] != 4) { g_Notify->DisplayError("What am I meant to do with this Controller Command"); }
|
||||
if (Command[0] != 1 || Command[1] != 4) { g_Notify->DisplayError("What am I meant to do with this controller command?"); }
|
||||
}
|
||||
|
||||
const uint32_t buttons = g_BaseSystem->GetButtons(Control);
|
||||
memcpy(&Command[3], &buttons, sizeof(uint32_t));
|
||||
}
|
||||
break;
|
||||
case 0x02: //read from controller pack
|
||||
case 0x02: // Read from controller pak
|
||||
if (Controllers[Control].Present != 0)
|
||||
{
|
||||
switch (Controllers[Control].Plugin)
|
||||
|
@ -600,7 +600,7 @@ void CPifRam::ReadControllerCommand(int32_t Control, uint8_t * Command)
|
|||
}
|
||||
}
|
||||
break;
|
||||
case 0x03: //write controller pak
|
||||
case 0x03: // Write controller pak
|
||||
if (Controllers[Control].Present != 0)
|
||||
{
|
||||
switch (Controllers[Control].Plugin)
|
||||
|
|
|
@ -261,7 +261,7 @@ void CRegisters::Reset()
|
|||
|
||||
m_LLBit = 0;
|
||||
|
||||
//Reset System Registers
|
||||
// Reset system registers
|
||||
memset(m_RDRAM_Interface, 0, sizeof(m_RDRAM_Interface));
|
||||
memset(m_RDRAM_Registers, 0, sizeof(m_RDRAM_Registers));
|
||||
memset(m_Mips_Interface, 0, sizeof(m_Mips_Interface));
|
||||
|
@ -350,11 +350,11 @@ void CRegisters::DoAddressError(bool DelaySlot, uint32_t BadVaddr, bool FromRead
|
|||
g_Notify->DisplayError(stdstr_f("AddressError %s Vaddr: %X", FromRead ? "reading" : "writing", BadVaddr).c_str());
|
||||
if ((STATUS_REGISTER & STATUS_EXL) != 0)
|
||||
{
|
||||
g_Notify->DisplayError("EXL set in AddressError Exception");
|
||||
g_Notify->DisplayError("EXL set in AddressError exception");
|
||||
}
|
||||
if ((STATUS_REGISTER & STATUS_ERL) != 0)
|
||||
{
|
||||
g_Notify->DisplayError("ERL set in AddressError Exception");
|
||||
g_Notify->DisplayError("ERL set in AddressError exception");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -406,11 +406,11 @@ void CRegisters::DoBreakException(bool DelaySlot)
|
|||
{
|
||||
if ((STATUS_REGISTER & STATUS_EXL) != 0)
|
||||
{
|
||||
g_Notify->DisplayError("EXL set in Break Exception");
|
||||
g_Notify->DisplayError("EXL set in break exception");
|
||||
}
|
||||
if ((STATUS_REGISTER & STATUS_ERL) != 0)
|
||||
{
|
||||
g_Notify->DisplayError("ERL set in Break Exception");
|
||||
g_Notify->DisplayError("ERL set in break exception");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -450,11 +450,11 @@ void CRegisters::DoCopUnusableException(bool DelaySlot, int32_t Coprocessor)
|
|||
{
|
||||
if ((STATUS_REGISTER & STATUS_EXL) != 0)
|
||||
{
|
||||
g_Notify->DisplayError("EXL set in Break Exception");
|
||||
g_Notify->DisplayError("EXL set in break exception");
|
||||
}
|
||||
if ((STATUS_REGISTER & STATUS_ERL) != 0)
|
||||
{
|
||||
g_Notify->DisplayError("ERL set in Break Exception");
|
||||
g_Notify->DisplayError("ERL set in break exception");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -495,7 +495,7 @@ bool CRegisters::DoIntrException(bool DelaySlot)
|
|||
|
||||
if (GenerateLog() && LogExceptions() && !LogNoInterrupts())
|
||||
{
|
||||
LogMessage("%08X: Interrupt Generated", m_PROGRAM_COUNTER);
|
||||
LogMessage("%08X: Interrupt generated", m_PROGRAM_COUNTER);
|
||||
}
|
||||
|
||||
CAUSE_REGISTER = FAKE_CAUSE_REGISTER;
|
||||
|
@ -548,7 +548,7 @@ void CRegisters::DoTLBReadMiss(bool DelaySlot, uint32_t BadVaddr)
|
|||
{
|
||||
if (HaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("TLBMiss - EXL Set\nBadVaddr = %X\nAddress Defined: %s", BadVaddr, g_TLB->AddressDefined(BadVaddr) ? "true" : "false").c_str());
|
||||
g_Notify->DisplayError(stdstr_f("TLBMiss - EXL set\nBadVaddr = %X\nAddress defined: %s", BadVaddr, g_TLB->AddressDefined(BadVaddr) ? "true" : "false").c_str());
|
||||
}
|
||||
m_PROGRAM_COUNTER = 0x80000180;
|
||||
}
|
||||
|
@ -586,7 +586,7 @@ void CRegisters::DoTLBWriteMiss(bool DelaySlot, uint32_t BadVaddr)
|
|||
{
|
||||
if (HaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("TLBMiss - EXL Set\nBadVaddr = %X\nAddress Defined: %s", BadVaddr, g_TLB->AddressDefined(BadVaddr) ? "true" : "false").c_str());
|
||||
g_Notify->DisplayError(stdstr_f("TLBMiss - EXL set\nBadVaddr = %X\nAddress defined: %s", BadVaddr, g_TLB->AddressDefined(BadVaddr) ? "true" : "false").c_str());
|
||||
}
|
||||
m_PROGRAM_COUNTER = 0x80000180;
|
||||
}
|
||||
|
@ -598,11 +598,11 @@ void CRegisters::DoSysCallException(bool DelaySlot)
|
|||
{
|
||||
if ((STATUS_REGISTER & STATUS_EXL) != 0)
|
||||
{
|
||||
g_Notify->DisplayError("EXL set in SysCall Exception");
|
||||
g_Notify->DisplayError("EXL set in syscall exception");
|
||||
}
|
||||
if ((STATUS_REGISTER & STATUS_ERL) != 0)
|
||||
{
|
||||
g_Notify->DisplayError("ERL set in SysCall Exception");
|
||||
g_Notify->DisplayError("ERL set in syscall exception");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include <Project64-core/Settings/GameSettings.h>
|
||||
#include <Project64-core/Logging.h>
|
||||
|
||||
//CPO registers by name
|
||||
// CPO registers by name
|
||||
class CP0registers
|
||||
{
|
||||
protected:
|
||||
|
@ -39,17 +39,17 @@ private:
|
|||
CP0registers& operator=(const CP0registers&);
|
||||
};
|
||||
|
||||
//CPO register flags
|
||||
// CPO register flags
|
||||
enum
|
||||
{
|
||||
//Status Register
|
||||
// Status register
|
||||
STATUS_IE = 0x00000001, STATUS_EXL = 0x00000002, STATUS_ERL = 0x00000004,
|
||||
STATUS_IP0 = 0x00000100, STATUS_IP1 = 0x00000200, STATUS_IP2 = 0x00000400,
|
||||
STATUS_IP3 = 0x00000800, STATUS_IP4 = 0x00001000, STATUS_IP5 = 0x00002000,
|
||||
STATUS_IP6 = 0x00004000, STATUS_IP7 = 0x00008000, STATUS_BEV = 0x00400000,
|
||||
STATUS_FR = 0x04000000, STATUS_CU0 = 0x10000000, STATUS_CU1 = 0x20000000,
|
||||
|
||||
//Cause Flags
|
||||
// Cause flags
|
||||
CAUSE_EXC_CODE = 0xFF,
|
||||
CAUSE_IP0 = 0x100,
|
||||
CAUSE_IP1 = 0x200,
|
||||
|
@ -61,56 +61,56 @@ enum
|
|||
CAUSE_IP7 = 0x8000,
|
||||
CAUSE_BD = 0x80000000,
|
||||
|
||||
//Cause exception ID's
|
||||
EXC_INT = 0, /* interrupt */
|
||||
EXC_MOD = 4, /* TLB mod */
|
||||
EXC_RMISS = 8, /* Read TLB Miss */
|
||||
EXC_WMISS = 12, /* Write TLB Miss */
|
||||
EXC_RADE = 16, /* Read Address Error */
|
||||
EXC_WADE = 20, /* Write Address Error */
|
||||
EXC_IBE = 24, /* Instruction Bus Error */
|
||||
EXC_DBE = 28, /* Data Bus Error */
|
||||
EXC_SYSCALL = 32, /* SYSCALL */
|
||||
EXC_BREAK = 36, /* BREAKpoint */
|
||||
EXC_II = 40, /* Illegal Instruction */
|
||||
EXC_CPU = 44, /* CoProcessor Unusable */
|
||||
EXC_OV = 48, /* OVerflow */
|
||||
EXC_TRAP = 52, /* Trap exception */
|
||||
EXC_VCEI = 56, /* Virt. Coherency on Inst. fetch */
|
||||
EXC_FPE = 60, /* Floating Point Exception */
|
||||
EXC_WATCH = 92, /* Watchpoint reference */
|
||||
EXC_VCED = 124,/* Virt. Coherency on data read */
|
||||
// Cause exception ID's
|
||||
EXC_INT = 0, // Interrupt
|
||||
EXC_MOD = 4, // TLB mod
|
||||
EXC_RMISS = 8, // Read TLB miss
|
||||
EXC_WMISS = 12, // Write TLB miss
|
||||
EXC_RADE = 16, // Read address error
|
||||
EXC_WADE = 20, // Write address error
|
||||
EXC_IBE = 24, // Instruction bus error
|
||||
EXC_DBE = 28, // Data bus error
|
||||
EXC_SYSCALL = 32, // Syscall
|
||||
EXC_BREAK = 36, // Breakpoint
|
||||
EXC_II = 40, // Illegal instruction
|
||||
EXC_CPU = 44, // Co-processor unusable
|
||||
EXC_OV = 48, // Overflow
|
||||
EXC_TRAP = 52, // Trap exception
|
||||
EXC_VCEI = 56, // Virtual coherency on instruction fetch
|
||||
EXC_FPE = 60, // Floating point exception
|
||||
EXC_WATCH = 92, // Watchpoint reference
|
||||
EXC_VCED = 124, // Virtual coherency on data read
|
||||
};
|
||||
|
||||
//Float point control status register flags
|
||||
// Float point control status register flags
|
||||
enum
|
||||
{
|
||||
FPCSR_FS = 0x01000000, /* flush denorm to zero */
|
||||
FPCSR_C = 0x00800000, /* condition bit */
|
||||
FPCSR_CE = 0x00020000, /* cause: unimplemented operation */
|
||||
FPCSR_CV = 0x00010000, /* cause: invalid operation */
|
||||
FPCSR_CZ = 0x00008000, /* cause: division by zero */
|
||||
FPCSR_CO = 0x00004000, /* cause: overflow */
|
||||
FPCSR_CU = 0x00002000, /* cause: underflow */
|
||||
FPCSR_CI = 0x00001000, /* cause: inexact operation */
|
||||
FPCSR_EV = 0x00000800, /* enable: invalid operation */
|
||||
FPCSR_EZ = 0x00000400, /* enable: division by zero */
|
||||
FPCSR_EO = 0x00000200, /* enable: overflow */
|
||||
FPCSR_EU = 0x00000100, /* enable: underflow */
|
||||
FPCSR_EI = 0x00000080, /* enable: inexact operation */
|
||||
FPCSR_FV = 0x00000040, /* flag: invalid operation */
|
||||
FPCSR_FZ = 0x00000020, /* flag: division by zero */
|
||||
FPCSR_FO = 0x00000010, /* flag: overflow */
|
||||
FPCSR_FU = 0x00000008, /* flag: underflow */
|
||||
FPCSR_FI = 0x00000004, /* flag: inexact operation */
|
||||
FPCSR_RM_MASK = 0x00000003, /* rounding mode mask */
|
||||
FPCSR_RM_RN = 0x00000000, /* round to nearest */
|
||||
FPCSR_RM_RZ = 0x00000001, /* round to zero */
|
||||
FPCSR_RM_RP = 0x00000002, /* round to positive infinity */
|
||||
FPCSR_RM_RM = 0x00000003, /* round to negative infinity */
|
||||
FPCSR_FS = 0x01000000, // Flush denormalization to zero
|
||||
FPCSR_C = 0x00800000, // Condition bit
|
||||
FPCSR_CE = 0x00020000, // Cause: unimplemented operation
|
||||
FPCSR_CV = 0x00010000, // Cause: invalid operation
|
||||
FPCSR_CZ = 0x00008000, // Cause: division by zero
|
||||
FPCSR_CO = 0x00004000, // Cause: overflow
|
||||
FPCSR_CU = 0x00002000, // Cause: underflow
|
||||
FPCSR_CI = 0x00001000, // Cause: inexact operation
|
||||
FPCSR_EV = 0x00000800, // Enable: invalid operation
|
||||
FPCSR_EZ = 0x00000400, // Enable: division by zero
|
||||
FPCSR_EO = 0x00000200, // Enable: overflow
|
||||
FPCSR_EU = 0x00000100, // Enable: underflow
|
||||
FPCSR_EI = 0x00000080, // Enable: inexact operation
|
||||
FPCSR_FV = 0x00000040, // Flag: invalid operation
|
||||
FPCSR_FZ = 0x00000020, // Flag: division by zero
|
||||
FPCSR_FO = 0x00000010, // Flag: overflow
|
||||
FPCSR_FU = 0x00000008, // Flag: underflow
|
||||
FPCSR_FI = 0x00000004, // Flag: inexact operation
|
||||
FPCSR_RM_MASK = 0x00000003, // Rounding mode mask
|
||||
FPCSR_RM_RN = 0x00000000, // Round to nearest
|
||||
FPCSR_RM_RZ = 0x00000001, // Round to zero
|
||||
FPCSR_RM_RP = 0x00000002, // Round to positive infinity
|
||||
FPCSR_RM_RM = 0x00000003, // Round to negative infinity
|
||||
};
|
||||
|
||||
//Rdram Registers
|
||||
// RDRAM registers
|
||||
class Rdram_InterfaceReg
|
||||
{
|
||||
protected:
|
||||
|
@ -135,7 +135,7 @@ private:
|
|||
Rdram_InterfaceReg& operator=(const Rdram_InterfaceReg&);
|
||||
};
|
||||
|
||||
//Mips interface registers
|
||||
// MIPS interface registers
|
||||
class Mips_InterfaceReg
|
||||
{
|
||||
protected:
|
||||
|
@ -155,52 +155,52 @@ private:
|
|||
Mips_InterfaceReg& operator=(const Mips_InterfaceReg&);
|
||||
};
|
||||
|
||||
//Mips interface flags
|
||||
// MIPS interface flags
|
||||
enum
|
||||
{
|
||||
MI_MODE_INIT = 0x0080, /* Bit 7: init mode */
|
||||
MI_MODE_EBUS = 0x0100, /* Bit 8: ebus test mode */
|
||||
MI_MODE_RDRAM = 0x0200, /* Bit 9: RDRAM reg mode */
|
||||
MI_MODE_INIT = 0x0080, // Bit 7: Initialization mode
|
||||
MI_MODE_EBUS = 0x0100, // Bit 8: EBUS test mode
|
||||
MI_MODE_RDRAM = 0x0200, // Bit 9: RDRAM register mode
|
||||
|
||||
MI_CLR_INIT = 0x0080, /* Bit 7: clear init mode */
|
||||
MI_SET_INIT = 0x0100, /* Bit 8: set init mode */
|
||||
MI_CLR_EBUS = 0x0200, /* Bit 9: clear ebus test */
|
||||
MI_SET_EBUS = 0x0400, /* Bit 10: set ebus test mode */
|
||||
MI_CLR_DP_INTR = 0x0800, /* Bit 11: clear dp interrupt */
|
||||
MI_CLR_RDRAM = 0x1000, /* Bit 12: clear RDRAM reg */
|
||||
MI_SET_RDRAM = 0x2000, /* Bit 13: set RDRAM reg mode */
|
||||
MI_CLR_INIT = 0x0080, // Bit 7: Clear initialization mode
|
||||
MI_SET_INIT = 0x0100, // Bit 8: Set initialization mode
|
||||
MI_CLR_EBUS = 0x0200, // Bit 9: Clear EBUS test
|
||||
MI_SET_EBUS = 0x0400, // Bit 10: Set EBUS test mode
|
||||
MI_CLR_DP_INTR = 0x0800, // Bit 11: Clear DP interrupt
|
||||
MI_CLR_RDRAM = 0x1000, // Bit 12: Clear RDRAM register
|
||||
MI_SET_RDRAM = 0x2000, // Bit 13: Set RDRAM register mode
|
||||
|
||||
//Flags for writing to MI_INTR_MASK_REG
|
||||
MI_INTR_MASK_CLR_SP = 0x0001, /* Bit 0: clear SP mask */
|
||||
MI_INTR_MASK_SET_SP = 0x0002, /* Bit 1: set SP mask */
|
||||
MI_INTR_MASK_CLR_SI = 0x0004, /* Bit 2: clear SI mask */
|
||||
MI_INTR_MASK_SET_SI = 0x0008, /* Bit 3: set SI mask */
|
||||
MI_INTR_MASK_CLR_AI = 0x0010, /* Bit 4: clear AI mask */
|
||||
MI_INTR_MASK_SET_AI = 0x0020, /* Bit 5: set AI mask */
|
||||
MI_INTR_MASK_CLR_VI = 0x0040, /* Bit 6: clear VI mask */
|
||||
MI_INTR_MASK_SET_VI = 0x0080, /* Bit 7: set VI mask */
|
||||
MI_INTR_MASK_CLR_PI = 0x0100, /* Bit 8: clear PI mask */
|
||||
MI_INTR_MASK_SET_PI = 0x0200, /* Bit 9: set PI mask */
|
||||
MI_INTR_MASK_CLR_DP = 0x0400, /* Bit 10: clear DP mask */
|
||||
MI_INTR_MASK_SET_DP = 0x0800, /* Bit 11: set DP mask */
|
||||
// Flags for writing to MI_INTR_MASK_REG
|
||||
MI_INTR_MASK_CLR_SP = 0x0001, // Bit 0: Clear SP mask
|
||||
MI_INTR_MASK_SET_SP = 0x0002, // Bit 1: Set SP mask
|
||||
MI_INTR_MASK_CLR_SI = 0x0004, // Bit 2: Clear SI mask
|
||||
MI_INTR_MASK_SET_SI = 0x0008, // Bit 3: Set SI mask
|
||||
MI_INTR_MASK_CLR_AI = 0x0010, // Bit 4: Clear AI mask
|
||||
MI_INTR_MASK_SET_AI = 0x0020, // Bit 5: Set AI mask
|
||||
MI_INTR_MASK_CLR_VI = 0x0040, // Bit 6: Clear VI mask
|
||||
MI_INTR_MASK_SET_VI = 0x0080, // Bit 7: Set VI mask
|
||||
MI_INTR_MASK_CLR_PI = 0x0100, // Bit 8: Clear PI mask
|
||||
MI_INTR_MASK_SET_PI = 0x0200, // Bit 9: Set PI mask
|
||||
MI_INTR_MASK_CLR_DP = 0x0400, // Bit 10: Clear DP mask
|
||||
MI_INTR_MASK_SET_DP = 0x0800, // Bit 11: Set DP mask
|
||||
|
||||
//Flags for reading from MI_INTR_MASK_REG
|
||||
MI_INTR_MASK_SP = 0x01, /* Bit 0: SP intr mask */
|
||||
MI_INTR_MASK_SI = 0x02, /* Bit 1: SI intr mask */
|
||||
MI_INTR_MASK_AI = 0x04, /* Bit 2: AI intr mask */
|
||||
MI_INTR_MASK_VI = 0x08, /* Bit 3: VI intr mask */
|
||||
MI_INTR_MASK_PI = 0x10, /* Bit 4: PI intr mask */
|
||||
MI_INTR_MASK_DP = 0x20, /* Bit 5: DP intr mask */
|
||||
// Flags for reading from MI_INTR_MASK_REG
|
||||
MI_INTR_MASK_SP = 0x01, // Bit 0: SP INTR mask
|
||||
MI_INTR_MASK_SI = 0x02, // Bit 1: SI INTR mask
|
||||
MI_INTR_MASK_AI = 0x04, // Bit 2: AI INTR mask
|
||||
MI_INTR_MASK_VI = 0x08, // Bit 3: VI INTR mask
|
||||
MI_INTR_MASK_PI = 0x10, // Bit 4: PI INTR mask
|
||||
MI_INTR_MASK_DP = 0x20, // Bit 5: DP INTR mask
|
||||
|
||||
MI_INTR_SP = 0x01, /* Bit 0: SP intr */
|
||||
MI_INTR_SI = 0x02, /* Bit 1: SI intr */
|
||||
MI_INTR_AI = 0x04, /* Bit 2: AI intr */
|
||||
MI_INTR_VI = 0x08, /* Bit 3: VI intr */
|
||||
MI_INTR_PI = 0x10, /* Bit 4: PI intr */
|
||||
MI_INTR_DP = 0x20, /* Bit 5: DP intr */
|
||||
MI_INTR_SP = 0x01, // Bit 0: SP INTR
|
||||
MI_INTR_SI = 0x02, // Bit 1: SI INTR
|
||||
MI_INTR_AI = 0x04, // Bit 2: AI INTR
|
||||
MI_INTR_VI = 0x08, // Bit 3: VI INTR
|
||||
MI_INTR_PI = 0x10, // Bit 4: PI INTR
|
||||
MI_INTR_DP = 0x20, // Bit 5: DP INTR
|
||||
};
|
||||
|
||||
//Mips interface registers
|
||||
// MIPS interface registers
|
||||
class Video_InterfaceReg
|
||||
{
|
||||
protected:
|
||||
|
@ -237,7 +237,7 @@ private:
|
|||
Video_InterfaceReg& operator=(const Video_InterfaceReg&);
|
||||
};
|
||||
|
||||
//Display Processor Control Registers
|
||||
// Display processor control registers
|
||||
class DisplayControlReg
|
||||
{
|
||||
protected:
|
||||
|
@ -261,33 +261,31 @@ private:
|
|||
|
||||
enum
|
||||
{
|
||||
DPC_CLR_XBUS_DMEM_DMA = 0x0001, /* Bit 0: clear xbus_dmem_dma */
|
||||
DPC_SET_XBUS_DMEM_DMA = 0x0002, /* Bit 1: set xbus_dmem_dma */
|
||||
DPC_CLR_FREEZE = 0x0004, /* Bit 2: clear freeze */
|
||||
DPC_SET_FREEZE = 0x0008, /* Bit 3: set freeze */
|
||||
DPC_CLR_FLUSH = 0x0010, /* Bit 4: clear flush */
|
||||
DPC_SET_FLUSH = 0x0020, /* Bit 5: set flush */
|
||||
DPC_CLR_TMEM_CTR = 0x0040, /* Bit 6: clear tmem ctr */
|
||||
DPC_CLR_PIPE_CTR = 0x0080, /* Bit 7: clear pipe ctr */
|
||||
DPC_CLR_CMD_CTR = 0x0100, /* Bit 8: clear cmd ctr */
|
||||
DPC_CLR_CLOCK_CTR = 0x0200, /* Bit 9: clear clock ctr */
|
||||
DPC_CLR_XBUS_DMEM_DMA = 0x0001, // Bit 0: Clear xbus_dmem_dma
|
||||
DPC_SET_XBUS_DMEM_DMA = 0x0002, // Bit 1: Set xbus_dmem_dma
|
||||
DPC_CLR_FREEZE = 0x0004, // Bit 2: Clear freeze
|
||||
DPC_SET_FREEZE = 0x0008, // Bit 3: Set freeze
|
||||
DPC_CLR_FLUSH = 0x0010, // Bit 4: Clear flush
|
||||
DPC_SET_FLUSH = 0x0020, // Bit 5: Set flush
|
||||
DPC_CLR_TMEM_CTR = 0x0040, // Bit 6: Clear TMEM CTR
|
||||
DPC_CLR_PIPE_CTR = 0x0080, // Bit 7: Clear pipe CTR
|
||||
DPC_CLR_CMD_CTR = 0x0100, // Bit 8: Clear CMD CTR
|
||||
DPC_CLR_CLOCK_CTR = 0x0200, // Bit 9: Clear clock CTR
|
||||
|
||||
DPC_STATUS_XBUS_DMEM_DMA = 0x001, /* Bit 0: xbus_dmem_dma */
|
||||
DPC_STATUS_FREEZE = 0x002, /* Bit 1: freeze */
|
||||
DPC_STATUS_FLUSH = 0x004, /* Bit 2: flush */
|
||||
DPC_STATUS_START_GCLK = 0x008, /* Bit 3: start gclk */
|
||||
DPC_STATUS_TMEM_BUSY = 0x010, /* Bit 4: tmem busy */
|
||||
DPC_STATUS_PIPE_BUSY = 0x020, /* Bit 5: pipe busy */
|
||||
DPC_STATUS_CMD_BUSY = 0x040, /* Bit 6: cmd busy */
|
||||
DPC_STATUS_CBUF_READY = 0x080, /* Bit 7: cbuf ready */
|
||||
DPC_STATUS_DMA_BUSY = 0x100, /* Bit 8: dma busy */
|
||||
DPC_STATUS_END_VALID = 0x200, /* Bit 9: end valid */
|
||||
DPC_STATUS_START_VALID = 0x400, /* Bit 10: start valid */
|
||||
DPC_STATUS_XBUS_DMEM_DMA = 0x001, // Bit 0: xbus_dmem_dma
|
||||
DPC_STATUS_FREEZE = 0x002, // Bit 1: Freeze
|
||||
DPC_STATUS_FLUSH = 0x004, // Bit 2: Flush
|
||||
DPC_STATUS_START_GCLK = 0x008, // Bit 3: Start GCLK
|
||||
DPC_STATUS_TMEM_BUSY = 0x010, // Bit 4: TMEM busy
|
||||
DPC_STATUS_PIPE_BUSY = 0x020, // Bit 5: Pipe busy
|
||||
DPC_STATUS_CMD_BUSY = 0x040, // Bit 6: CMD busy
|
||||
DPC_STATUS_CBUF_READY = 0x080, // Bit 7: CBUF ready
|
||||
DPC_STATUS_DMA_BUSY = 0x100, // Bit 8: DMA busy
|
||||
DPC_STATUS_END_VALID = 0x200, // Bit 9: End valid
|
||||
DPC_STATUS_START_VALID = 0x400, // Bit 10: Start valid
|
||||
};
|
||||
|
||||
/*
|
||||
//Audio Interface registers;
|
||||
*/
|
||||
// Audio interface registers
|
||||
class AudioInterfaceReg
|
||||
{
|
||||
protected:
|
||||
|
@ -309,11 +307,11 @@ private:
|
|||
|
||||
enum
|
||||
{
|
||||
AI_STATUS_FIFO_FULL = 0x80000000, /* Bit 31: full */
|
||||
AI_STATUS_DMA_BUSY = 0x40000000, /* Bit 30: busy */
|
||||
AI_STATUS_FIFO_FULL = 0x80000000, // Bit 31: Full
|
||||
AI_STATUS_DMA_BUSY = 0x40000000, // Bit 30: Busy
|
||||
};
|
||||
|
||||
//Audio Interface registers;
|
||||
// Audio interface registers
|
||||
|
||||
class PeripheralInterfaceReg
|
||||
{
|
||||
|
@ -365,7 +363,7 @@ private:
|
|||
RDRAMInt_InterfaceReg& operator=(const RDRAMInt_InterfaceReg&);
|
||||
};
|
||||
|
||||
//Signal Processor Interface;
|
||||
// Signal processor interface
|
||||
class SigProcessor_InterfaceReg
|
||||
{
|
||||
protected:
|
||||
|
@ -389,53 +387,53 @@ private:
|
|||
SigProcessor_InterfaceReg& operator=(const SigProcessor_InterfaceReg&);
|
||||
};
|
||||
|
||||
//Signal Processor interface flags
|
||||
// Signal processor interface flags
|
||||
enum
|
||||
{
|
||||
SP_CLR_HALT = 0x00001, /* Bit 0: clear halt */
|
||||
SP_SET_HALT = 0x00002, /* Bit 1: set halt */
|
||||
SP_CLR_BROKE = 0x00004, /* Bit 2: clear broke */
|
||||
SP_CLR_INTR = 0x00008, /* Bit 3: clear intr */
|
||||
SP_SET_INTR = 0x00010, /* Bit 4: set intr */
|
||||
SP_CLR_SSTEP = 0x00020, /* Bit 5: clear sstep */
|
||||
SP_SET_SSTEP = 0x00040, /* Bit 6: set sstep */
|
||||
SP_CLR_INTR_BREAK = 0x00080, /* Bit 7: clear intr on break */
|
||||
SP_SET_INTR_BREAK = 0x00100, /* Bit 8: set intr on break */
|
||||
SP_CLR_SIG0 = 0x00200, /* Bit 9: clear signal 0 */
|
||||
SP_SET_SIG0 = 0x00400, /* Bit 10: set signal 0 */
|
||||
SP_CLR_SIG1 = 0x00800, /* Bit 11: clear signal 1 */
|
||||
SP_SET_SIG1 = 0x01000, /* Bit 12: set signal 1 */
|
||||
SP_CLR_SIG2 = 0x02000, /* Bit 13: clear signal 2 */
|
||||
SP_SET_SIG2 = 0x04000, /* Bit 14: set signal 2 */
|
||||
SP_CLR_SIG3 = 0x08000, /* Bit 15: clear signal 3 */
|
||||
SP_SET_SIG3 = 0x10000, /* Bit 16: set signal 3 */
|
||||
SP_CLR_SIG4 = 0x20000, /* Bit 17: clear signal 4 */
|
||||
SP_SET_SIG4 = 0x40000, /* Bit 18: set signal 4 */
|
||||
SP_CLR_SIG5 = 0x80000, /* Bit 19: clear signal 5 */
|
||||
SP_SET_SIG5 = 0x100000, /* Bit 20: set signal 5 */
|
||||
SP_CLR_SIG6 = 0x200000, /* Bit 21: clear signal 6 */
|
||||
SP_SET_SIG6 = 0x400000, /* Bit 22: set signal 6 */
|
||||
SP_CLR_SIG7 = 0x800000, /* Bit 23: clear signal 7 */
|
||||
SP_SET_SIG7 = 0x1000000, /* Bit 24: set signal 7 */
|
||||
SP_CLR_HALT = 0x00001, // Bit 0: Clear halt
|
||||
SP_SET_HALT = 0x00002, // Bit 1: Set halt
|
||||
SP_CLR_BROKE = 0x00004, // Bit 2: Clear broke
|
||||
SP_CLR_INTR = 0x00008, // Bit 3: Clear INTR
|
||||
SP_SET_INTR = 0x00010, // Bit 4: Set INTR
|
||||
SP_CLR_SSTEP = 0x00020, // Bit 5: Clear SSTEP
|
||||
SP_SET_SSTEP = 0x00040, // Bit 6: Set SSTEP
|
||||
SP_CLR_INTR_BREAK = 0x00080, // Bit 7: Clear INTR on break
|
||||
SP_SET_INTR_BREAK = 0x00100, // Bit 8: Set INTR on break
|
||||
SP_CLR_SIG0 = 0x00200, // Bit 9: Clear signal 0
|
||||
SP_SET_SIG0 = 0x00400, // Bit 10: Set signal 0
|
||||
SP_CLR_SIG1 = 0x00800, // Bit 11: Clear signal 1
|
||||
SP_SET_SIG1 = 0x01000, // Bit 12: Set signal 1
|
||||
SP_CLR_SIG2 = 0x02000, // Bit 13: Clear signal 2
|
||||
SP_SET_SIG2 = 0x04000, // Bit 14: Set signal 2
|
||||
SP_CLR_SIG3 = 0x08000, // Bit 15: Clear signal 3
|
||||
SP_SET_SIG3 = 0x10000, // Bit 16: Set signal 3
|
||||
SP_CLR_SIG4 = 0x20000, // Bit 17: Clear signal 4
|
||||
SP_SET_SIG4 = 0x40000, // Bit 18: Set signal 4
|
||||
SP_CLR_SIG5 = 0x80000, // Bit 19: Clear signal 5
|
||||
SP_SET_SIG5 = 0x100000, // Bit 20: Set signal 5
|
||||
SP_CLR_SIG6 = 0x200000, // Bit 21: Clear signal 6
|
||||
SP_SET_SIG6 = 0x400000, // Bit 22: Set signal 6
|
||||
SP_CLR_SIG7 = 0x800000, // Bit 23: Clear signal 7
|
||||
SP_SET_SIG7 = 0x1000000, // Bit 24: Set signal 7
|
||||
|
||||
SP_STATUS_HALT = 0x001, /* Bit 0: halt */
|
||||
SP_STATUS_BROKE = 0x002, /* Bit 1: broke */
|
||||
SP_STATUS_DMA_BUSY = 0x004, /* Bit 2: dma busy */
|
||||
SP_STATUS_DMA_FULL = 0x008, /* Bit 3: dma full */
|
||||
SP_STATUS_IO_FULL = 0x010, /* Bit 4: io full */
|
||||
SP_STATUS_SSTEP = 0x020, /* Bit 5: single step */
|
||||
SP_STATUS_INTR_BREAK = 0x040, /* Bit 6: interrupt on break */
|
||||
SP_STATUS_SIG0 = 0x080, /* Bit 7: signal 0 set */
|
||||
SP_STATUS_SIG1 = 0x100, /* Bit 8: signal 1 set */
|
||||
SP_STATUS_SIG2 = 0x200, /* Bit 9: signal 2 set */
|
||||
SP_STATUS_SIG3 = 0x400, /* Bit 10: signal 3 set */
|
||||
SP_STATUS_SIG4 = 0x800, /* Bit 11: signal 4 set */
|
||||
SP_STATUS_SIG5 = 0x1000, /* Bit 12: signal 5 set */
|
||||
SP_STATUS_SIG6 = 0x2000, /* Bit 13: signal 6 set */
|
||||
SP_STATUS_SIG7 = 0x4000, /* Bit 14: signal 7 set */
|
||||
SP_STATUS_HALT = 0x001, // Bit 0: Halt
|
||||
SP_STATUS_BROKE = 0x002, // Bit 1: Broke
|
||||
SP_STATUS_DMA_BUSY = 0x004, // Bit 2: DMA busy
|
||||
SP_STATUS_DMA_FULL = 0x008, // Bit 3: DMA full
|
||||
SP_STATUS_IO_FULL = 0x010, // Bit 4: IO full
|
||||
SP_STATUS_SSTEP = 0x020, // Bit 5: Single step
|
||||
SP_STATUS_INTR_BREAK = 0x040, // Bit 6: Interrupt on break
|
||||
SP_STATUS_SIG0 = 0x080, // Bit 7: Signal 0 set
|
||||
SP_STATUS_SIG1 = 0x100, // Bit 8: Signal 1 set
|
||||
SP_STATUS_SIG2 = 0x200, // Bit 9: Signal 2 set
|
||||
SP_STATUS_SIG3 = 0x400, // Bit 10: Signal 3 set
|
||||
SP_STATUS_SIG4 = 0x800, // Bit 11: Signal 4 set
|
||||
SP_STATUS_SIG5 = 0x1000, // Bit 12: Signal 5 set
|
||||
SP_STATUS_SIG6 = 0x2000, // Bit 13: Signal 6 set
|
||||
SP_STATUS_SIG7 = 0x4000, // Bit 14: Signal 7 set
|
||||
};
|
||||
|
||||
//Peripheral Interface flags
|
||||
// Peripheral interface flags
|
||||
enum
|
||||
{
|
||||
PI_STATUS_DMA_BUSY = 0x01,
|
||||
|
@ -463,7 +461,7 @@ private:
|
|||
Serial_InterfaceReg& operator=(const Serial_InterfaceReg&);
|
||||
};
|
||||
|
||||
//Serial Interface flags
|
||||
// Serial interface flags
|
||||
enum
|
||||
{
|
||||
SI_STATUS_DMA_BUSY = 0x0001,
|
||||
|
@ -472,7 +470,7 @@ enum
|
|||
SI_STATUS_INTERRUPT = 0x1000,
|
||||
};
|
||||
|
||||
//Disk Interface
|
||||
// Disk interface
|
||||
class Disk_InterfaceReg
|
||||
{
|
||||
protected:
|
||||
|
@ -508,7 +506,7 @@ private:
|
|||
Disk_InterfaceReg& operator=(const Disk_InterfaceReg&);
|
||||
};
|
||||
|
||||
//Disk Interface Flags
|
||||
// Disk interface flags
|
||||
enum
|
||||
{
|
||||
DD_STATUS_DATA_RQ = 0x40000000,
|
||||
|
@ -588,7 +586,7 @@ class CRegisters :
|
|||
public:
|
||||
CRegisters(CN64System * System, CSystemEvents * SystemEvents);
|
||||
|
||||
//General Registers
|
||||
// General registers
|
||||
uint32_t m_PROGRAM_COUNTER;
|
||||
MIPS_DWORD m_GPR[32];
|
||||
uint32_t m_CP0[33];
|
||||
|
@ -596,14 +594,14 @@ public:
|
|||
MIPS_DWORD m_LO;
|
||||
uint32_t m_LLBit;
|
||||
|
||||
//Floating point registers/information
|
||||
// Floating point registers/information
|
||||
uint32_t m_FPCR[32];
|
||||
int32_t m_RoundingModel;
|
||||
MIPS_DWORD m_FPR[32];
|
||||
float * m_FPR_S[32];
|
||||
double * m_FPR_D[32];
|
||||
|
||||
//Memory Mapped N64 registers
|
||||
// Memory-mapped N64 registers
|
||||
uint32_t m_RDRAM_Registers[10];
|
||||
uint32_t m_SigProcessor_Interface[10];
|
||||
uint32_t m_Display_ControlReg[10];
|
||||
|
|
|
@ -50,7 +50,7 @@ const char * SystemEventName(SystemEvent event)
|
|||
case SysEvent_ResetRecompilerCode: return "SysEvent_ResetRecompilerCode";
|
||||
}
|
||||
static char unknown[100];
|
||||
sprintf(unknown, "unknown(%d)", event);
|
||||
sprintf(unknown, "Unknown(%d)", event);
|
||||
return unknown;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ CSystemTimer::CSystemTimer(CRegisters &Reg, int32_t & NextTimer) :
|
|||
|
||||
void CSystemTimer::Reset()
|
||||
{
|
||||
//initialise Structure
|
||||
// Initialize structure
|
||||
for (int i = 0; i < MaxTimer; i++)
|
||||
{
|
||||
m_TimerDetatils[i].Active = false;
|
||||
|
@ -47,16 +47,16 @@ void CSystemTimer::SetTimer(TimerType Type, uint32_t Cycles, bool bRelative)
|
|||
{
|
||||
if (m_TimerDetatils[Type].Active)
|
||||
{
|
||||
m_TimerDetatils[Type].CyclesToTimer += Cycles; //Add to the timer
|
||||
m_TimerDetatils[Type].CyclesToTimer += Cycles; // Add to the timer
|
||||
}
|
||||
else
|
||||
{
|
||||
m_TimerDetatils[Type].CyclesToTimer = (int64_t)Cycles - (int64_t)m_NextTimer; //replace the new cycles
|
||||
m_TimerDetatils[Type].CyclesToTimer = (int64_t)Cycles - (int64_t)m_NextTimer; // Replace the new cycles
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_TimerDetatils[Type].CyclesToTimer = (int64_t)Cycles - (int64_t)m_NextTimer; //replace the new cycles
|
||||
m_TimerDetatils[Type].CyclesToTimer = (int64_t)Cycles - (int64_t)m_NextTimer; // Replace the new cycles
|
||||
}
|
||||
FixTimers();
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ void CSystemTimer::FixTimers()
|
|||
SetCompareTimer();
|
||||
}
|
||||
|
||||
//Update the cycles for the remaining number of cycles to timer
|
||||
// Update the cycles for the remaining number of cycles to timer
|
||||
int count;
|
||||
for (count = 0; count < MaxTimer; count++)
|
||||
{
|
||||
|
@ -120,10 +120,10 @@ void CSystemTimer::FixTimers()
|
|||
m_TimerDetatils[count].CyclesToTimer += m_NextTimer;
|
||||
}
|
||||
|
||||
//Set Max timer
|
||||
// Set max timer
|
||||
m_NextTimer = 0x7FFFFFFF;
|
||||
|
||||
//Find the smallest timer left to go
|
||||
// Find the smallest timer left to go
|
||||
for (count = 0; count < MaxTimer; count++)
|
||||
{
|
||||
if (!m_TimerDetatils[count].Active)
|
||||
|
@ -138,7 +138,7 @@ void CSystemTimer::FixTimers()
|
|||
m_Current = (TimerType)count;
|
||||
}
|
||||
|
||||
//Move the timer back this value
|
||||
// Move the timer back this value
|
||||
for (count = 0; count < MaxTimer; count++)
|
||||
{
|
||||
if (!m_TimerDetatils[count].Active)
|
||||
|
|
|
@ -85,8 +85,8 @@ void CTLB::Probe()
|
|||
|
||||
if (TlbValueMasked == EntryHiMasked)
|
||||
{
|
||||
if ((TlbEntryHiValue & 0x100) != 0 || //Global
|
||||
((TlbEntryHiValue & 0xFF) == (g_Reg->ENTRYHI_REGISTER & 0xFF))) //SameAsid
|
||||
if ((TlbEntryHiValue & 0x100) != 0 || // Global
|
||||
((TlbEntryHiValue & 0xFF) == (g_Reg->ENTRYHI_REGISTER & 0xFF))) // SameAsid
|
||||
{
|
||||
g_Reg->INDEX_REGISTER = Counter;
|
||||
int FastIndx = Counter << 1;
|
||||
|
@ -115,7 +115,7 @@ void CTLB::WriteEntry(int index, bool Random)
|
|||
|
||||
WriteTrace(TraceTLB, TraceDebug, "%02d %d %08X %08X %08X %08X ", index, Random, g_Reg->PAGE_MASK_REGISTER, g_Reg->ENTRYHI_REGISTER, g_Reg->ENTRYLO0_REGISTER, g_Reg->ENTRYLO1_REGISTER);
|
||||
|
||||
//Check to see if entry is unmapping it self
|
||||
// Check to see if entry is unmapping itself
|
||||
if (m_tlb[index].EntryDefined)
|
||||
{
|
||||
FastIndx = index << 1;
|
||||
|
@ -135,7 +135,7 @@ void CTLB::WriteEntry(int index, bool Random)
|
|||
}
|
||||
}
|
||||
|
||||
//Reset old addresses
|
||||
// Reset old addresses
|
||||
if (m_tlb[index].EntryDefined)
|
||||
{
|
||||
for (FastIndx = index << 1; FastIndx <= (index << 1) + 1; FastIndx++)
|
||||
|
@ -164,7 +164,7 @@ void CTLB::WriteEntry(int index, bool Random)
|
|||
}
|
||||
}
|
||||
|
||||
//fill in m_tlb entry
|
||||
// Fill in m_tlb entry
|
||||
m_tlb[index].PageMask.Value = g_Reg->PAGE_MASK_REGISTER;
|
||||
m_tlb[index].EntryHi.Value = g_Reg->ENTRYHI_REGISTER;
|
||||
m_tlb[index].EntryLo0.Value = g_Reg->ENTRYLO0_REGISTER;
|
||||
|
@ -176,7 +176,7 @@ void CTLB::WriteEntry(int index, bool Random)
|
|||
|
||||
void CTLB::SetupTLB_Entry(int index, bool Random)
|
||||
{
|
||||
//Fix up Fast TLB entries
|
||||
// Fix up fast TLB entries
|
||||
if (!m_tlb[index].EntryDefined)
|
||||
{
|
||||
return;
|
||||
|
@ -216,7 +216,7 @@ void CTLB::SetupTLB_Entry(int index, bool Random)
|
|||
m_FastTlb[FastIndx].Random = Random;
|
||||
m_FastTlb[FastIndx].Probed = false;
|
||||
|
||||
//Test both entries to see if they are valid
|
||||
// Test both entries to see if they are valid
|
||||
for (FastIndx = index << 1; FastIndx <= (index << 1) + 1; FastIndx++)
|
||||
{
|
||||
if (!m_FastTlb[FastIndx].VALID)
|
||||
|
@ -238,7 +238,7 @@ void CTLB::SetupTLB_Entry(int index, bool Random)
|
|||
continue;
|
||||
}
|
||||
|
||||
//MAP the new m_tlb entry for reading and writing
|
||||
// Map the new m_tlb entry for reading and writing
|
||||
m_FastTlb[FastIndx].ValidEntry = true;
|
||||
m_CB->TLB_Mapped(m_FastTlb[FastIndx].VSTART, m_FastTlb[FastIndx].Length, m_FastTlb[FastIndx].PHYSSTART, !m_FastTlb[FastIndx].DIRTY);
|
||||
}
|
||||
|
|
|
@ -88,12 +88,12 @@ public:
|
|||
|
||||
void Reset(bool InvalidateTLB);
|
||||
|
||||
//Used by opcodes of the same name to manipulate the tlb (reads the registers)
|
||||
// Used by opcodes of the same name to manipulate the TLB (reads the registers)
|
||||
void Probe();
|
||||
void ReadEntry();
|
||||
void WriteEntry(int32_t index, bool Random);
|
||||
|
||||
//See if a VAddr has an entry to translate to a PAddr
|
||||
// See if a VAddr has an entry to translate to a PAddr
|
||||
bool AddressDefined(uint32_t VAddr);
|
||||
|
||||
const TLB_ENTRY & TlbEntry(int32_t Entry) const
|
||||
|
@ -124,7 +124,7 @@ private:
|
|||
bool Probed;
|
||||
};
|
||||
|
||||
friend class CDebugTlb; // enable debug window to read class
|
||||
friend class CDebugTlb; // Enable debug window to read class
|
||||
|
||||
CTLB_CB * const m_CB;
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// Project64 - A Nintendo 64 emulator
|
||||
// http://www.pj64-emu.com/
|
||||
// https://www.pj64-emu.com/
|
||||
// Copyright(C) 2001-2021 Project64
|
||||
// Copyright(C) 2015 Bobby Smiles
|
||||
|
||||
// GNU/GPLv2 licensed: https://gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "GBCart.h"
|
||||
#include "Transferpak.h"
|
||||
|
@ -17,7 +17,7 @@ uint16_t gb_cart_address(unsigned int bank, uint16_t address)
|
|||
|
||||
void Transferpak::Init()
|
||||
{
|
||||
//Quick check to ensure we dont have a ROM already
|
||||
// Quick check to ensure we don't have a ROM already
|
||||
if (tpak.gb_cart.rom == nullptr)
|
||||
{
|
||||
memset(&tpak, 0, sizeof(tpak));
|
||||
|
@ -38,20 +38,20 @@ void Transferpak::ReadFrom(uint16_t address, uint8_t * data)
|
|||
{
|
||||
if ((address >= 0x8000) && (address <= 0x8FFF))
|
||||
{
|
||||
//Ensure we actually have a ROM loaded in first.
|
||||
// Ensure we actually have a ROM loaded in first
|
||||
if (tpak.gb_cart.rom == nullptr)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
//Get whether the GB cart is enabled or disabled
|
||||
// Get whether the Game Boy cart is enabled or disabled
|
||||
uint8_t value = (tpak.enabled) ? 0x84 : 0x00;
|
||||
|
||||
memset(data, value, 0x20);
|
||||
}
|
||||
else if ((address >= 0xB000) && (address <= 0xBFFF))
|
||||
{
|
||||
// Get the GB Cart access mode
|
||||
// Get the Game Boy cart access mode
|
||||
if (tpak.enabled)
|
||||
{
|
||||
memset(data, tpak.access_mode, 0x20);
|
||||
|
@ -65,7 +65,7 @@ void Transferpak::ReadFrom(uint16_t address, uint8_t * data)
|
|||
}
|
||||
else if (address >= 0xC000)
|
||||
{
|
||||
// Read the GB Cart
|
||||
// Read the Game Boy cart
|
||||
if (tpak.enabled)
|
||||
{
|
||||
GBCart::read_gb_cart(&tpak.gb_cart, gb_cart_address(tpak.bank, address), data);
|
||||
|
@ -79,13 +79,13 @@ void Transferpak::WriteTo(uint16_t address, uint8_t * data)
|
|||
|
||||
if ((address >= 0x8000) && (address <= 0x8FFF))
|
||||
{
|
||||
//Ensure we actually have a ROM loaded in first.
|
||||
// Ensure we actually have a ROM loaded in first
|
||||
if (tpak.gb_cart.rom == nullptr)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
//Set whether the gb cart is enabled or disabled.
|
||||
// Set whether the Game Boy cart is enabled or disabled
|
||||
switch (*data)
|
||||
{
|
||||
case 0xFE:
|
||||
|
@ -95,13 +95,13 @@ void Transferpak::WriteTo(uint16_t address, uint8_t * data)
|
|||
tpak.enabled = true;
|
||||
break;
|
||||
default:
|
||||
//Do nothing
|
||||
// Do nothing
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ((address >= 0xA000) && (address <= 0xAFFF))
|
||||
{
|
||||
//Set the bank for the GB Cart
|
||||
// Set the bank for the Game Boy cart
|
||||
if (tpak.enabled)
|
||||
{
|
||||
tpak.bank = *data;
|
||||
|
@ -109,7 +109,7 @@ void Transferpak::WriteTo(uint16_t address, uint8_t * data)
|
|||
}
|
||||
else if ((address >= 0xB000) && (address <= 0xBFFF))
|
||||
{
|
||||
// Get the GB Cart access mode
|
||||
// Get the Game Boy cart access mode
|
||||
if (tpak.enabled)
|
||||
{
|
||||
tpak.access_mode_changed = 0x04;
|
||||
|
@ -118,13 +118,13 @@ void Transferpak::WriteTo(uint16_t address, uint8_t * data)
|
|||
|
||||
if ((*data & 0xFE) != 0)
|
||||
{
|
||||
//Unkown tpak write
|
||||
// Unknown Transfer Pak write
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (address >= 0xC000)
|
||||
{
|
||||
// Write to the GB Cart
|
||||
// Write to the Game Boy cart
|
||||
if (tpak.enabled)
|
||||
{
|
||||
GBCart::write_gb_cart(&tpak.gb_cart, gb_cart_address(tpak.bank, address), data);
|
||||
|
|
|
@ -31,16 +31,16 @@ bool CN64Disk::LoadDiskImage(const char * FileLoc)
|
|||
UnallocateDiskImage();
|
||||
m_ErrorMsg = EMPTY_STRING;
|
||||
|
||||
//Assume the file extension is *.ndd or *.d64
|
||||
// Assume the file extension is *.ndd or *.d64
|
||||
stdstr ext = CPath(FileLoc).GetExtension();
|
||||
stdstr ShadowFile = FileLoc;
|
||||
ShadowFile[ShadowFile.length() - 1] = 'r';
|
||||
|
||||
WriteTrace(TraceN64System, TraceDebug, "Attempt to load shadow file.");
|
||||
WriteTrace(TraceN64System, TraceDebug, "Attempting to load shadow file");
|
||||
if (!AllocateAndLoadDiskImage(ShadowFile.c_str()))
|
||||
{
|
||||
m_isShadowDisk = false;
|
||||
WriteTrace(TraceN64System, TraceDebug, "Loading Shadow file failed");
|
||||
WriteTrace(TraceN64System, TraceDebug, "Loading shadow file failed");
|
||||
UnallocateDiskImage();
|
||||
if (!AllocateAndLoadDiskImage(FileLoc))
|
||||
{
|
||||
|
@ -57,10 +57,10 @@ bool CN64Disk::LoadDiskImage(const char * FileLoc)
|
|||
uint32_t crc1 = CalculateCrc();
|
||||
uint32_t crc2 = ~crc1;
|
||||
m_DiskIdent.Format("%08X-%08X-C:%X", crc1, crc2, GetDiskAddressID()[0]);
|
||||
//Get the disk ID from the disk image
|
||||
// Get the disk ID from the disk image
|
||||
if (*(uint32_t *)(&GetDiskAddressID()[0]) != 0)
|
||||
{
|
||||
//if not 0x00000000
|
||||
// If not 0x00000000
|
||||
RomName[0] = (char)*(GetDiskAddressID() + 3);
|
||||
RomName[1] = (char)*(GetDiskAddressID() + 2);
|
||||
RomName[2] = (char)*(GetDiskAddressID() + 1);
|
||||
|
@ -69,7 +69,7 @@ bool CN64Disk::LoadDiskImage(const char * FileLoc)
|
|||
}
|
||||
else
|
||||
{
|
||||
//if 0x00000000 then use a made up one
|
||||
// If 0x00000000 then use a made up one
|
||||
RomName[0] = m_DiskIdent[12];
|
||||
RomName[1] = m_DiskIdent[11];
|
||||
RomName[2] = m_DiskIdent[10];
|
||||
|
@ -102,26 +102,26 @@ bool CN64Disk::SaveDiskImage()
|
|||
{
|
||||
DeinitSysDataD64();
|
||||
|
||||
//NO NEED TO SAVE IF DISK TYPE IS 6
|
||||
// No need to save if disk type is 6
|
||||
if (m_DiskType == 6)
|
||||
{
|
||||
m_DiskFile.Close();
|
||||
WriteTrace(TraceN64System, TraceDebug, "Loaded Disk Type is 6. No RAM area. Shadow file is not needed.");
|
||||
WriteTrace(TraceN64System, TraceDebug, "Loaded disk type is 6. No RAM area. Shadow file is not needed.");
|
||||
return true;
|
||||
}
|
||||
|
||||
//Assume the file extension is *.ndd / *.d64
|
||||
// Assume the file extension is *.ndd / *.d64
|
||||
if (m_DiskFormat == DiskFormatMAME || m_isShadowDisk || g_Settings->LoadDword(Setting_DiskSaveType) == SaveDisk_ShadowFile)
|
||||
{
|
||||
//Shadow File
|
||||
// Shadow file
|
||||
stdstr ShadowFile = m_FileName;
|
||||
ShadowFile[ShadowFile.length() - 1] = 'r';
|
||||
|
||||
WriteTrace(TraceN64System, TraceDebug, "Trying to open %s (Shadow File)", ShadowFile.c_str());
|
||||
WriteTrace(TraceN64System, TraceDebug, "Trying to open %s (shadow file)", ShadowFile.c_str());
|
||||
m_DiskFile.Close();
|
||||
if (!m_DiskFile.Open(ShadowFile.c_str(), CFileBase::modeWrite | CFileBase::modeCreate | CFileBase::modeNoTruncate))
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceError, "Failed to open %s (Shadow File)", ShadowFile.c_str());
|
||||
WriteTrace(TraceN64System, TraceError, "Failed to open %s (shadow file)", ShadowFile.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ bool CN64Disk::SaveDiskImage()
|
|||
}
|
||||
else
|
||||
{
|
||||
//RAM File
|
||||
// RAM file
|
||||
if (m_DiskFileSize <= m_DiskRamAddress || m_DiskRamAddress == 0)
|
||||
{
|
||||
m_DiskFile.Close();
|
||||
|
@ -149,11 +149,11 @@ bool CN64Disk::SaveDiskImage()
|
|||
ShadowFile[ShadowFile.length() - 2] = 'a';
|
||||
ShadowFile[ShadowFile.length() - 3] = 'r';
|
||||
|
||||
WriteTrace(TraceN64System, TraceDebug, "Trying to open %s (RAM File)", ShadowFile.c_str());
|
||||
WriteTrace(TraceN64System, TraceDebug, "Trying to open %s (RAM file)", ShadowFile.c_str());
|
||||
m_DiskFile.Close();
|
||||
if (!m_DiskFile.Open(ShadowFile.c_str(), CFileBase::modeWrite | CFileBase::modeCreate | CFileBase::modeNoTruncate))
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceError, "Failed to open %s (RAM File)", ShadowFile.c_str());
|
||||
WriteTrace(TraceN64System, TraceError, "Failed to open %s (RAM file)", ShadowFile.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -180,27 +180,27 @@ void CN64Disk::SwapDiskImage(const char * FileLoc)
|
|||
|
||||
bool CN64Disk::IsValidDiskImage(uint8_t Test[0x20])
|
||||
{
|
||||
//Basic System Data Check (first 0x20 bytes is enough)
|
||||
//Disk Type
|
||||
// Basic system data check (first 0x20 bytes is enough)
|
||||
// Disk type
|
||||
if ((Test[0x05] & 0xEF) > 6) return false;
|
||||
|
||||
//IPL Load Block
|
||||
// IPL load block
|
||||
uint16_t ipl_load_blk = ((Test[0x06] << 8) | Test[0x07]);
|
||||
if (ipl_load_blk > 0x10C3 || ipl_load_blk == 0x0000) return false;
|
||||
|
||||
//IPL Load Address
|
||||
// IPL load address
|
||||
uint32_t ipl_load_addr = (Test[0x1C] << 24) | (Test[0x1D] << 16) | (Test[0x1E] << 8) | Test[0x1F];
|
||||
if (ipl_load_addr < 0x80000000 && ipl_load_addr >= 0x80800000) return false;
|
||||
|
||||
//Country Code
|
||||
// Country code
|
||||
if (*((uint32_t *)&Test[0]) == 0x16D348E8) { return true; }
|
||||
else if (*((uint32_t *)&Test[0]) == 0x56EE6322) { return true; }
|
||||
else if (*((uint32_t *)&Test[0]) == 0x00000000) { return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
//Save the settings of the loaded rom, so all loaded settings about rom will be identified with
|
||||
//this rom
|
||||
// Save the settings of the loaded ROM, so all loaded settings about ROM will be identified with this ROM
|
||||
|
||||
void CN64Disk::SaveDiskSettingID(bool temp)
|
||||
{
|
||||
g_Settings->SaveBool(Game_TempLoaded, temp);
|
||||
|
@ -242,10 +242,10 @@ bool CN64Disk::AllocateDiskImage(uint32_t DiskFileSize)
|
|||
WriteTrace(TraceN64System, TraceError, "Failed to allocate memory for disk (size: 0x%X)", DiskFileSize);
|
||||
return false;
|
||||
}
|
||||
uint8_t * Image = (uint8_t *)(((uint64_t)ImageBase.get() + 0xFFF) & ~0xFFF); // start at begining of memory page
|
||||
uint8_t * Image = (uint8_t *)(((uint64_t)ImageBase.get() + 0xFFF) & ~0xFFF); // Start at beginning of memory page
|
||||
WriteTrace(TraceN64System, TraceDebug, "Allocated disk memory (%p)", Image);
|
||||
|
||||
//save information about the disk loaded
|
||||
// Save information about the disk loaded
|
||||
m_DiskImageBase = ImageBase.release();
|
||||
m_DiskImage = Image;
|
||||
m_DiskFileSize = DiskFileSize;
|
||||
|
@ -262,10 +262,10 @@ bool CN64Disk::AllocateDiskHeader()
|
|||
WriteTrace(TraceN64System, TraceError, "Failed to allocate memory for disk header forge (size: 0x40)");
|
||||
return false;
|
||||
}
|
||||
uint8_t * Header = (uint8_t *)(((uint64_t)HeaderBase.get() + 0xFFF) & ~0xFFF); // start at begining of memory page
|
||||
uint8_t * Header = (uint8_t *)(((uint64_t)HeaderBase.get() + 0xFFF) & ~0xFFF); // Start at beginning of memory page
|
||||
WriteTrace(TraceN64System, TraceDebug, "Allocated disk memory (%p)", Header);
|
||||
|
||||
//save information about the disk loaded
|
||||
// Save information about the disk loaded
|
||||
m_DiskHeaderBase = HeaderBase.release();
|
||||
m_DiskHeader = Header;
|
||||
return true;
|
||||
|
@ -280,7 +280,7 @@ bool CN64Disk::AllocateAndLoadDiskImage(const char * FileLoc)
|
|||
return false;
|
||||
}
|
||||
|
||||
//Make sure it is a valid disk image
|
||||
// Make sure it is a valid disk image
|
||||
uint8_t Test[0x100];
|
||||
bool isValidDisk = false;
|
||||
|
||||
|
@ -302,27 +302,27 @@ bool CN64Disk::AllocateAndLoadDiskImage(const char * FileLoc)
|
|||
if (!isValidDisk)
|
||||
{
|
||||
m_DiskFile.Close();
|
||||
WriteTrace(TraceN64System, TraceError, "invalid disk image file");
|
||||
WriteTrace(TraceN64System, TraceError, "Invalid disk image file");
|
||||
return false;
|
||||
}
|
||||
uint32_t DiskFileSize = m_DiskFile.GetLength();
|
||||
stdstr ext = CPath(FileLoc).GetExtension();
|
||||
WriteTrace(TraceN64System, TraceDebug, "Successfully Opened, size: 0x%X", DiskFileSize);
|
||||
WriteTrace(TraceN64System, TraceDebug, "Successfully opened, size: 0x%X", DiskFileSize);
|
||||
|
||||
//Check Disk File Format
|
||||
// Check disk file format
|
||||
if (((DiskFileSize == MameFormatSize) || (DiskFileSize == SDKFormatSize)) && (ext.compare("ndr") || ext.compare("ndd")))
|
||||
{
|
||||
if (DiskFileSize == MameFormatSize)
|
||||
{
|
||||
//If Disk is MAME Format (size is constant, it should be the same for every file), then continue
|
||||
// If disk is MAME Format (size is constant, it should be the same for every file), then continue
|
||||
m_DiskFormat = DiskFormatMAME;
|
||||
WriteTrace(TraceN64System, TraceDebug, "Disk File is MAME Format");
|
||||
WriteTrace(TraceN64System, TraceDebug, "Disk file is MAME format");
|
||||
}
|
||||
else
|
||||
{
|
||||
//If Disk is SDK format (made with SDK based dumpers like LuigiBlood's, or Nintendo's, size is also constant)
|
||||
// If disk is SDK format (made with SDK-based dumpers like LuigiBlood's, or Nintendo's, size is also constant)
|
||||
m_DiskFormat = DiskFormatSDK;
|
||||
WriteTrace(TraceN64System, TraceDebug, "Disk File is SDK Format");
|
||||
WriteTrace(TraceN64System, TraceDebug, "Disk file is SDK format");
|
||||
}
|
||||
|
||||
if (!AllocateDiskImage(DiskFileSize))
|
||||
|
@ -331,7 +331,7 @@ bool CN64Disk::AllocateAndLoadDiskImage(const char * FileLoc)
|
|||
return false;
|
||||
}
|
||||
|
||||
//Load the n64 disk to the allocated memory
|
||||
// Load the N64 disk to the allocated memory
|
||||
g_Notify->DisplayMessage(5, MSG_LOADING);
|
||||
m_DiskFile.SeekToBegin();
|
||||
|
||||
|
@ -350,7 +350,7 @@ bool CN64Disk::AllocateAndLoadDiskImage(const char * FileLoc)
|
|||
}
|
||||
TotalRead += dwToRead;
|
||||
|
||||
//Show Message of how much % wise of the rom has been loaded
|
||||
// Show message of how much of the ROM has been loaded (as a percentage)
|
||||
g_Notify->DisplayMessage(0, stdstr_f("%s: %.2f%c", GS(MSG_LOADED), ((float)TotalRead / (float)DiskFileSize) * 100.0f, '%').c_str());
|
||||
}
|
||||
|
||||
|
@ -370,7 +370,7 @@ bool CN64Disk::AllocateAndLoadDiskImage(const char * FileLoc)
|
|||
else if ((DiskFileSize > 0x4F08) && (ext.compare("d6r") || ext.compare("d64")))
|
||||
{
|
||||
m_DiskFormat = DiskFormatD64;
|
||||
WriteTrace(TraceN64System, TraceDebug, "Disk File is D64 Format");
|
||||
WriteTrace(TraceN64System, TraceDebug, "Disk file is D64 format");
|
||||
|
||||
m_DiskType = Test[5];
|
||||
uint16_t ROM_LBA_END = (Test[0xE0] << 8) | Test[0xE1];
|
||||
|
@ -396,11 +396,11 @@ bool CN64Disk::AllocateAndLoadDiskImage(const char * FileLoc)
|
|||
{
|
||||
m_DiskFile.Close();
|
||||
SetError(MSG_FAIL_IMAGE);
|
||||
WriteTrace(TraceN64System, TraceError, "Malformed D64 disk image, expected filesize of 0x200 + 0x%X + 0x%X = %08X, actual filesize: %08X", ROM_SIZE, RAM_SIZE, (0x200 + ROM_SIZE + RAM_SIZE), DiskFileSize);
|
||||
WriteTrace(TraceN64System, TraceError, "Malformed D64 disk image, expected file size of 0x200 + 0x%X + 0x%X = %08X, actual file size: %08X", ROM_SIZE, RAM_SIZE, (0x200 + ROM_SIZE + RAM_SIZE), DiskFileSize);
|
||||
return false;
|
||||
}
|
||||
|
||||
//Allocate File with Max RAM Area size
|
||||
// Allocate file with maximum size RAM area
|
||||
WriteTrace(TraceN64System, TraceError, "Allocate D64 ROM %08X + RAM %08X", ROM_SIZE, FULL_RAM_SIZE);
|
||||
if (!AllocateDiskImage(0x200 + ROM_SIZE + FULL_RAM_SIZE))
|
||||
{
|
||||
|
@ -408,7 +408,7 @@ bool CN64Disk::AllocateAndLoadDiskImage(const char * FileLoc)
|
|||
return false;
|
||||
}
|
||||
|
||||
//Load the n64 disk to the allocated memory
|
||||
// Load the N64 disk to the allocated memory
|
||||
g_Notify->DisplayMessage(5, MSG_LOADING);
|
||||
m_DiskFile.SeekToBegin();
|
||||
|
||||
|
@ -427,7 +427,7 @@ bool CN64Disk::AllocateAndLoadDiskImage(const char * FileLoc)
|
|||
}
|
||||
TotalRead += dwToRead;
|
||||
|
||||
//Show Message of how much % wise of the rom has been loaded
|
||||
// Show message of how much of the ROM has been loaded (as a percentage)
|
||||
g_Notify->DisplayMessage(0, stdstr_f("%s: %.2f%c", GS(MSG_LOADED), ((float)TotalRead / (float)DiskFileSize) * 100.0f, '%').c_str());
|
||||
}
|
||||
|
||||
|
@ -446,9 +446,9 @@ bool CN64Disk::AllocateAndLoadDiskImage(const char * FileLoc)
|
|||
}
|
||||
else
|
||||
{
|
||||
//Else the disk file is invalid
|
||||
// Otherwise the disk file is invalid
|
||||
m_DiskFile.Close();
|
||||
WriteTrace(TraceN64System, TraceError, "Disk File is invalid, unexpected size");
|
||||
WriteTrace(TraceN64System, TraceError, "Disk file is invalid, unexpected size");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -571,7 +571,7 @@ void CN64Disk::UnallocateDiskImage()
|
|||
|
||||
uint32_t CN64Disk::CalculateCrc()
|
||||
{
|
||||
//Custom CRC
|
||||
// Custom CRC
|
||||
int crc = 0;
|
||||
for (int i = 0; i < 0x200; i += 4)
|
||||
{
|
||||
|
@ -585,7 +585,7 @@ uint32_t CN64Disk::GetDiskAddressBlock(uint16_t head, uint16_t track, uint16_t b
|
|||
uint32_t offset = 0;
|
||||
if (m_DiskFormat == DiskFormatMAME)
|
||||
{
|
||||
//MAME
|
||||
// MAME
|
||||
uint32_t tr_off = 0;
|
||||
uint16_t dd_zone = 0;
|
||||
|
||||
|
@ -650,7 +650,7 @@ uint32_t CN64Disk::GetDiskAddressBlock(uint16_t head, uint16_t track, uint16_t b
|
|||
}
|
||||
else if (m_DiskFormat == DiskFormatSDK)
|
||||
{
|
||||
//SDK
|
||||
// SDK
|
||||
offset = LBAToByte(0, PhysToLBA(head, track, block)) + sector * sectorsize;
|
||||
|
||||
if (offset < (BLOCKSIZE(0) * SYSTEM_LBAS) && sector == 0)
|
||||
|
@ -671,7 +671,7 @@ uint32_t CN64Disk::GetDiskAddressBlock(uint16_t head, uint16_t track, uint16_t b
|
|||
}
|
||||
else
|
||||
{
|
||||
//D64
|
||||
// D64
|
||||
uint16_t ROM_LBA_END = *(uint16_t*)(&GetDiskAddressSys()[0xE2]);
|
||||
uint16_t RAM_LBA_START = *(uint16_t*)(&GetDiskAddressSys()[0xE0]);
|
||||
uint16_t RAM_LBA_END = *(uint16_t*)(&GetDiskAddressSys()[0xE6]);
|
||||
|
@ -714,14 +714,14 @@ void CN64Disk::DetectSystemArea()
|
|||
{
|
||||
if ((m_DiskFormat == DiskFormatMAME) || (m_DiskFormat == DiskFormatSDK))
|
||||
{
|
||||
//MAME / SDK (System Area can be handled identically)
|
||||
// MAME / SDK (system area can be handled identically)
|
||||
m_DiskSysAddress = 0;
|
||||
m_DiskIDAddress = DISKID_LBA * 0x4D08;
|
||||
m_DiskRomAddress = SYSTEM_LBAS * 0x4D08;
|
||||
|
||||
//Handle System Data
|
||||
// Handle system data
|
||||
const uint16_t sysblocks[4] = { 9, 8, 1, 0 };
|
||||
//Check if Disk is development disk
|
||||
// Check if disk is development disk
|
||||
bool isDevDisk = false;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
|
@ -744,10 +744,10 @@ void CN64Disk::DetectSystemArea()
|
|||
}
|
||||
}
|
||||
|
||||
//Handle Disk ID
|
||||
// Handle disk ID
|
||||
for (int i = 2; i > 0; i--)
|
||||
{
|
||||
//There are two Disk ID Blocks
|
||||
// There are two disk ID blocks
|
||||
if (IsSysSectorGood(DISKID_LBA + i, 0xE8))
|
||||
{
|
||||
m_DiskIDAddress = ((DISKID_LBA + i) * 0x4D08);
|
||||
|
@ -756,7 +756,7 @@ void CN64Disk::DetectSystemArea()
|
|||
}
|
||||
else //if (m_DiskFormat == DiskFormatD64)
|
||||
{
|
||||
//D64 (uses fixed addresses)
|
||||
// D64 (uses fixed addresses)
|
||||
m_DiskSysAddress = 0x000;
|
||||
m_DiskIDAddress = 0x100;
|
||||
m_DiskRomAddress = 0x200;
|
||||
|
@ -765,7 +765,7 @@ void CN64Disk::DetectSystemArea()
|
|||
|
||||
bool CN64Disk::IsSysSectorGood(uint32_t block, uint32_t sectorsize)
|
||||
{
|
||||
//Checks if all sectors are identical (meant only to be used for System Area for MAME and SDK formats)
|
||||
// Checks if all sectors are identical (meant only to be used for system area for MAME and SDK formats)
|
||||
for (int j = 1; j < SECTORS_PER_BLOCK; j++)
|
||||
{
|
||||
for (uint32_t k = 0; k < sectorsize; k++)
|
||||
|
@ -779,25 +779,25 @@ bool CN64Disk::IsSysSectorGood(uint32_t block, uint32_t sectorsize)
|
|||
|
||||
if (block < DISKID_LBA)
|
||||
{
|
||||
//Check System Data
|
||||
// Check system data
|
||||
|
||||
//System Format
|
||||
// System format
|
||||
if (m_DiskImage[(block * 0x4D08) + 4] != 0x10)
|
||||
return false;
|
||||
|
||||
//Disk Format
|
||||
// Disk format
|
||||
if ((m_DiskImage[(block * 0x4D08) + 5] & 0xF0) != 0x10)
|
||||
return false;
|
||||
|
||||
//Always 0xFFFFFFFF
|
||||
// Always 0xFFFFFFFF
|
||||
if (*(uint32_t*)&m_DiskImage[(block * 0x4D08) + 0x18] != 0xFFFFFFFF)
|
||||
return false;
|
||||
|
||||
uint8_t alt = 0xC; //Retail
|
||||
uint8_t alt = 0xC; // Retail
|
||||
if ((block & 2) != 0)
|
||||
alt = 0xA; //Development
|
||||
alt = 0xA; // Development
|
||||
|
||||
//Alternate Tracks Offsets (always the same)
|
||||
// Alternate tracks offsets (always the same)
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
if (m_DiskImage[(block * 0x4D08) + 8 + i] != ((i + 1) * alt))
|
||||
|
@ -824,14 +824,14 @@ Country CN64Disk::GetDiskCountryCode()
|
|||
|
||||
void CN64Disk::InitSysDataD64()
|
||||
{
|
||||
//Else the disk will not work properly.
|
||||
// Otherwise the disk will not work properly
|
||||
if (m_DiskFormat != DiskFormatD64)
|
||||
return;
|
||||
|
||||
GetDiskAddressSys()[4 ^ 3] = 0x10;
|
||||
GetDiskAddressSys()[5 ^ 3] |= 0x10;
|
||||
|
||||
//Expand RAM Area for file format consistency
|
||||
// Expand RAM area for file format consistency
|
||||
if (m_DiskType < 6)
|
||||
{
|
||||
*(uint16_t*)&GetDiskAddressSys()[0xE2 ^ 2] = RAM_START_LBA[m_DiskType] - SYSTEM_LBAS;
|
||||
|
@ -846,7 +846,7 @@ void CN64Disk::InitSysDataD64()
|
|||
|
||||
void CN64Disk::DeinitSysDataD64()
|
||||
{
|
||||
//Restore the data
|
||||
// Restore the data
|
||||
if (m_DiskFormat != DiskFormatD64)
|
||||
return;
|
||||
|
||||
|
@ -866,7 +866,7 @@ void CN64Disk::DetectRamAddress()
|
|||
{
|
||||
if (m_DiskFormat == DiskFormatMAME)
|
||||
{
|
||||
//Not supported
|
||||
// Not supported
|
||||
m_DiskRamAddress = 0;
|
||||
}
|
||||
else if (m_DiskFormat == DiskFormatSDK)
|
||||
|
@ -927,50 +927,50 @@ uint16_t CN64Disk::LBAToPhys(uint32_t lba)
|
|||
{
|
||||
uint8_t * sys_data = GetDiskAddressSys();
|
||||
|
||||
//Get Block 0/1 on Disk Track
|
||||
// Get block 0/1 on disk track
|
||||
uint8_t block = 1;
|
||||
if (((lba & 3) == 0) || ((lba & 3) == 3))
|
||||
block = 0;
|
||||
|
||||
//Get Virtual & Physical Disk Zones
|
||||
// Get virtual and physical disk zones
|
||||
uint16_t vzone = (uint16_t)LBAToVZone(lba);
|
||||
uint16_t pzone = VZoneToPZone(vzone, m_DiskType);
|
||||
|
||||
//Get Disk Head
|
||||
// Get disk head
|
||||
uint16_t head = (7 < pzone);
|
||||
|
||||
//Get Disk Zone
|
||||
// Get disk zone
|
||||
uint16_t disk_zone = pzone;
|
||||
if (disk_zone != 0)
|
||||
disk_zone = pzone - 7;
|
||||
|
||||
//Get Virtual Zone LBA start, if Zone 0, it's LBA 0
|
||||
// Get virtual zone LBA start, if zone 0, it's LBA 0
|
||||
uint16_t vzone_lba = 0;
|
||||
if (vzone != 0)
|
||||
vzone_lba = VZONE_LBA_TBL[m_DiskType][vzone - 1];
|
||||
|
||||
//Calculate Physical Track
|
||||
// Calculate physical track
|
||||
uint16_t track = (uint16_t)((lba - vzone_lba) >> 1);
|
||||
|
||||
//Get the start track from current zone
|
||||
// Get the start track from current zone
|
||||
uint16_t track_zone_start = SCYL_ZONE_TBL[0][pzone];
|
||||
if (head != 0)
|
||||
{
|
||||
//If Head 1, count from the other way around
|
||||
// If head 1, count from the other way around
|
||||
track = -track;
|
||||
track_zone_start = OUTERCYL_TBL[disk_zone - 1];
|
||||
}
|
||||
track += SCYL_ZONE_TBL[0][pzone];
|
||||
|
||||
//Get the relative offset to defect tracks for the current zone (if Zone 0, then it's 0)
|
||||
// Get the relative offset to defect tracks for the current zone (if zone 0, then it's 0)
|
||||
uint16_t defect_offset = 0;
|
||||
if (pzone != 0)
|
||||
defect_offset = sys_data[(8 + pzone - 1) ^ 3];
|
||||
|
||||
//Get amount of defect tracks for the current zone
|
||||
// Get amount of defect tracks for the current zone
|
||||
uint16_t defect_amount = sys_data[(8 + pzone) ^ 3] - defect_offset;
|
||||
|
||||
//Skip defect tracks
|
||||
// Skip defect tracks
|
||||
while ((defect_amount != 0) && ((sys_data[(0x20 + defect_offset) ^ 3] + track_zone_start) <= track))
|
||||
{
|
||||
track++;
|
||||
|
|
|
@ -54,11 +54,11 @@ private:
|
|||
uint16_t LBAToPhys(uint32_t lba);
|
||||
uint16_t PhysToLBA(uint16_t head, uint16_t track, uint16_t block);
|
||||
|
||||
//constant values
|
||||
// Constant values
|
||||
enum { ReadFromRomSection = 0x400000, MameFormatSize = 0x0435B0C0, SDKFormatSize = 0x03DEC800,
|
||||
DiskFormatMAME = 0x0, DiskFormatSDK = 0x1, DiskFormatD64 = 0x2 };
|
||||
|
||||
//class variables
|
||||
// Class variables
|
||||
CFile m_DiskFile;
|
||||
uint8_t * m_DiskImage;
|
||||
uint8_t * m_DiskImageBase;
|
||||
|
@ -73,11 +73,11 @@ private:
|
|||
LanguageStringID m_ErrorMsg;
|
||||
Country m_Country;
|
||||
stdstr m_RomName, m_FileName, m_DiskIdent;
|
||||
uint8_t m_DiskFormat; //0 = MAME, 1 = SDK, 2 = D64
|
||||
uint8_t m_DiskFormat; // 0 = MAME, 1 = SDK, 2 = D64
|
||||
uint8_t m_DiskType;
|
||||
bool m_isShadowDisk;
|
||||
|
||||
//Disk Defines
|
||||
// Disk defines
|
||||
#define MAX_LBA 0x10DB
|
||||
#define SIZE_LBA MAX_LBA+1
|
||||
#define SYSTEM_LBAS 24
|
||||
|
@ -134,11 +134,11 @@ private:
|
|||
|
||||
#define VZoneToPZone(x, y) VZONE_PZONE_TBL[y][x]
|
||||
|
||||
//Used for MAME format
|
||||
// Used for MAME format
|
||||
const uint32_t MAMEStartOffset[16] =
|
||||
{ 0x0, 0x5F15E0, 0xB79D00, 0x10801A0, 0x1523720, 0x1963D80, 0x1D414C0, 0x20BBCE0,
|
||||
0x23196E0, 0x28A1E00, 0x2DF5DC0, 0x3299340, 0x36D99A0, 0x3AB70E0, 0x3E31900, 0x4149200 };
|
||||
|
||||
//Used for SDK and D64 format
|
||||
// Used for SDK and D64 format
|
||||
uint16_t LBAToPhysTable[SIZE_LBA];
|
||||
};
|
|
@ -29,18 +29,18 @@ CN64Rom::~CN64Rom()
|
|||
|
||||
bool CN64Rom::AllocateRomImage(uint32_t RomFileSize)
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceDebug, "Allocating memory for rom");
|
||||
WriteTrace(TraceN64System, TraceDebug, "Allocating memory for ROM");
|
||||
std::unique_ptr<uint8_t> ImageBase(new uint8_t[RomFileSize + 0x2000]);
|
||||
if (ImageBase.get() == nullptr)
|
||||
{
|
||||
SetError(MSG_MEM_ALLOC_ERROR);
|
||||
WriteTrace(TraceN64System, TraceError, "Failed to allocate memory for rom (size: 0x%X)", RomFileSize);
|
||||
WriteTrace(TraceN64System, TraceError, "Failed to allocate memory for ROM (size: 0x%X)", RomFileSize);
|
||||
return false;
|
||||
}
|
||||
uint8_t * Image = (uint8_t *)(((uint64_t)ImageBase.get() + 0xFFF) & ~0xFFF); // start at begining of memory page
|
||||
WriteTrace(TraceN64System, TraceDebug, "Allocated rom memory (%p)", Image);
|
||||
uint8_t * Image = (uint8_t *)(((uint64_t)ImageBase.get() + 0xFFF) & ~0xFFF); // Start at beginning of memory page
|
||||
WriteTrace(TraceN64System, TraceDebug, "Allocated ROM memory (%p)", Image);
|
||||
|
||||
//save information about the rom loaded
|
||||
// Save information about the ROM loaded
|
||||
m_ROMImageBase = ImageBase.release();
|
||||
m_ROMImage = Image;
|
||||
m_RomFileSize = RomFileSize;
|
||||
|
@ -56,7 +56,7 @@ bool CN64Rom::AllocateAndLoadN64Image(const char * FileLoc, bool LoadBootCodeOnl
|
|||
return false;
|
||||
}
|
||||
|
||||
//Read the first 4 bytes and make sure it is a valid n64 image
|
||||
// Read the first 4 bytes and make sure it is a valid N64 image
|
||||
uint8_t Test[4];
|
||||
m_RomFile.SeekToBegin();
|
||||
if (m_RomFile.Read(Test, sizeof(Test)) != sizeof(Test))
|
||||
|
@ -68,16 +68,16 @@ bool CN64Rom::AllocateAndLoadN64Image(const char * FileLoc, bool LoadBootCodeOnl
|
|||
if (!IsValidRomImage(Test))
|
||||
{
|
||||
m_RomFile.Close();
|
||||
WriteTrace(TraceN64System, TraceError, "invalid image file %X %X %X %X", Test[0], Test[1], Test[2], Test[3]);
|
||||
WriteTrace(TraceN64System, TraceError, "Invalid image file %X %X %X %X", Test[0], Test[1], Test[2], Test[3]);
|
||||
return false;
|
||||
}
|
||||
uint32_t RomFileSize = m_RomFile.GetLength();
|
||||
WriteTrace(TraceN64System, TraceDebug, "Successfully Opened, size: 0x%X", RomFileSize);
|
||||
WriteTrace(TraceN64System, TraceDebug, "Successfully opened, size: 0x%X", RomFileSize);
|
||||
|
||||
//if loading boot code then just load the first 0x1000 bytes
|
||||
// If loading boot code then just load the first 0x1000 bytes
|
||||
if (LoadBootCodeOnly)
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceDebug, "loading boot code, so loading the first 0x1000 bytes", RomFileSize);
|
||||
WriteTrace(TraceN64System, TraceDebug, "Loading boot code, so loading the first 0x1000 bytes", RomFileSize);
|
||||
RomFileSize = 0x1000;
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ bool CN64Rom::AllocateAndLoadN64Image(const char * FileLoc, bool LoadBootCodeOnl
|
|||
return false;
|
||||
}
|
||||
|
||||
//Load the n64 rom to the allocated memory
|
||||
// Load the N64 ROM into the allocated memory
|
||||
g_Notify->DisplayMessage(5, MSG_LOADING);
|
||||
m_RomFile.SeekToBegin();
|
||||
|
||||
|
@ -106,7 +106,7 @@ bool CN64Rom::AllocateAndLoadN64Image(const char * FileLoc, bool LoadBootCodeOnl
|
|||
}
|
||||
TotalRead += dwToRead;
|
||||
|
||||
//Show Message of how much % wise of the rom has been loaded
|
||||
// Show message of how much of the ROM has been loaded (as a percent)
|
||||
g_Notify->DisplayMessage(0, stdstr_f("%s: %.2f%c", GS(MSG_LOADED), ((float)TotalRead / (float)RomFileSize) * 100.0f, '%').c_str());
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ bool CN64Rom::AllocateAndLoadN64Image(const char * FileLoc, bool LoadBootCodeOnl
|
|||
g_Notify->DisplayMessage(5, MSG_BYTESWAP);
|
||||
ByteSwapRom();
|
||||
|
||||
//Protect the memory so that it can not be written to.
|
||||
// Protect the memory so that it can't be written to
|
||||
ProtectMemory(m_ROMImage, m_RomFileSize, MEM_READONLY);
|
||||
return true;
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ bool CN64Rom::AllocateAndLoadZipImage(const char * FileLoc, bool LoadBootCodeOnl
|
|||
int port = unzGoToFirstFile(file);
|
||||
bool FoundRom = false;
|
||||
|
||||
//scan through all files in zip to a suitable file is found
|
||||
// Scan through all files in zip until a suitable file is found
|
||||
while (port == UNZ_OK && !FoundRom)
|
||||
{
|
||||
unz_file_info info;
|
||||
|
@ -155,12 +155,12 @@ bool CN64Rom::AllocateAndLoadZipImage(const char * FileLoc, bool LoadBootCodeOnl
|
|||
break;
|
||||
}
|
||||
|
||||
//Read the first 4 bytes to check magic number
|
||||
// Read the first 4 bytes to check magic number
|
||||
uint8_t Test[4];
|
||||
unzReadCurrentFile(file, Test, sizeof(Test));
|
||||
if (IsValidRomImage(Test))
|
||||
{
|
||||
//Get the size of the rom and try to allocate the memory needed.
|
||||
// Get the size of the ROM and try to allocate the memory needed
|
||||
uint32_t RomFileSize = info.uncompressed_size;
|
||||
if (LoadBootCodeOnly)
|
||||
{
|
||||
|
@ -173,7 +173,7 @@ bool CN64Rom::AllocateAndLoadZipImage(const char * FileLoc, bool LoadBootCodeOnl
|
|||
return false;
|
||||
}
|
||||
|
||||
//Load the n64 rom to the allocated memory
|
||||
// Load the N64 ROM into the allocated memory
|
||||
g_Notify->DisplayMessage(5, MSG_LOADING);
|
||||
memcpy(m_ROMImage, Test, 4);
|
||||
|
||||
|
@ -192,7 +192,7 @@ bool CN64Rom::AllocateAndLoadZipImage(const char * FileLoc, bool LoadBootCodeOnl
|
|||
}
|
||||
TotalRead += dwRead;
|
||||
|
||||
//Show Message of how much % wise of the rom has been loaded
|
||||
// Show message of how much of the ROM has been loaded (as a percent)
|
||||
g_Notify->DisplayMessage(5, stdstr_f("%s: %.2f%c", GS(MSG_LOADED), ((float)TotalRead / (float)RomFileSize) * 100.0f, '%').c_str());
|
||||
}
|
||||
dwRead = TotalRead + 4;
|
||||
|
@ -209,7 +209,7 @@ bool CN64Rom::AllocateAndLoadZipImage(const char * FileLoc, bool LoadBootCodeOnl
|
|||
g_Notify->DisplayMessage(5, MSG_BYTESWAP);
|
||||
ByteSwapRom();
|
||||
|
||||
//Protect the memory so that it can not be written to.
|
||||
// Protect the memory so that it can't be written to
|
||||
ProtectMemory(m_ROMImage, m_RomFileSize, MEM_READONLY);
|
||||
}
|
||||
unzCloseCurrentFile(file);
|
||||
|
@ -241,7 +241,7 @@ void CN64Rom::ByteSwapRom()
|
|||
m_ROMImage[count + 1] ^= m_ROMImage[count + 3];
|
||||
}
|
||||
break;
|
||||
case 0x40072780: //64DD IPL
|
||||
case 0x40072780: // 64DD IPL
|
||||
case 0x40123780:
|
||||
for (count = 0; count < m_RomFileSize; count += 4)
|
||||
{
|
||||
|
@ -278,10 +278,10 @@ CICChip CN64Rom::GetCicChipID(uint8_t * RomData, uint64_t * CRC)
|
|||
case 0x000000D6497E414B: return CIC_NUS_6103;
|
||||
case 0x0000011A49F60E96: return CIC_NUS_6105;
|
||||
case 0x000000D6D5BE5580: return CIC_NUS_6106;
|
||||
case 0x000001053BC19870: return CIC_NUS_5167; //64DD CONVERSION CIC
|
||||
case 0x000000D2E53EF008: return CIC_NUS_8303; //64DD IPL
|
||||
case 0x000000D2E53EF39F: return CIC_NUS_DDTL; //64DD IPL TOOL
|
||||
case 0x000000D2E53E5DDA: return CIC_NUS_DDUS; //64DD IPL US (different CIC)
|
||||
case 0x000001053BC19870: return CIC_NUS_5167; // 64DD conversion CIC
|
||||
case 0x000000D2E53EF008: return CIC_NUS_8303; // 64DD IPL
|
||||
case 0x000000D2E53EF39F: return CIC_NUS_DDTL; // 64DD IPL tool
|
||||
case 0x000000D2E53E5DDA: return CIC_NUS_DDUS; // 64DD IPL US (different CIC)
|
||||
default:
|
||||
return CIC_UNKNOWN;
|
||||
}
|
||||
|
@ -427,7 +427,7 @@ bool CN64Rom::IsValidRomImage(uint8_t Test[4])
|
|||
if (*((uint32_t *)&Test[0]) == 0x40123780) { return true; }
|
||||
if (*((uint32_t *)&Test[0]) == 0x12408037) { return true; }
|
||||
if (*((uint32_t *)&Test[0]) == 0x80371240) { return true; }
|
||||
if (*((uint32_t *)&Test[0]) == 0x40072780) { return true; } //64DD IPL
|
||||
if (*((uint32_t *)&Test[0]) == 0x40072780) { return true; } // 64DD IPL
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -459,7 +459,7 @@ void CN64Rom::CleanRomName(char * RomName, bool byteswap)
|
|||
}
|
||||
}
|
||||
|
||||
//truncate all the spaces at the end of the string
|
||||
// Truncate all the spaces at the end of the string
|
||||
for (int count = 19; count >= 0; count--)
|
||||
{
|
||||
if (RomName[count] == ' ')
|
||||
|
@ -476,7 +476,7 @@ void CN64Rom::CleanRomName(char * RomName, bool byteswap)
|
|||
}
|
||||
RomName[20] = '\0';
|
||||
|
||||
//remove all /,\,: from the string
|
||||
// Remove all special characters from the string
|
||||
for (int count = 0; count < (int)strlen(RomName); count++)
|
||||
{
|
||||
switch (RomName[count])
|
||||
|
@ -507,7 +507,7 @@ bool CN64Rom::LoadN64Image(const char * FileLoc, bool LoadBootCodeOnly)
|
|||
{
|
||||
stdstr FullPath = FileLoc;
|
||||
|
||||
//this should be a 7zip file
|
||||
// This should be a 7-zip file
|
||||
char * SubFile = strstr(const_cast<char*>(FullPath.c_str()), "?");
|
||||
if (SubFile != nullptr)
|
||||
{
|
||||
|
@ -516,8 +516,8 @@ bool CN64Rom::LoadN64Image(const char * FileLoc, bool LoadBootCodeOnly)
|
|||
}
|
||||
//else load first found file until dialog is implemented
|
||||
//{
|
||||
//Pop up a dialog and select file
|
||||
//allocate memory for sub name and copy selected file name to var
|
||||
// Pop up a dialog and select file
|
||||
// Allocate memory for sub name and copy selected file name to variable
|
||||
//}
|
||||
|
||||
C7zip ZipFile(FullPath.c_str());
|
||||
|
@ -540,9 +540,9 @@ bool CN64Rom::LoadN64Image(const char * FileLoc, bool LoadBootCodeOnly)
|
|||
}
|
||||
}
|
||||
|
||||
//Get the size of the rom and try to allocate the memory needed.
|
||||
// Get the size of the ROM and try to allocate the memory needed
|
||||
uint32_t RomFileSize = (uint32_t)f->Size;
|
||||
//if loading boot code then just load the first 0x1000 bytes
|
||||
// If loading boot code then just load the first 0x1000 bytes
|
||||
if (LoadBootCodeOnly) { RomFileSize = 0x1000; }
|
||||
|
||||
if (!AllocateRomImage(RomFileSize))
|
||||
|
@ -551,7 +551,7 @@ bool CN64Rom::LoadN64Image(const char * FileLoc, bool LoadBootCodeOnly)
|
|||
return false;
|
||||
}
|
||||
|
||||
//Load the n64 rom to the allocated memory
|
||||
// Load the N64 ROM to the allocated memory
|
||||
g_Notify->DisplayMessage(5, MSG_LOADING);
|
||||
if (!ZipFile.GetFile(i, m_ROMImage, RomFileSize))
|
||||
{
|
||||
|
@ -574,7 +574,7 @@ bool CN64Rom::LoadN64Image(const char * FileLoc, bool LoadBootCodeOnly)
|
|||
g_Notify->DisplayMessage(5, MSG_BYTESWAP);
|
||||
ByteSwapRom();
|
||||
|
||||
//Protect the memory so that it can not be written to.
|
||||
// Protect the memory so that it can't be written to
|
||||
ProtectMemory(m_ROMImage, m_RomFileSize, MEM_READONLY);
|
||||
Loaded7zFile = true;
|
||||
break;
|
||||
|
@ -588,7 +588,7 @@ bool CN64Rom::LoadN64Image(const char * FileLoc, bool LoadBootCodeOnly)
|
|||
}
|
||||
#endif
|
||||
|
||||
//Try to open the file as a zip file
|
||||
// Try to open the file as a zip file
|
||||
if (!Loaded7zFile)
|
||||
{
|
||||
if (!AllocateAndLoadZipImage(FileLoc, LoadBootCodeOnly))
|
||||
|
@ -607,7 +607,7 @@ bool CN64Rom::LoadN64Image(const char * FileLoc, bool LoadBootCodeOnly)
|
|||
}
|
||||
|
||||
char RomName[260];
|
||||
//Get the header from the rom image
|
||||
// Get the header from the ROM image
|
||||
memcpy(&RomName[0], (void *)(m_ROMImage + 0x20), 20);
|
||||
CN64Rom::CleanRomName(RomName);
|
||||
|
||||
|
@ -625,7 +625,7 @@ bool CN64Rom::LoadN64Image(const char * FileLoc, bool LoadBootCodeOnly)
|
|||
|
||||
if (!LoadBootCodeOnly)
|
||||
{
|
||||
//Calculate files MD5
|
||||
// Calculate files MD5 checksum
|
||||
m_MD5 = MD5((const unsigned char *)m_ROMImage, m_RomFileSize).hex_digest();
|
||||
WriteTrace(TraceN64System, TraceDebug, "MD5: %s", m_MD5.c_str());
|
||||
}
|
||||
|
@ -636,7 +636,7 @@ bool CN64Rom::LoadN64Image(const char * FileLoc, bool LoadBootCodeOnly)
|
|||
|
||||
if (IsLoadedRomDDIPL())
|
||||
{
|
||||
//Handle CRC differently if 64DD IPL
|
||||
// Handle CRC differently if it is a 64DD IPL
|
||||
CRC1 = (*(uint16_t *)(&m_ROMImage[0x608]) << 16) | *(uint16_t *)(&m_ROMImage[0x60C]);
|
||||
CRC2 = (*(uint16_t *)(&m_ROMImage[0x638]) << 16) | *(uint16_t *)(&m_ROMImage[0x63C]);
|
||||
}
|
||||
|
@ -677,13 +677,13 @@ bool CN64Rom::LoadN64Image(const char * FileLoc, bool LoadBootCodeOnly)
|
|||
}
|
||||
else if (!IsLoadedRomDDIPL())
|
||||
{
|
||||
g_Settings->SaveString(Game_GameName, m_RomName.c_str()); //Use Base Game's Save File if loaded in combo
|
||||
g_Settings->SaveString(Game_GameName, m_RomName.c_str()); // Use base games save file if loaded in combo
|
||||
}
|
||||
}
|
||||
|
||||
if (g_Settings->LoadBool(Game_CRC_Recalc))
|
||||
{
|
||||
//Calculate ROM Header CRC
|
||||
// Calculate ROM header CRC
|
||||
CalculateRomCrc();
|
||||
}
|
||||
|
||||
|
@ -703,7 +703,7 @@ bool CN64Rom::LoadN64ImageIPL(const char * FileLoc, bool LoadBootCodeOnly)
|
|||
{
|
||||
stdstr FullPath = FileLoc;
|
||||
|
||||
//this should be a 7zip file
|
||||
// This should be a 7-zip file
|
||||
char * SubFile = strstr(const_cast<char*>(FullPath.c_str()), "?");
|
||||
if (SubFile != nullptr)
|
||||
{
|
||||
|
@ -712,8 +712,8 @@ bool CN64Rom::LoadN64ImageIPL(const char * FileLoc, bool LoadBootCodeOnly)
|
|||
}
|
||||
//else load first found file until dialog is implemented
|
||||
//{
|
||||
//Pop up a dialog and select file
|
||||
//allocate memory for sub name and copy selected file name to var
|
||||
// Pop up a dialog and select file
|
||||
// Allocate memory for sub name and copy selected file name to variable
|
||||
//}
|
||||
|
||||
C7zip ZipFile(FullPath.c_str());
|
||||
|
@ -736,9 +736,9 @@ bool CN64Rom::LoadN64ImageIPL(const char * FileLoc, bool LoadBootCodeOnly)
|
|||
}
|
||||
}
|
||||
|
||||
//Get the size of the rom and try to allocate the memory needed.
|
||||
// Get the size of the ROM and try to allocate the memory needed
|
||||
uint32_t RomFileSize = (uint32_t)f->Size;
|
||||
//if loading boot code then just load the first 0x1000 bytes
|
||||
// If loading boot code then just load the first 0x1000 bytes
|
||||
if (LoadBootCodeOnly) { RomFileSize = 0x1000; }
|
||||
|
||||
if (!AllocateRomImage(RomFileSize))
|
||||
|
@ -747,7 +747,7 @@ bool CN64Rom::LoadN64ImageIPL(const char * FileLoc, bool LoadBootCodeOnly)
|
|||
return false;
|
||||
}
|
||||
|
||||
//Load the n64 rom to the allocated memory
|
||||
// Load the N64 ROM to the allocated memory
|
||||
g_Notify->DisplayMessage(5, MSG_LOADING);
|
||||
if (!ZipFile.GetFile(i, m_ROMImage, RomFileSize))
|
||||
{
|
||||
|
@ -770,7 +770,7 @@ bool CN64Rom::LoadN64ImageIPL(const char * FileLoc, bool LoadBootCodeOnly)
|
|||
g_Notify->DisplayMessage(5, MSG_BYTESWAP);
|
||||
ByteSwapRom();
|
||||
|
||||
//Protect the memory so that it can not be written to.
|
||||
// Protect the memory so that it can't be written to
|
||||
ProtectMemory(m_ROMImage, m_RomFileSize, MEM_READONLY);
|
||||
Loaded7zFile = true;
|
||||
break;
|
||||
|
@ -784,7 +784,7 @@ bool CN64Rom::LoadN64ImageIPL(const char * FileLoc, bool LoadBootCodeOnly)
|
|||
}
|
||||
#endif
|
||||
|
||||
//Try to open the file as a zip file
|
||||
// Try to open the file as a zip file
|
||||
if (!Loaded7zFile)
|
||||
{
|
||||
if (!AllocateAndLoadZipImage(FileLoc, LoadBootCodeOnly))
|
||||
|
@ -801,7 +801,7 @@ bool CN64Rom::LoadN64ImageIPL(const char * FileLoc, bool LoadBootCodeOnly)
|
|||
}
|
||||
|
||||
char RomName[260];
|
||||
//Get the header from the rom image
|
||||
// Get the header from the ROM image
|
||||
memcpy(&RomName[0], (void *)(m_ROMImage + 0x20), 20);
|
||||
CN64Rom::CleanRomName(RomName);
|
||||
if (strlen(RomName) == 0)
|
||||
|
@ -817,7 +817,7 @@ bool CN64Rom::LoadN64ImageIPL(const char * FileLoc, bool LoadBootCodeOnly)
|
|||
|
||||
if (!LoadBootCodeOnly)
|
||||
{
|
||||
//Calculate files MD5
|
||||
// Calculate files MD5 checksum
|
||||
m_MD5 = MD5((const unsigned char *)m_ROMImage, m_RomFileSize).hex_digest();
|
||||
WriteTrace(TraceN64System, TraceDebug, "MD5: %s", m_MD5.c_str());
|
||||
}
|
||||
|
@ -828,7 +828,7 @@ bool CN64Rom::LoadN64ImageIPL(const char * FileLoc, bool LoadBootCodeOnly)
|
|||
|
||||
if (IsLoadedRomDDIPL())
|
||||
{
|
||||
//Handle CRC differently if 64DD IPL
|
||||
// Handle CRC differently if it is a 64DD IPL
|
||||
CRC1 = (*(uint16_t *)(&m_ROMImage[0x608]) << 16) | *(uint16_t *)(&m_ROMImage[0x60C]);
|
||||
CRC2 = (*(uint16_t *)(&m_ROMImage[0x638]) << 16) | *(uint16_t *)(&m_ROMImage[0x63C]);
|
||||
}
|
||||
|
@ -854,15 +854,15 @@ bool CN64Rom::LoadN64ImageIPL(const char * FileLoc, bool LoadBootCodeOnly)
|
|||
|
||||
if (g_Settings->LoadBool(Game_CRC_Recalc))
|
||||
{
|
||||
//Calculate ROM Header CRC
|
||||
// Calculate ROM header CRC
|
||||
CalculateRomCrc();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//Save the settings of the loaded rom, so all loaded settings about rom will be identified with
|
||||
//this rom
|
||||
// Save the settings of the loaded ROM, so all loaded settings about ROM will be identified with this ROM
|
||||
|
||||
void CN64Rom::SaveRomSettingID(bool temp)
|
||||
{
|
||||
g_Settings->SaveBool(Game_TempLoaded, temp);
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
bool IsPal();
|
||||
void UnallocateRomImage();
|
||||
|
||||
//Get a message id for the reason that you failed to load the rom
|
||||
// Get a message ID for the reason that you failed to load the ROM
|
||||
LanguageStringID GetError() const { return m_ErrorMsg; }
|
||||
static CICChip GetCicChipID(uint8_t * RomData, uint64_t * CRC = nullptr);
|
||||
static void CleanRomName(char * RomName, bool byteswap = true);
|
||||
|
@ -43,10 +43,10 @@ private:
|
|||
|
||||
static void NotificationCB(const char * Status, CN64Rom * _this);
|
||||
|
||||
//constant values
|
||||
// Constant values
|
||||
enum { ReadFromRomSection = 0x400000 };
|
||||
|
||||
//class variables
|
||||
// Class variables
|
||||
CFile m_RomFile;
|
||||
uint8_t * m_ROMImage;
|
||||
uint8_t * m_ROMImageBase;
|
||||
|
|
|
@ -67,12 +67,12 @@ CN64System::CN64System(CPlugins * Plugins, uint32_t randomizer_seed, bool SavesR
|
|||
|
||||
if (!m_MMU_VM.Initialize(SyncSystem))
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceWarning, "MMU failed to Initialize");
|
||||
WriteTrace(TraceN64System, TraceWarning, "MMU failed to initialize");
|
||||
WriteTrace(TraceN64System, TraceDebug, "Done");
|
||||
return;
|
||||
}
|
||||
|
||||
WriteTrace(TraceN64System, TraceDebug, "Reseting Plugins");
|
||||
WriteTrace(TraceN64System, TraceDebug, "Resetting plugins");
|
||||
g_Notify->DisplayMessage(5, MSG_PLUGIN_INIT);
|
||||
m_Plugins->CreatePlugins();
|
||||
bool bRes = m_Plugins->Initiate(this);
|
||||
|
@ -98,7 +98,7 @@ CN64System::CN64System(CPlugins * Plugins, uint32_t randomizer_seed, bool SavesR
|
|||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
g_Notify->DisplayMessage(5, "Copy Plugins");
|
||||
g_Notify->DisplayMessage(5, "Copy plugins");
|
||||
g_Plugins->CopyPlugins(g_Settings->LoadStringVal(Directory_PluginSync));
|
||||
m_SyncPlugins = new CPlugins(Directory_PluginSync, true);
|
||||
m_SyncPlugins->SetRenderWindows(g_Plugins->SyncWindow(), nullptr);
|
||||
|
@ -154,14 +154,14 @@ CN64System::~CN64System()
|
|||
|
||||
void CN64System::ExternalEvent(SystemEvent action)
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceDebug, "action: %s", SystemEventName(action));
|
||||
WriteTrace(TraceN64System, TraceDebug, "Action: %s", SystemEventName(action));
|
||||
|
||||
if (action == SysEvent_LoadMachineState &&
|
||||
!g_Settings->LoadBool(GameRunning_CPU_Running) &&
|
||||
g_BaseSystem != nullptr &&
|
||||
g_BaseSystem->LoadState())
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceDebug, "ignore event, manualy loaded save");
|
||||
WriteTrace(TraceN64System, TraceDebug, "Ignore event, manually loaded save");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ void CN64System::ExternalEvent(SystemEvent action)
|
|||
g_BaseSystem != nullptr &&
|
||||
g_BaseSystem->SaveState())
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceDebug, "ignore event, manualy saved event");
|
||||
WriteTrace(TraceN64System, TraceDebug, "Ignore event, manually saved event");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -228,7 +228,7 @@ void CN64System::ExternalEvent(SystemEvent action)
|
|||
}
|
||||
break;
|
||||
case SysEvent_ResumeCPU_FromMenu:
|
||||
// always resume if from menu
|
||||
// Always resume if from menu
|
||||
m_hPauseEvent.Trigger();
|
||||
break;
|
||||
case SysEvent_ResumeCPU_AppGainedFocus:
|
||||
|
@ -305,24 +305,24 @@ bool CN64System::LoadFileImage(const char * FileLoc)
|
|||
g_Settings->SaveDword(Game_CurrentSaveState, g_Settings->LoadDefaultDword(Game_CurrentSaveState));
|
||||
if (g_Settings->LoadBool(GameRunning_LoadingInProgress))
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceError, "game loading is in progress, can not load new file");
|
||||
WriteTrace(TraceN64System, TraceError, "Game loading is in progress, cannot load new file");
|
||||
return false;
|
||||
}
|
||||
|
||||
//Mark the rom as loading
|
||||
WriteTrace(TraceN64System, TraceDebug, "Mark Rom as loading");
|
||||
// Mark the ROM as loading
|
||||
WriteTrace(TraceN64System, TraceDebug, "Mark ROM as loading");
|
||||
g_Settings->SaveString(Game_File, "");
|
||||
g_Settings->SaveBool(GameRunning_LoadingInProgress, true);
|
||||
|
||||
//Try to load the passed N64 rom
|
||||
// Try to load the passed N64 ROM
|
||||
if (g_Rom == nullptr)
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceDebug, "Allocating global rom object");
|
||||
WriteTrace(TraceN64System, TraceDebug, "Allocating global ROM object");
|
||||
g_Rom = new CN64Rom();
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceDebug, "Use existing global rom object");
|
||||
WriteTrace(TraceN64System, TraceDebug, "Use existing global ROM object");
|
||||
}
|
||||
|
||||
WriteTrace(TraceN64System, TraceDebug, "Loading \"%s\"", FileLoc);
|
||||
|
@ -330,7 +330,7 @@ bool CN64System::LoadFileImage(const char * FileLoc)
|
|||
{
|
||||
if (g_Rom->IsLoadedRomDDIPL())
|
||||
{
|
||||
//64DD IPL
|
||||
// 64DD IPL
|
||||
if (g_DDRom == nullptr)
|
||||
{
|
||||
g_DDRom = new CN64Rom();
|
||||
|
@ -351,7 +351,7 @@ bool CN64System::LoadFileImage(const char * FileLoc)
|
|||
g_Settings->SaveString(Game_File, FileLoc);
|
||||
}
|
||||
g_Settings->SaveBool(GameRunning_LoadingInProgress, false);
|
||||
WriteTrace(TraceN64System, TraceDebug, "Finished Loading (GoodName: %s)", g_Settings->LoadStringVal(Rdb_GoodName).c_str());
|
||||
WriteTrace(TraceN64System, TraceDebug, "Finished loading (GoodName: %s)", g_Settings->LoadStringVal(Rdb_GoodName).c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -375,20 +375,20 @@ bool CN64System::LoadFileImageIPL(const char * FileLoc)
|
|||
return false;
|
||||
}
|
||||
|
||||
//Mark the rom as loading
|
||||
WriteTrace(TraceN64System, TraceDebug, "Mark DDRom as loading");
|
||||
// Mark the N64DD IPL as loading
|
||||
WriteTrace(TraceN64System, TraceDebug, "Mark N64DD IPL as loading");
|
||||
//g_Settings->SaveString(Game_File, "");
|
||||
g_Settings->SaveBool(GameRunning_LoadingInProgress, true);
|
||||
|
||||
//Try to load the passed N64 DDrom
|
||||
// Try to load the passed N64DD IPL
|
||||
if (g_DDRom == nullptr)
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceDebug, "Allocating global DDrom object");
|
||||
WriteTrace(TraceN64System, TraceDebug, "Allocating global N64DD IPL object");
|
||||
g_DDRom = new CN64Rom();
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceDebug, "Use existing global DDrom object");
|
||||
WriteTrace(TraceN64System, TraceDebug, "Use existing global N64DD IPL object");
|
||||
}
|
||||
|
||||
WriteTrace(TraceN64System, TraceDebug, "Loading \"%s\"", FileLoc);
|
||||
|
@ -396,7 +396,7 @@ bool CN64System::LoadFileImageIPL(const char * FileLoc)
|
|||
{
|
||||
if (!g_DDRom->IsLoadedRomDDIPL())
|
||||
{
|
||||
//If not 64DD IPL then it's wrong
|
||||
// If not 64DD IPL then it's wrong
|
||||
WriteTrace(TraceN64System, TraceError, "LoadN64ImageIPL failed (\"%s\")", FileLoc);
|
||||
g_Notify->DisplayError(g_DDRom->GetError());
|
||||
delete g_DDRom;
|
||||
|
@ -437,20 +437,20 @@ bool CN64System::LoadDiskImage(const char * FileLoc, const bool Expansion)
|
|||
return false;
|
||||
}
|
||||
|
||||
//Mark the rom as loading
|
||||
WriteTrace(TraceN64System, TraceDebug, "Mark Disk as loading");
|
||||
// Mark the disk as loading
|
||||
WriteTrace(TraceN64System, TraceDebug, "Mark disk as loading");
|
||||
//g_Settings->SaveString(Game_File, "");
|
||||
g_Settings->SaveBool(GameRunning_LoadingInProgress, true);
|
||||
|
||||
//Try to load the passed N64 Disk
|
||||
// Try to load the passed N64 disk
|
||||
if (g_Disk == nullptr)
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceDebug, "Allocating global Disk object");
|
||||
WriteTrace(TraceN64System, TraceDebug, "Allocating global disk object");
|
||||
g_Disk = new CN64Disk();
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceDebug, "Use existing global Disk object");
|
||||
WriteTrace(TraceN64System, TraceDebug, "Use existing global disk object");
|
||||
}
|
||||
|
||||
WriteTrace(TraceN64System, TraceDebug, "Loading \"%s\"", FileLoc);
|
||||
|
@ -478,7 +478,7 @@ bool CN64System::LoadDiskImage(const char * FileLoc, const bool Expansion)
|
|||
|
||||
bool CN64System::RunFileImage(const char * FileLoc)
|
||||
{
|
||||
//Uninitialize g_Disk and g_DDRom to prevent exception when ending emulation of a regular ROM after playing 64DD content previously.
|
||||
// Uninitialize g_Disk and g_DDRom to prevent exception when ending emulation of a regular ROM after playing 64DD content previously
|
||||
if (g_Disk != nullptr)
|
||||
{
|
||||
g_Disk->UnallocateDiskImage();
|
||||
|
@ -517,7 +517,7 @@ bool CN64System::RunDiskImage(const char * FileLoc)
|
|||
return false;
|
||||
}
|
||||
|
||||
//Select IPL ROM depending on Disk Country Code
|
||||
// Select IPL ROM depending on disk country code
|
||||
if (!SelectAndLoadFileImageIPL(g_Disk->GetCountry(), false))
|
||||
{
|
||||
return false;
|
||||
|
@ -539,7 +539,7 @@ bool CN64System::RunDiskComboImage(const char * FileLoc, const char * FileLocDis
|
|||
return false;
|
||||
}
|
||||
|
||||
//Select IPL ROM depending on Disk Country Code
|
||||
// Select IPL ROM depending on disk country code
|
||||
if (!SelectAndLoadFileImageIPL(g_Disk->GetCountry(), true))
|
||||
{
|
||||
return false;
|
||||
|
@ -558,7 +558,7 @@ void CN64System::RunLoadedImage(void)
|
|||
{
|
||||
if (g_Settings->LoadBool(Setting_AutoStart) != 0)
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceDebug, "Automattically starting rom");
|
||||
WriteTrace(TraceN64System, TraceDebug, "Automatically starting ROM");
|
||||
g_BaseSystem->StartEmulation(true);
|
||||
}
|
||||
}
|
||||
|
@ -605,7 +605,7 @@ bool CN64System::SelectAndLoadFileImageIPL(Country country, bool combo)
|
|||
IPLROMError = MSG_TOOL_IPL_REQUIRED;
|
||||
if (combo && !CPath(g_Settings->LoadStringVal(File_DiskIPLTOOLPath).c_str()).Exists())
|
||||
{
|
||||
//Development IPL is not needed for combo ROM + Disk loading
|
||||
// Development IPL is not needed for combo ROM + disk loading
|
||||
if (CPath(g_Settings->LoadStringVal(File_DiskIPLPath).c_str()).Exists())
|
||||
IPLROMPathSetting = File_DiskIPLPath;
|
||||
else if (CPath(g_Settings->LoadStringVal(File_DiskIPLUSAPath).c_str()).Exists())
|
||||
|
@ -660,14 +660,14 @@ bool CN64System::EmulationStarting(CThread * thread)
|
|||
if (g_BaseSystem->SetActiveSystem(true))
|
||||
{
|
||||
g_BaseSystem->m_thread = thread;
|
||||
WriteTrace(TraceN64System, TraceDebug, "Setting up N64 system done");
|
||||
WriteTrace(TraceN64System, TraceDebug, "Setting up N64 system is done");
|
||||
g_Settings->SaveBool(GameRunning_LoadingInProgress, false);
|
||||
try
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceDebug, "Game starting");
|
||||
g_BaseSystem->StartEmulation2(false);
|
||||
WriteTrace(TraceN64System, TraceDebug, "Game Done");
|
||||
//PLACE TO ADD 64DD SAVING CODE
|
||||
WriteTrace(TraceN64System, TraceDebug, "Game done");
|
||||
// TODO: Add 64DD saving code?
|
||||
if (g_Disk != nullptr)
|
||||
{
|
||||
g_Disk->SaveDiskImage();
|
||||
|
@ -715,7 +715,7 @@ void CN64System::StartEmulation2(bool NewThread)
|
|||
WriteTrace(TraceN64System, TraceDebug, "Setting system as active");
|
||||
if (!m_Plugins->Reset(this) || !m_Plugins->initilized())
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceWarning, "can not run, plugins not initlized");
|
||||
WriteTrace(TraceN64System, TraceWarning, "Can't run, plugins not initialized");
|
||||
g_Settings->SaveBool(GameRunning_LoadingInProgress, false);
|
||||
g_Notify->DisplayError(MSG_PLUGIN_NOT_INIT);
|
||||
}
|
||||
|
@ -732,9 +732,9 @@ void CN64System::StartEmulation2(bool NewThread)
|
|||
}
|
||||
else
|
||||
{
|
||||
//mark the emulation as starting and fix up menus
|
||||
// Mark the emulation as starting and fix up menus
|
||||
g_Notify->DisplayMessage(2, MSG_EMULATION_STARTED);
|
||||
WriteTrace(TraceN64System, TraceDebug, "Start Executing CPU");
|
||||
WriteTrace(TraceN64System, TraceDebug, "Start executing CPU");
|
||||
ExecuteCPU();
|
||||
}
|
||||
WriteTrace(TraceN64System, TraceDebug, "Done");
|
||||
|
@ -969,7 +969,7 @@ void CN64System::InitRegisters(bool bPostPif, CMipsMemoryVM & MMU)
|
|||
{
|
||||
m_Reg.Reset();
|
||||
|
||||
//COP0 Registers
|
||||
// COP0 registers
|
||||
m_Reg.RANDOM_REGISTER = 0x1F;
|
||||
m_Reg.COUNT_REGISTER = 0x5000;
|
||||
m_Reg.MI_VERSION_REG = 0x02020102;
|
||||
|
@ -982,9 +982,9 @@ void CN64System::InitRegisters(bool bPostPif, CMipsMemoryVM & MMU)
|
|||
m_Reg.CONFIG_REGISTER = 0x0006E463;
|
||||
m_Reg.STATUS_REGISTER = 0x34000000;
|
||||
|
||||
//64DD Registers
|
||||
// N64DD registers
|
||||
|
||||
//Start 64DD in Reset State and Motor Not Spinning
|
||||
// Start N64DD in reset state and motor not spinning
|
||||
m_Reg.ASIC_STATUS = DD_STATUS_RST_STATE | DD_STATUS_MTR_N_SPIN;
|
||||
m_Reg.ASIC_ID_REG = 0x00030000;
|
||||
if (g_DDRom && (g_DDRom->CicChipID() == CIC_NUS_DDTL || (g_Disk && g_Disk->GetCountry() == Country_Unknown)))
|
||||
|
@ -1074,7 +1074,7 @@ void CN64System::InitRegisters(bool bPostPif, CMipsMemoryVM & MMU)
|
|||
case CIC_NUS_DDUS:
|
||||
case CIC_NUS_DDTL:
|
||||
default:
|
||||
//no specific values
|
||||
// No specific values
|
||||
break;
|
||||
}
|
||||
m_Reg.m_GPR[20].DW = 0x0000000000000001;
|
||||
|
@ -1088,12 +1088,12 @@ void CN64System::InitRegisters(bool bPostPif, CMipsMemoryVM & MMU)
|
|||
case CIC_NUS_6101:
|
||||
m_Reg.m_GPR[22].DW = 0x000000000000003F;
|
||||
break;
|
||||
case CIC_NUS_8303: //64DD IPL CIC
|
||||
case CIC_NUS_DDTL: //64DD IPL TOOL CIC
|
||||
case CIC_NUS_5167: //64DD CONVERSION CIC
|
||||
case CIC_NUS_8303: // 64DD IPL CIC
|
||||
case CIC_NUS_DDTL: // 64DD IPL tool CIC
|
||||
case CIC_NUS_5167: // 64DD conversion CIC
|
||||
m_Reg.m_GPR[22].DW = 0x00000000000000DD;
|
||||
break;
|
||||
case CIC_NUS_DDUS: //64DD US IPL CIC
|
||||
case CIC_NUS_DDUS: // 64DD US IPL CIC
|
||||
m_Reg.m_GPR[22].DW = 0x00000000000000DE;
|
||||
break;
|
||||
case CIC_UNKNOWN:
|
||||
|
@ -1153,7 +1153,7 @@ void CN64System::InitRegisters(bool bPostPif, CMipsMemoryVM & MMU)
|
|||
else
|
||||
{
|
||||
m_Reg.m_PROGRAM_COUNTER = 0xBFC00000;
|
||||
/* PIF_Ram[36] = 0x00; PIF_Ram[39] = 0x3F; //common pif ram start values
|
||||
/* PIF_Ram[36] = 0x00; PIF_Ram[39] = 0x3F; // Common PIF RAM start values
|
||||
|
||||
switch (g_Rom->CicChipID()) {
|
||||
case CIC_NUS_6101: PIF_Ram[37] = 0x06; PIF_Ram[38] = 0x3F; break;
|
||||
|
@ -1170,7 +1170,7 @@ void CN64System::ExecuteCPU()
|
|||
{
|
||||
WriteTrace(TraceN64System, TraceDebug, "Start");
|
||||
|
||||
//reset code
|
||||
// Reset code
|
||||
g_Settings->SaveBool(GameRunning_CPU_Paused, false);
|
||||
g_Settings->SaveBool(GameRunning_CPU_Running, true);
|
||||
g_Notify->DisplayMessage(2, MSG_EMULATION_STARTED);
|
||||
|
@ -1205,7 +1205,7 @@ void CN64System::ExecuteCPU()
|
|||
}
|
||||
WriteTrace(TraceN64System, TraceDebug, "CPU finished executing");
|
||||
CpuStopped();
|
||||
WriteTrace(TraceN64System, TraceDebug, "Notifing plugins rom is done");
|
||||
WriteTrace(TraceN64System, TraceDebug, "Notifying plugins ROM is done");
|
||||
m_Plugins->RomClosed();
|
||||
if (m_SyncCPU)
|
||||
{
|
||||
|
@ -1249,11 +1249,11 @@ void CN64System::UpdateSyncCPU(CN64System * const SecondCPU, uint32_t const Cycl
|
|||
{
|
||||
int CyclesToExecute = Cycles - m_CyclesToSkip;
|
||||
|
||||
//Update the number of cycles to skip
|
||||
// Update the number of cycles to skip
|
||||
m_CyclesToSkip -= Cycles;
|
||||
if (m_CyclesToSkip < 0) { m_CyclesToSkip = 0; }
|
||||
|
||||
//Run the other CPU For the same amount of cycles
|
||||
// Run the other CPU For the same amount of cycles
|
||||
if (CyclesToExecute < 0) { return; }
|
||||
|
||||
SecondCPU->SetActiveSystem(true);
|
||||
|
@ -1438,7 +1438,7 @@ void CN64System::DumpSyncErrors(CN64System * SecondCPU)
|
|||
CLog Error;
|
||||
Error.Open(ErrorFile);
|
||||
Error.Log("Errors:\r\n");
|
||||
Error.Log("Register, Recompiler, Interpter\r\n");
|
||||
Error.Log("Register, Recompiler, Interpreter\r\n");
|
||||
#ifdef TEST_SP_TRACKING
|
||||
if (m_CurrentSP != GPR[29].UW[0])
|
||||
{
|
||||
|
@ -1552,7 +1552,7 @@ void CN64System::DumpSyncErrors(CN64System * SecondCPU)
|
|||
{
|
||||
if (Rdram[z] != Rdram2[z])
|
||||
{
|
||||
Error.LogF("Rdram[%X]: %X %X\r\n", z << 2, Rdram[z], Rdram2[z]);
|
||||
Error.LogF("RDRAM[%X]: %X %X\r\n", z << 2, Rdram[z], Rdram2[z]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1561,7 +1561,7 @@ void CN64System::DumpSyncErrors(CN64System * SecondCPU)
|
|||
{
|
||||
if (Imem[z] != Imem2[z])
|
||||
{
|
||||
Error.LogF("Imem[%X]: %X %X\r\n", z << 2, Imem[z], Imem2[z]);
|
||||
Error.LogF("IMEM[%X]: %X %X\r\n", z << 2, Imem[z], Imem2[z]);
|
||||
}
|
||||
}
|
||||
uint32_t * Dmem = (uint32_t *)m_MMU_VM.Dmem(), *Dmem2 = (uint32_t *)SecondCPU->m_MMU_VM.Dmem();
|
||||
|
@ -1569,15 +1569,15 @@ void CN64System::DumpSyncErrors(CN64System * SecondCPU)
|
|||
{
|
||||
if (Dmem[z] != Dmem2[z])
|
||||
{
|
||||
Error.LogF("Dmem[%X]: %X %X\r\n", z << 2, Dmem[z], Dmem2[z]);
|
||||
Error.LogF("DMEM[%X]: %X %X\r\n", z << 2, Dmem[z], Dmem2[z]);
|
||||
}
|
||||
}
|
||||
Error.Log("\r\n");
|
||||
Error.Log("Information:\r\n");
|
||||
Error.Log("\r\n");
|
||||
Error.LogF("PROGRAM_COUNTER,0x%X\r\n", m_Reg.m_PROGRAM_COUNTER);
|
||||
Error.LogF("Current Timer,0x%X\r\n", m_NextTimer);
|
||||
Error.LogF("Timer Type,0x%X\r\n", m_SystemTimer.CurrentType());
|
||||
Error.LogF("Current timer,0x%X\r\n", m_NextTimer);
|
||||
Error.LogF("Timer type,0x%X\r\n", m_SystemTimer.CurrentType());
|
||||
Error.Log("\r\n");
|
||||
for (int i = 0; i < (sizeof(m_LastSuccessSyncPC) / sizeof(m_LastSuccessSyncPC[0])); i++)
|
||||
{
|
||||
|
@ -1610,7 +1610,7 @@ void CN64System::DumpSyncErrors(CN64System * SecondCPU)
|
|||
count < 10 ? 7 : 6, " ", *(m_Reg.m_FPR_D[count]), *(SecondCPU->m_Reg.m_FPR_D[count]));
|
||||
}
|
||||
Error.Log("\r\n");
|
||||
Error.LogF("Rounding Model, 0x%08X, 0x%08X\r\n", m_Reg.m_RoundingModel, SecondCPU->m_Reg.m_RoundingModel);
|
||||
Error.LogF("Rounding model, 0x%08X, 0x%08X\r\n", m_Reg.m_RoundingModel, SecondCPU->m_Reg.m_RoundingModel);
|
||||
Error.Log("\r\n");
|
||||
for (count = 0; count < 32; count++)
|
||||
{
|
||||
|
@ -1661,7 +1661,7 @@ void CN64System::DumpSyncErrors(CN64System * SecondCPU)
|
|||
}
|
||||
}
|
||||
Error.Log("\r\n");
|
||||
Error.Log("Code at Last Sync PC:\r\n");
|
||||
Error.Log("Code at last sync PC:\r\n");
|
||||
for (count = 0; count < 50; count++)
|
||||
{
|
||||
uint32_t OpcodeValue, Addr = m_LastSuccessSyncPC[0] + (count << 2);
|
||||
|
@ -1672,7 +1672,7 @@ void CN64System::DumpSyncErrors(CN64System * SecondCPU)
|
|||
}
|
||||
}
|
||||
|
||||
g_Notify->DisplayError("Sync Error");
|
||||
g_Notify->DisplayError("Sync error");
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
|
@ -1683,7 +1683,7 @@ bool CN64System::SaveState()
|
|||
// if (!m_SystemTimer.SaveAllowed()) { return false; }
|
||||
if ((m_Reg.STATUS_REGISTER & STATUS_EXL) != 0)
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceDebug, "Done - STATUS_EXL set, can not save");
|
||||
WriteTrace(TraceN64System, TraceDebug, "Done - STATUS_EXL set, can't save");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1715,13 +1715,13 @@ bool CN64System::SaveState()
|
|||
CPath ZipFile(SaveFile);
|
||||
ZipFile.SetNameExtension(stdstr_f("%s.zip", ZipFile.GetNameExtension().c_str()).c_str());
|
||||
|
||||
//Make sure the target dir exists
|
||||
// Make sure the target directory exists
|
||||
if (!SaveFile.DirectoryExists())
|
||||
{
|
||||
SaveFile.DirectoryCreate();
|
||||
}
|
||||
|
||||
//Open the file
|
||||
// Open the file
|
||||
if (g_Settings->LoadDword(Game_FuncLookupMode) == FuncFind_ChangeMemory)
|
||||
{
|
||||
if (m_Recomp)
|
||||
|
@ -1742,7 +1742,7 @@ bool CN64System::SaveState()
|
|||
zipWriteInFileInZip(file, &RdramSize, sizeof(uint32_t));
|
||||
if (g_Settings->LoadBool(Setting_EnableDisk) && g_Disk)
|
||||
{
|
||||
//Keep Base ROM Information (64DD IPL / Compatible Game ROM)
|
||||
// Keep base ROM information (64DD IPL / compatible game ROM)
|
||||
zipWriteInFileInZip(file, &g_Rom->GetRomAddress()[0x10], 0x20);
|
||||
zipWriteInFileInZip(file, g_Disk->GetDiskAddressID(), 0x20);
|
||||
}
|
||||
|
@ -1776,13 +1776,13 @@ bool CN64System::SaveState()
|
|||
|
||||
zipOpenNewFileInZip(file, ExtraInfo.GetNameExtension().c_str(), nullptr, nullptr, 0, nullptr, 0, nullptr, Z_DEFLATED, Z_DEFAULT_COMPRESSION);
|
||||
|
||||
//Extra Info v2
|
||||
// Extra info v2
|
||||
zipWriteInFileInZip(file, &SaveID_2, sizeof(SaveID_2));
|
||||
|
||||
//Disk Interface Info
|
||||
// Disk interface info
|
||||
zipWriteInFileInZip(file, m_Reg.m_DiskInterface, sizeof(uint32_t) * 22);
|
||||
|
||||
//System Timers Info
|
||||
// System timers info
|
||||
m_SystemTimer.SaveData(file);
|
||||
|
||||
zipCloseFileInZip(file);
|
||||
|
@ -1806,13 +1806,13 @@ bool CN64System::SaveState()
|
|||
return true;
|
||||
}
|
||||
|
||||
//Write info to file
|
||||
// Write info to file
|
||||
hSaveFile.SeekToBegin();
|
||||
hSaveFile.Write(&SaveID_0, sizeof(uint32_t));
|
||||
hSaveFile.Write(&RdramSize, sizeof(uint32_t));
|
||||
if (g_Settings->LoadBool(Setting_EnableDisk) && g_Disk)
|
||||
{
|
||||
//Keep Base ROM Information (64DD IPL / Compatible Game ROM)
|
||||
// Keep base ROM information (64DD IPL / compatible game ROM)
|
||||
hSaveFile.Write(&g_Rom->GetRomAddress()[0x10], 0x20);
|
||||
hSaveFile.Write(g_Disk->GetDiskAddressID(), 0x20);
|
||||
}
|
||||
|
@ -1847,13 +1847,13 @@ bool CN64System::SaveState()
|
|||
CFile hExtraInfo(ExtraInfo, CFileBase::modeWrite | CFileBase::modeCreate);
|
||||
if (hExtraInfo.IsOpen())
|
||||
{
|
||||
//Extra Info v2
|
||||
// Extra info v2
|
||||
hExtraInfo.Write(&SaveID_2, sizeof(uint32_t));
|
||||
|
||||
//Disk Interface Info
|
||||
// Disk interface info
|
||||
hExtraInfo.Write(m_Reg.m_DiskInterface, sizeof(uint32_t) * 22);
|
||||
|
||||
//System Timers Info
|
||||
// System timers info
|
||||
m_SystemTimer.SaveData(hExtraInfo);
|
||||
hExtraInfo.Close();
|
||||
}
|
||||
|
@ -1915,7 +1915,7 @@ bool CN64System::LoadState()
|
|||
}
|
||||
CPath NewFileName = FileName;
|
||||
|
||||
//Use old file Name
|
||||
// Use old file Name
|
||||
if (g_Settings->LoadDword(Game_CurrentSaveState) != 0)
|
||||
{
|
||||
FileName.SetNameExtension(stdstr_f("%s.pj%d", g_Settings->LoadStringVal(Game_GameName).c_str(), g_Settings->LoadDword(Game_CurrentSaveState)).c_str());
|
||||
|
@ -1954,7 +1954,7 @@ bool CN64System::LoadState(const char * FileName)
|
|||
|
||||
if (g_Settings->LoadDword(Setting_AutoZipInstantSave) || _stricmp(SaveFile.GetExtension().c_str(), ".zip") == 0)
|
||||
{
|
||||
//If ziping save add .zip on the end
|
||||
// If zipping save add .zip on the end
|
||||
if (!SaveFile.Exists() && _stricmp(SaveFile.GetExtension().c_str(), ".zip") != 0)
|
||||
{
|
||||
SaveFile.SetNameExtension(stdstr_f("%s.zip", SaveFile.GetNameExtension().c_str()).c_str());
|
||||
|
@ -1987,13 +1987,13 @@ bool CN64System::LoadState(const char * FileName)
|
|||
if (!LoadedZipFile && Value == SaveID_0 && port == UNZ_OK)
|
||||
{
|
||||
unzReadCurrentFile(file, &SaveRDRAMSize, sizeof(SaveRDRAMSize));
|
||||
//Check header
|
||||
// Check header
|
||||
|
||||
uint8_t LoadHeader[64];
|
||||
unzReadCurrentFile(file, LoadHeader, 0x40);
|
||||
if (g_Settings->LoadBool(Setting_EnableDisk) && g_Disk)
|
||||
{
|
||||
//Base ROM Information (64DD IPL / Compatible Game ROM) & Disk Info Check
|
||||
// Base ROM information (64DD IPL / compatible game ROM) and disk info check
|
||||
if ((memcmp(LoadHeader, &g_Rom->GetRomAddress()[0x10], 0x20) != 0 ||
|
||||
memcmp(&LoadHeader[0x20], g_Disk->GetDiskAddressID(), 0x20) != 0) &&
|
||||
!g_Notify->AskYesNoQuestion(g_Lang->GetString(MSG_SAVE_STATE_HEADER).c_str()))
|
||||
|
@ -2043,21 +2043,21 @@ bool CN64System::LoadState(const char * FileName)
|
|||
}
|
||||
if (LoadedZipFile && Value == SaveID_1 && port == UNZ_OK)
|
||||
{
|
||||
//Extra Info v1
|
||||
//System Timers Info
|
||||
// Extra info v1
|
||||
// System timers info
|
||||
m_SystemTimer.LoadData(file);
|
||||
}
|
||||
if (LoadedZipFile && Value == SaveID_2 && port == UNZ_OK)
|
||||
{
|
||||
//Extra Info v2 (Project64 2.4)
|
||||
//Disk Interface Info
|
||||
// Extra info v2 (Project64 2.4)
|
||||
// Disk interface info
|
||||
unzReadCurrentFile(file, m_Reg.m_DiskInterface, sizeof(uint32_t) * 22);
|
||||
|
||||
//Recover Disk Seek Address (if the save state is done while loading/saving data)
|
||||
// Recover disk seek address (if the save state is done while loading/saving data)
|
||||
if (g_Disk)
|
||||
DiskBMReadWrite(false);
|
||||
|
||||
//System Timers Info
|
||||
// System timers info
|
||||
m_SystemTimer.LoadData(file);
|
||||
}
|
||||
unzCloseCurrentFile(file);
|
||||
|
@ -2083,12 +2083,12 @@ bool CN64System::LoadState(const char * FileName)
|
|||
|
||||
hSaveFile.Read(&SaveRDRAMSize, sizeof(SaveRDRAMSize));
|
||||
|
||||
//Check header
|
||||
// Check header
|
||||
uint8_t LoadHeader[64];
|
||||
hSaveFile.Read(LoadHeader, 0x40);
|
||||
if (g_Settings->LoadBool(Setting_EnableDisk) && g_Disk)
|
||||
{
|
||||
//Base ROM Information (64DD IPL / Compatible Game ROM) & Disk Info Check
|
||||
// Base ROM information (64DD IPL / compatible game ROM) and disk info check
|
||||
if ((memcmp(LoadHeader, &g_Rom->GetRomAddress()[0x10], 0x20) != 0 ||
|
||||
memcmp(&LoadHeader[0x20], g_Disk->GetDiskAddressID(), 0x20) != 0) &&
|
||||
!g_Notify->AskYesNoQuestion(g_Lang->GetString(MSG_SAVE_STATE_HEADER).c_str()))
|
||||
|
@ -2138,29 +2138,29 @@ bool CN64System::LoadState(const char * FileName)
|
|||
CFile hExtraInfo(ExtraInfo, CFileBase::modeRead);
|
||||
if (hExtraInfo.IsOpen())
|
||||
{
|
||||
//Extra Info version check
|
||||
// Extra info version check
|
||||
hExtraInfo.Read(&Value, sizeof(Value));
|
||||
if (Value != SaveID_1 && Value != SaveID_2)
|
||||
hExtraInfo.SeekToBegin();
|
||||
|
||||
//Disk Interface Info
|
||||
// Disk interface info
|
||||
if (Value == SaveID_2)
|
||||
{
|
||||
hExtraInfo.Read(m_Reg.m_DiskInterface, sizeof(uint32_t) * 22);
|
||||
|
||||
//Recover Disk Seek Address (if the save state is done while loading/saving data)
|
||||
// Recover disk seek address (if the save state is done while loading/saving data)
|
||||
if (g_Disk)
|
||||
DiskBMReadWrite(false);
|
||||
}
|
||||
|
||||
//System Timers Info
|
||||
// System timers info
|
||||
m_SystemTimer.LoadData(hExtraInfo);
|
||||
|
||||
hExtraInfo.Close();
|
||||
}
|
||||
}
|
||||
|
||||
//Fix losing audio in certain games with certain plugins
|
||||
// Fix losing audio in certain games with certain plugins
|
||||
AudioResetOnLoad = g_Settings->LoadBool(Game_AudioResetOnLoad);
|
||||
if (AudioResetOnLoad)
|
||||
{
|
||||
|
@ -2185,12 +2185,12 @@ bool CN64System::LoadState(const char * FileName)
|
|||
}
|
||||
g_Plugins->Audio()->DacrateChanged(SystemType());
|
||||
|
||||
//Fix Random Register
|
||||
// Fix random register
|
||||
while ((int)m_Reg.RANDOM_REGISTER < (int)m_Reg.WIRED_REGISTER)
|
||||
{
|
||||
m_Reg.RANDOM_REGISTER += 32 - m_Reg.WIRED_REGISTER;
|
||||
}
|
||||
//Fix up timer
|
||||
// Fix up timer
|
||||
m_SystemTimer.SetTimer(CSystemTimer::CompareTimer, m_Reg.COMPARE_REGISTER - m_Reg.COUNT_REGISTER, false);
|
||||
m_SystemTimer.SetTimer(CSystemTimer::ViTimer, NextVITimer, false);
|
||||
m_Reg.FixFpuLocations();
|
||||
|
@ -2288,14 +2288,14 @@ void CN64System::RunRSP()
|
|||
|
||||
__except_try()
|
||||
{
|
||||
WriteTrace(TraceRSP, TraceDebug, "do cycles - starting");
|
||||
WriteTrace(TraceRSP, TraceDebug, "Do cycles - starting");
|
||||
g_Plugins->RSP()->DoRspCycles(100);
|
||||
WriteTrace(TraceRSP, TraceDebug, "do cycles - Done");
|
||||
WriteTrace(TraceRSP, TraceDebug, "Do cycles - done");
|
||||
}
|
||||
__except_catch()
|
||||
{
|
||||
WriteTrace(TraceRSP, TraceError, "exception generated");
|
||||
g_Notify->FatalError("CN64System::RunRSP()\nUnknown memory action\n\nEmulation stop");
|
||||
WriteTrace(TraceRSP, TraceError, "Exception generated");
|
||||
g_Notify->FatalError("CN64System::RunRSP()\nUnknown memory action\n\nEmulation stopping");
|
||||
}
|
||||
|
||||
if (Task == 1 && bDelayDP() && ((m_Reg.m_GfxIntrReg & MI_INTR_DP) != 0))
|
||||
|
@ -2328,7 +2328,7 @@ void CN64System::RunRSP()
|
|||
{
|
||||
m_RspBroke = true;
|
||||
}
|
||||
WriteTrace(TraceRSP, TraceDebug, "check interrupts");
|
||||
WriteTrace(TraceRSP, TraceDebug, "Check interrupts");
|
||||
g_Reg->CheckInterrupts();
|
||||
}
|
||||
}
|
||||
|
@ -2347,7 +2347,7 @@ void CN64System::RefreshScreen()
|
|||
|
||||
if (bShowCPUPer()) { CPU_UsageAddr = m_CPU_Usage.StartTimer(Timer_RefreshScreen); }
|
||||
|
||||
//Calculate how many cycles to next refresh
|
||||
// Calculate how many cycles to next refresh
|
||||
if (m_Reg.VI_V_SYNC_REG == 0)
|
||||
{
|
||||
VI_INTR_TIME = 500000;
|
||||
|
@ -2381,13 +2381,13 @@ void CN64System::RefreshScreen()
|
|||
|
||||
__except_try()
|
||||
{
|
||||
WriteTrace(TraceGFXPlugin, TraceDebug, "UpdateScreen Starting");
|
||||
WriteTrace(TraceGFXPlugin, TraceDebug, "UpdateScreen starting");
|
||||
g_Plugins->Gfx()->UpdateScreen();
|
||||
if (g_Debugger != nullptr && HaveDebugger())
|
||||
{
|
||||
g_Debugger->FrameDrawn();
|
||||
}
|
||||
WriteTrace(TraceGFXPlugin, TraceDebug, "UpdateScreen Done");
|
||||
WriteTrace(TraceGFXPlugin, TraceDebug, "UpdateScreen done");
|
||||
}
|
||||
__except_catch()
|
||||
{
|
||||
|
|
|
@ -27,7 +27,7 @@ class CPlugins;
|
|||
class CRSP_Plugin;
|
||||
class CRecompiler;
|
||||
|
||||
//#define TEST_SP_TRACKING //track the SP to make sure all ops pick it up fine
|
||||
//#define TEST_SP_TRACKING // Track the SP to make sure all ops pick it up fine
|
||||
|
||||
class CN64System :
|
||||
public CLogging,
|
||||
|
@ -44,7 +44,7 @@ public:
|
|||
bool m_EndEmulation;
|
||||
SAVE_CHIP_TYPE m_SaveUsing;
|
||||
|
||||
//Methods
|
||||
// Methods
|
||||
static bool LoadFileImage(const char * FileLoc);
|
||||
static bool LoadFileImageIPL(const char * FileLoc);
|
||||
static bool LoadDiskImage(const char * FileLoc, const bool Expansion);
|
||||
|
@ -56,7 +56,7 @@ public:
|
|||
static void CloseSystem(void);
|
||||
|
||||
void CloseCpu();
|
||||
void ExternalEvent(SystemEvent action); //covers gui interacting and timers etc..
|
||||
void ExternalEvent(SystemEvent action); // Covers GUI interactions and timers etc.
|
||||
void StartEmulation(bool NewThread);
|
||||
void EndEmulation();
|
||||
void AlterSpeed(const CSpeedLimiter::ESpeedChange SpeedChange) { m_Limiter.AlterSpeed(SpeedChange); }
|
||||
|
@ -79,29 +79,29 @@ public:
|
|||
uint32_t GetButtons(int32_t Control) const { return m_Buttons[Control]; }
|
||||
CPlugins * GetPlugins() { return m_Plugins; }
|
||||
|
||||
//Variable used to track that the SP is being handled and stays the same as the real SP in sync core
|
||||
// Variable used to track that the SP is being handled and stays the same as the real SP in sync core
|
||||
#ifdef TEST_SP_TRACKING
|
||||
uint32_t m_CurrentSP;
|
||||
#endif
|
||||
//For Sync CPU
|
||||
// For sync CPU
|
||||
void UpdateSyncCPU(CN64System * const SecondCPU, uint32_t const Cycles);
|
||||
void SyncCPU(CN64System * const SecondCPU);
|
||||
void SyncCPUPC(CN64System * const SecondCPU);
|
||||
void SyncSystem();
|
||||
void SyncSystemPC();
|
||||
private:
|
||||
//Make sure plugins can directly access this information
|
||||
// Make sure plugins can directly access this information
|
||||
friend class CGfxPlugin;
|
||||
friend class CAudioPlugin;
|
||||
friend class CRSP_Plugin;
|
||||
friend class CControl_Plugin;
|
||||
|
||||
//Recompiler has access to manipulate and call functions
|
||||
// Recompiler has access to manipulate and call functions
|
||||
friend class CSystemTimer;
|
||||
friend class CRecompiler;
|
||||
friend class CMipsMemoryVM;
|
||||
|
||||
//Used for loading and potentially executing the CPU in its own thread.
|
||||
// Used for loading and potentially executing the CPU in its own thread
|
||||
static void StartEmulationThread(CThread * thread);
|
||||
static bool EmulationStarting(CThread * thread);
|
||||
static void StartEmulationThead();
|
||||
|
@ -114,28 +114,28 @@ private:
|
|||
void InitRegisters(bool bPostPif, CMipsMemoryVM & MMU);
|
||||
void DisplayRSPListCount();
|
||||
|
||||
//CPU Methods
|
||||
// CPU methods
|
||||
void ExecuteRecompiler();
|
||||
void ExecuteInterpret();
|
||||
void ExecuteSyncCPU();
|
||||
|
||||
//Mark information saying that the CPU has stopped
|
||||
// Mark information saying that the CPU has stopped
|
||||
void CpuStopped();
|
||||
|
||||
//Functions in CTLB_CB
|
||||
// Functions in CTLB_CB
|
||||
void TLB_Mapped(uint32_t VAddr, uint32_t Len, uint32_t PAddr, bool bReadOnly);
|
||||
void TLB_Unmaped(uint32_t VAddr, uint32_t Len);
|
||||
void TLB_Changed();
|
||||
|
||||
CPlugins * const m_Plugins; //The plugin container
|
||||
CPlugins * const m_Plugins; // The plugin container
|
||||
CPlugins * m_SyncPlugins;
|
||||
CN64System * m_SyncCPU;
|
||||
CMipsMemoryVM m_MMU_VM; //Memory of the n64
|
||||
CMipsMemoryVM m_MMU_VM; // Memory of the N64
|
||||
CTLB m_TLB;
|
||||
CRegisters m_Reg;
|
||||
CMempak m_Mempak;
|
||||
CFramePerSecond m_FPS;
|
||||
CProfiling m_CPU_Usage; //used to track the cpu usage
|
||||
CProfiling m_CPU_Usage; // Used to track the CPU usage
|
||||
CRecompiler * m_Recomp;
|
||||
CAudio m_Audio;
|
||||
CSpeedLimiter m_Limiter;
|
||||
|
@ -155,24 +155,24 @@ private:
|
|||
bool m_SyncSystem;
|
||||
CRandom m_Random;
|
||||
|
||||
//When Syncing cores this is the PC where it last Sync'ed correctly
|
||||
// When syncing cores this is the PC where it last synced correctly
|
||||
uint32_t m_LastSuccessSyncPC[10];
|
||||
int32_t m_CyclesToSkip;
|
||||
|
||||
//Handle to the cpu thread
|
||||
// Handle to the CPU thread
|
||||
CThread * m_thread;
|
||||
|
||||
//Handle to pause mutex
|
||||
// Handle to pause mutex
|
||||
SyncEvent m_hPauseEvent;
|
||||
|
||||
//No of Alist and Dlist sent to the RSP
|
||||
// Number of Alist and Dlist sent to the RSP
|
||||
uint32_t m_AlistCount, m_DlistCount, m_UnknownCount;
|
||||
|
||||
//list of function that have been called .. used in profiling
|
||||
// List of function that have been called (used in profiling)
|
||||
FUNC_CALLS m_FunctionCalls;
|
||||
|
||||
//list of Save State File IDs
|
||||
const uint32_t SaveID_0 = 0x23D8A6C8; //Main Save State Info (*.pj)
|
||||
const uint32_t SaveID_1 = 0x56D2CD23; //Extra Data v1 (System Timing) Info (*.dat)
|
||||
const uint32_t SaveID_2 = 0x750A6BEB; //Extra Data v2 (Timing + Disk Registers) (*.dat)
|
||||
// List of save state file IDs
|
||||
const uint32_t SaveID_0 = 0x23D8A6C8; // Main save state info (*.pj)
|
||||
const uint32_t SaveID_1 = 0x56D2CD23; // Extra data v1 (system timing) info (*.dat)
|
||||
const uint32_t SaveID_2 = 0x750A6BEB; // Extra data v2 (timing + disk registers) (*.dat)
|
||||
};
|
||||
|
|
|
@ -2,12 +2,13 @@
|
|||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* The limits of COP1 extend to native SSE2 register capabilities, but for
|
||||
* now this is only being included to dodge the MSVC inline asm for x86.
|
||||
*
|
||||
* As better cross-platform methods of handling FP precision are implemented
|
||||
* for non-Intel-architecture builds, this #include may become obsolete.
|
||||
*/
|
||||
The limits of COP1 extend to native SSE2 register capabilities, but for
|
||||
now this is only being included to dodge the MSVC inline assembler for x86.
|
||||
|
||||
As better cross-platform methods of handling floating point precision are implemented
|
||||
for non-Intel-architecture builds, this #include may become obsolete.
|
||||
*/
|
||||
|
||||
#if defined(__i386) || defined(__x86_64__) || defined(_M_X64)
|
||||
#include <emmintrin.h>
|
||||
#endif
|
||||
|
|
|
@ -10,11 +10,11 @@ public:
|
|||
void RecordTime(PROFILE_TIMERS timer, uint32_t time);
|
||||
uint64_t NonCPUTime(void);
|
||||
|
||||
//recording timing against current timer, returns the address of the timer stopped
|
||||
// Recording timing against the current timer, returns the address of the timer stopped
|
||||
PROFILE_TIMERS StartTimer(PROFILE_TIMERS TimerType);
|
||||
PROFILE_TIMERS StopTimer();
|
||||
|
||||
//Display the CPU Usage
|
||||
// Display the CPU usage
|
||||
void ShowCPU_Usage();
|
||||
|
||||
void ResetTimers(void);
|
||||
|
|
|
@ -94,7 +94,7 @@ union Arm32Opcode
|
|||
uint32_t Hex;
|
||||
uint8_t Ascii[4];
|
||||
|
||||
// uint16 + uint16 type instuction
|
||||
// uint16 + uint16 type instruction
|
||||
struct
|
||||
{
|
||||
unsigned rn : 4;
|
||||
|
|
|
@ -16,9 +16,8 @@ CArmOps::ArmReg CArmOps::m_LastStoreReg;
|
|||
uint16_t CArmOps::m_PopRegisters = 0;
|
||||
uint16_t CArmOps::m_PushRegisters = 0;
|
||||
|
||||
/**************************************************************************
|
||||
* Logging Functions *
|
||||
**************************************************************************/
|
||||
// Logging functions
|
||||
|
||||
void CArmOps::WriteArmComment(const char * Comment)
|
||||
{
|
||||
CPU_Message("");
|
||||
|
@ -126,7 +125,7 @@ void CArmOps::AddConstToArmReg(ArmReg DestReg, ArmReg SourceReg, uint32_t Const)
|
|||
|
||||
if (DestReg == SourceReg && Const == 0)
|
||||
{
|
||||
//ignore
|
||||
// Ignore
|
||||
}
|
||||
else if ((Const & 0xFFFFFFF8) == 0 && DestReg <= 7 && SourceReg <= 7)
|
||||
{
|
||||
|
@ -836,7 +835,7 @@ void CArmOps::PushArmReg(uint16_t Registers)
|
|||
{
|
||||
if (Registers == m_PopRegisters)
|
||||
{
|
||||
CPU_Message("%s: Ignoring Push/Pop", __FUNCTION__);
|
||||
CPU_Message("%s: Ignoring push/pop", __FUNCTION__);
|
||||
m_PopRegisters = 0;
|
||||
PreOpCheck(Arm_Unknown, false, __FILE__, __LINE__);
|
||||
return;
|
||||
|
@ -1373,7 +1372,7 @@ void CArmOps::XorConstToArmReg(ArmReg DestReg, uint32_t value)
|
|||
|
||||
if (value == 0)
|
||||
{
|
||||
//ignore
|
||||
// Ignore
|
||||
}
|
||||
else if (CanThumbCompressConst(value))
|
||||
{
|
||||
|
|
|
@ -115,13 +115,13 @@ public:
|
|||
|
||||
enum ArmCompareType
|
||||
{
|
||||
ArmBranch_Equal = 0, //Code = 0000
|
||||
ArmBranch_Notequal = 1, //Code = 0001
|
||||
ArmBranch_GreaterThanOrEqual = 10, //Code = 1010
|
||||
ArmBranch_LessThan = 11, //Code = 1011
|
||||
ArmBranch_GreaterThan = 12, //Code = 1100
|
||||
ArmBranch_LessThanOrEqual = 13, //Code = 1101
|
||||
ArmBranch_Always = 14, //Code = 1110
|
||||
ArmBranch_Equal = 0, // Code = 0000
|
||||
ArmBranch_Notequal = 1, // Code = 0001
|
||||
ArmBranch_GreaterThanOrEqual = 10, // Code = 1010
|
||||
ArmBranch_LessThan = 11, // Code = 1011
|
||||
ArmBranch_GreaterThan = 12, // Code = 1100
|
||||
ArmBranch_LessThanOrEqual = 13, // Code = 1101
|
||||
ArmBranch_Always = 14, // Code = 1110
|
||||
};
|
||||
|
||||
enum ArmItMask
|
||||
|
@ -144,7 +144,7 @@ public:
|
|||
};
|
||||
|
||||
protected:
|
||||
//Logging Functions
|
||||
// Logging functions
|
||||
static void WriteArmComment(const char * Comment);
|
||||
static void WriteArmLabel(const char * Label);
|
||||
|
||||
|
|
|
@ -166,7 +166,8 @@ void CArmRecompilerOps::Compile_TrapCompare(TRAP_COMPARE CompareType)
|
|||
}
|
||||
}
|
||||
|
||||
/************************** Branch functions ************************/
|
||||
// Branch functions
|
||||
|
||||
void CArmRecompilerOps::Compile_BranchCompare(BRANCH_COMPARE CompareType)
|
||||
{
|
||||
switch (CompareType)
|
||||
|
@ -643,7 +644,7 @@ void CArmRecompilerOps::BNE_Compare()
|
|||
if (m_Section->m_Jump.FallThrough)
|
||||
{
|
||||
Jump = *g_RecompPos;
|
||||
BranchLabel8(ArmBranch_Notequal, "continue");
|
||||
BranchLabel8(ArmBranch_Notequal, "Continue");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -721,7 +722,7 @@ void CArmRecompilerOps::BNE_Compare()
|
|||
if (m_Section->m_Jump.FallThrough)
|
||||
{
|
||||
Jump = *g_RecompPos;
|
||||
BranchLabel8(ArmBranch_Notequal, "continue");
|
||||
BranchLabel8(ArmBranch_Notequal, "Continue");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -810,7 +811,7 @@ void CArmRecompilerOps::BNE_Compare()
|
|||
if (m_Section->m_Jump.FallThrough)
|
||||
{
|
||||
Jump = *g_RecompPos;
|
||||
BranchLabel8(ArmBranch_Notequal, "continue");
|
||||
BranchLabel8(ArmBranch_Notequal, "Continue");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -885,7 +886,7 @@ void CArmRecompilerOps::BNE_Compare()
|
|||
if (m_Section->m_Jump.FallThrough)
|
||||
{
|
||||
Jump = *g_RecompPos;
|
||||
BranchLabel8(ArmBranch_Notequal, "continue");
|
||||
BranchLabel8(ArmBranch_Notequal, "Continue");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -980,7 +981,7 @@ void CArmRecompilerOps::BEQ_Compare()
|
|||
if (m_Section->m_Cont.FallThrough)
|
||||
{
|
||||
Jump = *g_RecompPos;
|
||||
BranchLabel8(ArmBranch_Notequal, "continue");
|
||||
BranchLabel8(ArmBranch_Notequal, "Continue");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1057,7 +1058,7 @@ void CArmRecompilerOps::BEQ_Compare()
|
|||
if (m_Section->m_Cont.FallThrough)
|
||||
{
|
||||
Jump = *g_RecompPos;
|
||||
BranchLabel8(ArmBranch_Notequal, "continue");
|
||||
BranchLabel8(ArmBranch_Notequal, "Continue");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1141,7 +1142,7 @@ void CArmRecompilerOps::BEQ_Compare()
|
|||
if (m_Section->m_Cont.FallThrough)
|
||||
{
|
||||
Jump = *g_RecompPos;
|
||||
BranchLabel8(ArmBranch_Notequal, "continue");
|
||||
BranchLabel8(ArmBranch_Notequal, "Continue");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1204,7 +1205,7 @@ void CArmRecompilerOps::BEQ_Compare()
|
|||
if (m_Section->m_Cont.FallThrough)
|
||||
{
|
||||
Jump = *g_RecompPos;
|
||||
BranchLabel8(ArmBranch_Notequal, "continue");
|
||||
BranchLabel8(ArmBranch_Notequal, "Continue");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1328,12 +1329,12 @@ void CArmRecompilerOps::BGTZ_Compare()
|
|||
BranchLabel20(ArmBranch_LessThan, m_Section->m_Cont.BranchLabel.c_str());
|
||||
m_Section->m_Cont.LinkLocation = (uint32_t *)(*g_RecompPos - 4);
|
||||
Jump = *g_RecompPos;
|
||||
BranchLabel8(ArmBranch_GreaterThan, "continue");
|
||||
BranchLabel8(ArmBranch_GreaterThan, "Continue");
|
||||
}
|
||||
else if (m_Section->m_Cont.FallThrough)
|
||||
{
|
||||
Jump = *g_RecompPos;
|
||||
BranchLabel8(ArmBranch_LessThan, "continue");
|
||||
BranchLabel8(ArmBranch_LessThan, "Continue");
|
||||
BranchLabel20(ArmBranch_GreaterThan, m_Section->m_Jump.BranchLabel.c_str());
|
||||
m_Section->m_Jump.LinkLocation = (uint32_t *)(*g_RecompPos - 4);
|
||||
}
|
||||
|
@ -1829,7 +1830,8 @@ void CArmRecompilerOps::COP1_BCT_Compare()
|
|||
}
|
||||
}
|
||||
|
||||
/************************* OpCode functions *************************/
|
||||
// Opcode functions
|
||||
|
||||
void CArmRecompilerOps::J()
|
||||
{
|
||||
if (m_NextInstruction == NORMAL)
|
||||
|
@ -2335,8 +2337,8 @@ void CArmRecompilerOps::LW(bool ResultSigned, bool bRecordLLBit)
|
|||
if (g_System->bFastSP() && m_Opcode.rt == 29)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
/*ResetX86Protection();
|
||||
ResetMemoryStack();*/
|
||||
//ResetX86Protection();
|
||||
//ResetMemoryStack();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3671,7 +3673,7 @@ void CArmRecompilerOps::SPECIAL_SLT()
|
|||
MoveConstToArmReg(useRdReg ? GetMipsRegMapLo(m_Opcode.rd) : UnknownArmReg, (uint16_t)0);
|
||||
|
||||
CPU_Message("");
|
||||
CPU_Message(" Continue:");
|
||||
CPU_Message(" continue:");
|
||||
SetJump8(JumpContinue, *g_RecompPos);
|
||||
if (!useRdReg)
|
||||
{
|
||||
|
@ -3754,7 +3756,7 @@ void CArmRecompilerOps::SPECIAL_SLT()
|
|||
MoveConstToArmReg(useRdReg ? GetMipsRegMapLo(m_Opcode.rd) : TempRegRt, (uint16_t)1);
|
||||
MoveConstToArmReg(useRdReg ? GetMipsRegMapLo(m_Opcode.rd) : TempRegRt, (uint16_t)0);
|
||||
CPU_Message("");
|
||||
CPU_Message(" Continue:");
|
||||
CPU_Message(" continue:");
|
||||
SetJump8(JumpContinue, *g_RecompPos);
|
||||
if (!useRdReg)
|
||||
{
|
||||
|
@ -3923,14 +3925,15 @@ void CArmRecompilerOps::SPECIAL_DSRA32()
|
|||
}
|
||||
}
|
||||
|
||||
/************************** COP0 functions **************************/
|
||||
// COP0 functions
|
||||
|
||||
void CArmRecompilerOps::COP0_MF()
|
||||
{
|
||||
if (m_Opcode.rt != 0) { UnMap_GPR(m_Opcode.rt, true); }
|
||||
|
||||
switch (m_Opcode.rd)
|
||||
{
|
||||
case 9: //Count
|
||||
case 9: // Count
|
||||
m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() - g_System->CountPerOp());
|
||||
UpdateCounters(m_RegWorkingSet, false, true);
|
||||
m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() + g_System->CountPerOp());
|
||||
|
@ -3952,21 +3955,21 @@ void CArmRecompilerOps::COP0_MT()
|
|||
|
||||
switch (m_Opcode.rd)
|
||||
{
|
||||
case 0: //Index
|
||||
case 2: //EntryLo0
|
||||
case 3: //EntryLo1
|
||||
case 4: //Context
|
||||
case 5: //PageMask
|
||||
case 10: //Entry Hi
|
||||
case 12: //Status
|
||||
case 13: //cause
|
||||
case 14: //EPC
|
||||
case 16: //Config
|
||||
case 18: //WatchLo
|
||||
case 19: //WatchHi
|
||||
case 28: //Tag lo
|
||||
case 29: //Tag Hi
|
||||
case 30: //ErrEPC
|
||||
case 0: // Index
|
||||
case 2: // EntryLo0
|
||||
case 3: // EntryLo1
|
||||
case 4: // Context
|
||||
case 5: // PageMask
|
||||
case 10: // Entry Hi
|
||||
case 12: // Status
|
||||
case 13: // Cause
|
||||
case 14: // EPC
|
||||
case 16: // Config
|
||||
case 18: // WatchLo
|
||||
case 19: // WatchHi
|
||||
case 28: // Tag Lo
|
||||
case 29: // Tag Hi
|
||||
case 30: // ErrEPC
|
||||
if (g_Settings->LoadBool(Game_32Bit))
|
||||
{
|
||||
CompileInterpterCall((void *)R4300iOp32::COP0_MT, "R4300iOp32::COP0_MT");
|
||||
|
@ -3976,9 +3979,9 @@ void CArmRecompilerOps::COP0_MT()
|
|||
CompileInterpterCall((void *)R4300iOp::COP0_MT, "R4300iOp::COP0_MT");
|
||||
}
|
||||
break;
|
||||
case 6: //Wired
|
||||
case 9: //Count
|
||||
case 11: //Compare
|
||||
case 6: // Wired
|
||||
case 9: // Count
|
||||
case 11: // Compare
|
||||
m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() - g_System->CountPerOp());
|
||||
UpdateCounters(m_RegWorkingSet, false, true);
|
||||
m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() + g_System->CountPerOp());
|
||||
|
@ -4080,7 +4083,8 @@ void CArmRecompilerOps::COP0_CO_ERET()
|
|||
m_NextInstruction = END_BLOCK;
|
||||
}
|
||||
|
||||
/************************** COP1 functions **************************/
|
||||
// COP1 functions
|
||||
|
||||
void CArmRecompilerOps::COP1_MF()
|
||||
{
|
||||
CompileCop1Test();
|
||||
|
@ -4952,7 +4956,7 @@ void CArmRecompilerOps::SyncRegState(const CRegInfo & SyncTo)
|
|||
if (m_RegWorkingSet.GetArmRegMapped((ArmReg)i) == CArmRegInfo::GPR_Mapped)
|
||||
{
|
||||
bool moved_gpr_mapping = false;
|
||||
//See if mapped, if so move it
|
||||
// See if mapped, if so move it
|
||||
for (uint32_t z = 0; z < 16; z++)
|
||||
{
|
||||
if (SyncTo.GetArmRegMapped((ArmReg)z) != CArmRegInfo::GPR_Mapped)
|
||||
|
@ -4984,7 +4988,7 @@ void CArmRecompilerOps::SyncRegState(const CRegInfo & SyncTo)
|
|||
}
|
||||
}
|
||||
bool moved = false;
|
||||
//See if mapped, if so move it
|
||||
// See if mapped, if so move it
|
||||
for (uint32_t z = i + 1; z < 16; z++)
|
||||
{
|
||||
if (m_RegWorkingSet.GetArmRegMapped((ArmReg)z) == CArmRegInfo::Variable_Mapped &&
|
||||
|
@ -5010,7 +5014,7 @@ void CArmRecompilerOps::SyncRegState(const CRegInfo & SyncTo)
|
|||
if (m_RegWorkingSet.GetArmRegMapped((ArmReg)i) == CArmRegInfo::Variable_Mapped &&
|
||||
m_RegWorkingSet.GetVariableMappedTo((ArmReg)i) != SyncTo.GetVariableMappedTo((ArmReg)i))
|
||||
{
|
||||
//See if mapped, if so move it
|
||||
// See if mapped, if so move it
|
||||
for (uint32_t z = i + 1; z < 16; z++)
|
||||
{
|
||||
if (SyncTo.GetArmRegMapped((ArmReg)z) != CArmRegInfo::Variable_Mapped ||
|
||||
|
@ -5053,14 +5057,14 @@ void CArmRecompilerOps::SyncRegState(const CRegInfo & SyncTo)
|
|||
else if (MemStackReg == x86_Unknown)
|
||||
{
|
||||
UnMap_X86reg(TargetStackReg);
|
||||
CPU_Message(" regcache: allocate %s as Memory Stack", x86_Name(TargetStackReg));
|
||||
CPU_Message(" regcache: allocate %s as memory stack", x86_Name(TargetStackReg));
|
||||
m_RegWorkingSet.SetX86Mapped(TargetStackReg, CRegInfo::Stack_Mapped);
|
||||
MoveVariableToX86reg(&g_Recompiler->MemoryStackPos(), "MemoryStack", TargetStackReg);
|
||||
}
|
||||
else
|
||||
{
|
||||
UnMap_X86reg(TargetStackReg);
|
||||
CPU_Message(" regcache: change allocation of Memory Stack from %s to %s", x86_Name(MemStackReg), x86_Name(TargetStackReg));
|
||||
CPU_Message(" regcache: change allocation of memory stack from %s to %s", x86_Name(MemStackReg), x86_Name(TargetStackReg));
|
||||
m_RegWorkingSet.SetX86Mapped(TargetStackReg, CRegInfo::Stack_Mapped);
|
||||
m_RegWorkingSet.SetX86Mapped(MemStackReg, CRegInfo::NotMapped);
|
||||
MoveX86RegToX86Reg(MemStackReg, TargetStackReg);
|
||||
|
@ -5103,12 +5107,12 @@ void CArmRecompilerOps::SyncRegState(const CRegInfo & SyncTo)
|
|||
case CRegInfo::STATE_CONST_32_SIGN:
|
||||
if (GetMipsRegLo(i) != SyncTo.GetMipsRegLo(i))
|
||||
{
|
||||
CPU_Message("Value of const is different Reg %d (%s) Value: 0x%08X to 0x%08X", i, CRegName::GPR[i], GetMipsRegLo(i), SyncTo.GetMipsRegLo(i));
|
||||
CPU_Message("Value of constant is different register %d (%s) Value: 0x%08X to 0x%08X", i, CRegName::GPR[i], GetMipsRegLo(i), SyncTo.GetMipsRegLo(i));
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
continue;
|
||||
default:
|
||||
CPU_Message("Unhandled Reg state %d\nin SyncRegState", GetMipsRegState(i));
|
||||
CPU_Message("Unhandled register state %d\nin SyncRegState", GetMipsRegState(i));
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
}
|
||||
|
@ -5258,7 +5262,7 @@ void CArmRecompilerOps::SyncRegState(const CRegInfo & SyncTo)
|
|||
case CRegInfo::STATE_CONST_32_SIGN:
|
||||
if (!g_System->b32BitCore() && GetMipsRegLo_S(i) < 0)
|
||||
{
|
||||
CPU_Message("Sign Problems in SyncRegState\nSTATE_MAPPED_32_ZERO");
|
||||
CPU_Message("Sign problems in SyncRegState\nSTATE_MAPPED_32_ZERO");
|
||||
CPU_Message("%s: %X", CRegName::GPR[i], GetMipsRegLo_S(i));
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
@ -5503,7 +5507,7 @@ bool CArmRecompilerOps::InheritParentInfo()
|
|||
return true;
|
||||
}
|
||||
|
||||
//Multiple Parents
|
||||
// Multiple parents
|
||||
BLOCK_PARENT_LIST ParentList;
|
||||
CCodeSection::SECTION_LIST::iterator iter;
|
||||
for (iter = m_Section->m_ParentSection.begin(); iter != m_Section->m_ParentSection.end(); iter++)
|
||||
|
@ -5576,7 +5580,7 @@ bool CArmRecompilerOps::InheritParentInfo()
|
|||
FirstParent = 0;
|
||||
}
|
||||
|
||||
//Link First Parent to start
|
||||
// Link first parent to start
|
||||
CCodeSection * Parent = ParentList[FirstParent].Parent;
|
||||
CJumpInfo * JumpInfo = ParentList[FirstParent].JumpInfo;
|
||||
|
||||
|
@ -5610,7 +5614,7 @@ bool CArmRecompilerOps::InheritParentInfo()
|
|||
}
|
||||
JumpInfo->FallThrough = false;
|
||||
|
||||
//determine loop reg usage
|
||||
// Determine loop register usage
|
||||
if (m_Section->m_InLoop && ParentList.size() > 1)
|
||||
{
|
||||
if (!SetupRegisterForLoop(m_Section->m_BlockInfo, m_Section->m_RegEnter)) { return false; }
|
||||
|
@ -5632,7 +5636,7 @@ bool CArmRecompilerOps::InheritParentInfo()
|
|||
|
||||
if (m_RegWorkingSet.GetRoundingModel() != RegSet->GetRoundingModel()) { m_RegWorkingSet.SetRoundingModel(CRegInfo::RoundUnknown); }
|
||||
|
||||
//Find Parent MapRegState
|
||||
// Find parent MapRegState
|
||||
/*MemoryStackPos = x86_Unknown;
|
||||
for (i2 = 0; i2 < sizeof(x86_Registers) / sizeof(x86_Registers[0]); i2++)
|
||||
{
|
||||
|
@ -5644,7 +5648,7 @@ bool CArmRecompilerOps::InheritParentInfo()
|
|||
}
|
||||
if (MemoryStackPos == x86_Unknown)
|
||||
{
|
||||
// if the memory stack position is not mapped then unmap it
|
||||
// If the memory stack position is not mapped then unmap it
|
||||
x86Reg MemStackReg = Get_MemoryStack();
|
||||
if (MemStackReg != x86_Unknown)
|
||||
{
|
||||
|
@ -5686,7 +5690,7 @@ bool CArmRecompilerOps::InheritParentInfo()
|
|||
}
|
||||
break;
|
||||
default:
|
||||
CPU_Message("Unknown CPU State(%d) in InheritParentInfo", GetMipsRegState(i2));
|
||||
CPU_Message("Unknown CPU state(%d) in InheritParentInfo", GetMipsRegState(i2));
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
}
|
||||
|
@ -5729,7 +5733,7 @@ bool CArmRecompilerOps::InheritParentInfo()
|
|||
}
|
||||
break;
|
||||
default:
|
||||
CPU_Message("Unknown CPU State(%d) in InheritParentInfo", RegSet->GetMipsRegState(i2));
|
||||
CPU_Message("Unknown CPU state(%d) in InheritParentInfo", RegSet->GetMipsRegState(i2));
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
break;
|
||||
}
|
||||
|
@ -5755,7 +5759,7 @@ bool CArmRecompilerOps::InheritParentInfo()
|
|||
}
|
||||
m_Section->m_RegEnter = m_RegWorkingSet;
|
||||
|
||||
//Sync registers for different blocks
|
||||
// Sync registers for different blocks
|
||||
stdstr_f Label("Section_%d", m_Section->m_SectionID);
|
||||
int CurrentParent = FirstParent;
|
||||
bool NeedSync = false;
|
||||
|
@ -5828,7 +5832,7 @@ bool CArmRecompilerOps::InheritParentInfo()
|
|||
}
|
||||
break;
|
||||
default:
|
||||
WriteTrace(TraceRecompiler, TraceError, "Unhandled Reg state %d\nin InheritParentInfo", GetMipsRegState(i2));
|
||||
WriteTrace(TraceRecompiler, TraceError, "Unhandled register state %d\nin InheritParentInfo", GetMipsRegState(i2));
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
}
|
||||
|
@ -5865,7 +5869,7 @@ bool CArmRecompilerOps::InheritParentInfo()
|
|||
{
|
||||
UpdateCounters(m_RegWorkingSet, false, true);
|
||||
}
|
||||
SyncRegState(m_Section->m_RegEnter); //Sync
|
||||
SyncRegState(m_Section->m_RegEnter); // Sync
|
||||
m_Section->m_RegEnter = m_RegWorkingSet;
|
||||
}
|
||||
|
||||
|
@ -5966,7 +5970,7 @@ void CArmRecompilerOps::UpdateSyncCPU(CRegInfo & RegSet, uint32_t Cycles)
|
|||
{
|
||||
return;
|
||||
}
|
||||
WriteArmComment("Updating Sync CPU");
|
||||
WriteArmComment("Updating sync CPU");
|
||||
RegSet.BeforeCallDirect();
|
||||
MoveConstToArmReg(Arm_R2, Cycles);
|
||||
MoveConstToArmReg(Arm_R1, (uint32_t)g_SyncSystem, "g_SyncSystem");
|
||||
|
@ -5980,7 +5984,7 @@ void CArmRecompilerOps::UpdateCounters(CRegInfo & RegSet, bool CheckTimer, bool
|
|||
if (RegSet.GetBlockCycleCount() != 0)
|
||||
{
|
||||
UpdateSyncCPU(RegSet, RegSet.GetBlockCycleCount());
|
||||
WriteArmComment("Update Counter");
|
||||
WriteArmComment("Update counter");
|
||||
|
||||
ArmReg NextTimerReg = RegSet.Map_Variable(CArmRegInfo::VARIABLE_NEXT_TIMER);
|
||||
ArmReg TempReg = RegSet.Map_TempReg(Arm_Any, -1, false);
|
||||
|
@ -6133,7 +6137,7 @@ void CArmRecompilerOps::SW_Const(uint32_t Value, uint32_t VAddr)
|
|||
default:
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("%s\ntrying to store %08X in %08X?", __FUNCTION__, Value, VAddr).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("%s\nTrying to store %08X in %08X?", __FUNCTION__, Value, VAddr).c_str());
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -6169,10 +6173,10 @@ void CArmRecompilerOps::SW_Const(uint32_t Value, uint32_t VAddr)
|
|||
case 0x0404001C: MoveConstToVariable(0, &g_Reg->SP_SEMAPHORE_REG, "SP_SEMAPHORE_REG"); break;
|
||||
case 0x04080000: MoveConstToVariable(Value & 0xFFC, &g_Reg->SP_PC_REG, "SP_PC_REG"); break;
|
||||
default:
|
||||
CPU_Message(" Should be moving %X in to %08X ?!?", Value, VAddr);
|
||||
CPU_Message(" should be moving %X in to %08X ?", Value, VAddr);
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("%s\ntrying to store %08X in %08X?", __FUNCTION__, Value, VAddr).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("%s\nTrying to store %08X in %08X?", __FUNCTION__, Value, VAddr).c_str());
|
||||
}
|
||||
if (HaveDebugger()) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||
}
|
||||
|
@ -6191,7 +6195,7 @@ void CArmRecompilerOps::SW_Const(uint32_t Value, uint32_t VAddr)
|
|||
default:
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("%s\ntrying to store %08X in %08X?", __FUNCTION__, Value, VAddr).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("%s\nTrying to store %08X in %08X?", __FUNCTION__, Value, VAddr).c_str());
|
||||
}
|
||||
if (HaveDebugger()) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||
}
|
||||
|
@ -6303,10 +6307,10 @@ void CArmRecompilerOps::SW_Const(uint32_t Value, uint32_t VAddr)
|
|||
}
|
||||
break;
|
||||
default:
|
||||
CPU_Message(" Should be moving %X in to %08X ?!?", Value, VAddr);
|
||||
CPU_Message(" should be moving %X in to %08X ?", Value, VAddr);
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("%s\ntrying to store %08X in %08X?", __FUNCTION__, Value, VAddr).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("%s\nTrying to store %08X in %08X?", __FUNCTION__, Value, VAddr).c_str());
|
||||
}
|
||||
if (HaveDebugger()) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||
}
|
||||
|
@ -6324,7 +6328,7 @@ void CArmRecompilerOps::SW_Const(uint32_t Value, uint32_t VAddr)
|
|||
CompareArmRegToArmReg(TempReg, TempValueReg);
|
||||
|
||||
uint8_t * Jump = *g_RecompPos;
|
||||
BranchLabel8(ArmBranch_Equal, "continue");
|
||||
BranchLabel8(ArmBranch_Equal, "Continue");
|
||||
|
||||
m_RegWorkingSet.BeforeCallDirect();
|
||||
ArmReg VariableReg = TempValueReg != Arm_R1 ? Arm_R1 : Arm_R2;
|
||||
|
@ -6349,7 +6353,7 @@ void CArmRecompilerOps::SW_Const(uint32_t Value, uint32_t VAddr)
|
|||
CompareArmRegToArmReg(TempReg, TempValueReg);
|
||||
|
||||
uint8_t * Jump = *g_RecompPos;
|
||||
BranchLabel8(ArmBranch_Equal, "continue");
|
||||
BranchLabel8(ArmBranch_Equal, "Continue");
|
||||
|
||||
MoveArmRegToVariable(TempValueReg, &g_Reg->VI_WIDTH_REG, "VI_WIDTH_REG");
|
||||
m_RegWorkingSet.BeforeCallDirect();
|
||||
|
@ -6357,7 +6361,7 @@ void CArmRecompilerOps::SW_Const(uint32_t Value, uint32_t VAddr)
|
|||
m_RegWorkingSet.AfterCallDirect();
|
||||
FlushPopArmReg();
|
||||
CPU_Message("");
|
||||
CPU_Message(" Continue:");
|
||||
CPU_Message(" continue:");
|
||||
SetJump8(Jump, *g_RecompPos);
|
||||
}
|
||||
break;
|
||||
|
@ -6379,15 +6383,15 @@ void CArmRecompilerOps::SW_Const(uint32_t Value, uint32_t VAddr)
|
|||
case 0x04400030: MoveConstToVariable(Value, &g_Reg->VI_X_SCALE_REG, "VI_X_SCALE_REG"); break;
|
||||
case 0x04400034: MoveConstToVariable(Value, &g_Reg->VI_Y_SCALE_REG, "VI_Y_SCALE_REG"); break;
|
||||
default:
|
||||
CPU_Message(" Should be moving %X in to %08X ?!?", Value, VAddr);
|
||||
CPU_Message(" should be moving %X in to %08X ?", Value, VAddr);
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("%s\ntrying to store %08X in %08X?", __FUNCTION__, Value, VAddr).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("%s\nTrying to store %08X in %08X?", __FUNCTION__, Value, VAddr).c_str());
|
||||
}
|
||||
if (HaveDebugger()) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||
}
|
||||
break;
|
||||
case 0x04500000: /* AI registers */
|
||||
case 0x04500000: // AI registers
|
||||
switch (PAddr)
|
||||
{
|
||||
case 0x04500000: MoveConstToVariable(Value, &g_Reg->AI_DRAM_ADDR_REG, "AI_DRAM_ADDR_REG"); break;
|
||||
|
@ -6408,7 +6412,7 @@ void CArmRecompilerOps::SW_Const(uint32_t Value, uint32_t VAddr)
|
|||
break;
|
||||
case 0x04500008: MoveConstToVariable((Value & 1), &g_Reg->AI_CONTROL_REG, "AI_CONTROL_REG"); break;
|
||||
case 0x0450000C:
|
||||
/* Clear Interrupt */;
|
||||
// Clear interrupt
|
||||
AndConstToVariable(&g_Reg->MI_INTR_REG, "MI_INTR_REG", (uint32_t)~MI_INTR_AI);
|
||||
AndConstToVariable(&g_Reg->m_AudioIntrReg, "m_AudioIntrReg", (uint32_t)~MI_INTR_AI);
|
||||
m_RegWorkingSet.BeforeCallDirect();
|
||||
|
@ -6426,10 +6430,10 @@ void CArmRecompilerOps::SW_Const(uint32_t Value, uint32_t VAddr)
|
|||
break;
|
||||
case 0x04500014: MoveConstToVariable(Value, &g_Reg->AI_BITRATE_REG, "AI_BITRATE_REG"); break;
|
||||
default:
|
||||
CPU_Message(" Should be moving %X in to %08X ?!?", Value, VAddr);
|
||||
CPU_Message(" should be moving %X in to %08X ?", Value, VAddr);
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("%s\ntrying to store %08X in %08X?", __FUNCTION__, Value, VAddr).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("%s\nTrying to store %08X in %08X?", __FUNCTION__, Value, VAddr).c_str());
|
||||
}
|
||||
if (HaveDebugger()) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||
}
|
||||
|
@ -6475,10 +6479,10 @@ void CArmRecompilerOps::SW_Const(uint32_t Value, uint32_t VAddr)
|
|||
case 0x0460002C: MoveConstToVariable((Value & 0xFF), &g_Reg->PI_BSD_DOM2_PGS_REG, "PI_BSD_DOM2_PGS_REG"); break;
|
||||
case 0x04600030: MoveConstToVariable((Value & 0xFF), &g_Reg->PI_BSD_DOM2_RLS_REG, "PI_BSD_DOM2_RLS_REG"); break;
|
||||
default:
|
||||
CPU_Message(" Should be moving %X in to %08X ?!?", Value, VAddr);
|
||||
CPU_Message(" should be moving %X in to %08X ?", Value, VAddr);
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("%s\ntrying to store %08X in %08X?", __FUNCTION__, Value, VAddr).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("%s\nTrying to store %08X in %08X?", __FUNCTION__, Value, VAddr).c_str());
|
||||
}
|
||||
if (HaveDebugger()) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||
}
|
||||
|
@ -6491,10 +6495,10 @@ void CArmRecompilerOps::SW_Const(uint32_t Value, uint32_t VAddr)
|
|||
case 0x04700008: MoveConstToVariable(Value, &g_Reg->RI_CURRENT_LOAD_REG, "RI_CURRENT_LOAD_REG"); break;
|
||||
case 0x0470000C: MoveConstToVariable(Value, &g_Reg->RI_SELECT_REG, "RI_SELECT_REG"); break;
|
||||
default:
|
||||
CPU_Message(" Should be moving %X in to %08X ?!?", Value, VAddr);
|
||||
CPU_Message(" should be moving %X in to %08X ?", Value, VAddr);
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("%s\ntrying to store %08X in %08X?", __FUNCTION__, Value, VAddr).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("%s\nTrying to store %08X in %08X?", __FUNCTION__, Value, VAddr).c_str());
|
||||
}
|
||||
if (HaveDebugger()) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||
}
|
||||
|
@ -6532,16 +6536,16 @@ void CArmRecompilerOps::SW_Const(uint32_t Value, uint32_t VAddr)
|
|||
m_RegWorkingSet.AfterCallDirect();
|
||||
break;
|
||||
default:
|
||||
CPU_Message(" Should be moving %X in to %08X ?!?", Value, VAddr);
|
||||
CPU_Message(" should be moving %X in to %08X ?", Value, VAddr);
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("%s\ntrying to store %08X in %08X?", __FUNCTION__, Value, VAddr).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("%s\nTrying to store %08X in %08X?", __FUNCTION__, Value, VAddr).c_str());
|
||||
}
|
||||
if (HaveDebugger()) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||
}
|
||||
break;
|
||||
case 0x05000000:
|
||||
//64DD Registers
|
||||
// 64DD registers
|
||||
if (g_Settings->LoadBool(Setting_EnableDisk))
|
||||
{
|
||||
switch (PAddr)
|
||||
|
@ -6552,10 +6556,10 @@ void CArmRecompilerOps::SW_Const(uint32_t Value, uint32_t VAddr)
|
|||
m_RegWorkingSet.AfterCallDirect();
|
||||
break;
|
||||
default:
|
||||
CPU_Message(" Should be moving %X in to %08X ?!?", Value, VAddr);
|
||||
CPU_Message(" should be moving %X in to %08X ?", Value, VAddr);
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("%s\ntrying to store %08X in %08X?", __FUNCTION__, Value, VAddr).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("%s\nTrying to store %08X in %08X?", __FUNCTION__, Value, VAddr).c_str());
|
||||
}
|
||||
if (HaveDebugger()) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||
}
|
||||
|
@ -6574,10 +6578,10 @@ void CArmRecompilerOps::SW_Const(uint32_t Value, uint32_t VAddr)
|
|||
m_RegWorkingSet.AfterCallDirect();
|
||||
break;
|
||||
default:
|
||||
CPU_Message(" Should be moving %X in to %08X ?!?", Value, VAddr);
|
||||
CPU_Message(" should be moving %X in to %08X ?", Value, VAddr);
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("%s\ntrying to store %08X in %08X?", __FUNCTION__, Value, VAddr).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("%s\nTrying to store %08X in %08X?", __FUNCTION__, Value, VAddr).c_str());
|
||||
}
|
||||
if (HaveDebugger()) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||
}
|
||||
|
@ -6641,10 +6645,10 @@ void CArmRecompilerOps::SW_Register(ArmReg Reg, uint32_t VAddr)
|
|||
case 0x03F8000C: break;
|
||||
case 0x03F80014: break;
|
||||
default:
|
||||
CPU_Message(" Should be moving %s in to %08X ?!?", ArmRegName(Reg), VAddr);
|
||||
CPU_Message(" should be moving %s in to %08X ?", ArmRegName(Reg), VAddr);
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("%s\ntrying to store in %08X?", __FUNCTION__, VAddr).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("%s\nTrying to store in %08X?", __FUNCTION__, VAddr).c_str());
|
||||
}
|
||||
if (HaveDebugger()) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||
}
|
||||
|
@ -6689,10 +6693,10 @@ void CArmRecompilerOps::SW_Register(ArmReg Reg, uint32_t VAddr)
|
|||
}
|
||||
else
|
||||
{
|
||||
CPU_Message(" Should be moving %s in to %08X ?!?", ArmRegName(Reg), VAddr);
|
||||
CPU_Message(" should be moving %s in to %08X ?", ArmRegName(Reg), VAddr);
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("%s\ntrying to store in %08X?", __FUNCTION__, VAddr).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("%s\nTrying to store in %08X?", __FUNCTION__, VAddr).c_str());
|
||||
}
|
||||
if (HaveDebugger()) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||
}
|
||||
|
@ -6732,10 +6736,10 @@ void CArmRecompilerOps::SW_Register(ArmReg Reg, uint32_t VAddr)
|
|||
m_RegWorkingSet.AfterCallDirect();
|
||||
break;
|
||||
default:
|
||||
CPU_Message(" Should be moving %s in to %08X ?!?", ArmRegName(Reg), VAddr);
|
||||
CPU_Message(" should be moving %s in to %08X ?", ArmRegName(Reg), VAddr);
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("%s\ntrying to store in %08X?", __FUNCTION__, VAddr).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("%s\nTrying to store in %08X?", __FUNCTION__, VAddr).c_str());
|
||||
}
|
||||
if (HaveDebugger()) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||
}
|
||||
|
@ -6750,7 +6754,7 @@ void CArmRecompilerOps::SW_Register(ArmReg Reg, uint32_t VAddr)
|
|||
CompareArmRegToArmReg(TempReg, Reg);
|
||||
|
||||
uint8_t * Jump = *g_RecompPos;
|
||||
BranchLabel8(ArmBranch_Equal, "continue");
|
||||
BranchLabel8(ArmBranch_Equal, "Continue");
|
||||
|
||||
MoveArmRegToVariable(Reg, &g_Reg->VI_STATUS_REG, "VI_STATUS_REG");
|
||||
m_RegWorkingSet.BeforeCallDirect();
|
||||
|
@ -6758,7 +6762,7 @@ void CArmRecompilerOps::SW_Register(ArmReg Reg, uint32_t VAddr)
|
|||
m_RegWorkingSet.AfterCallDirect();
|
||||
FlushPopArmReg();
|
||||
CPU_Message("");
|
||||
CPU_Message(" Continue:");
|
||||
CPU_Message(" continue:");
|
||||
SetJump8(Jump, *g_RecompPos);
|
||||
}
|
||||
break;
|
||||
|
@ -6782,7 +6786,7 @@ void CArmRecompilerOps::SW_Register(ArmReg Reg, uint32_t VAddr)
|
|||
m_RegWorkingSet.AfterCallDirect();
|
||||
FlushPopArmReg();
|
||||
CPU_Message("");
|
||||
CPU_Message(" Continue:");
|
||||
CPU_Message(" continue:");
|
||||
SetJump8(Jump, *g_RecompPos);
|
||||
}
|
||||
break;
|
||||
|
@ -6804,14 +6808,14 @@ void CArmRecompilerOps::SW_Register(ArmReg Reg, uint32_t VAddr)
|
|||
case 0x04400030: MoveArmRegToVariable(Reg, &g_Reg->VI_X_SCALE_REG, "VI_X_SCALE_REG"); break;
|
||||
case 0x04400034: MoveArmRegToVariable(Reg, &g_Reg->VI_Y_SCALE_REG, "VI_Y_SCALE_REG"); break;
|
||||
default:
|
||||
CPU_Message(" Should be moving %s in to %08X ?!?", ArmRegName(Reg), VAddr);
|
||||
CPU_Message(" should be moving %s in to %08X ?", ArmRegName(Reg), VAddr);
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("%s\ntrying to store in %08X?", __FUNCTION__, VAddr).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("%s\nTrying to store in %08X?", __FUNCTION__, VAddr).c_str());
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0x04500000: /* AI registers */
|
||||
case 0x04500000: // AI registers
|
||||
switch (PAddr) {
|
||||
case 0x04500000: MoveArmRegToVariable(Reg, &g_Reg->AI_DRAM_ADDR_REG, "AI_DRAM_ADDR_REG"); break;
|
||||
case 0x04500004:
|
||||
|
@ -6835,7 +6839,7 @@ void CArmRecompilerOps::SW_Register(ArmReg Reg, uint32_t VAddr)
|
|||
MoveArmRegToVariable(Reg, &g_Reg->AI_CONTROL_REG, "AI_CONTROL_REG");
|
||||
AndConstToVariable(&g_Reg->AI_CONTROL_REG, "AI_CONTROL_REG", 1);
|
||||
case 0x0450000C:
|
||||
/* Clear Interrupt */;
|
||||
// Clear interrupt
|
||||
AndConstToVariable(&g_Reg->MI_INTR_REG, "MI_INTR_REG", (uint32_t)~MI_INTR_AI);
|
||||
AndConstToVariable(&g_Reg->m_AudioIntrReg, "m_AudioIntrReg", (uint32_t)~MI_INTR_AI);
|
||||
m_RegWorkingSet.BeforeCallDirect();
|
||||
|
@ -6859,7 +6863,7 @@ void CArmRecompilerOps::SW_Register(ArmReg Reg, uint32_t VAddr)
|
|||
MoveArmRegToVariable(Reg, PAddr + g_MMU->Rdram(), stdstr_f("RDRAM + %X", PAddr).c_str());
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("%s\ntrying to store in %08X?", __FUNCTION__, VAddr).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("%s\nTrying to store in %08X?", __FUNCTION__, VAddr).c_str());
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -6896,7 +6900,7 @@ void CArmRecompilerOps::SW_Register(ArmReg Reg, uint32_t VAddr)
|
|||
case 0x04600010:
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("%s\ntrying to store in %08X?", __FUNCTION__, VAddr).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("%s\nTrying to store in %08X?", __FUNCTION__, VAddr).c_str());
|
||||
}
|
||||
AndConstToVariable(&g_Reg->MI_INTR_REG, "MI_INTR_REG", (uint32_t)~MI_INTR_PI);
|
||||
m_RegWorkingSet.BeforeCallDirect();
|
||||
|
@ -6937,10 +6941,10 @@ void CArmRecompilerOps::SW_Register(ArmReg Reg, uint32_t VAddr)
|
|||
AndConstToVariable(&g_Reg->PI_BSD_DOM2_RLS_REG, "PI_BSD_DOM2_RLS_REG", 0xFF);
|
||||
break;
|
||||
default:
|
||||
CPU_Message(" Should be moving %s in to %08X ?!?", ArmRegName(Reg), VAddr);
|
||||
CPU_Message(" should be moving %s in to %08X ?", ArmRegName(Reg), VAddr);
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("%s\ntrying to store in %08X?", __FUNCTION__, VAddr).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("%s\nTrying to store in %08X?", __FUNCTION__, VAddr).c_str());
|
||||
}
|
||||
if (HaveDebugger()) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||
}
|
||||
|
@ -6953,10 +6957,10 @@ void CArmRecompilerOps::SW_Register(ArmReg Reg, uint32_t VAddr)
|
|||
case 0x0470000C: MoveArmRegToVariable(Reg, &g_Reg->RI_SELECT_REG, "RI_SELECT_REG"); break;
|
||||
case 0x04700010: MoveArmRegToVariable(Reg, &g_Reg->RI_REFRESH_REG, "RI_REFRESH_REG"); break;
|
||||
default:
|
||||
CPU_Message(" Should be moving %s in to %08X ?!?", ArmRegName(Reg), VAddr);
|
||||
CPU_Message(" should be moving %s in to %08X ?", ArmRegName(Reg), VAddr);
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("%s\ntrying to store in %08X?", __FUNCTION__, VAddr).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("%s\nTrying to store in %08X?", __FUNCTION__, VAddr).c_str());
|
||||
}
|
||||
if (HaveDebugger()) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||
}
|
||||
|
@ -6988,23 +6992,23 @@ void CArmRecompilerOps::SW_Register(ArmReg Reg, uint32_t VAddr)
|
|||
m_RegWorkingSet.AfterCallDirect();
|
||||
break;
|
||||
default:
|
||||
CPU_Message(" Should be moving %s in to %08X ?!?", ArmRegName(Reg), VAddr);
|
||||
CPU_Message(" should be moving %s in to %08X ?", ArmRegName(Reg), VAddr);
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("%s\ntrying to store in %08X?", __FUNCTION__, VAddr).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("%s\nTrying to store in %08X?", __FUNCTION__, VAddr).c_str());
|
||||
}
|
||||
if (HaveDebugger()) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||
}
|
||||
break;
|
||||
case 0x05000000:
|
||||
//64DD Registers
|
||||
// 64DD registers
|
||||
if (g_Settings->LoadBool(Setting_EnableDisk))
|
||||
{
|
||||
switch (PAddr)
|
||||
{
|
||||
case 0x05000500: MoveArmRegToVariable(Reg, &g_Reg->ASIC_DATA, "ASIC_DATA"); break;
|
||||
case 0x05000508:
|
||||
//ASIC_CMD
|
||||
// ASIC_CMD
|
||||
MoveArmRegToVariable(Reg, &g_Reg->ASIC_CMD, "ASIC_CMD");
|
||||
m_RegWorkingSet.BeforeCallDirect();
|
||||
CallFunction(AddressOf(&DiskCommand), "DiskCommand");
|
||||
|
@ -7017,7 +7021,7 @@ void CArmRecompilerOps::SW_Register(ArmReg Reg, uint32_t VAddr)
|
|||
m_RegWorkingSet.AfterCallDirect();
|
||||
break;
|
||||
case 0x05000510:
|
||||
//ASIC_BM_CTL
|
||||
// ASIC_BM_CTL
|
||||
MoveArmRegToVariable(Reg, &g_Reg->ASIC_BM_CTL, "ASIC_BM_CTL");
|
||||
m_RegWorkingSet.BeforeCallDirect();
|
||||
CallFunction(AddressOf(&DiskBMControl), "DiskBMControl");
|
||||
|
@ -7040,10 +7044,10 @@ void CArmRecompilerOps::SW_Register(ArmReg Reg, uint32_t VAddr)
|
|||
MoveArmRegToVariable(Reg, PAddr + g_MMU->Rdram(), stdstr_f("RDRAM + %X", PAddr).c_str());
|
||||
break;
|
||||
default:
|
||||
CPU_Message(" Should be moving %s in to %08X ?!?", ArmRegName(Reg), VAddr);
|
||||
CPU_Message(" should be moving %s in to %08X ?", ArmRegName(Reg), VAddr);
|
||||
if (ShowUnhandledMemory())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("%s\ntrying to store in %08X?", __FUNCTION__, VAddr).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("%s\nTrying to store in %08X?", __FUNCTION__, VAddr).c_str());
|
||||
}
|
||||
if (HaveDebugger()) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||
}
|
||||
|
@ -7084,7 +7088,7 @@ void CArmRecompilerOps::LB_KnownAddress(ArmReg Reg, uint32_t VAddr, bool SignExt
|
|||
SignExtendByte(Reg);
|
||||
break;
|
||||
default:
|
||||
CPU_Message(" Should be loading from %08X ?!?", VAddr);
|
||||
CPU_Message(" should be loading from %08X ?", VAddr);
|
||||
if (HaveDebugger()) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||
}
|
||||
}
|
||||
|
@ -7157,7 +7161,7 @@ void CArmRecompilerOps::LW_KnownAddress(ArmReg Reg, uint32_t VAddr)
|
|||
{
|
||||
g_Notify->DisplayError(stdstr_f("%s\nFailed to translate address: %08X", __FUNCTION__, VAddr).c_str());
|
||||
}
|
||||
CPU_Message(" Should be loading from %08X ?!?", VAddr);
|
||||
CPU_Message(" should be loading from %08X ?", VAddr);
|
||||
if (HaveDebugger()) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||
}
|
||||
break;
|
||||
|
@ -7180,7 +7184,7 @@ void CArmRecompilerOps::LW_KnownAddress(ArmReg Reg, uint32_t VAddr)
|
|||
default:
|
||||
MoveConstToArmReg(Reg, (uint32_t)0);
|
||||
if (ShowUnhandledMemory()) { g_Notify->DisplayError(stdstr_f("%s\nFailed to translate address: %08X", __FUNCTION__, VAddr).c_str()); }
|
||||
CPU_Message(" Should be loading from %08X ?!?", VAddr);
|
||||
CPU_Message(" should be loading from %08X ?", VAddr);
|
||||
if (HaveDebugger()) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||
}
|
||||
break;
|
||||
|
@ -7200,11 +7204,11 @@ void CArmRecompilerOps::LW_KnownAddress(ArmReg Reg, uint32_t VAddr)
|
|||
default:
|
||||
MoveConstToArmReg(Reg, (uint32_t)0);
|
||||
if (ShowUnhandledMemory()) { g_Notify->DisplayError(stdstr_f("%s\nFailed to translate address: %08X", __FUNCTION__, VAddr).c_str()); }
|
||||
CPU_Message(" Should be loading from %08X ?!?", VAddr);
|
||||
CPU_Message(" should be loading from %08X ?", VAddr);
|
||||
if (HaveDebugger()) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||
}
|
||||
break;
|
||||
case 0x04500000: /* AI registers */
|
||||
case 0x04500000: // AI registers
|
||||
switch (PAddr)
|
||||
{
|
||||
case 0x04500004:
|
||||
|
@ -7257,7 +7261,7 @@ void CArmRecompilerOps::LW_KnownAddress(ArmReg Reg, uint32_t VAddr)
|
|||
default:
|
||||
MoveConstToArmReg(Reg, (uint32_t)0);
|
||||
if (ShowUnhandledMemory()) { g_Notify->DisplayError(stdstr_f("%s\nFailed to translate address: %08X", __FUNCTION__, VAddr).c_str()); }
|
||||
CPU_Message(" Should be loading from %08X ?!?", VAddr);
|
||||
CPU_Message(" should be loading from %08X ?", VAddr);
|
||||
if (HaveDebugger()) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||
}
|
||||
break;
|
||||
|
@ -7283,7 +7287,7 @@ void CArmRecompilerOps::LW_KnownAddress(ArmReg Reg, uint32_t VAddr)
|
|||
{
|
||||
g_Notify->DisplayError(stdstr_f("%s\nFailed to translate address: %08X", __FUNCTION__, VAddr).c_str());
|
||||
}
|
||||
CPU_Message(" Should be loading from %08X ?!?", VAddr);
|
||||
CPU_Message(" should be loading from %08X ?", VAddr);
|
||||
if (HaveDebugger()) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||
}
|
||||
break;
|
||||
|
@ -7298,7 +7302,7 @@ void CArmRecompilerOps::LW_KnownAddress(ArmReg Reg, uint32_t VAddr)
|
|||
{
|
||||
g_Notify->DisplayError(stdstr_f("%s\nFailed to translate address: %08X", __FUNCTION__, VAddr).c_str());
|
||||
}
|
||||
CPU_Message(" Should be loading from %08X ?!?", VAddr);
|
||||
CPU_Message(" should be loading from %08X ?", VAddr);
|
||||
if (HaveDebugger()) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||
}
|
||||
break;
|
||||
|
@ -7313,12 +7317,12 @@ void CArmRecompilerOps::LW_KnownAddress(ArmReg Reg, uint32_t VAddr)
|
|||
{
|
||||
g_Notify->DisplayError(stdstr_f("%s\nFailed to translate address: %08X", __FUNCTION__, VAddr).c_str());
|
||||
}
|
||||
CPU_Message(" Should be loading from %08X ?!?", VAddr);
|
||||
CPU_Message(" should be loading from %08X ?", VAddr);
|
||||
if (HaveDebugger()) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||
}
|
||||
break;
|
||||
case 0x05000000:
|
||||
//64DD Registers
|
||||
// 64DD registers
|
||||
if (g_Settings->LoadBool(Setting_EnableDisk))
|
||||
{
|
||||
switch (PAddr)
|
||||
|
@ -7353,7 +7357,7 @@ void CArmRecompilerOps::LW_KnownAddress(ArmReg Reg, uint32_t VAddr)
|
|||
{
|
||||
g_Notify->DisplayError(stdstr_f("%s\nFailed to translate address: %08X", __FUNCTION__, VAddr).c_str());
|
||||
}
|
||||
CPU_Message(" Should be loading from %08X ?!?", VAddr);
|
||||
CPU_Message(" should be loading from %08X ?", VAddr);
|
||||
if (HaveDebugger()) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||
}
|
||||
}
|
||||
|
@ -7375,11 +7379,11 @@ void CArmRecompilerOps::LW_KnownAddress(ArmReg Reg, uint32_t VAddr)
|
|||
if ((PAddr & 0xF0000000) == 0x10000000 && (PAddr - 0x10000000) < g_Rom->GetRomSize())
|
||||
{
|
||||
uint32_t RomOffset = PAddr - 0x10000000;
|
||||
MoveVariableToArmReg(RomOffset + g_Rom->GetRomAddress(), stdstr_f("ROM + %X", RomOffset).c_str(), Reg); // read from rom
|
||||
MoveVariableToArmReg(RomOffset + g_Rom->GetRomAddress(), stdstr_f("ROM + %X", RomOffset).c_str(), Reg); // Read from ROM
|
||||
}
|
||||
else
|
||||
{
|
||||
CPU_Message(" Should be loading from %08X ?!?", VAddr);
|
||||
CPU_Message(" should be loading from %08X ?", VAddr);
|
||||
if (HaveDebugger()) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,10 +12,10 @@ class CArmRecompilerOps :
|
|||
public:
|
||||
CArmRecompilerOps();
|
||||
|
||||
/*************************** Trap functions *************************/
|
||||
// Trap functions
|
||||
void Compile_TrapCompare(TRAP_COMPARE CompareType);
|
||||
|
||||
/************************** Branch functions ************************/
|
||||
// Branch functions
|
||||
void Compile_BranchCompare(BRANCH_COMPARE CompareType);
|
||||
void Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE BranchType, bool Link);
|
||||
void Compile_BranchLikely(BRANCH_COMPARE CompareType, bool Link);
|
||||
|
@ -28,7 +28,7 @@ public:
|
|||
void COP1_BCF_Compare();
|
||||
void COP1_BCT_Compare();
|
||||
|
||||
/************************* OpCode functions *************************/
|
||||
// Opcode functions
|
||||
void J ();
|
||||
void JAL ();
|
||||
void ADDI ();
|
||||
|
@ -67,7 +67,7 @@ public:
|
|||
void SDC1 ();
|
||||
void SD ();
|
||||
|
||||
/********************** R4300i OpCodes: Special **********************/
|
||||
// R4300i opcodes: Special
|
||||
void SPECIAL_SLL ();
|
||||
void SPECIAL_SRL ();
|
||||
void SPECIAL_SRA ();
|
||||
|
@ -113,18 +113,18 @@ public:
|
|||
void SPECIAL_DSRL32 ();
|
||||
void SPECIAL_DSRA32 ();
|
||||
|
||||
/************************** COP0 functions **************************/
|
||||
// COP0 functions
|
||||
void COP0_MF ();
|
||||
void COP0_MT ();
|
||||
|
||||
/************************** COP0 CO functions ***********************/
|
||||
// COP0 CO functions
|
||||
void COP0_CO_TLBR ();
|
||||
void COP0_CO_TLBWI ();
|
||||
void COP0_CO_TLBWR ();
|
||||
void COP0_CO_TLBP ();
|
||||
void COP0_CO_ERET ();
|
||||
|
||||
/************************** COP1 functions **************************/
|
||||
// COP1 functions
|
||||
void COP1_MF ();
|
||||
void COP1_DMF ();
|
||||
void COP1_CF ();
|
||||
|
@ -132,7 +132,7 @@ public:
|
|||
void COP1_DMT ();
|
||||
void COP1_CT ();
|
||||
|
||||
/************************** COP1: S functions ************************/
|
||||
// COP1: S functions
|
||||
void COP1_S_ADD ();
|
||||
void COP1_S_SUB ();
|
||||
void COP1_S_MUL ();
|
||||
|
@ -154,7 +154,7 @@ public:
|
|||
void COP1_S_CVT_L ();
|
||||
void COP1_S_CMP ();
|
||||
|
||||
/************************** COP1: D functions ************************/
|
||||
// COP1: D functions
|
||||
void COP1_D_ADD ();
|
||||
void COP1_D_SUB ();
|
||||
void COP1_D_MUL ();
|
||||
|
@ -176,15 +176,15 @@ public:
|
|||
void COP1_D_CVT_L ();
|
||||
void COP1_D_CMP ();
|
||||
|
||||
/************************** COP1: W functions ************************/
|
||||
// COP1: W functions
|
||||
void COP1_W_CVT_S ();
|
||||
void COP1_W_CVT_D ();
|
||||
|
||||
/************************** COP1: L functions ************************/
|
||||
// COP1: L functions
|
||||
void COP1_L_CVT_S ();
|
||||
void COP1_L_CVT_D ();
|
||||
|
||||
/************************** Other functions **************************/
|
||||
// Other functions
|
||||
void UnknownOpcode ();
|
||||
|
||||
private:
|
||||
|
@ -220,7 +220,7 @@ private:
|
|||
void CompileExecuteBP(void);
|
||||
void CompileExecuteDelaySlotBP(void);
|
||||
|
||||
/********* Helper Functions *********/
|
||||
// Helper functions
|
||||
typedef CRegInfo::REG_STATE REG_STATE;
|
||||
|
||||
static inline REG_STATE GetMipsRegState(int32_t Reg) { return m_RegWorkingSet.GetMipsRegState(Reg); }
|
||||
|
|
|
@ -265,7 +265,7 @@ void CArmRegInfo::Map_GPR_32bit(int32_t MipsReg, bool SignValue, int32_t MipsReg
|
|||
{
|
||||
if (Is64Bit(MipsReg))
|
||||
{
|
||||
CPU_Message(" regcache: unallocate %s from high 32bit of %s", ArmRegName(GetMipsRegMapHi(MipsReg)), CRegName::GPR_Hi[MipsReg]);
|
||||
CPU_Message(" regcache: unallocate %s from high 32-bit of %s", ArmRegName(GetMipsRegMapHi(MipsReg)), CRegName::GPR_Hi[MipsReg]);
|
||||
SetArmRegMapOrder(GetMipsRegMapHi(MipsReg), 0);
|
||||
SetArmRegMapped(GetMipsRegMapHi(MipsReg), NotMapped);
|
||||
SetArmRegProtected(GetMipsRegMapHi(MipsReg), false);
|
||||
|
@ -327,7 +327,7 @@ void CArmRegInfo::Map_GPR_64bit(int32_t MipsReg, int32_t MipsRegToLoad)
|
|||
|
||||
if (MipsReg == 0)
|
||||
{
|
||||
if (HaveDebugger()) { g_Notify->DisplayError("Map_GPR_64bit\n\nWhy are you trying to map reg 0"); }
|
||||
if (HaveDebugger()) { g_Notify->DisplayError("Map_GPR_64bit\n\nWhy are you trying to map register 0?"); }
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return;
|
||||
}
|
||||
|
@ -466,7 +466,7 @@ void CArmRegInfo::UnMap_GPR(uint32_t MipsReg, bool WriteBackValue)
|
|||
{
|
||||
if (HaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("%s\n\nWhy are you trying to unmap reg 0", __FUNCTION__).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("%s\n\nWhy are you trying to unmap register 0?", __FUNCTION__).c_str());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -502,7 +502,7 @@ void CArmRegInfo::WriteBack_GPR(uint32_t MipsReg, bool Unmapping)
|
|||
{
|
||||
if (HaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("%s\n\nWhy are you trying to unmap reg 0", __FUNCTION__).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("%s\n\nWhy are you trying to unmap register 0?", __FUNCTION__).c_str());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -597,7 +597,7 @@ void CArmRegInfo::WriteBackRegisters()
|
|||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
break;
|
||||
default:
|
||||
CPU_Message("%s: Unknown State: %d reg %d (%s)", __FUNCTION__, GetMipsRegState(count), count, CRegName::GPR[count]);
|
||||
CPU_Message("%s: Unknown state: %d reg %d (%s)", __FUNCTION__, GetMipsRegState(count), count, CRegName::GPR[count]);
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
}
|
||||
|
@ -701,7 +701,7 @@ bool CArmRegInfo::UnMap_ArmReg(ArmReg Reg)
|
|||
}
|
||||
else if (GetArmRegMapped(Reg) == Temp_Mapped)
|
||||
{
|
||||
CPU_Message(" regcache: unallocate %s from temp storage", ArmRegName(Reg));
|
||||
CPU_Message(" regcache: unallocate %s from temporary storage", ArmRegName(Reg));
|
||||
SetArmRegMapped(Reg, NotMapped);
|
||||
return true;
|
||||
}
|
||||
|
@ -901,11 +901,11 @@ CArmOps::ArmReg CArmRegInfo::Map_TempReg(ArmReg Reg, int32_t MipsReg, bool LoadH
|
|||
}
|
||||
if (MipsReg < 0)
|
||||
{
|
||||
CPU_Message(" regcache: allocate %s as temp storage", ArmRegName(Reg));
|
||||
CPU_Message(" regcache: allocate %s as temporary storage", ArmRegName(Reg));
|
||||
}
|
||||
else
|
||||
{
|
||||
CPU_Message(" regcache: allocate %s as temp storage (%s)", ArmRegName(Reg), LoadHiWord ? CRegName::GPR_Hi[MipsReg] : CRegName::GPR_Lo[MipsReg]);
|
||||
CPU_Message(" regcache: allocate %s as temporary storage (%s)", ArmRegName(Reg), LoadHiWord ? CRegName::GPR_Hi[MipsReg] : CRegName::GPR_Lo[MipsReg]);
|
||||
if (GprReg == Arm_Unknown)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
|
|
|
@ -10,7 +10,7 @@ class CArmRegInfo :
|
|||
private CSystemRegisters
|
||||
{
|
||||
public:
|
||||
//enums
|
||||
// Enums
|
||||
enum REG_MAPPED
|
||||
{
|
||||
NotMapped = 0,
|
||||
|
|
|
@ -1,17 +1,14 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
/*
|
||||
Project64 - A Nintendo 64 emulator
|
||||
https://www.pj64-emu.com/
|
||||
Copyright (C) 2012-2021 Project64. All rights reserved.
|
||||
License:
|
||||
GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
#define GLOBAL_FUNCTION(name) \
|
||||
.align 2; \
|
||||
.globl name; \
|
||||
.global name; \
|
||||
.hidden name; \
|
||||
.type name, %function; \
|
||||
name
|
||||
|
@ -25,7 +22,7 @@
|
|||
TEXT_SECTION
|
||||
|
||||
GLOBAL_FUNCTION(__clear_cache_android):
|
||||
/* The following bug-fix implements __clear_cache (missing in Android) */
|
||||
/* The following bug-fix implements __clear_cache (missing in Android) */
|
||||
push {r7, lr}
|
||||
mov r2, #0
|
||||
mov r7, #0x2
|
||||
|
|
|
@ -26,7 +26,7 @@ m_RecompilerOps(nullptr),
|
|||
m_Test(1)
|
||||
{
|
||||
#if defined(__arm__) || defined(_M_ARM)
|
||||
// make sure function starts at odd address so that the system knows it is thumb mode
|
||||
// Make sure function starts at an odd address so that the system knows it is in thumb mode
|
||||
if (((uint32_t)m_CompiledLocation % 2) == 0)
|
||||
{
|
||||
m_CompiledLocation+=1;
|
||||
|
@ -264,7 +264,7 @@ bool CCodeBlock::CreateBlockLinkage(CCodeSection * EnterSection)
|
|||
{
|
||||
CPU_Message("%s: End Block", __FUNCTION__);
|
||||
CurrentSection->m_EndSection = true;
|
||||
// find other sections that need compiling
|
||||
// Find other sections that need compiling
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -334,7 +334,7 @@ bool CCodeBlock::CreateBlockLinkage(CCodeSection * EnterSection)
|
|||
|
||||
TestPC += IncludeDelaySlot ? 8 : 4;
|
||||
|
||||
//Find the next section
|
||||
// Find the next section
|
||||
CCodeSection * NewSection = nullptr;
|
||||
for (SectionMap::const_iterator itr = m_SectionMap.begin(); itr != m_SectionMap.end(); itr++)
|
||||
{
|
||||
|
@ -745,11 +745,11 @@ bool CCodeBlock::AnalyzeInstruction(uint32_t PC, uint32_t & TargetPC, uint32_t &
|
|||
|
||||
bool CCodeBlock::Compile()
|
||||
{
|
||||
CPU_Message("====== Code Block ======");
|
||||
CPU_Message("====== Code block ======");
|
||||
CPU_Message("Native entry point: %X", CompiledLocation());
|
||||
CPU_Message("Start of Block: %X", VAddrEnter());
|
||||
CPU_Message("No of Sections: %d", NoOfSections());
|
||||
CPU_Message("====== recompiled code ======");
|
||||
CPU_Message("Start of block: %X", VAddrEnter());
|
||||
CPU_Message("Number of sections: %d", NoOfSections());
|
||||
CPU_Message("====== Recompiled code ======");
|
||||
|
||||
m_RecompilerOps->EnterCodeBlock();
|
||||
if (g_System->bLinkBlocks())
|
||||
|
|
|
@ -46,10 +46,10 @@ private:
|
|||
bool & EndBlock, bool & PermLoop);
|
||||
|
||||
uint32_t m_VAddrEnter;
|
||||
uint32_t m_VAddrFirst; // the address of the first opcode in the block
|
||||
uint32_t m_VAddrLast; // the address of the first opcode in the block
|
||||
uint8_t* m_CompiledLocation; // What address is this compiled at
|
||||
uint8_t* m_CompiledLocationEnd; // What address is this compiled at
|
||||
uint32_t m_VAddrFirst; // The address of the first opcode in the block
|
||||
uint32_t m_VAddrLast; // The address of the first opcode in the block
|
||||
uint8_t* m_CompiledLocation; // What address is this compiled at?
|
||||
uint8_t* m_CompiledLocationEnd; // What address is this compiled at?
|
||||
|
||||
typedef std::map<uint32_t, CCodeSection *> SectionMap;
|
||||
typedef std::list<CCodeSection *> SectionList;
|
||||
|
|
|
@ -187,7 +187,7 @@ void CCodeSection::GenerateSectionLinkage()
|
|||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
#ifdef legacycode
|
||||
//Handle Fall througth
|
||||
// Handle fall-through
|
||||
uint8_t * Jump = nullptr;
|
||||
for (i = 0; i < 2; i ++)
|
||||
{
|
||||
|
@ -243,7 +243,7 @@ void CCodeSection::GenerateSectionLinkage()
|
|||
// MoveConstToVariable(DELAY_SLOT,&m_NextInstruction,"m_NextInstruction");
|
||||
PushImm32(stdstr_f("0x%08X",m_RecompilerOps->GetCurrentPC() + 4).c_str(),m_RecompilerOps->GetCurrentPC() + 4);
|
||||
|
||||
// check if there is an existing section
|
||||
// Check if there is an existing section
|
||||
|
||||
MoveConstToX86reg((uint32_t)g_Recompiler,x86_ECX);
|
||||
Call_Direct(AddressOf(&CRecompiler::CompileDelaySlot), "CRecompiler::CompileDelaySlot");
|
||||
|
@ -253,7 +253,7 @@ void CCodeSection::GenerateSectionLinkage()
|
|||
#endif
|
||||
}
|
||||
|
||||
// Handle Perm Loop
|
||||
// Handle permanent loop
|
||||
if (m_RecompilerOps->GetCurrentPC() == m_Jump.TargetPC && (m_Cont.FallThrough == false))
|
||||
{
|
||||
if (!DelaySlotEffectsJump(m_RecompilerOps->GetCurrentPC()))
|
||||
|
@ -826,7 +826,7 @@ bool CCodeSection::GenerateNativeCode(uint32_t Test)
|
|||
break;
|
||||
case JUMP:
|
||||
case END_BLOCK:
|
||||
// Do nothing, block will end
|
||||
// Do nothing, the block will end
|
||||
break;
|
||||
default:
|
||||
CPU_Message("m_RecompilerOps->GetNextStepType() = %d", m_RecompilerOps->GetNextStepType());
|
||||
|
@ -874,7 +874,7 @@ void CCodeSection::AddParent(CCodeSection * Parent)
|
|||
return;
|
||||
}
|
||||
|
||||
// check to see if we already have the parent in the list
|
||||
// Check to see if we already have the parent in the list
|
||||
for (SECTION_LIST::iterator iter = m_ParentSection.begin(); iter != m_ParentSection.end(); iter++)
|
||||
{
|
||||
if (*iter == Parent)
|
||||
|
@ -896,7 +896,7 @@ void CCodeSection::AddParent(CCodeSection * Parent)
|
|||
}
|
||||
else
|
||||
{
|
||||
g_Notify->DisplayError("How are these sections joined?????");
|
||||
g_Notify->DisplayError("How are these sections joined?");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1192,26 +1192,27 @@ void CCodeSection::DisplaySectionInformation()
|
|||
|
||||
if (g_System->bLinkBlocks())
|
||||
{
|
||||
CPU_Message("Jump Address: 0x%08X", m_Jump.JumpPC);
|
||||
CPU_Message("Jump Target Address: 0x%08X", m_Jump.TargetPC);
|
||||
CPU_Message("Jump address: 0x%08X", m_Jump.JumpPC);
|
||||
CPU_Message("Jump target address: 0x%08X", m_Jump.TargetPC);
|
||||
if (m_JumpSection != nullptr)
|
||||
{
|
||||
CPU_Message("Jump Section: %d", m_JumpSection->m_SectionID);
|
||||
CPU_Message("Jump section: %d", m_JumpSection->m_SectionID);
|
||||
}
|
||||
else
|
||||
{
|
||||
CPU_Message("Jump Section: None");
|
||||
CPU_Message("Jump section: None");
|
||||
}
|
||||
CPU_Message("Continue Address: 0x%08X", m_Cont.JumpPC);
|
||||
CPU_Message("Continue Target Address: 0x%08X", m_Cont.TargetPC);
|
||||
if (m_ContinueSection != nullptr) {
|
||||
CPU_Message("Continue Section: %d", m_ContinueSection->m_SectionID);
|
||||
CPU_Message("Continue address: 0x%08X", m_Cont.JumpPC);
|
||||
CPU_Message("Continue target address: 0x%08X", m_Cont.TargetPC);
|
||||
if (m_ContinueSection != nullptr)
|
||||
{
|
||||
CPU_Message("Continue section: %d", m_ContinueSection->m_SectionID);
|
||||
}
|
||||
else
|
||||
{
|
||||
CPU_Message("Continue Section: None");
|
||||
CPU_Message("Continue section: None");
|
||||
}
|
||||
CPU_Message("In Loop: %s", m_InLoop ? "Yes" : "No");
|
||||
CPU_Message("In loop: %s", m_InLoop ? "Yes" : "No");
|
||||
}
|
||||
CPU_Message("=======================");
|
||||
}
|
|
@ -27,7 +27,7 @@ public:
|
|||
void AddParent(CCodeSection * Parent);
|
||||
void SwitchParent(CCodeSection * OldParent, CCodeSection * NewParent);
|
||||
|
||||
/* Block Connection info */
|
||||
// Block connection info
|
||||
SECTION_LIST m_ParentSection;
|
||||
CCodeBlock * const m_BlockInfo;
|
||||
const uint32_t m_SectionID;
|
||||
|
@ -35,8 +35,8 @@ public:
|
|||
uint32_t m_EndPC;
|
||||
CCodeSection * m_ContinueSection;
|
||||
CCodeSection * m_JumpSection;
|
||||
bool m_EndSection; // if this section does not link
|
||||
bool m_LinkAllowed; // are other sections allowed to find block to link to it
|
||||
bool m_EndSection; // If this section does not link, are other sections allowed to find block to link to it?
|
||||
bool m_LinkAllowed;
|
||||
uint32_t m_Test;
|
||||
uint32_t m_Test2;
|
||||
uint8_t * m_CompiledLocation;
|
||||
|
@ -44,10 +44,10 @@ public:
|
|||
bool m_DelaySlot;
|
||||
CRecompilerOps * & m_RecompilerOps;
|
||||
|
||||
/* Register Info */
|
||||
// Register info
|
||||
CRegInfo m_RegEnter;
|
||||
|
||||
/* Jump Info */
|
||||
// Jump info
|
||||
CJumpInfo m_Jump;
|
||||
CJumpInfo m_Cont;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ struct CExitInfo
|
|||
CRegInfo ExitRegSet;
|
||||
EXIT_REASON reason;
|
||||
STEP_TYPE NextInstruction;
|
||||
uint32_t * JumpLoc; //32bit jump
|
||||
uint32_t * JumpLoc; // 32-bit jump
|
||||
};
|
||||
|
||||
typedef std::list<CExitInfo> EXIT_LIST;
|
||||
|
|
|
@ -16,7 +16,7 @@ CCompiledFunc::CCompiledFunc( const CCodeBlock & CodeBlock ) :
|
|||
m_MemLocation[1] = CodeBlock.MemLocation(1);
|
||||
|
||||
#if defined(__arm__) || defined(_M_ARM)
|
||||
// make sure function starts at odd address so that the system knows it is thumb mode
|
||||
// Make sure function starts at an odd address so that the system knows it is in thumb mode
|
||||
if ((((uint32_t)m_Function) % 2) == 0)
|
||||
{
|
||||
m_Function = (Func)(((uint32_t)m_Function) + 1);
|
||||
|
|
|
@ -8,7 +8,6 @@ public:
|
|||
|
||||
typedef void (*Func)();
|
||||
|
||||
//Get Private Information
|
||||
const uint32_t EnterPC () const { return m_EnterPC; }
|
||||
const uint32_t MinPC () const { return m_MinPC; }
|
||||
const uint32_t MaxPC () const { return m_MaxPC; }
|
||||
|
|
|
@ -16,13 +16,13 @@ CFunctionMap::~CFunctionMap()
|
|||
|
||||
bool CFunctionMap::AllocateMemory()
|
||||
{
|
||||
WriteTrace(TraceRecompiler, TraceDebug, "start");
|
||||
WriteTrace(TraceRecompiler, TraceDebug, "Start");
|
||||
if (LookUpMode() == FuncFind_VirtualLookup && m_FunctionTable == nullptr)
|
||||
{
|
||||
m_FunctionTable = new PCCompiledFunc_TABLE[0x100000];
|
||||
if (m_FunctionTable == nullptr)
|
||||
{
|
||||
WriteTrace(TraceRecompiler, TraceError, "failed to allocate function table");
|
||||
WriteTrace(TraceRecompiler, TraceError, "Failed to allocate function table");
|
||||
g_Notify->FatalError(MSG_MEM_ALLOC_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ bool CFunctionMap::AllocateMemory()
|
|||
m_JumpTable = new PCCompiledFunc[RdramSize() >> 2];
|
||||
if (m_JumpTable == nullptr)
|
||||
{
|
||||
WriteTrace(TraceRecompiler, TraceError, "failed to allocate jump table");
|
||||
WriteTrace(TraceRecompiler, TraceError, "Failed to allocate jump table");
|
||||
g_Notify->FatalError(MSG_MEM_ALLOC_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ void CFunctionMap::CleanBuffers()
|
|||
|
||||
void CFunctionMap::Reset(bool bAllocate)
|
||||
{
|
||||
WriteTrace(TraceRecompiler, TraceDebug, "start (bAllocate: %s)", bAllocate ? "true" : "false");
|
||||
WriteTrace(TraceRecompiler, TraceDebug, "Start (bAllocate: %s)", bAllocate ? "true" : "false");
|
||||
CleanBuffers();
|
||||
if (bAllocate && (g_System->LookUpMode() == FuncFind_VirtualLookup || g_System->LookUpMode() == FuncFind_PhysicalLookup))
|
||||
{
|
||||
|
|
|
@ -14,7 +14,7 @@ struct CJumpInfo
|
|||
uint32_t * LinkLocation2;
|
||||
bool FallThrough;
|
||||
bool PermLoop;
|
||||
bool DoneDelaySlot; //maybe deletable
|
||||
bool DoneDelaySlot;
|
||||
CRegInfo RegSet;
|
||||
EXIT_REASON ExitReason;
|
||||
};
|
||||
|
|
|
@ -235,7 +235,7 @@ bool LoopAnalysis::CheckLoopRegisterUsage(CCodeSection * Section)
|
|||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
#ifdef legacycode
|
||||
if (m_Command.Hex == 0x00000001) { break; }
|
||||
g_Notify->DisplayError("Unhandled R4300i OpCode in FillSectionInfo 5\n%s",
|
||||
g_Notify->DisplayError("Unhandled R4300i opcode in FillSectionInfo 5\n%s",
|
||||
R4300iOpcodeName(m_Command.Hex, m_PC));
|
||||
#endif
|
||||
m_NextInstruction = END_BLOCK;
|
||||
|
@ -366,7 +366,7 @@ bool LoopAnalysis::CheckLoopRegisterUsage(CCodeSection * Section)
|
|||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
#ifdef legacycode
|
||||
if (m_Command.Hex == 0x0407000D) { break; }
|
||||
g_Notify->DisplayError("Unhandled R4300i OpCode in FillSectionInfo 4\n%s",
|
||||
g_Notify->DisplayError("Unhandled R4300i opcode in FillSectionInfo 4\n%s",
|
||||
R4300iOpcodeName(m_Command.Hex, m_PC));
|
||||
m_NextInstruction = END_BLOCK;
|
||||
m_PC -= 4;
|
||||
|
@ -542,14 +542,14 @@ bool LoopAnalysis::CheckLoopRegisterUsage(CCodeSection * Section)
|
|||
case R4300i_COP0_CO_TLBP: break;
|
||||
case R4300i_COP0_CO_ERET: m_NextInstruction = END_BLOCK; break;
|
||||
default:
|
||||
g_Notify->DisplayError(stdstr_f("Unhandled R4300i OpCode in FillSectionInfo\n%s", R4300iOpcodeName(m_Command.Hex, m_PC)).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Unhandled R4300i opcode in FillSectionInfo\n%s", R4300iOpcodeName(m_Command.Hex, m_PC)).c_str());
|
||||
m_NextInstruction = END_BLOCK;
|
||||
m_PC -= 4;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Unhandled R4300i OpCode in FillSectionInfo 3\n%s", R4300iOpcodeName(m_Command.Hex, m_PC)).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Unhandled R4300i opcode in FillSectionInfo 3\n%s", R4300iOpcodeName(m_Command.Hex, m_PC)).c_str());
|
||||
m_NextInstruction = END_BLOCK;
|
||||
m_PC -= 4;
|
||||
}
|
||||
|
@ -627,7 +627,7 @@ bool LoopAnalysis::CheckLoopRegisterUsage(CCodeSection * Section)
|
|||
case R4300i_COP1_W: break;
|
||||
case R4300i_COP1_L: break;
|
||||
default:
|
||||
g_Notify->DisplayError(stdstr_f("Unhandled R4300i OpCode in FillSectionInfo 2\n%s", R4300iOpcodeName(m_Command.Hex, m_PC)).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Unhandled R4300i opcode in FillSectionInfo 2\n%s", R4300iOpcodeName(m_Command.Hex, m_PC)).c_str());
|
||||
m_NextInstruction = END_BLOCK;
|
||||
m_PC -= 4;
|
||||
}
|
||||
|
@ -727,7 +727,7 @@ bool LoopAnalysis::CheckLoopRegisterUsage(CCodeSection * Section)
|
|||
if (m_Command.Hex == 0xF1F3F5F7) { break; }
|
||||
if (m_Command.Hex == 0xC1200000) { break; }
|
||||
if (m_Command.Hex == 0x4C5A5353) { break; }
|
||||
g_Notify->DisplayError(stdstr_f("Unhandled R4300i OpCode in FillSectionInfo 1\n%s\n%X", R4300iOpcodeName(m_Command.Hex, m_PC), m_Command.Hex).c_str());
|
||||
g_Notify->DisplayError(stdstr_f("Unhandled R4300i opcode in FillSectionInfo 1\n%s\n%X", R4300iOpcodeName(m_Command.Hex, m_PC), m_Command.Hex).c_str());
|
||||
}
|
||||
|
||||
CPU_Message(" %s state: %X value: %X", CRegName::GPR[5], m_Reg.GetMipsRegState(5), m_Reg.GetMipsRegLo(5));
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue