Random fixes and cleanups

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5297 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
NeoBrainX 2010-04-08 16:59:35 +00:00
parent b452bf7051
commit f727139ebf
22 changed files with 555 additions and 573 deletions

View File

@ -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;
}

View File

@ -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_

View File

@ -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

View File

@ -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

View File

@ -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;
@ -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;
@ -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);
}

View File

@ -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;

View File

@ -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 of game id
Memory::Write_U32(Memory::Read_U32(0x80000000), 0x80003180);
// copy first 20 bytes of disc to start of Mem 1
VolumeHandler::ReadToPtr(Memory::GetPointer(0x80000000), 0, 0x20);
u32 shift = 0;
if (_bIsWii)
shift = 2;
// copy of game id
Memory::Write_U32(Memory::Read_U32(0x80000000), 0x80003180);
u32 fstOffset = VolumeHandler::Read32(0x0424) << shift;
u32 fstSize = VolumeHandler::Read32(0x0428) << shift;
u32 maxFstSize = VolumeHandler::Read32(0x042c) << shift;
u32 shift = 0;
if (_bIsWii)
shift = 2;
u32 arenaHigh = 0x817FFFF4 - maxFstSize;
Memory::Write_U32(arenaHigh, 0x00000034);
u32 fstOffset = VolumeHandler::Read32(0x0424) << shift;
u32 fstSize = VolumeHandler::Read32(0x0428) << shift;
u32 maxFstSize = VolumeHandler::Read32(0x042c) << shift;
// load FST
VolumeHandler::ReadToPtr(Memory::GetPointer(arenaHigh), fstOffset, fstSize);
Memory::Write_U32(arenaHigh, 0x00000038);
Memory::Write_U32(maxFstSize, 0x0000003c);
}
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;
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!");
}
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;
char gameID[7];
memcpy(gameID, pVolume->GetUniqueID().c_str(), 6);
gameID[6] = 0;
// setup the map from ISOFile ID
VolumeHandler::SetVolumeName(_StartupPara.m_strFilename);
// setup the map from ISOFile ID
VolumeHandler::SetVolumeName(_StartupPara.m_strFilename);
VideoInterface::SetRegionReg((char)VolumeHandler::GetVolume()->GetUniqueID().at(3));
VideoInterface::SetRegionReg((char)VolumeHandler::GetVolume()->GetUniqueID().at(3));
DVDInterface::SetDiscInside(VolumeHandler::IsValid());
DVDInterface::SetDiscInside(VolumeHandler::IsValid());
_StartupPara.bWii = VolumeHandler::IsWii();
_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);
}
// 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();
/* 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();
// 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!");
}
// 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;
}
bool BS2Success = 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!");
}
if (dolWii)
{
BS2Success = EmulatedBS2(dolWii);
}
else if (!VolumeHandler::IsWii() && !_StartupPara.m_strDefaultGCM.empty())
{
VolumeHandler::SetVolumeName(_StartupPara.m_strDefaultGCM.c_str());
BS2Success = EmulatedBS2(dolWii);
}
bool BS2Success = false;
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);
}
if (elfWii)
{
BS2Success = EmulatedBS2(elfWii);
}
else if (!VolumeHandler::IsWii() && !_StartupPara.m_strDefaultGCM.empty())
{
VolumeHandler::SetVolumeName(_StartupPara.m_strDefaultGCM.c_str());
BS2Success = EmulatedBS2(elfWii);
}
DVDInterface::SetDiscInside(VolumeHandler::IsValid());
// 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);
if (!BS2Success)
{
CDolLoader dolLoader(_StartupPara.m_strFilename.c_str());
PC = dolLoader.GetEntryPoint();
}
DVDInterface::SetDiscInside(VolumeHandler::IsValid());
if (LoadMapFromFilename(_StartupPara.m_strFilename))
HLE::PatchFunctions();
}
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;
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;
}

View File

@ -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++)

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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);
// ISO folders
ini.Set("General", "GCMPathes", (int)m_ISOFolder.size());
for (size_t i = 0; i < m_ISOFolder.size(); i++)
{
ini.Set("General", "LastFilename", m_LastFilename);
// 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);
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]);
}
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]);
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);
// 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();
}

View File

@ -111,11 +111,7 @@ struct SConfig
static void Shutdown();
private:
// constructor
SConfig();
// destructor
~SConfig();
static SConfig* m_Instance;

View File

@ -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

View File

@ -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

View File

@ -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;
}

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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

View File

@ -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

View File

@ -42,6 +42,6 @@ DiscIO::IVolume *GetVolume();
void EjectVolume();
} // namespace
} // end of namespace VolumeHandler
#endif