Skip to content

Commit

Permalink
Rsp: Move InitilizeRSPRegisters and InitilizeRSP into rsp-core
Browse files Browse the repository at this point in the history
  • Loading branch information
project64 committed Sep 21, 2023
1 parent 42a944c commit 5dcc7e2
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 19 deletions.
21 changes: 21 additions & 0 deletions Source/Project64-rsp-core/RSPInfo.cpp
@@ -1,3 +1,24 @@
#include "RSPInfo.h"
#include <Project64-rsp-core/Settings/RspSettings.h>
#include <Project64-rsp-core/Settings/RspSettingsID.h>
#include <Project64-rsp-core/cpu/RSPCpu.h>
#include <Project64-rsp-core/cpu/RSPRegisters.h>
#include <Project64-rsp-core/cpu/RspMemory.h>
#include <Settings/Settings.h>

RSP_INFO RSPInfo;

void InitilizeRSP(RSP_INFO & Rsp_Info)
{
RSPInfo = Rsp_Info;

AudioHle = Set_AudioHle != 0 ? GetSystemSetting(Set_AudioHle) != 0 : false;
GraphicsHle = Set_GraphicsHle != 0 ? GetSystemSetting(Set_GraphicsHle) != 0 : true;

AllocateMemory();
InitilizeRSPRegisters();
Build_RSP();
#ifdef GenerateLog
Start_Log();
#endif
}
2 changes: 2 additions & 0 deletions Source/Project64-rsp-core/RSPInfo.h
@@ -1,3 +1,5 @@
#include <Project64-plugin-spec/Rsp.h>

extern RSP_INFO RSPInfo;

void InitilizeRSP(RSP_INFO & Rsp_Info);
10 changes: 10 additions & 0 deletions Source/Project64-rsp-core/cpu/RSPRegister.cpp
@@ -1,4 +1,5 @@
#include "cpu/RspTypes.h"
#include <string.h>

// RSP registers
UWORD32 RSP_GPR[32], RSP_Flags[4];
Expand Down Expand Up @@ -44,6 +45,15 @@ char * GPR_Strings[32] = {
"RA",
};

void InitilizeRSPRegisters(void)
{
memset(RSP_GPR, 0, sizeof(RSP_GPR));
for (size_t i = 0, n = sizeof(RSP_Vect) / sizeof(RSP_Vect[0]); i < n; i++)
{
RSP_Vect[i] = RSPVector();
}
}

int64_t AccumulatorGet(uint8_t el)
{
return (((int64_t)RSP_ACCUM[el].HW[3]) << 32) | (((int64_t)RSP_ACCUM[el].UHW[2]) << 16) | RSP_ACCUM[el].UHW[1];
Expand Down
9 changes: 0 additions & 9 deletions Source/Project64-rsp/Debugger/RSPRegistersUI.cpp
Expand Up @@ -111,15 +111,6 @@ void HideRSP_RegisterPanel(int Panel)
}
}

void InitilizeRSPRegisters(void)
{
memset(RSP_GPR, 0, sizeof(RSP_GPR));
for (size_t i = 0, n = sizeof(RSP_Vect) / sizeof(RSP_Vect[0]); i < n; i++)
{
RSP_Vect[i] = RSPVector();
}
}

void PaintRSP_HiddenPanel(HWND hWnd)
{
PAINTSTRUCT ps;
Expand Down
11 changes: 1 addition & 10 deletions Source/Project64-rsp/Main.cpp
Expand Up @@ -322,17 +322,8 @@ EXPORT void InitiateRSP(RSP_INFO Rsp_Info, uint32_t * CycleCount)
{
g_RSPDebuggerUI.reset(new RSPDebuggerUI);
g_RSPDebugger = g_RSPDebuggerUI.get();
RSPInfo = Rsp_Info;
AudioHle = GetSystemSetting(Set_AudioHle) != 0;
GraphicsHle = GetSystemSetting(Set_GraphicsHle) != 0;

InitilizeRSP(Rsp_Info);
*CycleCount = 0;
AllocateMemory();
InitilizeRSPRegisters();
Build_RSP();
#ifdef GenerateLog
Start_Log();
#endif
}

/*
Expand Down

0 comments on commit 5dcc7e2

Please sign in to comment.