summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/common/common_types.h2
-rw-r--r--src/common/console_listener.cpp10
-rw-r--r--src/common/extended_trace.cpp2
-rw-r--r--src/common/file_search.cpp6
-rw-r--r--src/common/file_util.cpp26
-rw-r--r--src/common/file_util.h2
-rw-r--r--src/common/log_manager.cpp2
-rw-r--r--src/common/mem_arena.cpp2
-rw-r--r--src/common/memory_util.cpp2
-rw-r--r--src/common/msg_handler.cpp2
-rw-r--r--src/common/string_util.cpp20
-rw-r--r--src/common/string_util.h8
-rw-r--r--src/core/arm/disassembler/arm_disasm.cpp78
-rw-r--r--src/core/hle/svc.cpp2
-rw-r--r--src/core/loader/loader.cpp31
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.cpp4
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.h2
17 files changed, 103 insertions, 98 deletions
diff --git a/src/common/common_types.h b/src/common/common_types.h
index 9d41e5971..00fde828d 100644
--- a/src/common/common_types.h
+++ b/src/common/common_types.h
@@ -100,7 +100,7 @@ union t128 {
__m128 a; ///< 128-bit floating point (__m128 maps to the XMM[0-7] registers)
};
-namespace common {
+namespace Common {
/// Rectangle data structure
class Rect {
public:
diff --git a/src/common/console_listener.cpp b/src/common/console_listener.cpp
index 6a89edd44..40122224c 100644
--- a/src/common/console_listener.cpp
+++ b/src/common/console_listener.cpp
@@ -43,7 +43,7 @@ void ConsoleListener::Open(bool Hidden, int Width, int Height, const char *Title
// Save the window handle that AllocConsole() created
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
// Set the console window title
- SetConsoleTitle(UTF8ToTStr(Title).c_str());
+ SetConsoleTitle(Common::UTF8ToTStr(Title).c_str());
// Set letter space
LetterSpace(80, 4000);
//MoveWindow(GetConsoleWindow(), 200,200, 800,800, true);
@@ -189,11 +189,11 @@ void ConsoleListener::PixelSpace(int Left, int Top, int Width, int Height, bool
{
Str.resize(Str.size() + 1);
if (!ReadConsoleOutputCharacter(hConsole, Str.back().data(), ReadBufferSize, coordScreen, &cCharsRead))
- SLog += StringFromFormat("WriteConsoleOutputCharacter error");
+ SLog += Common::StringFromFormat("WriteConsoleOutputCharacter error");
Attr.resize(Attr.size() + 1);
if (!ReadConsoleOutputAttribute(hConsole, Attr.back().data(), ReadBufferSize, coordScreen, &cAttrRead))
- SLog += StringFromFormat("WriteConsoleOutputAttribute error");
+ SLog += Common::StringFromFormat("WriteConsoleOutputAttribute error");
// Break on error
if (cAttrRead == 0) break;
@@ -219,9 +219,9 @@ void ConsoleListener::PixelSpace(int Left, int Top, int Width, int Height, bool
for (size_t i = 0; i < Attr.size(); i++)
{
if (!WriteConsoleOutputCharacter(hConsole, Str[i].data(), ReadBufferSize, coordScreen, &cCharsWritten))
- SLog += StringFromFormat("WriteConsoleOutputCharacter error");
+ SLog += Common::StringFromFormat("WriteConsoleOutputCharacter error");
if (!WriteConsoleOutputAttribute(hConsole, Attr[i].data(), ReadBufferSize, coordScreen, &cAttrWritten))
- SLog += StringFromFormat("WriteConsoleOutputAttribute error");
+ SLog += Common::StringFromFormat("WriteConsoleOutputAttribute error");
BytesWritten += cAttrWritten;
coordScreen = GetCoordinates(BytesWritten, LBufWidth);
diff --git a/src/common/extended_trace.cpp b/src/common/extended_trace.cpp
index 66dae4935..9cd0398ed 100644
--- a/src/common/extended_trace.cpp
+++ b/src/common/extended_trace.cpp
@@ -278,7 +278,7 @@ void PrintFunctionAndSourceInfo(FILE* file, const STACKFRAME& callstack)
GetFunctionInfoFromAddresses((ULONG)callstack.AddrPC.Offset, (ULONG)callstack.AddrFrame.Offset, symInfo);
GetSourceInfoFromAddress((ULONG)callstack.AddrPC.Offset, srcInfo);
- etfprint(file, " " + TStrToUTF8(srcInfo) + " : " + TStrToUTF8(symInfo) + "\n");
+ etfprint(file, " " + Common::TStrToUTF8(srcInfo) + " : " + Common::TStrToUTF8(symInfo) + "\n");
}
void StackTrace( HANDLE hThread, const char* lpszMessage, FILE *file )
diff --git a/src/common/file_search.cpp b/src/common/file_search.cpp
index cd50ace75..63580f688 100644
--- a/src/common/file_search.cpp
+++ b/src/common/file_search.cpp
@@ -33,10 +33,10 @@ CFileSearch::CFileSearch(const CFileSearch::XStringVector& _rSearchStrings, cons
void CFileSearch::FindFiles(const std::string& _searchString, const std::string& _strPath)
{
std::string GCMSearchPath;
- BuildCompleteFilename(GCMSearchPath, _strPath, _searchString);
+ Common::BuildCompleteFilename(GCMSearchPath, _strPath, _searchString);
#ifdef _WIN32
WIN32_FIND_DATA findData;
- HANDLE FindFirst = FindFirstFile(UTF8ToTStr(GCMSearchPath).c_str(), &findData);
+ HANDLE FindFirst = FindFirstFile(Common::UTF8ToTStr(GCMSearchPath).c_str(), &findData);
if (FindFirst != INVALID_HANDLE_VALUE)
{
@@ -47,7 +47,7 @@ void CFileSearch::FindFiles(const std::string& _searchString, const std::string&
if (findData.cFileName[0] != '.')
{
std::string strFilename;
- BuildCompleteFilename(strFilename, _strPath, TStrToUTF8(findData.cFileName));
+ Common::BuildCompleteFilename(strFilename, _strPath, Common::TStrToUTF8(findData.cFileName));
m_FileNames.push_back(strFilename);
}
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp
index 04d222ca1..970041007 100644
--- a/src/common/file_util.cpp
+++ b/src/common/file_util.cpp
@@ -64,7 +64,7 @@ bool Exists(const std::string &filename)
StripTailDirSlashes(copy);
#ifdef _WIN32
- int result = _tstat64(UTF8ToTStr(copy).c_str(), &file_info);
+ int result = _tstat64(Common::UTF8ToTStr(copy).c_str(), &file_info);
#else
int result = stat64(copy.c_str(), &file_info);
#endif
@@ -81,7 +81,7 @@ bool IsDirectory(const std::string &filename)
StripTailDirSlashes(copy);
#ifdef _WIN32
- int result = _tstat64(UTF8ToTStr(copy).c_str(), &file_info);
+ int result = _tstat64(Common::UTF8ToTStr(copy).c_str(), &file_info);
#else
int result = stat64(copy.c_str(), &file_info);
#endif
@@ -117,7 +117,7 @@ bool Delete(const std::string &filename)
}
#ifdef _WIN32
- if (!DeleteFile(UTF8ToTStr(filename).c_str()))
+ if (!DeleteFile(Common::UTF8ToTStr(filename).c_str()))
{
WARN_LOG(COMMON, "Delete: DeleteFile failed on %s: %s",
filename.c_str(), GetLastErrorMsg());
@@ -139,7 +139,7 @@ bool CreateDir(const std::string &path)
{
INFO_LOG(COMMON, "CreateDir: directory %s", path.c_str());
#ifdef _WIN32
- if (::CreateDirectory(UTF8ToTStr(path).c_str(), NULL))
+ if (::CreateDirectory(Common::UTF8ToTStr(path).c_str(), NULL))
return true;
DWORD error = GetLastError();
if (error == ERROR_ALREADY_EXISTS)
@@ -218,7 +218,7 @@ bool DeleteDir(const std::string &filename)
}
#ifdef _WIN32
- if (::RemoveDirectory(UTF8ToTStr(filename).c_str()))
+ if (::RemoveDirectory(Common::UTF8ToTStr(filename).c_str()))
return true;
#else
if (rmdir(filename.c_str()) == 0)
@@ -247,7 +247,7 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename)
INFO_LOG(COMMON, "Copy: %s --> %s",
srcFilename.c_str(), destFilename.c_str());
#ifdef _WIN32
- if (CopyFile(UTF8ToTStr(srcFilename).c_str(), UTF8ToTStr(destFilename).c_str(), FALSE))
+ if (CopyFile(Common::UTF8ToTStr(srcFilename).c_str(), Common::UTF8ToTStr(destFilename).c_str(), FALSE))
return true;
ERROR_LOG(COMMON, "Copy: failed %s --> %s: %s",
@@ -335,7 +335,7 @@ u64 GetSize(const std::string &filename)
struct stat64 buf;
#ifdef _WIN32
- if (_tstat64(UTF8ToTStr(filename).c_str(), &buf) == 0)
+ if (_tstat64(Common::UTF8ToTStr(filename).c_str(), &buf) == 0)
#else
if (stat64(filename.c_str(), &buf) == 0)
#endif
@@ -408,7 +408,7 @@ u32 ScanDirectoryTree(const std::string &directory, FSTEntry& parentEntry)
// Find the first file in the directory.
WIN32_FIND_DATA ffd;
- HANDLE hFind = FindFirstFile(UTF8ToTStr(directory + "\\*").c_str(), &ffd);
+ HANDLE hFind = FindFirstFile(Common::UTF8ToTStr(directory + "\\*").c_str(), &ffd);
if (hFind == INVALID_HANDLE_VALUE)
{
FindClose(hFind);
@@ -418,7 +418,7 @@ u32 ScanDirectoryTree(const std::string &directory, FSTEntry& parentEntry)
do
{
FSTEntry entry;
- const std::string virtualName(TStrToUTF8(ffd.cFileName));
+ const std::string virtualName(Common::TStrToUTF8(ffd.cFileName));
#else
struct dirent dirent, *result = NULL;
@@ -475,7 +475,7 @@ bool DeleteDirRecursively(const std::string &directory)
#ifdef _WIN32
// Find the first file in the directory.
WIN32_FIND_DATA ffd;
- HANDLE hFind = FindFirstFile(UTF8ToTStr(directory + "\\*").c_str(), &ffd);
+ HANDLE hFind = FindFirstFile(Common::UTF8ToTStr(directory + "\\*").c_str(), &ffd);
if (hFind == INVALID_HANDLE_VALUE)
{
@@ -486,7 +486,7 @@ bool DeleteDirRecursively(const std::string &directory)
// windows loop
do
{
- const std::string virtualName(TStrToUTF8(ffd.cFileName));
+ const std::string virtualName(Common::TStrToUTF8(ffd.cFileName));
#else
struct dirent dirent, *result = NULL;
DIR *dirp = opendir(directory.c_str());
@@ -624,7 +624,7 @@ std::string& GetExeDirectory()
{
TCHAR Dolphin_exe_Path[2048];
GetModuleFileName(NULL, Dolphin_exe_Path, 2048);
- DolphinPath = TStrToUTF8(Dolphin_exe_Path);
+ DolphinPath = Common::TStrToUTF8(Dolphin_exe_Path);
DolphinPath = DolphinPath.substr(0, DolphinPath.find_last_of('\\'));
}
return DolphinPath;
@@ -819,7 +819,7 @@ bool IOFile::Open(const std::string& filename, const char openmode[])
{
Close();
#ifdef _WIN32
- _tfopen_s(&m_file, UTF8ToTStr(filename).c_str(), UTF8ToTStr(openmode).c_str());
+ _tfopen_s(&m_file, Common::UTF8ToTStr(filename).c_str(), Common::UTF8ToTStr(openmode).c_str());
#else
m_file = fopen(filename.c_str(), openmode);
#endif
diff --git a/src/common/file_util.h b/src/common/file_util.h
index 0871734d4..fdae5c9c8 100644
--- a/src/common/file_util.h
+++ b/src/common/file_util.h
@@ -213,7 +213,7 @@ template <typename T>
void OpenFStream(T& fstream, const std::string& filename, std::ios_base::openmode openmode)
{
#ifdef _WIN32
- fstream.open(UTF8ToTStr(filename).c_str(), openmode);
+ fstream.open(Common::UTF8ToTStr(filename).c_str(), openmode);
#else
fstream.open(filename.c_str(), openmode);
#endif
diff --git a/src/common/log_manager.cpp b/src/common/log_manager.cpp
index c2b5d0e2c..43346f279 100644
--- a/src/common/log_manager.cpp
+++ b/src/common/log_manager.cpp
@@ -120,7 +120,7 @@ void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const
if (!log->IsEnabled() || level > log->GetLevel() || ! log->HasListeners())
return;
- CharArrayFromFormatV(temp, MAX_MSGLEN, fmt, args);
+ Common::CharArrayFromFormatV(temp, MAX_MSGLEN, fmt, args);
static const char level_to_char[7] = "ONEWID";
sprintf(msg, "%s %s:%u %c[%s] %s: %s\n", Common::Timer::GetTimeFormatted().c_str(), file, line,
diff --git a/src/common/mem_arena.cpp b/src/common/mem_arena.cpp
index a456beb28..40d9c03a2 100644
--- a/src/common/mem_arena.cpp
+++ b/src/common/mem_arena.cpp
@@ -139,7 +139,7 @@ void MemArena::GrabLowMemSpace(size_t size)
// a bit more.
for (int i = 0; i < 10000; i++)
{
- std::string file_name = StringFromFormat("/citramem.%d", i);
+ std::string file_name = Common::StringFromFormat("/citramem.%d", i);
fd = shm_open(file_name.c_str(), O_RDWR | O_CREAT | O_EXCL, 0600);
if (fd != -1)
{
diff --git a/src/common/memory_util.cpp b/src/common/memory_util.cpp
index 45bf5a496..bab7d9f7a 100644
--- a/src/common/memory_util.cpp
+++ b/src/common/memory_util.cpp
@@ -187,7 +187,7 @@ std::string MemUsage()
if (NULL == hProcess) return "MemUsage Error";
if (GetProcessMemoryInfo(hProcess, &pmc, sizeof(pmc)))
- Ret = StringFromFormat("%s K", ThousandSeparate(pmc.WorkingSetSize / 1024, 7).c_str());
+ Ret = Common::StringFromFormat("%s K", Common::ThousandSeparate(pmc.WorkingSetSize / 1024, 7).c_str());
CloseHandle(hProcess);
return Ret;
diff --git a/src/common/msg_handler.cpp b/src/common/msg_handler.cpp
index 3e02ec4d7..b3556aaa8 100644
--- a/src/common/msg_handler.cpp
+++ b/src/common/msg_handler.cpp
@@ -72,7 +72,7 @@ bool MsgAlert(bool yes_no, int Style, const char* format, ...)
va_list args;
va_start(args, format);
- CharArrayFromFormatV(buffer, sizeof(buffer)-1, str_translator(format).c_str(), args);
+ Common::CharArrayFromFormatV(buffer, sizeof(buffer)-1, str_translator(format).c_str(), args);
va_end(args);
ERROR_LOG(MASTER_LOG, "%s: %s", caption.c_str(), buffer);
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp
index b0c65d47d..9199e30bc 100644
--- a/src/common/string_util.cpp
+++ b/src/common/string_util.cpp
@@ -13,20 +13,18 @@
#include <iconv.h>
#endif
+namespace Common {
+
/// Make a string lowercase
-void LowerStr(char* str) {
- for (int i = 0; str[i]; i++) {
- str[i] = tolower(str[ i ]);
- }
+std::string ToLower(std::string str) {
+ std::transform(str.begin(), str.end(), str.begin(), ::tolower);
+ return str;
}
/// Make a string uppercase
-void UpperStr(char* str) {
- for (int i=0; i < strlen(str); i++) {
- if(str[i] >= 'a' && str[i] <= 'z') {
- str[i] &= 0xDF;
- }
- }
+std::string ToUpper(std::string str) {
+ std::transform(str.begin(), str.end(), str.begin(), ::toupper);
+ return str;
}
// faster than sscanf
@@ -546,3 +544,5 @@ std::string UTF16ToUTF8(const std::wstring& input)
}
#endif
+
+}
diff --git a/src/common/string_util.h b/src/common/string_util.h
index ba4cd363e..16ce39bc1 100644
--- a/src/common/string_util.h
+++ b/src/common/string_util.h
@@ -12,11 +12,13 @@
#include "common/common.h"
+namespace Common {
+
/// Make a string lowercase
-void LowerStr(char* str);
+std::string ToLower(std::string str);
/// Make a string uppercase
-void UpperStr(char* str);
+std::string ToUpper(std::string str);
std::string StringFromFormat(const char* format, ...);
// Cheap!
@@ -111,3 +113,5 @@ inline std::string UTF8ToTStr(const std::string& str)
#endif
#endif
+
+}
diff --git a/src/core/arm/disassembler/arm_disasm.cpp b/src/core/arm/disassembler/arm_disasm.cpp
index 33e036cbf..45c720e16 100644
--- a/src/core/arm/disassembler/arm_disasm.cpp
+++ b/src/core/arm/disassembler/arm_disasm.cpp
@@ -260,14 +260,14 @@ std::string ARM_Disasm::DisassembleALU(Opcode opcode, uint32_t insn)
// The "mov" instruction ignores the first operand (rn).
rn_str[0] = 0;
if ((flags & kNoOperand1) == 0) {
- rn_str = StringFromFormat("r%d, ", rn);
+ rn_str = Common::StringFromFormat("r%d, ", rn);
}
// The following instructions do not write the result register (rd):
// tst, teq, cmp, cmn.
rd_str[0] = 0;
if ((flags & kNoDest) == 0) {
- rd_str = StringFromFormat("r%d, ", rd);
+ rd_str = Common::StringFromFormat("r%d, ", rd);
}
const char *sbit_str = "";
@@ -275,7 +275,7 @@ std::string ARM_Disasm::DisassembleALU(Opcode opcode, uint32_t insn)
sbit_str = "s";
if (is_immed) {
- return StringFromFormat("%s%s%s\t%s%s#%u ; 0x%x",
+ return Common::StringFromFormat("%s%s%s\t%s%s#%u ; 0x%x",
opname, cond_to_str(cond), sbit_str, rd_str.c_str(), rn_str.c_str(), immed, immed);
}
@@ -290,24 +290,24 @@ std::string ARM_Disasm::DisassembleALU(Opcode opcode, uint32_t insn)
rotated_val = (rotated_val >> rotate2) | (rotated_val << (32 - rotate2));
if (!shift_is_reg && shift_type == 0 && shift_amount == 0) {
- return StringFromFormat("%s%s%s\t%s%sr%d",
+ return Common::StringFromFormat("%s%s%s\t%s%sr%d",
opname, cond_to_str(cond), sbit_str, rd_str.c_str(), rn_str.c_str(), rm);
}
const char *shift_name = shift_names[shift_type];
if (shift_is_reg) {
- return StringFromFormat("%s%s%s\t%s%sr%d, %s r%d",
+ return Common::StringFromFormat("%s%s%s\t%s%sr%d, %s r%d",
opname, cond_to_str(cond), sbit_str, rd_str.c_str(), rn_str.c_str(), rm,
shift_name, rs);
}
if (shift_amount == 0) {
if (shift_type == 3) {
- return StringFromFormat("%s%s%s\t%s%sr%d, RRX",
+ return Common::StringFromFormat("%s%s%s\t%s%sr%d, RRX",
opname, cond_to_str(cond), sbit_str, rd_str.c_str(), rn_str.c_str(), rm);
}
shift_amount = 32;
}
- return StringFromFormat("%s%s%s\t%s%sr%d, %s #%u",
+ return Common::StringFromFormat("%s%s%s\t%s%sr%d, %s #%u",
opname, cond_to_str(cond), sbit_str, rd_str.c_str(), rn_str.c_str(), rm,
shift_name, shift_amount);
}
@@ -325,20 +325,20 @@ std::string ARM_Disasm::DisassembleBranch(uint32_t addr, Opcode opcode, uint32_t
offset += 8;
addr += offset;
const char *opname = opcode_names[opcode];
- return StringFromFormat("%s%s\t0x%x", opname, cond_to_str(cond), addr);
+ return Common::StringFromFormat("%s%s\t0x%x", opname, cond_to_str(cond), addr);
}
std::string ARM_Disasm::DisassembleBX(uint32_t insn)
{
uint8_t cond = (insn >> 28) & 0xf;
uint8_t rn = insn & 0xf;
- return StringFromFormat("bx%s\tr%d", cond_to_str(cond), rn);
+ return Common::StringFromFormat("bx%s\tr%d", cond_to_str(cond), rn);
}
std::string ARM_Disasm::DisassembleBKPT(uint32_t insn)
{
uint32_t immed = (((insn >> 8) & 0xfff) << 4) | (insn & 0xf);
- return StringFromFormat("bkpt\t#%d", immed);
+ return Common::StringFromFormat("bkpt\t#%d", immed);
}
std::string ARM_Disasm::DisassembleCLZ(uint32_t insn)
@@ -346,7 +346,7 @@ std::string ARM_Disasm::DisassembleCLZ(uint32_t insn)
uint8_t cond = (insn >> 28) & 0xf;
uint8_t rd = (insn >> 12) & 0xf;
uint8_t rm = insn & 0xf;
- return StringFromFormat("clz%s\tr%d, r%d", cond_to_str(cond), rd, rm);
+ return Common::StringFromFormat("clz%s\tr%d, r%d", cond_to_str(cond), rd, rm);
}
std::string ARM_Disasm::DisassembleMemblock(Opcode opcode, uint32_t insn)
@@ -376,7 +376,7 @@ std::string ARM_Disasm::DisassembleMemblock(Opcode opcode, uint32_t insn)
tmp_list[0] = 0;
for (int ii = 0; ii < 16; ++ii) {
if (reg_list & (1 << ii)) {
- tmp_list += StringFromFormat("%sr%d", comma, ii);
+ tmp_list += Common::StringFromFormat("%sr%d", comma, ii);
comma = ",";
}
}
@@ -396,7 +396,7 @@ std::string ARM_Disasm::DisassembleMemblock(Opcode opcode, uint32_t insn)
}
}
- return StringFromFormat("%s%s%s\tr%d%s, {%s}%s",
+ return Common::StringFromFormat("%s%s%s\tr%d%s, {%s}%s",
opname, cond_to_str(cond), addr_mode, rn, bang, tmp_list.c_str(), carret);
}
@@ -432,10 +432,10 @@ std::string ARM_Disasm::DisassembleMem(uint32_t insn)
if (is_reg == 0) {
if (is_pre) {
if (offset == 0) {
- return StringFromFormat("%s%s%s\tr%d, [r%d]",
+ return Common::StringFromFormat("%s%s%s\tr%d, [r%d]",
opname, cond_to_str(cond), byte, rd, rn);
} else {
- return StringFromFormat("%s%s%s\tr%d, [r%d, #%s%u]%s",
+ return Common::StringFromFormat("%s%s%s\tr%d, [r%d, #%s%u]%s",
opname, cond_to_str(cond), byte, rd, rn, minus, offset, bang);
}
} else {
@@ -443,7 +443,7 @@ std::string ARM_Disasm::DisassembleMem(uint32_t insn)
if (write_back)
transfer = "t";
- return StringFromFormat("%s%s%s%s\tr%d, [r%d], #%s%u",
+ return Common::StringFromFormat("%s%s%s%s\tr%d, [r%d], #%s%u",
opname, cond_to_str(cond), byte, transfer, rd, rn, minus, offset);
}
}
@@ -457,16 +457,16 @@ std::string ARM_Disasm::DisassembleMem(uint32_t insn)
if (is_pre) {
if (shift_amount == 0) {
if (shift_type == 0) {
- return StringFromFormat("%s%s%s\tr%d, [r%d, %sr%d]%s",
+ return Common::StringFromFormat("%s%s%s\tr%d, [r%d, %sr%d]%s",
opname, cond_to_str(cond), byte, rd, rn, minus, rm, bang);
}
if (shift_type == 3) {
- return StringFromFormat("%s%s%s\tr%d, [r%d, %sr%d, RRX]%s",
+ return Common::StringFromFormat("%s%s%s\tr%d, [r%d, %sr%d, RRX]%s",
opname, cond_to_str(cond), byte, rd, rn, minus, rm, bang);
}
shift_amount = 32;
}
- return StringFromFormat("%s%s%s\tr%d, [r%d, %sr%d, %s #%u]%s",
+ return Common::StringFromFormat("%s%s%s\tr%d, [r%d, %sr%d, %s #%u]%s",
opname, cond_to_str(cond), byte, rd, rn, minus, rm,
shift_name, shift_amount, bang);
}
@@ -477,17 +477,17 @@ std::string ARM_Disasm::DisassembleMem(uint32_t insn)
if (shift_amount == 0) {
if (shift_type == 0) {
- return StringFromFormat("%s%s%s%s\tr%d, [r%d], %sr%d",
+ return Common::StringFromFormat("%s%s%s%s\tr%d, [r%d], %sr%d",
opname, cond_to_str(cond), byte, transfer, rd, rn, minus, rm);
}
if (shift_type == 3) {
- return StringFromFormat("%s%s%s%s\tr%d, [r%d], %sr%d, RRX",
+ return Common::StringFromFormat("%s%s%s%s\tr%d, [r%d], %sr%d, RRX",
opname, cond_to_str(cond), byte, transfer, rd, rn, minus, rm);
}
shift_amount = 32;
}
- return StringFromFormat("%s%s%s%s\tr%d, [r%d], %sr%d, %s #%u",
+ return Common::StringFromFormat("%s%s%s%s\tr%d, [r%d], %sr%d, %s #%u",
opname, cond_to_str(cond), byte, transfer, rd, rn, minus, rm,
shift_name, shift_amount);
}
@@ -528,22 +528,22 @@ std::string ARM_Disasm::DisassembleMemHalf(uint32_t insn)
if (is_immed) {
if (is_pre) {
if (offset == 0) {
- return StringFromFormat("%s%sh\tr%d, [r%d]", opname, cond_to_str(cond), rd, rn);
+ return Common::StringFromFormat("%s%sh\tr%d, [r%d]", opname, cond_to_str(cond), rd, rn);
} else {
- return StringFromFormat("%s%sh\tr%d, [r%d, #%s%u]%s",
+ return Common::StringFromFormat("%s%sh\tr%d, [r%d, #%s%u]%s",
opname, cond_to_str(cond), rd, rn, minus, offset, bang);
}
} else {
- return StringFromFormat("%s%sh\tr%d, [r%d], #%s%u",
+ return Common::StringFromFormat("%s%sh\tr%d, [r%d], #%s%u",
opname, cond_to_str(cond), rd, rn, minus, offset);
}
}
if (is_pre) {
- return StringFromFormat("%s%sh\tr%d, [r%d, %sr%d]%s",
+ return Common::StringFromFormat("%s%sh\tr%d, [r%d, %sr%d]%s",
opname, cond_to_str(cond), rd, rn, minus, rm, bang);
} else {
- return StringFromFormat("%s%sh\tr%d, [r%d], %sr%d",
+ return Common::StringFromFormat("%s%sh\tr%d, [r%d], %sr%d",
opname, cond_to_str(cond), rd, rn, minus, rm);
}
}
@@ -558,7 +558,7 @@ std::string ARM_Disasm::DisassembleMCR(Opcode opcode, uint32_t insn)
uint8_t crm = insn & 0xf;
const char *opname = opcode_names[opcode];
- return StringFromFormat("%s%s\t%d, 0, r%d, cr%d, cr%d, {%d}",
+ return Common::StringFromFormat("%s%s\t%d, 0, r%d, cr%d, cr%d, {%d}",
opname, cond_to_str(cond), cpnum, crd, crn, crm, opcode2);
}
@@ -572,7 +572,7 @@ std::string ARM_Disasm::DisassembleMLA(Opcode opcode, uint32_t insn)
uint8_t bit_s = (insn >> 20) & 1;
const char *opname = opcode_names[opcode];
- return StringFromFormat("%s%s%s\tr%d, r%d, r%d, r%d",
+ return Common::StringFromFormat("%s%s%s\tr%d, r%d, r%d, r%d",
opname, cond_to_str(cond), bit_s ? "s" : "", rd, rm, rs, rn);
}
@@ -586,7 +586,7 @@ std::string ARM_Disasm::DisassembleUMLAL(Opcode opcode, uint32_t insn)
uint8_t bit_s = (insn >> 20) & 1;
const char *opname = opcode_names[opcode];
- return StringFromFormat("%s%s%s\tr%d, r%d, r%d, r%d",
+ return Common::StringFromFormat("%s%s%s\tr%d, r%d, r%d, r%d",
opname, cond_to_str(cond), bit_s ? "s" : "", rdlo, rdhi, rm, rs);
}
@@ -599,7 +599,7 @@ std::string ARM_Disasm::DisassembleMUL(Opcode opcode, uint32_t insn)
uint8_t bit_s = (insn >> 20) & 1;
const char *opname = opcode_names[opcode];
- return StringFromFormat("%s%s%s\tr%d, r%d, r%d",
+ return Common::StringFromFormat("%s%s%s\tr%d, r%d, r%d",
opname, cond_to_str(cond), bit_s ? "s" : "", rd, rm, rs);
}
@@ -609,7 +609,7 @@ std::string ARM_Disasm::DisassembleMRS(uint32_t insn)
uint8_t rd = (insn >> 12) & 0xf;
uint8_t ps = (insn >> 22) & 1;
- return StringFromFormat("mrs%s\tr%d, %s", cond_to_str(cond), rd, ps ? "spsr" : "cpsr");
+ return Common::StringFromFormat("mrs%s\tr%d, %s", cond_to_str(cond), rd, ps ? "spsr" : "cpsr");
}
std::string ARM_Disasm::DisassembleMSR(uint32_t insn)
@@ -636,13 +636,13 @@ std::string ARM_Disasm::DisassembleMSR(uint32_t insn)
uint8_t rotate = (insn >> 8) & 0xf;
uint8_t rotate2 = rotate << 1;
uint32_t rotated_val = (immed >> rotate2) | (immed << (32 - rotate2));
- return StringFromFormat("msr%s\t%s_%s, #0x%x",
+ return Common::StringFromFormat("msr%s\t%s_%s, #0x%x",
cond_to_str(cond), pd ? "spsr" : "cpsr", flags, rotated_val);
}
uint8_t rm = insn & 0xf;
- return StringFromFormat("msr%s\t%s_%s, r%d",
+ return Common::StringFromFormat("msr%s\t%s_%s, r%d",
cond_to_str(cond), pd ? "spsr" : "cpsr", flags, rm);
}
@@ -658,14 +658,14 @@ std::string ARM_Disasm::DisassemblePLD(uint32_t insn)
if (is_reg) {
uint8_t rm = insn & 0xf;
- return StringFromFormat("pld\t[r%d, %sr%d]", rn, minus, rm);
+ return Common::StringFromFormat("pld\t[r%d, %sr%d]", rn, minus, rm);
}
uint16_t offset = insn & 0xfff;
if (offset == 0) {
- return StringFromFormat("pld\t[r%d]", rn);
+ return Common::StringFromFormat("pld\t[r%d]", rn);
} else {
- return StringFromFormat("pld\t[r%d, #%s%u]", rn, minus, offset);
+ return Common::StringFromFormat("pld\t[r%d, #%s%u]", rn, minus, offset);
}
}
@@ -674,7 +674,7 @@ std::string ARM_Disasm::DisassembleSWI(uint32_t insn)
uint8_t cond = (insn >> 28) & 0xf;
uint32_t sysnum = insn & 0x00ffffff;
- return StringFromFormat("swi%s 0x%x", cond_to_str(cond), sysnum);
+ return Common::StringFromFormat("swi%s 0x%x", cond_to_str(cond), sysnum);
}
std::string ARM_Disasm::DisassembleSWP(Opcode opcode, uint32_t insn)
@@ -685,7 +685,7 @@ std::string ARM_Disasm::DisassembleSWP(Opcode opcode, uint32_t insn)
uint8_t rm = insn & 0xf;
const char *opname = opcode_names[opcode];
- return StringFromFormat("%s%s\tr%d, r%d, [r%d]", opname, cond_to_str(cond), rd, rm, rn);
+ return Common::StringFromFormat("%s%s\tr%d, r%d, [r%d]", opname, cond_to_str(cond), rd, rm, rn);
}
Opcode ARM_Disasm::Decode(uint32_t insn) {
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp
index 07a750b89..490e05cde 100644
--- a/src/core/hle/svc.cpp
+++ b/src/core/hle/svc.cpp
@@ -218,7 +218,7 @@ Result CreateThread(u32 priority, u32 entry_point, u32 arg, u32 stack_top, u32 p
TSymbol symbol = Symbols::GetSymbol(entry_point);
name = symbol.name;
} else {
- name = StringFromFormat("unknown-%08x", entry_point);
+ name = Common::StringFromFormat("unknown-%08x", entry_point);
}
Handle thread = Kernel::CreateThread(name.c_str(), entry_point, priority, arg, processor_id,
diff --git a/src/core/loader/loader.cpp b/src/core/loader/loader.cpp
index 5cbb26f54..577a2297a 100644
--- a/src/core/loader/loader.cpp
+++ b/src/core/loader/loader.cpp
@@ -25,22 +25,23 @@ FileType IdentifyFile(const std::string &filename) {
ERROR_LOG(LOADER, "invalid filename %s", filename.c_str());
return FileType::Error;
}
- std::string extension = filename.size() >= 5 ? filename.substr(filename.size() - 4) : "";
- if (!strcasecmp(extension.c_str(), ".elf")) {
- return FileType::ELF; // TODO(bunnei): Do some filetype checking :p
- }
- else if (!strcasecmp(extension.c_str(), ".axf")) {
- return FileType::ELF; // TODO(bunnei): Do some filetype checking :p
- }
- else if (!strcasecmp(extension.c_str(), ".cxi")) {
- return FileType::CXI; // TODO(bunnei): Do some filetype checking :p
- }
- else if (!strcasecmp(extension.c_str(), ".cci")) {
- return FileType::CCI; // TODO(bunnei): Do some filetype checking :p
- }
- else if (!strcasecmp(extension.c_str(), ".bin")) {
- return FileType::BIN; // TODO(bunnei): Do some filetype checking :p
+ size_t extension_loc = filename.find_last_of('.');
+ if (extension_loc == std::string::npos)
+ return FileType::Unknown;
+ std::string extension = Common::ToLower(filename.substr(extension_loc));
+
+ // TODO(bunnei): Do actual filetype checking instead of naively checking the extension
+ if (extension == ".elf") {
+ return FileType::ELF;
+ } else if (extension == ".axf") {
+ return FileType::ELF;
+ } else if (extension == ".cxi") {
+ return FileType::CXI;
+ } else if (extension == ".cci") {
+ return FileType::CCI;
+ } else if (extension == ".bin") {
+ return FileType::BIN;
}
return FileType::Unknown;
}
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp
index 0e4e06517..ad3ce3ba1 100644
--- a/src/video_core/renderer_opengl/renderer_opengl.cpp
+++ b/src/video_core/renderer_opengl/renderer_opengl.cpp
@@ -77,7 +77,7 @@ void RendererOpenGL::SwapBuffers() {
//
// TODO(princesspeachum): (related to above^) this should only be called when there's new data, not every frame.
// Currently this uploads data that shouldn't have changed.
- common::Rect framebuffer_size(0, 0, resolution_width, resolution_height);
+ Common::Rect framebuffer_size(0, 0, resolution_width, resolution_height);
RenderXFB(framebuffer_size, framebuffer_size);
// XFB->Window copy
@@ -113,7 +113,7 @@ void RendererOpenGL::FlipFramebuffer(const u8* raw_data, ScreenInfo& screen_info
* @param src_rect Source rectangle in XFB to copy
* @param dst_rect Destination rectangle in output framebuffer to copy to
*/
-void RendererOpenGL::RenderXFB(const common::Rect& src_rect, const common::Rect& dst_rect) {
+void RendererOpenGL::RenderXFB(const Common::Rect& src_rect, const Common::Rect& dst_rect) {
const auto& framebuffer_top = GPU::g_regs.framebuffer_config[0];
const auto& framebuffer_sub = GPU::g_regs.framebuffer_config[1];
const u32 active_fb_top = (framebuffer_top.active_fb == 1)
diff --git a/src/video_core/renderer_opengl/renderer_opengl.h b/src/video_core/renderer_opengl/renderer_opengl.h
index eac91df51..0d25b2a52 100644
--- a/src/video_core/renderer_opengl/renderer_opengl.h
+++ b/src/video_core/renderer_opengl/renderer_opengl.h
@@ -27,7 +27,7 @@ public:
* @param src_rect Source rectangle in XFB to copy
* @param dst_rect Destination rectangle in output framebuffer to copy to
*/
- void RenderXFB(const common::Rect& src_rect, const common::Rect& dst_rect);
+ void RenderXFB(const Common::Rect& src_rect, const Common::Rect& dst_rect);
/**
* Set the emulator window to use for renderer