summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorNeoBrainX <NeoBrainX@googlemail.com>2010-04-08 16:59:35 +0000
committerNeoBrainX <NeoBrainX@googlemail.com>2010-04-08 16:59:35 +0000
commitf727139ebfc28c82455fc050cea953cb7d204b5f (patch)
tree1d3d29467a7a96e67ac9896607fe71a90fd3510d /Source/Core
parentb452bf7051112d9bb603aa9c3a228b06fdb4b2e1 (diff)
Random fixes and cleanups
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5297 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Common/Src/FileSearch.cpp18
-rw-r--r--Source/Core/Common/Src/FileSearch.h18
-rw-r--r--Source/Core/Common/Src/FileUtil.cpp3
-rw-r--r--Source/Core/Core/Src/ARDecrypt.cpp8
-rw-r--r--Source/Core/Core/Src/ActionReplay.cpp247
-rw-r--r--Source/Core/Core/Src/ActionReplay.h6
-rw-r--r--Source/Core/Core/Src/Boot/Boot.cpp419
-rw-r--r--Source/Core/Core/Src/Boot/Boot_DOL.cpp8
-rw-r--r--Source/Core/Core/Src/Boot/Boot_ELF.cpp7
-rw-r--r--Source/Core/Core/Src/Boot/Boot_WiiWAD.cpp3
-rw-r--r--Source/Core/Core/Src/Boot/ElfReader.cpp6
-rw-r--r--Source/Core/Core/Src/ConfigManager.cpp151
-rw-r--r--Source/Core/Core/Src/ConfigManager.h4
-rw-r--r--Source/Core/Core/Src/HLE/HLE.cpp8
-rw-r--r--Source/Core/Core/Src/HLE/HLE_Misc.cpp2
-rw-r--r--Source/Core/Core/Src/HLE/HLE_OS.cpp22
-rw-r--r--Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp170
-rw-r--r--Source/Core/Core/Src/MemTools.cpp4
-rw-r--r--Source/Core/Core/Src/State.cpp37
-rw-r--r--Source/Core/Core/Src/Tracer.cpp4
-rw-r--r--Source/Core/Core/Src/VolumeHandler.cpp11
-rw-r--r--Source/Core/Core/Src/VolumeHandler.h2
22 files changed, 570 insertions, 588 deletions
diff --git a/Source/Core/Common/Src/FileSearch.cpp b/Source/Core/Common/Src/FileSearch.cpp
index 94ae687821..36eb3d0536 100644
--- a/Source/Core/Common/Src/FileSearch.cpp
+++ b/Source/Core/Common/Src/FileSearch.cpp
@@ -74,17 +74,13 @@ void CFileSearch::FindFiles(const std::string& _searchString, const std::string&
size_t dot_pos = _searchString.rfind(".");
if (dot_pos == std::string::npos)
- {
return;
- }
std::string ext = _searchString.substr(dot_pos);
DIR* dir = opendir(_strPath.c_str());
if (!dir)
- {
return;
- }
dirent* dp;
@@ -93,19 +89,17 @@ void CFileSearch::FindFiles(const std::string& _searchString, const std::string&
dp = readdir(dir);
if (!dp)
- {
break;
- }
std::string s(dp->d_name);
if ( (s.size() > ext.size()) && (!strcasecmp(s.substr(s.size() - ext.size()).c_str(), ext.c_str())) )
{
- std::string full_name;
- if (_strPath.c_str()[_strPath.size()-1] == DIR_SEP_CHR)
- full_name = _strPath + s;
- else
- full_name = _strPath + DIR_SEP + s;
+ std::string full_name;
+ if (_strPath.c_str()[_strPath.size()-1] == DIR_SEP_CHR)
+ full_name = _strPath + s;
+ else
+ full_name = _strPath + DIR_SEP + s;
m_FileNames.push_back(full_name);
}
@@ -118,5 +112,5 @@ void CFileSearch::FindFiles(const std::string& _searchString, const std::string&
const CFileSearch::XStringVector& CFileSearch::GetFileNames() const
{
- return(m_FileNames);
+ return m_FileNames;
}
diff --git a/Source/Core/Common/Src/FileSearch.h b/Source/Core/Common/Src/FileSearch.h
index 85445fe7c6..6a73f92f99 100644
--- a/Source/Core/Common/Src/FileSearch.h
+++ b/Source/Core/Common/Src/FileSearch.h
@@ -23,21 +23,17 @@
class CFileSearch
{
- public:
+public:
+ typedef std::vector<std::string>XStringVector;
- typedef std::vector<std::string>XStringVector;
+ CFileSearch(const XStringVector& _rSearchStrings, const XStringVector& _rDirectories);
+ const XStringVector& GetFileNames() const;
- CFileSearch(const XStringVector& _rSearchStrings, const XStringVector& _rDirectories);
+private:
- const XStringVector& GetFileNames() const;
+ void FindFiles(const std::string& _searchString, const std::string& _strPath);
-
- private:
-
- void FindFiles(const std::string& _searchString, const std::string& _strPath);
-
-
- XStringVector m_FileNames;
+ XStringVector m_FileNames;
};
#endif // _FILESEARCH_H_
diff --git a/Source/Core/Common/Src/FileUtil.cpp b/Source/Core/Common/Src/FileUtil.cpp
index b3d358276a..95ae8b202e 100644
--- a/Source/Core/Common/Src/FileUtil.cpp
+++ b/Source/Core/Common/Src/FileUtil.cpp
@@ -123,7 +123,7 @@ bool Delete(const char *filename)
}
#else
if (unlink(filename) == -1) {
- WARN_LOG(COMMON, "Delete: DeleteFile failed on %s: %s",
+ WARN_LOG(COMMON, "Delete: unlink failed on %s: %s",
filename, GetLastErrorMsg());
return false;
}
@@ -594,7 +594,6 @@ std::string GetPluginsDirectory()
INFO_LOG(COMMON, "GetPluginsDirectory: Setting to %s:", pluginsDir.c_str());
return pluginsDir;
-
}
// Returns the path to where the sys file are
diff --git a/Source/Core/Core/Src/ARDecrypt.cpp b/Source/Core/Core/Src/ARDecrypt.cpp
index f09ff7f7ec..963416644d 100644
--- a/Source/Core/Core/Src/ARDecrypt.cpp
+++ b/Source/Core/Core/Src/ARDecrypt.cpp
@@ -35,8 +35,6 @@ int total;
const char *filter = "0123456789ABCDEFGHJKMNPQRTUVWXYZILOS";
u32 genseeds[0x20];
-//u8 globalvar=0;
-//u8 globalvar2=0;
const u8 bitstringlen[0x08] = {
@@ -408,9 +406,7 @@ bool batchdecrypt(u32 *codes, u16 size)
int GetVal(const char *flt, char chr)
{
- int ret;
-
- ret = (int)(strchr(flt,chr) - flt);
+ int ret = (int)(strchr(flt,chr) - flt);
switch (ret)
{
case 32: // 'I'
@@ -424,7 +420,6 @@ int GetVal(const char *flt, char chr)
ret = 5;
break;
}
-
return ret;
}
@@ -516,4 +511,5 @@ void DecryptARCode(std::vector<std::string> vCodes, std::vector<AREntry> &ops)
}
}
}
+
} //namespace ActionReplay
diff --git a/Source/Core/Core/Src/ActionReplay.cpp b/Source/Core/Core/Src/ActionReplay.cpp
index 3d4f7a6f45..e957d54ad1 100644
--- a/Source/Core/Core/Src/ActionReplay.cpp
+++ b/Source/Core/Core/Src/ActionReplay.cpp
@@ -25,7 +25,7 @@
// -----------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------------------------------
-// Codes Types:
+// Code Types:
// (Unconditonal) Normal Codes (0): this one has subtypes inside
// (Conditional) Normal Codes (1 - 7): these just compare values and set the line skip info
// Zero Codes: any code with no address. These codes are used to do special operations like memory copy, etc
@@ -45,15 +45,16 @@
namespace ActionReplay
{
+
enum
{
- // Zero Code Types
+ // Zero Code Types
ZCODE_END = 0x00,
ZCODE_NORM = 0x02,
ZCODE_ROW = 0x03,
ZCODE_04 = 0x04,
- // Conditonal Codes
+ // Conditonal Codes
CONDTIONAL_IF_EQUAL = 0x01,
CONDTIONAL_IF_NOT_EQUAL = 0x02,
CONDTIONAL_IF_LESS_THAN_SIGNED = 0x03,
@@ -68,7 +69,7 @@ enum
DATATYPE_32BIT = 0x02,
DATATYPE_32BIT_FLOAT = 0x03,
- // Normal Code 0 Subtypes
+ // Normal Code 0 Subtypes
SUB_RAM_WRITE = 0x00,
SUB_WRITE_POINTER = 0x01,
SUB_ADD_CODE = 0x02,
@@ -101,7 +102,7 @@ void LoadCodes(IniFile &ini, bool forceLoad)
{
// Parses the Action Replay section of a game ini file.
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableCheats
- && !forceLoad)
+ && !forceLoad)
return;
std::vector<std::string> lines;
@@ -132,7 +133,7 @@ void LoadCodes(IniFile &ini, bool forceLoad)
currentCode.ops.clear();
encryptedLines.clear();
}
-
+
if (line.size() > 1)
{
if (line[0] == '+')
@@ -217,7 +218,7 @@ void LogInfo(const char *format, ...)
if (logSelf)
{
std::string text = temp;
- text += "\n";
+ text += '\n';
arLog.push_back(text.c_str());
}
}
@@ -238,12 +239,12 @@ void RunAllActive()
}
}
- if (!b_RanOnce)
- b_RanOnce = true;
+ b_RanOnce = true;
}
}
-bool RunCode(const ARCode &arcode) {
+bool RunCode(const ARCode &arcode)
+{
// The mechanism is different than what the real AR uses, so there may be compatibility problems.
u8 cmd;
u32 addr;
@@ -260,7 +261,7 @@ bool RunCode(const ARCode &arcode) {
LogInfo("Code Name: %s", code.name.c_str());
LogInfo("Number of codes: %i", code.ops.size());
-
+
for (iter = code.ops.begin(); iter != code.ops.end(); ++iter)
{
// If conditional mode has been set to true, then run our code execution control
@@ -281,8 +282,7 @@ bool RunCode(const ARCode &arcode) {
if (!skip && count > 0) count--; // execute n lines
// if -2 : execute all lines
- if (b_RanOnce)
- b_RanOnce = false;
+ b_RanOnce = false;
}
cmd = iter->cmd_addr >> 24; // AR command
@@ -460,30 +460,32 @@ bool Subtype_RamWriteAndFill(u32 addr, u32 data)
switch (size)
{
case DATATYPE_8BIT:
+ {
+ LogInfo("8-bit Write");
+ LogInfo("--------");
+ u32 repeat = data >> 8;
+ for (u32 i = 0; i <= repeat; i++)
{
- LogInfo("8-bit Write");
- LogInfo("--------");
- u32 repeat = data >> 8;
- for (u32 i = 0; i <= repeat; i++) {
- Memory::Write_U8(data & 0xFF, new_addr + i);
- LogInfo("Wrote %08x to address %08x", data & 0xFF, new_addr + i);
- }
- LogInfo("--------");
- break;
+ Memory::Write_U8(data & 0xFF, new_addr + i);
+ LogInfo("Wrote %08x to address %08x", data & 0xFF, new_addr + i);
}
+ LogInfo("--------");
+ break;
+ }
case DATATYPE_16BIT:
+ {
+ LogInfo("16-bit Write");
+ LogInfo("--------");
+ u32 repeat = data >> 16;
+ for (u32 i = 0; i <= repeat; i++)
{
- LogInfo("16-bit Write");
- LogInfo("--------");
- u32 repeat = data >> 16;
- for (u32 i = 0; i <= repeat; i++) {
- Memory::Write_U16(data & 0xFFFF, new_addr + i * 2);
- LogInfo("Wrote %08x to address %08x", data & 0xFFFF, new_addr + i * 2);
- }
- LogInfo("--------");
- break;
+ Memory::Write_U16(data & 0xFFFF, new_addr + i * 2);
+ LogInfo("Wrote %08x to address %08x", data & 0xFFFF, new_addr + i * 2);
}
+ LogInfo("--------");
+ break;
+ }
case DATATYPE_32BIT_FLOAT:
case DATATYPE_32BIT: // Dword write
LogInfo("32bit Write");
@@ -509,36 +511,36 @@ bool Subtype_WriteToPointer(u32 addr, u32 data)
switch (size)
{
case DATATYPE_8BIT:
- {
- LogInfo("Write 8-bit to pointer");
- LogInfo("--------");
- u32 ptr = Memory::Read_U32(new_addr);
- u8 thebyte = data & 0xFF;
- u32 offset = data >> 8;
- LogInfo("Pointer: %08x", ptr);
- LogInfo("Byte: %08x", thebyte);
- LogInfo("Offset: %08x", offset);
- Memory::Write_U8(thebyte, ptr + offset);
- LogInfo("Wrote %08x to address %08x", thebyte, ptr + offset);
- LogInfo("--------");
- break;
- }
+ {
+ LogInfo("Write 8-bit to pointer");
+ LogInfo("--------");
+ u32 ptr = Memory::Read_U32(new_addr);
+ u8 thebyte = data & 0xFF;
+ u32 offset = data >> 8;
+ LogInfo("Pointer: %08x", ptr);
+ LogInfo("Byte: %08x", thebyte);
+ LogInfo("Offset: %08x", offset);
+ Memory::Write_U8(thebyte, ptr + offset);
+ LogInfo("Wrote %08x to address %08x", thebyte, ptr + offset);
+ LogInfo("--------");
+ break;
+ }
case DATATYPE_16BIT:
- {
- LogInfo("Write 16-bit to pointer");
- LogInfo("--------");
- u32 ptr = Memory::Read_U32(new_addr);
- u16 theshort = data & 0xFFFF;
- u32 offset = (data >> 16) << 1;
- LogInfo("Pointer: %08x", ptr);
- LogInfo("Byte: %08x", theshort);
- LogInfo("Offset: %08x", offset);
- Memory::Write_U16(theshort, ptr + offset);
- LogInfo("Wrote %08x to address %08x", theshort, ptr + offset);
- LogInfo("--------");
- break;
- }
+ {
+ LogInfo("Write 16-bit to pointer");
+ LogInfo("--------");
+ u32 ptr = Memory::Read_U32(new_addr);
+ u16 theshort = data & 0xFFFF;
+ u32 offset = (data >> 16) << 1;
+ LogInfo("Pointer: %08x", ptr);
+ LogInfo("Byte: %08x", theshort);
+ LogInfo("Offset: %08x", offset);
+ Memory::Write_U16(theshort, ptr + offset);
+ LogInfo("Wrote %08x to address %08x", theshort, ptr + offset);
+ LogInfo("--------");
+ break;
+ }
case DATATYPE_32BIT_FLOAT:
case DATATYPE_32BIT:
LogInfo("Write 32-bit to pointer");
@@ -558,7 +560,7 @@ bool Subtype_WriteToPointer(u32 addr, u32 data)
bool Subtype_AddCode(u32 addr, u32 data)
{
- // Used to incrment a value in memory
+ // Used to increment a value in memory
u32 new_addr = (addr & 0x81FFFFFF);
u8 size = (addr >> 25) & 0x03;
LogInfo("Hardware Address: %08x", new_addr);
@@ -587,21 +589,21 @@ bool Subtype_AddCode(u32 addr, u32 data)
LogInfo("--------");
break;
case DATATYPE_32BIT_FLOAT:
- {
- LogInfo("32-bit floating Add");
- LogInfo("--------");
+ {
+ LogInfo("32-bit floating Add");
+ LogInfo("--------");
- u32 read = Memory::Read_U32(new_addr);
- float fread = *((float*)&read);
- fread += (float)data;
- u32 newval = *((u32*)&fread);
- Memory::Write_U32(newval, new_addr);
- LogInfo("Old Value %08x", read);
- LogInfo("Increment %08x", data);
- LogInfo("New value %08x", newval);
- LogInfo("--------");
- break;
- }
+ u32 read = Memory::Read_U32(new_addr);
+ float fread = *((float*)&read);
+ fread += (float)data;
+ u32 newval = *((u32*)&fread);
+ Memory::Write_U32(newval, new_addr);
+ LogInfo("Old Value %08x", read);
+ LogInfo("Increment %08x", data);
+ LogInfo("New value %08x", newval);
+ LogInfo("--------");
+ break;
+ }
default:
LogInfo("Bad Size");
PanicAlert("Action Replay Error: Invalid size(%08x : address = %08x) in Add Code (%s)", size, addr, code.name.c_str());
@@ -639,57 +641,59 @@ bool ZeroCode_FillAndSlide(u32 val_last, u32 addr, u32 data) // This needs more
switch (size)
{
- case DATATYPE_8BIT:
- LogInfo("8-bit Write");
- LogInfo("--------");
- for (int i = 0; i < write_num; i++)
- {
- Memory::Write_U8(val & 0xFF, curr_addr);
- curr_addr += addr_incr;
- val += val_incr;
- LogInfo("Write %08x to address %08x", val & 0xFF, curr_addr);
+ case DATATYPE_8BIT:
+ LogInfo("8-bit Write");
+ LogInfo("--------");
+ for (int i = 0; i < write_num; i++)
+ {
+ Memory::Write_U8(val & 0xFF, curr_addr);
+ curr_addr += addr_incr;
+ val += val_incr;
+ LogInfo("Write %08x to address %08x", val & 0xFF, curr_addr);
- LogInfo("Value Update: %08x", val);
- LogInfo("Current Hardware Address Update: %08x", curr_addr);
- }
- LogInfo("--------");
- break;
- case DATATYPE_16BIT:
- LogInfo("16-bit 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);
- curr_addr += addr_incr * 2;
- val += val_incr;
- LogInfo("Value Update: %08x", val);
- LogInfo("Current Hardware Address Update: %08x", curr_addr);
- }
- LogInfo("--------");
- break;
- case DATATYPE_32BIT:
- LogInfo("32-bit 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);
- curr_addr += addr_incr * 4;
- val += val_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());
- return false;
+ LogInfo("Value Update: %08x", val);
+ LogInfo("Current Hardware Address Update: %08x", curr_addr);
+ }
+ LogInfo("--------");
+ break;
+ case DATATYPE_16BIT:
+ LogInfo("16-bit 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);
+ curr_addr += addr_incr * 2;
+ val += val_incr;
+ LogInfo("Value Update: %08x", val);
+ LogInfo("Current Hardware Address Update: %08x", curr_addr);
+ }
+ LogInfo("--------");
+ break;
+ case DATATYPE_32BIT:
+ LogInfo("32-bit 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);
+ curr_addr += addr_incr * 4;
+ val += val_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());
+ return false;
}
return true;
}
-// Looks like this is new??
-bool ZeroCode_MemoryCopy(u32 val_last, u32 addr, u32 data) // Has not been tested
+// Looks like this is new?? - untested
+bool ZeroCode_MemoryCopy(u32 val_last, u32 addr, u32 data)
{
u32 addr_dest = val_last | 0x06000000;
u32 addr_src = (addr & 0x01FFFFFF) | 0x80000000;
@@ -704,7 +708,8 @@ bool ZeroCode_MemoryCopy(u32 val_last, u32 addr, u32 data) // Has not been teste
{ // Memory Copy With Pointers Support
LogInfo("Memory Copy With Pointers Support");
LogInfo("--------");
- for (int i = 0; i < 138; i++) {
+ for (int i = 0; i < 138; i++)
+ {
Memory::Write_U8(Memory::Read_U8(addr_src + i), addr_dest + i);
LogInfo("Wrote %08x to address %08x", Memory::Read_U8(addr_src + i), addr_dest + i);
}
diff --git a/Source/Core/Core/Src/ActionReplay.h b/Source/Core/Core/Src/ActionReplay.h
index 3920f8146a..e9f389b591 100644
--- a/Source/Core/Core/Src/ActionReplay.h
+++ b/Source/Core/Core/Src/ActionReplay.h
@@ -23,14 +23,16 @@
namespace ActionReplay
{
-struct AREntry {
+struct AREntry
+{
AREntry() {}
AREntry(u32 _addr, u32 _value) : cmd_addr(_addr), value(_value) {}
u32 cmd_addr;
u32 value;
};
-struct ARCode {
+struct ARCode
+{
std::string name;
std::vector<AREntry> ops;
bool active;
diff --git a/Source/Core/Core/Src/Boot/Boot.cpp b/Source/Core/Core/Src/Boot/Boot.cpp
index 24f61385b5..8be1c3611b 100644
--- a/Source/Core/Core/Src/Boot/Boot.cpp
+++ b/Source/Core/Core/Src/Boot/Boot.cpp
@@ -49,30 +49,29 @@
void CBoot::Load_FST(bool _bIsWii)
{
- if (VolumeHandler::IsValid())
- {
- // copy first 20 bytes of disc to start of Mem 1
- VolumeHandler::ReadToPtr(Memory::GetPointer(0x80000000), 0, 0x20);
+ if (!VolumeHandler::IsValid()) return;
+
+ // copy first 20 bytes of disc to start of Mem 1
+ VolumeHandler::ReadToPtr(Memory::GetPointer(0x80000000), 0, 0x20);
- // copy of game id
- Memory::Write_U32(Memory::Read_U32(0x80000000), 0x80003180);
+ // copy of game id
+ Memory::Write_U32(Memory::Read_U32(0x80000000), 0x80003180);
- u32 shift = 0;
- if (_bIsWii)
- shift = 2;
-
- u32 fstOffset = VolumeHandler::Read32(0x0424) << shift;
- u32 fstSize = VolumeHandler::Read32(0x0428) << shift;
- u32 maxFstSize = VolumeHandler::Read32(0x042c) << shift;
-
- u32 arenaHigh = 0x817FFFF4 - maxFstSize;
- Memory::Write_U32(arenaHigh, 0x00000034);
-
- // load FST
- VolumeHandler::ReadToPtr(Memory::GetPointer(arenaHigh), fstOffset, fstSize);
- Memory::Write_U32(arenaHigh, 0x00000038);
- Memory::Write_U32(maxFstSize, 0x0000003c);
- }
+ u32 shift = 0;
+ if (_bIsWii)
+ shift = 2;
+
+ u32 fstOffset = VolumeHandler::Read32(0x0424) << shift;
+ u32 fstSize = VolumeHandler::Read32(0x0428) << shift;
+ u32 maxFstSize = VolumeHandler::Read32(0x042c) << shift;
+
+ u32 arenaHigh = 0x817FFFF4 - maxFstSize;
+ Memory::Write_U32(arenaHigh, 0x00000034);
+
+ // load FST
+ VolumeHandler::ReadToPtr(Memory::GetPointer(arenaHigh), fstOffset, fstSize);
+ Memory::Write_U32(arenaHigh, 0x00000038);
+ Memory::Write_U32(maxFstSize, 0x0000003c);
}
void CBoot::UpdateDebugger_MapLoaded(const char *_gameID)
@@ -86,18 +85,18 @@ std::string CBoot::GenerateMapFilename()
SCoreStartupParameter& _StartupPara = SConfig::GetInstance().m_LocalCoreStartupParameter;
switch (_StartupPara.m_BootType)
{
- case SCoreStartupParameter::BOOT_WII_NAND:
- {
- const DiscIO::INANDContentLoader& Loader = DiscIO::CNANDContentManager::Access().GetNANDLoader(_StartupPara.m_strFilename);
- if (Loader.IsValid())
- {
- u64 TitleID = Loader.GetTitleID();
- char tmpBuffer[32];
- sprintf(tmpBuffer, "%08x_%08x", (u32)(TitleID >> 32) & 0xFFFFFFFF , (u32)TitleID & 0xFFFFFFFF );
- return std::string(File::GetUserPath(D_MAPS_IDX)) + std::string(tmpBuffer) + ".map";
- }
- }
- break;
+ case SCoreStartupParameter::BOOT_WII_NAND:
+ {
+ const DiscIO::INANDContentLoader& Loader = DiscIO::CNANDContentManager::Access().GetNANDLoader(_StartupPara.m_strFilename);
+ if (Loader.IsValid())
+ {
+ u64 TitleID = Loader.GetTitleID();
+ char tmpBuffer[32];
+ sprintf(tmpBuffer, "%08x_%08x", (u32)(TitleID >> 32) & 0xFFFFFFFF , (u32)TitleID & 0xFFFFFFFF );
+ return std::string(File::GetUserPath(D_MAPS_IDX)) + std::string(tmpBuffer) + ".map";
+ }
+ break;
+ }
case SCoreStartupParameter::BOOT_ELF:
case SCoreStartupParameter::BOOT_DOL:
@@ -122,7 +121,7 @@ bool CBoot::LoadMapFromFilename(const std::string &_rFilename, const char *_game
if (_gameID != NULL)
{
BuildCompleteFilename(strMapFilename, "maps", std::string(_gameID) + ".map");
- success = g_symbolDB.LoadMap(strMapFilename.c_str());
+ success = g_symbolDB.LoadMap(strMapFilename.c_str());
}
}
else
@@ -160,173 +159,171 @@ bool CBoot::Load_BS2(const std::string& _rBootROMFilename)
// Third boot step after BootManager and Core. See Call schedule in BootManager.cpp
bool CBoot::BootUp()
{
- SCoreStartupParameter& _StartupPara =
+ SCoreStartupParameter& _StartupPara =
SConfig::GetInstance().m_LocalCoreStartupParameter;
NOTICE_LOG(BOOT, "Booting %s", _StartupPara.m_strFilename.c_str());
g_symbolDB.Clear();
- VideoInterface::Preset(_StartupPara.bNTSC);
- switch (_StartupPara.m_BootType)
- {
- // GCM and Wii
- // ===================================================================================
- case SCoreStartupParameter::BOOT_ISO:
- {
- DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(_StartupPara.m_strFilename);
- if (pVolume == NULL)
- break;
-
- bool isoWii = DiscIO::IsVolumeWiiDisc(pVolume);
- if (isoWii != _StartupPara.bWii)
- {
- PanicAlert("Warning - starting ISO in wrong console mode!");
- }
-
- char gameID[7];
- memcpy(gameID, pVolume->GetUniqueID().c_str(), 6);
- gameID[6] = 0;
-
- // setup the map from ISOFile ID
- VolumeHandler::SetVolumeName(_StartupPara.m_strFilename);
-
- VideoInterface::SetRegionReg((char)VolumeHandler::GetVolume()->GetUniqueID().at(3));
-
- DVDInterface::SetDiscInside(VolumeHandler::IsValid());
-
- _StartupPara.bWii = VolumeHandler::IsWii();
-
- // HLE BS2 or not
- if (_StartupPara.bHLE_BS2)
- {
- EmulatedBS2(_StartupPara.bWii);
- }
- else if (!Load_BS2(_StartupPara.m_strBootROM))
- {
- // If we can't load the bootrom file we HLE it instead
- EmulatedBS2(_StartupPara.bWii);
- }
-
- /* Try to load the symbol map if there is one, and then scan it for
- and eventually replace code */
- if (LoadMapFromFilename(_StartupPara.m_strFilename, gameID))
- HLE::PatchFunctions();
-
- // We don't need the volume any more
- delete pVolume;
- }
- break;
+ VideoInterface::Preset(_StartupPara.bNTSC);
+ switch (_StartupPara.m_BootType)
+ {
+ // GCM and Wii
+ case SCoreStartupParameter::BOOT_ISO:
+ {
+ DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(_StartupPara.m_strFilename);
+ if (pVolume == NULL)
+ break;
- // DOL
- // ===================================================================================
- case SCoreStartupParameter::BOOT_DOL:
- {
- // Check if we have gotten a Wii file or not
- bool dolWii = CDolLoader::IsDolWii(_StartupPara.m_strFilename.c_str());
- if (dolWii != _StartupPara.bWii)
- {
- PanicAlert("Warning - starting DOL in wrong console mode!");
- }
-
- bool BS2Success = false;
-
- if (dolWii)
- {
- BS2Success = EmulatedBS2(dolWii);
- }
- else if (!VolumeHandler::IsWii() && !_StartupPara.m_strDefaultGCM.empty())
- {
- VolumeHandler::SetVolumeName(_StartupPara.m_strDefaultGCM.c_str());
- BS2Success = EmulatedBS2(dolWii);
- }
-
- if (!_StartupPara.m_strDVDRoot.empty())
- {
- NOTICE_LOG(BOOT, "Setting DVDRoot %s", _StartupPara.m_strDVDRoot.c_str());
- VolumeHandler::SetVolumeDirectory(_StartupPara.m_strDVDRoot, dolWii, _StartupPara.m_strApploader, _StartupPara.m_strFilename);
- BS2Success = EmulatedBS2(dolWii);
- }
-
- DVDInterface::SetDiscInside(VolumeHandler::IsValid());
-
- if (!BS2Success)
- {
- CDolLoader dolLoader(_StartupPara.m_strFilename.c_str());
- PC = dolLoader.GetEntryPoint();
- }
-
- if (LoadMapFromFilename(_StartupPara.m_strFilename))
- HLE::PatchFunctions();
- }
- break;
+ bool isoWii = DiscIO::IsVolumeWiiDisc(pVolume);
+ if (isoWii != _StartupPara.bWii)
+ {
+ PanicAlert("Warning - starting ISO in wrong console mode!");
+ }
+
+ char gameID[7];
+ memcpy(gameID, pVolume->GetUniqueID().c_str(), 6);
+ gameID[6] = 0;
+
+ // setup the map from ISOFile ID
+ VolumeHandler::SetVolumeName(_StartupPara.m_strFilename);
+
+ VideoInterface::SetRegionReg((char)VolumeHandler::GetVolume()->GetUniqueID().at(3));
+
+ DVDInterface::SetDiscInside(VolumeHandler::IsValid());
+
+ _StartupPara.bWii = VolumeHandler::IsWii();
+
+ // HLE BS2 or not
+ if (_StartupPara.bHLE_BS2)
+ {
+ EmulatedBS2(_StartupPara.bWii);
+ }
+ else if (!Load_BS2(_StartupPara.m_strBootROM))
+ {
+ // If we can't load the bootrom file we HLE it instead
+ EmulatedBS2(_StartupPara.bWii);
+ }
+
+ /* Try to load the symbol map if there is one, and then scan it for
+ and eventually replace code */
+ if (LoadMapFromFilename(_StartupPara.m_strFilename, gameID))
+ HLE::PatchFunctions();
+
+ // We don't need the volume any more
+ delete pVolume;
+ break;
+ }
+
+ // DOL
+ case SCoreStartupParameter::BOOT_DOL:
+ {
+ // Check if we have gotten a Wii file or not
+ bool dolWii = CDolLoader::IsDolWii(_StartupPara.m_strFilename.c_str());
+ if (dolWii != _StartupPara.bWii)
+ {
+ PanicAlert("Warning - starting DOL in wrong console mode!");
+ }
+
+ bool BS2Success = false;
+
+ if (dolWii)
+ {
+ BS2Success = EmulatedBS2(dolWii);
+ }
+ else if (!VolumeHandler::IsWii() && !_StartupPara.m_strDefaultGCM.empty())
+ {
+ VolumeHandler::SetVolumeName(_StartupPara.m_strDefaultGCM.c_str());
+ BS2Success = EmulatedBS2(dolWii);
+ }
+
+ if (!_StartupPara.m_strDVDRoot.empty())
+ {
+ NOTICE_LOG(BOOT, "Setting DVDRoot %s", _StartupPara.m_strDVDRoot.c_str());
+ VolumeHandler::SetVolumeDirectory(_StartupPara.m_strDVDRoot, dolWii, _StartupPara.m_strApploader, _StartupPara.m_strFilename);
+ BS2Success = EmulatedBS2(dolWii);
+ }
+
+ DVDInterface::SetDiscInside(VolumeHandler::IsValid());
+
+ if (!BS2Success)
+ {
+ CDolLoader dolLoader(_StartupPara.m_strFilename.c_str());
+ PC = dolLoader.GetEntryPoint();
+ }
+
+ if (LoadMapFromFilename(_StartupPara.m_strFilename))
+ HLE::PatchFunctions();
- // ELF
- // ===================================================================================
- case SCoreStartupParameter::BOOT_ELF:
- {
- if(!File::Exists(_StartupPara.m_strFilename.c_str()))
- {
- PanicAlert("The file you specified (%s) does not exist",
- _StartupPara.m_strFilename.c_str());
- return false;
- }
-
- // Check if we have gotten a Wii file or not
- bool elfWii = IsElfWii(_StartupPara.m_strFilename.c_str());
- if (elfWii != _StartupPara.bWii)
- {
- PanicAlert("Warning - starting ELF in wrong console mode!");
- }
-
- bool BS2Success = false;
-
- if (elfWii)
- {
- BS2Success = EmulatedBS2(elfWii);
- }
- else if (!VolumeHandler::IsWii() && !_StartupPara.m_strDefaultGCM.empty())
- {
- VolumeHandler::SetVolumeName(_StartupPara.m_strDefaultGCM.c_str());
- BS2Success = EmulatedBS2(elfWii);
- }
-
- // load image or create virtual drive from directory
- if (!_StartupPara.m_strDVDRoot.empty()) {
- NOTICE_LOG(BOOT, "Setting DVDRoot %s", _StartupPara.m_strDVDRoot.c_str());
- // TODO: auto-convert elf to dol, so we can load them :)
- VolumeHandler::SetVolumeDirectory(_StartupPara.m_strDVDRoot, elfWii);
- BS2Success = EmulatedBS2(elfWii);
- }
- else if (!_StartupPara.m_strDefaultGCM.empty()) {
- NOTICE_LOG(BOOT, "Loading default ISO %s", _StartupPara.m_strDefaultGCM.c_str());
- VolumeHandler::SetVolumeName(_StartupPara.m_strDefaultGCM);
- }
- else
- VolumeHandler::SetVolumeDirectory(_StartupPara.m_strFilename, elfWii);
-
- DVDInterface::SetDiscInside(VolumeHandler::IsValid());
-
- if (BS2Success)
- {
- HLE::PatchFunctions();
- }
- else // Poor man's bootup
- {
- Load_FST(elfWii);
- Boot_ELF(_StartupPara.m_strFilename.c_str());
- }
- UpdateDebugger_MapLoaded();
- Dolphin_Debugger::AddAutoBreakpoints();
- }
break;
+ }
+
+ // ELF
+ case SCoreStartupParameter::BOOT_ELF:
+ {
+ if(!File::Exists(_StartupPara.m_strFilename.c_str()))
+ {
+ PanicAlert("The file you specified (%s) does not exist",
+ _StartupPara.m_strFilename.c_str());
+ return false;
+ }
+
+ // Check if we have gotten a Wii file or not
+ bool elfWii = IsElfWii(_StartupPara.m_strFilename.c_str());
+ if (elfWii != _StartupPara.bWii)
+ {
+ PanicAlert("Warning - starting ELF in wrong console mode!");
+ }
+
+ bool BS2Success = false;
+
+ if (elfWii)
+ {
+ BS2Success = EmulatedBS2(elfWii);
+ }
+ else if (!VolumeHandler::IsWii() && !_StartupPara.m_strDefaultGCM.empty())
+ {
+ VolumeHandler::SetVolumeName(_StartupPara.m_strDefaultGCM.c_str());
+ BS2Success = EmulatedBS2(elfWii);
+ }
+
+ // load image or create virtual drive from directory
+ if (!_StartupPara.m_strDVDRoot.empty())
+ {
+ NOTICE_LOG(BOOT, "Setting DVDRoot %s", _StartupPara.m_strDVDRoot.c_str());
+ // TODO: auto-convert elf to dol, so we can load them :)
+ VolumeHandler::SetVolumeDirectory(_StartupPara.m_strDVDRoot, elfWii);
+ BS2Success = EmulatedBS2(elfWii);
+ }
+ else if (!_StartupPara.m_strDefaultGCM.empty())
+ {
+ NOTICE_LOG(BOOT, "Loading default ISO %s", _StartupPara.m_strDefaultGCM.c_str());
+ VolumeHandler::SetVolumeName(_StartupPara.m_strDefaultGCM);
+ }
+ else VolumeHandler::SetVolumeDirectory(_StartupPara.m_strFilename, elfWii);
+
+ DVDInterface::SetDiscInside(VolumeHandler::IsValid());
+
+ if (BS2Success)
+ {
+ HLE::PatchFunctions();
+ }
+ else // Poor man's bootup
+ {
+ Load_FST(elfWii);
+ Boot_ELF(_StartupPara.m_strFilename.c_str());
+ }
+ UpdateDebugger_MapLoaded();
+ Dolphin_Debugger::AddAutoBreakpoints();
+ break;
+ }
// Wii WAD
- // ===================================================================================
case SCoreStartupParameter::BOOT_WII_NAND:
Boot_WiiWAD(_StartupPara.m_strFilename.c_str());
- if (LoadMapFromFilename(_StartupPara.m_strFilename))
- HLE::PatchFunctions();
+ if (LoadMapFromFilename(_StartupPara.m_strFilename))
+ HLE::PatchFunctions();
// load default image or create virtual drive from directory
if (!_StartupPara.m_strDVDRoot.empty())
@@ -335,33 +332,31 @@ bool CBoot::BootUp()
VolumeHandler::SetVolumeName(_StartupPara.m_strDefaultGCM);
DVDInterface::SetDiscInside(VolumeHandler::IsValid());
-
break;
- // Bootstrap 2 (AKA: Initial Program Loader, "BIOS")
- // ===================================================================================
- case SCoreStartupParameter::BOOT_BS2:
- {
- DVDInterface::SetDiscInside(VolumeHandler::IsValid());
- if (Load_BS2(_StartupPara.m_strBootROM))
- {
- if (LoadMapFromFilename(_StartupPara.m_strFilename))
- HLE::PatchFunctions();
- }
- else
- {
- return false;
- }
- }
- break;
+ // Bootstrap 2 (AKA: Initial Program Loader, "BIOS")
+ case SCoreStartupParameter::BOOT_BS2:
+ {
+ DVDInterface::SetDiscInside(VolumeHandler::IsValid());
+ if (Load_BS2(_StartupPara.m_strBootROM))
+ {
+ if (LoadMapFromFilename(_StartupPara.m_strFilename))
+ HLE::PatchFunctions();
+ }
+ else
+ {
+ return false;
+ }
+ break;
+ }
- default:
- {
- PanicAlert("Tried to load an unknown file type.");
- return false;
- }
- }
+ default:
+ {
+ PanicAlert("Tried to load an unknown file type.");
+ return false;
+ }
+ }
Host_UpdateLogDisplay();
return true;
}
diff --git a/Source/Core/Core/Src/Boot/Boot_DOL.cpp b/Source/Core/Core/Src/Boot/Boot_DOL.cpp
index 8468376d82..1f7578ff85 100644
--- a/Source/Core/Core/Src/Boot/Boot_DOL.cpp
+++ b/Source/Core/Core/Src/Boot/Boot_DOL.cpp
@@ -51,9 +51,9 @@ bool CDolLoader::Initialize(u8* _pBuffer, u32 _Size)
p[i] = Common::swap32(p[i]);
// load all text (code) sections
- for(int i = 0; i < DOL_NUM_TEXT; i++)
+ for (int i = 0; i < DOL_NUM_TEXT; i++)
{
- if(m_dolheader.textOffset[i] != 0)
+ if (m_dolheader.textOffset[i] != 0)
{
u8* pTemp = &_pBuffer[m_dolheader.textOffset[i]];
for (u32 num = 0; num < m_dolheader.textSize[i]; num++)
@@ -62,9 +62,9 @@ bool CDolLoader::Initialize(u8* _pBuffer, u32 _Size)
}
// load all data sections
- for(int i = 0; i < DOL_NUM_DATA; i++)
+ for (int i = 0; i < DOL_NUM_DATA; i++)
{
- if(m_dolheader.dataOffset[i] != 0)
+ if (m_dolheader.dataOffset[i] != 0)
{
u8* pTemp = &_pBuffer[m_dolheader.dataOffset[i]];
for (u32 num = 0; num < m_dolheader.dataSize[i]; num++)
diff --git a/Source/Core/Core/Src/Boot/Boot_ELF.cpp b/Source/Core/Core/Src/Boot/Boot_ELF.cpp
index a7b13d5800..ba1fe4c5b0 100644
--- a/Source/Core/Core/Src/Boot/Boot_ELF.cpp
+++ b/Source/Core/Core/Src/Boot/Boot_ELF.cpp
@@ -59,13 +59,14 @@ bool CBoot::Boot_ELF(const char *filename)
{
if (LoadMapFromFilename(filename))
HLE::PatchFunctions();
- } else {
+ }
+ else
+ {
HLE::PatchFunctions();
}
PC = reader.GetEntryPoint();
- delete [] mem;
+ delete []mem;
return true;
}
-
diff --git a/Source/Core/Core/Src/Boot/Boot_WiiWAD.cpp b/Source/Core/Core/Src/Boot/Boot_WiiWAD.cpp
index 0f1d2b249b..2f21caa4cc 100644
--- a/Source/Core/Core/Src/Boot/Boot_WiiWAD.cpp
+++ b/Source/Core/Core/Src/Boot/Boot_WiiWAD.cpp
@@ -123,7 +123,8 @@ bool CBoot::Install_WiiWAD(const char* _pFilename)
sprintf(APPFileName, "%s%08x.app", ContentPath, Content.m_ContentID);
FILE* pAPPFile = fopen(APPFileName, "wb");
- if (pAPPFile == NULL) {
+ if (pAPPFile == NULL)
+ {
PanicAlert("WAD installation failed: error creating %s", APPFileName);
return false;
}
diff --git a/Source/Core/Core/Src/Boot/ElfReader.cpp b/Source/Core/Core/Src/Boot/ElfReader.cpp
index cb70ab6bb2..28bebd2ba8 100644
--- a/Source/Core/Core/Src/Boot/ElfReader.cpp
+++ b/Source/Core/Core/Src/Boot/ElfReader.cpp
@@ -94,7 +94,7 @@ ElfReader::ElfReader(void *ptr)
const char *ElfReader::GetSectionName(int section) const
{
if (sections[section].sh_type == SHT_NULL)
- return 0;
+ return NULL;
int nameOffset = sections[section].sh_name;
char *ptr = (char*)GetSectionDataPtr(header->e_shstrndx);
@@ -102,7 +102,7 @@ const char *ElfReader::GetSectionName(int section) const
if (ptr)
return ptr + nameOffset;
else
- return 0;
+ return NULL;
}
void addrToHiLo(u32 addr, u16 &hi, s16 &lo)
@@ -207,7 +207,7 @@ SectionID ElfReader::GetSectionByName(const char *name, int firstSection) const
{
const char *secname = GetSectionName(i);
- if (secname != 0 && strcmp(name, secname) == 0)
+ if (secname != NULL && strcmp(name, secname) == 0)
return i;
}
return -1;
diff --git a/Source/Core/Core/Src/ConfigManager.cpp b/Source/Core/Core/Src/ConfigManager.cpp
index 7bc7984652..e3a754538a 100644
--- a/Source/Core/Core/Src/ConfigManager.cpp
+++ b/Source/Core/Core/Src/ConfigManager.cpp
@@ -57,95 +57,90 @@ void SConfig::SaveSettings()
{
NOTICE_LOG(BOOT, "Saving Settings to %s", File::GetUserPath(F_DOLPHINCONFIG_IDX));
IniFile ini;
- ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)); // yes we must load first to not kill unknown stuff
+ ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)); // load first to not kill unknown stuff
// General
- {
- ini.Set("General", "LastFilename", m_LastFilename);
+ ini.Set("General", "LastFilename", m_LastFilename);
- // ISO folders
- ini.Set("General", "GCMPathes", (int)m_ISOFolder.size());
+ // ISO folders
+ ini.Set("General", "GCMPathes", (int)m_ISOFolder.size());
- for (size_t i = 0; i < m_ISOFolder.size(); i++)
- {
- TCHAR tmp[16];
- sprintf(tmp, "GCMPath%i", (int)i);
- ini.Set("General", tmp, m_ISOFolder[i]);
- }
-
- ini.Set("General", "RecersiveGCMPaths", m_RecursiveISOFolder);
+ for (size_t i = 0; i < m_ISOFolder.size(); i++)
+ {
+ TCHAR tmp[16];
+ sprintf(tmp, "GCMPath%i", (int)i);
+ ini.Set("General", tmp, m_ISOFolder[i]);
}
+ ini.Set("General", "RecersiveGCMPaths", m_RecursiveISOFolder);
+
+ // Interface
+ ini.Set("Interface", "ConfirmStop", m_LocalCoreStartupParameter.bConfirmStop);
+ ini.Set("Interface", "UsePanicHandlers", m_LocalCoreStartupParameter.bUsePanicHandlers);
+ ini.Set("Interface", "HideCursor", m_LocalCoreStartupParameter.bHideCursor);
+ ini.Set("Interface", "AutoHideCursor", m_LocalCoreStartupParameter.bAutoHideCursor);
+ ini.Set("Interface", "Theme", m_LocalCoreStartupParameter.iTheme);
+ ini.Set("Interface", "MainWindowPosX", m_LocalCoreStartupParameter.iPosX);
+ ini.Set("Interface", "MainWindowPosY", m_LocalCoreStartupParameter.iPosY);
+ ini.Set("Interface", "MainWindowWidth", m_LocalCoreStartupParameter.iWidth);
+ ini.Set("Interface", "MainWindowHeight", m_LocalCoreStartupParameter.iHeight);
+ ini.Set("Interface", "Language", m_InterfaceLanguage);
+ ini.Set("Interface", "ShowToolbar", m_InterfaceToolbar);
+ ini.Set("Interface", "ShowStatusbar", m_InterfaceStatusbar);
+ ini.Set("Interface", "ShowLogWindow", m_InterfaceLogWindow);
+ ini.Set("Interface", "ShowConsole", m_InterfaceConsole);
+
+ // Game List Control
+ ini.Set("GameList", "ListDrives", m_ListDrives);
+ ini.Set("GameList", "ListWad", m_ListWad);
+ ini.Set("GameList", "ListWii", m_ListWii);
+ ini.Set("GameList", "ListGC", m_ListGC);
+ ini.Set("GameList", "ListJap", m_ListJap);
+ ini.Set("GameList", "ListPal", m_ListPal);
+ ini.Set("GameList", "ListUsa", m_ListUsa);
+ ini.Set("GameList", "ListFrance", m_ListFrance);
+ ini.Set("GameList", "ListItaly", m_ListItaly);
+ ini.Set("GameList", "ListKorea", m_ListKorea);
+ ini.Set("GameList", "ListTaiwan", m_ListTaiwan);
+ ini.Set("GameList", "ListUnknown", m_ListUnknown);
+
+ // Core
+ ini.Set("Core", "HLE_BS2", m_LocalCoreStartupParameter.bHLE_BS2);
+ ini.Set("Core", "CPUCore", m_LocalCoreStartupParameter.iCPUCore);
+ ini.Set("Core", "CPUThread", m_LocalCoreStartupParameter.bCPUThread);
+ ini.Set("Core", "DSPThread", m_LocalCoreStartupParameter.bDSPThread);
+ ini.Set("Core", "SkipIdle", m_LocalCoreStartupParameter.bSkipIdle);
+ ini.Set("Core", "LockThreads", m_LocalCoreStartupParameter.bLockThreads);
+ ini.Set("Core", "DefaultGCM", m_LocalCoreStartupParameter.m_strDefaultGCM);
+ ini.Set("Core", "DVDRoot", m_LocalCoreStartupParameter.m_strDVDRoot);
+ ini.Set("Core", "Apploader", m_LocalCoreStartupParameter.m_strApploader);
+ ini.Set("Core", "EnableCheats", m_LocalCoreStartupParameter.bEnableCheats);
+ ini.Set("Core", "SelectedLanguage", m_LocalCoreStartupParameter.SelectedLanguage);
+ ini.Set("Core", "MemcardA", m_strMemoryCardA);
+ ini.Set("Core", "MemcardB", m_strMemoryCardB);
+ ini.Set("Core", "SlotA", m_EXIDevice[0]);
+ ini.Set("Core", "SlotB", m_EXIDevice[1]);
+ ini.Set("Core", "SerialPort1", m_EXIDevice[2]);
+ char sidevicenum[16];
+ for (int i = 0; i < 4; ++i)
{
- // Interface
- ini.Set("Interface", "ConfirmStop", m_LocalCoreStartupParameter.bConfirmStop);
- ini.Set("Interface", "UsePanicHandlers", m_LocalCoreStartupParameter.bUsePanicHandlers);
- ini.Set("Interface", "HideCursor", m_LocalCoreStartupParameter.bHideCursor);
- ini.Set("Interface", "AutoHideCursor", m_LocalCoreStartupParameter.bAutoHideCursor);
- ini.Set("Interface", "Theme", m_LocalCoreStartupParameter.iTheme);
- ini.Set("Interface", "MainWindowPosX", m_LocalCoreStartupParameter.iPosX);
- ini.Set("Interface", "MainWindowPosY", m_LocalCoreStartupParameter.iPosY);
- ini.Set("Interface", "MainWindowWidth", m_LocalCoreStartupParameter.iWidth);
- ini.Set("Interface", "MainWindowHeight", m_LocalCoreStartupParameter.iHeight);
- ini.Set("Interface", "Language", m_InterfaceLanguage);
- ini.Set("Interface", "ShowToolbar", m_InterfaceToolbar);
- ini.Set("Interface", "ShowStatusbar", m_InterfaceStatusbar);
- ini.Set("Interface", "ShowLogWindow", m_InterfaceLogWindow);
- ini.Set("Interface", "ShowConsole", m_InterfaceConsole);
-
- // Game List Control
- ini.Set("GameList", "ListDrives", m_ListDrives);
- ini.Set("GameList", "ListWad", m_ListWad);
- ini.Set("GameList", "ListWii", m_ListWii);
- ini.Set("GameList", "ListGC", m_ListGC);
- ini.Set("GameList", "ListJap", m_ListJap);
- ini.Set("GameList", "ListPal", m_ListPal);
- ini.Set("GameList", "ListUsa", m_ListUsa);
- ini.Set("GameList", "ListFrance", m_ListFrance);
- ini.Set("GameList", "ListItaly", m_ListItaly);
- ini.Set("GameList", "ListKorea", m_ListKorea);
- ini.Set("GameList", "ListTaiwan", m_ListTaiwan);
- ini.Set("GameList", "ListUnknown", m_ListUnknown);
-
- // Core
- ini.Set("Core", "HLE_BS2", m_LocalCoreStartupParameter.bHLE_BS2);
- ini.Set("Core", "CPUCore", m_LocalCoreStartupParameter.iCPUCore);
- ini.Set("Core", "CPUThread", m_LocalCoreStartupParameter.bCPUThread);
- ini.Set("Core", "DSPThread", m_LocalCoreStartupParameter.bDSPThread);
- ini.Set("Core", "SkipIdle", m_LocalCoreStartupParameter.bSkipIdle);
- ini.Set("Core", "LockThreads", m_LocalCoreStartupParameter.bLockThreads);
- ini.Set("Core", "DefaultGCM", m_LocalCoreStartupParameter.m_strDefaultGCM);
- ini.Set("Core", "DVDRoot", m_LocalCoreStartupParameter.m_strDVDRoot);
- ini.Set("Core", "Apploader", m_LocalCoreStartupParameter.m_strApploader);
- ini.Set("Core", "EnableCheats", m_LocalCoreStartupParameter.bEnableCheats);
- ini.Set("Core", "SelectedLanguage", m_LocalCoreStartupParameter.SelectedLanguage);
- ini.Set("Core", "MemcardA", m_strMemoryCardA);
- ini.Set("Core", "MemcardB", m_strMemoryCardB);
- ini.Set("Core", "SlotA", m_EXIDevice[0]);
- ini.Set("Core", "SlotB", m_EXIDevice[1]);
- ini.Set("Core", "SerialPort1", m_EXIDevice[2]);
- char sidevicenum[16];
- for (int i = 0; i < 4; ++i)
- {
- sprintf(sidevicenum, "SIDevice%i", i);
- ini.Set("Core", sidevicenum, m_SIDevice[i]);
- }
+ sprintf(sidevicenum, "SIDevice%i", i);
+ ini.Set("Core", sidevicenum, m_SIDevice[i]);
+ }
- ini.Set("Core", "WiiSDCard", m_WiiSDCard);
- ini.Set("Core", "WiiKeyboard", m_WiiKeyboard);
- ini.Set("Core", "RunCompareServer", m_LocalCoreStartupParameter.bRunCompareServer);
- ini.Set("Core", "RunCompareClient", m_LocalCoreStartupParameter.bRunCompareClient);
- ini.Set("Core", "FrameLimit", m_Framelimit);
+ ini.Set("Core", "WiiSDCard", m_WiiSDCard);
+ ini.Set("Core", "WiiKeyboard", m_WiiKeyboard);
+ ini.Set("Core", "RunCompareServer", m_LocalCoreStartupParameter.bRunCompareServer);
+ ini.Set("Core", "RunCompareClient", m_LocalCoreStartupParameter.bRunCompareClient);
+ ini.Set("Core", "FrameLimit", m_Framelimit);
- // Plugins
- ini.Set("Core", "GFXPlugin", m_LocalCoreStartupParameter.m_strVideoPlugin);
- ini.Set("Core", "DSPPlugin", m_LocalCoreStartupParameter.m_strDSPPlugin);
- ini.Set("Core", "PadPlugin", m_LocalCoreStartupParameter.m_strPadPlugin[0]);
- ini.Set("Core", "WiiMotePlugin",m_LocalCoreStartupParameter.m_strWiimotePlugin[0]);
- }
+ // Plugins
+ ini.Set("Core", "GFXPlugin", m_LocalCoreStartupParameter.m_strVideoPlugin);
+ ini.Set("Core", "DSPPlugin", m_LocalCoreStartupParameter.m_strDSPPlugin);
+ ini.Set("Core", "PadPlugin", m_LocalCoreStartupParameter.m_strPadPlugin[0]);
+ ini.Set("Core", "WiiMotePlugin",m_LocalCoreStartupParameter.m_strWiimotePlugin[0]);
ini.Save(File::GetUserPath(F_DOLPHINCONFIG_IDX));
-
m_SYSCONF->Save();
}
diff --git a/Source/Core/Core/Src/ConfigManager.h b/Source/Core/Core/Src/ConfigManager.h
index 8be6207096..d91eb4148d 100644
--- a/Source/Core/Core/Src/ConfigManager.h
+++ b/Source/Core/Core/Src/ConfigManager.h
@@ -111,11 +111,7 @@ struct SConfig
static void Shutdown();
private:
-
- // constructor
SConfig();
-
- // destructor
~SConfig();
static SConfig* m_Instance;
diff --git a/Source/Core/Core/Src/HLE/HLE.cpp b/Source/Core/Core/Src/HLE/HLE.cpp
index 2fc438f64b..b1985a5291 100644
--- a/Source/Core/Core/Src/HLE/HLE.cpp
+++ b/Source/Core/Core/Src/HLE/HLE.cpp
@@ -104,7 +104,8 @@ void Patch(u32 address, const char *hle_func_name)
{
for (u32 i = 0; i < sizeof(OSPatches) / sizeof(SPatch); i++)
{
- if (!strcmp(OSPatches[i].m_szPatchName, hle_func_name)) {
+ if (!strcmp(OSPatches[i].m_szPatchName, hle_func_name))
+ {
u32 HLEPatchValue = (1 & 0x3f) << 26;
Memory::Write_U32(HLEPatchValue | i, address);
return;
@@ -121,7 +122,8 @@ void PatchFunctions()
if (symbol > 0)
{
u32 HLEPatchValue = (1 & 0x3f) << 26;
- for (u32 addr = symbol->address; addr < symbol->address + symbol->size; addr += 4) {
+ for (u32 addr = symbol->address; addr < symbol->address + symbol->size; addr += 4)
+ {
orig_instruction[addr] = Memory::ReadUnchecked_U32(addr);
Memory::Write_U32(HLEPatchValue | i, addr);
}
@@ -166,4 +168,4 @@ u32 GetOrigInstruction(u32 addr)
return 0;
}
-}
+} // end of namespace HLE
diff --git a/Source/Core/Core/Src/HLE/HLE_Misc.cpp b/Source/Core/Core/Src/HLE/HLE_Misc.cpp
index 1f481c1db3..422d4f15b7 100644
--- a/Source/Core/Core/Src/HLE/HLE_Misc.cpp
+++ b/Source/Core/Core/Src/HLE/HLE_Misc.cpp
@@ -26,7 +26,7 @@ namespace HLE_Misc
{
// Helper to quickly read the floating point value at a memory location.
-inline float F(u32 addr)
+inline float F(u32 addr)
{
u32 mem = Memory::ReadFast32(addr);
return *((float*)&mem);
diff --git a/Source/Core/Core/Src/HLE/HLE_OS.cpp b/Source/Core/Core/Src/HLE/HLE_OS.cpp
index b96ab8c123..9b08e7a9eb 100644
--- a/Source/Core/Core/Src/HLE/HLE_OS.cpp
+++ b/Source/Core/Core/Src/HLE/HLE_OS.cpp
@@ -117,20 +117,20 @@ void GetStringVA(std::string& _rOutBuffer, u32 strReg)
case 'd':
case 'i':
- {
- //u64 Double = Memory::Read_U64(Parameter);
- _rOutBuffer += StringFromFormat(ArgumentBuffer, Parameter);
- }
+ {
+ //u64 Double = Memory::Read_U64(Parameter);
+ _rOutBuffer += StringFromFormat(ArgumentBuffer, Parameter);
break;
+ }
case 'f':
- {
- _rOutBuffer += StringFromFormat(ArgumentBuffer,
- rPS0(FloatingParameterCounter));
- FloatingParameterCounter++;
- ParameterCounter--;
- }
+ {
+ _rOutBuffer += StringFromFormat(ArgumentBuffer,
+ rPS0(FloatingParameterCounter));
+ FloatingParameterCounter++;
+ ParameterCounter--;
break;
+ }
case 'p':
// Override, so 64bit dolphin prints 32bit pointers, since the ppc is 32bit :)
@@ -153,4 +153,4 @@ void GetStringVA(std::string& _rOutBuffer, u32 strReg)
_rOutBuffer.resize(_rOutBuffer.length() - 1);
}
-}
+} // end of namespace HLE_OS
diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp
index 07c18d373d..36d2bde4e9 100644
--- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp
+++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp
@@ -105,58 +105,58 @@ bool CWII_IPC_HLE_Device_net_kd_request::IOCtl(u32 _CommandAddress)
u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C);
u32 ReturnValue = 0;
- switch (Parameter)
- {
- case IOCTL_NWC24_SUSPEND_SCHEDULAR:
+ switch (Parameter)
+ {
+ case IOCTL_NWC24_SUSPEND_SCHEDULAR:
// NWC24iResumeForCloseLib from NWC24SuspendScheduler (Input: none, Output: 32 bytes)
- INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_SUSPEND_SCHEDULAR - NI");
- break;
+ INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_SUSPEND_SCHEDULAR - NI");
+ break;
- case IOCTL_NWC24_EXEC_TRY_SUSPEND_SCHEDULAR: // NWC24iResumeForCloseLib
- INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_EXEC_TRY_SUSPEND_SCHEDULAR - NI");
- break;
+ case IOCTL_NWC24_EXEC_TRY_SUSPEND_SCHEDULAR: // NWC24iResumeForCloseLib
+ INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_EXEC_TRY_SUSPEND_SCHEDULAR - NI");
+ break;
- case IOCTL_NWC24_UNK_3: // NWC24iResumeForCloseLib
- INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_UNK_3 - NI");
- break;
+ case IOCTL_NWC24_UNK_3: // NWC24iResumeForCloseLib
+ INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_UNK_3 - NI");
+ break;
- case IOCTL_NWC24_STARTUP_SOCKET: // NWC24iStartupSocket
- INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_STARTUP_SOCKET - NI");
- break;
+ case IOCTL_NWC24_STARTUP_SOCKET: // NWC24iStartupSocket
+ INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_STARTUP_SOCKET - NI");
+ break;
- case IOCTL_NWC24_LOCK_SOCKET: // WiiMenu
- INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_LOCK_SOCKET - NI");
- break;
+ case IOCTL_NWC24_LOCK_SOCKET: // WiiMenu
+ INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_LOCK_SOCKET - NI");
+ break;
- case IOCTL_NWC24_UNLOCK_SOCKET:
- INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_UNLOCK_SOCKET - NI");
- break;
+ case IOCTL_NWC24_UNLOCK_SOCKET:
+ INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_UNLOCK_SOCKET - NI");
+ break;
- case IOCTL_NWC24_REQUEST_GENERATED_USER_ID: // (Input: none, Output: 32 bytes)
- INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_REQUEST_GENERATED_USER_ID");
+ case IOCTL_NWC24_REQUEST_GENERATED_USER_ID: // (Input: none, Output: 32 bytes)
+ INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_REQUEST_GENERATED_USER_ID");
memcpy(Memory::GetPointer(BufferOut), m_UserID.c_str(), m_UserID.length() + 1);
- break;
+ break;
- case IOCTL_NWC24_GET_SCHEDULAR_STAT:
- INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_GET_SCHEDULAR_STAT - NI");
- break;
+ case IOCTL_NWC24_GET_SCHEDULAR_STAT:
+ INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_GET_SCHEDULAR_STAT - NI");
+ break;
- case IOCTL_NWC24_SAVE_MAIL_NOW:
- INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_SAVE_MAIL_NOW - NI");
- break;
+ case IOCTL_NWC24_SAVE_MAIL_NOW:
+ INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_SAVE_MAIL_NOW - NI");
+ break;
- case IOCTL_NWC24_REQUEST_SHUTDOWN:
+ case IOCTL_NWC24_REQUEST_SHUTDOWN:
// if ya set the IOS version to a very high value this happens ...
- INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_REQUEST_SHUTDOWN - NI");
- break;
+ INFO_LOG(WII_IPC_NET, "NET_KD_REQ: IOCTL_NWC24_REQUEST_SHUTDOWN - NI");
+ break;
- default:
- INFO_LOG(WII_IPC_NET, "/dev/net/kd/request::IOCtl request 0x%x (BufferIn: (%08x, %i), BufferOut: (%08x, %i)",
- Parameter, BufferIn, BufferInSize, BufferOut, BufferOutSize);
- break;
- }
+ default:
+ INFO_LOG(WII_IPC_NET, "/dev/net/kd/request::IOCtl request 0x%x (BufferIn: (%08x, %i), BufferOut: (%08x, %i)",
+ Parameter, BufferIn, BufferInSize, BufferOut, BufferOutSize);
+ break;
+ }
- // g_ReplyQueueLater.push(std::pair<u32, std::string>(_CommandAddress, GetDeviceName()));
+ // g_ReplyQueueLater.push(std::pair<u32, std::string>(_CommandAddress, GetDeviceName()));
Memory::Write_U32(ReturnValue, _CommandAddress + 4);
return true;
@@ -240,7 +240,7 @@ bool CWII_IPC_HLE_Device_net_ncd_manage::IOCtlV(u32 _CommandAddress)
u32 addr = CommandBuffer.PayloadBuffer.at(0).m_Address;
Memory::WriteBigEData((const u8*)&m_Ifconfig, addr, 8);
addr += 8;
- for (unsigned int i = 0;i < 3; i++)
+ for (unsigned int i = 0; i < 3; i++)
{
netcfg_connection_t *conn = &m_Ifconfig.connection[i];
@@ -349,10 +349,12 @@ bool CWII_IPC_HLE_Device_net_ncd_manage::IOCtlV(u32 _CommandAddress)
// Handle /dev/net/ip/top requests
CWII_IPC_HLE_Device_net_ip_top::CWII_IPC_HLE_Device_net_ip_top(u32 _DeviceID, const std::string& _rDeviceName)
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
-{}
+{
+}
CWII_IPC_HLE_Device_net_ip_top::~CWII_IPC_HLE_Device_net_ip_top()
-{}
+{
+}
bool CWII_IPC_HLE_Device_net_ip_top::Open(u32 _CommandAddress, u32 _Mode)
{
@@ -417,58 +419,57 @@ u32 CWII_IPC_HLE_Device_net_ip_top::ExecuteCommand(u32 _Command, u32 _BufferIn,
break;
case IOCTL_SO_SOCKET:
- {
- u32 AF = Memory::Read_U32(_BufferIn);
- u32 TYPE = Memory::Read_U32(_BufferIn + 0x04);
- u32 PROT = Memory::Read_U32(_BufferIn + 0x04 * 2);
-// u32 Unk1 = Memory::Read_U32(_BufferIn + 0x04 * 3);
- u32 Socket = (u32)socket(AF, TYPE, PROT);
- return Common::swap32(Socket); // So it doesn't get mangled later on
- }
+ {
+ u32 AF = Memory::Read_U32(_BufferIn);
+ u32 TYPE = Memory::Read_U32(_BufferIn + 0x04);
+ u32 PROT = Memory::Read_U32(_BufferIn + 0x04 * 2);
+// u32 Unk1 = Memory::Read_U32(_BufferIn + 0x04 * 3);
+ u32 Socket = (u32)socket(AF, TYPE, PROT);
+ return Common::swap32(Socket); // So it doesn't get mangled later on
break;
+ }
case IOCTL_SO_BIND:
- {
- bind_params *addr = (bind_params*)Memory::GetPointer(_BufferIn);
- GC_sockaddr_in addrPC;
- memcpy(&addrPC, addr->name, sizeof(GC_sockaddr_in));
- sockaddr_in address;
- address.sin_family = addrPC.sin_family;
- address.sin_addr.s_addr = addrPC.sin_addr.s_addr_;
- address.sin_port = htons(addrPC.sin_port);
- int Return = bind(addr->socket, (sockaddr*)&address, sizeof(address));
- return Return;
- //int bind(int s, struct sockaddr *addr, int addrlen);
- }
+ {
+ bind_params *addr = (bind_params*)Memory::GetPointer(_BufferIn);
+ GC_sockaddr_in addrPC;
+ memcpy(&addrPC, addr->name, sizeof(GC_sockaddr_in));
+ sockaddr_in address;
+ address.sin_family = addrPC.sin_family;
+ address.sin_addr.s_addr = addrPC.sin_addr.s_addr_;
+ address.sin_port = htons(addrPC.sin_port);
+ int Return = bind(addr->socket, (sockaddr*)&address, sizeof(address));
+ return Return;
+ //int bind(int s, struct sockaddr *addr, int addrlen);
break;
+ }
case IOCTL_SO_LISTEN:
- {
- u32 S = Memory::Read_U32(_BufferIn);
- u32 BACKLOG = Memory::Read_U32(_BufferIn + 0x04);
- u32 Return = listen(S, BACKLOG);
- return Return;
- }
+ {
+ u32 S = Memory::Read_U32(_BufferIn);
+ u32 BACKLOG = Memory::Read_U32(_BufferIn + 0x04);
+ u32 Return = listen(S, BACKLOG);
+ return Return;
break;
+ }
case IOCTL_SO_ACCEPT:
- {
- //TODO: (Sonic)Check if this is correct
- u32 S = Memory::Read_U32(_BufferIn);
- socklen_t addrlen;
- struct sockaddr_in address;
- u32 Return = (u32)accept(S, (struct sockaddr *)&address, &addrlen);
- GC_sockaddr_in *addr = (GC_sockaddr_in*)Memory::GetPointer(BufferOut);
- addr->sin_family = (u8)address.sin_family;
- addr->sin_addr.s_addr_ = address.sin_addr.s_addr;
- addr->sin_port = address.sin_port;
- socklen_t *Len = (socklen_t *)Memory::GetPointer(BufferOut + 0x04);
- *Len = addrlen;
- return Return;
- //int accept(int s, struct sockaddr *addr, int *addrlen);
- ///dev/net/ip/top::IOCtl request 0x1 (BufferIn: (000318c0, 4), BufferOut: (00058a4c, 8)
- }
- break;
+ {
+ //TODO: (Sonic)Check if this is correct
+ u32 S = Memory::Read_U32(_BufferIn);
+ socklen_t addrlen;
+ struct sockaddr_in address;
+ u32 Return = (u32)accept(S, (struct sockaddr *)&address, &addrlen);
+ GC_sockaddr_in *addr = (GC_sockaddr_in*)Memory::GetPointer(BufferOut);
+ addr->sin_family = (u8)address.sin_family;
+ addr->sin_addr.s_addr_ = address.sin_addr.s_addr;
+ addr->sin_port = address.sin_port;
+ socklen_t *Len = (socklen_t *)Memory::GetPointer(BufferOut + 0x04);
+ *Len = addrlen;
+ return Return;
+ //int accept(int s, struct sockaddr *addr, int *addrlen);
+ ///dev/net/ip/top::IOCtl request 0x1 (BufferIn: (000318c0, 4), BufferOut: (00058a4c, 8)
+ }
case IOCTL_SO_GETHOSTID:
return 127 << 24 | 1;
@@ -504,6 +505,5 @@ bool CWII_IPC_HLE_Device_net_ip_top::IOCtlV(u32 _CommandAddress)
}
Memory::Write_U32(ReturnValue, _CommandAddress+4);
-
return true;
}
diff --git a/Source/Core/Core/Src/MemTools.cpp b/Source/Core/Core/Src/MemTools.cpp
index 965af81c30..2205b85123 100644
--- a/Source/Core/Core/Src/MemTools.cpp
+++ b/Source/Core/Core/Src/MemTools.cpp
@@ -150,7 +150,7 @@ void InstallExceptionHandler()
#endif
}
-#else // _WIN32)
+#else // _WIN32
//
// backtrace useful function
@@ -165,7 +165,7 @@ void print_trace(const char * msg)
size = backtrace(array, 100);
strings = backtrace_symbols(array, size);
- printf("%s Obtained %zd stack frames.\n", msg, size);
+ printf("%s Obtained %u stack frames.\n", msg, size);
for (i = 0; i < size; i++)
printf("--> %s\n", strings[i]);
free(strings);
diff --git a/Source/Core/Core/Src/State.cpp b/Source/Core/Core/Src/State.cpp
index 0b62fca92b..b7c7591148 100644
--- a/Source/Core/Core/Src/State.cpp
+++ b/Source/Core/Core/Src/State.cpp
@@ -89,11 +89,11 @@ void DoState(PointerWrap &p)
}
// Begin with video plugin, so that it gets a chance to clear it's caches and writeback modified things to RAM
CPluginManager &pm = CPluginManager::GetInstance();
- pm.GetVideo()->DoState(p.GetPPtr(), p.GetMode());
- pm.GetDSP()->DoState(p.GetPPtr(), p.GetMode());
- pm.GetPad(0)->DoState(p.GetPPtr(), p.GetMode());
- if (Core::g_CoreStartupParameter.bWii)
- pm.GetWiimote(0)->DoState(p.GetPPtr(), p.GetMode());
+ pm.GetVideo()->DoState(p.GetPPtr(), p.GetMode());
+ pm.GetDSP()->DoState(p.GetPPtr(), p.GetMode());
+ pm.GetPad(0)->DoState(p.GetPPtr(), p.GetMode());
+ if (Core::g_CoreStartupParameter.bWii)
+ pm.GetWiimote(0)->DoState(p.GetPPtr(), p.GetMode());
PowerPC::DoState(p);
HW::DoState(p);
CoreTiming::DoState(p);
@@ -161,7 +161,8 @@ THREAD_RETURN CompressAndDumpState(void *pArgs)
delete saveArg;
// Moving to last overwritten save-state
- if (File::Exists(cur_filename.c_str())) {
+ if (File::Exists(cur_filename.c_str()))
+ {
if (File::Exists((std::string(File::GetUserPath(D_STATESAVES_IDX)) + "lastState.sav").c_str()))
File::Delete((std::string(File::GetUserPath(D_STATESAVES_IDX)) + "lastState.sav").c_str());
@@ -170,9 +171,10 @@ THREAD_RETURN CompressAndDumpState(void *pArgs)
}
FILE *f = fopen(filename.c_str(), "wb");
- if (f == NULL) {
+ if (f == NULL)
+ {
Core::DisplayMessage("Could not save state", 2000);
- delete [] buffer;
+ delete []buffer;
return 0;
}
@@ -181,11 +183,13 @@ THREAD_RETURN CompressAndDumpState(void *pArgs)
header.sz = bCompressed ? sz : 0;
fwrite(&header, sizeof(state_header), 1, f);
- if (bCompressed) {
+ if (bCompressed)
+ {
lzo_uint cur_len = 0;
lzo_uint i = 0;
- for (;;) {
+ for (;;)
+ {
if ((i + IN_LEN) >= sz)
cur_len = sz - i;
else
@@ -202,7 +206,6 @@ THREAD_RETURN CompressAndDumpState(void *pArgs)
break;
i += cur_len;
}
-
}
else
{
@@ -210,8 +213,7 @@ THREAD_RETURN CompressAndDumpState(void *pArgs)
}
fclose(f);
-
- delete [] buffer;
+ delete []buffer;
Core::DisplayMessage(StringFromFormat("Saved State to %s",
filename.c_str()).c_str(), 2000);
@@ -288,7 +290,6 @@ void LoadStateCallback(u64 userdata, int cyclesLate)
gameID), 2000);
fclose(f);
-
return;
}
@@ -300,14 +301,15 @@ void LoadStateCallback(u64 userdata, int cyclesLate)
lzo_uint i = 0;
buffer = new u8[sz];
- if (!buffer) {
+ if (!buffer)
+ {
PanicAlert("Error allocating buffer");
return;
}
while (true)
{
- lzo_uint cur_len = 0;
- lzo_uint new_len = 0;
+ lzo_uint cur_len = 0; // number of bytes to read
+ lzo_uint new_len = 0; // number of bytes to write
if (fread(&cur_len, 1, sizeof(int), f) == 0)
break;
if (feof(f))
@@ -324,7 +326,6 @@ void LoadStateCallback(u64 userdata, int cyclesLate)
return;
}
- // The size of the data to read to our buffer is 'new_len'
i += new_len;
}
}
diff --git a/Source/Core/Core/Src/Tracer.cpp b/Source/Core/Core/Src/Tracer.cpp
index 7d4e9280ff..1ef0883146 100644
--- a/Source/Core/Core/Src/Tracer.cpp
+++ b/Source/Core/Core/Src/Tracer.cpp
@@ -53,7 +53,7 @@ void StopTrace()
if (tracefile)
{
fclose(tracefile);
- tracefile = 0;
+ tracefile = NULL;
}
}
@@ -143,5 +143,5 @@ int SyncTrace()
return 1;
}
-}
+} // end of namespace Core
diff --git a/Source/Core/Core/Src/VolumeHandler.cpp b/Source/Core/Core/Src/VolumeHandler.cpp
index 21b34c161d..c26aaf10ec 100644
--- a/Source/Core/Core/Src/VolumeHandler.cpp
+++ b/Source/Core/Core/Src/VolumeHandler.cpp
@@ -23,7 +23,8 @@ namespace VolumeHandler
DiscIO::IVolume* g_pVolume = NULL;
-DiscIO::IVolume *GetVolume() {
+DiscIO::IVolume *GetVolume()
+{
return g_pVolume;
}
@@ -50,7 +51,7 @@ bool SetVolumeName(const std::string& _rFullPath)
g_pVolume = DiscIO::CreateVolumeFromFilename(_rFullPath);
- return g_pVolume != NULL;
+ return (g_pVolume != NULL);
}
void SetVolumeDirectory(const std::string& _rFullPath, bool _bIsWii, const std::string& _rApploader, const std::string& _rDOL)
@@ -82,7 +83,6 @@ bool ReadToPtr(u8* ptr, u64 _dwOffset, u64 _dwLength)
g_pVolume->Read(_dwOffset, _dwLength, ptr);
return true;
}
-
return false;
}
@@ -93,13 +93,12 @@ bool RAWReadToPtr( u8* ptr, u64 _dwOffset, u64 _dwLength )
g_pVolume->RAWRead(_dwOffset, _dwLength, ptr);
return true;
}
-
return false;
}
bool IsValid()
{
- return g_pVolume != NULL;
+ return (g_pVolume != NULL);
}
bool IsWii()
@@ -110,4 +109,4 @@ bool IsWii()
return false;
}
-} // namespace
+} // end of namespace VolumeHandler
diff --git a/Source/Core/Core/Src/VolumeHandler.h b/Source/Core/Core/Src/VolumeHandler.h
index 3e8ad20c09..44a002f768 100644
--- a/Source/Core/Core/Src/VolumeHandler.h
+++ b/Source/Core/Core/Src/VolumeHandler.h
@@ -42,6 +42,6 @@ DiscIO::IVolume *GetVolume();
void EjectVolume();
-} // namespace
+} // end of namespace VolumeHandler
#endif