StringUtil cleanup. Nothing seems broken.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6367 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Jordan Woyak
2010-11-10 04:12:31 +00:00
parent 7b34def0fc
commit 26f84c1e74
20 changed files with 190 additions and 411 deletions

View File

@ -184,14 +184,14 @@ void LoadCodes(IniFile &ini, bool forceLoad)
continue;
}
SplitString(line, " ", pieces);
SplitString(line, ' ', pieces);
// Check if the AR code is decrypted
if (pieces.size() == 2 && pieces[0].size() == 8 && pieces[1].size() == 8)
{
AREntry op;
bool success_addr = TryParseUInt(std::string("0x") + pieces[0], &op.cmd_addr);
bool success_val = TryParseUInt(std::string("0x") + pieces[1], &op.value);
bool success_addr = TryParse(std::string("0x") + pieces[0], &op.cmd_addr);
bool success_val = TryParse(std::string("0x") + pieces[1], &op.value);
if (!(success_addr | success_val)) {
PanicAlert("Action Replay Error: invalid AR code line: %s", line.c_str());
if (!success_addr) PanicAlert("The address is invalid");
@ -202,7 +202,7 @@ void LoadCodes(IniFile &ini, bool forceLoad)
}
else
{
SplitString(line, "-", pieces);
SplitString(line, '-', pieces);
if (pieces.size() == 3 && pieces[0].size() == 4 && pieces[1].size() == 4 && pieces[2].size() == 5)
{
// Encrypted AR code

View File

@ -213,7 +213,7 @@ void FrameStepOnOff()
void WriteStatus()
{
std::string TmpStr = "Time: " + ReRecTimer.GetTimeElapsedFormatted();
TmpStr += StringFromFormat(" Frame: %s", ThS(g_FrameCounter).c_str());
TmpStr += StringFromFormat(" Frame: %s", ThousandSeparate(g_FrameCounter).c_str());
// The FPS is the total average since the game was booted
TmpStr += StringFromFormat(" FPS: %i", (g_FrameCounter * 1000) / ReRecTimer.GetTimeElapsed());
TmpStr += StringFromFormat(" FrameStep: %s", g_FrameStep ? "On" : "Off");

View File

@ -197,7 +197,7 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32
VolumeHandler::RAWReadToPtr(Memory::GetPointer(_BufferOut), 0, _BufferOutSize);
INFO_LOG(WII_IPC_DVD, "DVDLowReadDiskID %s",
ArrayToString(Memory::GetPointer(_BufferOut), _BufferOutSize, 0, _BufferOutSize).c_str());
ArrayToString(Memory::GetPointer(_BufferOut), _BufferOutSize, _BufferOutSize).c_str());
}
break;

View File

@ -895,7 +895,7 @@ namespace Core
INFO_LOG(WIIMOTE, "====================");
INFO_LOG(WIIMOTE, "Callback_WiimoteInterruptChannel: (Wiimote: #%i)", _number);
DEBUG_LOG(WIIMOTE, " Data: %s", ArrayToString(pData, _Size, 0, 50).c_str());
DEBUG_LOG(WIIMOTE, " Data: %s", ArrayToString(pData, _Size, 50).c_str());
DEBUG_LOG(WIIMOTE, " Channel: %x", _channelID);
s_Usb->m_WiiMotes[_number].ReceiveL2capData(_channelID, _pData, _Size);

View File

@ -30,6 +30,8 @@
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include "StringUtil.h"
#include "PatchEngine.h"
#include "HW/Memmap.h"
@ -48,7 +50,6 @@ const char *PatchTypeStrings[] =
"byte",
"word",
"dword",
0
};
std::vector<Patch> onFrame;
@ -88,14 +89,15 @@ void LoadPatchSection(const char *section, std::vector<Patch> &patches, IniFile
line.at(loc) = ':';
std::vector<std::string> items;
SplitString(line, ":", items);
SplitString(line, ':', items);
if (items.size() >= 3) {
PatchEntry pE;
bool success = true;
success = success && TryParseUInt(items[0], &pE.address);
success = success && TryParseUInt(items[2], &pE.value);
pE.type = (PatchType)ChooseStringFrom(items[1].c_str(), PatchTypeStrings);
success = success && (pE.type != (PatchType)-1);
success &= TryParse(items[0], &pE.address);
success &= TryParse(items[2], &pE.value);
pE.type = PatchType(std::find(PatchTypeStrings, PatchTypeStrings + 3, items[1]) - PatchTypeStrings);
success &= (pE.type != (PatchType)3);
if (success)
currentPatch.entries.push_back(pE);
}
@ -131,8 +133,8 @@ static void LoadSpeedhacks(const char *section, std::map<u32, int> &hacks, IniFi
u32 address;
u32 cycles;
bool success = true;
success = success && TryParseUInt(std::string(key.c_str()), &address);
success = success && TryParseUInt(value, &cycles);
success &= TryParse(key, &address);
success &= TryParse(value, &cycles);
if (success) {
speedHacks[address] = (int)cycles;
}