diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/common/console_listener.cpp | 10 | ||||
| -rw-r--r-- | src/common/extended_trace.cpp | 2 | ||||
| -rw-r--r-- | src/common/file_search.cpp | 6 | ||||
| -rw-r--r-- | src/common/file_util.cpp | 26 | ||||
| -rw-r--r-- | src/common/file_util.h | 2 | ||||
| -rw-r--r-- | src/common/log_manager.cpp | 2 | ||||
| -rw-r--r-- | src/common/mem_arena.cpp | 2 | ||||
| -rw-r--r-- | src/common/memory_util.cpp | 2 | ||||
| -rw-r--r-- | src/common/msg_handler.cpp | 2 | ||||
| -rw-r--r-- | src/common/string_util.cpp | 8 | ||||
| -rw-r--r-- | src/common/string_util.h | 9 | ||||
| -rw-r--r-- | src/core/arm/disassembler/arm_disasm.cpp | 78 | ||||
| -rw-r--r-- | src/core/hle/svc.cpp | 2 | ||||
| -rw-r--r-- | src/core/loader/loader.cpp | 31 |
14 files changed, 94 insertions, 88 deletions
diff --git a/src/common/console_listener.cpp b/src/common/console_listener.cpp index 27697ef1f..96970ab17 100644 --- a/src/common/console_listener.cpp +++ b/src/common/console_listener.cpp | |||
| @@ -47,7 +47,7 @@ void ConsoleListener::Open(bool Hidden, int Width, int Height, const char *Title | |||
| 47 | // Save the window handle that AllocConsole() created | 47 | // Save the window handle that AllocConsole() created |
| 48 | hConsole = GetStdHandle(STD_OUTPUT_HANDLE); | 48 | hConsole = GetStdHandle(STD_OUTPUT_HANDLE); |
| 49 | // Set the console window title | 49 | // Set the console window title |
| 50 | SetConsoleTitle(UTF8ToTStr(Title).c_str()); | 50 | SetConsoleTitle(Common::UTF8ToTStr(Title).c_str()); |
| 51 | // Set letter space | 51 | // Set letter space |
| 52 | LetterSpace(80, 4000); | 52 | LetterSpace(80, 4000); |
| 53 | //MoveWindow(GetConsoleWindow(), 200,200, 800,800, true); | 53 | //MoveWindow(GetConsoleWindow(), 200,200, 800,800, true); |
| @@ -193,11 +193,11 @@ void ConsoleListener::PixelSpace(int Left, int Top, int Width, int Height, bool | |||
| 193 | { | 193 | { |
| 194 | Str.resize(Str.size() + 1); | 194 | Str.resize(Str.size() + 1); |
| 195 | if (!ReadConsoleOutputCharacter(hConsole, Str.back().data(), ReadBufferSize, coordScreen, &cCharsRead)) | 195 | if (!ReadConsoleOutputCharacter(hConsole, Str.back().data(), ReadBufferSize, coordScreen, &cCharsRead)) |
| 196 | SLog += StringFromFormat("WriteConsoleOutputCharacter error"); | 196 | SLog += Common::StringFromFormat("WriteConsoleOutputCharacter error"); |
| 197 | 197 | ||
| 198 | Attr.resize(Attr.size() + 1); | 198 | Attr.resize(Attr.size() + 1); |
| 199 | if (!ReadConsoleOutputAttribute(hConsole, Attr.back().data(), ReadBufferSize, coordScreen, &cAttrRead)) | 199 | if (!ReadConsoleOutputAttribute(hConsole, Attr.back().data(), ReadBufferSize, coordScreen, &cAttrRead)) |
| 200 | SLog += StringFromFormat("WriteConsoleOutputAttribute error"); | 200 | SLog += Common::StringFromFormat("WriteConsoleOutputAttribute error"); |
| 201 | 201 | ||
| 202 | // Break on error | 202 | // Break on error |
| 203 | if (cAttrRead == 0) break; | 203 | if (cAttrRead == 0) break; |
| @@ -223,9 +223,9 @@ void ConsoleListener::PixelSpace(int Left, int Top, int Width, int Height, bool | |||
| 223 | for (size_t i = 0; i < Attr.size(); i++) | 223 | for (size_t i = 0; i < Attr.size(); i++) |
| 224 | { | 224 | { |
| 225 | if (!WriteConsoleOutputCharacter(hConsole, Str[i].data(), ReadBufferSize, coordScreen, &cCharsWritten)) | 225 | if (!WriteConsoleOutputCharacter(hConsole, Str[i].data(), ReadBufferSize, coordScreen, &cCharsWritten)) |
| 226 | SLog += StringFromFormat("WriteConsoleOutputCharacter error"); | 226 | SLog += Common::StringFromFormat("WriteConsoleOutputCharacter error"); |
| 227 | if (!WriteConsoleOutputAttribute(hConsole, Attr[i].data(), ReadBufferSize, coordScreen, &cAttrWritten)) | 227 | if (!WriteConsoleOutputAttribute(hConsole, Attr[i].data(), ReadBufferSize, coordScreen, &cAttrWritten)) |
| 228 | SLog += StringFromFormat("WriteConsoleOutputAttribute error"); | 228 | SLog += Common::StringFromFormat("WriteConsoleOutputAttribute error"); |
| 229 | 229 | ||
| 230 | BytesWritten += cAttrWritten; | 230 | BytesWritten += cAttrWritten; |
| 231 | coordScreen = GetCoordinates(BytesWritten, LBufWidth); | 231 | 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) | |||
| 278 | 278 | ||
| 279 | GetFunctionInfoFromAddresses((ULONG)callstack.AddrPC.Offset, (ULONG)callstack.AddrFrame.Offset, symInfo); | 279 | GetFunctionInfoFromAddresses((ULONG)callstack.AddrPC.Offset, (ULONG)callstack.AddrFrame.Offset, symInfo); |
| 280 | GetSourceInfoFromAddress((ULONG)callstack.AddrPC.Offset, srcInfo); | 280 | GetSourceInfoFromAddress((ULONG)callstack.AddrPC.Offset, srcInfo); |
| 281 | etfprint(file, " " + TStrToUTF8(srcInfo) + " : " + TStrToUTF8(symInfo) + "\n"); | 281 | etfprint(file, " " + Common::TStrToUTF8(srcInfo) + " : " + Common::TStrToUTF8(symInfo) + "\n"); |
| 282 | } | 282 | } |
| 283 | 283 | ||
| 284 | void StackTrace( HANDLE hThread, const char* lpszMessage, FILE *file ) | 284 | void StackTrace( HANDLE hThread, const char* lpszMessage, FILE *file ) |
diff --git a/src/common/file_search.cpp b/src/common/file_search.cpp index a9d19477d..a80a98820 100644 --- a/src/common/file_search.cpp +++ b/src/common/file_search.cpp | |||
| @@ -35,10 +35,10 @@ CFileSearch::CFileSearch(const CFileSearch::XStringVector& _rSearchStrings, cons | |||
| 35 | void CFileSearch::FindFiles(const std::string& _searchString, const std::string& _strPath) | 35 | void CFileSearch::FindFiles(const std::string& _searchString, const std::string& _strPath) |
| 36 | { | 36 | { |
| 37 | std::string GCMSearchPath; | 37 | std::string GCMSearchPath; |
| 38 | BuildCompleteFilename(GCMSearchPath, _strPath, _searchString); | 38 | Common::BuildCompleteFilename(GCMSearchPath, _strPath, _searchString); |
| 39 | #ifdef _WIN32 | 39 | #ifdef _WIN32 |
| 40 | WIN32_FIND_DATA findData; | 40 | WIN32_FIND_DATA findData; |
| 41 | HANDLE FindFirst = FindFirstFile(UTF8ToTStr(GCMSearchPath).c_str(), &findData); | 41 | HANDLE FindFirst = FindFirstFile(Common::UTF8ToTStr(GCMSearchPath).c_str(), &findData); |
| 42 | 42 | ||
| 43 | if (FindFirst != INVALID_HANDLE_VALUE) | 43 | if (FindFirst != INVALID_HANDLE_VALUE) |
| 44 | { | 44 | { |
| @@ -49,7 +49,7 @@ void CFileSearch::FindFiles(const std::string& _searchString, const std::string& | |||
| 49 | if (findData.cFileName[0] != '.') | 49 | if (findData.cFileName[0] != '.') |
| 50 | { | 50 | { |
| 51 | std::string strFilename; | 51 | std::string strFilename; |
| 52 | BuildCompleteFilename(strFilename, _strPath, TStrToUTF8(findData.cFileName)); | 52 | Common::BuildCompleteFilename(strFilename, _strPath, Common::TStrToUTF8(findData.cFileName)); |
| 53 | m_FileNames.push_back(strFilename); | 53 | m_FileNames.push_back(strFilename); |
| 54 | } | 54 | } |
| 55 | 55 | ||
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index b6ff2e40b..2fdc7ec01 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp | |||
| @@ -71,7 +71,7 @@ bool Exists(const std::string &filename) | |||
| 71 | StripTailDirSlashes(copy); | 71 | StripTailDirSlashes(copy); |
| 72 | 72 | ||
| 73 | #ifdef _WIN32 | 73 | #ifdef _WIN32 |
| 74 | int result = _tstat64(UTF8ToTStr(copy).c_str(), &file_info); | 74 | int result = _tstat64(Common::UTF8ToTStr(copy).c_str(), &file_info); |
| 75 | #else | 75 | #else |
| 76 | int result = stat64(copy.c_str(), &file_info); | 76 | int result = stat64(copy.c_str(), &file_info); |
| 77 | #endif | 77 | #endif |
| @@ -88,7 +88,7 @@ bool IsDirectory(const std::string &filename) | |||
| 88 | StripTailDirSlashes(copy); | 88 | StripTailDirSlashes(copy); |
| 89 | 89 | ||
| 90 | #ifdef _WIN32 | 90 | #ifdef _WIN32 |
| 91 | int result = _tstat64(UTF8ToTStr(copy).c_str(), &file_info); | 91 | int result = _tstat64(Common::UTF8ToTStr(copy).c_str(), &file_info); |
| 92 | #else | 92 | #else |
| 93 | int result = stat64(copy.c_str(), &file_info); | 93 | int result = stat64(copy.c_str(), &file_info); |
| 94 | #endif | 94 | #endif |
| @@ -124,7 +124,7 @@ bool Delete(const std::string &filename) | |||
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | #ifdef _WIN32 | 126 | #ifdef _WIN32 |
| 127 | if (!DeleteFile(UTF8ToTStr(filename).c_str())) | 127 | if (!DeleteFile(Common::UTF8ToTStr(filename).c_str())) |
| 128 | { | 128 | { |
| 129 | WARN_LOG(COMMON, "Delete: DeleteFile failed on %s: %s", | 129 | WARN_LOG(COMMON, "Delete: DeleteFile failed on %s: %s", |
| 130 | filename.c_str(), GetLastErrorMsg()); | 130 | filename.c_str(), GetLastErrorMsg()); |
| @@ -146,7 +146,7 @@ bool CreateDir(const std::string &path) | |||
| 146 | { | 146 | { |
| 147 | INFO_LOG(COMMON, "CreateDir: directory %s", path.c_str()); | 147 | INFO_LOG(COMMON, "CreateDir: directory %s", path.c_str()); |
| 148 | #ifdef _WIN32 | 148 | #ifdef _WIN32 |
| 149 | if (::CreateDirectory(UTF8ToTStr(path).c_str(), NULL)) | 149 | if (::CreateDirectory(Common::UTF8ToTStr(path).c_str(), NULL)) |
| 150 | return true; | 150 | return true; |
| 151 | DWORD error = GetLastError(); | 151 | DWORD error = GetLastError(); |
| 152 | if (error == ERROR_ALREADY_EXISTS) | 152 | if (error == ERROR_ALREADY_EXISTS) |
| @@ -225,7 +225,7 @@ bool DeleteDir(const std::string &filename) | |||
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | #ifdef _WIN32 | 227 | #ifdef _WIN32 |
| 228 | if (::RemoveDirectory(UTF8ToTStr(filename).c_str())) | 228 | if (::RemoveDirectory(Common::UTF8ToTStr(filename).c_str())) |
| 229 | return true; | 229 | return true; |
| 230 | #else | 230 | #else |
| 231 | if (rmdir(filename.c_str()) == 0) | 231 | if (rmdir(filename.c_str()) == 0) |
| @@ -254,7 +254,7 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename) | |||
| 254 | INFO_LOG(COMMON, "Copy: %s --> %s", | 254 | INFO_LOG(COMMON, "Copy: %s --> %s", |
| 255 | srcFilename.c_str(), destFilename.c_str()); | 255 | srcFilename.c_str(), destFilename.c_str()); |
| 256 | #ifdef _WIN32 | 256 | #ifdef _WIN32 |
| 257 | if (CopyFile(UTF8ToTStr(srcFilename).c_str(), UTF8ToTStr(destFilename).c_str(), FALSE)) | 257 | if (CopyFile(Common::UTF8ToTStr(srcFilename).c_str(), Common::UTF8ToTStr(destFilename).c_str(), FALSE)) |
| 258 | return true; | 258 | return true; |
| 259 | 259 | ||
| 260 | ERROR_LOG(COMMON, "Copy: failed %s --> %s: %s", | 260 | ERROR_LOG(COMMON, "Copy: failed %s --> %s: %s", |
| @@ -342,7 +342,7 @@ u64 GetSize(const std::string &filename) | |||
| 342 | 342 | ||
| 343 | struct stat64 buf; | 343 | struct stat64 buf; |
| 344 | #ifdef _WIN32 | 344 | #ifdef _WIN32 |
| 345 | if (_tstat64(UTF8ToTStr(filename).c_str(), &buf) == 0) | 345 | if (_tstat64(Common::UTF8ToTStr(filename).c_str(), &buf) == 0) |
| 346 | #else | 346 | #else |
| 347 | if (stat64(filename.c_str(), &buf) == 0) | 347 | if (stat64(filename.c_str(), &buf) == 0) |
| 348 | #endif | 348 | #endif |
| @@ -415,7 +415,7 @@ u32 ScanDirectoryTree(const std::string &directory, FSTEntry& parentEntry) | |||
| 415 | // Find the first file in the directory. | 415 | // Find the first file in the directory. |
| 416 | WIN32_FIND_DATA ffd; | 416 | WIN32_FIND_DATA ffd; |
| 417 | 417 | ||
| 418 | HANDLE hFind = FindFirstFile(UTF8ToTStr(directory + "\\*").c_str(), &ffd); | 418 | HANDLE hFind = FindFirstFile(Common::UTF8ToTStr(directory + "\\*").c_str(), &ffd); |
| 419 | if (hFind == INVALID_HANDLE_VALUE) | 419 | if (hFind == INVALID_HANDLE_VALUE) |
| 420 | { | 420 | { |
| 421 | FindClose(hFind); | 421 | FindClose(hFind); |
| @@ -425,7 +425,7 @@ u32 ScanDirectoryTree(const std::string &directory, FSTEntry& parentEntry) | |||
| 425 | do | 425 | do |
| 426 | { | 426 | { |
| 427 | FSTEntry entry; | 427 | FSTEntry entry; |
| 428 | const std::string virtualName(TStrToUTF8(ffd.cFileName)); | 428 | const std::string virtualName(Common::TStrToUTF8(ffd.cFileName)); |
| 429 | #else | 429 | #else |
| 430 | struct dirent dirent, *result = NULL; | 430 | struct dirent dirent, *result = NULL; |
| 431 | 431 | ||
| @@ -482,7 +482,7 @@ bool DeleteDirRecursively(const std::string &directory) | |||
| 482 | #ifdef _WIN32 | 482 | #ifdef _WIN32 |
| 483 | // Find the first file in the directory. | 483 | // Find the first file in the directory. |
| 484 | WIN32_FIND_DATA ffd; | 484 | WIN32_FIND_DATA ffd; |
| 485 | HANDLE hFind = FindFirstFile(UTF8ToTStr(directory + "\\*").c_str(), &ffd); | 485 | HANDLE hFind = FindFirstFile(Common::UTF8ToTStr(directory + "\\*").c_str(), &ffd); |
| 486 | 486 | ||
| 487 | if (hFind == INVALID_HANDLE_VALUE) | 487 | if (hFind == INVALID_HANDLE_VALUE) |
| 488 | { | 488 | { |
| @@ -493,7 +493,7 @@ bool DeleteDirRecursively(const std::string &directory) | |||
| 493 | // windows loop | 493 | // windows loop |
| 494 | do | 494 | do |
| 495 | { | 495 | { |
| 496 | const std::string virtualName(TStrToUTF8(ffd.cFileName)); | 496 | const std::string virtualName(Common::TStrToUTF8(ffd.cFileName)); |
| 497 | #else | 497 | #else |
| 498 | struct dirent dirent, *result = NULL; | 498 | struct dirent dirent, *result = NULL; |
| 499 | DIR *dirp = opendir(directory.c_str()); | 499 | DIR *dirp = opendir(directory.c_str()); |
| @@ -631,7 +631,7 @@ std::string& GetExeDirectory() | |||
| 631 | { | 631 | { |
| 632 | TCHAR Dolphin_exe_Path[2048]; | 632 | TCHAR Dolphin_exe_Path[2048]; |
| 633 | GetModuleFileName(NULL, Dolphin_exe_Path, 2048); | 633 | GetModuleFileName(NULL, Dolphin_exe_Path, 2048); |
| 634 | DolphinPath = TStrToUTF8(Dolphin_exe_Path); | 634 | DolphinPath = Common::TStrToUTF8(Dolphin_exe_Path); |
| 635 | DolphinPath = DolphinPath.substr(0, DolphinPath.find_last_of('\\')); | 635 | DolphinPath = DolphinPath.substr(0, DolphinPath.find_last_of('\\')); |
| 636 | } | 636 | } |
| 637 | return DolphinPath; | 637 | return DolphinPath; |
| @@ -826,7 +826,7 @@ bool IOFile::Open(const std::string& filename, const char openmode[]) | |||
| 826 | { | 826 | { |
| 827 | Close(); | 827 | Close(); |
| 828 | #ifdef _WIN32 | 828 | #ifdef _WIN32 |
| 829 | _tfopen_s(&m_file, UTF8ToTStr(filename).c_str(), UTF8ToTStr(openmode).c_str()); | 829 | _tfopen_s(&m_file, Common::UTF8ToTStr(filename).c_str(), Common::UTF8ToTStr(openmode).c_str()); |
| 830 | #else | 830 | #else |
| 831 | m_file = fopen(filename.c_str(), openmode); | 831 | m_file = fopen(filename.c_str(), openmode); |
| 832 | #endif | 832 | #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> | |||
| 213 | void OpenFStream(T& fstream, const std::string& filename, std::ios_base::openmode openmode) | 213 | void OpenFStream(T& fstream, const std::string& filename, std::ios_base::openmode openmode) |
| 214 | { | 214 | { |
| 215 | #ifdef _WIN32 | 215 | #ifdef _WIN32 |
| 216 | fstream.open(UTF8ToTStr(filename).c_str(), openmode); | 216 | fstream.open(Common::UTF8ToTStr(filename).c_str(), openmode); |
| 217 | #else | 217 | #else |
| 218 | fstream.open(filename.c_str(), openmode); | 218 | fstream.open(filename.c_str(), openmode); |
| 219 | #endif | 219 | #endif |
diff --git a/src/common/log_manager.cpp b/src/common/log_manager.cpp index 4e1cb60bd..9fd019fb3 100644 --- a/src/common/log_manager.cpp +++ b/src/common/log_manager.cpp | |||
| @@ -121,7 +121,7 @@ void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const | |||
| 121 | if (!log->IsEnabled() || level > log->GetLevel() || ! log->HasListeners()) | 121 | if (!log->IsEnabled() || level > log->GetLevel() || ! log->HasListeners()) |
| 122 | return; | 122 | return; |
| 123 | 123 | ||
| 124 | CharArrayFromFormatV(temp, MAX_MSGLEN, fmt, args); | 124 | Common::CharArrayFromFormatV(temp, MAX_MSGLEN, fmt, args); |
| 125 | 125 | ||
| 126 | static const char level_to_char[7] = "ONEWID"; | 126 | static const char level_to_char[7] = "ONEWID"; |
| 127 | sprintf(msg, "%s %s:%u %c[%s] %s: %s\n", Common::Timer::GetTimeFormatted().c_str(), file, line, | 127 | 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 b76ac92d3..d4dd933bf 100644 --- a/src/common/mem_arena.cpp +++ b/src/common/mem_arena.cpp | |||
| @@ -143,7 +143,7 @@ void MemArena::GrabLowMemSpace(size_t size) | |||
| 143 | // a bit more. | 143 | // a bit more. |
| 144 | for (int i = 0; i < 10000; i++) | 144 | for (int i = 0; i < 10000; i++) |
| 145 | { | 145 | { |
| 146 | std::string file_name = StringFromFormat("/citramem.%d", i); | 146 | std::string file_name = Common::StringFromFormat("/citramem.%d", i); |
| 147 | fd = shm_open(file_name.c_str(), O_RDWR | O_CREAT | O_EXCL, 0600); | 147 | fd = shm_open(file_name.c_str(), O_RDWR | O_CREAT | O_EXCL, 0600); |
| 148 | if (fd != -1) | 148 | if (fd != -1) |
| 149 | { | 149 | { |
diff --git a/src/common/memory_util.cpp b/src/common/memory_util.cpp index e01e63175..1496002e9 100644 --- a/src/common/memory_util.cpp +++ b/src/common/memory_util.cpp | |||
| @@ -190,7 +190,7 @@ std::string MemUsage() | |||
| 190 | if (NULL == hProcess) return "MemUsage Error"; | 190 | if (NULL == hProcess) return "MemUsage Error"; |
| 191 | 191 | ||
| 192 | if (GetProcessMemoryInfo(hProcess, &pmc, sizeof(pmc))) | 192 | if (GetProcessMemoryInfo(hProcess, &pmc, sizeof(pmc))) |
| 193 | Ret = StringFromFormat("%s K", ThousandSeparate(pmc.WorkingSetSize / 1024, 7).c_str()); | 193 | Ret = Common::StringFromFormat("%s K", Common::ThousandSeparate(pmc.WorkingSetSize / 1024, 7).c_str()); |
| 194 | 194 | ||
| 195 | CloseHandle(hProcess); | 195 | CloseHandle(hProcess); |
| 196 | return Ret; | 196 | 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, ...) | |||
| 72 | 72 | ||
| 73 | va_list args; | 73 | va_list args; |
| 74 | va_start(args, format); | 74 | va_start(args, format); |
| 75 | CharArrayFromFormatV(buffer, sizeof(buffer)-1, str_translator(format).c_str(), args); | 75 | Common::CharArrayFromFormatV(buffer, sizeof(buffer)-1, str_translator(format).c_str(), args); |
| 76 | va_end(args); | 76 | va_end(args); |
| 77 | 77 | ||
| 78 | ERROR_LOG(MASTER_LOG, "%s: %s", caption.c_str(), buffer); | 78 | 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 c489c868b..bd4c33391 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp | |||
| @@ -17,14 +17,16 @@ | |||
| 17 | #include <iconv.h> | 17 | #include <iconv.h> |
| 18 | #endif | 18 | #endif |
| 19 | 19 | ||
| 20 | namespace Common { | ||
| 21 | |||
| 20 | /// Make a string lowercase | 22 | /// Make a string lowercase |
| 21 | std::string LowerStr(std::string str) { | 23 | std::string ToLower(std::string str) { |
| 22 | std::transform(str.begin(), str.end(), str.begin(), ::tolower); | 24 | std::transform(str.begin(), str.end(), str.begin(), ::tolower); |
| 23 | return str; | 25 | return str; |
| 24 | } | 26 | } |
| 25 | 27 | ||
| 26 | /// Make a string uppercase | 28 | /// Make a string uppercase |
| 27 | std::string UpperStr(std::string str) { | 29 | std::string ToUpper(std::string str) { |
| 28 | std::transform(str.begin(), str.end(), str.begin(), ::toupper); | 30 | std::transform(str.begin(), str.end(), str.begin(), ::toupper); |
| 29 | return str; | 31 | return str; |
| 30 | } | 32 | } |
| @@ -541,3 +543,5 @@ std::string UTF16ToUTF8(const std::wstring& input) | |||
| 541 | } | 543 | } |
| 542 | 544 | ||
| 543 | #endif | 545 | #endif |
| 546 | |||
| 547 | } | ||
diff --git a/src/common/string_util.h b/src/common/string_util.h index b1118816e..16ce39bc1 100644 --- a/src/common/string_util.h +++ b/src/common/string_util.h | |||
| @@ -12,12 +12,13 @@ | |||
| 12 | 12 | ||
| 13 | #include "common/common.h" | 13 | #include "common/common.h" |
| 14 | 14 | ||
| 15 | /// Make a string lowercase | 15 | namespace Common { |
| 16 | 16 | ||
| 17 | std::string LowerStr(std::string str); | 17 | /// Make a string lowercase |
| 18 | std::string ToLower(std::string str); | ||
| 18 | 19 | ||
| 19 | /// Make a string uppercase | 20 | /// Make a string uppercase |
| 20 | std::string UpperStr(std::string str); | 21 | std::string ToUpper(std::string str); |
| 21 | 22 | ||
| 22 | std::string StringFromFormat(const char* format, ...); | 23 | std::string StringFromFormat(const char* format, ...); |
| 23 | // Cheap! | 24 | // Cheap! |
| @@ -112,3 +113,5 @@ inline std::string UTF8ToTStr(const std::string& str) | |||
| 112 | #endif | 113 | #endif |
| 113 | 114 | ||
| 114 | #endif | 115 | #endif |
| 116 | |||
| 117 | } | ||
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) | |||
| 260 | // The "mov" instruction ignores the first operand (rn). | 260 | // The "mov" instruction ignores the first operand (rn). |
| 261 | rn_str[0] = 0; | 261 | rn_str[0] = 0; |
| 262 | if ((flags & kNoOperand1) == 0) { | 262 | if ((flags & kNoOperand1) == 0) { |
| 263 | rn_str = StringFromFormat("r%d, ", rn); | 263 | rn_str = Common::StringFromFormat("r%d, ", rn); |
| 264 | } | 264 | } |
| 265 | 265 | ||
| 266 | // The following instructions do not write the result register (rd): | 266 | // The following instructions do not write the result register (rd): |
| 267 | // tst, teq, cmp, cmn. | 267 | // tst, teq, cmp, cmn. |
| 268 | rd_str[0] = 0; | 268 | rd_str[0] = 0; |
| 269 | if ((flags & kNoDest) == 0) { | 269 | if ((flags & kNoDest) == 0) { |
| 270 | rd_str = StringFromFormat("r%d, ", rd); | 270 | rd_str = Common::StringFromFormat("r%d, ", rd); |
| 271 | } | 271 | } |
| 272 | 272 | ||
| 273 | const char *sbit_str = ""; | 273 | const char *sbit_str = ""; |
| @@ -275,7 +275,7 @@ std::string ARM_Disasm::DisassembleALU(Opcode opcode, uint32_t insn) | |||
| 275 | sbit_str = "s"; | 275 | sbit_str = "s"; |
| 276 | 276 | ||
| 277 | if (is_immed) { | 277 | if (is_immed) { |
| 278 | return StringFromFormat("%s%s%s\t%s%s#%u ; 0x%x", | 278 | return Common::StringFromFormat("%s%s%s\t%s%s#%u ; 0x%x", |
| 279 | opname, cond_to_str(cond), sbit_str, rd_str.c_str(), rn_str.c_str(), immed, immed); | 279 | opname, cond_to_str(cond), sbit_str, rd_str.c_str(), rn_str.c_str(), immed, immed); |
| 280 | } | 280 | } |
| 281 | 281 | ||
| @@ -290,24 +290,24 @@ std::string ARM_Disasm::DisassembleALU(Opcode opcode, uint32_t insn) | |||
| 290 | rotated_val = (rotated_val >> rotate2) | (rotated_val << (32 - rotate2)); | 290 | rotated_val = (rotated_val >> rotate2) | (rotated_val << (32 - rotate2)); |
| 291 | 291 | ||
| 292 | if (!shift_is_reg && shift_type == 0 && shift_amount == 0) { | 292 | if (!shift_is_reg && shift_type == 0 && shift_amount == 0) { |
| 293 | return StringFromFormat("%s%s%s\t%s%sr%d", | 293 | return Common::StringFromFormat("%s%s%s\t%s%sr%d", |
| 294 | opname, cond_to_str(cond), sbit_str, rd_str.c_str(), rn_str.c_str(), rm); | 294 | opname, cond_to_str(cond), sbit_str, rd_str.c_str(), rn_str.c_str(), rm); |
| 295 | } | 295 | } |
| 296 | 296 | ||
| 297 | const char *shift_name = shift_names[shift_type]; | 297 | const char *shift_name = shift_names[shift_type]; |
| 298 | if (shift_is_reg) { | 298 | if (shift_is_reg) { |
| 299 | return StringFromFormat("%s%s%s\t%s%sr%d, %s r%d", | 299 | return Common::StringFromFormat("%s%s%s\t%s%sr%d, %s r%d", |
| 300 | opname, cond_to_str(cond), sbit_str, rd_str.c_str(), rn_str.c_str(), rm, | 300 | opname, cond_to_str(cond), sbit_str, rd_str.c_str(), rn_str.c_str(), rm, |
| 301 | shift_name, rs); | 301 | shift_name, rs); |
| 302 | } | 302 | } |
| 303 | if (shift_amount == 0) { | 303 | if (shift_amount == 0) { |
| 304 | if (shift_type == 3) { | 304 | if (shift_type == 3) { |
| 305 | return StringFromFormat("%s%s%s\t%s%sr%d, RRX", | 305 | return Common::StringFromFormat("%s%s%s\t%s%sr%d, RRX", |
| 306 | opname, cond_to_str(cond), sbit_str, rd_str.c_str(), rn_str.c_str(), rm); | 306 | opname, cond_to_str(cond), sbit_str, rd_str.c_str(), rn_str.c_str(), rm); |
| 307 | } | 307 | } |
| 308 | shift_amount = 32; | 308 | shift_amount = 32; |
| 309 | } | 309 | } |
| 310 | return StringFromFormat("%s%s%s\t%s%sr%d, %s #%u", | 310 | return Common::StringFromFormat("%s%s%s\t%s%sr%d, %s #%u", |
| 311 | opname, cond_to_str(cond), sbit_str, rd_str.c_str(), rn_str.c_str(), rm, | 311 | opname, cond_to_str(cond), sbit_str, rd_str.c_str(), rn_str.c_str(), rm, |
| 312 | shift_name, shift_amount); | 312 | shift_name, shift_amount); |
| 313 | } | 313 | } |
| @@ -325,20 +325,20 @@ std::string ARM_Disasm::DisassembleBranch(uint32_t addr, Opcode opcode, uint32_t | |||
| 325 | offset += 8; | 325 | offset += 8; |
| 326 | addr += offset; | 326 | addr += offset; |
| 327 | const char *opname = opcode_names[opcode]; | 327 | const char *opname = opcode_names[opcode]; |
| 328 | return StringFromFormat("%s%s\t0x%x", opname, cond_to_str(cond), addr); | 328 | return Common::StringFromFormat("%s%s\t0x%x", opname, cond_to_str(cond), addr); |
| 329 | } | 329 | } |
| 330 | 330 | ||
| 331 | std::string ARM_Disasm::DisassembleBX(uint32_t insn) | 331 | std::string ARM_Disasm::DisassembleBX(uint32_t insn) |
| 332 | { | 332 | { |
| 333 | uint8_t cond = (insn >> 28) & 0xf; | 333 | uint8_t cond = (insn >> 28) & 0xf; |
| 334 | uint8_t rn = insn & 0xf; | 334 | uint8_t rn = insn & 0xf; |
| 335 | return StringFromFormat("bx%s\tr%d", cond_to_str(cond), rn); | 335 | return Common::StringFromFormat("bx%s\tr%d", cond_to_str(cond), rn); |
| 336 | } | 336 | } |
| 337 | 337 | ||
| 338 | std::string ARM_Disasm::DisassembleBKPT(uint32_t insn) | 338 | std::string ARM_Disasm::DisassembleBKPT(uint32_t insn) |
| 339 | { | 339 | { |
| 340 | uint32_t immed = (((insn >> 8) & 0xfff) << 4) | (insn & 0xf); | 340 | uint32_t immed = (((insn >> 8) & 0xfff) << 4) | (insn & 0xf); |
| 341 | return StringFromFormat("bkpt\t#%d", immed); | 341 | return Common::StringFromFormat("bkpt\t#%d", immed); |
| 342 | } | 342 | } |
| 343 | 343 | ||
| 344 | std::string ARM_Disasm::DisassembleCLZ(uint32_t insn) | 344 | std::string ARM_Disasm::DisassembleCLZ(uint32_t insn) |
| @@ -346,7 +346,7 @@ std::string ARM_Disasm::DisassembleCLZ(uint32_t insn) | |||
| 346 | uint8_t cond = (insn >> 28) & 0xf; | 346 | uint8_t cond = (insn >> 28) & 0xf; |
| 347 | uint8_t rd = (insn >> 12) & 0xf; | 347 | uint8_t rd = (insn >> 12) & 0xf; |
| 348 | uint8_t rm = insn & 0xf; | 348 | uint8_t rm = insn & 0xf; |
| 349 | return StringFromFormat("clz%s\tr%d, r%d", cond_to_str(cond), rd, rm); | 349 | return Common::StringFromFormat("clz%s\tr%d, r%d", cond_to_str(cond), rd, rm); |
| 350 | } | 350 | } |
| 351 | 351 | ||
| 352 | std::string ARM_Disasm::DisassembleMemblock(Opcode opcode, uint32_t insn) | 352 | std::string ARM_Disasm::DisassembleMemblock(Opcode opcode, uint32_t insn) |
| @@ -376,7 +376,7 @@ std::string ARM_Disasm::DisassembleMemblock(Opcode opcode, uint32_t insn) | |||
| 376 | tmp_list[0] = 0; | 376 | tmp_list[0] = 0; |
| 377 | for (int ii = 0; ii < 16; ++ii) { | 377 | for (int ii = 0; ii < 16; ++ii) { |
| 378 | if (reg_list & (1 << ii)) { | 378 | if (reg_list & (1 << ii)) { |
| 379 | tmp_list += StringFromFormat("%sr%d", comma, ii); | 379 | tmp_list += Common::StringFromFormat("%sr%d", comma, ii); |
| 380 | comma = ","; | 380 | comma = ","; |
| 381 | } | 381 | } |
| 382 | } | 382 | } |
| @@ -396,7 +396,7 @@ std::string ARM_Disasm::DisassembleMemblock(Opcode opcode, uint32_t insn) | |||
| 396 | } | 396 | } |
| 397 | } | 397 | } |
| 398 | 398 | ||
| 399 | return StringFromFormat("%s%s%s\tr%d%s, {%s}%s", | 399 | return Common::StringFromFormat("%s%s%s\tr%d%s, {%s}%s", |
| 400 | opname, cond_to_str(cond), addr_mode, rn, bang, tmp_list.c_str(), carret); | 400 | opname, cond_to_str(cond), addr_mode, rn, bang, tmp_list.c_str(), carret); |
| 401 | } | 401 | } |
| 402 | 402 | ||
| @@ -432,10 +432,10 @@ std::string ARM_Disasm::DisassembleMem(uint32_t insn) | |||
| 432 | if (is_reg == 0) { | 432 | if (is_reg == 0) { |
| 433 | if (is_pre) { | 433 | if (is_pre) { |
| 434 | if (offset == 0) { | 434 | if (offset == 0) { |
| 435 | return StringFromFormat("%s%s%s\tr%d, [r%d]", | 435 | return Common::StringFromFormat("%s%s%s\tr%d, [r%d]", |
| 436 | opname, cond_to_str(cond), byte, rd, rn); | 436 | opname, cond_to_str(cond), byte, rd, rn); |
| 437 | } else { | 437 | } else { |
| 438 | return StringFromFormat("%s%s%s\tr%d, [r%d, #%s%u]%s", | 438 | return Common::StringFromFormat("%s%s%s\tr%d, [r%d, #%s%u]%s", |
| 439 | opname, cond_to_str(cond), byte, rd, rn, minus, offset, bang); | 439 | opname, cond_to_str(cond), byte, rd, rn, minus, offset, bang); |
| 440 | } | 440 | } |
| 441 | } else { | 441 | } else { |
| @@ -443,7 +443,7 @@ std::string ARM_Disasm::DisassembleMem(uint32_t insn) | |||
| 443 | if (write_back) | 443 | if (write_back) |
| 444 | transfer = "t"; | 444 | transfer = "t"; |
| 445 | 445 | ||
| 446 | return StringFromFormat("%s%s%s%s\tr%d, [r%d], #%s%u", | 446 | return Common::StringFromFormat("%s%s%s%s\tr%d, [r%d], #%s%u", |
| 447 | opname, cond_to_str(cond), byte, transfer, rd, rn, minus, offset); | 447 | opname, cond_to_str(cond), byte, transfer, rd, rn, minus, offset); |
| 448 | } | 448 | } |
| 449 | } | 449 | } |
| @@ -457,16 +457,16 @@ std::string ARM_Disasm::DisassembleMem(uint32_t insn) | |||
| 457 | if (is_pre) { | 457 | if (is_pre) { |
| 458 | if (shift_amount == 0) { | 458 | if (shift_amount == 0) { |
| 459 | if (shift_type == 0) { | 459 | if (shift_type == 0) { |
| 460 | return StringFromFormat("%s%s%s\tr%d, [r%d, %sr%d]%s", | 460 | return Common::StringFromFormat("%s%s%s\tr%d, [r%d, %sr%d]%s", |
| 461 | opname, cond_to_str(cond), byte, rd, rn, minus, rm, bang); | 461 | opname, cond_to_str(cond), byte, rd, rn, minus, rm, bang); |
| 462 | } | 462 | } |
| 463 | if (shift_type == 3) { | 463 | if (shift_type == 3) { |
| 464 | return StringFromFormat("%s%s%s\tr%d, [r%d, %sr%d, RRX]%s", | 464 | return Common::StringFromFormat("%s%s%s\tr%d, [r%d, %sr%d, RRX]%s", |
| 465 | opname, cond_to_str(cond), byte, rd, rn, minus, rm, bang); | 465 | opname, cond_to_str(cond), byte, rd, rn, minus, rm, bang); |
| 466 | } | 466 | } |
| 467 | shift_amount = 32; | 467 | shift_amount = 32; |
| 468 | } | 468 | } |
| 469 | return StringFromFormat("%s%s%s\tr%d, [r%d, %sr%d, %s #%u]%s", | 469 | return Common::StringFromFormat("%s%s%s\tr%d, [r%d, %sr%d, %s #%u]%s", |
| 470 | opname, cond_to_str(cond), byte, rd, rn, minus, rm, | 470 | opname, cond_to_str(cond), byte, rd, rn, minus, rm, |
| 471 | shift_name, shift_amount, bang); | 471 | shift_name, shift_amount, bang); |
| 472 | } | 472 | } |
| @@ -477,17 +477,17 @@ std::string ARM_Disasm::DisassembleMem(uint32_t insn) | |||
| 477 | 477 | ||
| 478 | if (shift_amount == 0) { | 478 | if (shift_amount == 0) { |
| 479 | if (shift_type == 0) { | 479 | if (shift_type == 0) { |
| 480 | return StringFromFormat("%s%s%s%s\tr%d, [r%d], %sr%d", | 480 | return Common::StringFromFormat("%s%s%s%s\tr%d, [r%d], %sr%d", |
| 481 | opname, cond_to_str(cond), byte, transfer, rd, rn, minus, rm); | 481 | opname, cond_to_str(cond), byte, transfer, rd, rn, minus, rm); |
| 482 | } | 482 | } |
| 483 | if (shift_type == 3) { | 483 | if (shift_type == 3) { |
| 484 | return StringFromFormat("%s%s%s%s\tr%d, [r%d], %sr%d, RRX", | 484 | return Common::StringFromFormat("%s%s%s%s\tr%d, [r%d], %sr%d, RRX", |
| 485 | opname, cond_to_str(cond), byte, transfer, rd, rn, minus, rm); | 485 | opname, cond_to_str(cond), byte, transfer, rd, rn, minus, rm); |
| 486 | } | 486 | } |
| 487 | shift_amount = 32; | 487 | shift_amount = 32; |
| 488 | } | 488 | } |
| 489 | 489 | ||
| 490 | return StringFromFormat("%s%s%s%s\tr%d, [r%d], %sr%d, %s #%u", | 490 | return Common::StringFromFormat("%s%s%s%s\tr%d, [r%d], %sr%d, %s #%u", |
| 491 | opname, cond_to_str(cond), byte, transfer, rd, rn, minus, rm, | 491 | opname, cond_to_str(cond), byte, transfer, rd, rn, minus, rm, |
| 492 | shift_name, shift_amount); | 492 | shift_name, shift_amount); |
| 493 | } | 493 | } |
| @@ -528,22 +528,22 @@ std::string ARM_Disasm::DisassembleMemHalf(uint32_t insn) | |||
| 528 | if (is_immed) { | 528 | if (is_immed) { |
| 529 | if (is_pre) { | 529 | if (is_pre) { |
| 530 | if (offset == 0) { | 530 | if (offset == 0) { |
| 531 | return StringFromFormat("%s%sh\tr%d, [r%d]", opname, cond_to_str(cond), rd, rn); | 531 | return Common::StringFromFormat("%s%sh\tr%d, [r%d]", opname, cond_to_str(cond), rd, rn); |
| 532 | } else { | 532 | } else { |
| 533 | return StringFromFormat("%s%sh\tr%d, [r%d, #%s%u]%s", | 533 | return Common::StringFromFormat("%s%sh\tr%d, [r%d, #%s%u]%s", |
| 534 | opname, cond_to_str(cond), rd, rn, minus, offset, bang); | 534 | opname, cond_to_str(cond), rd, rn, minus, offset, bang); |
| 535 | } | 535 | } |
| 536 | } else { | 536 | } else { |
| 537 | return StringFromFormat("%s%sh\tr%d, [r%d], #%s%u", | 537 | return Common::StringFromFormat("%s%sh\tr%d, [r%d], #%s%u", |
| 538 | opname, cond_to_str(cond), rd, rn, minus, offset); | 538 | opname, cond_to_str(cond), rd, rn, minus, offset); |
| 539 | } | 539 | } |
| 540 | } | 540 | } |
| 541 | 541 | ||
| 542 | if (is_pre) { | 542 | if (is_pre) { |
| 543 | return StringFromFormat("%s%sh\tr%d, [r%d, %sr%d]%s", | 543 | return Common::StringFromFormat("%s%sh\tr%d, [r%d, %sr%d]%s", |
| 544 | opname, cond_to_str(cond), rd, rn, minus, rm, bang); | 544 | opname, cond_to_str(cond), rd, rn, minus, rm, bang); |
| 545 | } else { | 545 | } else { |
| 546 | return StringFromFormat("%s%sh\tr%d, [r%d], %sr%d", | 546 | return Common::StringFromFormat("%s%sh\tr%d, [r%d], %sr%d", |
| 547 | opname, cond_to_str(cond), rd, rn, minus, rm); | 547 | opname, cond_to_str(cond), rd, rn, minus, rm); |
| 548 | } | 548 | } |
| 549 | } | 549 | } |
| @@ -558,7 +558,7 @@ std::string ARM_Disasm::DisassembleMCR(Opcode opcode, uint32_t insn) | |||
| 558 | uint8_t crm = insn & 0xf; | 558 | uint8_t crm = insn & 0xf; |
| 559 | 559 | ||
| 560 | const char *opname = opcode_names[opcode]; | 560 | const char *opname = opcode_names[opcode]; |
| 561 | return StringFromFormat("%s%s\t%d, 0, r%d, cr%d, cr%d, {%d}", | 561 | return Common::StringFromFormat("%s%s\t%d, 0, r%d, cr%d, cr%d, {%d}", |
| 562 | opname, cond_to_str(cond), cpnum, crd, crn, crm, opcode2); | 562 | opname, cond_to_str(cond), cpnum, crd, crn, crm, opcode2); |
| 563 | } | 563 | } |
| 564 | 564 | ||
| @@ -572,7 +572,7 @@ std::string ARM_Disasm::DisassembleMLA(Opcode opcode, uint32_t insn) | |||
| 572 | uint8_t bit_s = (insn >> 20) & 1; | 572 | uint8_t bit_s = (insn >> 20) & 1; |
| 573 | 573 | ||
| 574 | const char *opname = opcode_names[opcode]; | 574 | const char *opname = opcode_names[opcode]; |
| 575 | return StringFromFormat("%s%s%s\tr%d, r%d, r%d, r%d", | 575 | return Common::StringFromFormat("%s%s%s\tr%d, r%d, r%d, r%d", |
| 576 | opname, cond_to_str(cond), bit_s ? "s" : "", rd, rm, rs, rn); | 576 | opname, cond_to_str(cond), bit_s ? "s" : "", rd, rm, rs, rn); |
| 577 | } | 577 | } |
| 578 | 578 | ||
| @@ -586,7 +586,7 @@ std::string ARM_Disasm::DisassembleUMLAL(Opcode opcode, uint32_t insn) | |||
| 586 | uint8_t bit_s = (insn >> 20) & 1; | 586 | uint8_t bit_s = (insn >> 20) & 1; |
| 587 | 587 | ||
| 588 | const char *opname = opcode_names[opcode]; | 588 | const char *opname = opcode_names[opcode]; |
| 589 | return StringFromFormat("%s%s%s\tr%d, r%d, r%d, r%d", | 589 | return Common::StringFromFormat("%s%s%s\tr%d, r%d, r%d, r%d", |
| 590 | opname, cond_to_str(cond), bit_s ? "s" : "", rdlo, rdhi, rm, rs); | 590 | opname, cond_to_str(cond), bit_s ? "s" : "", rdlo, rdhi, rm, rs); |
| 591 | } | 591 | } |
| 592 | 592 | ||
| @@ -599,7 +599,7 @@ std::string ARM_Disasm::DisassembleMUL(Opcode opcode, uint32_t insn) | |||
| 599 | uint8_t bit_s = (insn >> 20) & 1; | 599 | uint8_t bit_s = (insn >> 20) & 1; |
| 600 | 600 | ||
| 601 | const char *opname = opcode_names[opcode]; | 601 | const char *opname = opcode_names[opcode]; |
| 602 | return StringFromFormat("%s%s%s\tr%d, r%d, r%d", | 602 | return Common::StringFromFormat("%s%s%s\tr%d, r%d, r%d", |
| 603 | opname, cond_to_str(cond), bit_s ? "s" : "", rd, rm, rs); | 603 | opname, cond_to_str(cond), bit_s ? "s" : "", rd, rm, rs); |
| 604 | } | 604 | } |
| 605 | 605 | ||
| @@ -609,7 +609,7 @@ std::string ARM_Disasm::DisassembleMRS(uint32_t insn) | |||
| 609 | uint8_t rd = (insn >> 12) & 0xf; | 609 | uint8_t rd = (insn >> 12) & 0xf; |
| 610 | uint8_t ps = (insn >> 22) & 1; | 610 | uint8_t ps = (insn >> 22) & 1; |
| 611 | 611 | ||
| 612 | return StringFromFormat("mrs%s\tr%d, %s", cond_to_str(cond), rd, ps ? "spsr" : "cpsr"); | 612 | return Common::StringFromFormat("mrs%s\tr%d, %s", cond_to_str(cond), rd, ps ? "spsr" : "cpsr"); |
| 613 | } | 613 | } |
| 614 | 614 | ||
| 615 | std::string ARM_Disasm::DisassembleMSR(uint32_t insn) | 615 | std::string ARM_Disasm::DisassembleMSR(uint32_t insn) |
| @@ -636,13 +636,13 @@ std::string ARM_Disasm::DisassembleMSR(uint32_t insn) | |||
| 636 | uint8_t rotate = (insn >> 8) & 0xf; | 636 | uint8_t rotate = (insn >> 8) & 0xf; |
| 637 | uint8_t rotate2 = rotate << 1; | 637 | uint8_t rotate2 = rotate << 1; |
| 638 | uint32_t rotated_val = (immed >> rotate2) | (immed << (32 - rotate2)); | 638 | uint32_t rotated_val = (immed >> rotate2) | (immed << (32 - rotate2)); |
| 639 | return StringFromFormat("msr%s\t%s_%s, #0x%x", | 639 | return Common::StringFromFormat("msr%s\t%s_%s, #0x%x", |
| 640 | cond_to_str(cond), pd ? "spsr" : "cpsr", flags, rotated_val); | 640 | cond_to_str(cond), pd ? "spsr" : "cpsr", flags, rotated_val); |
| 641 | } | 641 | } |
| 642 | 642 | ||
| 643 | uint8_t rm = insn & 0xf; | 643 | uint8_t rm = insn & 0xf; |
| 644 | 644 | ||
| 645 | return StringFromFormat("msr%s\t%s_%s, r%d", | 645 | return Common::StringFromFormat("msr%s\t%s_%s, r%d", |
| 646 | cond_to_str(cond), pd ? "spsr" : "cpsr", flags, rm); | 646 | cond_to_str(cond), pd ? "spsr" : "cpsr", flags, rm); |
| 647 | } | 647 | } |
| 648 | 648 | ||
| @@ -658,14 +658,14 @@ std::string ARM_Disasm::DisassemblePLD(uint32_t insn) | |||
| 658 | 658 | ||
| 659 | if (is_reg) { | 659 | if (is_reg) { |
| 660 | uint8_t rm = insn & 0xf; | 660 | uint8_t rm = insn & 0xf; |
| 661 | return StringFromFormat("pld\t[r%d, %sr%d]", rn, minus, rm); | 661 | return Common::StringFromFormat("pld\t[r%d, %sr%d]", rn, minus, rm); |
| 662 | } | 662 | } |
| 663 | 663 | ||
| 664 | uint16_t offset = insn & 0xfff; | 664 | uint16_t offset = insn & 0xfff; |
| 665 | if (offset == 0) { | 665 | if (offset == 0) { |
| 666 | return StringFromFormat("pld\t[r%d]", rn); | 666 | return Common::StringFromFormat("pld\t[r%d]", rn); |
| 667 | } else { | 667 | } else { |
| 668 | return StringFromFormat("pld\t[r%d, #%s%u]", rn, minus, offset); | 668 | return Common::StringFromFormat("pld\t[r%d, #%s%u]", rn, minus, offset); |
| 669 | } | 669 | } |
| 670 | } | 670 | } |
| 671 | 671 | ||
| @@ -674,7 +674,7 @@ std::string ARM_Disasm::DisassembleSWI(uint32_t insn) | |||
| 674 | uint8_t cond = (insn >> 28) & 0xf; | 674 | uint8_t cond = (insn >> 28) & 0xf; |
| 675 | uint32_t sysnum = insn & 0x00ffffff; | 675 | uint32_t sysnum = insn & 0x00ffffff; |
| 676 | 676 | ||
| 677 | return StringFromFormat("swi%s 0x%x", cond_to_str(cond), sysnum); | 677 | return Common::StringFromFormat("swi%s 0x%x", cond_to_str(cond), sysnum); |
| 678 | } | 678 | } |
| 679 | 679 | ||
| 680 | std::string ARM_Disasm::DisassembleSWP(Opcode opcode, uint32_t insn) | 680 | std::string ARM_Disasm::DisassembleSWP(Opcode opcode, uint32_t insn) |
| @@ -685,7 +685,7 @@ std::string ARM_Disasm::DisassembleSWP(Opcode opcode, uint32_t insn) | |||
| 685 | uint8_t rm = insn & 0xf; | 685 | uint8_t rm = insn & 0xf; |
| 686 | 686 | ||
| 687 | const char *opname = opcode_names[opcode]; | 687 | const char *opname = opcode_names[opcode]; |
| 688 | return StringFromFormat("%s%s\tr%d, r%d, [r%d]", opname, cond_to_str(cond), rd, rm, rn); | 688 | return Common::StringFromFormat("%s%s\tr%d, r%d, [r%d]", opname, cond_to_str(cond), rd, rm, rn); |
| 689 | } | 689 | } |
| 690 | 690 | ||
| 691 | Opcode ARM_Disasm::Decode(uint32_t insn) { | 691 | Opcode ARM_Disasm::Decode(uint32_t insn) { |
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index bdcfae6f5..0ce3f027b 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp | |||
| @@ -221,7 +221,7 @@ Result CreateThread(u32 priority, u32 entry_point, u32 arg, u32 stack_top, u32 p | |||
| 221 | TSymbol symbol = Symbols::GetSymbol(entry_point); | 221 | TSymbol symbol = Symbols::GetSymbol(entry_point); |
| 222 | name = symbol.name; | 222 | name = symbol.name; |
| 223 | } else { | 223 | } else { |
| 224 | name = StringFromFormat("unknown-%08x", entry_point); | 224 | name = Common::StringFromFormat("unknown-%08x", entry_point); |
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | Handle thread = Kernel::CreateThread(name.c_str(), entry_point, priority, arg, processor_id, | 227 | 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 ce1154b79..1f895ed2e 100644 --- a/src/core/loader/loader.cpp +++ b/src/core/loader/loader.cpp | |||
| @@ -28,22 +28,21 @@ FileType IdentifyFile(const std::string &filename) { | |||
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | size_t extension_loc = filename.find_last_of('.'); | 30 | size_t extension_loc = filename.find_last_of('.'); |
| 31 | std::string extension = extension_loc != std::string::npos ? filename.substr(extension_loc) : ""; | 31 | if (extension_loc == std::string::npos) |
| 32 | 32 | return FileType::Unknown; | |
| 33 | if (LowerStr(extension) == ".elf") { | 33 | std::string extension = Common::ToLower(filename.substr(extension_loc)); |
| 34 | return FileType::ELF; // TODO(bunnei): Do some filetype checking :p | 34 | |
| 35 | } | 35 | // TODO(bunnei): Do actual filetype checking instead of naively checking the extension |
| 36 | else if (LowerStr(extension) == ".axf") { | 36 | if (extension == ".elf") { |
| 37 | return FileType::ELF; // TODO(bunnei): Do some filetype checking :p | 37 | return FileType::ELF; |
| 38 | } | 38 | } else if (extension == ".axf") { |
| 39 | else if (LowerStr(extension) == ".cxi") { | 39 | return FileType::ELF; |
| 40 | return FileType::CXI; // TODO(bunnei): Do some filetype checking :p | 40 | } else if (extension == ".cxi") { |
| 41 | } | 41 | return FileType::CXI; |
| 42 | else if (LowerStr(extension) == ".cci") { | 42 | } else if (extension == ".cci") { |
| 43 | return FileType::CCI; // TODO(bunnei): Do some filetype checking :p | 43 | return FileType::CCI; |
| 44 | } | 44 | } else if (extension == ".bin") { |
| 45 | else if (LowerStr(extension) == ".bin") { | 45 | return FileType::BIN; |
| 46 | return FileType::BIN; // TODO(bunnei): Do some filetype checking :p | ||
| 47 | } | 46 | } |
| 48 | return FileType::Unknown; | 47 | return FileType::Unknown; |
| 49 | } | 48 | } |