diff options
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/chunk_file.h | 14 | ||||
| -rw-r--r-- | src/common/common_funcs.h | 14 | ||||
| -rw-r--r-- | src/common/common_types.h | 2 | ||||
| -rw-r--r-- | src/common/console_listener.cpp | 24 | ||||
| -rw-r--r-- | src/common/extended_trace.cpp | 26 | ||||
| -rw-r--r-- | src/common/fifo_queue.h | 2 | ||||
| -rw-r--r-- | src/common/file_search.cpp | 2 | ||||
| -rw-r--r-- | src/common/file_util.cpp | 62 | ||||
| -rw-r--r-- | src/common/hash.cpp | 32 | ||||
| -rw-r--r-- | src/common/linear_disk_cache.h | 6 | ||||
| -rw-r--r-- | src/common/log.h | 6 | ||||
| -rw-r--r-- | src/common/log_manager.cpp | 10 | ||||
| -rw-r--r-- | src/common/log_manager.h | 4 | ||||
| -rw-r--r-- | src/common/math_util.cpp | 14 | ||||
| -rw-r--r-- | src/common/mem_arena.cpp | 10 | ||||
| -rw-r--r-- | src/common/memory_util.cpp | 8 | ||||
| -rw-r--r-- | src/common/msg_handler.h | 42 | ||||
| -rw-r--r-- | src/common/string_util.cpp | 18 | ||||
| -rw-r--r-- | src/common/string_util.h | 2 | ||||
| -rw-r--r-- | src/common/symbols.cpp | 4 | ||||
| -rw-r--r-- | src/common/thread.cpp | 6 | ||||
| -rw-r--r-- | src/common/thread.h | 8 | ||||
| -rw-r--r-- | src/common/thread_queue_list.h | 4 |
23 files changed, 160 insertions, 160 deletions
diff --git a/src/common/chunk_file.h b/src/common/chunk_file.h index dc8ac1fd9..609784076 100644 --- a/src/common/chunk_file.h +++ b/src/common/chunk_file.h | |||
| @@ -51,7 +51,7 @@ public: | |||
| 51 | PointerWrapSection(PointerWrap &p, int ver, const char *title) : p_(p), ver_(ver), title_(title) { | 51 | PointerWrapSection(PointerWrap &p, int ver, const char *title) : p_(p), ver_(ver), title_(title) { |
| 52 | } | 52 | } |
| 53 | ~PointerWrapSection(); | 53 | ~PointerWrapSection(); |
| 54 | 54 | ||
| 55 | bool operator == (const int &v) const { return ver_ == v; } | 55 | bool operator == (const int &v) const { return ver_ == v; } |
| 56 | bool operator != (const int &v) const { return ver_ != v; } | 56 | bool operator != (const int &v) const { return ver_ != v; } |
| 57 | bool operator <= (const int &v) const { return ver_ <= v; } | 57 | bool operator <= (const int &v) const { return ver_ <= v; } |
| @@ -196,7 +196,7 @@ public: | |||
| 196 | } | 196 | } |
| 197 | (*ptr) += size; | 197 | (*ptr) += size; |
| 198 | } | 198 | } |
| 199 | 199 | ||
| 200 | template<class K, class T> | 200 | template<class K, class T> |
| 201 | void Do(std::map<K, T *> &x) | 201 | void Do(std::map<K, T *> &x) |
| 202 | { | 202 | { |
| @@ -364,7 +364,7 @@ public: | |||
| 364 | if (vec_size > 0) | 364 | if (vec_size > 0) |
| 365 | DoArray(&x[0], vec_size); | 365 | DoArray(&x[0], vec_size); |
| 366 | } | 366 | } |
| 367 | 367 | ||
| 368 | // Store deques. | 368 | // Store deques. |
| 369 | template<class T> | 369 | template<class T> |
| 370 | void Do(std::deque<T *> &x) | 370 | void Do(std::deque<T *> &x) |
| @@ -481,11 +481,11 @@ public: | |||
| 481 | } | 481 | } |
| 482 | 482 | ||
| 483 | // Store strings. | 483 | // Store strings. |
| 484 | void Do(std::string &x) | 484 | void Do(std::string &x) |
| 485 | { | 485 | { |
| 486 | int stringLen = (int)x.length() + 1; | 486 | int stringLen = (int)x.length() + 1; |
| 487 | Do(stringLen); | 487 | Do(stringLen); |
| 488 | 488 | ||
| 489 | switch (mode) { | 489 | switch (mode) { |
| 490 | case MODE_READ: x = (char*)*ptr; break; | 490 | case MODE_READ: x = (char*)*ptr; break; |
| 491 | case MODE_WRITE: memcpy(*ptr, x.c_str(), stringLen); break; | 491 | case MODE_WRITE: memcpy(*ptr, x.c_str(), stringLen); break; |
| @@ -495,7 +495,7 @@ public: | |||
| 495 | (*ptr) += stringLen; | 495 | (*ptr) += stringLen; |
| 496 | } | 496 | } |
| 497 | 497 | ||
| 498 | void Do(std::wstring &x) | 498 | void Do(std::wstring &x) |
| 499 | { | 499 | { |
| 500 | int stringLen = sizeof(wchar_t)*((int)x.length() + 1); | 500 | int stringLen = sizeof(wchar_t)*((int)x.length() + 1); |
| 501 | Do(stringLen); | 501 | Do(stringLen); |
| @@ -534,7 +534,7 @@ public: | |||
| 534 | void Do(T &x) { | 534 | void Do(T &x) { |
| 535 | DoHelper<T>::Do(this, x); | 535 | DoHelper<T>::Do(this, x); |
| 536 | } | 536 | } |
| 537 | 537 | ||
| 538 | template<class T> | 538 | template<class T> |
| 539 | void DoPOD(T &x) { | 539 | void DoPOD(T &x) { |
| 540 | DoHelper<T>::Do(this, x); | 540 | DoHelper<T>::Do(this, x); |
diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h index c18afe119..d84ec4c42 100644 --- a/src/common/common_funcs.h +++ b/src/common/common_funcs.h | |||
| @@ -17,7 +17,7 @@ template<> struct CompileTimeAssert<true> {}; | |||
| 17 | #define b2(x) ( (x) | ( (x) >> 1) ) | 17 | #define b2(x) ( (x) | ( (x) >> 1) ) |
| 18 | #define b4(x) ( b2(x) | ( b2(x) >> 2) ) | 18 | #define b4(x) ( b2(x) | ( b2(x) >> 2) ) |
| 19 | #define b8(x) ( b4(x) | ( b4(x) >> 4) ) | 19 | #define b8(x) ( b4(x) | ( b4(x) >> 4) ) |
| 20 | #define b16(x) ( b8(x) | ( b8(x) >> 8) ) | 20 | #define b16(x) ( b8(x) | ( b8(x) >> 8) ) |
| 21 | #define b32(x) (b16(x) | (b16(x) >>16) ) | 21 | #define b32(x) (b16(x) | (b16(x) >>16) ) |
| 22 | #define ROUND_UP_POW2(x) (b32(x - 1) + 1) | 22 | #define ROUND_UP_POW2(x) (b32(x - 1) + 1) |
| 23 | 23 | ||
| @@ -79,12 +79,12 @@ inline u64 _rotr64(u64 x, unsigned int shift){ | |||
| 79 | #define unlink _unlink | 79 | #define unlink _unlink |
| 80 | #define snprintf _snprintf | 80 | #define snprintf _snprintf |
| 81 | #define vscprintf _vscprintf | 81 | #define vscprintf _vscprintf |
| 82 | 82 | ||
| 83 | // Locale Cross-Compatibility | 83 | // Locale Cross-Compatibility |
| 84 | #define locale_t _locale_t | 84 | #define locale_t _locale_t |
| 85 | #define freelocale _free_locale | 85 | #define freelocale _free_locale |
| 86 | #define newlocale(mask, locale, base) _create_locale(mask, locale) | 86 | #define newlocale(mask, locale, base) _create_locale(mask, locale) |
| 87 | 87 | ||
| 88 | #define LC_GLOBAL_LOCALE ((locale_t)-1) | 88 | #define LC_GLOBAL_LOCALE ((locale_t)-1) |
| 89 | #define LC_ALL_MASK LC_ALL | 89 | #define LC_ALL_MASK LC_ALL |
| 90 | #define LC_COLLATE_MASK LC_COLLATE | 90 | #define LC_COLLATE_MASK LC_COLLATE |
| @@ -92,7 +92,7 @@ inline u64 _rotr64(u64 x, unsigned int shift){ | |||
| 92 | #define LC_MONETARY_MASK LC_MONETARY | 92 | #define LC_MONETARY_MASK LC_MONETARY |
| 93 | #define LC_NUMERIC_MASK LC_NUMERIC | 93 | #define LC_NUMERIC_MASK LC_NUMERIC |
| 94 | #define LC_TIME_MASK LC_TIME | 94 | #define LC_TIME_MASK LC_TIME |
| 95 | 95 | ||
| 96 | inline locale_t uselocale(locale_t new_locale) | 96 | inline locale_t uselocale(locale_t new_locale) |
| 97 | { | 97 | { |
| 98 | // Retrieve the current per thread locale setting | 98 | // Retrieve the current per thread locale setting |
| @@ -168,8 +168,8 @@ inline u16 swap16(u16 _data) {return _byteswap_ushort(_data);} | |||
| 168 | inline u32 swap32(u32 _data) {return _byteswap_ulong (_data);} | 168 | inline u32 swap32(u32 _data) {return _byteswap_ulong (_data);} |
| 169 | inline u64 swap64(u64 _data) {return _byteswap_uint64(_data);} | 169 | inline u64 swap64(u64 _data) {return _byteswap_uint64(_data);} |
| 170 | #elif _M_ARM | 170 | #elif _M_ARM |
| 171 | inline u16 swap16 (u16 _data) { u32 data = _data; __asm__ ("rev16 %0, %1\n" : "=l" (data) : "l" (data)); return (u16)data;} | 171 | inline u16 swap16 (u16 _data) { u32 data = _data; __asm__ ("rev16 %0, %1\n" : "=l" (data) : "l" (data)); return (u16)data;} |
| 172 | inline u32 swap32 (u32 _data) {__asm__ ("rev %0, %1\n" : "=l" (_data) : "l" (_data)); return _data;} | 172 | inline u32 swap32 (u32 _data) {__asm__ ("rev %0, %1\n" : "=l" (_data) : "l" (_data)); return _data;} |
| 173 | inline u64 swap64(u64 _data) {return ((u64)swap32(_data) << 32) | swap32(_data >> 32);} | 173 | inline u64 swap64(u64 _data) {return ((u64)swap32(_data) << 32) | swap32(_data >> 32);} |
| 174 | #elif __linux__ | 174 | #elif __linux__ |
| 175 | inline u16 swap16(u16 _data) {return bswap_16(_data);} | 175 | inline u16 swap16(u16 _data) {return bswap_16(_data);} |
| @@ -226,7 +226,7 @@ template <typename T> | |||
| 226 | inline T FromBigEndian(T data) | 226 | inline T FromBigEndian(T data) |
| 227 | { | 227 | { |
| 228 | //static_assert(std::is_arithmetic<T>::value, "function only makes sense with arithmetic types"); | 228 | //static_assert(std::is_arithmetic<T>::value, "function only makes sense with arithmetic types"); |
| 229 | 229 | ||
| 230 | swap<sizeof(data)>(reinterpret_cast<u8*>(&data)); | 230 | swap<sizeof(data)>(reinterpret_cast<u8*>(&data)); |
| 231 | return data; | 231 | return data; |
| 232 | } | 232 | } |
diff --git a/src/common/common_types.h b/src/common/common_types.h index 7ce6b2240..6d432e462 100644 --- a/src/common/common_types.h +++ b/src/common/common_types.h | |||
| @@ -22,7 +22,7 @@ | |||
| 22 | * http://code.google.com/p/gekko-gc-emu/ | 22 | * http://code.google.com/p/gekko-gc-emu/ |
| 23 | */ | 23 | */ |
| 24 | 24 | ||
| 25 | #pragma once | 25 | #pragma once |
| 26 | 26 | ||
| 27 | #include <cmath> | 27 | #include <cmath> |
| 28 | #include <cstdint> | 28 | #include <cstdint> |
diff --git a/src/common/console_listener.cpp b/src/common/console_listener.cpp index 53f20d754..d7f27c358 100644 --- a/src/common/console_listener.cpp +++ b/src/common/console_listener.cpp | |||
| @@ -86,7 +86,7 @@ bool ConsoleListener::IsOpen() | |||
| 86 | 86 | ||
| 87 | /* | 87 | /* |
| 88 | LetterSpace: SetConsoleScreenBufferSize and SetConsoleWindowInfo are | 88 | LetterSpace: SetConsoleScreenBufferSize and SetConsoleWindowInfo are |
| 89 | dependent on each other, that's the reason for the additional checks. | 89 | dependent on each other, that's the reason for the additional checks. |
| 90 | */ | 90 | */ |
| 91 | void ConsoleListener::BufferWidthHeight(int BufferWidth, int BufferHeight, int ScreenWidth, int ScreenHeight, bool BufferFirst) | 91 | void ConsoleListener::BufferWidthHeight(int BufferWidth, int BufferHeight, int ScreenWidth, int ScreenHeight, bool BufferFirst) |
| 92 | { | 92 | { |
| @@ -225,7 +225,7 @@ void ConsoleListener::PixelSpace(int Left, int Top, int Width, int Height, bool | |||
| 225 | 225 | ||
| 226 | BytesWritten += cAttrWritten; | 226 | BytesWritten += cAttrWritten; |
| 227 | coordScreen = GetCoordinates(BytesWritten, LBufWidth); | 227 | coordScreen = GetCoordinates(BytesWritten, LBufWidth); |
| 228 | } | 228 | } |
| 229 | 229 | ||
| 230 | const int OldCursor = ConInfo.dwCursorPosition.Y * ConInfo.dwSize.X + ConInfo.dwCursorPosition.X; | 230 | const int OldCursor = ConInfo.dwCursorPosition.Y * ConInfo.dwSize.X + ConInfo.dwCursorPosition.X; |
| 231 | COORD Coo = GetCoordinates(OldCursor, LBufWidth); | 231 | COORD Coo = GetCoordinates(OldCursor, LBufWidth); |
| @@ -296,23 +296,23 @@ void ConsoleListener::Log(LogTypes::LOG_LEVELS Level, const char *Text) | |||
| 296 | } | 296 | } |
| 297 | // Clear console screen | 297 | // Clear console screen |
| 298 | void ConsoleListener::ClearScreen(bool Cursor) | 298 | void ConsoleListener::ClearScreen(bool Cursor) |
| 299 | { | 299 | { |
| 300 | #if defined(_WIN32) | 300 | #if defined(_WIN32) |
| 301 | COORD coordScreen = { 0, 0 }; | 301 | COORD coordScreen = { 0, 0 }; |
| 302 | DWORD cCharsWritten; | 302 | DWORD cCharsWritten; |
| 303 | CONSOLE_SCREEN_BUFFER_INFO csbi; | 303 | CONSOLE_SCREEN_BUFFER_INFO csbi; |
| 304 | DWORD dwConSize; | 304 | DWORD dwConSize; |
| 305 | 305 | ||
| 306 | HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); | 306 | HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); |
| 307 | 307 | ||
| 308 | GetConsoleScreenBufferInfo(hConsole, &csbi); | 308 | GetConsoleScreenBufferInfo(hConsole, &csbi); |
| 309 | dwConSize = csbi.dwSize.X * csbi.dwSize.Y; | 309 | dwConSize = csbi.dwSize.X * csbi.dwSize.Y; |
| 310 | // Write space to the entire console | 310 | // Write space to the entire console |
| 311 | FillConsoleOutputCharacter(hConsole, TEXT(' '), dwConSize, coordScreen, &cCharsWritten); | 311 | FillConsoleOutputCharacter(hConsole, TEXT(' '), dwConSize, coordScreen, &cCharsWritten); |
| 312 | GetConsoleScreenBufferInfo(hConsole, &csbi); | 312 | GetConsoleScreenBufferInfo(hConsole, &csbi); |
| 313 | FillConsoleOutputAttribute(hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten); | 313 | FillConsoleOutputAttribute(hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten); |
| 314 | // Reset cursor | 314 | // Reset cursor |
| 315 | if (Cursor) SetConsoleCursorPosition(hConsole, coordScreen); | 315 | if (Cursor) SetConsoleCursorPosition(hConsole, coordScreen); |
| 316 | #endif | 316 | #endif |
| 317 | } | 317 | } |
| 318 | 318 | ||
diff --git a/src/common/extended_trace.cpp b/src/common/extended_trace.cpp index 9cd0398ed..bf61ac1d1 100644 --- a/src/common/extended_trace.cpp +++ b/src/common/extended_trace.cpp | |||
| @@ -29,7 +29,7 @@ using namespace std; | |||
| 29 | void PCSTR2LPTSTR( PCSTR lpszIn, LPTSTR lpszOut ) | 29 | void PCSTR2LPTSTR( PCSTR lpszIn, LPTSTR lpszOut ) |
| 30 | { | 30 | { |
| 31 | #if defined(UNICODE)||defined(_UNICODE) | 31 | #if defined(UNICODE)||defined(_UNICODE) |
| 32 | ULONG index = 0; | 32 | ULONG index = 0; |
| 33 | PCSTR lpAct = lpszIn; | 33 | PCSTR lpAct = lpszIn; |
| 34 | 34 | ||
| 35 | for( ; ; lpAct++ ) | 35 | for( ; ; lpAct++ ) |
| @@ -37,7 +37,7 @@ void PCSTR2LPTSTR( PCSTR lpszIn, LPTSTR lpszOut ) | |||
| 37 | lpszOut[index++] = (TCHAR)(*lpAct); | 37 | lpszOut[index++] = (TCHAR)(*lpAct); |
| 38 | if ( *lpAct == 0 ) | 38 | if ( *lpAct == 0 ) |
| 39 | break; | 39 | break; |
| 40 | } | 40 | } |
| 41 | #else | 41 | #else |
| 42 | // This is trivial :) | 42 | // This is trivial :) |
| 43 | strcpy( lpszOut, lpszIn ); | 43 | strcpy( lpszOut, lpszIn ); |
| @@ -101,7 +101,7 @@ BOOL InitSymInfo( PCSTR lpszInitialSymbolPath ) | |||
| 101 | CHAR lpszSymbolPath[BUFFERSIZE]; | 101 | CHAR lpszSymbolPath[BUFFERSIZE]; |
| 102 | DWORD symOptions = SymGetOptions(); | 102 | DWORD symOptions = SymGetOptions(); |
| 103 | 103 | ||
| 104 | symOptions |= SYMOPT_LOAD_LINES; | 104 | symOptions |= SYMOPT_LOAD_LINES; |
| 105 | symOptions &= ~SYMOPT_UNDNAME; | 105 | symOptions &= ~SYMOPT_UNDNAME; |
| 106 | SymSetOptions( symOptions ); | 106 | SymSetOptions( symOptions ); |
| 107 | InitSymbolPath( lpszSymbolPath, lpszInitialSymbolPath ); | 107 | InitSymbolPath( lpszSymbolPath, lpszInitialSymbolPath ); |
| @@ -153,15 +153,15 @@ static BOOL GetFunctionInfoFromAddresses( ULONG fnAddress, ULONG stackAddress, L | |||
| 153 | #ifndef _M_X64 | 153 | #ifndef _M_X64 |
| 154 | DWORD dwDisp = 0; | 154 | DWORD dwDisp = 0; |
| 155 | if ( SymGetSymFromAddr( GetCurrentProcess(), (ULONG)fnAddress, &dwDisp, pSym ) ) | 155 | if ( SymGetSymFromAddr( GetCurrentProcess(), (ULONG)fnAddress, &dwDisp, pSym ) ) |
| 156 | #else | 156 | #else |
| 157 | //makes it compile but hell im not sure if this works... | 157 | //makes it compile but hell im not sure if this works... |
| 158 | DWORD64 dwDisp = 0; | 158 | DWORD64 dwDisp = 0; |
| 159 | if ( SymGetSymFromAddr( GetCurrentProcess(), (ULONG)fnAddress, (PDWORD64)&dwDisp, pSym ) ) | 159 | if ( SymGetSymFromAddr( GetCurrentProcess(), (ULONG)fnAddress, (PDWORD64)&dwDisp, pSym ) ) |
| 160 | #endif | 160 | #endif |
| 161 | { | 161 | { |
| 162 | // Make the symbol readable for humans | 162 | // Make the symbol readable for humans |
| 163 | UnDecorateSymbolName( pSym->Name, lpszNonUnicodeUnDSymbol, BUFFERSIZE, | 163 | UnDecorateSymbolName( pSym->Name, lpszNonUnicodeUnDSymbol, BUFFERSIZE, |
| 164 | UNDNAME_COMPLETE | | 164 | UNDNAME_COMPLETE | |
| 165 | UNDNAME_NO_THISTYPE | | 165 | UNDNAME_NO_THISTYPE | |
| 166 | UNDNAME_NO_SPECIAL_SYMS | | 166 | UNDNAME_NO_SPECIAL_SYMS | |
| 167 | UNDNAME_NO_MEMBER_TYPE | | 167 | UNDNAME_NO_MEMBER_TYPE | |
| @@ -219,7 +219,7 @@ static BOOL GetFunctionInfoFromAddresses( ULONG fnAddress, ULONG stackAddress, L | |||
| 219 | _tcscat( lpszSymbol, lpszParsed ); | 219 | _tcscat( lpszSymbol, lpszParsed ); |
| 220 | 220 | ||
| 221 | ret = TRUE; | 221 | ret = TRUE; |
| 222 | } | 222 | } |
| 223 | GlobalFree( pSym ); | 223 | GlobalFree( pSym ); |
| 224 | 224 | ||
| 225 | return ret; | 225 | return ret; |
| @@ -325,14 +325,14 @@ void StackTrace( HANDLE hThread, const char* lpszMessage, FILE *file ) | |||
| 325 | 325 | ||
| 326 | PrintFunctionAndSourceInfo(file, callStack); | 326 | PrintFunctionAndSourceInfo(file, callStack); |
| 327 | 327 | ||
| 328 | for( ULONG index = 0; ; index++ ) | 328 | for( ULONG index = 0; ; index++ ) |
| 329 | { | 329 | { |
| 330 | bResult = StackWalk( | 330 | bResult = StackWalk( |
| 331 | IMAGE_FILE_MACHINE_I386, | 331 | IMAGE_FILE_MACHINE_I386, |
| 332 | hProcess, | 332 | hProcess, |
| 333 | hThread, | 333 | hThread, |
| 334 | &callStack, | 334 | &callStack, |
| 335 | NULL, | 335 | NULL, |
| 336 | NULL, | 336 | NULL, |
| 337 | SymFunctionTableAccess, | 337 | SymFunctionTableAccess, |
| 338 | SymGetModuleBase, | 338 | SymGetModuleBase, |
| @@ -341,7 +341,7 @@ void StackTrace( HANDLE hThread, const char* lpszMessage, FILE *file ) | |||
| 341 | if ( index == 0 ) | 341 | if ( index == 0 ) |
| 342 | continue; | 342 | continue; |
| 343 | 343 | ||
| 344 | if( !bResult || callStack.AddrFrame.Offset == 0 ) | 344 | if( !bResult || callStack.AddrFrame.Offset == 0 ) |
| 345 | break; | 345 | break; |
| 346 | 346 | ||
| 347 | PrintFunctionAndSourceInfo(file, callStack); | 347 | PrintFunctionAndSourceInfo(file, callStack); |
| @@ -382,14 +382,14 @@ void StackTrace(HANDLE hThread, const char* lpszMessage, FILE *file, DWORD eip, | |||
| 382 | 382 | ||
| 383 | PrintFunctionAndSourceInfo(file, callStack); | 383 | PrintFunctionAndSourceInfo(file, callStack); |
| 384 | 384 | ||
| 385 | for( ULONG index = 0; ; index++ ) | 385 | for( ULONG index = 0; ; index++ ) |
| 386 | { | 386 | { |
| 387 | bResult = StackWalk( | 387 | bResult = StackWalk( |
| 388 | IMAGE_FILE_MACHINE_I386, | 388 | IMAGE_FILE_MACHINE_I386, |
| 389 | hProcess, | 389 | hProcess, |
| 390 | hThread, | 390 | hThread, |
| 391 | &callStack, | 391 | &callStack, |
| 392 | NULL, | 392 | NULL, |
| 393 | NULL, | 393 | NULL, |
| 394 | SymFunctionTableAccess, | 394 | SymFunctionTableAccess, |
| 395 | SymGetModuleBase, | 395 | SymGetModuleBase, |
| @@ -398,7 +398,7 @@ void StackTrace(HANDLE hThread, const char* lpszMessage, FILE *file, DWORD eip, | |||
| 398 | if ( index == 0 ) | 398 | if ( index == 0 ) |
| 399 | continue; | 399 | continue; |
| 400 | 400 | ||
| 401 | if( !bResult || callStack.AddrFrame.Offset == 0 ) | 401 | if( !bResult || callStack.AddrFrame.Offset == 0 ) |
| 402 | break; | 402 | break; |
| 403 | 403 | ||
| 404 | PrintFunctionAndSourceInfo(file, callStack); | 404 | PrintFunctionAndSourceInfo(file, callStack); |
diff --git a/src/common/fifo_queue.h b/src/common/fifo_queue.h index 78a8f561d..2c18285d4 100644 --- a/src/common/fifo_queue.h +++ b/src/common/fifo_queue.h | |||
| @@ -45,7 +45,7 @@ public: | |||
| 45 | // create the element, add it to the queue | 45 | // create the element, add it to the queue |
| 46 | m_write_ptr->current = new T(std::forward<Arg>(t)); | 46 | m_write_ptr->current = new T(std::forward<Arg>(t)); |
| 47 | // set the next pointer to a new element ptr | 47 | // set the next pointer to a new element ptr |
| 48 | // then advance the write pointer | 48 | // then advance the write pointer |
| 49 | m_write_ptr = m_write_ptr->next = new ElementPtr(); | 49 | m_write_ptr = m_write_ptr->next = new ElementPtr(); |
| 50 | Common::AtomicIncrement(m_size); | 50 | Common::AtomicIncrement(m_size); |
| 51 | } | 51 | } |
diff --git a/src/common/file_search.cpp b/src/common/file_search.cpp index 63580f688..bfb54ce72 100644 --- a/src/common/file_search.cpp +++ b/src/common/file_search.cpp | |||
| @@ -43,7 +43,7 @@ void CFileSearch::FindFiles(const std::string& _searchString, const std::string& | |||
| 43 | bool bkeepLooping = true; | 43 | bool bkeepLooping = true; |
| 44 | 44 | ||
| 45 | while (bkeepLooping) | 45 | while (bkeepLooping) |
| 46 | { | 46 | { |
| 47 | if (findData.cFileName[0] != '.') | 47 | if (findData.cFileName[0] != '.') |
| 48 | { | 48 | { |
| 49 | std::string strFilename; | 49 | std::string strFilename; |
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index 35da07306..b6dec838c 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp | |||
| @@ -88,7 +88,7 @@ bool IsDirectory(const std::string &filename) | |||
| 88 | #endif | 88 | #endif |
| 89 | 89 | ||
| 90 | if (result < 0) { | 90 | if (result < 0) { |
| 91 | WARN_LOG(COMMON, "IsDirectory: stat failed on %s: %s", | 91 | WARN_LOG(COMMON, "IsDirectory: stat failed on %s: %s", |
| 92 | filename.c_str(), GetLastErrorMsg()); | 92 | filename.c_str(), GetLastErrorMsg()); |
| 93 | return false; | 93 | return false; |
| 94 | } | 94 | } |
| @@ -102,7 +102,7 @@ bool Delete(const std::string &filename) | |||
| 102 | { | 102 | { |
| 103 | INFO_LOG(COMMON, "Delete: file %s", filename.c_str()); | 103 | INFO_LOG(COMMON, "Delete: file %s", filename.c_str()); |
| 104 | 104 | ||
| 105 | // Return true because we care about the file no | 105 | // Return true because we care about the file no |
| 106 | // being there, not the actual delete. | 106 | // being there, not the actual delete. |
| 107 | if (!Exists(filename)) | 107 | if (!Exists(filename)) |
| 108 | { | 108 | { |
| @@ -120,13 +120,13 @@ bool Delete(const std::string &filename) | |||
| 120 | #ifdef _WIN32 | 120 | #ifdef _WIN32 |
| 121 | if (!DeleteFile(Common::UTF8ToTStr(filename).c_str())) | 121 | if (!DeleteFile(Common::UTF8ToTStr(filename).c_str())) |
| 122 | { | 122 | { |
| 123 | WARN_LOG(COMMON, "Delete: DeleteFile failed on %s: %s", | 123 | WARN_LOG(COMMON, "Delete: DeleteFile failed on %s: %s", |
| 124 | filename.c_str(), GetLastErrorMsg()); | 124 | filename.c_str(), GetLastErrorMsg()); |
| 125 | return false; | 125 | return false; |
| 126 | } | 126 | } |
| 127 | #else | 127 | #else |
| 128 | if (unlink(filename.c_str()) == -1) { | 128 | if (unlink(filename.c_str()) == -1) { |
| 129 | WARN_LOG(COMMON, "Delete: unlink failed on %s: %s", | 129 | WARN_LOG(COMMON, "Delete: unlink failed on %s: %s", |
| 130 | filename.c_str(), GetLastErrorMsg()); | 130 | filename.c_str(), GetLastErrorMsg()); |
| 131 | return false; | 131 | return false; |
| 132 | } | 132 | } |
| @@ -232,28 +232,28 @@ bool DeleteDir(const std::string &filename) | |||
| 232 | return false; | 232 | return false; |
| 233 | } | 233 | } |
| 234 | 234 | ||
| 235 | // renames file srcFilename to destFilename, returns true on success | 235 | // renames file srcFilename to destFilename, returns true on success |
| 236 | bool Rename(const std::string &srcFilename, const std::string &destFilename) | 236 | bool Rename(const std::string &srcFilename, const std::string &destFilename) |
| 237 | { | 237 | { |
| 238 | INFO_LOG(COMMON, "Rename: %s --> %s", | 238 | INFO_LOG(COMMON, "Rename: %s --> %s", |
| 239 | srcFilename.c_str(), destFilename.c_str()); | 239 | srcFilename.c_str(), destFilename.c_str()); |
| 240 | if (rename(srcFilename.c_str(), destFilename.c_str()) == 0) | 240 | if (rename(srcFilename.c_str(), destFilename.c_str()) == 0) |
| 241 | return true; | 241 | return true; |
| 242 | ERROR_LOG(COMMON, "Rename: failed %s --> %s: %s", | 242 | ERROR_LOG(COMMON, "Rename: failed %s --> %s: %s", |
| 243 | srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); | 243 | srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); |
| 244 | return false; | 244 | return false; |
| 245 | } | 245 | } |
| 246 | 246 | ||
| 247 | // copies file srcFilename to destFilename, returns true on success | 247 | // copies file srcFilename to destFilename, returns true on success |
| 248 | bool Copy(const std::string &srcFilename, const std::string &destFilename) | 248 | bool Copy(const std::string &srcFilename, const std::string &destFilename) |
| 249 | { | 249 | { |
| 250 | INFO_LOG(COMMON, "Copy: %s --> %s", | 250 | INFO_LOG(COMMON, "Copy: %s --> %s", |
| 251 | srcFilename.c_str(), destFilename.c_str()); | 251 | srcFilename.c_str(), destFilename.c_str()); |
| 252 | #ifdef _WIN32 | 252 | #ifdef _WIN32 |
| 253 | if (CopyFile(Common::UTF8ToTStr(srcFilename).c_str(), Common::UTF8ToTStr(destFilename).c_str(), FALSE)) | 253 | if (CopyFile(Common::UTF8ToTStr(srcFilename).c_str(), Common::UTF8ToTStr(destFilename).c_str(), FALSE)) |
| 254 | return true; | 254 | return true; |
| 255 | 255 | ||
| 256 | ERROR_LOG(COMMON, "Copy: failed %s --> %s: %s", | 256 | ERROR_LOG(COMMON, "Copy: failed %s --> %s: %s", |
| 257 | srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); | 257 | srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); |
| 258 | return false; | 258 | return false; |
| 259 | #else | 259 | #else |
| @@ -267,7 +267,7 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename) | |||
| 267 | FILE *input = fopen(srcFilename.c_str(), "rb"); | 267 | FILE *input = fopen(srcFilename.c_str(), "rb"); |
| 268 | if (!input) | 268 | if (!input) |
| 269 | { | 269 | { |
| 270 | ERROR_LOG(COMMON, "Copy: input failed %s --> %s: %s", | 270 | ERROR_LOG(COMMON, "Copy: input failed %s --> %s: %s", |
| 271 | srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); | 271 | srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); |
| 272 | return false; | 272 | return false; |
| 273 | } | 273 | } |
| @@ -277,7 +277,7 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename) | |||
| 277 | if (!output) | 277 | if (!output) |
| 278 | { | 278 | { |
| 279 | fclose(input); | 279 | fclose(input); |
| 280 | ERROR_LOG(COMMON, "Copy: output failed %s --> %s: %s", | 280 | ERROR_LOG(COMMON, "Copy: output failed %s --> %s: %s", |
| 281 | srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); | 281 | srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); |
| 282 | return false; | 282 | return false; |
| 283 | } | 283 | } |
| @@ -291,8 +291,8 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename) | |||
| 291 | { | 291 | { |
| 292 | if (ferror(input) != 0) | 292 | if (ferror(input) != 0) |
| 293 | { | 293 | { |
| 294 | ERROR_LOG(COMMON, | 294 | ERROR_LOG(COMMON, |
| 295 | "Copy: failed reading from source, %s --> %s: %s", | 295 | "Copy: failed reading from source, %s --> %s: %s", |
| 296 | srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); | 296 | srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); |
| 297 | goto bail; | 297 | goto bail; |
| 298 | } | 298 | } |
| @@ -302,8 +302,8 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename) | |||
| 302 | int wnum = fwrite(buffer, sizeof(char), rnum, output); | 302 | int wnum = fwrite(buffer, sizeof(char), rnum, output); |
| 303 | if (wnum != rnum) | 303 | if (wnum != rnum) |
| 304 | { | 304 | { |
| 305 | ERROR_LOG(COMMON, | 305 | ERROR_LOG(COMMON, |
| 306 | "Copy: failed writing to output, %s --> %s: %s", | 306 | "Copy: failed writing to output, %s --> %s: %s", |
| 307 | srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); | 307 | srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); |
| 308 | goto bail; | 308 | goto bail; |
| 309 | } | 309 | } |
| @@ -335,7 +335,7 @@ u64 GetSize(const std::string &filename) | |||
| 335 | WARN_LOG(COMMON, "GetSize: failed %s: is a directory", filename.c_str()); | 335 | WARN_LOG(COMMON, "GetSize: failed %s: is a directory", filename.c_str()); |
| 336 | return 0; | 336 | return 0; |
| 337 | } | 337 | } |
| 338 | 338 | ||
| 339 | struct stat64 buf; | 339 | struct stat64 buf; |
| 340 | #ifdef _WIN32 | 340 | #ifdef _WIN32 |
| 341 | if (_tstat64(Common::UTF8ToTStr(filename).c_str(), &buf) == 0) | 341 | if (_tstat64(Common::UTF8ToTStr(filename).c_str(), &buf) == 0) |
| @@ -384,10 +384,10 @@ u64 GetSize(FILE *f) | |||
| 384 | return size; | 384 | return size; |
| 385 | } | 385 | } |
| 386 | 386 | ||
| 387 | // creates an empty file filename, returns true on success | 387 | // creates an empty file filename, returns true on success |
| 388 | bool CreateEmptyFile(const std::string &filename) | 388 | bool CreateEmptyFile(const std::string &filename) |
| 389 | { | 389 | { |
| 390 | INFO_LOG(COMMON, "CreateEmptyFile: %s", filename.c_str()); | 390 | INFO_LOG(COMMON, "CreateEmptyFile: %s", filename.c_str()); |
| 391 | 391 | ||
| 392 | if (!FileUtil::IOFile(filename, "wb")) | 392 | if (!FileUtil::IOFile(filename, "wb")) |
| 393 | { | 393 | { |
| @@ -437,7 +437,7 @@ u32 ScanDirectoryTree(const std::string &directory, FSTEntry& parentEntry) | |||
| 437 | #endif | 437 | #endif |
| 438 | // check for "." and ".." | 438 | // check for "." and ".." |
| 439 | if (((virtualName[0] == '.') && (virtualName[1] == '\0')) || | 439 | if (((virtualName[0] == '.') && (virtualName[1] == '\0')) || |
| 440 | ((virtualName[0] == '.') && (virtualName[1] == '.') && | 440 | ((virtualName[0] == '.') && (virtualName[1] == '.') && |
| 441 | (virtualName[2] == '\0'))) | 441 | (virtualName[2] == '\0'))) |
| 442 | continue; | 442 | continue; |
| 443 | entry.virtualName = virtualName; | 443 | entry.virtualName = virtualName; |
| @@ -452,14 +452,14 @@ u32 ScanDirectoryTree(const std::string &directory, FSTEntry& parentEntry) | |||
| 452 | foundEntries += (u32)entry.size; | 452 | foundEntries += (u32)entry.size; |
| 453 | } | 453 | } |
| 454 | else | 454 | else |
| 455 | { // is a file | 455 | { // is a file |
| 456 | entry.isDirectory = false; | 456 | entry.isDirectory = false; |
| 457 | entry.size = GetSize(entry.physicalName.c_str()); | 457 | entry.size = GetSize(entry.physicalName.c_str()); |
| 458 | } | 458 | } |
| 459 | ++foundEntries; | 459 | ++foundEntries; |
| 460 | // Push into the tree | 460 | // Push into the tree |
| 461 | parentEntry.children.push_back(entry); | 461 | parentEntry.children.push_back(entry); |
| 462 | #ifdef _WIN32 | 462 | #ifdef _WIN32 |
| 463 | } while (FindNextFile(hFind, &ffd) != 0); | 463 | } while (FindNextFile(hFind, &ffd) != 0); |
| 464 | FindClose(hFind); | 464 | FindClose(hFind); |
| 465 | #else | 465 | #else |
| @@ -504,7 +504,7 @@ bool DeleteDirRecursively(const std::string &directory) | |||
| 504 | 504 | ||
| 505 | // check for "." and ".." | 505 | // check for "." and ".." |
| 506 | if (((virtualName[0] == '.') && (virtualName[1] == '\0')) || | 506 | if (((virtualName[0] == '.') && (virtualName[1] == '\0')) || |
| 507 | ((virtualName[0] == '.') && (virtualName[1] == '.') && | 507 | ((virtualName[0] == '.') && (virtualName[1] == '.') && |
| 508 | (virtualName[2] == '\0'))) | 508 | (virtualName[2] == '\0'))) |
| 509 | continue; | 509 | continue; |
| 510 | 510 | ||
| @@ -540,7 +540,7 @@ bool DeleteDirRecursively(const std::string &directory) | |||
| 540 | closedir(dirp); | 540 | closedir(dirp); |
| 541 | #endif | 541 | #endif |
| 542 | FileUtil::DeleteDir(directory); | 542 | FileUtil::DeleteDir(directory); |
| 543 | 543 | ||
| 544 | return true; | 544 | return true; |
| 545 | } | 545 | } |
| 546 | 546 | ||
| @@ -585,7 +585,7 @@ void CopyDir(const std::string &source_path, const std::string &dest_path) | |||
| 585 | std::string GetCurrentDir() | 585 | std::string GetCurrentDir() |
| 586 | { | 586 | { |
| 587 | char *dir; | 587 | char *dir; |
| 588 | // Get the current working directory (getcwd uses malloc) | 588 | // Get the current working directory (getcwd uses malloc) |
| 589 | if (!(dir = __getcwd(NULL, 0))) { | 589 | if (!(dir = __getcwd(NULL, 0))) { |
| 590 | 590 | ||
| 591 | ERROR_LOG(COMMON, "GetCurrentDirectory failed: %s", | 591 | ERROR_LOG(COMMON, "GetCurrentDirectory failed: %s", |
| @@ -604,7 +604,7 @@ bool SetCurrentDir(const std::string &directory) | |||
| 604 | } | 604 | } |
| 605 | 605 | ||
| 606 | #if defined(__APPLE__) | 606 | #if defined(__APPLE__) |
| 607 | std::string GetBundleDirectory() | 607 | std::string GetBundleDirectory() |
| 608 | { | 608 | { |
| 609 | CFURLRef BundleRef; | 609 | CFURLRef BundleRef; |
| 610 | char AppBundlePath[MAXPATHLEN]; | 610 | char AppBundlePath[MAXPATHLEN]; |
| @@ -666,8 +666,8 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string &new | |||
| 666 | if (FileUtil::Exists(ROOT_DIR DIR_SEP USERDATA_DIR)) | 666 | if (FileUtil::Exists(ROOT_DIR DIR_SEP USERDATA_DIR)) |
| 667 | paths[D_USER_IDX] = ROOT_DIR DIR_SEP USERDATA_DIR DIR_SEP; | 667 | paths[D_USER_IDX] = ROOT_DIR DIR_SEP USERDATA_DIR DIR_SEP; |
| 668 | else | 668 | else |
| 669 | paths[D_USER_IDX] = std::string(getenv("HOME") ? | 669 | paths[D_USER_IDX] = std::string(getenv("HOME") ? |
| 670 | getenv("HOME") : getenv("PWD") ? | 670 | getenv("HOME") : getenv("PWD") ? |
| 671 | getenv("PWD") : "") + DIR_SEP EMU_DATA_DIR DIR_SEP; | 671 | getenv("PWD") : "") + DIR_SEP EMU_DATA_DIR DIR_SEP; |
| 672 | #endif | 672 | #endif |
| 673 | 673 | ||
| @@ -749,7 +749,7 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string &new | |||
| 749 | paths[F_MAINLOG_IDX] = paths[D_LOGS_IDX] + MAIN_LOG; | 749 | paths[F_MAINLOG_IDX] = paths[D_LOGS_IDX] + MAIN_LOG; |
| 750 | } | 750 | } |
| 751 | } | 751 | } |
| 752 | 752 | ||
| 753 | return paths[DirIDX]; | 753 | return paths[DirIDX]; |
| 754 | } | 754 | } |
| 755 | 755 | ||
| @@ -762,7 +762,7 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string &new | |||
| 762 | // if (!FileUtil::Exists(dir)) | 762 | // if (!FileUtil::Exists(dir)) |
| 763 | // dir = SHARED_USER_DIR THEMES_DIR "/" + theme_name + "/"; | 763 | // dir = SHARED_USER_DIR THEMES_DIR "/" + theme_name + "/"; |
| 764 | //#endif | 764 | //#endif |
| 765 | // | 765 | // |
| 766 | // return dir; | 766 | // return dir; |
| 767 | //} | 767 | //} |
| 768 | 768 | ||
diff --git a/src/common/hash.cpp b/src/common/hash.cpp index d2ebc7341..2ddcfe6b7 100644 --- a/src/common/hash.cpp +++ b/src/common/hash.cpp | |||
| @@ -115,15 +115,15 @@ inline u64 getblock(const u64 * p, int i) | |||
| 115 | 115 | ||
| 116 | inline void bmix64(u64 & h1, u64 & h2, u64 & k1, u64 & k2, u64 & c1, u64 & c2) | 116 | inline void bmix64(u64 & h1, u64 & h2, u64 & k1, u64 & k2, u64 & c1, u64 & c2) |
| 117 | { | 117 | { |
| 118 | k1 *= c1; | 118 | k1 *= c1; |
| 119 | k1 = _rotl64(k1,23); | 119 | k1 = _rotl64(k1,23); |
| 120 | k1 *= c2; | 120 | k1 *= c2; |
| 121 | h1 ^= k1; | 121 | h1 ^= k1; |
| 122 | h1 += h2; | 122 | h1 += h2; |
| 123 | 123 | ||
| 124 | h2 = _rotl64(h2,41); | 124 | h2 = _rotl64(h2,41); |
| 125 | 125 | ||
| 126 | k2 *= c2; | 126 | k2 *= c2; |
| 127 | k2 = _rotl64(k2,23); | 127 | k2 = _rotl64(k2,23); |
| 128 | k2 *= c1; | 128 | k2 *= c1; |
| 129 | h2 ^= k2; | 129 | h2 ^= k2; |
| @@ -250,7 +250,7 @@ u64 GetCRC32(const u8 *src, int len, u32 samples) | |||
| 250 | } | 250 | } |
| 251 | 251 | ||
| 252 | 252 | ||
| 253 | /* | 253 | /* |
| 254 | * NOTE: This hash function is used for custom texture loading/dumping, so | 254 | * NOTE: This hash function is used for custom texture loading/dumping, so |
| 255 | * it should not be changed, which would require all custom textures to be | 255 | * it should not be changed, which would require all custom textures to be |
| 256 | * recalculated for their new hash values. If the hashing function is | 256 | * recalculated for their new hash values. If the hashing function is |
| @@ -273,7 +273,7 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples) | |||
| 273 | u64 k = data[0]; | 273 | u64 k = data[0]; |
| 274 | data+=Step; | 274 | data+=Step; |
| 275 | k *= m; | 275 | k *= m; |
| 276 | k ^= k >> r; | 276 | k ^= k >> r; |
| 277 | k *= m; | 277 | k *= m; |
| 278 | h ^= k; | 278 | h ^= k; |
| 279 | h *= m; | 279 | h *= m; |
| @@ -292,13 +292,13 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples) | |||
| 292 | case 1: h ^= u64(data2[0]); | 292 | case 1: h ^= u64(data2[0]); |
| 293 | h *= m; | 293 | h *= m; |
| 294 | }; | 294 | }; |
| 295 | 295 | ||
| 296 | h ^= h >> r; | 296 | h ^= h >> r; |
| 297 | h *= m; | 297 | h *= m; |
| 298 | h ^= h >> r; | 298 | h ^= h >> r; |
| 299 | 299 | ||
| 300 | return h; | 300 | return h; |
| 301 | } | 301 | } |
| 302 | #else | 302 | #else |
| 303 | // CRC32 hash using the SSE4.2 instruction | 303 | // CRC32 hash using the SSE4.2 instruction |
| 304 | u64 GetCRC32(const u8 *src, int len, u32 samples) | 304 | u64 GetCRC32(const u8 *src, int len, u32 samples) |
| @@ -351,15 +351,15 @@ inline u32 fmix32(u32 h) | |||
| 351 | 351 | ||
| 352 | inline void bmix32(u32 & h1, u32 & h2, u32 & k1, u32 & k2, u32 & c1, u32 & c2) | 352 | inline void bmix32(u32 & h1, u32 & h2, u32 & k1, u32 & k2, u32 & c1, u32 & c2) |
| 353 | { | 353 | { |
| 354 | k1 *= c1; | 354 | k1 *= c1; |
| 355 | k1 = _rotl(k1,11); | 355 | k1 = _rotl(k1,11); |
| 356 | k1 *= c2; | 356 | k1 *= c2; |
| 357 | h1 ^= k1; | 357 | h1 ^= k1; |
| 358 | h1 += h2; | 358 | h1 += h2; |
| 359 | 359 | ||
| 360 | h2 = _rotl(h2,17); | 360 | h2 = _rotl(h2,17); |
| 361 | 361 | ||
| 362 | k2 *= c2; | 362 | k2 *= c2; |
| 363 | k2 = _rotl(k2,11); | 363 | k2 = _rotl(k2,11); |
| 364 | k2 *= c1; | 364 | k2 *= c1; |
| 365 | h2 ^= k2; | 365 | h2 ^= k2; |
| @@ -405,7 +405,7 @@ u64 GetMurmurHash3(const u8* src, int len, u32 samples) | |||
| 405 | 405 | ||
| 406 | //---------- | 406 | //---------- |
| 407 | // tail | 407 | // tail |
| 408 | 408 | ||
| 409 | const u8 * tail = (const u8*)(data + nblocks*8); | 409 | const u8 * tail = (const u8*)(data + nblocks*8); |
| 410 | 410 | ||
| 411 | u32 k1 = 0; | 411 | u32 k1 = 0; |
| @@ -439,7 +439,7 @@ u64 GetMurmurHash3(const u8* src, int len, u32 samples) | |||
| 439 | 439 | ||
| 440 | out[0] = h1; | 440 | out[0] = h1; |
| 441 | out[1] = h2; | 441 | out[1] = h2; |
| 442 | 442 | ||
| 443 | return *((u64 *)&out); | 443 | return *((u64 *)&out); |
| 444 | } | 444 | } |
| 445 | 445 | ||
| @@ -463,11 +463,11 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples) | |||
| 463 | { | 463 | { |
| 464 | u64 k = data[0]; | 464 | u64 k = data[0]; |
| 465 | data+=Step; | 465 | data+=Step; |
| 466 | k *= m; | 466 | k *= m; |
| 467 | k ^= k >> r; | 467 | k ^= k >> r; |
| 468 | k *= m; | 468 | k *= m; |
| 469 | h ^= k; | 469 | h ^= k; |
| 470 | h *= m; | 470 | h *= m; |
| 471 | } | 471 | } |
| 472 | 472 | ||
| 473 | const u8 * data2 = (const u8*)end; | 473 | const u8 * data2 = (const u8*)end; |
| @@ -483,7 +483,7 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples) | |||
| 483 | case 1: h ^= u64(data2[0]); | 483 | case 1: h ^= u64(data2[0]); |
| 484 | h *= m; | 484 | h *= m; |
| 485 | }; | 485 | }; |
| 486 | 486 | ||
| 487 | h ^= h >> r; | 487 | h ^= h >> r; |
| 488 | h *= m; | 488 | h *= m; |
| 489 | h ^= h >> r; | 489 | h ^= h >> r; |
diff --git a/src/common/linear_disk_cache.h b/src/common/linear_disk_cache.h index 96dce3155..f4263f72a 100644 --- a/src/common/linear_disk_cache.h +++ b/src/common/linear_disk_cache.h | |||
| @@ -64,7 +64,7 @@ public: | |||
| 64 | m_file.seekg(0, std::ios::beg); | 64 | m_file.seekg(0, std::ios::beg); |
| 65 | std::fstream::pos_type start_pos = m_file.tellg(); | 65 | std::fstream::pos_type start_pos = m_file.tellg(); |
| 66 | std::streamoff file_size = end_pos - start_pos; | 66 | std::streamoff file_size = end_pos - start_pos; |
| 67 | 67 | ||
| 68 | if (m_file.is_open() && ValidateHeader()) | 68 | if (m_file.is_open() && ValidateHeader()) |
| 69 | { | 69 | { |
| 70 | // good header, read some key/value pairs | 70 | // good header, read some key/value pairs |
| @@ -87,7 +87,7 @@ public: | |||
| 87 | 87 | ||
| 88 | // read key/value and pass to reader | 88 | // read key/value and pass to reader |
| 89 | if (Read(&key) && | 89 | if (Read(&key) && |
| 90 | Read(value, value_size) && | 90 | Read(value, value_size) && |
| 91 | Read(&entry_number) && | 91 | Read(&entry_number) && |
| 92 | entry_number == m_num_entries+1) | 92 | entry_number == m_num_entries+1) |
| 93 | { | 93 | { |
| @@ -115,7 +115,7 @@ public: | |||
| 115 | WriteHeader(); | 115 | WriteHeader(); |
| 116 | return 0; | 116 | return 0; |
| 117 | } | 117 | } |
| 118 | 118 | ||
| 119 | void Sync() | 119 | void Sync() |
| 120 | { | 120 | { |
| 121 | m_file.flush(); | 121 | m_file.flush(); |
diff --git a/src/common/log.h b/src/common/log.h index 822cd21eb..14ad98c08 100644 --- a/src/common/log.h +++ b/src/common/log.h | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | enum { | 11 | enum { |
| 12 | OS_LEVEL, // Printed by the emulated operating system | 12 | OS_LEVEL, // Printed by the emulated operating system |
| 13 | NOTICE_LEVEL, // VERY important information that is NOT errors. Like startup and OSReports. | 13 | NOTICE_LEVEL, // VERY important information that is NOT errors. Like startup and OSReports. |
| 14 | ERROR_LEVEL, // Critical errors | 14 | ERROR_LEVEL, // Critical errors |
| 15 | WARNING_LEVEL, // Something is suspicious. | 15 | WARNING_LEVEL, // Something is suspicious. |
| 16 | INFO_LEVEL, // General information. | 16 | INFO_LEVEL, // General information. |
| 17 | DEBUG_LEVEL, // Detailed debugging - might make things slow. | 17 | DEBUG_LEVEL, // Detailed debugging - might make things slow. |
| @@ -46,7 +46,7 @@ enum LOG_TYPE { | |||
| 46 | MEMMAP, | 46 | MEMMAP, |
| 47 | MEMCARD_MANAGER, | 47 | MEMCARD_MANAGER, |
| 48 | OSREPORT, | 48 | OSREPORT, |
| 49 | PAD, | 49 | PAD, |
| 50 | PROCESSORINTERFACE, | 50 | PROCESSORINTERFACE, |
| 51 | PIXELENGINE, | 51 | PIXELENGINE, |
| 52 | SERIALINTERFACE, | 52 | SERIALINTERFACE, |
| @@ -89,7 +89,7 @@ enum LOG_LEVELS { | |||
| 89 | 89 | ||
| 90 | } // namespace | 90 | } // namespace |
| 91 | 91 | ||
| 92 | void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type, const char*file, int line, | 92 | void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type, const char*file, int line, |
| 93 | const char* function, const char* fmt, ...) | 93 | const char* function, const char* fmt, ...) |
| 94 | #ifdef __GNUC__ | 94 | #ifdef __GNUC__ |
| 95 | __attribute__((format(printf, 6, 7))) | 95 | __attribute__((format(printf, 6, 7))) |
diff --git a/src/common/log_manager.cpp b/src/common/log_manager.cpp index 687f4e337..38c681ee0 100644 --- a/src/common/log_manager.cpp +++ b/src/common/log_manager.cpp | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #include "common/timer.h" | 9 | #include "common/timer.h" |
| 10 | #include "common/thread.h" | 10 | #include "common/thread.h" |
| 11 | 11 | ||
| 12 | void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char* file, int line, | 12 | void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char* file, int line, |
| 13 | const char* function, const char* fmt, ...) | 13 | const char* function, const char* fmt, ...) |
| 14 | { | 14 | { |
| 15 | va_list args; | 15 | va_list args; |
| @@ -112,7 +112,7 @@ LogManager::~LogManager() | |||
| 112 | delete m_debuggerLog; | 112 | delete m_debuggerLog; |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char* file, | 115 | void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char* file, |
| 116 | int line, const char* function, const char *fmt, va_list args) | 116 | int line, const char* function, const char *fmt, va_list args) |
| 117 | { | 117 | { |
| 118 | char temp[MAX_MSGLEN]; | 118 | char temp[MAX_MSGLEN]; |
| @@ -125,11 +125,11 @@ void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const | |||
| 125 | Common::CharArrayFromFormatV(temp, MAX_MSGLEN, fmt, args); | 125 | Common::CharArrayFromFormatV(temp, MAX_MSGLEN, fmt, args); |
| 126 | 126 | ||
| 127 | static const char level_to_char[7] = "ONEWID"; | 127 | static const char level_to_char[7] = "ONEWID"; |
| 128 | sprintf(msg, "%s %s:%u %c[%s] %s: %s\n", Common::Timer::GetTimeFormatted().c_str(), file, line, | 128 | sprintf(msg, "%s %s:%u %c[%s] %s: %s\n", Common::Timer::GetTimeFormatted().c_str(), file, line, |
| 129 | level_to_char[(int)level], log->GetShortName(), function, temp); | 129 | level_to_char[(int)level], log->GetShortName(), function, temp); |
| 130 | 130 | ||
| 131 | #ifdef ANDROID | 131 | #ifdef ANDROID |
| 132 | Host_SysMessage(msg); | 132 | Host_SysMessage(msg); |
| 133 | #endif | 133 | #endif |
| 134 | log->Trigger(level, msg); | 134 | log->Trigger(level, msg); |
| 135 | } | 135 | } |
diff --git a/src/common/log_manager.h b/src/common/log_manager.h index de1d16ee5..baefc4ba8 100644 --- a/src/common/log_manager.h +++ b/src/common/log_manager.h | |||
| @@ -54,7 +54,7 @@ class LogContainer | |||
| 54 | { | 54 | { |
| 55 | public: | 55 | public: |
| 56 | LogContainer(const char* shortName, const char* fullName, bool enable = false); | 56 | LogContainer(const char* shortName, const char* fullName, bool enable = false); |
| 57 | 57 | ||
| 58 | const char* GetShortName() const { return m_shortName; } | 58 | const char* GetShortName() const { return m_shortName; } |
| 59 | const char* GetFullName() const { return m_fullName; } | 59 | const char* GetFullName() const { return m_fullName; } |
| 60 | 60 | ||
| @@ -98,7 +98,7 @@ public: | |||
| 98 | 98 | ||
| 99 | static u32 GetMaxLevel() { return LogTypes::MAX_LOGLEVEL; } | 99 | static u32 GetMaxLevel() { return LogTypes::MAX_LOGLEVEL; } |
| 100 | 100 | ||
| 101 | void Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char* file, int line, | 101 | void Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char* file, int line, |
| 102 | const char* function, const char *fmt, va_list args); | 102 | const char* function, const char *fmt, va_list args); |
| 103 | 103 | ||
| 104 | void SetLogLevel(LogTypes::LOG_TYPE type, LogTypes::LOG_LEVELS level) | 104 | void SetLogLevel(LogTypes::LOG_TYPE type, LogTypes::LOG_LEVELS level) |
diff --git a/src/common/math_util.cpp b/src/common/math_util.cpp index ab0e6b75c..3613e82a6 100644 --- a/src/common/math_util.cpp +++ b/src/common/math_util.cpp | |||
| @@ -18,7 +18,7 @@ u32 ClassifyDouble(double dvalue) | |||
| 18 | value.d = dvalue; | 18 | value.d = dvalue; |
| 19 | u64 sign = value.i & DOUBLE_SIGN; | 19 | u64 sign = value.i & DOUBLE_SIGN; |
| 20 | u64 exp = value.i & DOUBLE_EXP; | 20 | u64 exp = value.i & DOUBLE_EXP; |
| 21 | if (exp > DOUBLE_ZERO && exp < DOUBLE_EXP) | 21 | if (exp > DOUBLE_ZERO && exp < DOUBLE_EXP) |
| 22 | { | 22 | { |
| 23 | // Nice normalized number. | 23 | // Nice normalized number. |
| 24 | return sign ? PPC_FPCLASS_NN : PPC_FPCLASS_PN; | 24 | return sign ? PPC_FPCLASS_NN : PPC_FPCLASS_PN; |
| @@ -58,7 +58,7 @@ u32 ClassifyFloat(float fvalue) | |||
| 58 | value.f = fvalue; | 58 | value.f = fvalue; |
| 59 | u32 sign = value.i & FLOAT_SIGN; | 59 | u32 sign = value.i & FLOAT_SIGN; |
| 60 | u32 exp = value.i & FLOAT_EXP; | 60 | u32 exp = value.i & FLOAT_EXP; |
| 61 | if (exp > FLOAT_ZERO && exp < FLOAT_EXP) | 61 | if (exp > FLOAT_ZERO && exp < FLOAT_EXP) |
| 62 | { | 62 | { |
| 63 | // Nice normalized number. | 63 | // Nice normalized number. |
| 64 | return sign ? PPC_FPCLASS_NN : PPC_FPCLASS_PN; | 64 | return sign ? PPC_FPCLASS_NN : PPC_FPCLASS_PN; |
| @@ -77,13 +77,13 @@ u32 ClassifyFloat(float fvalue) | |||
| 77 | // Denormalized number. | 77 | // Denormalized number. |
| 78 | return sign ? PPC_FPCLASS_ND : PPC_FPCLASS_PD; | 78 | return sign ? PPC_FPCLASS_ND : PPC_FPCLASS_PD; |
| 79 | } | 79 | } |
| 80 | } | 80 | } |
| 81 | else if (exp) | 81 | else if (exp) |
| 82 | { | 82 | { |
| 83 | // Infinite | 83 | // Infinite |
| 84 | return sign ? PPC_FPCLASS_NINF : PPC_FPCLASS_PINF; | 84 | return sign ? PPC_FPCLASS_NINF : PPC_FPCLASS_PINF; |
| 85 | } | 85 | } |
| 86 | else | 86 | else |
| 87 | { | 87 | { |
| 88 | //Zero | 88 | //Zero |
| 89 | return sign ? PPC_FPCLASS_NZ : PPC_FPCLASS_PZ; | 89 | return sign ? PPC_FPCLASS_NZ : PPC_FPCLASS_PZ; |
| @@ -143,7 +143,7 @@ void Matrix33::RotateY(Matrix33 &mtx, float rad) | |||
| 143 | mtx.data[0] = c; | 143 | mtx.data[0] = c; |
| 144 | mtx.data[2] = s; | 144 | mtx.data[2] = s; |
| 145 | mtx.data[4] = 1; | 145 | mtx.data[4] = 1; |
| 146 | mtx.data[6] = -s; | 146 | mtx.data[6] = -s; |
| 147 | mtx.data[8] = c; | 147 | mtx.data[8] = c; |
| 148 | } | 148 | } |
| 149 | 149 | ||
diff --git a/src/common/mem_arena.cpp b/src/common/mem_arena.cpp index 40d9c03a2..31ca27b42 100644 --- a/src/common/mem_arena.cpp +++ b/src/common/mem_arena.cpp | |||
| @@ -272,11 +272,11 @@ u8* MemArena::Find4GBBase() | |||
| 272 | 272 | ||
| 273 | 273 | ||
| 274 | // yeah, this could also be done in like two bitwise ops... | 274 | // yeah, this could also be done in like two bitwise ops... |
| 275 | #define SKIP(a_flags, b_flags) | 275 | #define SKIP(a_flags, b_flags) |
| 276 | // if (!(a_flags & MV_WII_ONLY) && (b_flags & MV_WII_ONLY)) | 276 | // if (!(a_flags & MV_WII_ONLY) && (b_flags & MV_WII_ONLY)) |
| 277 | // continue; | 277 | // continue; |
| 278 | // if (!(a_flags & MV_FAKE_VMEM) && (b_flags & MV_FAKE_VMEM)) | 278 | // if (!(a_flags & MV_FAKE_VMEM) && (b_flags & MV_FAKE_VMEM)) |
| 279 | // continue; | 279 | // continue; |
| 280 | 280 | ||
| 281 | static bool Memory_TryBase(u8 *base, const MemoryView *views, int num_views, u32 flags, MemArena *arena) { | 281 | static bool Memory_TryBase(u8 *base, const MemoryView *views, int num_views, u32 flags, MemArena *arena) { |
| 282 | // OK, we know where to find free space. Now grab it! | 282 | // OK, we know where to find free space. Now grab it! |
diff --git a/src/common/memory_util.cpp b/src/common/memory_util.cpp index bab7d9f7a..b6f66e4e1 100644 --- a/src/common/memory_util.cpp +++ b/src/common/memory_util.cpp | |||
| @@ -47,7 +47,7 @@ void* AllocateExecutableMemory(size_t size, bool low) | |||
| 47 | 47 | ||
| 48 | // printf("Mapped executable memory at %p (size %ld)\n", ptr, | 48 | // printf("Mapped executable memory at %p (size %ld)\n", ptr, |
| 49 | // (unsigned long)size); | 49 | // (unsigned long)size); |
| 50 | 50 | ||
| 51 | #ifdef _WIN32 | 51 | #ifdef _WIN32 |
| 52 | if (ptr == nullptr) | 52 | if (ptr == nullptr) |
| 53 | { | 53 | { |
| @@ -55,7 +55,7 @@ void* AllocateExecutableMemory(size_t size, bool low) | |||
| 55 | if (ptr == MAP_FAILED) | 55 | if (ptr == MAP_FAILED) |
| 56 | { | 56 | { |
| 57 | ptr = nullptr; | 57 | ptr = nullptr; |
| 58 | #endif | 58 | #endif |
| 59 | PanicAlert("Failed to allocate executable memory"); | 59 | PanicAlert("Failed to allocate executable memory"); |
| 60 | } | 60 | } |
| 61 | #if !defined(_WIN32) && defined(__x86_64__) && !defined(MAP_32BIT) | 61 | #if !defined(_WIN32) && defined(__x86_64__) && !defined(MAP_32BIT) |
| @@ -127,11 +127,11 @@ void FreeMemoryPages(void* ptr, size_t size) | |||
| 127 | if (ptr) | 127 | if (ptr) |
| 128 | { | 128 | { |
| 129 | #ifdef _WIN32 | 129 | #ifdef _WIN32 |
| 130 | 130 | ||
| 131 | if (!VirtualFree(ptr, 0, MEM_RELEASE)) | 131 | if (!VirtualFree(ptr, 0, MEM_RELEASE)) |
| 132 | PanicAlert("FreeMemoryPages failed!\n%s", GetLastErrorMsg()); | 132 | PanicAlert("FreeMemoryPages failed!\n%s", GetLastErrorMsg()); |
| 133 | ptr = NULL; // Is this our responsibility? | 133 | ptr = NULL; // Is this our responsibility? |
| 134 | 134 | ||
| 135 | #else | 135 | #else |
| 136 | munmap(ptr, size); | 136 | munmap(ptr, size); |
| 137 | #endif | 137 | #endif |
diff --git a/src/common/msg_handler.h b/src/common/msg_handler.h index 7c5319ec3..9bfdf950e 100644 --- a/src/common/msg_handler.h +++ b/src/common/msg_handler.h | |||
| @@ -15,7 +15,7 @@ enum MSG_TYPE | |||
| 15 | CRITICAL | 15 | CRITICAL |
| 16 | }; | 16 | }; |
| 17 | 17 | ||
| 18 | typedef bool (*MsgAlertHandler)(const char* caption, const char* text, | 18 | typedef bool (*MsgAlertHandler)(const char* caption, const char* text, |
| 19 | bool yes_no, int Style); | 19 | bool yes_no, int Style); |
| 20 | typedef std::string (*StringTranslator)(const char* text); | 20 | typedef std::string (*StringTranslator)(const char* text); |
| 21 | 21 | ||
| @@ -31,29 +31,29 @@ void SetEnableAlert(bool enable); | |||
| 31 | 31 | ||
| 32 | #ifndef GEKKO | 32 | #ifndef GEKKO |
| 33 | #ifdef _WIN32 | 33 | #ifdef _WIN32 |
| 34 | #define SuccessAlert(format, ...) MsgAlert(false, INFORMATION, format, __VA_ARGS__) | 34 | #define SuccessAlert(format, ...) MsgAlert(false, INFORMATION, format, __VA_ARGS__) |
| 35 | #define PanicAlert(format, ...) MsgAlert(false, WARNING, format, __VA_ARGS__) | 35 | #define PanicAlert(format, ...) MsgAlert(false, WARNING, format, __VA_ARGS__) |
| 36 | #define PanicYesNo(format, ...) MsgAlert(true, WARNING, format, __VA_ARGS__) | 36 | #define PanicYesNo(format, ...) MsgAlert(true, WARNING, format, __VA_ARGS__) |
| 37 | #define AskYesNo(format, ...) MsgAlert(true, QUESTION, format, __VA_ARGS__) | 37 | #define AskYesNo(format, ...) MsgAlert(true, QUESTION, format, __VA_ARGS__) |
| 38 | #define CriticalAlert(format, ...) MsgAlert(false, CRITICAL, format, __VA_ARGS__) | 38 | #define CriticalAlert(format, ...) MsgAlert(false, CRITICAL, format, __VA_ARGS__) |
| 39 | // Use these macros (that do the same thing) if the message should be translated. | 39 | // Use these macros (that do the same thing) if the message should be translated. |
| 40 | #define SuccessAlertT(format, ...) MsgAlert(false, INFORMATION, format, __VA_ARGS__) | 40 | #define SuccessAlertT(format, ...) MsgAlert(false, INFORMATION, format, __VA_ARGS__) |
| 41 | #define PanicAlertT(format, ...) MsgAlert(false, WARNING, format, __VA_ARGS__) | 41 | #define PanicAlertT(format, ...) MsgAlert(false, WARNING, format, __VA_ARGS__) |
| 42 | #define PanicYesNoT(format, ...) MsgAlert(true, WARNING, format, __VA_ARGS__) | 42 | #define PanicYesNoT(format, ...) MsgAlert(true, WARNING, format, __VA_ARGS__) |
| 43 | #define AskYesNoT(format, ...) MsgAlert(true, QUESTION, format, __VA_ARGS__) | 43 | #define AskYesNoT(format, ...) MsgAlert(true, QUESTION, format, __VA_ARGS__) |
| 44 | #define CriticalAlertT(format, ...) MsgAlert(false, CRITICAL, format, __VA_ARGS__) | 44 | #define CriticalAlertT(format, ...) MsgAlert(false, CRITICAL, format, __VA_ARGS__) |
| 45 | #else | 45 | #else |
| 46 | #define SuccessAlert(format, ...) MsgAlert(false, INFORMATION, format, ##__VA_ARGS__) | 46 | #define SuccessAlert(format, ...) MsgAlert(false, INFORMATION, format, ##__VA_ARGS__) |
| 47 | #define PanicAlert(format, ...) MsgAlert(false, WARNING, format, ##__VA_ARGS__) | 47 | #define PanicAlert(format, ...) MsgAlert(false, WARNING, format, ##__VA_ARGS__) |
| 48 | #define PanicYesNo(format, ...) MsgAlert(true, WARNING, format, ##__VA_ARGS__) | 48 | #define PanicYesNo(format, ...) MsgAlert(true, WARNING, format, ##__VA_ARGS__) |
| 49 | #define AskYesNo(format, ...) MsgAlert(true, QUESTION, format, ##__VA_ARGS__) | 49 | #define AskYesNo(format, ...) MsgAlert(true, QUESTION, format, ##__VA_ARGS__) |
| 50 | #define CriticalAlert(format, ...) MsgAlert(false, CRITICAL, format, ##__VA_ARGS__) | 50 | #define CriticalAlert(format, ...) MsgAlert(false, CRITICAL, format, ##__VA_ARGS__) |
| 51 | // Use these macros (that do the same thing) if the message should be translated. | 51 | // Use these macros (that do the same thing) if the message should be translated. |
| 52 | #define SuccessAlertT(format, ...) MsgAlert(false, INFORMATION, format, ##__VA_ARGS__) | 52 | #define SuccessAlertT(format, ...) MsgAlert(false, INFORMATION, format, ##__VA_ARGS__) |
| 53 | #define PanicAlertT(format, ...) MsgAlert(false, WARNING, format, ##__VA_ARGS__) | 53 | #define PanicAlertT(format, ...) MsgAlert(false, WARNING, format, ##__VA_ARGS__) |
| 54 | #define PanicYesNoT(format, ...) MsgAlert(true, WARNING, format, ##__VA_ARGS__) | 54 | #define PanicYesNoT(format, ...) MsgAlert(true, WARNING, format, ##__VA_ARGS__) |
| 55 | #define AskYesNoT(format, ...) MsgAlert(true, QUESTION, format, ##__VA_ARGS__) | 55 | #define AskYesNoT(format, ...) MsgAlert(true, QUESTION, format, ##__VA_ARGS__) |
| 56 | #define CriticalAlertT(format, ...) MsgAlert(false, CRITICAL, format, ##__VA_ARGS__) | 56 | #define CriticalAlertT(format, ...) MsgAlert(false, CRITICAL, format, ##__VA_ARGS__) |
| 57 | #endif | 57 | #endif |
| 58 | #else | 58 | #else |
| 59 | // GEKKO | 59 | // GEKKO |
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index 54943d306..dcec9275f 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp | |||
| @@ -121,11 +121,11 @@ std::string ArrayToString(const u8 *data, u32 size, int line_len, bool spaces) | |||
| 121 | { | 121 | { |
| 122 | std::ostringstream oss; | 122 | std::ostringstream oss; |
| 123 | oss << std::setfill('0') << std::hex; | 123 | oss << std::setfill('0') << std::hex; |
| 124 | 124 | ||
| 125 | for (int line = 0; size; ++data, --size) | 125 | for (int line = 0; size; ++data, --size) |
| 126 | { | 126 | { |
| 127 | oss << std::setw(2) << (int)*data; | 127 | oss << std::setw(2) << (int)*data; |
| 128 | 128 | ||
| 129 | if (line_len == ++line) | 129 | if (line_len == ++line) |
| 130 | { | 130 | { |
| 131 | oss << '\n'; | 131 | oss << '\n'; |
| @@ -168,7 +168,7 @@ bool TryParse(const std::string &str, u32 *const output) | |||
| 168 | errno = 0; | 168 | errno = 0; |
| 169 | 169 | ||
| 170 | unsigned long value = strtoul(str.c_str(), &endptr, 0); | 170 | unsigned long value = strtoul(str.c_str(), &endptr, 0); |
| 171 | 171 | ||
| 172 | if (!endptr || *endptr) | 172 | if (!endptr || *endptr) |
| 173 | return false; | 173 | return false; |
| 174 | 174 | ||
| @@ -294,7 +294,7 @@ std::string ReplaceAll(std::string result, const std::string& src, const std::st | |||
| 294 | //#include <string> | 294 | //#include <string> |
| 295 | //#include <assert.h> | 295 | //#include <assert.h> |
| 296 | 296 | ||
| 297 | const char HEX2DEC[256] = | 297 | const char HEX2DEC[256] = |
| 298 | { | 298 | { |
| 299 | /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ | 299 | /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ |
| 300 | /* 0 */ 16,16,16,16, 16,16,16,16, 16,16,16,16, 16,16,16,16, | 300 | /* 0 */ 16,16,16,16, 16,16,16,16, 16,16,16,16, 16,16,16,16, |
| @@ -327,7 +327,7 @@ std::string UriDecode(const std::string & sSrc) | |||
| 327 | const unsigned char * pSrc = (const unsigned char *)sSrc.c_str(); | 327 | const unsigned char * pSrc = (const unsigned char *)sSrc.c_str(); |
| 328 | const size_t SRC_LEN = sSrc.length(); | 328 | const size_t SRC_LEN = sSrc.length(); |
| 329 | const unsigned char * const SRC_END = pSrc + SRC_LEN; | 329 | const unsigned char * const SRC_END = pSrc + SRC_LEN; |
| 330 | const unsigned char * const SRC_LAST_DEC = SRC_END - 2; // last decodable '%' | 330 | const unsigned char * const SRC_LAST_DEC = SRC_END - 2; // last decodable '%' |
| 331 | 331 | ||
| 332 | char * const pStart = new char[SRC_LEN]; | 332 | char * const pStart = new char[SRC_LEN]; |
| 333 | char * pEnd = pStart; | 333 | char * pEnd = pStart; |
| @@ -394,7 +394,7 @@ std::string UriEncode(const std::string & sSrc) | |||
| 394 | 394 | ||
| 395 | for (; pSrc < SRC_END; ++pSrc) | 395 | for (; pSrc < SRC_END; ++pSrc) |
| 396 | { | 396 | { |
| 397 | if (SAFE[*pSrc]) | 397 | if (SAFE[*pSrc]) |
| 398 | *pEnd++ = *pSrc; | 398 | *pEnd++ = *pSrc; |
| 399 | else | 399 | else |
| 400 | { | 400 | { |
| @@ -518,9 +518,9 @@ static std::string CodeToUTF8(const char* fromcode, const std::basic_string<T>& | |||
| 518 | 518 | ||
| 519 | out_buffer.resize(out_buffer_size - dst_bytes); | 519 | out_buffer.resize(out_buffer_size - dst_bytes); |
| 520 | out_buffer.swap(result); | 520 | out_buffer.swap(result); |
| 521 | 521 | ||
| 522 | iconv_close(conv_desc); | 522 | iconv_close(conv_desc); |
| 523 | 523 | ||
| 524 | return result; | 524 | return result; |
| 525 | } | 525 | } |
| 526 | 526 | ||
| @@ -576,7 +576,7 @@ std::u16string UTF8ToUTF16(const std::string& input) | |||
| 576 | out_buffer.swap(result); | 576 | out_buffer.swap(result); |
| 577 | 577 | ||
| 578 | iconv_close(conv_desc); | 578 | iconv_close(conv_desc); |
| 579 | 579 | ||
| 580 | return result; | 580 | return result; |
| 581 | } | 581 | } |
| 582 | 582 | ||
diff --git a/src/common/string_util.h b/src/common/string_util.h index 787a5663f..ae5bbadad 100644 --- a/src/common/string_util.h +++ b/src/common/string_util.h | |||
| @@ -63,7 +63,7 @@ template <typename N> | |||
| 63 | static bool TryParse(const std::string &str, N *const output) | 63 | static bool TryParse(const std::string &str, N *const output) |
| 64 | { | 64 | { |
| 65 | std::istringstream iss(str); | 65 | std::istringstream iss(str); |
| 66 | 66 | ||
| 67 | N tmp = 0; | 67 | N tmp = 0; |
| 68 | if (iss >> tmp) | 68 | if (iss >> tmp) |
| 69 | { | 69 | { |
diff --git a/src/common/symbols.cpp b/src/common/symbols.cpp index d61f4c0c6..63ad6218b 100644 --- a/src/common/symbols.cpp +++ b/src/common/symbols.cpp | |||
| @@ -31,7 +31,7 @@ namespace Symbols | |||
| 31 | { | 31 | { |
| 32 | TSymbolsMap::iterator foundSymbolItr; | 32 | TSymbolsMap::iterator foundSymbolItr; |
| 33 | TSymbol symbol; | 33 | TSymbol symbol; |
| 34 | 34 | ||
| 35 | foundSymbolItr = g_symbols.find(_address); | 35 | foundSymbolItr = g_symbols.find(_address); |
| 36 | if (foundSymbolItr != g_symbols.end()) | 36 | if (foundSymbolItr != g_symbols.end()) |
| 37 | { | 37 | { |
| @@ -44,7 +44,7 @@ namespace Symbols | |||
| 44 | { | 44 | { |
| 45 | return GetSymbol(_address).name; | 45 | return GetSymbol(_address).name; |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | void Remove(u32 _address) | 48 | void Remove(u32 _address) |
| 49 | { | 49 | { |
| 50 | g_symbols.erase(_address); | 50 | g_symbols.erase(_address); |
diff --git a/src/common/thread.cpp b/src/common/thread.cpp index 60d8ed075..dc153ba71 100644 --- a/src/common/thread.cpp +++ b/src/common/thread.cpp | |||
| @@ -25,7 +25,7 @@ int CurrentThreadId() | |||
| 25 | return 0; | 25 | return 0; |
| 26 | #endif | 26 | #endif |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | #ifdef _WIN32 | 29 | #ifdef _WIN32 |
| 30 | 30 | ||
| 31 | void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask) | 31 | void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask) |
| @@ -52,7 +52,7 @@ void SwitchCurrentThread() | |||
| 52 | // Sets the debugger-visible name of the current thread. | 52 | // Sets the debugger-visible name of the current thread. |
| 53 | // Uses undocumented (actually, it is now documented) trick. | 53 | // Uses undocumented (actually, it is now documented) trick. |
| 54 | // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsdebug/html/vxtsksettingthreadname.asp | 54 | // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsdebug/html/vxtsksettingthreadname.asp |
| 55 | 55 | ||
| 56 | // This is implemented much nicer in upcoming msvc++, see: | 56 | // This is implemented much nicer in upcoming msvc++, see: |
| 57 | // http://msdn.microsoft.com/en-us/library/xcb2z8hs(VS.100).aspx | 57 | // http://msdn.microsoft.com/en-us/library/xcb2z8hs(VS.100).aspx |
| 58 | void SetCurrentThreadName(const char* szThreadName) | 58 | void SetCurrentThreadName(const char* szThreadName) |
| @@ -81,7 +81,7 @@ void SetCurrentThreadName(const char* szThreadName) | |||
| 81 | __except(EXCEPTION_CONTINUE_EXECUTION) | 81 | __except(EXCEPTION_CONTINUE_EXECUTION) |
| 82 | {} | 82 | {} |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | #else // !WIN32, so must be POSIX threads | 85 | #else // !WIN32, so must be POSIX threads |
| 86 | 86 | ||
| 87 | void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask) | 87 | void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask) |
diff --git a/src/common/thread.h b/src/common/thread.h index 5e7bc1f9c..be9b5cbe2 100644 --- a/src/common/thread.h +++ b/src/common/thread.h | |||
| @@ -30,7 +30,7 @@ int CurrentThreadId(); | |||
| 30 | 30 | ||
| 31 | void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask); | 31 | void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask); |
| 32 | void SetCurrentThreadAffinity(u32 mask); | 32 | void SetCurrentThreadAffinity(u32 mask); |
| 33 | 33 | ||
| 34 | class Event | 34 | class Event |
| 35 | { | 35 | { |
| 36 | public: | 36 | public: |
| @@ -135,7 +135,7 @@ private: | |||
| 135 | const size_t m_count; | 135 | const size_t m_count; |
| 136 | volatile size_t m_waiting; | 136 | volatile size_t m_waiting; |
| 137 | }; | 137 | }; |
| 138 | 138 | ||
| 139 | void SleepCurrentThread(int ms); | 139 | void SleepCurrentThread(int ms); |
| 140 | void SwitchCurrentThread(); // On Linux, this is equal to sleep 1ms | 140 | void SwitchCurrentThread(); // On Linux, this is equal to sleep 1ms |
| 141 | 141 | ||
| @@ -146,7 +146,7 @@ inline void YieldCPU() | |||
| 146 | { | 146 | { |
| 147 | std::this_thread::yield(); | 147 | std::this_thread::yield(); |
| 148 | } | 148 | } |
| 149 | 149 | ||
| 150 | void SetCurrentThreadName(const char *name); | 150 | void SetCurrentThreadName(const char *name); |
| 151 | 151 | ||
| 152 | } // namespace Common | 152 | } // namespace Common |
diff --git a/src/common/thread_queue_list.h b/src/common/thread_queue_list.h index 4a89572f6..59efbce4c 100644 --- a/src/common/thread_queue_list.h +++ b/src/common/thread_queue_list.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project / PPSSPP Project | 1 | // Copyright 2014 Citra Emulator Project / PPSSPP Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| @@ -12,7 +12,7 @@ template<class IdType> | |||
| 12 | struct ThreadQueueList { | 12 | struct ThreadQueueList { |
| 13 | // Number of queues (number of priority levels starting at 0.) | 13 | // Number of queues (number of priority levels starting at 0.) |
| 14 | static const int NUM_QUEUES = 128; | 14 | static const int NUM_QUEUES = 128; |
| 15 | 15 | ||
| 16 | // Initial number of threads a single queue can handle. | 16 | // Initial number of threads a single queue can handle. |
| 17 | static const int INITIAL_CAPACITY = 32; | 17 | static const int INITIAL_CAPACITY = 32; |
| 18 | 18 | ||