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:
parent
4355c37397
commit
522752c77d
|
@ -58,7 +58,7 @@ void CriticalSection::Enter()
|
||||||
|
|
||||||
bool CriticalSection::TryEnter()
|
bool CriticalSection::TryEnter()
|
||||||
{
|
{
|
||||||
return(TryEnterCriticalSection(§ion) ? true : false);
|
return TryEnterCriticalSection(§ion) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,15 +15,14 @@
|
||||||
// Official SVN repository and contact information can be found at
|
// Official SVN repository and contact information can be found at
|
||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
|
// Partial Action Replay code system implementation.
|
||||||
// Simple partial Action Replay code system implementation.
|
|
||||||
|
|
||||||
// Will never be able to support some AR codes - specifically those that patch the running
|
// 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 engine itself - yes they do exist!!!
|
||||||
|
|
||||||
// Action Replay actually is a small virtual machine with a limited number of commands.
|
// 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
|
// It probably is Turing complete - but what does that matter when AR codes can write
|
||||||
// actual PowerPC code.
|
// actual PowerPC code...
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -166,14 +165,14 @@ 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);
|
char* temp = (char*)alloca(strlen(format)+512);
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
CharArrayFromFormatV(temp, 512, format, args);
|
CharArrayFromFormatV(temp, 512, format, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
if (IsLoggingActivated())
|
if (LogManager::Enabled())
|
||||||
LogManager::Log(LogTypes::ACTIONREPLAY, temp);
|
LogManager::Log(LogTypes::ACTIONREPLAY, temp);
|
||||||
if (logSelf)
|
if (logSelf)
|
||||||
{
|
{
|
||||||
|
@ -189,20 +188,21 @@ void ActionReplayRunAllActive()
|
||||||
{
|
{
|
||||||
if (Core::GetStartupParameter().bEnableCheats) {
|
if (Core::GetStartupParameter().bEnableCheats) {
|
||||||
for (std::vector<ARCode>::iterator iter = activeCodes.begin(); iter != activeCodes.end(); ++iter)
|
for (std::vector<ARCode>::iterator iter = activeCodes.begin(); iter != activeCodes.end(); ++iter)
|
||||||
if (iter->active) {
|
{
|
||||||
|
if (iter->active)
|
||||||
|
{
|
||||||
if (!RunActionReplayCode(*iter))
|
if (!RunActionReplayCode(*iter))
|
||||||
iter->active = false;
|
iter->active = false;
|
||||||
LogInfo("\n");
|
LogInfo("\n");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (!b_RanOnce)
|
if (!b_RanOnce)
|
||||||
b_RanOnce = true;
|
b_RanOnce = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool RunActionReplayCode(const ARCode &arcode) {
|
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;
|
u8 cmd;
|
||||||
u32 addr;
|
u32 addr;
|
||||||
u32 data;
|
u32 data;
|
||||||
|
@ -276,7 +276,8 @@ bool RunActionReplayCode(const ARCode &arcode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// skip these weird init lines
|
// skip these weird init lines
|
||||||
if (iter == code.ops.begin() && cmd == 1) continue;
|
if (iter == code.ops.begin() && cmd == 1)
|
||||||
|
continue;
|
||||||
|
|
||||||
// Zero codes
|
// Zero codes
|
||||||
if (addr == 0x0) // Check if the code is a zero code
|
if (addr == 0x0) // Check if the code is a zero code
|
||||||
|
@ -380,8 +381,6 @@ bool RunActionReplayCode(const ARCode &arcode) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Subtypes
|
// Subtypes
|
||||||
bool Subtype_RamWriteAndFill(u32 addr, u32 data)
|
bool Subtype_RamWriteAndFill(u32 addr, u32 data)
|
||||||
{
|
{
|
||||||
|
@ -543,7 +542,6 @@ bool Subtype_MasterCodeAndWriteToCCXXXXXX()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Zero Codes
|
// Zero Codes
|
||||||
bool ZeroCode_FillAndSlide(u32 val_last, u32 addr, u32 data) // This needs more testing
|
bool ZeroCode_FillAndSlide(u32 val_last, u32 addr, u32 data) // This needs more testing
|
||||||
{
|
{
|
||||||
|
@ -784,6 +782,7 @@ bool NormalCode_Type_1(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NormalCode_Type_2(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
|
bool NormalCode_Type_2(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
|
||||||
{
|
{
|
||||||
u8 size = (addr >> 25) & 0x03;
|
u8 size = (addr >> 25) & 0x03;
|
||||||
|
@ -819,6 +818,7 @@ bool NormalCode_Type_2(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NormalCode_Type_3(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
|
bool NormalCode_Type_3(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
|
||||||
{
|
{
|
||||||
u8 size = (addr >> 25) & 0x03;
|
u8 size = (addr >> 25) & 0x03;
|
||||||
|
@ -854,6 +854,7 @@ bool NormalCode_Type_3(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NormalCode_Type_4(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
|
bool NormalCode_Type_4(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
|
||||||
{
|
{
|
||||||
u8 size = (addr >> 25) & 0x03;
|
u8 size = (addr >> 25) & 0x03;
|
||||||
|
@ -889,6 +890,7 @@ bool NormalCode_Type_4(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NormalCode_Type_5(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
|
bool NormalCode_Type_5(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
|
||||||
{
|
{
|
||||||
u8 size = (addr >> 25) & 0x03;
|
u8 size = (addr >> 25) & 0x03;
|
||||||
|
@ -924,6 +926,7 @@ bool NormalCode_Type_5(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NormalCode_Type_6(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
|
bool NormalCode_Type_6(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
|
||||||
{
|
{
|
||||||
u8 size = (addr >> 25) & 0x03;
|
u8 size = (addr >> 25) & 0x03;
|
||||||
|
@ -959,6 +962,7 @@ bool NormalCode_Type_6(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NormalCode_Type_7(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
|
bool NormalCode_Type_7(u8 subtype, u32 addr, u32 data, int *count, bool *skip)
|
||||||
{
|
{
|
||||||
u8 size = (addr >> 25) & 0x03;
|
u8 size = (addr >> 25) & 0x03;
|
||||||
|
@ -999,6 +1003,7 @@ size_t ActionReplay_GetCodeListSize()
|
||||||
{
|
{
|
||||||
return arCodes.size();
|
return arCodes.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
ARCode ActionReplay_GetARCode(size_t index)
|
ARCode ActionReplay_GetARCode(size_t index)
|
||||||
{
|
{
|
||||||
if (index > arCodes.size())
|
if (index > arCodes.size())
|
||||||
|
@ -1008,6 +1013,7 @@ ARCode ActionReplay_GetARCode(size_t index)
|
||||||
}
|
}
|
||||||
return arCodes[index];
|
return arCodes[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionReplay_SetARCode_IsActive(bool active, size_t index)
|
void ActionReplay_SetARCode_IsActive(bool active, size_t index)
|
||||||
{
|
{
|
||||||
if (index > arCodes.size())
|
if (index > arCodes.size())
|
||||||
|
@ -1018,6 +1024,7 @@ void ActionReplay_SetARCode_IsActive(bool active, size_t index)
|
||||||
arCodes[index].active = active;
|
arCodes[index].active = active;
|
||||||
ActionReplay_UpdateActiveList();
|
ActionReplay_UpdateActiveList();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionReplay_UpdateActiveList()
|
void ActionReplay_UpdateActiveList()
|
||||||
{
|
{
|
||||||
b_RanOnce = false;
|
b_RanOnce = false;
|
||||||
|
@ -1033,10 +1040,12 @@ void ActionReplay_EnableSelfLogging(bool enable)
|
||||||
{
|
{
|
||||||
logSelf = enable;
|
logSelf = enable;
|
||||||
}
|
}
|
||||||
std::vector<std::string> ActionReplay_GetSelfLog()
|
|
||||||
|
const std::vector<std::string> &ActionReplay_GetSelfLog()
|
||||||
{
|
{
|
||||||
return arLog;
|
return arLog;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ActionReplay_IsSelfLogging()
|
bool ActionReplay_IsSelfLogging()
|
||||||
{
|
{
|
||||||
return logSelf;
|
return logSelf;
|
||||||
|
|
|
@ -39,7 +39,7 @@ ARCode ActionReplay_GetARCode(size_t index);
|
||||||
void ActionReplay_SetARCode_IsActive(bool active, size_t index);
|
void ActionReplay_SetARCode_IsActive(bool active, size_t index);
|
||||||
void ActionReplay_UpdateActiveList();
|
void ActionReplay_UpdateActiveList();
|
||||||
void ActionReplay_EnableSelfLogging(bool enable);
|
void ActionReplay_EnableSelfLogging(bool enable);
|
||||||
std::vector<std::string> ActionReplay_GetSelfLog();
|
const std::vector<std::string> &ActionReplay_GetSelfLog();
|
||||||
bool ActionReplay_IsSelfLogging();
|
bool ActionReplay_IsSelfLogging();
|
||||||
|
|
||||||
#endif //_ACTIONREPLAY_H_
|
#endif //_ACTIONREPLAY_H_
|
||||||
|
|
|
@ -73,7 +73,7 @@ namespace Core
|
||||||
void Callback_VideoLog(const TCHAR* _szMessage, int _bDoBreak);
|
void Callback_VideoLog(const TCHAR* _szMessage, int _bDoBreak);
|
||||||
void Callback_VideoCopiedToXFB();
|
void Callback_VideoCopiedToXFB();
|
||||||
void Callback_DSPLog(const TCHAR* _szMessage, int _v);
|
void Callback_DSPLog(const TCHAR* _szMessage, int _v);
|
||||||
char *Callback_ISOName(void);
|
const char *Callback_ISOName(void);
|
||||||
void Callback_DSPInterrupt();
|
void Callback_DSPInterrupt();
|
||||||
void Callback_PADLog(const TCHAR* _szMessage);
|
void Callback_PADLog(const TCHAR* _szMessage);
|
||||||
void Callback_WiimoteLog(const TCHAR* _szMessage, int _v);
|
void Callback_WiimoteLog(const TCHAR* _szMessage, int _v);
|
||||||
|
@ -375,12 +375,12 @@ THREAD_RETURN EmuThread(void *pArg)
|
||||||
cpuThread->WaitForDeath();
|
cpuThread->WaitForDeath();
|
||||||
if (g_pUpdateFPSDisplay != NULL)
|
if (g_pUpdateFPSDisplay != NULL)
|
||||||
g_pUpdateFPSDisplay("Stopping...");
|
g_pUpdateFPSDisplay("Stopping...");
|
||||||
|
|
||||||
if (cpuThread) {
|
if (cpuThread) {
|
||||||
delete cpuThread;
|
delete cpuThread; // This joins the cpu thread.
|
||||||
|
// Returns after game exited
|
||||||
cpuThread = NULL;
|
cpuThread = NULL;
|
||||||
}
|
}
|
||||||
// Returns after game exited
|
|
||||||
|
|
||||||
g_bHwInit = false;
|
g_bHwInit = false;
|
||||||
|
|
||||||
PluginPAD::PAD_Shutdown();
|
PluginPAD::PAD_Shutdown();
|
||||||
|
@ -396,7 +396,7 @@ THREAD_RETURN EmuThread(void *pArg)
|
||||||
|
|
||||||
LOG(MASTER_LOG, "EmuThread exited");
|
LOG(MASTER_LOG, "EmuThread exited");
|
||||||
// The CPU should return when a game is stopped and cleanup should be done here,
|
// 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
|
// so we can restart the plugins (or load new ones) for the next game.
|
||||||
if (_CoreParameter.hMainWindow == g_pWindowHandle)
|
if (_CoreParameter.hMainWindow == g_pWindowHandle)
|
||||||
Host_UpdateMainFrame();
|
Host_UpdateMainFrame();
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -555,12 +555,12 @@ void Callback_PADLog(const TCHAR* _szMessage)
|
||||||
// Callback_ISOName: Let the DSP plugin get the game name
|
// Callback_ISOName: Let the DSP plugin get the game name
|
||||||
//
|
//
|
||||||
//std::string Callback_ISOName(void)
|
//std::string Callback_ISOName(void)
|
||||||
char * Callback_ISOName(void)
|
const char *Callback_ISOName(void)
|
||||||
{
|
{
|
||||||
if (g_CoreStartupParameter.m_strName.length() > 0)
|
if (g_CoreStartupParameter.m_strName.length() > 0)
|
||||||
return (char *)g_CoreStartupParameter.m_strName.c_str();
|
return (const char *)g_CoreStartupParameter.m_strName.c_str();
|
||||||
else
|
else
|
||||||
return (char *)"";
|
return (const char *)"";
|
||||||
}
|
}
|
||||||
|
|
||||||
// __________________________________________________________________________________________________
|
// __________________________________________________________________________________________________
|
||||||
|
|
|
@ -72,7 +72,6 @@ void CheckGatherPipe()
|
||||||
memcpy(Memory::GetPointer(CPeripheralInterface::Fifo_CPUWritePointer), m_gatherPipe, GATHER_PIPE_SIZE);
|
memcpy(Memory::GetPointer(CPeripheralInterface::Fifo_CPUWritePointer), m_gatherPipe, GATHER_PIPE_SIZE);
|
||||||
|
|
||||||
// [F|RES]: i thought GP is forced to mem1 ... strange
|
// [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
|
// move back the spill bytes
|
||||||
m_gatherPipeCount -= GATHER_PIPE_SIZE;
|
m_gatherPipeCount -= GATHER_PIPE_SIZE;
|
||||||
|
@ -85,7 +84,7 @@ void CheckGatherPipe()
|
||||||
// increase the CPUWritePointer
|
// increase the CPUWritePointer
|
||||||
CPeripheralInterface::Fifo_CPUWritePointer += GATHER_PIPE_SIZE;
|
CPeripheralInterface::Fifo_CPUWritePointer += GATHER_PIPE_SIZE;
|
||||||
if (CPeripheralInterface::Fifo_CPUWritePointer > CPeripheralInterface::Fifo_CPUEnd)
|
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)
|
if (CPeripheralInterface::Fifo_CPUWritePointer >= CPeripheralInterface::Fifo_CPUEnd)
|
||||||
CPeripheralInterface::Fifo_CPUWritePointer = CPeripheralInterface::Fifo_CPUBase;
|
CPeripheralInterface::Fifo_CPUWritePointer = CPeripheralInterface::Fifo_CPUBase;
|
||||||
|
|
|
@ -623,7 +623,6 @@ bool Init()
|
||||||
position += FAKEVMEM_SIZE;
|
position += FAKEVMEM_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//WriteProtectMemory(base + 24*1024*1024, 8*1024*1024);
|
|
||||||
if (wii)
|
if (wii)
|
||||||
{
|
{
|
||||||
m_pPhysicalEXRAM = (u8*)g_arena.CreateViewAt(position, EXRAM_SIZE, base + 0x10000000);
|
m_pPhysicalEXRAM = (u8*)g_arena.CreateViewAt(position, EXRAM_SIZE, base + 0x10000000);
|
||||||
|
@ -673,6 +672,7 @@ bool Init()
|
||||||
else
|
else
|
||||||
InitHWMemFuncs();
|
InitHWMemFuncs();
|
||||||
|
|
||||||
|
LOG(MEMMAP, "Memory system initialized. RAM at %p (0x80000000 @ %p)", base, base + 0x80000000);
|
||||||
m_IsInitialized = true;
|
m_IsInitialized = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -690,7 +690,6 @@ void DoState(PointerWrap &p)
|
||||||
bool Shutdown()
|
bool Shutdown()
|
||||||
{
|
{
|
||||||
m_IsInitialized = false;
|
m_IsInitialized = false;
|
||||||
|
|
||||||
bool wii = Core::GetStartupParameter().bWii;
|
bool wii = Core::GetStartupParameter().bWii;
|
||||||
|
|
||||||
g_arena.ReleaseView(m_pRAM, RAM_SIZE);
|
g_arena.ReleaseView(m_pRAM, RAM_SIZE);
|
||||||
|
@ -728,6 +727,7 @@ bool Shutdown()
|
||||||
g_arena.ReleaseView(m_pPhysicalFakeVMEM, FAKEVMEM_SIZE);
|
g_arena.ReleaseView(m_pPhysicalFakeVMEM, FAKEVMEM_SIZE);
|
||||||
#endif
|
#endif
|
||||||
g_arena.ReleaseSpace();
|
g_arena.ReleaseSpace();
|
||||||
|
LOG(MEMMAP, "Memory system shut down.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -511,7 +511,6 @@ void Update()
|
||||||
|
|
||||||
if (VerticalBeamPos == NextXFBRender)
|
if (VerticalBeamPos == NextXFBRender)
|
||||||
{
|
{
|
||||||
|
|
||||||
u8* xfbPtr = 0;
|
u8* xfbPtr = 0;
|
||||||
int yOffset = 0;
|
int yOffset = 0;
|
||||||
|
|
||||||
|
|
|
@ -197,24 +197,18 @@ void LogManager::Shutdown()
|
||||||
// ==========================================================================================
|
// ==========================================================================================
|
||||||
// The function that finally writes the log.
|
// The function that finally writes the log.
|
||||||
// ---------------
|
// ---------------
|
||||||
u32 lastPC;
|
|
||||||
std::string lastSymbol;
|
|
||||||
void LogManager::Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...)
|
void LogManager::Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...)
|
||||||
{
|
{
|
||||||
|
static u32 lastPC;
|
||||||
|
static std::string lastSymbol;
|
||||||
|
|
||||||
if (m_LogSettings == NULL)
|
if (m_LogSettings == NULL)
|
||||||
return;
|
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
|
// get the current verbosity level and type
|
||||||
sprintf(cvv, "%03i", (int)_type);
|
// TODO: Base 100 is bad for speed.
|
||||||
svv = cvv;
|
int v = _type / 100;
|
||||||
v = atoi(svv.substr(0, 1).c_str());
|
int type = _type % 100;
|
||||||
type = atoi(svv.substr(1, 2).c_str());
|
|
||||||
|
|
||||||
// security checks
|
// security checks
|
||||||
if (m_Log[_type] == NULL || !m_Log[_type]->m_bEnable
|
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);
|
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.
|
/* 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[id]->m_pFile);
|
||||||
//fflush(m_Log[ver*100 + LogTypes::MASTER_LOG]->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]++;
|
m_nextMessages[ver]++;
|
||||||
if (m_nextMessages[ver] >= MAX_MESSAGES)
|
if (m_nextMessages[ver] >= MAX_MESSAGES)
|
||||||
m_nextMessages[ver] = 0;
|
m_nextMessages[ver] = 0;
|
||||||
// ---------------
|
|
||||||
}
|
}
|
||||||
else // write to separate files and structs
|
else // write to separate files and structs
|
||||||
{
|
{
|
||||||
int id;
|
|
||||||
for (int i = VERBOSITY_LEVELS; i >= v ; i--)
|
for (int i = VERBOSITY_LEVELS; i >= v ; i--)
|
||||||
{
|
{
|
||||||
// prepare the right id
|
// prepare the right id
|
||||||
id = i*100 + type;
|
int id = i*100 + type;
|
||||||
|
|
||||||
// write to memory
|
// write to memory
|
||||||
m_Messages[i][m_nextMessages[i]].Set((LogTypes::LOG_TYPE)id, v, Msg2);
|
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
|
m_bDirty = true; // tell LogWindow that the log has been updated
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsLoggingActivated()
|
|
||||||
{
|
|
||||||
#ifdef LOGGING
|
|
||||||
return true;
|
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
|
@ -30,8 +30,9 @@ struct CDebugger_Log
|
||||||
{
|
{
|
||||||
char m_szName[128];
|
char m_szName[128];
|
||||||
char m_szShortName[32];
|
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];
|
char m_szFilename[256];
|
||||||
|
|
||||||
bool m_bLogToFile;
|
bool m_bLogToFile;
|
||||||
bool m_bShowInLog;
|
bool m_bShowInLog;
|
||||||
bool m_bEnable;
|
bool m_bEnable;
|
||||||
|
@ -40,10 +41,7 @@ struct CDebugger_Log
|
||||||
void Init();
|
void Init();
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
|
|
||||||
// constructor
|
|
||||||
CDebugger_Log(const char* _szShortName, const char* _szName, int a);
|
CDebugger_Log(const char* _szShortName, const char* _szName, int a);
|
||||||
|
|
||||||
// destructor
|
|
||||||
~CDebugger_Log();
|
~CDebugger_Log();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -55,10 +53,7 @@ struct CDebugger_LogSettings
|
||||||
bool bWriteMaster;
|
bool bWriteMaster;
|
||||||
bool bUnify;
|
bool bUnify;
|
||||||
|
|
||||||
// constructor
|
|
||||||
CDebugger_LogSettings();
|
CDebugger_LogSettings();
|
||||||
|
|
||||||
// destructor
|
|
||||||
~CDebugger_LogSettings();
|
~CDebugger_LogSettings();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -67,7 +62,6 @@ class LogManager
|
||||||
#define MAX_MESSAGES 8000 // the old value was to large
|
#define MAX_MESSAGES 8000 // the old value was to large
|
||||||
#define MAX_MSGLEN 256
|
#define MAX_MSGLEN 256
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Message
|
// Message
|
||||||
struct SMessage
|
struct SMessage
|
||||||
{
|
{
|
||||||
|
@ -103,6 +97,7 @@ public:
|
||||||
//
|
//
|
||||||
static void Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...);
|
static void Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...);
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum LOG_SETTINGS
|
enum LOG_SETTINGS
|
||||||
{
|
{
|
||||||
|
@ -118,13 +113,17 @@ private:
|
||||||
static bool m_bInitialized;
|
static bool m_bInitialized;
|
||||||
static CDebugger_LogSettings* m_LogSettings;
|
static CDebugger_LogSettings* m_LogSettings;
|
||||||
static CDebugger_Log* m_Log[LogTypes::NUMBER_OF_LOGS + (VERBOSITY_LEVELS * 100)]; // make 326 of them
|
static CDebugger_Log* m_Log[LogTypes::NUMBER_OF_LOGS + (VERBOSITY_LEVELS * 100)]; // make 326 of them
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void Init();
|
static void Init();
|
||||||
static void Clear(void);
|
static void Clear(void);
|
||||||
static void Shutdown();
|
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, ...);
|
static void Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern bool IsLoggingActivated();
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -359,6 +359,7 @@ CodeOp *Flatten(u32 address, u32 &realsize, BlockStats &st, BlockRegStats &gpa,
|
||||||
code[i].branchToIndex = -1;
|
code[i].branchToIndex = -1;
|
||||||
code[i].x86ptr = 0;
|
code[i].x86ptr = 0;
|
||||||
GekkoOPInfo *opinfo = GetOpInfo(inst);
|
GekkoOPInfo *opinfo = GetOpInfo(inst);
|
||||||
|
if (opinfo)
|
||||||
numCycles += opinfo->numCyclesMinusOne + 1;
|
numCycles += opinfo->numCyclesMinusOne + 1;
|
||||||
_assert_msg_(GEKKO, opinfo != 0, "Invalid Op - Error flattening %08x op %08x",address+i*4,inst);
|
_assert_msg_(GEKKO, opinfo != 0, "Invalid Op - Error flattening %08x op %08x",address+i*4,inst);
|
||||||
int flags = opinfo->flags;
|
int flags = opinfo->flags;
|
||||||
|
|
|
@ -284,11 +284,13 @@ void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStart
|
||||||
|
|
||||||
|
|
||||||
// additional dialogs
|
// additional dialogs
|
||||||
if (IsLoggingActivated() && bLogWindow)
|
#ifdef LOGGING
|
||||||
|
if (bLogWindow)
|
||||||
{
|
{
|
||||||
m_LogWindow = new CLogWindow(this);
|
m_LogWindow = new CLogWindow(this);
|
||||||
m_LogWindow->Show(true);
|
m_LogWindow->Show(true);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (bRegisterWindow)
|
if (bRegisterWindow)
|
||||||
{
|
{
|
||||||
|
@ -380,7 +382,7 @@ void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParam
|
||||||
{
|
{
|
||||||
wxMenu* pDebugDialogs = new wxMenu;
|
wxMenu* pDebugDialogs = new wxMenu;
|
||||||
|
|
||||||
if (IsLoggingActivated())
|
if (LogManager::Enabled())
|
||||||
{
|
{
|
||||||
wxMenuItem* pLogWindow = pDebugDialogs->Append(IDM_LOGWINDOW, _T("&LogManager"), wxEmptyString, wxITEM_CHECK);
|
wxMenuItem* pLogWindow = pDebugDialogs->Append(IDM_LOGWINDOW, _T("&LogManager"), wxEmptyString, wxITEM_CHECK);
|
||||||
pLogWindow->Check(bLogWindow);
|
pLogWindow->Check(bLogWindow);
|
||||||
|
@ -905,12 +907,11 @@ void CCodeWindow::OnSymbolListContextMenu(wxContextMenuEvent& event)
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Show and hide windows
|
// Show and hide windows
|
||||||
// -----------------------
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void CCodeWindow::OnToggleLogWindow(wxCommandEvent& event)
|
void CCodeWindow::OnToggleLogWindow(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
if (IsLoggingActivated())
|
if (LogManager::Enabled())
|
||||||
{
|
{
|
||||||
bool show = GetMenuBar()->IsChecked(event.GetId());
|
bool show = GetMenuBar()->IsChecked(event.GetId());
|
||||||
|
|
||||||
|
|
|
@ -198,7 +198,7 @@ void wxCheatsWindow::OnEvent_ButtonUpdateCodes_Press(wxCommandEvent& WXUNUSED (e
|
||||||
void wxCheatsWindow::OnEvent_ButtonUpdateLog_Press(wxCommandEvent& WXUNUSED (event))
|
void wxCheatsWindow::OnEvent_ButtonUpdateLog_Press(wxCommandEvent& WXUNUSED (event))
|
||||||
{
|
{
|
||||||
m_TextCtrl_Log->Clear();
|
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++)
|
for (int i = 0; i < arLog.size(); i++)
|
||||||
{
|
{
|
||||||
m_TextCtrl_Log->AppendText(wxString::FromAscii(arLog[i].c_str()));
|
m_TextCtrl_Log->AppendText(wxString::FromAscii(arLog[i].c_str()));
|
||||||
|
|
|
@ -371,7 +371,7 @@
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs"
|
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"
|
RuntimeLibrary="0"
|
||||||
BufferSecurityCheck="false"
|
BufferSecurityCheck="false"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
|
|
|
@ -12,7 +12,7 @@ typedef unsigned char (*TARAM_Read_U8)(const unsigned int _uAddress);
|
||||||
typedef unsigned char* (*TGetMemoryPointer)(const unsigned int _uAddress);
|
typedef unsigned char* (*TGetMemoryPointer)(const unsigned int _uAddress);
|
||||||
typedef unsigned char* (*TGetARAMPointer)(void);
|
typedef unsigned char* (*TGetARAMPointer)(void);
|
||||||
typedef void (*TLogv)(const char* _szMessage, int _v);
|
typedef void (*TLogv)(const char* _szMessage, int _v);
|
||||||
typedef char* (*TName)(void);
|
typedef const char* (*TName)(void);
|
||||||
typedef void (*TDebuggerBreak)(void);
|
typedef void (*TDebuggerBreak)(void);
|
||||||
typedef void (*TGenerateDSPInt)(void);
|
typedef void (*TGenerateDSPInt)(void);
|
||||||
typedef unsigned int (*TAudioGetStreaming)(short* _pDestBuffer, unsigned int _numSamples);
|
typedef unsigned int (*TAudioGetStreaming)(short* _pDestBuffer, unsigned int _numSamples);
|
||||||
|
|
Loading…
Reference in New Issue