diff options
| -rw-r--r-- | src/common/common_types.h | 2 | ||||
| -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 | 20 | ||||
| -rw-r--r-- | src/common/string_util.h | 8 | ||||
| -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 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/renderer_opengl.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/renderer_opengl.h | 2 |
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 { | |||
| 100 | __m128 a; ///< 128-bit floating point (__m128 maps to the XMM[0-7] registers) | 100 | __m128 a; ///< 128-bit floating point (__m128 maps to the XMM[0-7] registers) |
| 101 | }; | 101 | }; |
| 102 | 102 | ||
| 103 | namespace common { | 103 | namespace Common { |
| 104 | /// Rectangle data structure | 104 | /// Rectangle data structure |
| 105 | class Rect { | 105 | class Rect { |
| 106 | public: | 106 | 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 | |||
| 43 | // Save the window handle that AllocConsole() created | 43 | // Save the window handle that AllocConsole() created |
| 44 | hConsole = GetStdHandle(STD_OUTPUT_HANDLE); | 44 | hConsole = GetStdHandle(STD_OUTPUT_HANDLE); |
| 45 | // Set the console window title | 45 | // Set the console window title |
| 46 | SetConsoleTitle(UTF8ToTStr(Title).c_str()); | 46 | SetConsoleTitle(Common::UTF8ToTStr(Title).c_str()); |
| 47 | // Set letter space | 47 | // Set letter space |
| 48 | LetterSpace(80, 4000); | 48 | LetterSpace(80, 4000); |
| 49 | //MoveWindow(GetConsoleWindow(), 200,200, 800,800, true); | 49 | //MoveWindow(GetConsoleWindow(), 200,200, 800,800, true); |
| @@ -189,11 +189,11 @@ void ConsoleListener::PixelSpace(int Left, int Top, int Width, int Height, bool | |||
| 189 | { | 189 | { |
| 190 | Str.resize(Str.size() + 1); | 190 | Str.resize(Str.size() + 1); |
| 191 | if (!ReadConsoleOutputCharacter(hConsole, Str.back().data(), ReadBufferSize, coordScreen, &cCharsRead)) | 191 | if (!ReadConsoleOutputCharacter(hConsole, Str.back().data(), ReadBufferSize, coordScreen, &cCharsRead)) |
| 192 | SLog += StringFromFormat("WriteConsoleOutputCharacter error"); | 192 | SLog += Common::StringFromFormat("WriteConsoleOutputCharacter error"); |
| 193 | 193 | ||
| 194 | Attr.resize(Attr.size() + 1); | 194 | Attr.resize(Attr.size() + 1); |
| 195 | if (!ReadConsoleOutputAttribute(hConsole, Attr.back().data(), ReadBufferSize, coordScreen, &cAttrRead)) | 195 | if (!ReadConsoleOutputAttribute(hConsole, Attr.back().data(), ReadBufferSize, coordScreen, &cAttrRead)) |
| 196 | SLog += StringFromFormat("WriteConsoleOutputAttribute error"); | 196 | SLog += Common::StringFromFormat("WriteConsoleOutputAttribute error"); |
| 197 | 197 | ||
| 198 | // Break on error | 198 | // Break on error |
| 199 | if (cAttrRead == 0) break; | 199 | if (cAttrRead == 0) break; |
| @@ -219,9 +219,9 @@ void ConsoleListener::PixelSpace(int Left, int Top, int Width, int Height, bool | |||
| 219 | for (size_t i = 0; i < Attr.size(); i++) | 219 | for (size_t i = 0; i < Attr.size(); i++) |
| 220 | { | 220 | { |
| 221 | if (!WriteConsoleOutputCharacter(hConsole, Str[i].data(), ReadBufferSize, coordScreen, &cCharsWritten)) | 221 | if (!WriteConsoleOutputCharacter(hConsole, Str[i].data(), ReadBufferSize, coordScreen, &cCharsWritten)) |
| 222 | SLog += StringFromFormat("WriteConsoleOutputCharacter error"); | 222 | SLog += Common::StringFromFormat("WriteConsoleOutputCharacter error"); |
| 223 | if (!WriteConsoleOutputAttribute(hConsole, Attr[i].data(), ReadBufferSize, coordScreen, &cAttrWritten)) | 223 | if (!WriteConsoleOutputAttribute(hConsole, Attr[i].data(), ReadBufferSize, coordScreen, &cAttrWritten)) |
| 224 | SLog += StringFromFormat("WriteConsoleOutputAttribute error"); | 224 | SLog += Common::StringFromFormat("WriteConsoleOutputAttribute error"); |
| 225 | 225 | ||
| 226 | BytesWritten += cAttrWritten; | 226 | BytesWritten += cAttrWritten; |
| 227 | coordScreen = GetCoordinates(BytesWritten, LBufWidth); | 227 | 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 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 | |||
| 33 | void CFileSearch::FindFiles(const std::string& _searchString, const std::string& _strPath) | 33 | void CFileSearch::FindFiles(const std::string& _searchString, const std::string& _strPath) |
| 34 | { | 34 | { |
| 35 | std::string GCMSearchPath; | 35 | std::string GCMSearchPath; |
| 36 | BuildCompleteFilename(GCMSearchPath, _strPath, _searchString); | 36 | Common::BuildCompleteFilename(GCMSearchPath, _strPath, _searchString); |
| 37 | #ifdef _WIN32 | 37 | #ifdef _WIN32 |
| 38 | WIN32_FIND_DATA findData; | 38 | WIN32_FIND_DATA findData; |
| 39 | HANDLE FindFirst = FindFirstFile(UTF8ToTStr(GCMSearchPath).c_str(), &findData); | 39 | HANDLE FindFirst = FindFirstFile(Common::UTF8ToTStr(GCMSearchPath).c_str(), &findData); |
| 40 | 40 | ||
| 41 | if (FindFirst != INVALID_HANDLE_VALUE) | 41 | if (FindFirst != INVALID_HANDLE_VALUE) |
| 42 | { | 42 | { |
| @@ -47,7 +47,7 @@ void CFileSearch::FindFiles(const std::string& _searchString, const std::string& | |||
| 47 | if (findData.cFileName[0] != '.') | 47 | if (findData.cFileName[0] != '.') |
| 48 | { | 48 | { |
| 49 | std::string strFilename; | 49 | std::string strFilename; |
| 50 | BuildCompleteFilename(strFilename, _strPath, TStrToUTF8(findData.cFileName)); | 50 | Common::BuildCompleteFilename(strFilename, _strPath, Common::TStrToUTF8(findData.cFileName)); |
| 51 | m_FileNames.push_back(strFilename); | 51 | m_FileNames.push_back(strFilename); |
| 52 | } | 52 | } |
| 53 | 53 | ||
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) | |||
| 64 | StripTailDirSlashes(copy); | 64 | StripTailDirSlashes(copy); |
| 65 | 65 | ||
| 66 | #ifdef _WIN32 | 66 | #ifdef _WIN32 |
| 67 | int result = _tstat64(UTF8ToTStr(copy).c_str(), &file_info); | 67 | int result = _tstat64(Common::UTF8ToTStr(copy).c_str(), &file_info); |
| 68 | #else | 68 | #else |
| 69 | int result = stat64(copy.c_str(), &file_info); | 69 | int result = stat64(copy.c_str(), &file_info); |
| 70 | #endif | 70 | #endif |
| @@ -81,7 +81,7 @@ bool IsDirectory(const std::string &filename) | |||
| 81 | StripTailDirSlashes(copy); | 81 | StripTailDirSlashes(copy); |
| 82 | 82 | ||
| 83 | #ifdef _WIN32 | 83 | #ifdef _WIN32 |
| 84 | int result = _tstat64(UTF8ToTStr(copy).c_str(), &file_info); | 84 | int result = _tstat64(Common::UTF8ToTStr(copy).c_str(), &file_info); |
| 85 | #else | 85 | #else |
| 86 | int result = stat64(copy.c_str(), &file_info); | 86 | int result = stat64(copy.c_str(), &file_info); |
| 87 | #endif | 87 | #endif |
| @@ -117,7 +117,7 @@ bool Delete(const std::string &filename) | |||
| 117 | } | 117 | } |
| 118 | 118 | ||
| 119 | #ifdef _WIN32 | 119 | #ifdef _WIN32 |
| 120 | if (!DeleteFile(UTF8ToTStr(filename).c_str())) | 120 | if (!DeleteFile(Common::UTF8ToTStr(filename).c_str())) |
| 121 | { | 121 | { |
| 122 | WARN_LOG(COMMON, "Delete: DeleteFile failed on %s: %s", | 122 | WARN_LOG(COMMON, "Delete: DeleteFile failed on %s: %s", |
| 123 | filename.c_str(), GetLastErrorMsg()); | 123 | filename.c_str(), GetLastErrorMsg()); |
| @@ -139,7 +139,7 @@ bool CreateDir(const std::string &path) | |||
| 139 | { | 139 | { |
| 140 | INFO_LOG(COMMON, "CreateDir: directory %s", path.c_str()); | 140 | INFO_LOG(COMMON, "CreateDir: directory %s", path.c_str()); |
| 141 | #ifdef _WIN32 | 141 | #ifdef _WIN32 |
| 142 | if (::CreateDirectory(UTF8ToTStr(path).c_str(), NULL)) | 142 | if (::CreateDirectory(Common::UTF8ToTStr(path).c_str(), NULL)) |
| 143 | return true; | 143 | return true; |
| 144 | DWORD error = GetLastError(); | 144 | DWORD error = GetLastError(); |
| 145 | if (error == ERROR_ALREADY_EXISTS) | 145 | if (error == ERROR_ALREADY_EXISTS) |
| @@ -218,7 +218,7 @@ bool DeleteDir(const std::string &filename) | |||
| 218 | } | 218 | } |
| 219 | 219 | ||
| 220 | #ifdef _WIN32 | 220 | #ifdef _WIN32 |
| 221 | if (::RemoveDirectory(UTF8ToTStr(filename).c_str())) | 221 | if (::RemoveDirectory(Common::UTF8ToTStr(filename).c_str())) |
| 222 | return true; | 222 | return true; |
| 223 | #else | 223 | #else |
| 224 | if (rmdir(filename.c_str()) == 0) | 224 | if (rmdir(filename.c_str()) == 0) |
| @@ -247,7 +247,7 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename) | |||
| 247 | INFO_LOG(COMMON, "Copy: %s --> %s", | 247 | INFO_LOG(COMMON, "Copy: %s --> %s", |
| 248 | srcFilename.c_str(), destFilename.c_str()); | 248 | srcFilename.c_str(), destFilename.c_str()); |
| 249 | #ifdef _WIN32 | 249 | #ifdef _WIN32 |
| 250 | if (CopyFile(UTF8ToTStr(srcFilename).c_str(), UTF8ToTStr(destFilename).c_str(), FALSE)) | 250 | if (CopyFile(Common::UTF8ToTStr(srcFilename).c_str(), Common::UTF8ToTStr(destFilename).c_str(), FALSE)) |
| 251 | return true; | 251 | return true; |
| 252 | 252 | ||
| 253 | ERROR_LOG(COMMON, "Copy: failed %s --> %s: %s", | 253 | ERROR_LOG(COMMON, "Copy: failed %s --> %s: %s", |
| @@ -335,7 +335,7 @@ u64 GetSize(const std::string &filename) | |||
| 335 | 335 | ||
| 336 | struct stat64 buf; | 336 | struct stat64 buf; |
| 337 | #ifdef _WIN32 | 337 | #ifdef _WIN32 |
| 338 | if (_tstat64(UTF8ToTStr(filename).c_str(), &buf) == 0) | 338 | if (_tstat64(Common::UTF8ToTStr(filename).c_str(), &buf) == 0) |
| 339 | #else | 339 | #else |
| 340 | if (stat64(filename.c_str(), &buf) == 0) | 340 | if (stat64(filename.c_str(), &buf) == 0) |
| 341 | #endif | 341 | #endif |
| @@ -408,7 +408,7 @@ u32 ScanDirectoryTree(const std::string &directory, FSTEntry& parentEntry) | |||
| 408 | // Find the first file in the directory. | 408 | // Find the first file in the directory. |
| 409 | WIN32_FIND_DATA ffd; | 409 | WIN32_FIND_DATA ffd; |
| 410 | 410 | ||
| 411 | HANDLE hFind = FindFirstFile(UTF8ToTStr(directory + "\\*").c_str(), &ffd); | 411 | HANDLE hFind = FindFirstFile(Common::UTF8ToTStr(directory + "\\*").c_str(), &ffd); |
| 412 | if (hFind == INVALID_HANDLE_VALUE) | 412 | if (hFind == INVALID_HANDLE_VALUE) |
| 413 | { | 413 | { |
| 414 | FindClose(hFind); | 414 | FindClose(hFind); |
| @@ -418,7 +418,7 @@ u32 ScanDirectoryTree(const std::string &directory, FSTEntry& parentEntry) | |||
| 418 | do | 418 | do |
| 419 | { | 419 | { |
| 420 | FSTEntry entry; | 420 | FSTEntry entry; |
| 421 | const std::string virtualName(TStrToUTF8(ffd.cFileName)); | 421 | const std::string virtualName(Common::TStrToUTF8(ffd.cFileName)); |
| 422 | #else | 422 | #else |
| 423 | struct dirent dirent, *result = NULL; | 423 | struct dirent dirent, *result = NULL; |
| 424 | 424 | ||
| @@ -475,7 +475,7 @@ bool DeleteDirRecursively(const std::string &directory) | |||
| 475 | #ifdef _WIN32 | 475 | #ifdef _WIN32 |
| 476 | // Find the first file in the directory. | 476 | // Find the first file in the directory. |
| 477 | WIN32_FIND_DATA ffd; | 477 | WIN32_FIND_DATA ffd; |
| 478 | HANDLE hFind = FindFirstFile(UTF8ToTStr(directory + "\\*").c_str(), &ffd); | 478 | HANDLE hFind = FindFirstFile(Common::UTF8ToTStr(directory + "\\*").c_str(), &ffd); |
| 479 | 479 | ||
| 480 | if (hFind == INVALID_HANDLE_VALUE) | 480 | if (hFind == INVALID_HANDLE_VALUE) |
| 481 | { | 481 | { |
| @@ -486,7 +486,7 @@ bool DeleteDirRecursively(const std::string &directory) | |||
| 486 | // windows loop | 486 | // windows loop |
| 487 | do | 487 | do |
| 488 | { | 488 | { |
| 489 | const std::string virtualName(TStrToUTF8(ffd.cFileName)); | 489 | const std::string virtualName(Common::TStrToUTF8(ffd.cFileName)); |
| 490 | #else | 490 | #else |
| 491 | struct dirent dirent, *result = NULL; | 491 | struct dirent dirent, *result = NULL; |
| 492 | DIR *dirp = opendir(directory.c_str()); | 492 | DIR *dirp = opendir(directory.c_str()); |
| @@ -624,7 +624,7 @@ std::string& GetExeDirectory() | |||
| 624 | { | 624 | { |
| 625 | TCHAR Dolphin_exe_Path[2048]; | 625 | TCHAR Dolphin_exe_Path[2048]; |
| 626 | GetModuleFileName(NULL, Dolphin_exe_Path, 2048); | 626 | GetModuleFileName(NULL, Dolphin_exe_Path, 2048); |
| 627 | DolphinPath = TStrToUTF8(Dolphin_exe_Path); | 627 | DolphinPath = Common::TStrToUTF8(Dolphin_exe_Path); |
| 628 | DolphinPath = DolphinPath.substr(0, DolphinPath.find_last_of('\\')); | 628 | DolphinPath = DolphinPath.substr(0, DolphinPath.find_last_of('\\')); |
| 629 | } | 629 | } |
| 630 | return DolphinPath; | 630 | return DolphinPath; |
| @@ -819,7 +819,7 @@ bool IOFile::Open(const std::string& filename, const char openmode[]) | |||
| 819 | { | 819 | { |
| 820 | Close(); | 820 | Close(); |
| 821 | #ifdef _WIN32 | 821 | #ifdef _WIN32 |
| 822 | _tfopen_s(&m_file, UTF8ToTStr(filename).c_str(), UTF8ToTStr(openmode).c_str()); | 822 | _tfopen_s(&m_file, Common::UTF8ToTStr(filename).c_str(), Common::UTF8ToTStr(openmode).c_str()); |
| 823 | #else | 823 | #else |
| 824 | m_file = fopen(filename.c_str(), openmode); | 824 | m_file = fopen(filename.c_str(), openmode); |
| 825 | #endif | 825 | #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 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 | |||
| 120 | if (!log->IsEnabled() || level > log->GetLevel() || ! log->HasListeners()) | 120 | if (!log->IsEnabled() || level > log->GetLevel() || ! log->HasListeners()) |
| 121 | return; | 121 | return; |
| 122 | 122 | ||
| 123 | CharArrayFromFormatV(temp, MAX_MSGLEN, fmt, args); | 123 | Common::CharArrayFromFormatV(temp, MAX_MSGLEN, fmt, args); |
| 124 | 124 | ||
| 125 | static const char level_to_char[7] = "ONEWID"; | 125 | static const char level_to_char[7] = "ONEWID"; |
| 126 | sprintf(msg, "%s %s:%u %c[%s] %s: %s\n", Common::Timer::GetTimeFormatted().c_str(), file, line, | 126 | 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) | |||
| 139 | // a bit more. | 139 | // a bit more. |
| 140 | for (int i = 0; i < 10000; i++) | 140 | for (int i = 0; i < 10000; i++) |
| 141 | { | 141 | { |
| 142 | std::string file_name = StringFromFormat("/citramem.%d", i); | 142 | std::string file_name = Common::StringFromFormat("/citramem.%d", i); |
| 143 | fd = shm_open(file_name.c_str(), O_RDWR | O_CREAT | O_EXCL, 0600); | 143 | fd = shm_open(file_name.c_str(), O_RDWR | O_CREAT | O_EXCL, 0600); |
| 144 | if (fd != -1) | 144 | if (fd != -1) |
| 145 | { | 145 | { |
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() | |||
| 187 | if (NULL == hProcess) return "MemUsage Error"; | 187 | if (NULL == hProcess) return "MemUsage Error"; |
| 188 | 188 | ||
| 189 | if (GetProcessMemoryInfo(hProcess, &pmc, sizeof(pmc))) | 189 | if (GetProcessMemoryInfo(hProcess, &pmc, sizeof(pmc))) |
| 190 | Ret = StringFromFormat("%s K", ThousandSeparate(pmc.WorkingSetSize / 1024, 7).c_str()); | 190 | Ret = Common::StringFromFormat("%s K", Common::ThousandSeparate(pmc.WorkingSetSize / 1024, 7).c_str()); |
| 191 | 191 | ||
| 192 | CloseHandle(hProcess); | 192 | CloseHandle(hProcess); |
| 193 | return Ret; | 193 | 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 b0c65d47d..9199e30bc 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp | |||
| @@ -13,20 +13,18 @@ | |||
| 13 | #include <iconv.h> | 13 | #include <iconv.h> |
| 14 | #endif | 14 | #endif |
| 15 | 15 | ||
| 16 | namespace Common { | ||
| 17 | |||
| 16 | /// Make a string lowercase | 18 | /// Make a string lowercase |
| 17 | void LowerStr(char* str) { | 19 | std::string ToLower(std::string str) { |
| 18 | for (int i = 0; str[i]; i++) { | 20 | std::transform(str.begin(), str.end(), str.begin(), ::tolower); |
| 19 | str[i] = tolower(str[ i ]); | 21 | return str; |
| 20 | } | ||
| 21 | } | 22 | } |
| 22 | 23 | ||
| 23 | /// Make a string uppercase | 24 | /// Make a string uppercase |
| 24 | void UpperStr(char* str) { | 25 | std::string ToUpper(std::string str) { |
| 25 | for (int i=0; i < strlen(str); i++) { | 26 | std::transform(str.begin(), str.end(), str.begin(), ::toupper); |
| 26 | if(str[i] >= 'a' && str[i] <= 'z') { | 27 | return str; |
| 27 | str[i] &= 0xDF; | ||
| 28 | } | ||
| 29 | } | ||
| 30 | } | 28 | } |
| 31 | 29 | ||
| 32 | // faster than sscanf | 30 | // faster than sscanf |
| @@ -546,3 +544,5 @@ std::string UTF16ToUTF8(const std::wstring& input) | |||
| 546 | } | 544 | } |
| 547 | 545 | ||
| 548 | #endif | 546 | #endif |
| 547 | |||
| 548 | } | ||
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 @@ | |||
| 12 | 12 | ||
| 13 | #include "common/common.h" | 13 | #include "common/common.h" |
| 14 | 14 | ||
| 15 | namespace Common { | ||
| 16 | |||
| 15 | /// Make a string lowercase | 17 | /// Make a string lowercase |
| 16 | void LowerStr(char* str); | 18 | std::string ToLower(std::string str); |
| 17 | 19 | ||
| 18 | /// Make a string uppercase | 20 | /// Make a string uppercase |
| 19 | void UpperStr(char* str); | 21 | std::string ToUpper(std::string str); |
| 20 | 22 | ||
| 21 | std::string StringFromFormat(const char* format, ...); | 23 | std::string StringFromFormat(const char* format, ...); |
| 22 | // Cheap! | 24 | // Cheap! |
| @@ -111,3 +113,5 @@ inline std::string UTF8ToTStr(const std::string& str) | |||
| 111 | #endif | 113 | #endif |
| 112 | 114 | ||
| 113 | #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 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 | |||
| 218 | TSymbol symbol = Symbols::GetSymbol(entry_point); | 218 | TSymbol symbol = Symbols::GetSymbol(entry_point); |
| 219 | name = symbol.name; | 219 | name = symbol.name; |
| 220 | } else { | 220 | } else { |
| 221 | name = StringFromFormat("unknown-%08x", entry_point); | 221 | name = Common::StringFromFormat("unknown-%08x", entry_point); |
| 222 | } | 222 | } |
| 223 | 223 | ||
| 224 | Handle thread = Kernel::CreateThread(name.c_str(), entry_point, priority, arg, processor_id, | 224 | 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) { | |||
| 25 | ERROR_LOG(LOADER, "invalid filename %s", filename.c_str()); | 25 | ERROR_LOG(LOADER, "invalid filename %s", filename.c_str()); |
| 26 | return FileType::Error; | 26 | return FileType::Error; |
| 27 | } | 27 | } |
| 28 | std::string extension = filename.size() >= 5 ? filename.substr(filename.size() - 4) : ""; | ||
| 29 | 28 | ||
| 30 | if (!strcasecmp(extension.c_str(), ".elf")) { | 29 | size_t extension_loc = filename.find_last_of('.'); |
| 31 | return FileType::ELF; // TODO(bunnei): Do some filetype checking :p | 30 | if (extension_loc == std::string::npos) |
| 32 | } | 31 | return FileType::Unknown; |
| 33 | else if (!strcasecmp(extension.c_str(), ".axf")) { | 32 | std::string extension = Common::ToLower(filename.substr(extension_loc)); |
| 34 | return FileType::ELF; // TODO(bunnei): Do some filetype checking :p | 33 | |
| 35 | } | 34 | // TODO(bunnei): Do actual filetype checking instead of naively checking the extension |
| 36 | else if (!strcasecmp(extension.c_str(), ".cxi")) { | 35 | if (extension == ".elf") { |
| 37 | return FileType::CXI; // TODO(bunnei): Do some filetype checking :p | 36 | return FileType::ELF; |
| 38 | } | 37 | } else if (extension == ".axf") { |
| 39 | else if (!strcasecmp(extension.c_str(), ".cci")) { | 38 | return FileType::ELF; |
| 40 | return FileType::CCI; // TODO(bunnei): Do some filetype checking :p | 39 | } else if (extension == ".cxi") { |
| 41 | } | 40 | return FileType::CXI; |
| 42 | else if (!strcasecmp(extension.c_str(), ".bin")) { | 41 | } else if (extension == ".cci") { |
| 43 | return FileType::BIN; // TODO(bunnei): Do some filetype checking :p | 42 | return FileType::CCI; |
| 43 | } else if (extension == ".bin") { | ||
| 44 | return FileType::BIN; | ||
| 44 | } | 45 | } |
| 45 | return FileType::Unknown; | 46 | return FileType::Unknown; |
| 46 | } | 47 | } |
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() { | |||
| 77 | // | 77 | // |
| 78 | // TODO(princesspeachum): (related to above^) this should only be called when there's new data, not every frame. | 78 | // TODO(princesspeachum): (related to above^) this should only be called when there's new data, not every frame. |
| 79 | // Currently this uploads data that shouldn't have changed. | 79 | // Currently this uploads data that shouldn't have changed. |
| 80 | common::Rect framebuffer_size(0, 0, resolution_width, resolution_height); | 80 | Common::Rect framebuffer_size(0, 0, resolution_width, resolution_height); |
| 81 | RenderXFB(framebuffer_size, framebuffer_size); | 81 | RenderXFB(framebuffer_size, framebuffer_size); |
| 82 | 82 | ||
| 83 | // XFB->Window copy | 83 | // XFB->Window copy |
| @@ -113,7 +113,7 @@ void RendererOpenGL::FlipFramebuffer(const u8* raw_data, ScreenInfo& screen_info | |||
| 113 | * @param src_rect Source rectangle in XFB to copy | 113 | * @param src_rect Source rectangle in XFB to copy |
| 114 | * @param dst_rect Destination rectangle in output framebuffer to copy to | 114 | * @param dst_rect Destination rectangle in output framebuffer to copy to |
| 115 | */ | 115 | */ |
| 116 | void RendererOpenGL::RenderXFB(const common::Rect& src_rect, const common::Rect& dst_rect) { | 116 | void RendererOpenGL::RenderXFB(const Common::Rect& src_rect, const Common::Rect& dst_rect) { |
| 117 | const auto& framebuffer_top = GPU::g_regs.framebuffer_config[0]; | 117 | const auto& framebuffer_top = GPU::g_regs.framebuffer_config[0]; |
| 118 | const auto& framebuffer_sub = GPU::g_regs.framebuffer_config[1]; | 118 | const auto& framebuffer_sub = GPU::g_regs.framebuffer_config[1]; |
| 119 | const u32 active_fb_top = (framebuffer_top.active_fb == 1) | 119 | 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: | |||
| 27 | * @param src_rect Source rectangle in XFB to copy | 27 | * @param src_rect Source rectangle in XFB to copy |
| 28 | * @param dst_rect Destination rectangle in output framebuffer to copy to | 28 | * @param dst_rect Destination rectangle in output framebuffer to copy to |
| 29 | */ | 29 | */ |
| 30 | void RenderXFB(const common::Rect& src_rect, const common::Rect& dst_rect); | 30 | void RenderXFB(const Common::Rect& src_rect, const Common::Rect& dst_rect); |
| 31 | 31 | ||
| 32 | /** | 32 | /** |
| 33 | * Set the emulator window to use for renderer | 33 | * Set the emulator window to use for renderer |