summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorhrydgard <hrydgard@gmail.com>2008-12-13 16:58:06 +0000
committerhrydgard <hrydgard@gmail.com>2008-12-13 16:58:06 +0000
commit522752c77d101e7c8dd7c661e1e5fc601280e9e1 (patch)
treed8747759465d5f4e37d22510838c215bd2efa828 /Source/Core
parent4355c373970ccc3f690699f0d40448972f81e8bc (diff)
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
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Common/Src/Thread.cpp2
-rw-r--r--Source/Core/Core/Src/ActionReplay.cpp253
-rw-r--r--Source/Core/Core/Src/ActionReplay.h2
-rw-r--r--Source/Core/Core/Src/Core.cpp28
-rw-r--r--Source/Core/Core/Src/HW/GPFifo.cpp3
-rw-r--r--Source/Core/Core/Src/HW/Memmap.cpp4
-rw-r--r--Source/Core/Core/Src/HW/VideoInterface.cpp1
-rw-r--r--Source/Core/Core/Src/LogManager.cpp33
-rw-r--r--Source/Core/Core/Src/LogManager.h19
-rw-r--r--Source/Core/Core/Src/PowerPC/PPCAnalyst.cpp5
-rw-r--r--Source/Core/Core/Src/PowerPC/SymbolDB.cpp2
-rw-r--r--Source/Core/DebuggerWX/Src/CodeWindow.cpp9
-rw-r--r--Source/Core/DolphinWX/Src/CheatsWindow.cpp2
-rw-r--r--Source/Core/DolphinWX/Src/GameListCtrl.cpp4
-rw-r--r--Source/Core/VideoCommon/VideoCommon.vcproj2
15 files changed, 180 insertions, 189 deletions
diff --git a/Source/Core/Common/Src/Thread.cpp b/Source/Core/Common/Src/Thread.cpp
index 5af43cca41..853918cf06 100644
--- a/Source/Core/Common/Src/Thread.cpp
+++ b/Source/Core/Common/Src/Thread.cpp
@@ -58,7 +58,7 @@ void CriticalSection::Enter()
bool CriticalSection::TryEnter()
{
- return(TryEnterCriticalSection(&section) ? true : false);
+ return TryEnterCriticalSection(&section) ? true : false;
}
diff --git a/Source/Core/Core/Src/ActionReplay.cpp b/Source/Core/Core/Src/ActionReplay.cpp
index 936fdd6656..4b7fccf712 100644
--- a/Source/Core/Core/Src/ActionReplay.cpp
+++ b/Source/Core/Core/Src/ActionReplay.cpp
@@ -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);
+ }
+ if (val_incr > 0)
+ {
+ val += (u32)val_incr;
}
- LogInfo("--------");
- break;
+ 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);
+ }
+ 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("--------");
- break;
+ 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);
+ }
+ 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("--------");
- break;
+ 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;
diff --git a/Source/Core/Core/Src/ActionReplay.h b/Source/Core/Core/Src/ActionReplay.h
index 4c5866caea..f7dc634d19 100644
--- a/Source/Core/Core/Src/ActionReplay.h
+++ b/Source/Core/Core/Src/ActionReplay.h
@@ -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_
diff --git a/Source/Core/Core/Src/Core.cpp b/Source/Core/Core/Src/Core.cpp
index 33345bc715..790c177879 100644
--- a/Source/Core/Core/Src/Core.cpp
+++ b/Source/Core/Core/Src/Core.cpp
@@ -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 *)"";
}
// __________________________________________________________________________________________________
diff --git a/Source/Core/Core/Src/HW/GPFifo.cpp b/Source/Core/Core/Src/HW/GPFifo.cpp
index 176108e506..72a749f2d7 100644
--- a/Source/Core/Core/Src/HW/GPFifo.cpp
+++ b/Source/Core/Core/Src/HW/GPFifo.cpp
@@ -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;
diff --git a/Source/Core/Core/Src/HW/Memmap.cpp b/Source/Core/Core/Src/HW/Memmap.cpp
index b799da391a..d7552822d5 100644
--- a/Source/Core/Core/Src/HW/Memmap.cpp
+++ b/Source/Core/Core/Src/HW/Memmap.cpp
@@ -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;
}
diff --git a/Source/Core/Core/Src/HW/VideoInterface.cpp b/Source/Core/Core/Src/HW/VideoInterface.cpp
index 3cbfcb7f9e..f07479d1c0 100644
--- a/Source/Core/Core/Src/HW/VideoInterface.cpp
+++ b/Source/Core/Core/Src/HW/VideoInterface.cpp
@@ -511,7 +511,6 @@ void Update()
if (VerticalBeamPos == NextXFBRender)
{
-
u8* xfbPtr = 0;
int yOffset = 0;
diff --git a/Source/Core/Core/Src/LogManager.cpp b/Source/Core/Core/Src/LogManager.cpp
index eb7452effd..57bfb14992 100644
--- a/Source/Core/Core/Src/LogManager.cpp
+++ b/Source/Core/Core/Src/LogManager.cpp
@@ -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
-}
diff --git a/Source/Core/Core/Src/LogManager.h b/Source/Core/Core/Src/LogManager.h
index df7e646ffc..2ab35ba02a 100644
--- a/Source/Core/Core/Src/LogManager.h
+++ b/Source/Core/Core/Src/LogManager.h
@@ -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
diff --git a/Source/Core/Core/Src/PowerPC/PPCAnalyst.cpp b/Source/Core/Core/Src/PowerPC/PPCAnalyst.cpp
index 480a3426a4..43aad8b6fd 100644
--- a/Source/Core/Core/Src/PowerPC/PPCAnalyst.cpp
+++ b/Source/Core/Core/Src/PowerPC/PPCAnalyst.cpp
@@ -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;
diff --git a/Source/Core/Core/Src/PowerPC/SymbolDB.cpp b/Source/Core/Core/Src/PowerPC/SymbolDB.cpp
index 619bb30682..fc81deedcd 100644
--- a/Source/Core/Core/Src/PowerPC/SymbolDB.cpp
+++ b/Source/Core/Core/Src/PowerPC/SymbolDB.cpp
@@ -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");
diff --git a/Source/Core/DebuggerWX/Src/CodeWindow.cpp b/Source/Core/DebuggerWX/Src/CodeWindow.cpp
index f37ff57332..b5caf52533 100644
--- a/Source/Core/DebuggerWX/Src/CodeWindow.cpp
+++ b/Source/Core/DebuggerWX/Src/CodeWindow.cpp
@@ -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());
diff --git a/Source/Core/DolphinWX/Src/CheatsWindow.cpp b/Source/Core/DolphinWX/Src/CheatsWindow.cpp
index 23a4f82f82..415bcde170 100644
--- a/Source/Core/DolphinWX/Src/CheatsWindow.cpp
+++ b/Source/Core/DolphinWX/Src/CheatsWindow.cpp
@@ -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()));
diff --git a/Source/Core/DolphinWX/Src/GameListCtrl.cpp b/Source/Core/DolphinWX/Src/GameListCtrl.cpp
index 764a106cb7..a0d168f078 100644
--- a/Source/Core/DolphinWX/Src/GameListCtrl.cpp
+++ b/Source/Core/DolphinWX/Src/GameListCtrl.cpp
@@ -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();
diff --git a/Source/Core/VideoCommon/VideoCommon.vcproj b/Source/Core/VideoCommon/VideoCommon.vcproj
index 0096e445f5..14c8bd26a5 100644
--- a/Source/Core/VideoCommon/VideoCommon.vcproj
+++ b/Source/Core/VideoCommon/VideoCommon.vcproj
@@ -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"