[Project64] Clean up Section Info.cpp, x86CodeLog.cpp, plugins

This commit is contained in:
zilmar 2015-11-10 07:26:33 +11:00
parent dda79ce345
commit eef290f767
6 changed files with 116 additions and 113 deletions

View File

@ -12,29 +12,29 @@
CJumpInfo::CJumpInfo()
{
TargetPC = (DWORD)-1;
JumpPC = (DWORD)-1;
BranchLabel = "";
LinkLocation = NULL;
TargetPC = (uint32_t)-1;
JumpPC = (uint32_t)-1;
BranchLabel = "";
LinkLocation = NULL;
LinkLocation2 = NULL;
FallThrough = false;
PermLoop = false;
FallThrough = false;
PermLoop = false;
DoneDelaySlot = false;
ExitReason = CExitInfo::Normal;
ExitReason = CExitInfo::Normal;
}
#ifdef tofix
bool CCodeSection::IsAllParentLoops(CCodeSection * Parent, bool IgnoreIfCompiled, DWORD Test)
{
bool CCodeSection::IsAllParentLoops(CCodeSection * Parent, bool IgnoreIfCompiled, uint32_t Test)
{
if (IgnoreIfCompiled && Parent->CompiledLocation != NULL) { return true; }
if (!InLoop) { return false; }
if (!Parent->InLoop) { return false; }
if (Parent->ParentSection.empty()) { return false; }
if (this == Parent) { return true; }
if (this == Parent) { return true; }
if (Parent->Test == Test) { return true; }
Parent->Test = Test;
for (SECTION_LIST::iterator iter = Parent->ParentSection.begin(); iter != Parent->ParentSection.end(); iter++)
{
CCodeSection * ParentSection = *iter;
@ -45,11 +45,11 @@ bool CCodeSection::IsAllParentLoops(CCodeSection * Parent, bool IgnoreIfCompiled
void CCodeSection::UnlinkParent( CCodeSection * Parent, bool AllowDelete, bool ContinueSection )
{
if (this == NULL)
if (this == NULL)
{
return;
}
SECTION_LIST::iterator iter = ParentSection.begin();
while ( iter != ParentSection.end())
{
@ -63,24 +63,24 @@ void CCodeSection::UnlinkParent( CCodeSection * Parent, bool AllowDelete, bool C
}
}
// if (Parent->ContinueSection != Parent->JumpSection)
// {
// if (!ContinueSection && Parent->ContinueSection == this)
// {
// g_Notify->BreakPoint(__FILEW__,__LINE__);
// }
// }
// if (Parent->ContinueSection != Parent->JumpSection)
// {
// if (!ContinueSection && Parent->ContinueSection == this)
// {
// g_Notify->BreakPoint(__FILEW__,__LINE__);
// }
// }
if (ContinueSection && Parent->ContinueSection == this)
{
Parent->ContinueSection = NULL;
}
// if (Parent->ContinueSection != Parent->JumpSection)
// {
// if (ContinueSection && Parent->JumpSection == this)
// {
// g_Notify->BreakPoint(__FILEW__,__LINE__);
// }
// }
// if (Parent->ContinueSection != Parent->JumpSection)
// {
// if (ContinueSection && Parent->JumpSection == this)
// {
// g_Notify->BreakPoint(__FILEW__,__LINE__);
// }
// }
if (!ContinueSection && Parent->JumpSection == this)
{
Parent->JumpSection = NULL;
@ -100,7 +100,7 @@ void CCodeSection::UnlinkParent( CCodeSection * Parent, bool AllowDelete, bool C
{
delete this;
}
}
}
}
CCodeSection::~CCodeSection()
@ -111,7 +111,7 @@ CCodeSection::~CCodeSection()
if (Parent->ContinueSection == this) { UnlinkParent(Parent, false, true); }
if (Parent->JumpSection == this) { UnlinkParent(Parent, false, false); }
}
if (ContinueSection)
{
ContinueSection->UnlinkParent(this, true, true);
@ -132,9 +132,9 @@ CCodeSection::~CCodeSection()
}
}
DWORD CCodeSection::GetNewTestValue()
uint32_t CCodeSection::GetNewTestValue()
{
static DWORD LastTest = 0;
static uint32_t LastTest = 0;
if (LastTest == 0xFFFFFFFF) { LastTest = 0; }
LastTest += 1;
return LastTest;
@ -143,13 +143,12 @@ DWORD CCodeSection::GetNewTestValue()
void CRegInfo::Initialize()
{
int count;
MIPS_RegState[0] = STATE_CONST_32_SIGN;
MIPS_RegVal[0].DW = 0;
for (count = 1; count < 32; count ++ ) {
MIPS_RegState[count] = STATE_UNKNOWN;
MIPS_RegVal[count].DW = 0;
}
for (count = 0; count < 10; count ++ ) {
x86reg_MappedTo[count] = NotMapped;
@ -170,4 +169,3 @@ void CRegInfo::Initialize()
}
#endif

View File

@ -12,8 +12,10 @@
class CCodeSection;
class CCodeBlock;
struct CJumpInfo;
struct BLOCK_PARENT {
struct BLOCK_PARENT
{
CCodeSection * Parent;
CJumpInfo * JumpInfo;
};

View File

@ -13,40 +13,43 @@
static HANDLE hCPULogFile = NULL;
bool bX86Logging = false;
void x86_Log_Message (const char * Message, ...) {
DWORD dwWritten;
char Msg[400];
va_list ap;
va_start( ap, Message );
vsprintf( Msg, Message, ap );
va_end( ap );
strcat(Msg,"\r\n");
void x86_Log_Message (const char * Message, ...)
{
DWORD dwWritten;
char Msg[400];
WriteFile( hCPULogFile,Msg,strlen(Msg),&dwWritten,NULL );
va_list ap;
va_start( ap, Message );
vsprintf( Msg, Message, ap );
va_end( ap );
strcat(Msg,"\r\n");
WriteFile( hCPULogFile,Msg,strlen(Msg),&dwWritten,NULL );
}
void Start_x86_Log (void) {
void Start_x86_Log (void)
{
CPath LogFileName(CPath::MODULE_DIRECTORY);
LogFileName.AppendDirectory("Logs");
LogFileName.SetNameExtension("CPUoutput.log");
CPath LogFileName(CPath::MODULE_DIRECTORY);
LogFileName.AppendDirectory("Logs");
LogFileName.SetNameExtension("CPUoutput.log");
if (hCPULogFile) { Stop_x86_Log(); }
hCPULogFile = CreateFile(LogFileName,GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,
CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
if (hCPULogFile)
{
bX86Logging = true;
SetFilePointer(hCPULogFile,0,NULL,FILE_BEGIN);
}
if (hCPULogFile) { Stop_x86_Log(); }
hCPULogFile = CreateFile(LogFileName,GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,
CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
if (hCPULogFile)
{
bX86Logging = true;
SetFilePointer(hCPULogFile,0,NULL,FILE_BEGIN);
}
}
void Stop_x86_Log (void) {
if (hCPULogFile) {
CloseHandle(hCPULogFile);
hCPULogFile = NULL;
bX86Logging = false;
}
void Stop_x86_Log (void)
{
if (hCPULogFile)
{
CloseHandle(hCPULogFile);
hCPULogFile = NULL;
bX86Logging = false;
}
}

View File

@ -119,13 +119,13 @@ bool CAudioPlugin::Initiate(CN64System * System, CMainGui * RenderWindow)
Info.RDRAM = g_MMU->Rdram();
Info.DMEM = g_MMU->Dmem();
Info.IMEM = g_MMU->Imem();
Info.MI__INTR_REG = (uint32_t *)&g_Reg->m_AudioIntrReg;
Info.AI__DRAM_ADDR_REG = (uint32_t *)&g_Reg->AI_DRAM_ADDR_REG;
Info.AI__LEN_REG = (uint32_t *)&g_Reg->AI_LEN_REG;
Info.AI__CONTROL_REG = (uint32_t *)&g_Reg->AI_CONTROL_REG;
Info.AI__STATUS_REG = (uint32_t *)&g_Reg->AI_STATUS_REG;
Info.AI__DACRATE_REG = (uint32_t *)&g_Reg->AI_DACRATE_REG;
Info.AI__BITRATE_REG = (uint32_t *)&g_Reg->AI_BITRATE_REG;
Info.MI__INTR_REG = &g_Reg->m_AudioIntrReg;
Info.AI__DRAM_ADDR_REG = &g_Reg->AI_DRAM_ADDR_REG;
Info.AI__LEN_REG = &g_Reg->AI_LEN_REG;
Info.AI__CONTROL_REG = &g_Reg->AI_CONTROL_REG;
Info.AI__STATUS_REG = &g_Reg->AI_STATUS_REG;
Info.AI__DACRATE_REG = &g_Reg->AI_DACRATE_REG;
Info.AI__BITRATE_REG = &g_Reg->AI_BITRATE_REG;
}
m_Initialized = InitiateAudio(Info) != 0;

View File

@ -191,29 +191,29 @@ bool CGfxPlugin::Initiate(CN64System * System, CMainGui * RenderWindow)
Info.RDRAM = g_MMU->Rdram();
Info.DMEM = g_MMU->Dmem();
Info.IMEM = g_MMU->Imem();
Info.MI__INTR_REG = (uint32_t *)&g_Reg->m_GfxIntrReg;
Info.DPC__START_REG = (uint32_t *)&g_Reg->DPC_START_REG;
Info.DPC__END_REG = (uint32_t *)&g_Reg->DPC_END_REG;
Info.DPC__CURRENT_REG = (uint32_t *)&g_Reg->DPC_CURRENT_REG;
Info.DPC__STATUS_REG = (uint32_t *)&g_Reg->DPC_STATUS_REG;
Info.DPC__CLOCK_REG = (uint32_t *)&g_Reg->DPC_CLOCK_REG;
Info.DPC__BUFBUSY_REG = (uint32_t *)&g_Reg->DPC_BUFBUSY_REG;
Info.DPC__PIPEBUSY_REG = (uint32_t *)&g_Reg->DPC_PIPEBUSY_REG;
Info.DPC__TMEM_REG = (uint32_t *)&g_Reg->DPC_TMEM_REG;
Info.VI__STATUS_REG = (uint32_t *)&g_Reg->VI_STATUS_REG;
Info.VI__ORIGIN_REG = (uint32_t *)&g_Reg->VI_ORIGIN_REG;
Info.VI__WIDTH_REG = (uint32_t *)&g_Reg->VI_WIDTH_REG;
Info.VI__INTR_REG = (uint32_t *)&g_Reg->VI_INTR_REG;
Info.VI__V_CURRENT_LINE_REG = (uint32_t *)&g_Reg->VI_CURRENT_REG;
Info.VI__TIMING_REG = (uint32_t *)&g_Reg->VI_TIMING_REG;
Info.VI__V_SYNC_REG = (uint32_t *)&g_Reg->VI_V_SYNC_REG;
Info.VI__H_SYNC_REG = (uint32_t *)&g_Reg->VI_H_SYNC_REG;
Info.VI__LEAP_REG = (uint32_t *)&g_Reg->VI_LEAP_REG;
Info.VI__H_START_REG = (uint32_t *)&g_Reg->VI_H_START_REG;
Info.VI__V_START_REG = (uint32_t *)&g_Reg->VI_V_START_REG;
Info.VI__V_BURST_REG = (uint32_t *)&g_Reg->VI_V_BURST_REG;
Info.VI__X_SCALE_REG = (uint32_t *)&g_Reg->VI_X_SCALE_REG;
Info.VI__Y_SCALE_REG = (uint32_t *)&g_Reg->VI_Y_SCALE_REG;
Info.MI__INTR_REG = &g_Reg->m_GfxIntrReg;
Info.DPC__START_REG = &g_Reg->DPC_START_REG;
Info.DPC__END_REG = &g_Reg->DPC_END_REG;
Info.DPC__CURRENT_REG = &g_Reg->DPC_CURRENT_REG;
Info.DPC__STATUS_REG = &g_Reg->DPC_STATUS_REG;
Info.DPC__CLOCK_REG = &g_Reg->DPC_CLOCK_REG;
Info.DPC__BUFBUSY_REG = &g_Reg->DPC_BUFBUSY_REG;
Info.DPC__PIPEBUSY_REG = &g_Reg->DPC_PIPEBUSY_REG;
Info.DPC__TMEM_REG = &g_Reg->DPC_TMEM_REG;
Info.VI__STATUS_REG = &g_Reg->VI_STATUS_REG;
Info.VI__ORIGIN_REG = &g_Reg->VI_ORIGIN_REG;
Info.VI__WIDTH_REG = &g_Reg->VI_WIDTH_REG;
Info.VI__INTR_REG = &g_Reg->VI_INTR_REG;
Info.VI__V_CURRENT_LINE_REG = &g_Reg->VI_CURRENT_REG;
Info.VI__TIMING_REG = &g_Reg->VI_TIMING_REG;
Info.VI__V_SYNC_REG = &g_Reg->VI_V_SYNC_REG;
Info.VI__H_SYNC_REG = &g_Reg->VI_H_SYNC_REG;
Info.VI__LEAP_REG = &g_Reg->VI_LEAP_REG;
Info.VI__H_START_REG = &g_Reg->VI_H_START_REG;
Info.VI__V_START_REG = &g_Reg->VI_V_START_REG;
Info.VI__V_BURST_REG = &g_Reg->VI_V_BURST_REG;
Info.VI__X_SCALE_REG = &g_Reg->VI_X_SCALE_REG;
Info.VI__Y_SCALE_REG = &g_Reg->VI_Y_SCALE_REG;
}
m_Initialized = InitiateGFX(Info) != 0;

View File

@ -161,26 +161,26 @@ bool CRSP_Plugin::Initiate(CPlugins * Plugins, CN64System * System)
Info.DMEM = g_MMU->Dmem();
Info.IMEM = g_MMU->Imem();
Info.MI__INTR_REG = (uint32_t *)&g_Reg->m_RspIntrReg;
Info.MI__INTR_REG = &g_Reg->m_RspIntrReg;
Info.SP__MEM_ADDR_REG = (uint32_t *)&g_Reg->SP_MEM_ADDR_REG;
Info.SP__DRAM_ADDR_REG = (uint32_t *)&g_Reg->SP_DRAM_ADDR_REG;
Info.SP__RD_LEN_REG = (uint32_t *)&g_Reg->SP_RD_LEN_REG;
Info.SP__WR_LEN_REG = (uint32_t *)&g_Reg->SP_WR_LEN_REG;
Info.SP__STATUS_REG = (uint32_t *)&g_Reg->SP_STATUS_REG;
Info.SP__DMA_FULL_REG = (uint32_t *)&g_Reg->SP_DMA_FULL_REG;
Info.SP__DMA_BUSY_REG = (uint32_t *)&g_Reg->SP_DMA_BUSY_REG;
Info.SP__PC_REG = (uint32_t *)&g_Reg->SP_PC_REG;
Info.SP__SEMAPHORE_REG = (uint32_t *)&g_Reg->SP_SEMAPHORE_REG;
Info.SP__MEM_ADDR_REG = &g_Reg->SP_MEM_ADDR_REG;
Info.SP__DRAM_ADDR_REG = &g_Reg->SP_DRAM_ADDR_REG;
Info.SP__RD_LEN_REG = &g_Reg->SP_RD_LEN_REG;
Info.SP__WR_LEN_REG = &g_Reg->SP_WR_LEN_REG;
Info.SP__STATUS_REG = &g_Reg->SP_STATUS_REG;
Info.SP__DMA_FULL_REG = &g_Reg->SP_DMA_FULL_REG;
Info.SP__DMA_BUSY_REG = &g_Reg->SP_DMA_BUSY_REG;
Info.SP__PC_REG = &g_Reg->SP_PC_REG;
Info.SP__SEMAPHORE_REG = &g_Reg->SP_SEMAPHORE_REG;
Info.DPC__START_REG = (uint32_t *)&g_Reg->DPC_START_REG;
Info.DPC__END_REG = (uint32_t *)&g_Reg->DPC_END_REG;
Info.DPC__CURRENT_REG = (uint32_t *)&g_Reg->DPC_CURRENT_REG;
Info.DPC__STATUS_REG = (uint32_t *)&g_Reg->DPC_STATUS_REG;
Info.DPC__CLOCK_REG = (uint32_t *)&g_Reg->DPC_CLOCK_REG;
Info.DPC__BUFBUSY_REG = (uint32_t *)&g_Reg->DPC_BUFBUSY_REG;
Info.DPC__PIPEBUSY_REG = (uint32_t *)&g_Reg->DPC_PIPEBUSY_REG;
Info.DPC__TMEM_REG = (uint32_t *)&g_Reg->DPC_TMEM_REG;
Info.DPC__START_REG = &g_Reg->DPC_START_REG;
Info.DPC__END_REG = &g_Reg->DPC_END_REG;
Info.DPC__CURRENT_REG = &g_Reg->DPC_CURRENT_REG;
Info.DPC__STATUS_REG = &g_Reg->DPC_STATUS_REG;
Info.DPC__CLOCK_REG = &g_Reg->DPC_CLOCK_REG;
Info.DPC__BUFBUSY_REG = &g_Reg->DPC_BUFBUSY_REG;
Info.DPC__PIPEBUSY_REG = &g_Reg->DPC_PIPEBUSY_REG;
Info.DPC__TMEM_REG = &g_Reg->DPC_TMEM_REG;
}
InitiateRSP(Info, &m_CycleCount);