Some code clean up. I am terrible at coding styles...

This commit is contained in:
Matthew Parlane 2012-03-18 21:50:07 +13:00
parent 6fe495e1aa
commit 8479d5bdf7
1 changed files with 21 additions and 12 deletions

View File

@ -85,7 +85,8 @@ void Init()
_dbg_assert_msg_(WII_IPC_HLE, g_DeviceMap.empty(), "DeviceMap isnt empty on init"); _dbg_assert_msg_(WII_IPC_HLE, g_DeviceMap.empty(), "DeviceMap isnt empty on init");
u32 i; u32 i;
for(i=0; i<IPC_MAX_FDS; i++){ for (i=0; i<IPC_MAX_FDS; i++)
{
g_FdMap[i] = NULL; g_FdMap[i] = NULL;
} }
@ -121,7 +122,8 @@ void Reset(bool _bHard)
{ {
u32 i; u32 i;
for (i=0; i<IPC_MAX_FDS; i++){ for (i=0; i<IPC_MAX_FDS; i++)
{
if (g_FdMap[i] != NULL && !g_FdMap[i]->IsHardware()) if (g_FdMap[i] != NULL && !g_FdMap[i]->IsHardware())
{ {
// close all files and delete their resources // close all files and delete their resources
@ -160,7 +162,7 @@ void Shutdown()
void SetDefaultContentFile(const std::string& _rFilename) void SetDefaultContentFile(const std::string& _rFilename)
{ {
TDeviceMap::const_iterator itr = g_DeviceMap.begin(); TDeviceMap::const_iterator itr = g_DeviceMap.begin();
while(itr != g_DeviceMap.end()) while (itr != g_DeviceMap.end())
{ {
if (itr->second && itr->second->GetDeviceName().find(std::string("/dev/es")) == 0) if (itr->second && itr->second->GetDeviceName().find(std::string("/dev/es")) == 0)
{ {
@ -185,7 +187,8 @@ void SDIO_EventNotify()
int getFreeDeviceId() int getFreeDeviceId()
{ {
u32 i; u32 i;
for(i=0; i<IPC_MAX_FDS; i++){ for (i=0; i<IPC_MAX_FDS; i++)
{
if (g_FdMap[i] == NULL) if (g_FdMap[i] == NULL)
{ {
return i; return i;
@ -248,10 +251,12 @@ void DoState(PointerWrap &p)
if (p.GetMode() == PointerWrap::MODE_READ) if (p.GetMode() == PointerWrap::MODE_READ)
{ {
u32 i; u32 i;
for (i=0; i<IPC_MAX_FDS; i++){ for (i=0; i<IPC_MAX_FDS; i++)
{
u32 exists; u32 exists;
p.Do(exists); p.Do(exists);
if (exists){ if (exists)
{
u32 isHw; u32 isHw;
p.Do(isHw); p.Do(isHw);
if (isHw) if (isHw)
@ -283,10 +288,12 @@ void DoState(PointerWrap &p)
else else
{ {
u32 i; u32 i;
for (i=0; i<IPC_MAX_FDS; i++){ for (i=0; i<IPC_MAX_FDS; i++)
{
u32 exists = g_FdMap[i] ? 1 : 0; u32 exists = g_FdMap[i] ? 1 : 0;
p.Do(exists); p.Do(exists);
if (exists){ if (exists)
{
u32 isHw = g_FdMap[i]->IsHardware() ? 1 : 0; u32 isHw = g_FdMap[i]->IsHardware() ? 1 : 0;
p.Do(isHw); p.Do(isHw);
if (isHw) if (isHw)
@ -348,7 +355,7 @@ void ExecuteCommand(u32 _Address)
break; break;
} }
} }
if(j == ES_MAX_COUNT) if (j == ES_MAX_COUNT)
{ {
Memory::Write_U32(FS_EESEXHAUSTED, _Address + 4); Memory::Write_U32(FS_EESEXHAUSTED, _Address + 4);
CmdSuccess = true; CmdSuccess = true;
@ -382,7 +389,7 @@ void ExecuteCommand(u32 _Address)
INFO_LOG(WII_IPC_FILEIO, "IOP: Open File (Device=%s, ID=%08x, Mode=%i)", INFO_LOG(WII_IPC_FILEIO, "IOP: Open File (Device=%s, ID=%08x, Mode=%i)",
pDevice->GetDeviceName().c_str(), DeviceID, Mode); pDevice->GetDeviceName().c_str(), DeviceID, Mode);
if(Memory::Read_U32(_Address + 4) == DeviceID) if (Memory::Read_U32(_Address + 4) == DeviceID)
g_FdMap[DeviceID] = pDevice; g_FdMap[DeviceID] = pDevice;
} }
@ -553,8 +560,10 @@ void Update()
void UpdateDevices() void UpdateDevices()
{ {
// Check if a hardware device must be updated // Check if a hardware device must be updated
for (TDeviceMap::const_iterator itr = g_DeviceMap.begin(); itr != g_DeviceMap.end(); ++itr) { for (TDeviceMap::const_iterator itr = g_DeviceMap.begin(); itr != g_DeviceMap.end(); ++itr)
if (itr->second->IsOpened() && itr->second->Update()) { {
if (itr->second->IsOpened() && itr->second->Update())
{
break; break;
} }
} }