mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
Kill off some usages of c_str.
Also changes some function params, but this is ok. Some simplifications were also able to be made (ie. killing off strcmps with ==, etc).
This commit is contained in:
@ -126,7 +126,7 @@ bool CBoot::LoadMapFromFilename()
|
||||
{
|
||||
std::string strMapFilename;
|
||||
bool found = FindMapFile(&strMapFilename, nullptr);
|
||||
if (found && g_symbolDB.LoadMap(strMapFilename.c_str()))
|
||||
if (found && g_symbolDB.LoadMap(strMapFilename))
|
||||
{
|
||||
UpdateDebugger_MapLoaded();
|
||||
return true;
|
||||
@ -149,7 +149,7 @@ bool CBoot::Load_BS2(const std::string& _rBootROMFilename)
|
||||
|
||||
// Load the whole ROM dump
|
||||
std::string data;
|
||||
if (!File::ReadFileToString(_rBootROMFilename.c_str(), data))
|
||||
if (!File::ReadFileToString(_rBootROMFilename, data))
|
||||
return false;
|
||||
|
||||
u32 ipl_hash = HashAdler32((const u8*)data.data(), data.size());
|
||||
@ -247,7 +247,7 @@ bool CBoot::BootUp()
|
||||
{
|
||||
PPCAnalyst::FindFunctions(0x80004000, 0x811fffff, &g_symbolDB);
|
||||
SignatureDB db;
|
||||
if (db.Load((File::GetSysDirectory() + TOTALDB).c_str()))
|
||||
if (db.Load(File::GetSysDirectory() + TOTALDB))
|
||||
{
|
||||
db.Apply(&g_symbolDB);
|
||||
HLE::PatchFunctions();
|
||||
@ -268,7 +268,7 @@ bool CBoot::BootUp()
|
||||
// DOL
|
||||
case SCoreStartupParameter::BOOT_DOL:
|
||||
{
|
||||
CDolLoader dolLoader(_StartupPara.m_strFilename.c_str());
|
||||
CDolLoader dolLoader(_StartupPara.m_strFilename);
|
||||
// Check if we have gotten a Wii file or not
|
||||
bool dolWii = dolLoader.IsWii();
|
||||
if (dolWii != _StartupPara.bWii)
|
||||
@ -284,7 +284,7 @@ bool CBoot::BootUp()
|
||||
}
|
||||
else if (!VolumeHandler::IsWii() && !_StartupPara.m_strDefaultGCM.empty())
|
||||
{
|
||||
VolumeHandler::SetVolumeName(_StartupPara.m_strDefaultGCM.c_str());
|
||||
VolumeHandler::SetVolumeName(_StartupPara.m_strDefaultGCM);
|
||||
BS2Success = EmulatedBS2(dolWii);
|
||||
}
|
||||
|
||||
@ -320,7 +320,7 @@ bool CBoot::BootUp()
|
||||
}
|
||||
|
||||
// Check if we have gotten a Wii file or not
|
||||
bool elfWii = IsElfWii(_StartupPara.m_strFilename.c_str());
|
||||
bool elfWii = IsElfWii(_StartupPara.m_strFilename);
|
||||
if (elfWii != _StartupPara.bWii)
|
||||
{
|
||||
PanicAlertT("Warning - starting ELF in wrong console mode!");
|
||||
@ -334,7 +334,7 @@ bool CBoot::BootUp()
|
||||
}
|
||||
else if (!VolumeHandler::IsWii() && !_StartupPara.m_strDefaultGCM.empty())
|
||||
{
|
||||
VolumeHandler::SetVolumeName(_StartupPara.m_strDefaultGCM.c_str());
|
||||
VolumeHandler::SetVolumeName(_StartupPara.m_strDefaultGCM);
|
||||
BS2Success = EmulatedBS2(elfWii);
|
||||
}
|
||||
|
||||
@ -362,7 +362,7 @@ bool CBoot::BootUp()
|
||||
else // Poor man's bootup
|
||||
{
|
||||
Load_FST(elfWii);
|
||||
Boot_ELF(_StartupPara.m_strFilename.c_str());
|
||||
Boot_ELF(_StartupPara.m_strFilename);
|
||||
}
|
||||
UpdateDebugger_MapLoaded();
|
||||
Dolphin_Debugger::AddAutoBreakpoints();
|
||||
@ -371,7 +371,7 @@ bool CBoot::BootUp()
|
||||
|
||||
// Wii WAD
|
||||
case SCoreStartupParameter::BOOT_WII_NAND:
|
||||
Boot_WiiWAD(_StartupPara.m_strFilename.c_str());
|
||||
Boot_WiiWAD(_StartupPara.m_strFilename);
|
||||
|
||||
if (LoadMapFromFilename())
|
||||
HLE::PatchFunctions();
|
||||
|
@ -25,7 +25,7 @@ class CBoot
|
||||
public:
|
||||
|
||||
static bool BootUp();
|
||||
static bool IsElfWii(const char *filename);
|
||||
static bool IsElfWii(const std::string& filename);
|
||||
|
||||
// Tries to find a map file for the current game by looking first in the
|
||||
// local user directory, then in the shared user directory.
|
||||
@ -46,8 +46,8 @@ private:
|
||||
static void UpdateDebugger_MapLoaded(const char* _gameID = nullptr);
|
||||
|
||||
static bool LoadMapFromFilename();
|
||||
static bool Boot_ELF(const char *filename);
|
||||
static bool Boot_WiiWAD(const char *filename);
|
||||
static bool Boot_ELF(const std::string& filename);
|
||||
static bool Boot_WiiWAD(const std::string& filename);
|
||||
|
||||
static bool EmulatedBS2_GC();
|
||||
static bool EmulatedBS2_Wii();
|
||||
|
@ -2,6 +2,8 @@
|
||||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "Common/CommonFuncs.h"
|
||||
#include "Common/FileUtil.h"
|
||||
|
||||
@ -14,14 +16,14 @@ CDolLoader::CDolLoader(u8* _pBuffer, u32 _Size)
|
||||
Initialize(_pBuffer, _Size);
|
||||
}
|
||||
|
||||
CDolLoader::CDolLoader(const char* _szFilename)
|
||||
CDolLoader::CDolLoader(const std::string& filename)
|
||||
: m_isWii(false)
|
||||
{
|
||||
const u64 size = File::GetSize(_szFilename);
|
||||
const u64 size = File::GetSize(filename);
|
||||
u8* const tmpBuffer = new u8[(size_t)size];
|
||||
|
||||
{
|
||||
File::IOFile pStream(_szFilename, "rb");
|
||||
File::IOFile pStream(filename, "rb");
|
||||
pStream.ReadBytes(tmpBuffer, (size_t)size);
|
||||
}
|
||||
|
||||
|
@ -4,12 +4,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
class CDolLoader
|
||||
{
|
||||
public:
|
||||
CDolLoader(const char* _szFilename);
|
||||
CDolLoader(const std::string& filename);
|
||||
CDolLoader(u8* _pBuffer, u32 _Size);
|
||||
~CDolLoader();
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/PowerPC/PowerPC.h"
|
||||
|
||||
bool CBoot::IsElfWii(const char *filename)
|
||||
bool CBoot::IsElfWii(const std::string& filename)
|
||||
{
|
||||
/* We already check if filename existed before we called this function, so
|
||||
there is no need for another check, just read the file right away */
|
||||
@ -55,7 +55,7 @@ bool CBoot::IsElfWii(const char *filename)
|
||||
}
|
||||
|
||||
|
||||
bool CBoot::Boot_ELF(const char *filename)
|
||||
bool CBoot::Boot_ELF(const std::string& filename)
|
||||
{
|
||||
const u64 filesize = File::GetSize(filename);
|
||||
u8 *mem = new u8[(size_t)filesize];
|
||||
|
@ -3,6 +3,7 @@
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "Common/CommonPaths.h"
|
||||
#include "Common/FileUtil.h"
|
||||
@ -45,9 +46,8 @@ typedef struct {
|
||||
u32 unknown[6];
|
||||
} StateFlags;
|
||||
|
||||
bool CBoot::Boot_WiiWAD(const char* _pFilename)
|
||||
bool CBoot::Boot_WiiWAD(const std::string& _pFilename)
|
||||
{
|
||||
|
||||
std::string state_filename(Common::GetTitleDataPath(TITLEID_SYSMENU) + WII_STATE);
|
||||
|
||||
if (File::Exists(state_filename))
|
||||
@ -102,7 +102,7 @@ bool CBoot::Boot_WiiWAD(const char* _pFilename)
|
||||
}
|
||||
else
|
||||
{
|
||||
pDolLoader.reset(new CDolLoader(pContent->m_Filename.c_str()));
|
||||
pDolLoader.reset(new CDolLoader(pContent->m_Filename));
|
||||
}
|
||||
pDolLoader->Load();
|
||||
PC = pDolLoader->GetEntryPoint() | 0x80000000;
|
||||
|
Reference in New Issue
Block a user