small speedup of logmanager, minor logging improvements, misc code standard improvements, replace a crash with an error message in ppcanalyst

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1521 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2008-12-13 16:58:06 +00:00
parent 4355c37397
commit 522752c77d
16 changed files with 188 additions and 197 deletions

View file

@ -58,7 +58,7 @@ void CriticalSection::Enter()
bool CriticalSection::TryEnter()
{
return(TryEnterCriticalSection(&section) ? true : false);
return TryEnterCriticalSection(&section) ? true : false;
}

View file

@ -15,15 +15,14 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Simple partial Action Replay code system implementation.
// Partial Action Replay code system implementation.
// Will never be able to support some AR codes - specifically those that patch the running
// Action Replay engine itself - yes they do exist!!!
// Action Replay actually is a small virtual machine with a limited number of commands.
// It probably is Turing complete - but what does that matter when AR codes can write
// actual PowerPC code.
// actual PowerPC code...
#include <string>
#include <vector>
@ -102,7 +101,7 @@ void LoadActionReplayCodes(IniFile &ini)
encryptedLines.clear();
}
if(line.size() > 1)
if (line.size() > 1)
{
if (line[0] == '+')
{
@ -164,16 +163,16 @@ void LoadActionReplayCodes(IniFile &ini)
void LogInfo(const char *format, ...)
{
if(!b_RanOnce)
if (!b_RanOnce)
{
if (IsLoggingActivated() || logSelf)
if (LogManager::Enabled() || logSelf)
{
char* temp = (char*)alloca(strlen(format)+512);
va_list args;
va_start(args, format);
CharArrayFromFormatV(temp, 512, format, args);
va_end(args);
if (IsLoggingActivated())
if (LogManager::Enabled())
LogManager::Log(LogTypes::ACTIONREPLAY, temp);
if (logSelf)
{
@ -188,21 +187,22 @@ void LogInfo(const char *format, ...)
void ActionReplayRunAllActive()
{
if (Core::GetStartupParameter().bEnableCheats) {
for (std::vector<ARCode>::iterator iter = activeCodes.begin(); iter != activeCodes.end(); ++iter)
if (iter->active) {
if(!RunActionReplayCode(*iter))
for (std::vector<ARCode>::iterator iter = activeCodes.begin(); iter != activeCodes.end(); ++iter)
{
if (iter->active)
{
if (!RunActionReplayCode(*iter))
iter->active = false;
LogInfo("\n");
}
if(!b_RanOnce)
}
if (!b_RanOnce)
b_RanOnce = true;
}
}
bool RunActionReplayCode(const ARCode &arcode) {
// The mechanism is slightly different than what the real AR uses, so there may be compatibility problems.
// The mechanism is different than what the real AR uses, so there may be compatibility problems.
u8 cmd;
u32 addr;
u32 data;
@ -239,7 +239,7 @@ bool RunActionReplayCode(const ARCode &arcode) {
if (!skip && count > 0) count--; // execute n lines
// if -2 : execute all lines
if(b_RanOnce)
if (b_RanOnce)
b_RanOnce = false;
}
@ -276,14 +276,15 @@ bool RunActionReplayCode(const ARCode &arcode) {
}
// skip these weird init lines
if (iter == code.ops.begin() && cmd == 1) continue;
if (iter == code.ops.begin() && cmd == 1)
continue;
// Zero codes
if (addr == 0x0) // Check if the code is a zero code
{
u8 zcode = ((data >> 29) & 0x07);
LogInfo("Doing Zero Code %08x", zcode);
switch(zcode)
switch (zcode)
{
case 0x00: // END OF CODES
LogInfo("ZCode: End Of Codes");
@ -327,45 +328,45 @@ bool RunActionReplayCode(const ARCode &arcode) {
cond = true;
LogInfo("This Normal Code is a Conditional Code");
}
switch(type)
switch (type)
{
case 0x0:
if(!NormalCode_Type_0(subtype, addr, data))
if (!NormalCode_Type_0(subtype, addr, data))
return false;
continue;
case 0x1:
LogInfo("Type 1: If Equal");
if(!NormalCode_Type_1(subtype, addr, data, &count, &skip))
if (!NormalCode_Type_1(subtype, addr, data, &count, &skip))
return false;
continue;
case 0x2:
LogInfo("Type 2: If Not Equal");
if(!NormalCode_Type_2(subtype, addr, data, &count, &skip))
if (!NormalCode_Type_2(subtype, addr, data, &count, &skip))
return false;
continue;
case 0x3:
LogInfo("Type 3: If Less Than (Signed)");
if(!NormalCode_Type_3(subtype, addr, data, &count, &skip))
if (!NormalCode_Type_3(subtype, addr, data, &count, &skip))
return false;
continue;
case 0x4:
LogInfo("Type 4: If Greater Than (Signed)");
if(!NormalCode_Type_4(subtype, addr, data, &count, &skip))
if (!NormalCode_Type_4(subtype, addr, data, &count, &skip))
return false;
continue;
case 0x5:
LogInfo("Type 5: If Less Than (Unsigned)");
if(!NormalCode_Type_5(subtype, addr, data, &count, &skip))
if (!NormalCode_Type_5(subtype, addr, data, &count, &skip))
return false;
continue;
case 0x6:
LogInfo("Type 6: If Greater Than (Unsigned)");
if(!NormalCode_Type_6(subtype, addr, data, &count, &skip))
if (!NormalCode_Type_6(subtype, addr, data, &count, &skip))
return false;
continue;
case 0x7:
LogInfo("Type 7: If AND");
if(!NormalCode_Type_7(subtype, addr, data, &count, &skip))
if (!NormalCode_Type_7(subtype, addr, data, &count, &skip))
return false;
continue;
default:
@ -374,14 +375,12 @@ bool RunActionReplayCode(const ARCode &arcode) {
}
}
if(b_RanOnce && cond)
if (b_RanOnce && cond)
b_RanOnce = true;
return true;
}
// Subtypes
bool Subtype_RamWriteAndFill(u32 addr, u32 data)
{
@ -543,7 +542,6 @@ bool Subtype_MasterCodeAndWriteToCCXXXXXX()
return false;
}
// Zero Codes
bool ZeroCode_FillAndSlide(u32 val_last, u32 addr, u32 data) // This needs more testing
{
@ -583,89 +581,89 @@ bool ZeroCode_FillAndSlide(u32 val_last, u32 addr, u32 data) // This needs more
LogInfo("Current Hardware Address Update: %08x", curr_addr);
}
switch(size)
switch (size)
{
case 0x0: // Byte
LogInfo("Byte Write");
LogInfo("--------");
for (int i=0; i < write_num; i++) {
Memory::Write_U8(val & 0xFF, curr_addr);
LogInfo("Write %08x to address %08x", val & 0xFF, curr_addr);
if (val_incr < 0)
{
val -= (u32)abs(val_incr);
}
if (val_incr > 0)
{
val += (u32)val_incr;
}
if (addr_incr < 0)
{
curr_addr -= (u32)abs(addr_incr);
}
if (addr_incr > 0)
{
curr_addr += (u32)addr_incr;
}
LogInfo("Value Update: %08x", val);
LogInfo("Current Hardware Address Update: %08x", curr_addr);
LogInfo("Byte Write");
LogInfo("--------");
for (int i=0; i < write_num; i++) {
Memory::Write_U8(val & 0xFF, curr_addr);
LogInfo("Write %08x to address %08x", val & 0xFF, curr_addr);
if (val_incr < 0)
{
val -= (u32)abs(val_incr);
}
LogInfo("--------");
break;
if (val_incr > 0)
{
val += (u32)val_incr;
}
if (addr_incr < 0)
{
curr_addr -= (u32)abs(addr_incr);
}
if (addr_incr > 0)
{
curr_addr += (u32)addr_incr;
}
LogInfo("Value Update: %08x", val);
LogInfo("Current Hardware Address Update: %08x", curr_addr);
}
LogInfo("--------");
break;
case 0x1: // Halfword
LogInfo("Short Write");
LogInfo("--------");
for (int i=0; i < write_num; i++) {
Memory::Write_U16(val & 0xFFFF, curr_addr);
LogInfo("Write %08x to address %08x", val & 0xFFFF, curr_addr);
if (val_incr < 0)
{
val -= (u32)abs(val_incr);
}
if (val_incr > 0)
{
val += (u32)val_incr;
}
if (addr_incr < 0)
{
curr_addr -= (u32)abs(addr_incr);
}
if (addr_incr > 0)
{
curr_addr += (u32)addr_incr;
}
LogInfo("Value Update: %08x", val);
LogInfo("Current Hardware Address Update: %08x", curr_addr);
LogInfo("Short Write");
LogInfo("--------");
for (int i=0; i < write_num; i++) {
Memory::Write_U16(val & 0xFFFF, curr_addr);
LogInfo("Write %08x to address %08x", val & 0xFFFF, curr_addr);
if (val_incr < 0)
{
val -= (u32)abs(val_incr);
}
LogInfo("--------");
break;
if (val_incr > 0)
{
val += (u32)val_incr;
}
if (addr_incr < 0)
{
curr_addr -= (u32)abs(addr_incr);
}
if (addr_incr > 0)
{
curr_addr += (u32)addr_incr;
}
LogInfo("Value Update: %08x", val);
LogInfo("Current Hardware Address Update: %08x", curr_addr);
}
LogInfo("--------");
break;
case 0x2: // Word
LogInfo("Word Write");
LogInfo("--------");
for (int i=0; i < write_num; i++) {
Memory::Write_U32(val, curr_addr);
LogInfo("Write %08x to address %08x", val, curr_addr);
if (val_incr < 0)
{
val -= (u32)abs(val_incr);
}
if (val_incr > 0)
{
val += (u32)val_incr;
}
if (addr_incr < 0)
{
curr_addr -= (u32)abs(addr_incr);
}
if (addr_incr > 0)
{
curr_addr += (u32)addr_incr;
}
LogInfo("Value Update: %08x", val);
LogInfo("Current Hardware Address Update: %08x", curr_addr);
LogInfo("Word Write");
LogInfo("--------");
for (int i = 0; i < write_num; i++) {
Memory::Write_U32(val, curr_addr);
LogInfo("Write %08x to address %08x", val, curr_addr);
if (val_incr < 0)
{
val -= (u32)abs(val_incr);
}
LogInfo("--------");
break;
if (val_incr > 0)
{
val += (u32)val_incr;
}
if (addr_incr < 0)
{
curr_addr -= (u32)abs(addr_incr);
}
if (addr_incr > 0)
{
curr_addr += (u32)addr_incr;
}
LogInfo("Value Update: %08x", val);
LogInfo("Current Hardware Address Update: %08x", curr_addr);
}
LogInfo("--------");
break;
default:
LogInfo("Bad Size");
PanicAlert("Action Replay Error: Invalid size (%08x : address = %08x) in Fill and Slide (%s)", size, new_addr, code.name.c_str());
@ -685,7 +683,7 @@ bool ZeroCode_MemoryCopy(u32 val_last, u32 addr, u32 data) // Has not been teste
if ((data & ~0x7FFF) == 0x0000)
{
if((data >> 24) != 0x0)
if ((data >> 24) != 0x0)
{ // Memory Copy With Pointers Support
LogInfo("Memory Copy With Pointers Support");
LogInfo("--------");
@ -756,7 +754,7 @@ bool NormalCode_Type_1(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
LogInfo("Size: %08x", size);
LogInfo("Hardware Address: %08x", new_addr);
bool con = true;
switch(size)
switch (size)
{
case 0x0: con = (Memory::Read_U8(new_addr) == (u8)(data & 0xFF)); break;
case 0x1: con = (Memory::Read_U16(new_addr) == (u16)(data & 0xFFFF)); break;
@ -771,7 +769,7 @@ bool NormalCode_Type_1(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
*skip = !con; // set skip
LogInfo("Skip set to %s", !con ? "False" : "True");
switch(subtype)
switch (subtype)
{
case 0x0: *count = 1; break; // 1 line
case 0x1: *count = 2; break; // 2 lines
@ -784,6 +782,7 @@ bool NormalCode_Type_1(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
}
return true;
}
bool NormalCode_Type_2(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
{
u8 size = (addr >> 25) & 0x03;
@ -791,7 +790,7 @@ bool NormalCode_Type_2(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
LogInfo("Size: %08x", size);
LogInfo("Hardware Address: %08x", new_addr);
bool con = true;
switch(size)
switch (size)
{
case 0x0: con = (Memory::Read_U8(new_addr) != (u8)(data & 0xFF)); break;
case 0x1: con = (Memory::Read_U16(new_addr) != (u16)(data & 0xFFFF)); break;
@ -806,7 +805,7 @@ bool NormalCode_Type_2(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
*skip = !con; // set skip
LogInfo("Skip set to %s", !con ? "False" : "True");
switch(subtype)
switch (subtype)
{
case 0x0: *count = 1; break; // 1 line
case 0x1: *count = 2; break; // 2 lines
@ -819,6 +818,7 @@ bool NormalCode_Type_2(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
}
return true;
}
bool NormalCode_Type_3(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
{
u8 size = (addr >> 25) & 0x03;
@ -826,7 +826,7 @@ bool NormalCode_Type_3(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
LogInfo("Size: %08x", size);
LogInfo("Hardware Address: %08x", new_addr);
bool con = true;
switch(size)
switch (size)
{
case 0x0: con = ((char)Memory::Read_U8(new_addr) < (char)(data & 0xFF)); break;
case 0x1: con = ((short)Memory::Read_U16(new_addr) < (short)(data & 0xFFFF)); break;
@ -841,7 +841,7 @@ bool NormalCode_Type_3(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
*skip = !con; // set skip
LogInfo("Skip set to %s", !con ? "False" : "True");
switch(subtype)
switch (subtype)
{
case 0x0: *count = 1; break; // 1 line
case 0x1: *count = 2; break; // 2 lines
@ -854,6 +854,7 @@ bool NormalCode_Type_3(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
}
return true;
}
bool NormalCode_Type_4(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
{
u8 size = (addr >> 25) & 0x03;
@ -861,7 +862,7 @@ bool NormalCode_Type_4(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
LogInfo("Size: %08x", size);
LogInfo("Hardware Address: %08x", new_addr);
bool con = true;
switch(size)
switch (size)
{
case 0x0: con = ((char)Memory::Read_U8(new_addr) > (char)(data & 0xFF)); break;
case 0x1: con = ((short)Memory::Read_U16(new_addr) > (short)(data & 0xFFFF)); break;
@ -876,7 +877,7 @@ bool NormalCode_Type_4(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
*skip = !con; // set skip
LogInfo("Skip set to %s", !con ? "False" : "True");
switch(subtype)
switch (subtype)
{
case 0x0: *count = 1; break; // 1 line
case 0x1: *count = 2; break; // 2 lines
@ -889,6 +890,7 @@ bool NormalCode_Type_4(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
}
return true;
}
bool NormalCode_Type_5(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
{
u8 size = (addr >> 25) & 0x03;
@ -896,7 +898,7 @@ bool NormalCode_Type_5(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
LogInfo("Size: %08x", size);
LogInfo("Hardware Address: %08x", new_addr);
bool con = true;
switch(size)
switch (size)
{
case 0x0: con = (Memory::Read_U8(new_addr) < (data & 0xFF)); break;
case 0x1: con = (Memory::Read_U16(new_addr) < (data & 0xFFFF)); break;
@ -911,7 +913,7 @@ bool NormalCode_Type_5(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
*skip = !con; // set skip
LogInfo("Skip set to %s", !con ? "False" : "True");
switch(subtype)
switch (subtype)
{
case 0x0: *count = 1; break; // 1 line
case 0x1: *count = 2; break; // 2 lines
@ -924,6 +926,7 @@ bool NormalCode_Type_5(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
}
return true;
}
bool NormalCode_Type_6(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
{
u8 size = (addr >> 25) & 0x03;
@ -931,7 +934,7 @@ bool NormalCode_Type_6(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
LogInfo("Size: %08x", size);
LogInfo("Hardware Address: %08x", new_addr);
bool con = true;
switch(size)
switch (size)
{
case 0x0: con = (Memory::Read_U8(new_addr) > (data & 0xFF)); break;
case 0x1: con = (Memory::Read_U16(new_addr) > (data & 0xFFFF)); break;
@ -946,7 +949,7 @@ bool NormalCode_Type_6(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
*skip = !con; // set skip
LogInfo("Skip set to %s", !con ? "False" : "True");
switch(subtype)
switch (subtype)
{
case 0x0: *count = 1; break; // 1 line
case 0x1: *count = 2; break; // 2 lines
@ -959,6 +962,7 @@ bool NormalCode_Type_6(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
}
return true;
}
bool NormalCode_Type_7(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
{
u8 size = (addr >> 25) & 0x03;
@ -966,7 +970,7 @@ bool NormalCode_Type_7(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
LogInfo("Size: %08x", size);
LogInfo("Hardware Address: %08x", new_addr);
bool con = true;
switch(size)
switch (size)
{
case 0x0: con = ((Memory::Read_U8(new_addr) & (data & 0xFF)) != 0); break;
case 0x1: con = ((Memory::Read_U16(new_addr) & (data & 0xFFFF)) != 0); break;
@ -981,7 +985,7 @@ bool NormalCode_Type_7(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
*skip = !con; // set skip
LogInfo("Skip set to %s", !con ? "False" : "True");
switch(subtype)
switch (subtype)
{
case 0x0: *count = 1; break; // 1 line
case 0x1: *count = 2; break; // 2 lines
@ -999,6 +1003,7 @@ size_t ActionReplay_GetCodeListSize()
{
return arCodes.size();
}
ARCode ActionReplay_GetARCode(size_t index)
{
if (index > arCodes.size())
@ -1008,6 +1013,7 @@ ARCode ActionReplay_GetARCode(size_t index)
}
return arCodes[index];
}
void ActionReplay_SetARCode_IsActive(bool active, size_t index)
{
if (index > arCodes.size())
@ -1018,6 +1024,7 @@ void ActionReplay_SetARCode_IsActive(bool active, size_t index)
arCodes[index].active = active;
ActionReplay_UpdateActiveList();
}
void ActionReplay_UpdateActiveList()
{
b_RanOnce = false;
@ -1033,10 +1040,12 @@ void ActionReplay_EnableSelfLogging(bool enable)
{
logSelf = enable;
}
std::vector<std::string> ActionReplay_GetSelfLog()
const std::vector<std::string> &ActionReplay_GetSelfLog()
{
return arLog;
}
bool ActionReplay_IsSelfLogging()
{
return logSelf;

View file

@ -39,7 +39,7 @@ ARCode ActionReplay_GetARCode(size_t index);
void ActionReplay_SetARCode_IsActive(bool active, size_t index);
void ActionReplay_UpdateActiveList();
void ActionReplay_EnableSelfLogging(bool enable);
std::vector<std::string> ActionReplay_GetSelfLog();
const std::vector<std::string> &ActionReplay_GetSelfLog();
bool ActionReplay_IsSelfLogging();
#endif //_ACTIONREPLAY_H_

View file

@ -73,7 +73,7 @@ namespace Core
void Callback_VideoLog(const TCHAR* _szMessage, int _bDoBreak);
void Callback_VideoCopiedToXFB();
void Callback_DSPLog(const TCHAR* _szMessage, int _v);
char *Callback_ISOName(void);
const char *Callback_ISOName(void);
void Callback_DSPInterrupt();
void Callback_PADLog(const TCHAR* _szMessage);
void Callback_WiimoteLog(const TCHAR* _szMessage, int _v);
@ -371,16 +371,16 @@ THREAD_RETURN EmuThread(void *pArg)
}
// Wait for CPU thread to exit - it should have been signaled to do so by now
if(cpuThread)
if (cpuThread)
cpuThread->WaitForDeath();
if( g_pUpdateFPSDisplay != NULL )
if (g_pUpdateFPSDisplay != NULL)
g_pUpdateFPSDisplay("Stopping...");
if(cpuThread) {
delete cpuThread;
if (cpuThread) {
delete cpuThread; // This joins the cpu thread.
// Returns after game exited
cpuThread = NULL;
}
// Returns after game exited
g_bHwInit = false;
PluginPAD::PAD_Shutdown();
@ -395,8 +395,8 @@ THREAD_RETURN EmuThread(void *pArg)
HW::Shutdown();
LOG(MASTER_LOG, "EmuThread exited");
//The CPU should return when a game is stopped and cleanup should be done here,
//so we can restart the plugins (or load new ones) for the next game
// The CPU should return when a game is stopped and cleanup should be done here,
// so we can restart the plugins (or load new ones) for the next game.
if (_CoreParameter.hMainWindow == g_pWindowHandle)
Host_UpdateMainFrame();
return 0;
@ -514,7 +514,7 @@ void Callback_VideoCopiedToXFB()
(int)(idleDiff),
SystemTimers::GetTicksPerSecond()/1000000);
if( g_pUpdateFPSDisplay != NULL )
if (g_pUpdateFPSDisplay != NULL)
g_pUpdateFPSDisplay(temp);
Host_UpdateStatusBar(temp);
@ -555,12 +555,12 @@ void Callback_PADLog(const TCHAR* _szMessage)
// Callback_ISOName: Let the DSP plugin get the game name
//
//std::string Callback_ISOName(void)
char * Callback_ISOName(void)
const char *Callback_ISOName(void)
{
if(g_CoreStartupParameter.m_strName.length() > 0)
return (char *)g_CoreStartupParameter.m_strName.c_str();
if (g_CoreStartupParameter.m_strName.length() > 0)
return (const char *)g_CoreStartupParameter.m_strName.c_str();
else
return (char *)"";
return (const char *)"";
}
// __________________________________________________________________________________________________

View file

@ -72,7 +72,6 @@ void CheckGatherPipe()
memcpy(Memory::GetPointer(CPeripheralInterface::Fifo_CPUWritePointer), m_gatherPipe, GATHER_PIPE_SIZE);
// [F|RES]: i thought GP is forced to mem1 ... strange
// memcpy(&Memory::GetMainRAMPtr()[CPeripheralInterface::Fifo_CPUWritePointer], m_gatherPipe, GATHER_PIPE_SIZE);
// move back the spill bytes
m_gatherPipeCount -= GATHER_PIPE_SIZE;
@ -85,7 +84,7 @@ void CheckGatherPipe()
// increase the CPUWritePointer
CPeripheralInterface::Fifo_CPUWritePointer += GATHER_PIPE_SIZE;
if (CPeripheralInterface::Fifo_CPUWritePointer > CPeripheralInterface::Fifo_CPUEnd)
_assert_msg_(DYNA_REC, 0, "Fifo_CPUWritePointer out of bounds");
_assert_msg_(DYNA_REC, 0, "Fifo_CPUWritePointer out of bounds: %08x (end = %08x)", CPeripheralInterface::Fifo_CPUWritePointer, CPeripheralInterface::Fifo_CPUEnd);
if (CPeripheralInterface::Fifo_CPUWritePointer >= CPeripheralInterface::Fifo_CPUEnd)
CPeripheralInterface::Fifo_CPUWritePointer = CPeripheralInterface::Fifo_CPUBase;

View file

@ -623,7 +623,6 @@ bool Init()
position += FAKEVMEM_SIZE;
}
//WriteProtectMemory(base + 24*1024*1024, 8*1024*1024);
if (wii)
{
m_pPhysicalEXRAM = (u8*)g_arena.CreateViewAt(position, EXRAM_SIZE, base + 0x10000000);
@ -673,6 +672,7 @@ bool Init()
else
InitHWMemFuncs();
LOG(MEMMAP, "Memory system initialized. RAM at %p (0x80000000 @ %p)", base, base + 0x80000000);
m_IsInitialized = true;
return true;
}
@ -690,7 +690,6 @@ void DoState(PointerWrap &p)
bool Shutdown()
{
m_IsInitialized = false;
bool wii = Core::GetStartupParameter().bWii;
g_arena.ReleaseView(m_pRAM, RAM_SIZE);
@ -728,6 +727,7 @@ bool Shutdown()
g_arena.ReleaseView(m_pPhysicalFakeVMEM, FAKEVMEM_SIZE);
#endif
g_arena.ReleaseSpace();
LOG(MEMMAP, "Memory system shut down.");
return true;
}

View file

@ -511,7 +511,6 @@ void Update()
if (VerticalBeamPos == NextXFBRender)
{
u8* xfbPtr = 0;
int yOffset = 0;

View file

@ -197,24 +197,18 @@ void LogManager::Shutdown()
// ==========================================================================================
// The function that finally writes the log.
// ---------------
u32 lastPC;
std::string lastSymbol;
void LogManager::Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...)
{
static u32 lastPC;
static std::string lastSymbol;
if (m_LogSettings == NULL)
return;
// declarations
int v; // verbosity level
int type; // the log type, CONSOLE etc.
char cvv[20];
std::string svv;
// get the current verbosity level and type
sprintf(cvv, "%03i", (int)_type);
svv = cvv;
v = atoi(svv.substr(0, 1).c_str());
type = atoi(svv.substr(1, 2).c_str());
// TODO: Base 100 is bad for speed.
int v = _type / 100;
int type = _type % 100;
// security checks
if (m_Log[_type] == NULL || !m_Log[_type]->m_bEnable
@ -310,7 +304,7 @@ void LogManager::Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...)
fprintf(m_Log[ver*100 + LogTypes::MASTER_LOG]->m_pFile, "%s", Msg2);
/* In case it crashes write now to make sure you get the last messages.
Is this slower than caching it? */
Is this slower than caching it? Most likely yes, fflush can be really slow.*/
//fflush(m_Log[id]->m_pFile);
//fflush(m_Log[ver*100 + LogTypes::MASTER_LOG]->m_pFile);
@ -320,15 +314,13 @@ void LogManager::Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...)
m_nextMessages[ver]++;
if (m_nextMessages[ver] >= MAX_MESSAGES)
m_nextMessages[ver] = 0;
// ---------------
}
else // write to separate files and structs
{
int id;
for (int i = VERBOSITY_LEVELS; i >= v ; i--)
{
// prepare the right id
id = i*100 + type;
int id = i*100 + type;
// write to memory
m_Messages[i][m_nextMessages[i]].Set((LogTypes::LOG_TYPE)id, v, Msg2);
@ -357,12 +349,3 @@ void LogManager::Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...)
}
m_bDirty = true; // tell LogWindow that the log has been updated
}
bool IsLoggingActivated()
{
#ifdef LOGGING
return true;
#else
return false;
#endif
}

View file

@ -30,8 +30,9 @@ struct CDebugger_Log
{
char m_szName[128];
char m_szShortName[32];
char m_szShortName_[32]; // save the unadjusted originals here
char m_szShortName_[32]; // save the unadjusted originals here ( ???? )
char m_szFilename[256];
bool m_bLogToFile;
bool m_bShowInLog;
bool m_bEnable;
@ -40,10 +41,7 @@ struct CDebugger_Log
void Init();
void Shutdown();
// constructor
CDebugger_Log(const char* _szShortName, const char* _szName, int a);
// destructor
~CDebugger_Log();
};
@ -55,10 +53,7 @@ struct CDebugger_LogSettings
bool bWriteMaster;
bool bUnify;
// constructor
CDebugger_LogSettings();
// destructor
~CDebugger_LogSettings();
};
@ -67,7 +62,6 @@ class LogManager
#define MAX_MESSAGES 8000 // the old value was to large
#define MAX_MSGLEN 256
public:
// Message
struct SMessage
{
@ -103,6 +97,7 @@ public:
//
static void Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...);
};
private:
enum LOG_SETTINGS
{
@ -118,13 +113,17 @@ private:
static bool m_bInitialized;
static CDebugger_LogSettings* m_LogSettings;
static CDebugger_Log* m_Log[LogTypes::NUMBER_OF_LOGS + (VERBOSITY_LEVELS * 100)]; // make 326 of them
public:
static void Init();
static void Clear(void);
static void Shutdown();
#ifdef LOGGING
static bool Enabled() { return true; }
#else
static bool Enabled() { return false; }
#endif
static void Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...);
};
extern bool IsLoggingActivated();
#endif

View file

@ -359,8 +359,9 @@ CodeOp *Flatten(u32 address, u32 &realsize, BlockStats &st, BlockRegStats &gpa,
code[i].branchToIndex = -1;
code[i].x86ptr = 0;
GekkoOPInfo *opinfo = GetOpInfo(inst);
numCycles += opinfo->numCyclesMinusOne + 1;
_assert_msg_(GEKKO, opinfo != 0,"Invalid Op - Error flattening %08x op %08x",address+i*4,inst);
if (opinfo)
numCycles += opinfo->numCyclesMinusOne + 1;
_assert_msg_(GEKKO, opinfo != 0, "Invalid Op - Error flattening %08x op %08x",address+i*4,inst);
int flags = opinfo->flags;
bool follow = false;

View file

@ -309,7 +309,7 @@ bool SymbolDB::SaveMap(const char *filename, bool WithCodes) const
{
// Format the name for the codes version
std::string mapFile = filename;
if(WithCodes) mapFile = mapFile.substr(0, mapFile.find_last_of(".")) + "_code.map";
if (WithCodes) mapFile = mapFile.substr(0, mapFile.find_last_of(".")) + "_code.map";
// Make a file
FILE *f = fopen(mapFile.c_str(), "w");

View file

@ -284,11 +284,13 @@ void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStart
// additional dialogs
if (IsLoggingActivated() && bLogWindow)
#ifdef LOGGING
if (bLogWindow)
{
m_LogWindow = new CLogWindow(this);
m_LogWindow->Show(true);
}
#endif
if (bRegisterWindow)
{
@ -380,7 +382,7 @@ void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParam
{
wxMenu* pDebugDialogs = new wxMenu;
if (IsLoggingActivated())
if (LogManager::Enabled())
{
wxMenuItem* pLogWindow = pDebugDialogs->Append(IDM_LOGWINDOW, _T("&LogManager"), wxEmptyString, wxITEM_CHECK);
pLogWindow->Check(bLogWindow);
@ -905,12 +907,11 @@ void CCodeWindow::OnSymbolListContextMenu(wxContextMenuEvent& event)
/////////////////////////////////////////////////////////////////////////////////////////////////
// Show and hide windows
// -----------------------
/////////////////////////////////////////////////////////////////////////////////////////////////
void CCodeWindow::OnToggleLogWindow(wxCommandEvent& event)
{
if (IsLoggingActivated())
if (LogManager::Enabled())
{
bool show = GetMenuBar()->IsChecked(event.GetId());

View file

@ -198,7 +198,7 @@ void wxCheatsWindow::OnEvent_ButtonUpdateCodes_Press(wxCommandEvent& WXUNUSED (e
void wxCheatsWindow::OnEvent_ButtonUpdateLog_Press(wxCommandEvent& WXUNUSED (event))
{
m_TextCtrl_Log->Clear();
std::vector<std::string> arLog = ActionReplay_GetSelfLog();
const std::vector<std::string> &arLog = ActionReplay_GetSelfLog();
for (int i = 0; i < arLog.size(); i++)
{
m_TextCtrl_Log->AppendText(wxString::FromAscii(arLog[i].c_str()));

View file

@ -592,7 +592,7 @@ void CGameListCtrl::OnDeleteGCM(wxCommandEvent& WXUNUSED (event))
if (!iso)
return;
if (wxMessageBox(_("Are you sure you want to delete this file?\nIt will be gone forever!"),
wxMessageBoxCaptionStr, wxYES_NO|wxICON_EXCLAMATION) == wxYES)
wxMessageBoxCaptionStr, wxYES_NO | wxICON_EXCLAMATION) == wxYES)
{
File::Delete(iso->GetFileName().c_str());
Update();
@ -601,7 +601,7 @@ void CGameListCtrl::OnDeleteGCM(wxCommandEvent& WXUNUSED (event))
else
{
if (wxMessageBox(_("Are you sure you want to delete these files?\nThey will be gone forever!"),
wxMessageBoxCaptionStr, wxYES_NO|wxICON_EXCLAMATION) == wxYES)
wxMessageBoxCaptionStr, wxYES_NO | wxICON_EXCLAMATION) == wxYES)
{
int selected = GetSelectedItemCount();

View file

@ -371,7 +371,7 @@
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_SECURE_SCL=0WIN32;_LIB;__WXMSW__;wxUSE_BASE=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_SECURE_SCL=0;__WXMSW__;wxUSE_BASE=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
RuntimeLibrary="0"
BufferSecurityCheck="false"
UsePrecompiledHeader="0"

View file

@ -8,14 +8,14 @@
#include "PluginSpecs.h"
#include "ExportProlog.h"
typedef unsigned char (*TARAM_Read_U8)(const unsigned int _uAddress);
typedef unsigned char* (*TGetMemoryPointer)(const unsigned int _uAddress);
typedef unsigned char* (*TGetARAMPointer)(void);
typedef void (*TLogv)(const char* _szMessage, int _v);
typedef char* (*TName)(void);
typedef void (*TDebuggerBreak)(void);
typedef void (*TGenerateDSPInt)(void);
typedef unsigned int(*TAudioGetStreaming)(short* _pDestBuffer, unsigned int _numSamples);
typedef unsigned char (*TARAM_Read_U8)(const unsigned int _uAddress);
typedef unsigned char* (*TGetMemoryPointer)(const unsigned int _uAddress);
typedef unsigned char* (*TGetARAMPointer)(void);
typedef void (*TLogv)(const char* _szMessage, int _v);
typedef const char* (*TName)(void);
typedef void (*TDebuggerBreak)(void);
typedef void (*TGenerateDSPInt)(void);
typedef unsigned int (*TAudioGetStreaming)(short* _pDestBuffer, unsigned int _numSamples);
typedef struct
{