[Project64] Fix some warnings

This commit is contained in:
zilmar 2016-11-28 07:34:02 +11:00
parent 66b22ecab1
commit a25f22a9af
16 changed files with 262 additions and 249 deletions

View File

@ -294,7 +294,7 @@ static void read_gb_cart_mbc3(struct gb_cart* gb_cart, uint16_t address, uint8_t
{ {
if (gb_cart->ram != NULL) if (gb_cart->ram != NULL)
{ {
if (gb_cart->ram_bank >= 0x00 && gb_cart->ram_bank <= 0x03) if (gb_cart->ram_bank <= 0x03)
{ {
offset = (address - 0xA000) + (gb_cart->ram_bank * 0x2000); offset = (address - 0xA000) + (gb_cart->ram_bank * 0x2000);
if (offset < gb_cart->ram_size) if (offset < gb_cart->ram_size)
@ -373,7 +373,7 @@ static void write_gb_cart_mbc3(struct gb_cart* gb_cart, uint16_t address, const
{ {
if (gb_cart->ram != NULL) if (gb_cart->ram != NULL)
{ {
if (gb_cart->ram_bank >= 0x00 && gb_cart->ram_bank <= 0x03) if (gb_cart->ram_bank <= 0x03)
{ {
offset = (address - 0xA000) + (gb_cart->ram_bank * 0x2000); offset = (address - 0xA000) + (gb_cart->ram_bank * 0x2000);
if (offset < gb_cart->ram_size) if (offset < gb_cart->ram_size)

View File

@ -889,6 +889,14 @@ void CN64System::InitRegisters(bool bPostPif, CMipsMemoryVM & MMU)
m_Reg.m_GPR[5].DW = 0xFFFFFFFFE067221F; m_Reg.m_GPR[5].DW = 0xFFFFFFFFE067221F;
m_Reg.m_GPR[14].DW = 0x000000005CD2B70F; m_Reg.m_GPR[14].DW = 0x000000005CD2B70F;
break; break;
case CIC_NUS_6101:
case CIC_NUS_6104:
case CIC_NUS_5167:
case CIC_NUS_8303:
case CIC_NUS_DDUS:
default:
//no specific values
break;
} }
m_Reg.m_GPR[20].DW = 0x0000000000000001; m_Reg.m_GPR[20].DW = 0x0000000000000001;
m_Reg.m_GPR[23].DW = 0x0000000000000000; m_Reg.m_GPR[23].DW = 0x0000000000000000;

View File

@ -181,8 +181,14 @@ bool CCodeBlock::SetSection(CCodeSection * & Section, CCodeSection * CurrentSect
BaseSection->m_JumpSection = SplitSection->m_JumpSection; BaseSection->m_JumpSection = SplitSection->m_JumpSection;
BaseSection->SetContinueAddress(SplitSection->m_Cont.JumpPC, SplitSection->m_Cont.TargetPC); BaseSection->SetContinueAddress(SplitSection->m_Cont.JumpPC, SplitSection->m_Cont.TargetPC);
BaseSection->m_ContinueSection = SplitSection->m_ContinueSection; BaseSection->m_ContinueSection = SplitSection->m_ContinueSection;
BaseSection->m_JumpSection->SwitchParent(SplitSection, BaseSection); if (BaseSection->m_JumpSection)
BaseSection->m_ContinueSection->SwitchParent(SplitSection, BaseSection); {
BaseSection->m_JumpSection->SwitchParent(SplitSection, BaseSection);
}
if (BaseSection->m_ContinueSection)
{
BaseSection->m_ContinueSection->SwitchParent(SplitSection, BaseSection);
}
BaseSection->AddParent(SplitSection); BaseSection->AddParent(SplitSection);
SplitSection->m_EndPC = TargetPC - 4; SplitSection->m_EndPC = TargetPC - 4;
@ -400,7 +406,10 @@ void CCodeBlock::DetermineLoops()
CCodeSection * Section = itr->second; CCodeSection * Section = itr->second;
uint32_t Test = NextTest(); uint32_t Test = NextTest();
Section->DetermineLoop(Test, Test, Section->m_SectionID); if (Section)
{
Section->DetermineLoop(Test, Test, Section->m_SectionID);
}
} }
} }
@ -750,11 +759,11 @@ bool CCodeBlock::Compile()
m_RecompilerOps->EnterCodeBlock(); m_RecompilerOps->EnterCodeBlock();
if (g_System->bLinkBlocks()) if (g_System->bLinkBlocks())
{ {
while (m_EnterSection->GenerateNativeCode(NextTest())); while (m_EnterSection !=NULL && m_EnterSection->GenerateNativeCode(NextTest()));
} }
else else
{ {
if (!m_EnterSection->GenerateNativeCode(NextTest())) if (m_EnterSection == NULL || !m_EnterSection->GenerateNativeCode(NextTest()))
{ {
return false; return false;
} }

View File

@ -341,7 +341,7 @@ void CCodeSection::GenerateSectionLinkage()
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
{ {
if (JumpInfo[i]->FallThrough && !TargetSection[i]->GenerateNativeCode(m_BlockInfo->NextTest())) if (JumpInfo[i]->FallThrough && (TargetSection[i] == NULL || !TargetSection[i]->GenerateNativeCode(m_BlockInfo->NextTest())))
{ {
JumpInfo[i]->FallThrough = false; JumpInfo[i]->FallThrough = false;
m_RecompilerOps->JumpToUnknown(JumpInfo[i]); m_RecompilerOps->JumpToUnknown(JumpInfo[i]);
@ -441,8 +441,6 @@ bool CCodeSection::ParentContinue()
bool CCodeSection::GenerateNativeCode(uint32_t Test) bool CCodeSection::GenerateNativeCode(uint32_t Test)
{ {
if (this == NULL) { return false; }
if (m_CompiledLocation != NULL) if (m_CompiledLocation != NULL)
{ {
if (m_Test == Test) if (m_Test == Test)
@ -450,8 +448,8 @@ bool CCodeSection::GenerateNativeCode(uint32_t Test)
return false; return false;
} }
m_Test = Test; m_Test = Test;
if (m_ContinueSection->GenerateNativeCode(Test)) { return true; } if (m_ContinueSection != NULL && m_ContinueSection->GenerateNativeCode(Test)) { return true; }
if (m_JumpSection->GenerateNativeCode(Test)) { return true; } if (m_JumpSection != NULL && m_JumpSection->GenerateNativeCode(Test)) { return true; }
return false; return false;
} }
@ -766,6 +764,14 @@ bool CCodeSection::GenerateNativeCode(uint32_t Test)
m_RecompilerOps->GetRegWorkingSet().SetBlockCycleCount(m_RecompilerOps->GetRegWorkingSet().GetBlockCycleCount() - g_System->CountPerOp()); m_RecompilerOps->GetRegWorkingSet().SetBlockCycleCount(m_RecompilerOps->GetRegWorkingSet().GetBlockCycleCount() - g_System->CountPerOp());
m_RecompilerOps->SetCurrentPC(m_RecompilerOps->GetCurrentPC() - 4); m_RecompilerOps->SetCurrentPC(m_RecompilerOps->GetCurrentPC() - 4);
break; break;
case JUMP:
case END_BLOCK:
// Do nothing, block will end
break;
default:
CPU_Message("m_RecompilerOps->GetNextStepType() = %d", m_RecompilerOps->GetNextStepType());
g_Notify->BreakPoint(__FILE__, __LINE__);
break;
} }
if (m_DelaySlot) if (m_DelaySlot)
@ -802,7 +808,6 @@ bool CCodeSection::GenerateNativeCode(uint32_t Test)
void CCodeSection::AddParent(CCodeSection * Parent) void CCodeSection::AddParent(CCodeSection * Parent)
{ {
if (this == NULL) { return; }
if (Parent == NULL) if (Parent == NULL)
{ {
m_RecompilerOps->SetRegWorkingSet(m_RegEnter); m_RecompilerOps->SetRegWorkingSet(m_RegEnter);
@ -850,8 +855,6 @@ void CCodeSection::AddParent(CCodeSection * Parent)
void CCodeSection::SwitchParent(CCodeSection * OldParent, CCodeSection * NewParent) void CCodeSection::SwitchParent(CCodeSection * OldParent, CCodeSection * NewParent)
{ {
if (this == NULL) { return; }
bool bFoundOldParent = false; bool bFoundOldParent = false;
for (SECTION_LIST::iterator iter = m_ParentSection.begin(); iter != m_ParentSection.end(); iter++) for (SECTION_LIST::iterator iter = m_ParentSection.begin(); iter != m_ParentSection.end(); iter++)
{ {
@ -901,15 +904,19 @@ void CCodeSection::TestRegConstantStates(CRegInfo & Base, CRegInfo & Reg)
void CCodeSection::DetermineLoop(uint32_t Test, uint32_t Test2, uint32_t TestID) void CCodeSection::DetermineLoop(uint32_t Test, uint32_t Test2, uint32_t TestID)
{ {
if (this == NULL) { return; }
if (m_SectionID == TestID) if (m_SectionID == TestID)
{ {
if (m_Test2 != Test2) if (m_Test2 != Test2)
{ {
m_Test2 = Test2; m_Test2 = Test2;
m_ContinueSection->DetermineLoop(Test, Test2, TestID); if (m_ContinueSection)
m_JumpSection->DetermineLoop(Test, Test2, TestID); {
m_ContinueSection->DetermineLoop(Test, Test2, TestID);
}
if (m_JumpSection)
{
m_JumpSection->DetermineLoop(Test, Test2, TestID);
}
if (m_Test != Test) if (m_Test != Test)
{ {
@ -934,15 +941,20 @@ void CCodeSection::DetermineLoop(uint32_t Test, uint32_t Test2, uint32_t TestID)
if (m_Test2 != Test2) if (m_Test2 != Test2)
{ {
m_Test2 = Test2; m_Test2 = Test2;
m_ContinueSection->DetermineLoop(Test, Test2, TestID); if (m_ContinueSection)
m_JumpSection->DetermineLoop(Test, Test2, TestID); {
m_ContinueSection->DetermineLoop(Test, Test2, TestID);
}
if (m_JumpSection)
{
m_JumpSection->DetermineLoop(Test, Test2, TestID);
}
} }
} }
} }
CCodeSection * CCodeSection::ExistingSection(uint32_t Addr, uint32_t Test) CCodeSection * CCodeSection::ExistingSection(uint32_t Addr, uint32_t Test)
{ {
if (this == NULL) { return NULL; }
if (m_EnterPC == Addr && m_LinkAllowed) if (m_EnterPC == Addr && m_LinkAllowed)
{ {
return this; return this;
@ -950,9 +962,9 @@ CCodeSection * CCodeSection::ExistingSection(uint32_t Addr, uint32_t Test)
if (m_Test == Test) { return NULL; } if (m_Test == Test) { return NULL; }
m_Test = Test; m_Test = Test;
CCodeSection * Section = m_JumpSection->ExistingSection(Addr, Test); CCodeSection * Section = m_JumpSection ? m_JumpSection->ExistingSection(Addr, Test) : NULL;
if (Section != NULL) { return Section; } if (Section != NULL) { return Section; }
Section = m_ContinueSection->ExistingSection(Addr, Test); Section = m_ContinueSection ? m_ContinueSection->ExistingSection(Addr, Test) : NULL;
if (Section != NULL) { return Section; } if (Section != NULL) { return Section; }
return NULL; return NULL;
@ -960,7 +972,6 @@ CCodeSection * CCodeSection::ExistingSection(uint32_t Addr, uint32_t Test)
bool CCodeSection::SectionAccessible(uint32_t SectionId, uint32_t Test) bool CCodeSection::SectionAccessible(uint32_t SectionId, uint32_t Test)
{ {
if (this == NULL) { return false; }
if (m_SectionID == SectionId) if (m_SectionID == SectionId)
{ {
return true; return true;
@ -969,20 +980,15 @@ bool CCodeSection::SectionAccessible(uint32_t SectionId, uint32_t Test)
if (m_Test == Test) { return false; } if (m_Test == Test) { return false; }
m_Test = Test; m_Test = Test;
if (m_ContinueSection->SectionAccessible(SectionId, Test)) if (m_ContinueSection && m_ContinueSection->SectionAccessible(SectionId, Test))
{ {
return true; return true;
} }
return m_JumpSection->SectionAccessible(SectionId, Test); return m_JumpSection && m_JumpSection->SectionAccessible(SectionId, Test);
} }
void CCodeSection::UnlinkParent(CCodeSection * Parent, bool ContinueSection) void CCodeSection::UnlinkParent(CCodeSection * Parent, bool ContinueSection)
{ {
if (this == NULL)
{
return;
}
CPU_Message("%s: Section %d Parent: %d ContinueSection = %s", __FUNCTION__, m_SectionID, Parent->m_SectionID, ContinueSection ? "Yes" : "No"); CPU_Message("%s: Section %d Parent: %d ContinueSection = %s", __FUNCTION__, m_SectionID, Parent->m_SectionID, ContinueSection ? "Yes" : "No");
if (Parent->m_ContinueSection == this && Parent->m_JumpSection == this) if (Parent->m_ContinueSection == this && Parent->m_JumpSection == this)
{ {
@ -1084,13 +1090,12 @@ bool CCodeSection::DisplaySectionInformation(uint32_t ID, uint32_t Test)
{ {
return false; return false;
} }
if (this == NULL) { return false; }
if (m_Test == Test) { return false; } if (m_Test == Test) { return false; }
m_Test = Test; m_Test = Test;
if (m_SectionID != ID) if (m_SectionID != ID)
{ {
if (m_ContinueSection->DisplaySectionInformation(ID, Test)) { return true; } if (m_ContinueSection != NULL && m_ContinueSection->DisplaySectionInformation(ID, Test)) { return true; }
if (m_JumpSection->DisplaySectionInformation(ID, Test)) { return true; } if (m_JumpSection != NULL && m_JumpSection->DisplaySectionInformation(ID, Test)) { return true; }
return false; return false;
} }
DisplaySectionInformation(); DisplaySectionInformation();

View File

@ -28,7 +28,6 @@ public:
bool GenerateNativeCode(uint32_t Test); bool GenerateNativeCode(uint32_t Test);
void GenerateSectionLinkage(); void GenerateSectionLinkage();
void DetermineLoop(uint32_t Test, uint32_t Test2, uint32_t TestID); void DetermineLoop(uint32_t Test, uint32_t Test2, uint32_t TestID);
bool FixConstants(uint32_t Test);
CCodeSection * ExistingSection(uint32_t Addr, uint32_t Test); CCodeSection * ExistingSection(uint32_t Addr, uint32_t Test);
bool SectionAccessible(uint32_t SectionId, uint32_t Test); bool SectionAccessible(uint32_t SectionId, uint32_t Test);
bool DisplaySectionInformation(uint32_t ID, uint32_t Test); bool DisplaySectionInformation(uint32_t ID, uint32_t Test);

View File

@ -745,7 +745,8 @@ bool LoopAnalysis::CheckLoopRegisterUsage(CCodeSection * Section)
m_NextInstruction = END_BLOCK; m_NextInstruction = END_BLOCK;
SetJumpRegSet(Section, m_Reg); SetJumpRegSet(Section, m_Reg);
} }
else { else
{
switch (m_NextInstruction) switch (m_NextInstruction)
{ {
case NORMAL: case NORMAL:
@ -760,29 +761,17 @@ bool LoopAnalysis::CheckLoopRegisterUsage(CCodeSection * Section)
} }
break; break;
case LIKELY_DELAY_SLOT: case LIKELY_DELAY_SLOT:
{
SetContinueRegSet(Section, m_Reg); SetContinueRegSet(Section, m_Reg);
SetJumpRegSet(Section, m_Reg); SetJumpRegSet(Section, m_Reg);
} m_NextInstruction = END_BLOCK;
m_NextInstruction = END_BLOCK; break;
break;
case DELAY_SLOT_DONE: case DELAY_SLOT_DONE:
{
SetContinueRegSet(Section, m_Reg); SetContinueRegSet(Section, m_Reg);
SetJumpRegSet(Section, m_Reg); SetJumpRegSet(Section, m_Reg);
} m_NextInstruction = END_BLOCK;
m_NextInstruction = END_BLOCK; break;
break;
case LIKELY_DELAY_SLOT_DONE: case LIKELY_DELAY_SLOT_DONE:
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
if (Section->m_CompiledLocation)
{
}
else
{
//Section->m_Jump.RegSet = m_Reg;
//Section->m_Jump.DoneDelaySlot = true;
}
m_NextInstruction = END_BLOCK; m_NextInstruction = END_BLOCK;
break; break;
} }
@ -1146,8 +1135,8 @@ void LoopAnalysis::SPECIAL_DADD()
if (m_Reg.IsConst(m_Command.rt) && m_Reg.IsConst(m_Command.rs)) if (m_Reg.IsConst(m_Command.rt) && m_Reg.IsConst(m_Command.rs))
{ {
m_Reg.SetMipsReg(m_Command.rd, m_Reg.SetMipsReg(m_Command.rd,
m_Reg.Is64Bit(m_Command.rs) ? m_Reg.GetMipsReg(m_Command.rs) : (int64_t)m_Reg.GetMipsRegLo_S(m_Command.rs) + (m_Reg.Is64Bit(m_Command.rs) ? m_Reg.GetMipsReg(m_Command.rs) : (int64_t)m_Reg.GetMipsRegLo_S(m_Command.rs)) +
m_Reg.Is64Bit(m_Command.rt) ? m_Reg.GetMipsReg(m_Command.rt) : (int64_t)m_Reg.GetMipsRegLo_S(m_Command.rt) (m_Reg.Is64Bit(m_Command.rt) ? m_Reg.GetMipsReg(m_Command.rt) : (int64_t)m_Reg.GetMipsRegLo_S(m_Command.rt))
); );
m_Reg.SetMipsRegState(m_Command.rd, CRegInfo::STATE_CONST_64); m_Reg.SetMipsRegState(m_Command.rd, CRegInfo::STATE_CONST_64);
} }
@ -1167,8 +1156,8 @@ void LoopAnalysis::SPECIAL_DADDU()
if (m_Reg.IsConst(m_Command.rt) && m_Reg.IsConst(m_Command.rs)) if (m_Reg.IsConst(m_Command.rt) && m_Reg.IsConst(m_Command.rs))
{ {
m_Reg.SetMipsReg(m_Command.rd, m_Reg.SetMipsReg(m_Command.rd,
m_Reg.Is64Bit(m_Command.rs) ? m_Reg.GetMipsReg(m_Command.rs) : (int64_t)m_Reg.GetMipsRegLo_S(m_Command.rs) + (m_Reg.Is64Bit(m_Command.rs) ? m_Reg.GetMipsReg(m_Command.rs) : (int64_t)m_Reg.GetMipsRegLo_S(m_Command.rs)) +
m_Reg.Is64Bit(m_Command.rt) ? m_Reg.GetMipsReg(m_Command.rt) : (int64_t)m_Reg.GetMipsRegLo_S(m_Command.rt) (m_Reg.Is64Bit(m_Command.rt) ? m_Reg.GetMipsReg(m_Command.rt) : (int64_t)m_Reg.GetMipsRegLo_S(m_Command.rt))
); );
m_Reg.SetMipsRegState(m_Command.rd, CRegInfo::STATE_CONST_64); m_Reg.SetMipsRegState(m_Command.rd, CRegInfo::STATE_CONST_64);
} }
@ -1188,8 +1177,8 @@ void LoopAnalysis::SPECIAL_DSUB()
if (m_Reg.IsConst(m_Command.rt) && m_Reg.IsConst(m_Command.rs)) if (m_Reg.IsConst(m_Command.rt) && m_Reg.IsConst(m_Command.rs))
{ {
m_Reg.SetMipsReg(m_Command.rd, m_Reg.SetMipsReg(m_Command.rd,
m_Reg.Is64Bit(m_Command.rs) ? m_Reg.GetMipsReg(m_Command.rs) : (int64_t)m_Reg.GetMipsRegLo_S(m_Command.rs) - (m_Reg.Is64Bit(m_Command.rs) ? m_Reg.GetMipsReg(m_Command.rs) : (int64_t)m_Reg.GetMipsRegLo_S(m_Command.rs)) -
m_Reg.Is64Bit(m_Command.rt) ? m_Reg.GetMipsReg(m_Command.rt) : (int64_t)m_Reg.GetMipsRegLo_S(m_Command.rt) (m_Reg.Is64Bit(m_Command.rt) ? m_Reg.GetMipsReg(m_Command.rt) : (int64_t)m_Reg.GetMipsRegLo_S(m_Command.rt))
); );
m_Reg.SetMipsRegState(m_Command.rd, CRegInfo::STATE_CONST_64); m_Reg.SetMipsRegState(m_Command.rd, CRegInfo::STATE_CONST_64);
} }
@ -1209,8 +1198,8 @@ void LoopAnalysis::SPECIAL_DSUBU()
if (m_Reg.IsConst(m_Command.rt) && m_Reg.IsConst(m_Command.rs)) if (m_Reg.IsConst(m_Command.rt) && m_Reg.IsConst(m_Command.rs))
{ {
m_Reg.SetMipsReg(m_Command.rd, m_Reg.SetMipsReg(m_Command.rd,
m_Reg.Is64Bit(m_Command.rs) ? m_Reg.GetMipsReg(m_Command.rs) : (int64_t)m_Reg.GetMipsRegLo_S(m_Command.rs) - (m_Reg.Is64Bit(m_Command.rs) ? m_Reg.GetMipsReg(m_Command.rs) : (int64_t)m_Reg.GetMipsRegLo_S(m_Command.rs)) -
m_Reg.Is64Bit(m_Command.rt) ? m_Reg.GetMipsReg(m_Command.rt) : (int64_t)m_Reg.GetMipsRegLo_S(m_Command.rt) (m_Reg.Is64Bit(m_Command.rt) ? m_Reg.GetMipsReg(m_Command.rt) : (int64_t)m_Reg.GetMipsRegLo_S(m_Command.rt))
); );
m_Reg.SetMipsRegState(m_Command.rd, CRegInfo::STATE_CONST_64); m_Reg.SetMipsRegState(m_Command.rd, CRegInfo::STATE_CONST_64);
} }

View File

@ -167,174 +167,174 @@ void CRecompiler::RecompilerMain_VirtualTable()
void CRecompiler::RecompilerMain_VirtualTable_validate() void CRecompiler::RecompilerMain_VirtualTable_validate()
{ {
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
/* PCCompiledFunc_TABLE * m_FunctionTable = m_Functions.GetFunctionTable(); #ifdef legacycode
PCCompiledFunc_TABLE * m_FunctionTable = m_Functions.GetFunctionTable();
while(!m_EndEmulation) while (!m_EndEmulation)
{ {
/*if (NextInstruction == DELAY_SLOT) if (NextInstruction == DELAY_SLOT)
{ {
CCompiledFunc * Info = m_FunctionsDelaySlot.FindFunction(PROGRAM_COUNTER); CCompiledFunc * Info = m_FunctionsDelaySlot.FindFunction(PROGRAM_COUNTER);
//Find Block on hash table //Find Block on hash table
if (Info == NULL) if (Info == NULL)
{ {
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
#ifdef legacycode #ifdef legacycode
if (!g_TLB->ValidVaddr(PROGRAM_COUNTER)) if (!g_TLB->ValidVaddr(PROGRAM_COUNTER))
{ {
DoTLBMiss(NextInstruction == DELAY_SLOT,PROGRAM_COUNTER); DoTLBMiss(NextInstruction == DELAY_SLOT, PROGRAM_COUNTER);
NextInstruction = NORMAL; NextInstruction = NORMAL;
if (!g_TLB->ValidVaddr(PROGRAM_COUNTER)) if (!g_TLB->ValidVaddr(PROGRAM_COUNTER))
{ {
g_Notify->DisplayError("Failed to translate PC to a PAddr: %X\n\nEmulation stopped",PROGRAM_COUNTER); g_Notify->DisplayError("Failed to translate PC to a PAddr: %X\n\nEmulation stopped", PROGRAM_COUNTER);
return; return;
} }
continue; continue;
} }
#endif #endif
//Find Block on hash table //Find Block on hash table
Info = CompileDelaySlot(PROGRAM_COUNTER); Info = CompileDelaySlot(PROGRAM_COUNTER);
if (Info == NULL || EndEmulation()) if (Info == NULL || EndEmulation())
{ {
break; break;
} }
} }
const uint8_t * Block = Info->FunctionAddr(); const uint8_t * Block = Info->FunctionAddr();
if ((*Info->MemLocation[0] != Info->MemContents[0]) || if ((*Info->MemLocation[0] != Info->MemContents[0]) ||
(*Info->MemLocation[1] != Info->MemContents[1])) (*Info->MemLocation[1] != Info->MemContents[1]))
{ {
ClearRecompCode_Virt((Info->VStartPC() - 0x1000) & ~0xFFF,0x2000,Remove_ValidateFunc); ClearRecompCode_Virt((Info->VStartPC() - 0x1000) & ~0xFFF, 0x2000, Remove_ValidateFunc);
NextInstruction = DELAY_SLOT; NextInstruction = DELAY_SLOT;
Info = NULL; Info = NULL;
continue; continue;
} }
_asm { _asm {
pushad pushad
call Block call Block
popad popad
} }
continue; continue;
}*/ }
/* PCCompiledFunc_TABLE table = m_FunctionTable[PROGRAM_COUNTER >> 0xC]; PCCompiledFunc_TABLE table = m_FunctionTable[PROGRAM_COUNTER >> 0xC];
if (table) if (table)
{ {
CCompiledFunc * info = table[(PROGRAM_COUNTER & 0xFFF) >> 2]; CCompiledFunc * info = table[(PROGRAM_COUNTER & 0xFFF) >> 2];
if (info != NULL) if (info != NULL)
{ {
if ((*info->MemLocation[0] != info->MemContents[0]) || if ((*info->MemLocation[0] != info->MemContents[0]) ||
(*info->MemLocation[1] != info->MemContents[1])) (*info->MemLocation[1] != info->MemContents[1]))
{ {
ClearRecompCode_Virt((info->VStartPC() - 0x1000) & ~0xFFF,0x3000,Remove_ValidateFunc); ClearRecompCode_Virt((info->VStartPC() - 0x1000) & ~0xFFF, 0x3000, Remove_ValidateFunc);
info = NULL; info = NULL;
continue; continue;
} }
const uint8_t * Block = info->FunctionAddr(); const uint8_t * Block = info->FunctionAddr();
_asm { _asm {
pushad pushad
call Block call Block
popad popad
} }
continue; continue;
} }
} }
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
#ifdef legacycode #ifdef legacycode
if (!g_TLB->ValidVaddr(PROGRAM_COUNTER)) if (!g_TLB->ValidVaddr(PROGRAM_COUNTER))
{ {
DoTLBMiss(NextInstruction == DELAY_SLOT,PROGRAM_COUNTER); DoTLBMiss(NextInstruction == DELAY_SLOT, PROGRAM_COUNTER);
NextInstruction = NORMAL; NextInstruction = NORMAL;
if (!g_TLB->ValidVaddr(PROGRAM_COUNTER)) if (!g_TLB->ValidVaddr(PROGRAM_COUNTER))
{ {
g_Notify->DisplayError("Failed to translate PC to a PAddr: %X\n\nEmulation stopped",PROGRAM_COUNTER); g_Notify->DisplayError("Failed to translate PC to a PAddr: %X\n\nEmulation stopped", PROGRAM_COUNTER);
return; return;
} }
} }
#endif #endif
CCompiledFunc * info = CompileCode(); CCompiledFunc * info = CompileCode();
if (info == NULL || EndEmulation()) if (info == NULL || EndEmulation())
{ {
break; break;
} }
} }
/* while (!m_EndEmulation)
while(!m_EndEmulation)
{ {
if (!g_MMU->ValidVaddr(PROGRAM_COUNTER)) if (!g_MMU->ValidVaddr(PROGRAM_COUNTER))
{ {
DoTLBMiss(NextInstruction == DELAY_SLOT,PROGRAM_COUNTER); DoTLBMiss(NextInstruction == DELAY_SLOT, PROGRAM_COUNTER);
NextInstruction = NORMAL; NextInstruction = NORMAL;
if (!g_MMU->ValidVaddr(PROGRAM_COUNTER)) if (!g_MMU->ValidVaddr(PROGRAM_COUNTER))
{ {
g_Notify->DisplayError("Failed to translate PC to a PAddr: %X\n\nEmulation stopped",PROGRAM_COUNTER); g_Notify->DisplayError("Failed to translate PC to a PAddr: %X\n\nEmulation stopped", PROGRAM_COUNTER);
return; return;
} }
} }
if (NextInstruction == DELAY_SLOT) if (NextInstruction == DELAY_SLOT)
{ {
CCompiledFunc * Info = m_FunctionsDelaySlot.FindFunction(PROGRAM_COUNTER); CCompiledFunc * Info = m_FunctionsDelaySlot.FindFunction(PROGRAM_COUNTER);
//Find Block on hash table //Find Block on hash table
if (Info == NULL) if (Info == NULL)
{ {
Info = CompileDelaySlot(PROGRAM_COUNTER); Info = CompileDelaySlot(PROGRAM_COUNTER);
if (Info == NULL || EndEmulation()) if (Info == NULL || EndEmulation())
{ {
break; break;
} }
} }
if (bSMM_ValidFunc()) if (bSMM_ValidFunc())
{ {
if ((*Info->MemLocation[0] != Info->MemContents[0]) || if ((*Info->MemLocation[0] != Info->MemContents[0]) ||
(*Info->MemLocation[1] != Info->MemContents[1])) (*Info->MemLocation[1] != Info->MemContents[1]))
{ {
ClearRecompCode_Virt((Info->StartPC() - 0x1000) & ~0xFFF,0x2000,Remove_ValidateFunc); ClearRecompCode_Virt((Info->StartPC() - 0x1000) & ~0xFFF, 0x2000, Remove_ValidateFunc);
NextInstruction = DELAY_SLOT; NextInstruction = DELAY_SLOT;
Info = NULL; Info = NULL;
continue; continue;
} }
} }
const uint8_t * Block = Info->FunctionAddr(); const uint8_t * Block = Info->FunctionAddr();
_asm { _asm {
pushad pushad
call Block call Block
popad popad
} }
continue; continue;
} }
CCompiledFunc * Info = m_Functions.FindFunction(PROGRAM_COUNTER); CCompiledFunc * Info = m_Functions.FindFunction(PROGRAM_COUNTER);
//Find Block on hash table //Find Block on hash table
if (Info == NULL) if (Info == NULL)
{ {
Info = CompileCode(); Info = CompileCode();
if (Info == NULL || EndEmulation()) if (Info == NULL || EndEmulation())
{ {
break; break;
}
}
if (bSMM_ValidFunc())
{
if ((*Info->MemLocation[0] != Info->MemContents[0]) ||
(*Info->MemLocation[1] != Info->MemContents[1]))
{
ClearRecompCode_Virt((Info->StartPC() - 0x1000) & ~0xFFF, 0x3000, Remove_ValidateFunc);
Info = NULL;
continue;
}
}
const uint8_t * Block = Info->FunctionAddr();
_asm {
pushad
call Block
popad
}
} }
} #endif
if (bSMM_ValidFunc())
{
if ((*Info->MemLocation[0] != Info->MemContents[0]) ||
(*Info->MemLocation[1] != Info->MemContents[1]))
{
ClearRecompCode_Virt((Info->StartPC() - 0x1000) & ~0xFFF,0x3000,Remove_ValidateFunc);
Info = NULL;
continue;
}
}
const uint8_t * Block = Info->FunctionAddr();
_asm {
pushad
call Block
popad
}
}
*/
} }
void CRecompiler::RecompilerMain_Lookup() void CRecompiler::RecompilerMain_Lookup()
@ -384,7 +384,7 @@ void CRecompiler::RecompilerMain_Lookup()
while(!m_EndEmulation) while(!m_EndEmulation)
{ {
/*if (bUseTlb()) if (bUseTlb())
{ {
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
#ifdef legacycode #ifdef legacycode
@ -511,14 +511,14 @@ void CRecompiler::RecompilerMain_Lookup()
sprintf(Label,"PC: %X to %X",ProfAddress,ProfAddress+ 0xFFC); sprintf(Label,"PC: %X to %X",ProfAddress,ProfAddress+ 0xFFC);
// StartTimer(Label); // StartTimer(Label);
} }
/*if (PROGRAM_COUNTER >= 0x800DD000 && PROGRAM_COUNTER <= 0x800DDFFC) { if (PROGRAM_COUNTER >= 0x800DD000 && PROGRAM_COUNTER <= 0x800DDFFC) {
char Label[100]; char Label[100];
sprintf(Label,"PC: %X Block: %X",PROGRAM_COUNTER,Block); sprintf(Label,"PC: %X Block: %X",PROGRAM_COUNTER,Block);
StartTimer(Label); StartTimer(Label);
}*/ }
// } else if ((Profiling || ShowCPUPer) && ProfilingLabel[0] == 0) { // } else if ((Profiling || ShowCPUPer) && ProfilingLabel[0] == 0) {
// StartTimer("r4300i Running"); // StartTimer("r4300i Running");
/* } }
#endif #endif
const uint8_t * Block = Info->FunctionAddr(); const uint8_t * Block = Info->FunctionAddr();
_asm { _asm {

View File

@ -47,11 +47,6 @@ bool CCodeSection::IsAllParentLoops(CCodeSection * Parent, bool IgnoreIfCompiled
void CCodeSection::UnlinkParent( CCodeSection * Parent, bool AllowDelete, bool ContinueSection ) void CCodeSection::UnlinkParent( CCodeSection * Parent, bool AllowDelete, bool ContinueSection )
{ {
if (this == NULL)
{
return;
}
SECTION_LIST::iterator iter = ParentSection.begin(); SECTION_LIST::iterator iter = ParentSection.begin();
while ( iter != ParentSection.end()) while ( iter != ParentSection.end())
{ {

View File

@ -8336,12 +8336,12 @@ void CX86RecompilerOps::COP1_S_CMP()
if ((m_Opcode.funct & 1) != 0) if ((m_Opcode.funct & 1) != 0)
{ {
x86Reg Reg2 = Map_TempReg(x86_Any8Bit, 0, false); x86Reg _86RegReg2 = Map_TempReg(x86_Any8Bit, 0, false);
AndConstToX86Reg(x86_EAX, 0x4300); AndConstToX86Reg(x86_EAX, 0x4300);
CompConstToX86reg(x86_EAX, 0x4300); CompConstToX86reg(x86_EAX, 0x4300);
Setz(Reg2); Setz(_86RegReg2);
OrX86RegToX86Reg(Reg, Reg2); OrX86RegToX86Reg(Reg, _86RegReg2);
} }
} }
else if ((m_Opcode.funct & 1) != 0) else if ((m_Opcode.funct & 1) != 0)
@ -8709,12 +8709,12 @@ void CX86RecompilerOps::COP1_D_CMP()
if ((m_Opcode.funct & 1) != 0) if ((m_Opcode.funct & 1) != 0)
{ {
x86Reg Reg2 = Map_TempReg(x86_Any8Bit, 0, false); x86Reg _86RegReg2 = Map_TempReg(x86_Any8Bit, 0, false);
AndConstToX86Reg(x86_EAX, 0x4300); AndConstToX86Reg(x86_EAX, 0x4300);
CompConstToX86reg(x86_EAX, 0x4300); CompConstToX86reg(x86_EAX, 0x4300);
Setz(Reg2); Setz(_86RegReg2);
OrX86RegToX86Reg(Reg, Reg2); OrX86RegToX86Reg(Reg, _86RegReg2);
} }
} }
else if ((m_Opcode.funct & 1) != 0) else if ((m_Opcode.funct & 1) != 0)

View File

@ -18,7 +18,7 @@
#include <Project64-core/N64System/Recompiler/RecompilerOps.h> #include <Project64-core/N64System/Recompiler/RecompilerOps.h>
#include <Project64-core/N64System/Recompiler/x86/x86ops.h> #include <Project64-core/N64System/Recompiler/x86/x86ops.h>
#include <Project64-core/N64System/Recompiler/JumpInfo.h> #include <Project64-core/N64System/Recompiler/JumpInfo.h>
#include <Project64-core/Settings/DebugSettings.h> #include <Project64-core/N64System/Interpreter/InterpreterOps.h>
#include <Project64-core/Settings/N64SystemSettings.h> #include <Project64-core/Settings/N64SystemSettings.h>
#include <Project64-core/Settings/RecompilerSettings.h> #include <Project64-core/Settings/RecompilerSettings.h>
@ -27,9 +27,8 @@ class CCodeSection;
class CX86RecompilerOps : class CX86RecompilerOps :
public CRecompilerOps, public CRecompilerOps,
protected CDebugSettings, protected R4300iOp,
protected CX86Ops, protected CX86Ops,
protected CSystemRegisters,
protected CN64SystemSettings, protected CN64SystemSettings,
protected CRecompilerSettings protected CRecompilerSettings
{ {

View File

@ -94,7 +94,7 @@ void CSpeedLimiter::AlterSpeed( const ESpeedChange SpeedChange )
{ {
m_Speed += 5 * SpeedFactor; m_Speed += 5 * SpeedFactor;
} }
else if (m_Speed > 1 && SpeedChange == DECREASE_SPEED || SpeedChange == INCREASE_SPEED) else if ((m_Speed > 1 && SpeedChange == DECREASE_SPEED) || SpeedChange == INCREASE_SPEED)
{ {
m_Speed += 1 * SpeedFactor; m_Speed += 1 * SpeedFactor;
} }

View File

@ -422,6 +422,9 @@ void CPlugins::ConfigPlugin(void* hParent, PLUGIN_TYPE Type)
} }
m_Control->DllConfig(hParent); m_Control->DllConfig(hParent);
break; break;
case PLUGIN_TYPE_NONE:
default:
g_Notify->BreakPoint(__FILE__, __LINE__);
} }
} }

View File

@ -206,16 +206,16 @@ void CRomList::FillRomList(strlist & FileList, const char * Directory)
SectionName.ToLower(); SectionName.ToLower();
WriteTrace(TraceUserInterface, TraceDebug, "4 %s", SectionName.c_str()); WriteTrace(TraceUserInterface, TraceDebug, "4 %s", SectionName.c_str());
for (int32_t i = 0; i < ZipFile.NumFiles(); i++) for (int32_t zi = 0; zi < ZipFile.NumFiles(); zi++)
{ {
CSzFileItem * f = ZipFile.FileItem(i); CSzFileItem * f = ZipFile.FileItem(zi);
if (f->IsDir) if (f->IsDir)
{ {
continue; continue;
} }
ROM_INFO RomInfo; ROM_INFO RomInfo;
std::wstring FileNameW = ZipFile.FileNameIndex(i); std::wstring FileNameW = ZipFile.FileNameIndex(zi);
if (FileNameW.length() == 0) if (FileNameW.length() == 0)
{ {
continue; continue;

View File

@ -603,10 +603,10 @@ void CSettings::RegisterSetting(CSettings * _this, SettingID ID, SettingID Defau
} }
else else
{ {
SettingID RdbSetting = (SettingID)_this->m_NextAutoSettingId; SettingID AutoRdbSetting = (SettingID)_this->m_NextAutoSettingId;
_this->m_NextAutoSettingId += 1; _this->m_NextAutoSettingId += 1;
_this->AddHandler(RdbSetting, new CSettingTypeRomDatabaseSetting(Category, DefaultStr, DefaultID, true)); _this->AddHandler(AutoRdbSetting, new CSettingTypeRomDatabaseSetting(Category, DefaultStr, DefaultID, true));
_this->AddHandler(ID, new CSettingTypeApplication(Category, DefaultStr, RdbSetting)); _this->AddHandler(ID, new CSettingTypeApplication(Category, DefaultStr, AutoRdbSetting));
} }
break; break;
default: default:
@ -1247,10 +1247,10 @@ void CSettings::UnregisterChangeCB(SettingID Type, void * Data, SettingChangedFu
{ {
if (item->Next) if (item->Next)
{ {
SettingID Type = Callback->first; SettingID CallbackType = Callback->first;
SETTING_CHANGED_CB * Next = item->Next; SETTING_CHANGED_CB * Next = item->Next;
m_Callback.erase(Callback); m_Callback.erase(Callback);
m_Callback.insert(SETTING_CALLBACK::value_type(Type, Next)); m_Callback.insert(SETTING_CALLBACK::value_type(CallbackType, Next));
} }
else else
{ {

View File

@ -3,8 +3,8 @@
CNotificationImp & Notify(void) CNotificationImp & Notify(void)
{ {
static CNotificationImp g_Notify; static CNotificationImp Notify;
return g_Notify; return Notify;
} }
CNotificationImp::CNotificationImp() : CNotificationImp::CNotificationImp() :
@ -56,8 +56,6 @@ void CNotificationImp::DisplayError(LanguageStringID StringID) const
void CNotificationImp::DisplayError(const char * Message) const void CNotificationImp::DisplayError(const char * Message) const
{ {
if (this == NULL) { return; }
WriteTrace(TraceUserInterface, TraceError, Message); WriteTrace(TraceUserInterface, TraceError, Message);
WindowMode(); WindowMode();
@ -119,8 +117,6 @@ void CNotificationImp::DisplayMessage2(const char * Message) const
bool CNotificationImp::AskYesNoQuestion(const char * Question) const bool CNotificationImp::AskYesNoQuestion(const char * Question) const
{ {
if (this == NULL) { return false; }
WriteTrace(TraceUserInterface, TraceError, Question); WriteTrace(TraceUserInterface, TraceError, Question);
WindowMode(); WindowMode();

View File

@ -148,6 +148,11 @@ void RegisterSetting(short SettingID, SETTING_DATA_TYPE Type, const char * Name,
case Data_String_RDB_Setting: case Data_String_RDB_Setting:
Location = SettingType_RdbSetting; Location = SettingType_RdbSetting;
break; break;
case Data_DWORD_General:
case Data_String_General:
default:
Location = (SettingLocation)g_PluginSettings.DefaultLocation;
break;
} }
switch (Type) switch (Type)
@ -215,6 +220,11 @@ void RegisterSetting2(short SettingID, SETTING_DATA_TYPE Type, const char * Name
case Data_String_RDB_Setting: case Data_String_RDB_Setting:
Location = SettingType_RdbSetting; Location = SettingType_RdbSetting;
break; break;
case Data_DWORD_General:
case Data_String_General:
default:
Location = (SettingLocation)g_PluginSettings.DefaultLocation;
break;
} }
switch (Type) switch (Type)