summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTING.md28
-rw-r--r--src/citra/citra.cpp2
-rw-r--r--src/citra_qt/bootmanager.cpp4
-rw-r--r--src/citra_qt/bootmanager.hxx2
-rw-r--r--src/citra_qt/debugger/callstack.cpp6
-rw-r--r--src/citra_qt/debugger/registers.hxx2
-rw-r--r--src/common/chunk_file.h14
-rw-r--r--src/common/common_funcs.h14
-rw-r--r--src/common/common_types.h2
-rw-r--r--src/common/console_listener.cpp24
-rw-r--r--src/common/extended_trace.cpp26
-rw-r--r--src/common/fifo_queue.h2
-rw-r--r--src/common/file_search.cpp2
-rw-r--r--src/common/file_util.cpp62
-rw-r--r--src/common/hash.cpp32
-rw-r--r--src/common/linear_disk_cache.h6
-rw-r--r--src/common/log.h6
-rw-r--r--src/common/log_manager.cpp10
-rw-r--r--src/common/log_manager.h4
-rw-r--r--src/common/math_util.cpp14
-rw-r--r--src/common/mem_arena.cpp10
-rw-r--r--src/common/memory_util.cpp8
-rw-r--r--src/common/msg_handler.h42
-rw-r--r--src/common/string_util.cpp18
-rw-r--r--src/common/string_util.h2
-rw-r--r--src/common/symbols.cpp4
-rw-r--r--src/common/thread.cpp6
-rw-r--r--src/common/thread.h8
-rw-r--r--src/common/thread_queue_list.h4
-rw-r--r--src/core/arm/arm_interface.h6
-rw-r--r--src/core/arm/disassembler/load_symbol_map.cpp4
-rw-r--r--src/core/arm/dyncom/arm_dyncom.cpp4
-rw-r--r--src/core/arm/dyncom/arm_dyncom.h2
-rw-r--r--src/core/arm/dyncom/arm_dyncom_interpreter.h2
-rw-r--r--src/core/arm/interpreter/arm_interpreter.cpp4
-rw-r--r--src/core/arm/interpreter/arm_interpreter.h2
-rw-r--r--src/core/core_timing.cpp4
-rw-r--r--src/core/file_sys/archive.h2
-rw-r--r--src/core/file_sys/archive_romfs.h2
-rw-r--r--src/core/hle/config_mem.cpp2
-rw-r--r--src/core/hle/coprocessor.cpp2
-rw-r--r--src/core/hle/function_wrappers.h4
-rw-r--r--src/core/hle/hle.cpp6
-rw-r--r--src/core/hle/hle.h2
-rw-r--r--src/core/hle/kernel/address_arbiter.h2
-rw-r--r--src/core/hle/kernel/archive.cpp6
-rw-r--r--src/core/hle/kernel/event.cpp4
-rw-r--r--src/core/hle/kernel/event.h2
-rw-r--r--src/core/hle/kernel/kernel.cpp6
-rw-r--r--src/core/hle/kernel/kernel.h10
-rw-r--r--src/core/hle/kernel/mutex.cpp4
-rw-r--r--src/core/hle/kernel/mutex.h2
-rw-r--r--src/core/hle/kernel/shared_memory.cpp4
-rw-r--r--src/core/hle/kernel/shared_memory.h4
-rw-r--r--src/core/hle/kernel/thread.cpp38
-rw-r--r--src/core/hle/kernel/thread.h2
-rw-r--r--src/core/hle/service/ac_u.h2
-rw-r--r--src/core/hle/service/apt_u.cpp4
-rw-r--r--src/core/hle/service/apt_u.h4
-rw-r--r--src/core/hle/service/boss_u.cpp4
-rw-r--r--src/core/hle/service/err_f.cpp4
-rw-r--r--src/core/hle/service/err_f.h2
-rw-r--r--src/core/hle/service/fs_user.cpp2
-rw-r--r--src/core/hle/service/hid_user.h2
-rw-r--r--src/core/hle/service/mic_u.cpp2
-rw-r--r--src/core/hle/service/service.cpp2
-rw-r--r--src/core/hle/service/service.h14
-rw-r--r--src/core/hle/svc.cpp28
-rw-r--r--src/core/hle/svc.h2
-rw-r--r--src/core/hw/hw.cpp6
-rw-r--r--src/core/loader/elf.cpp4
-rw-r--r--src/core/loader/ncch.cpp6
-rw-r--r--src/core/loader/ncch.h2
-rw-r--r--src/video_core/renderer_base.h2
-rw-r--r--src/video_core/utils.cpp4
75 files changed, 296 insertions, 296 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index cb1067c92..302afe216 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -28,23 +28,23 @@ Follow the indentation/whitespace style shown below. Do not use tabs, use 4-spac
28namespace Example { 28namespace Example {
29 29
30// Namespace contents are not indented 30// Namespace contents are not indented
31 31
32// Declare globals at the top 32// Declare globals at the top
33int g_foo = 0; 33int g_foo = 0;
34char* g_some_pointer; // Notice the position of the * 34char* g_some_pointer; // Notice the position of the *
35 35
36enum SomeEnum { 36enum SomeEnum {
37 COLOR_RED, 37 COLOR_RED,
38 COLOR_GREEN, 38 COLOR_GREEN,
39 COLOR_BLUE 39 COLOR_BLUE
40}; 40};
41 41
42struct Position { 42struct Position {
43 int x, y; 43 int x, y;
44}; 44};
45 45
46// Use "typename" rather than "class" here, just to be consistent 46// Use "typename" rather than "class" here, just to be consistent
47template 47template
48void FooBar() { 48void FooBar() {
49 int some_array[] = { 49 int some_array[] = {
50 5, 50 5,
@@ -52,29 +52,29 @@ void FooBar() {
52 7, 52 7,
53 42 53 42
54 }; 54 };
55 55
56 if (note == the_space_after_the_if) { 56 if (note == the_space_after_the_if) {
57 CallAfunction(); 57 CallAfunction();
58 } else { 58 } else {
59 // Use a space after the // when commenting 59 // Use a space after the // when commenting
60 } 60 }
61 61
62 // Comment directly above code when possible 62 // Comment directly above code when possible
63 if (some_condition) single_statement(); 63 if (some_condition) single_statement();
64 64
65 // Place a single space after the for loop semicolons 65 // Place a single space after the for loop semicolons
66 for (int i = 0; i != 25; ++i) { 66 for (int i = 0; i != 25; ++i) {
67 // This is how we write loops 67 // This is how we write loops
68 } 68 }
69 69
70 DoStuff(this, function, call, takes, up, multiple, 70 DoStuff(this, function, call, takes, up, multiple,
71 lines, like, this); 71 lines, like, this);
72 72
73 if (this || condition_takes_up_multiple && 73 if (this || condition_takes_up_multiple &&
74 lines && like && this || everything || 74 lines && like && this || everything ||
75 alright || then) { 75 alright || then) {
76 } 76 }
77 77
78 switch (var) { 78 switch (var) {
79 // No indentation for case label 79 // No indentation for case label
80 case 1: { 80 case 1: {
@@ -85,18 +85,18 @@ void FooBar() {
85 case 3: 85 case 3:
86 DoSomething(var); 86 DoSomething(var);
87 return; 87 return;
88 88
89 default: 89 default:
90 // Yes, even break for the last case 90 // Yes, even break for the last case
91 break; 91 break;
92 } 92 }
93 93
94 std::vector 94 std::vector
95 you_can_declare, 95 you_can_declare,
96 a_few, 96 a_few,
97 variables, 97 variables,
98 like_this; 98 like_this;
99} 99}
100 100
101} 101}
102``` 102```
diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp
index 41b62ac16..f2aeb510e 100644
--- a/src/citra/citra.cpp
+++ b/src/citra/citra.cpp
@@ -23,7 +23,7 @@ int __cdecl main(int argc, char **argv) {
23 } 23 }
24 24
25 Config config; 25 Config config;
26 26
27 if (!Settings::values.enable_log) 27 if (!Settings::values.enable_log)
28 LogManager::Shutdown(); 28 LogManager::Shutdown();
29 29
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp
index 758f71fda..20623c939 100644
--- a/src/citra_qt/bootmanager.cpp
+++ b/src/citra_qt/bootmanager.cpp
@@ -23,7 +23,7 @@
23#define APP_TITLE APP_NAME " " APP_VERSION 23#define APP_TITLE APP_NAME " " APP_VERSION
24#define COPYRIGHT "Copyright (C) 2013-2014 Citra Team" 24#define COPYRIGHT "Copyright (C) 2013-2014 Citra Team"
25 25
26EmuThread::EmuThread(GRenderWindow* render_window) : 26EmuThread::EmuThread(GRenderWindow* render_window) :
27 filename(""), exec_cpu_step(false), cpu_running(false), 27 filename(""), exec_cpu_step(false), cpu_running(false),
28 stop_run(false), render_window(render_window) 28 stop_run(false), render_window(render_window)
29{ 29{
@@ -42,7 +42,7 @@ void EmuThread::run()
42 if (cpu_running) 42 if (cpu_running)
43 { 43 {
44 Core::RunLoop(); 44 Core::RunLoop();
45 } 45 }
46 else if (exec_cpu_step) 46 else if (exec_cpu_step)
47 { 47 {
48 exec_cpu_step = false; 48 exec_cpu_step = false;
diff --git a/src/citra_qt/bootmanager.hxx b/src/citra_qt/bootmanager.hxx
index 3eec1668e..5f69f15ea 100644
--- a/src/citra_qt/bootmanager.hxx
+++ b/src/citra_qt/bootmanager.hxx
@@ -18,7 +18,7 @@ class EmuThread : public QThread
18public: 18public:
19 /** 19 /**
20 * Set image filename 20 * Set image filename
21 * 21 *
22 * @param filename 22 * @param filename
23 * @warning Only call when not running! 23 * @warning Only call when not running!
24 */ 24 */
diff --git a/src/citra_qt/debugger/callstack.cpp b/src/citra_qt/debugger/callstack.cpp
index 77fb0c9ed..895851be3 100644
--- a/src/citra_qt/debugger/callstack.cpp
+++ b/src/citra_qt/debugger/callstack.cpp
@@ -28,7 +28,7 @@ void CallstackWidget::OnCPUStepped()
28 28
29 u32 sp = app_core->GetReg(13); //stack pointer 29 u32 sp = app_core->GetReg(13); //stack pointer
30 u32 addr, ret_addr, call_addr, func_addr; 30 u32 addr, ret_addr, call_addr, func_addr;
31 31
32 int counter = 0; 32 int counter = 0;
33 for (int addr = 0x10000000; addr >= sp; addr -= 4) 33 for (int addr = 0x10000000; addr >= sp; addr -= 4)
34 { 34 {
@@ -55,7 +55,7 @@ void CallstackWidget::OnCPUStepped()
55 callstack_model->setItem(counter, 0, new QStandardItem(QString("0x%1").arg(addr, 8, 16, QLatin1Char('0')))); 55 callstack_model->setItem(counter, 0, new QStandardItem(QString("0x%1").arg(addr, 8, 16, QLatin1Char('0'))));
56 callstack_model->setItem(counter, 1, new QStandardItem(QString("0x%1").arg(ret_addr, 8, 16, QLatin1Char('0')))); 56 callstack_model->setItem(counter, 1, new QStandardItem(QString("0x%1").arg(ret_addr, 8, 16, QLatin1Char('0'))));
57 callstack_model->setItem(counter, 2, new QStandardItem(QString("0x%1").arg(call_addr, 8, 16, QLatin1Char('0')))); 57 callstack_model->setItem(counter, 2, new QStandardItem(QString("0x%1").arg(call_addr, 8, 16, QLatin1Char('0'))));
58 58
59 name = Symbols::HasSymbol(func_addr) ? Symbols::GetSymbol(func_addr).name : "unknown"; 59 name = Symbols::HasSymbol(func_addr) ? Symbols::GetSymbol(func_addr).name : "unknown";
60 callstack_model->setItem(counter, 3, new QStandardItem(QString("%1_%2").arg(QString::fromStdString(name)) 60 callstack_model->setItem(counter, 3, new QStandardItem(QString("%1_%2").arg(QString::fromStdString(name))
61 .arg(QString("0x%1").arg(func_addr, 8, 16, QLatin1Char('0'))))); 61 .arg(QString("0x%1").arg(func_addr, 8, 16, QLatin1Char('0')))));
@@ -63,4 +63,4 @@ void CallstackWidget::OnCPUStepped()
63 counter++; 63 counter++;
64 } 64 }
65 } 65 }
66} \ No newline at end of file 66}
diff --git a/src/citra_qt/debugger/registers.hxx b/src/citra_qt/debugger/registers.hxx
index 9645feb2a..b525aa49e 100644
--- a/src/citra_qt/debugger/registers.hxx
+++ b/src/citra_qt/debugger/registers.hxx
@@ -19,7 +19,7 @@ private:
19 Ui::ARMRegisters cpu_regs_ui; 19 Ui::ARMRegisters cpu_regs_ui;
20 20
21 QTreeWidget* tree; 21 QTreeWidget* tree;
22 22
23 QTreeWidgetItem* registers; 23 QTreeWidgetItem* registers;
24 QTreeWidgetItem* CSPR; 24 QTreeWidgetItem* CSPR;
25}; 25};
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);}
168inline u32 swap32(u32 _data) {return _byteswap_ulong (_data);} 168inline u32 swap32(u32 _data) {return _byteswap_ulong (_data);}
169inline u64 swap64(u64 _data) {return _byteswap_uint64(_data);} 169inline u64 swap64(u64 _data) {return _byteswap_uint64(_data);}
170#elif _M_ARM 170#elif _M_ARM
171inline u16 swap16 (u16 _data) { u32 data = _data; __asm__ ("rev16 %0, %1\n" : "=l" (data) : "l" (data)); return (u16)data;} 171inline u16 swap16 (u16 _data) { u32 data = _data; __asm__ ("rev16 %0, %1\n" : "=l" (data) : "l" (data)); return (u16)data;}
172inline u32 swap32 (u32 _data) {__asm__ ("rev %0, %1\n" : "=l" (_data) : "l" (_data)); return _data;} 172inline u32 swap32 (u32 _data) {__asm__ ("rev %0, %1\n" : "=l" (_data) : "l" (_data)); return _data;}
173inline u64 swap64(u64 _data) {return ((u64)swap32(_data) << 32) | swap32(_data >> 32);} 173inline u64 swap64(u64 _data) {return ((u64)swap32(_data) << 32) | swap32(_data >> 32);}
174#elif __linux__ 174#elif __linux__
175inline u16 swap16(u16 _data) {return bswap_16(_data);} 175inline u16 swap16(u16 _data) {return bswap_16(_data);}
@@ -226,7 +226,7 @@ template <typename T>
226inline T FromBigEndian(T data) 226inline 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*/
91void ConsoleListener::BufferWidthHeight(int BufferWidth, int BufferHeight, int ScreenWidth, int ScreenHeight, bool BufferFirst) 91void 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
298void ConsoleListener::ClearScreen(bool Cursor) 298void 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;
29void PCSTR2LPTSTR( PCSTR lpszIn, LPTSTR lpszOut ) 29void 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
236bool Rename(const std::string &srcFilename, const std::string &destFilename) 236bool 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
248bool Copy(const std::string &srcFilename, const std::string &destFilename) 248bool 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
388bool CreateEmptyFile(const std::string &filename) 388bool 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)
585std::string GetCurrentDir() 585std::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__)
607std::string GetBundleDirectory() 607std::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
116inline void bmix64(u64 & h1, u64 & h2, u64 & k1, u64 & k2, u64 & c1, u64 & c2) 116inline 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
304u64 GetCRC32(const u8 *src, int len, u32 samples) 304u64 GetCRC32(const u8 *src, int len, u32 samples)
@@ -351,15 +351,15 @@ inline u32 fmix32(u32 h)
351 351
352inline void bmix32(u32 & h1, u32 & h2, u32 & k1, u32 & k2, u32 & c1, u32 & c2) 352inline 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 @@
11enum { 11enum {
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
92void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type, const char*file, int line, 92void 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
12void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char* file, int line, 12void 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
115void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char* file, 115void 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{
55public: 55public:
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
281static bool Memory_TryBase(u8 *base, const MemoryView *views, int num_views, u32 flags, MemArena *arena) { 281static 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
18typedef bool (*MsgAlertHandler)(const char* caption, const char* text, 18typedef bool (*MsgAlertHandler)(const char* caption, const char* text,
19 bool yes_no, int Style); 19 bool yes_no, int Style);
20typedef std::string (*StringTranslator)(const char* text); 20typedef 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
297const char HEX2DEC[256] = 297const 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>
63static bool TryParse(const std::string &str, N *const output) 63static 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
31void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask) 31void 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
58void SetCurrentThreadName(const char* szThreadName) 58void 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
87void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask) 87void 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
31void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask); 31void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask);
32void SetCurrentThreadAffinity(u32 mask); 32void SetCurrentThreadAffinity(u32 mask);
33 33
34class Event 34class Event
35{ 35{
36public: 36public:
@@ -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
139void SleepCurrentThread(int ms); 139void SleepCurrentThread(int ms);
140void SwitchCurrentThread(); // On Linux, this is equal to sleep 1ms 140void 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
150void SetCurrentThreadName(const char *name); 150void 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>
12struct ThreadQueueList { 12struct 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
diff --git a/src/core/arm/arm_interface.h b/src/core/arm/arm_interface.h
index 4b93d3313..3ae528562 100644
--- a/src/core/arm/arm_interface.h
+++ b/src/core/arm/arm_interface.h
@@ -1,6 +1,6 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator 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
@@ -63,7 +63,7 @@ public:
63 * Get the current CPSR register 63 * Get the current CPSR register
64 * @return Returns the value of the CPSR register 64 * @return Returns the value of the CPSR register
65 */ 65 */
66 virtual u32 GetCPSR() const = 0; 66 virtual u32 GetCPSR() const = 0;
67 67
68 /** 68 /**
69 * Set the current CPSR register 69 * Set the current CPSR register
@@ -98,7 +98,7 @@ public:
98 } 98 }
99 99
100protected: 100protected:
101 101
102 /** 102 /**
103 * Executes the given number of instructions 103 * Executes the given number of instructions
104 * @param num_instructions Number of instructions to executes 104 * @param num_instructions Number of instructions to executes
diff --git a/src/core/arm/disassembler/load_symbol_map.cpp b/src/core/arm/disassembler/load_symbol_map.cpp
index 0f384ad3e..55278474b 100644
--- a/src/core/arm/disassembler/load_symbol_map.cpp
+++ b/src/core/arm/disassembler/load_symbol_map.cpp
@@ -22,8 +22,8 @@ void LoadSymbolMap(std::string filename) {
22 22
23 while (std::getline(infile, line)) { 23 while (std::getline(infile, line)) {
24 std::istringstream iss(line); 24 std::istringstream iss(line);
25 if (!(iss >> address_str >> size >> function_name)) { 25 if (!(iss >> address_str >> size >> function_name)) {
26 break; // Error parsing 26 break; // Error parsing
27 } 27 }
28 u32 address = std::stoul(address_str, nullptr, 16); 28 u32 address = std::stoul(address_str, nullptr, 16);
29 29
diff --git a/src/core/arm/dyncom/arm_dyncom.cpp b/src/core/arm/dyncom/arm_dyncom.cpp
index a3ed3e31e..6c8ea211e 100644
--- a/src/core/arm/dyncom/arm_dyncom.cpp
+++ b/src/core/arm/dyncom/arm_dyncom.cpp
@@ -1,6 +1,6 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator 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#include "core/arm/skyeye_common/armcpu.h" 5#include "core/arm/skyeye_common/armcpu.h"
6#include "core/arm/skyeye_common/armemu.h" 6#include "core/arm/skyeye_common/armemu.h"
@@ -113,7 +113,7 @@ void ARM_DynCom::ExecuteInstructions(int num_instructions) {
113 state->NumInstrsToExecute = num_instructions; 113 state->NumInstrsToExecute = num_instructions;
114 114
115 // Dyncom only breaks on instruction dispatch. This only happens on every instruction when 115 // Dyncom only breaks on instruction dispatch. This only happens on every instruction when
116 // executing one instruction at a time. Otherwise, if a block is being executed, more 116 // executing one instruction at a time. Otherwise, if a block is being executed, more
117 // instructions may actually be executed than specified. 117 // instructions may actually be executed than specified.
118 ticks += InterpreterMainLoop(state.get()); 118 ticks += InterpreterMainLoop(state.get());
119} 119}
diff --git a/src/core/arm/dyncom/arm_dyncom.h b/src/core/arm/dyncom/arm_dyncom.h
index f3c70b7d3..51eea41ed 100644
--- a/src/core/arm/dyncom/arm_dyncom.h
+++ b/src/core/arm/dyncom/arm_dyncom.h
@@ -1,6 +1,6 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator 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
diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.h b/src/core/arm/dyncom/arm_dyncom_interpreter.h
index c65eb23f7..3a2462f55 100644
--- a/src/core/arm/dyncom/arm_dyncom_interpreter.h
+++ b/src/core/arm/dyncom/arm_dyncom_interpreter.h
@@ -1,6 +1,6 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator 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
diff --git a/src/core/arm/interpreter/arm_interpreter.cpp b/src/core/arm/interpreter/arm_interpreter.cpp
index ed4415082..e2aa5ce92 100644
--- a/src/core/arm/interpreter/arm_interpreter.cpp
+++ b/src/core/arm/interpreter/arm_interpreter.cpp
@@ -1,6 +1,6 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator 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#include "core/arm/interpreter/arm_interpreter.h" 5#include "core/arm/interpreter/arm_interpreter.h"
6 6
@@ -24,7 +24,7 @@ ARM_Interpreter::ARM_Interpreter() {
24 state->lateabtSig = LOW; 24 state->lateabtSig = LOW;
25 25
26 // Reset the core to initial state 26 // Reset the core to initial state
27 ARMul_CoProInit(state); 27 ARMul_CoProInit(state);
28 ARMul_Reset(state); 28 ARMul_Reset(state);
29 state->NextInstr = RESUME; // NOTE: This will be overwritten by LoadContext 29 state->NextInstr = RESUME; // NOTE: This will be overwritten by LoadContext
30 state->Emulate = 3; 30 state->Emulate = 3;
diff --git a/src/core/arm/interpreter/arm_interpreter.h b/src/core/arm/interpreter/arm_interpreter.h
index f1e7198c5..ed53d997c 100644
--- a/src/core/arm/interpreter/arm_interpreter.h
+++ b/src/core/arm/interpreter/arm_interpreter.h
@@ -1,6 +1,6 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator 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
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp
index 0116cb376..d6e9dc849 100644
--- a/src/core/core_timing.cpp
+++ b/src/core/core_timing.cpp
@@ -249,7 +249,7 @@ void AddEventToQueue(Event* ne)
249 249
250// This must be run ONLY from within the cpu thread 250// This must be run ONLY from within the cpu thread
251// cyclesIntoFuture may be VERY inaccurate if called from anything else 251// cyclesIntoFuture may be VERY inaccurate if called from anything else
252// than Advance 252// than Advance
253void ScheduleEvent(s64 cyclesIntoFuture, int event_type, u64 userdata) 253void ScheduleEvent(s64 cyclesIntoFuture, int event_type, u64 userdata)
254{ 254{
255 Event *ne = GetNewEvent(); 255 Event *ne = GetNewEvent();
@@ -469,7 +469,7 @@ void ProcessFifoWaitEvents()
469 { 469 {
470 if (first->time <= globalTimer) 470 if (first->time <= globalTimer)
471 { 471 {
472 // LOG(TIMER, "[Scheduler] %s (%lld, %lld) ", 472 // LOG(TIMER, "[Scheduler] %s (%lld, %lld) ",
473 // first->name ? first->name : "?", (u64)globalTimer, (u64)first->time); 473 // first->name ? first->name : "?", (u64)globalTimer, (u64)first->time);
474 Event* evt = first; 474 Event* evt = first;
475 first = first->next; 475 first = first->next;
diff --git a/src/core/file_sys/archive.h b/src/core/file_sys/archive.h
index dc2d2ced9..1135d8804 100644
--- a/src/core/file_sys/archive.h
+++ b/src/core/file_sys/archive.h
@@ -222,7 +222,7 @@ public:
222 * @return Size of the archive in bytes 222 * @return Size of the archive in bytes
223 */ 223 */
224 virtual size_t GetSize() const = 0; 224 virtual size_t GetSize() const = 0;
225 225
226 /** 226 /**
227 * Set the size of the archive in bytes 227 * Set the size of the archive in bytes
228 */ 228 */
diff --git a/src/core/file_sys/archive_romfs.h b/src/core/file_sys/archive_romfs.h
index b0dd421b7..f05327f51 100644
--- a/src/core/file_sys/archive_romfs.h
+++ b/src/core/file_sys/archive_romfs.h
@@ -74,7 +74,7 @@ public:
74 * @return Size of the archive in bytes 74 * @return Size of the archive in bytes
75 */ 75 */
76 size_t GetSize() const override; 76 size_t GetSize() const override;
77 77
78 /** 78 /**
79 * Set the size of the archive in bytes 79 * Set the size of the archive in bytes
80 */ 80 */
diff --git a/src/core/hle/config_mem.cpp b/src/core/hle/config_mem.cpp
index a45e61427..c7cf5b1d3 100644
--- a/src/core/hle/config_mem.cpp
+++ b/src/core/hle/config_mem.cpp
@@ -1,6 +1,6 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator 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#include "common/common_types.h" 5#include "common/common_types.h"
6 6
diff --git a/src/core/hle/coprocessor.cpp b/src/core/hle/coprocessor.cpp
index 1eb33eb86..e34229a57 100644
--- a/src/core/hle/coprocessor.cpp
+++ b/src/core/hle/coprocessor.cpp
@@ -1,6 +1,6 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator 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#include "core/hle/coprocessor.h" 5#include "core/hle/coprocessor.h"
6#include "core/hle/hle.h" 6#include "core/hle/hle.h"
diff --git a/src/core/hle/function_wrappers.h b/src/core/hle/function_wrappers.h
index 55eaf0621..3dbe25037 100644
--- a/src/core/hle/function_wrappers.h
+++ b/src/core/hle/function_wrappers.h
@@ -50,7 +50,7 @@ template<s32 func(u32*, u32, u32, u32, u32, u32)> void Wrap(){
50 50
51template<s32 func(s32*, u32*, s32, bool, s64)> void Wrap() { 51template<s32 func(s32*, u32*, s32, bool, s64)> void Wrap() {
52 s32 param_1 = 0; 52 s32 param_1 = 0;
53 s32 retval = func(&param_1, (Handle*)Memory::GetPointer(PARAM(1)), (s32)PARAM(2), 53 s32 retval = func(&param_1, (Handle*)Memory::GetPointer(PARAM(1)), (s32)PARAM(2),
54 (PARAM(3) != 0), (((s64)PARAM(4) << 32) | PARAM(0))); 54 (PARAM(3) != 0), (((s64)PARAM(4) << 32) | PARAM(0)));
55 Core::g_app_core->SetReg(1, (u32)param_1); 55 Core::g_app_core->SetReg(1, (u32)param_1);
56 FuncReturn(retval); 56 FuncReturn(retval);
@@ -103,7 +103,7 @@ template<s32 func(void*)> void Wrap() {
103} 103}
104 104
105template<s32 func(s64*, u32, void*, s32)> void Wrap(){ 105template<s32 func(s64*, u32, void*, s32)> void Wrap(){
106 FuncReturn(func((s64*)Memory::GetPointer(PARAM(0)), PARAM(1), Memory::GetPointer(PARAM(2)), 106 FuncReturn(func((s64*)Memory::GetPointer(PARAM(0)), PARAM(1), Memory::GetPointer(PARAM(2)),
107 (s32)PARAM(3))); 107 (s32)PARAM(3)));
108} 108}
109 109
diff --git a/src/core/hle/hle.cpp b/src/core/hle/hle.cpp
index b03894ad7..b8ac186f6 100644
--- a/src/core/hle/hle.cpp
+++ b/src/core/hle/hle.cpp
@@ -1,6 +1,6 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator 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#include <vector> 5#include <vector>
6 6
@@ -20,7 +20,7 @@ bool g_reschedule = false; ///< If true, immediately reschedules the CPU to a n
20const FunctionDef* GetSVCInfo(u32 opcode) { 20const FunctionDef* GetSVCInfo(u32 opcode) {
21 u32 func_num = opcode & 0xFFFFFF; // 8 bits 21 u32 func_num = opcode & 0xFFFFFF; // 8 bits
22 if (func_num > 0xFF) { 22 if (func_num > 0xFF) {
23 ERROR_LOG(HLE,"unknown svc=0x%02X", func_num); 23 ERROR_LOG(HLE,"unknown svc=0x%02X", func_num);
24 return nullptr; 24 return nullptr;
25 } 25 }
26 return &g_module_db[0].func_table[func_num]; 26 return &g_module_db[0].func_table[func_num];
@@ -58,7 +58,7 @@ void RegisterAllModules() {
58 58
59void Init() { 59void Init() {
60 Service::Init(); 60 Service::Init();
61 61
62 RegisterAllModules(); 62 RegisterAllModules();
63 63
64 NOTICE_LOG(HLE, "initialized OK"); 64 NOTICE_LOG(HLE, "initialized OK");
diff --git a/src/core/hle/hle.h b/src/core/hle/hle.h
index bf4d84575..4ab258c69 100644
--- a/src/core/hle/hle.h
+++ b/src/core/hle/hle.h
@@ -1,6 +1,6 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator 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
diff --git a/src/core/hle/kernel/address_arbiter.h b/src/core/hle/kernel/address_arbiter.h
index a483fe466..6886e479d 100644
--- a/src/core/hle/kernel/address_arbiter.h
+++ b/src/core/hle/kernel/address_arbiter.h
@@ -11,7 +11,7 @@
11// Address arbiters are an underlying kernel synchronization object that can be created/used via 11// Address arbiters are an underlying kernel synchronization object that can be created/used via
12// supervisor calls (SVCs). They function as sort of a global lock. Typically, games/other CTR 12// supervisor calls (SVCs). They function as sort of a global lock. Typically, games/other CTR
13// applications use them as an underlying mechanism to implement thread-safe barriers, events, and 13// applications use them as an underlying mechanism to implement thread-safe barriers, events, and
14// semphores. 14// semphores.
15 15
16//////////////////////////////////////////////////////////////////////////////////////////////////// 16////////////////////////////////////////////////////////////////////////////////////////////////////
17// Kernel namespace 17// Kernel namespace
diff --git a/src/core/hle/kernel/archive.cpp b/src/core/hle/kernel/archive.cpp
index 8f1c95d0f..d9ee4682a 100644
--- a/src/core/hle/kernel/archive.cpp
+++ b/src/core/hle/kernel/archive.cpp
@@ -52,14 +52,14 @@ public:
52 FileSys::Archive* backend; ///< Archive backend interface 52 FileSys::Archive* backend; ///< Archive backend interface
53 53
54 /** 54 /**
55 * Synchronize kernel object 55 * Synchronize kernel object
56 * @param wait Boolean wait set if current thread should wait as a result of sync operation 56 * @param wait Boolean wait set if current thread should wait as a result of sync operation
57 * @return Result of operation, 0 on success, otherwise error code 57 * @return Result of operation, 0 on success, otherwise error code
58 */ 58 */
59 Result SyncRequest(bool* wait) override { 59 Result SyncRequest(bool* wait) override {
60 u32* cmd_buff = Service::GetCommandBuffer(); 60 u32* cmd_buff = Service::GetCommandBuffer();
61 FileCommand cmd = static_cast<FileCommand>(cmd_buff[0]); 61 FileCommand cmd = static_cast<FileCommand>(cmd_buff[0]);
62 62
63 switch (cmd) { 63 switch (cmd) {
64 // Read from archive... 64 // Read from archive...
65 case FileCommand::Read: 65 case FileCommand::Read:
@@ -343,7 +343,7 @@ Archive* CreateArchive(Handle& handle, FileSys::Archive* backend, const std::str
343 archive->backend = backend; 343 archive->backend = backend;
344 344
345 MountArchive(archive); 345 MountArchive(archive);
346 346
347 return archive; 347 return archive;
348} 348}
349 349
diff --git a/src/core/hle/kernel/event.cpp b/src/core/hle/kernel/event.cpp
index 45ed79be8..e0117c0bc 100644
--- a/src/core/hle/kernel/event.cpp
+++ b/src/core/hle/kernel/event.cpp
@@ -1,6 +1,6 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator 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#include <map> 5#include <map>
6#include <algorithm> 6#include <algorithm>
@@ -95,7 +95,7 @@ Result SignalEvent(const Handle handle) {
95 for (size_t i = 0; i < evt->waiting_threads.size(); ++i) { 95 for (size_t i = 0; i < evt->waiting_threads.size(); ++i) {
96 ResumeThreadFromWait( evt->waiting_threads[i]); 96 ResumeThreadFromWait( evt->waiting_threads[i]);
97 97
98 // If any thread is signalled awake by this event, assume the event was "caught" and reset 98 // If any thread is signalled awake by this event, assume the event was "caught" and reset
99 // the event. This will result in the next thread waiting on the event to block. Otherwise, 99 // the event. This will result in the next thread waiting on the event to block. Otherwise,
100 // the event will not be reset, and the next thread to call WaitSynchronization on it will 100 // the event will not be reset, and the next thread to call WaitSynchronization on it will
101 // not block. Not sure if this is correct behavior, but it seems to work. 101 // not block. Not sure if this is correct behavior, but it seems to work.
diff --git a/src/core/hle/kernel/event.h b/src/core/hle/kernel/event.h
index c39b33180..6add72897 100644
--- a/src/core/hle/kernel/event.h
+++ b/src/core/hle/kernel/event.h
@@ -1,6 +1,6 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator 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
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index 88cbc1af5..018000abd 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -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#include "common/common.h" 5#include "common/common.h"
6 6
@@ -68,7 +68,7 @@ void ObjectPool::List() {
68 for (int i = 0; i < MAX_COUNT; i++) { 68 for (int i = 0; i < MAX_COUNT; i++) {
69 if (occupied[i]) { 69 if (occupied[i]) {
70 if (pool[i]) { 70 if (pool[i]) {
71 INFO_LOG(KERNEL, "KO %i: %s \"%s\"", i + HANDLE_OFFSET, pool[i]->GetTypeName().c_str(), 71 INFO_LOG(KERNEL, "KO %i: %s \"%s\"", i + HANDLE_OFFSET, pool[i]->GetTypeName().c_str(),
72 pool[i]->GetName().c_str()); 72 pool[i]->GetName().c_str());
73 } 73 }
74 } 74 }
@@ -110,7 +110,7 @@ void Shutdown() {
110 */ 110 */
111bool LoadExec(u32 entry_point) { 111bool LoadExec(u32 entry_point) {
112 Init(); 112 Init();
113 113
114 Core::g_app_core->SetPC(entry_point); 114 Core::g_app_core->SetPC(entry_point);
115 115
116 // 0x30 is the typical main thread priority I've seen used so far 116 // 0x30 is the typical main thread priority I've seen used so far
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h
index dd7c91d4f..e0c94f186 100644
--- a/src/core/hle/kernel/kernel.h
+++ b/src/core/hle/kernel/kernel.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
@@ -34,7 +34,7 @@ enum class HandleType : u32 {
34 Archive = 12, 34 Archive = 12,
35 Directory = 13, 35 Directory = 13,
36}; 36};
37 37
38enum { 38enum {
39 DEFAULT_STACK_SIZE = 0x4000, 39 DEFAULT_STACK_SIZE = 0x4000,
40}; 40};
@@ -52,7 +52,7 @@ public:
52 virtual Kernel::HandleType GetHandleType() const = 0; 52 virtual Kernel::HandleType GetHandleType() const = 0;
53 53
54 /** 54 /**
55 * Synchronize kernel object 55 * Synchronize kernel object
56 * @param wait Boolean wait set if current thread should wait as a result of sync operation 56 * @param wait Boolean wait set if current thread should wait as a result of sync operation
57 * @return Result of operation, 0 on success, otherwise error code 57 * @return Result of operation, 0 on success, otherwise error code
58 */ 58 */
@@ -139,7 +139,7 @@ public:
139 } 139 }
140 140
141 bool GetIDType(Handle handle, HandleType* type) const { 141 bool GetIDType(Handle handle, HandleType* type) const {
142 if ((handle < HANDLE_OFFSET) || (handle >= HANDLE_OFFSET + MAX_COUNT) || 142 if ((handle < HANDLE_OFFSET) || (handle >= HANDLE_OFFSET + MAX_COUNT) ||
143 !occupied[handle - HANDLE_OFFSET]) { 143 !occupied[handle - HANDLE_OFFSET]) {
144 ERROR_LOG(KERNEL, "Kernel: Bad object handle %i (%08x)", handle, handle); 144 ERROR_LOG(KERNEL, "Kernel: Bad object handle %i (%08x)", handle, handle);
145 return false; 145 return false;
@@ -155,7 +155,7 @@ public:
155 int GetCount(); 155 int GetCount();
156 156
157private: 157private:
158 158
159 enum { 159 enum {
160 MAX_COUNT = 0x1000, 160 MAX_COUNT = 0x1000,
161 HANDLE_OFFSET = 0x100, 161 HANDLE_OFFSET = 0x100,
diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp
index fcfd061ac..31129fd86 100644
--- a/src/core/hle/kernel/mutex.cpp
+++ b/src/core/hle/kernel/mutex.cpp
@@ -1,6 +1,6 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator 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#include <map> 5#include <map>
6#include <vector> 6#include <vector>
@@ -28,7 +28,7 @@ public:
28 std::string name; ///< Name of mutex (optional) 28 std::string name; ///< Name of mutex (optional)
29 29
30 /** 30 /**
31 * Synchronize kernel object 31 * Synchronize kernel object
32 * @param wait Boolean wait set if current thread should wait as a result of sync operation 32 * @param wait Boolean wait set if current thread should wait as a result of sync operation
33 * @return Result of operation, 0 on success, otherwise error code 33 * @return Result of operation, 0 on success, otherwise error code
34 */ 34 */
diff --git a/src/core/hle/kernel/mutex.h b/src/core/hle/kernel/mutex.h
index 7d7b5137e..313ba6fee 100644
--- a/src/core/hle/kernel/mutex.h
+++ b/src/core/hle/kernel/mutex.h
@@ -1,6 +1,6 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator 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
diff --git a/src/core/hle/kernel/shared_memory.cpp b/src/core/hle/kernel/shared_memory.cpp
index f538c6550..7ef3e54cc 100644
--- a/src/core/hle/kernel/shared_memory.cpp
+++ b/src/core/hle/kernel/shared_memory.cpp
@@ -1,6 +1,6 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator 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#include "common/common.h" 5#include "common/common.h"
6 6
@@ -67,7 +67,7 @@ Handle CreateSharedMemory(const std::string& name) {
67 * @param other_permissions Memory block map other permissions (specified by SVC field) 67 * @param other_permissions Memory block map other permissions (specified by SVC field)
68 * @return Result of operation, 0 on success, otherwise error code 68 * @return Result of operation, 0 on success, otherwise error code
69 */ 69 */
70Result MapSharedMemory(u32 handle, u32 address, MemoryPermission permissions, 70Result MapSharedMemory(u32 handle, u32 address, MemoryPermission permissions,
71 MemoryPermission other_permissions) { 71 MemoryPermission other_permissions) {
72 72
73 if (address < Memory::SHARED_MEMORY_VADDR || address >= Memory::SHARED_MEMORY_VADDR_END) { 73 if (address < Memory::SHARED_MEMORY_VADDR || address >= Memory::SHARED_MEMORY_VADDR_END) {
diff --git a/src/core/hle/kernel/shared_memory.h b/src/core/hle/kernel/shared_memory.h
index 5312b8854..0aec03538 100644
--- a/src/core/hle/kernel/shared_memory.h
+++ b/src/core/hle/kernel/shared_memory.h
@@ -1,6 +1,6 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator 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
@@ -34,7 +34,7 @@ Handle CreateSharedMemory(const std::string& name="Unknown");
34 * @param other_permissions Memory block map other permissions (specified by SVC field) 34 * @param other_permissions Memory block map other permissions (specified by SVC field)
35 * @return Result of operation, 0 on success, otherwise error code 35 * @return Result of operation, 0 on success, otherwise error code
36 */ 36 */
37Result MapSharedMemory(u32 handle, u32 address, MemoryPermission permissions, 37Result MapSharedMemory(u32 handle, u32 address, MemoryPermission permissions,
38 MemoryPermission other_permissions); 38 MemoryPermission other_permissions);
39 39
40/** 40/**
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index e15590c49..9e2e15c8e 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -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#include <algorithm> 5#include <algorithm>
6#include <list> 6#include <list>
@@ -113,7 +113,7 @@ void ResetThread(Thread* t, u32 arg, s32 lowest_priority) {
113 t->context.pc = t->context.reg_15 = t->entry_point; 113 t->context.pc = t->context.reg_15 = t->entry_point;
114 t->context.sp = t->stack_top; 114 t->context.sp = t->stack_top;
115 t->context.cpsr = 0x1F; // Usermode 115 t->context.cpsr = 0x1F; // Usermode
116 116
117 // TODO(bunnei): This instructs the CPU core to start the execution as if it is "resuming" a 117 // TODO(bunnei): This instructs the CPU core to start the execution as if it is "resuming" a
118 // thread. This is somewhat Sky-Eye specific, and should be re-architected in the future to be 118 // thread. This is somewhat Sky-Eye specific, and should be re-architected in the future to be
119 // agnostic of the CPU core. 119 // agnostic of the CPU core.
@@ -148,7 +148,7 @@ inline bool VerifyWait(const Handle& handle, WaitType type, Handle wait_handle)
148 Thread* thread = g_object_pool.GetFast<Thread>(handle); 148 Thread* thread = g_object_pool.GetFast<Thread>(handle);
149 _assert_msg_(KERNEL, (thread != nullptr), "called, but thread is nullptr!"); 149 _assert_msg_(KERNEL, (thread != nullptr), "called, but thread is nullptr!");
150 150
151 if (type != thread->wait_type || wait_handle != thread->wait_handle) 151 if (type != thread->wait_type || wait_handle != thread->wait_handle)
152 return false; 152 return false;
153 153
154 return true; 154 return true;
@@ -158,7 +158,7 @@ inline bool VerifyWait(const Handle& handle, WaitType type, Handle wait_handle)
158void StopThread(Handle handle, const char* reason) { 158void StopThread(Handle handle, const char* reason) {
159 Thread* thread = g_object_pool.GetFast<Thread>(handle); 159 Thread* thread = g_object_pool.GetFast<Thread>(handle);
160 _assert_msg_(KERNEL, (thread != nullptr), "called, but thread is nullptr!"); 160 _assert_msg_(KERNEL, (thread != nullptr), "called, but thread is nullptr!");
161 161
162 ChangeReadyState(thread, false); 162 ChangeReadyState(thread, false);
163 thread->status = THREADSTATUS_DORMANT; 163 thread->status = THREADSTATUS_DORMANT;
164 for (size_t i = 0; i < thread->waiting_threads.size(); ++i) { 164 for (size_t i = 0; i < thread->waiting_threads.size(); ++i) {
@@ -181,7 +181,7 @@ void ChangeThreadState(Thread* t, ThreadStatus new_status) {
181 } 181 }
182 ChangeReadyState(t, (new_status & THREADSTATUS_READY) != 0); 182 ChangeReadyState(t, (new_status & THREADSTATUS_READY) != 0);
183 t->status = new_status; 183 t->status = new_status;
184 184
185 if (new_status == THREADSTATUS_WAIT) { 185 if (new_status == THREADSTATUS_WAIT) {
186 if (t->wait_type == WAITTYPE_NONE) { 186 if (t->wait_type == WAITTYPE_NONE) {
187 ERROR_LOG(KERNEL, "Waittype none not allowed"); 187 ERROR_LOG(KERNEL, "Waittype none not allowed");
@@ -216,7 +216,7 @@ Handle ArbitrateHighestPriorityThread(u32 arbiter, u32 address) {
216 216
217/// Arbitrate all threads currently waiting 217/// Arbitrate all threads currently waiting
218void ArbitrateAllThreads(u32 arbiter, u32 address) { 218void ArbitrateAllThreads(u32 arbiter, u32 address) {
219 219
220 // Iterate through threads, find highest priority thread that is waiting to be arbitrated... 220 // Iterate through threads, find highest priority thread that is waiting to be arbitrated...
221 for (const auto& handle : g_thread_queue) { 221 for (const auto& handle : g_thread_queue) {
222 222
@@ -238,11 +238,11 @@ void CallThread(Thread* t) {
238/// Switches CPU context to that of the specified thread 238/// Switches CPU context to that of the specified thread
239void SwitchContext(Thread* t) { 239void SwitchContext(Thread* t) {
240 Thread* cur = GetCurrentThread(); 240 Thread* cur = GetCurrentThread();
241 241
242 // Save context for current thread 242 // Save context for current thread
243 if (cur) { 243 if (cur) {
244 SaveContext(cur->context); 244 SaveContext(cur->context);
245 245
246 if (cur->IsRunning()) { 246 if (cur->IsRunning()) {
247 ChangeReadyState(cur, true); 247 ChangeReadyState(cur, true);
248 } 248 }
@@ -263,7 +263,7 @@ void SwitchContext(Thread* t) {
263Thread* NextThread() { 263Thread* NextThread() {
264 Handle next; 264 Handle next;
265 Thread* cur = GetCurrentThread(); 265 Thread* cur = GetCurrentThread();
266 266
267 if (cur && cur->IsRunning()) { 267 if (cur && cur->IsRunning()) {
268 next = g_thread_ready_queue.pop_first_better(cur->current_priority); 268 next = g_thread_ready_queue.pop_first_better(cur->current_priority);
269 } else { 269 } else {
@@ -319,7 +319,7 @@ void DebugThreadQueue() {
319Thread* CreateThread(Handle& handle, const char* name, u32 entry_point, s32 priority, 319Thread* CreateThread(Handle& handle, const char* name, u32 entry_point, s32 priority,
320 s32 processor_id, u32 stack_top, int stack_size) { 320 s32 processor_id, u32 stack_top, int stack_size) {
321 321
322 _assert_msg_(KERNEL, (priority >= THREADPRIO_HIGHEST && priority <= THREADPRIO_LOWEST), 322 _assert_msg_(KERNEL, (priority >= THREADPRIO_HIGHEST && priority <= THREADPRIO_LOWEST),
323 "CreateThread priority=%d, outside of allowable range!", priority) 323 "CreateThread priority=%d, outside of allowable range!", priority)
324 324
325 Thread* thread = new Thread; 325 Thread* thread = new Thread;
@@ -351,7 +351,7 @@ Handle CreateThread(const char* name, u32 entry_point, s32 priority, u32 arg, s3
351 return -1; 351 return -1;
352 } 352 }
353 if ((u32)stack_size < 0x200) { 353 if ((u32)stack_size < 0x200) {
354 ERROR_LOG(KERNEL, "CreateThread(name=%s): invalid stack_size=0x%08X", name, 354 ERROR_LOG(KERNEL, "CreateThread(name=%s): invalid stack_size=0x%08X", name,
355 stack_size); 355 stack_size);
356 return -1; 356 return -1;
357 } 357 }
@@ -368,7 +368,7 @@ Handle CreateThread(const char* name, u32 entry_point, s32 priority, u32 arg, s3
368 return -1; 368 return -1;
369 } 369 }
370 Handle handle; 370 Handle handle;
371 Thread* thread = CreateThread(handle, name, entry_point, priority, processor_id, stack_top, 371 Thread* thread = CreateThread(handle, name, entry_point, priority, processor_id, stack_top,
372 stack_size); 372 stack_size);
373 373
374 ResetThread(thread, arg, 0); 374 ResetThread(thread, arg, 0);
@@ -423,19 +423,19 @@ Result SetThreadPriority(Handle handle, s32 priority) {
423/// Sets up the primary application thread 423/// Sets up the primary application thread
424Handle SetupMainThread(s32 priority, int stack_size) { 424Handle SetupMainThread(s32 priority, int stack_size) {
425 Handle handle; 425 Handle handle;
426 426
427 // Initialize new "main" thread 427 // Initialize new "main" thread
428 Thread* thread = CreateThread(handle, "main", Core::g_app_core->GetPC(), priority, 428 Thread* thread = CreateThread(handle, "main", Core::g_app_core->GetPC(), priority,
429 THREADPROCESSORID_0, Memory::SCRATCHPAD_VADDR_END, stack_size); 429 THREADPROCESSORID_0, Memory::SCRATCHPAD_VADDR_END, stack_size);
430 430
431 ResetThread(thread, 0, 0); 431 ResetThread(thread, 0, 0);
432 432
433 // If running another thread already, set it to "ready" state 433 // If running another thread already, set it to "ready" state
434 Thread* cur = GetCurrentThread(); 434 Thread* cur = GetCurrentThread();
435 if (cur && cur->IsRunning()) { 435 if (cur && cur->IsRunning()) {
436 ChangeReadyState(cur, true); 436 ChangeReadyState(cur, true);
437 } 437 }
438 438
439 // Run new "main" thread 439 // Run new "main" thread
440 SetCurrentThread(thread); 440 SetCurrentThread(thread);
441 thread->status = THREADSTATUS_RUNNING; 441 thread->status = THREADSTATUS_RUNNING;
@@ -452,12 +452,12 @@ void Reschedule() {
452 HLE::g_reschedule = false; 452 HLE::g_reschedule = false;
453 if (next > 0) { 453 if (next > 0) {
454 INFO_LOG(KERNEL, "context switch 0x%08X -> 0x%08X", prev->GetHandle(), next->GetHandle()); 454 INFO_LOG(KERNEL, "context switch 0x%08X -> 0x%08X", prev->GetHandle(), next->GetHandle());
455 455
456 SwitchContext(next); 456 SwitchContext(next);
457 457
458 // Hack - There is no mechanism yet to waken the primary thread if it has been put to sleep 458 // Hack - There is no mechanism yet to waken the primary thread if it has been put to sleep
459 // by a simulated VBLANK thread switch. So, we'll just immediately set it to "ready" again. 459 // by a simulated VBLANK thread switch. So, we'll just immediately set it to "ready" again.
460 // This results in the current thread yielding on a VBLANK once, and then it will be 460 // This results in the current thread yielding on a VBLANK once, and then it will be
461 // immediately placed back in the queue for execution. 461 // immediately placed back in the queue for execution.
462 if (prev->wait_type == WAITTYPE_VBLANK) { 462 if (prev->wait_type == WAITTYPE_VBLANK) {
463 ResumeThreadFromWait(prev->GetHandle()); 463 ResumeThreadFromWait(prev->GetHandle());
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h
index 39fa38b75..2a43797ee 100644
--- a/src/core/hle/kernel/thread.h
+++ b/src/core/hle/kernel/thread.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
diff --git a/src/core/hle/service/ac_u.h b/src/core/hle/service/ac_u.h
index 3c5958d27..8509a793e 100644
--- a/src/core/hle/service/ac_u.h
+++ b/src/core/hle/service/ac_u.h
@@ -9,7 +9,7 @@
9//////////////////////////////////////////////////////////////////////////////////////////////////// 9////////////////////////////////////////////////////////////////////////////////////////////////////
10// Namespace AC_U 10// Namespace AC_U
11 11
12// socket service "ac:u" 12// socket service "ac:u"
13 13
14namespace AC_U { 14namespace AC_U {
15 15
diff --git a/src/core/hle/service/apt_u.cpp b/src/core/hle/service/apt_u.cpp
index 4f41ec5f4..4bb05ce40 100644
--- a/src/core/hle/service/apt_u.cpp
+++ b/src/core/hle/service/apt_u.cpp
@@ -27,7 +27,7 @@ enum class SignalType : u32 {
27 27
28void Initialize(Service::Interface* self) { 28void Initialize(Service::Interface* self) {
29 u32* cmd_buff = Service::GetCommandBuffer(); 29 u32* cmd_buff = Service::GetCommandBuffer();
30 30
31 cmd_buff[3] = Kernel::CreateEvent(RESETTYPE_ONESHOT, "APT_U:Menu"); // APT menu event handle 31 cmd_buff[3] = Kernel::CreateEvent(RESETTYPE_ONESHOT, "APT_U:Menu"); // APT menu event handle
32 cmd_buff[4] = Kernel::CreateEvent(RESETTYPE_ONESHOT, "APT_U:Pause"); // APT pause event handle 32 cmd_buff[4] = Kernel::CreateEvent(RESETTYPE_ONESHOT, "APT_U:Pause"); // APT pause event handle
33 33
@@ -168,7 +168,7 @@ void AppletUtility(Service::Interface* self) {
168 cmd_buff[1] = 0; // No error 168 cmd_buff[1] = 0; // No error
169 169
170 WARN_LOG(KERNEL, "(STUBBED) called unk=0x%08X, buffer1_size=0x%08x, buffer2_size=0x%08x, " 170 WARN_LOG(KERNEL, "(STUBBED) called unk=0x%08X, buffer1_size=0x%08x, buffer2_size=0x%08x, "
171 "buffer1_addr=0x%08x, buffer2_addr=0x%08x", unk, buffer1_size, buffer2_size, 171 "buffer1_addr=0x%08x, buffer2_addr=0x%08x", unk, buffer1_size, buffer2_size,
172 buffer1_addr, buffer2_addr); 172 buffer1_addr, buffer2_addr);
173} 173}
174 174
diff --git a/src/core/hle/service/apt_u.h b/src/core/hle/service/apt_u.h
index 5af39e085..306730400 100644
--- a/src/core/hle/service/apt_u.h
+++ b/src/core/hle/service/apt_u.h
@@ -13,8 +13,8 @@ namespace APT_U {
13 13
14// Application and title launching service. These services handle signaling for home/power button as 14// Application and title launching service. These services handle signaling for home/power button as
15// well. Only one session for either APT service can be open at a time, normally processes close the 15// well. Only one session for either APT service can be open at a time, normally processes close the
16// service handle immediately once finished using the service. The commands for APT:U and APT:S are 16// service handle immediately once finished using the service. The commands for APT:U and APT:S are
17// exactly the same, however certain commands are only accessible with APT:S(NS module will call 17// exactly the same, however certain commands are only accessible with APT:S(NS module will call
18// svcBreak when the command isn't accessible). See http://3dbrew.org/wiki/NS#APT_Services. 18// svcBreak when the command isn't accessible). See http://3dbrew.org/wiki/NS#APT_Services.
19 19
20/// Interface to "APT:U" service 20/// Interface to "APT:U" service
diff --git a/src/core/hle/service/boss_u.cpp b/src/core/hle/service/boss_u.cpp
index d398edc68..b2ff4a756 100644
--- a/src/core/hle/service/boss_u.cpp
+++ b/src/core/hle/service/boss_u.cpp
@@ -21,8 +21,8 @@ namespace BOSS_U {
21 Interface::Interface() { 21 Interface::Interface() {
22 Register(FunctionTable, ARRAY_SIZE(FunctionTable)); 22 Register(FunctionTable, ARRAY_SIZE(FunctionTable));
23 } 23 }
24 24
25 Interface::~Interface() { 25 Interface::~Interface() {
26 } 26 }
27 27
28} // namespace 28} // namespace
diff --git a/src/core/hle/service/err_f.cpp b/src/core/hle/service/err_f.cpp
index 917b2f8ca..785c351e9 100644
--- a/src/core/hle/service/err_f.cpp
+++ b/src/core/hle/service/err_f.cpp
@@ -20,8 +20,8 @@ namespace ERR_F {
20 Interface::Interface() { 20 Interface::Interface() {
21 Register(FunctionTable, ARRAY_SIZE(FunctionTable)); 21 Register(FunctionTable, ARRAY_SIZE(FunctionTable));
22 } 22 }
23 23
24 Interface::~Interface() { 24 Interface::~Interface() {
25 } 25 }
26 26
27} // namespace 27} // namespace
diff --git a/src/core/hle/service/err_f.h b/src/core/hle/service/err_f.h
index 5da663267..8b636b96c 100644
--- a/src/core/hle/service/err_f.h
+++ b/src/core/hle/service/err_f.h
@@ -23,5 +23,5 @@ namespace ERR_F {
23 return "err:f"; 23 return "err:f";
24 } 24 }
25 }; 25 };
26 26
27} // namespace 27} // namespace
diff --git a/src/core/hle/service/fs_user.cpp b/src/core/hle/service/fs_user.cpp
index 06d3f5656..dadc89ef8 100644
--- a/src/core/hle/service/fs_user.cpp
+++ b/src/core/hle/service/fs_user.cpp
@@ -269,7 +269,7 @@ static void IsSdmcDetected(Service::Interface* self) {
269 269
270 cmd_buff[1] = 0; 270 cmd_buff[1] = 0;
271 cmd_buff[2] = Settings::values.use_virtual_sd ? 1 : 0; 271 cmd_buff[2] = Settings::values.use_virtual_sd ? 1 : 0;
272 272
273 DEBUG_LOG(KERNEL, "called"); 273 DEBUG_LOG(KERNEL, "called");
274} 274}
275 275
diff --git a/src/core/hle/service/hid_user.h b/src/core/hle/service/hid_user.h
index 9f6c4d5ed..5ed97085d 100644
--- a/src/core/hle/service/hid_user.h
+++ b/src/core/hle/service/hid_user.h
@@ -15,7 +15,7 @@
15 15
16namespace HID_User { 16namespace HID_User {
17 17
18/** 18/**
19 * Structure of a Pad controller state. 19 * Structure of a Pad controller state.
20 */ 20 */
21struct PadState { 21struct PadState {
diff --git a/src/core/hle/service/mic_u.cpp b/src/core/hle/service/mic_u.cpp
index 58051f133..d6f30e9ae 100644
--- a/src/core/hle/service/mic_u.cpp
+++ b/src/core/hle/service/mic_u.cpp
@@ -27,7 +27,7 @@ const Interface::FunctionInfo FunctionTable[] = {
27 {0x000D0040, nullptr, "SetClamp"}, 27 {0x000D0040, nullptr, "SetClamp"},
28 {0x000E0000, nullptr, "GetClamp"}, 28 {0x000E0000, nullptr, "GetClamp"},
29 {0x000F0040, nullptr, "unknown_input1"}, 29 {0x000F0040, nullptr, "unknown_input1"},
30 {0x00100040, nullptr, "unknown_input2"}, 30 {0x00100040, nullptr, "unknown_input2"},
31}; 31};
32 32
33//////////////////////////////////////////////////////////////////////////////////////////////////// 33////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index ba7299170..5906e2060 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -75,7 +75,7 @@ Interface* Manager::FetchFromPortName(const std::string& port_name) {
75/// Initialize ServiceManager 75/// Initialize ServiceManager
76void Init() { 76void Init() {
77 g_manager = new Manager; 77 g_manager = new Manager;
78 78
79 g_manager->AddService(new SRV::Interface); 79 g_manager->AddService(new SRV::Interface);
80 g_manager->AddService(new AC_U::Interface); 80 g_manager->AddService(new AC_U::Interface);
81 g_manager->AddService(new APT_U::Interface); 81 g_manager->AddService(new APT_U::Interface);
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h
index 2f5a866c9..55aa84e83 100644
--- a/src/core/hle/service/service.h
+++ b/src/core/hle/service/service.h
@@ -38,7 +38,7 @@ class Manager;
38class Interface : public Kernel::Object { 38class Interface : public Kernel::Object {
39 friend class Manager; 39 friend class Manager;
40public: 40public:
41 41
42 std::string GetName() const override { return GetPortName(); } 42 std::string GetName() const override { return GetPortName(); }
43 std::string GetTypeName() const override { return GetPortName(); } 43 std::string GetTypeName() const override { return GetPortName(); }
44 44
@@ -76,7 +76,7 @@ public:
76 } 76 }
77 77
78 /** 78 /**
79 * Synchronize kernel object 79 * Synchronize kernel object
80 * @param wait Boolean wait set if current thread should wait as a result of sync operation 80 * @param wait Boolean wait set if current thread should wait as a result of sync operation
81 * @return Result of operation, 0 on success, otherwise error code 81 * @return Result of operation, 0 on success, otherwise error code
82 */ 82 */
@@ -85,23 +85,23 @@ public:
85 auto itr = m_functions.find(cmd_buff[0]); 85 auto itr = m_functions.find(cmd_buff[0]);
86 86
87 if (itr == m_functions.end()) { 87 if (itr == m_functions.end()) {
88 ERROR_LOG(OSHLE, "unknown/unimplemented function: port=%s, command=0x%08X", 88 ERROR_LOG(OSHLE, "unknown/unimplemented function: port=%s, command=0x%08X",
89 GetPortName().c_str(), cmd_buff[0]); 89 GetPortName().c_str(), cmd_buff[0]);
90 90
91 // TODO(bunnei): Hack - ignore error 91 // TODO(bunnei): Hack - ignore error
92 u32* cmd_buff = Service::GetCommandBuffer(); 92 u32* cmd_buff = Service::GetCommandBuffer();
93 cmd_buff[1] = 0; 93 cmd_buff[1] = 0;
94 return 0; 94 return 0;
95 } 95 }
96 if (itr->second.func == nullptr) { 96 if (itr->second.func == nullptr) {
97 ERROR_LOG(OSHLE, "unimplemented function: port=%s, name=%s", 97 ERROR_LOG(OSHLE, "unimplemented function: port=%s, name=%s",
98 GetPortName().c_str(), itr->second.name.c_str()); 98 GetPortName().c_str(), itr->second.name.c_str());
99 99
100 // TODO(bunnei): Hack - ignore error 100 // TODO(bunnei): Hack - ignore error
101 u32* cmd_buff = Service::GetCommandBuffer(); 101 u32* cmd_buff = Service::GetCommandBuffer();
102 cmd_buff[1] = 0; 102 cmd_buff[1] = 0;
103 return 0; 103 return 0;
104 } 104 }
105 105
106 itr->second.func(this); 106 itr->second.func(this);
107 107
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp
index 16a1d99b7..3a06d6765 100644
--- a/src/core/hle/svc.cpp
+++ b/src/core/hle/svc.cpp
@@ -1,6 +1,6 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator 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#include <map> 5#include <map>
6 6
@@ -30,7 +30,7 @@ enum ControlMemoryOperation {
30 30
31/// Map application or GSP heap memory 31/// Map application or GSP heap memory
32static Result ControlMemory(u32* out_addr, u32 operation, u32 addr0, u32 addr1, u32 size, u32 permissions) { 32static Result ControlMemory(u32* out_addr, u32 operation, u32 addr0, u32 addr1, u32 size, u32 permissions) {
33 DEBUG_LOG(SVC,"called operation=0x%08X, addr0=0x%08X, addr1=0x%08X, size=%08X, permissions=0x%08X", 33 DEBUG_LOG(SVC,"called operation=0x%08X, addr0=0x%08X, addr1=0x%08X, size=%08X, permissions=0x%08X",
34 operation, addr0, addr1, size, permissions); 34 operation, addr0, addr1, size, permissions);
35 35
36 switch (operation) { 36 switch (operation) {
@@ -54,7 +54,7 @@ static Result ControlMemory(u32* out_addr, u32 operation, u32 addr0, u32 addr1,
54 54
55/// Maps a memory block to specified address 55/// Maps a memory block to specified address
56static Result MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 other_permissions) { 56static Result MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 other_permissions) {
57 DEBUG_LOG(SVC, "called memblock=0x%08X, addr=0x%08X, mypermissions=0x%08X, otherpermission=%d", 57 DEBUG_LOG(SVC, "called memblock=0x%08X, addr=0x%08X, mypermissions=0x%08X, otherpermission=%d",
58 handle, addr, permissions, other_permissions); 58 handle, addr, permissions, other_permissions);
59 59
60 Kernel::MemoryPermission permissions_type = static_cast<Kernel::MemoryPermission>(permissions); 60 Kernel::MemoryPermission permissions_type = static_cast<Kernel::MemoryPermission>(permissions);
@@ -63,7 +63,7 @@ static Result MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 other
63 case Kernel::MemoryPermission::Write: 63 case Kernel::MemoryPermission::Write:
64 case Kernel::MemoryPermission::ReadWrite: 64 case Kernel::MemoryPermission::ReadWrite:
65 case Kernel::MemoryPermission::DontCare: 65 case Kernel::MemoryPermission::DontCare:
66 Kernel::MapSharedMemory(handle, addr, permissions_type, 66 Kernel::MapSharedMemory(handle, addr, permissions_type,
67 static_cast<Kernel::MemoryPermission>(other_permissions)); 67 static_cast<Kernel::MemoryPermission>(other_permissions));
68 break; 68 break;
69 default: 69 default:
@@ -115,7 +115,7 @@ static Result WaitSynchronization1(Handle handle, s64 nano_seconds) {
115 115
116 Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(handle); 116 Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(handle);
117 117
118 DEBUG_LOG(SVC, "called handle=0x%08X(%s:%s), nanoseconds=%lld", handle, object->GetTypeName().c_str(), 118 DEBUG_LOG(SVC, "called handle=0x%08X(%s:%s), nanoseconds=%lld", handle, object->GetTypeName().c_str(),
119 object->GetName().c_str(), nano_seconds); 119 object->GetName().c_str(), nano_seconds);
120 120
121 _assert_msg_(KERNEL, (object != nullptr), "called, but kernel object is nullptr!"); 121 _assert_msg_(KERNEL, (object != nullptr), "called, but kernel object is nullptr!");
@@ -138,7 +138,7 @@ static Result WaitSynchronizationN(s32* out, Handle* handles, s32 handle_count,
138 bool unlock_all = true; 138 bool unlock_all = true;
139 bool wait_infinite = (nano_seconds == -1); // Used to wait until a thread has terminated 139 bool wait_infinite = (nano_seconds == -1); // Used to wait until a thread has terminated
140 140
141 DEBUG_LOG(SVC, "called handle_count=%d, wait_all=%s, nanoseconds=%lld", 141 DEBUG_LOG(SVC, "called handle_count=%d, wait_all=%s, nanoseconds=%lld",
142 handle_count, (wait_all ? "true" : "false"), nano_seconds); 142 handle_count, (wait_all ? "true" : "false"), nano_seconds);
143 143
144 // Iterate through each handle, synchronize kernel object 144 // Iterate through each handle, synchronize kernel object
@@ -149,7 +149,7 @@ static Result WaitSynchronizationN(s32* out, Handle* handles, s32 handle_count,
149 _assert_msg_(KERNEL, (object != nullptr), "called handle=0x%08X, but kernel object " 149 _assert_msg_(KERNEL, (object != nullptr), "called handle=0x%08X, but kernel object "
150 "is nullptr!", handles[i]); 150 "is nullptr!", handles[i]);
151 151
152 DEBUG_LOG(SVC, "\thandle[%d] = 0x%08X(%s:%s)", i, handles[i], object->GetTypeName().c_str(), 152 DEBUG_LOG(SVC, "\thandle[%d] = 0x%08X(%s:%s)", i, handles[i], object->GetTypeName().c_str(),
153 object->GetName().c_str()); 153 object->GetName().c_str());
154 154
155 Result res = object->WaitSynchronization(&wait); 155 Result res = object->WaitSynchronization(&wait);
@@ -183,7 +183,7 @@ static Result CreateAddressArbiter(u32* arbiter) {
183 183
184/// Arbitrate address 184/// Arbitrate address
185static Result ArbitrateAddress(Handle arbiter, u32 address, u32 type, u32 value, s64 nanoseconds) { 185static Result ArbitrateAddress(Handle arbiter, u32 address, u32 type, u32 value, s64 nanoseconds) {
186 return Kernel::ArbitrateAddress(arbiter, static_cast<Kernel::ArbitrationType>(type), address, 186 return Kernel::ArbitrateAddress(arbiter, static_cast<Kernel::ArbitrationType>(type), address,
187 value); 187 value);
188} 188}
189 189
@@ -195,7 +195,7 @@ static void OutputDebugString(const char* string) {
195/// Get resource limit 195/// Get resource limit
196static Result GetResourceLimit(Handle* resource_limit, Handle process) { 196static Result GetResourceLimit(Handle* resource_limit, Handle process) {
197 // With regards to proceess values: 197 // With regards to proceess values:
198 // 0xFFFF8001 is a handle alias for the current KProcess, and 0xFFFF8000 is a handle alias for 198 // 0xFFFF8001 is a handle alias for the current KProcess, and 0xFFFF8000 is a handle alias for
199 // the current KThread. 199 // the current KThread.
200 *resource_limit = 0xDEADBEEF; 200 *resource_limit = 0xDEADBEEF;
201 ERROR_LOG(SVC, "(UNIMPLEMENTED) called process=0x%08X", process); 201 ERROR_LOG(SVC, "(UNIMPLEMENTED) called process=0x%08X", process);
@@ -227,9 +227,9 @@ static Result CreateThread(u32 priority, u32 entry_point, u32 arg, u32 stack_top
227 Core::g_app_core->SetReg(1, thread); 227 Core::g_app_core->SetReg(1, thread);
228 228
229 DEBUG_LOG(SVC, "called entrypoint=0x%08X (%s), arg=0x%08X, stacktop=0x%08X, " 229 DEBUG_LOG(SVC, "called entrypoint=0x%08X (%s), arg=0x%08X, stacktop=0x%08X, "
230 "threadpriority=0x%08X, processorid=0x%08X : created handle=0x%08X", entry_point, 230 "threadpriority=0x%08X, processorid=0x%08X : created handle=0x%08X", entry_point,
231 name.c_str(), arg, stack_top, priority, processor_id, thread); 231 name.c_str(), arg, stack_top, priority, processor_id, thread);
232 232
233 return 0; 233 return 0;
234} 234}
235 235
@@ -258,7 +258,7 @@ static Result SetThreadPriority(Handle handle, s32 priority) {
258/// Create a mutex 258/// Create a mutex
259static Result CreateMutex(Handle* mutex, u32 initial_locked) { 259static Result CreateMutex(Handle* mutex, u32 initial_locked) {
260 *mutex = Kernel::CreateMutex((initial_locked != 0)); 260 *mutex = Kernel::CreateMutex((initial_locked != 0));
261 DEBUG_LOG(SVC, "called initial_locked=%s : created handle=0x%08X", 261 DEBUG_LOG(SVC, "called initial_locked=%s : created handle=0x%08X",
262 initial_locked ? "true" : "false", *mutex); 262 initial_locked ? "true" : "false", *mutex);
263 return 0; 263 return 0;
264} 264}
@@ -286,7 +286,7 @@ static Result QueryMemory(void* info, void* out, u32 addr) {
286/// Create an event 286/// Create an event
287static Result CreateEvent(Handle* evt, u32 reset_type) { 287static Result CreateEvent(Handle* evt, u32 reset_type) {
288 *evt = Kernel::CreateEvent((ResetType)reset_type); 288 *evt = Kernel::CreateEvent((ResetType)reset_type);
289 DEBUG_LOG(SVC, "called reset_type=0x%08X : created handle=0x%08X", 289 DEBUG_LOG(SVC, "called reset_type=0x%08X : created handle=0x%08X",
290 reset_type, *evt); 290 reset_type, *evt);
291 return 0; 291 return 0;
292} 292}
@@ -301,7 +301,7 @@ static Result DuplicateHandle(Handle* out, Handle handle) {
301 } 301 }
302 _assert_msg_(KERNEL, (handle != Kernel::CurrentProcess), 302 _assert_msg_(KERNEL, (handle != Kernel::CurrentProcess),
303 "(UNIMPLEMENTED) process handle duplication!"); 303 "(UNIMPLEMENTED) process handle duplication!");
304 304
305 // TODO(bunnei): FixMe - This is a hack to return the handle that we were asked to duplicate. 305 // TODO(bunnei): FixMe - This is a hack to return the handle that we were asked to duplicate.
306 *out = handle; 306 *out = handle;
307 307
diff --git a/src/core/hle/svc.h b/src/core/hle/svc.h
index 1d125faf6..6be393d0b 100644
--- a/src/core/hle/svc.h
+++ b/src/core/hle/svc.h
@@ -1,6 +1,6 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator 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
diff --git a/src/core/hw/hw.cpp b/src/core/hw/hw.cpp
index 33f75c50a..4d0719263 100644
--- a/src/core/hw/hw.cpp
+++ b/src/core/hw/hw.cpp
@@ -39,7 +39,7 @@ enum {
39template <typename T> 39template <typename T>
40inline void Read(T &var, const u32 addr) { 40inline void Read(T &var, const u32 addr) {
41 switch (addr & 0xFFFFF000) { 41 switch (addr & 0xFFFFF000) {
42 42
43 // TODO(bunnei): What is the virtual address of NDMA? 43 // TODO(bunnei): What is the virtual address of NDMA?
44 // case VADDR_NDMA: 44 // case VADDR_NDMA:
45 // NDMA::Read(var, addr); 45 // NDMA::Read(var, addr);
@@ -57,9 +57,9 @@ inline void Read(T &var, const u32 addr) {
57template <typename T> 57template <typename T>
58inline void Write(u32 addr, const T data) { 58inline void Write(u32 addr, const T data) {
59 switch (addr & 0xFFFFF000) { 59 switch (addr & 0xFFFFF000) {
60 60
61 // TODO(bunnei): What is the virtual address of NDMA? 61 // TODO(bunnei): What is the virtual address of NDMA?
62 // case VADDR_NDMA 62 // case VADDR_NDMA
63 // NDMA::Write(addr, data); 63 // NDMA::Write(addr, data);
64 // break; 64 // break;
65 65
diff --git a/src/core/loader/elf.cpp b/src/core/loader/elf.cpp
index 389d5a8c9..63d2496ed 100644
--- a/src/core/loader/elf.cpp
+++ b/src/core/loader/elf.cpp
@@ -273,13 +273,13 @@ bool ElfReader::LoadInto(u32 vaddr) {
273 273
274 for (int i = 0; i < header->e_phnum; i++) { 274 for (int i = 0; i < header->e_phnum; i++) {
275 Elf32_Phdr *p = segments + i; 275 Elf32_Phdr *p = segments + i;
276 INFO_LOG(MASTER_LOG, "Type: %i Vaddr: %08x Filesz: %i Memsz: %i ", p->p_type, p->p_vaddr, 276 INFO_LOG(MASTER_LOG, "Type: %i Vaddr: %08x Filesz: %i Memsz: %i ", p->p_type, p->p_vaddr,
277 p->p_filesz, p->p_memsz); 277 p->p_filesz, p->p_memsz);
278 278
279 if (p->p_type == PT_LOAD) { 279 if (p->p_type == PT_LOAD) {
280 segment_addr[i] = base_addr + p->p_vaddr; 280 segment_addr[i] = base_addr + p->p_vaddr;
281 memcpy(Memory::GetPointer(segment_addr[i]), GetSegmentPtr(i), p->p_filesz); 281 memcpy(Memory::GetPointer(segment_addr[i]), GetSegmentPtr(i), p->p_filesz);
282 INFO_LOG(MASTER_LOG, "Loadable Segment Copied to %08x, size %08x", segment_addr[i], 282 INFO_LOG(MASTER_LOG, "Loadable Segment Copied to %08x, size %08x", segment_addr[i],
283 p->p_memsz); 283 p->p_memsz);
284 } 284 }
285 } 285 }
diff --git a/src/core/loader/ncch.cpp b/src/core/loader/ncch.cpp
index 5b6f88604..343bb7523 100644
--- a/src/core/loader/ncch.cpp
+++ b/src/core/loader/ncch.cpp
@@ -118,7 +118,7 @@ AppLoader_NCCH::~AppLoader_NCCH() {
118 * @return ResultStatus result of function 118 * @return ResultStatus result of function
119 */ 119 */
120ResultStatus AppLoader_NCCH::LoadExec() const { 120ResultStatus AppLoader_NCCH::LoadExec() const {
121 if (!is_loaded) 121 if (!is_loaded)
122 return ResultStatus::ErrorNotLoaded; 122 return ResultStatus::ErrorNotLoaded;
123 123
124 std::vector<u8> code; 124 std::vector<u8> code;
@@ -185,7 +185,7 @@ ResultStatus AppLoader_NCCH::LoadSectionExeFS(const char* name, std::vector<u8>&
185 return ResultStatus::Error; 185 return ResultStatus::Error;
186 } 186 }
187 return ResultStatus::ErrorNotUsed; 187 return ResultStatus::ErrorNotUsed;
188} 188}
189 189
190/** 190/**
191 * Loads an NCCH file (e.g. from a CCI, or the first NCCH in a CXI) 191 * Loads an NCCH file (e.g. from a CCI, or the first NCCH in a CXI)
@@ -210,7 +210,7 @@ ResultStatus AppLoader_NCCH::Load() {
210 file.Seek(ncch_offset, 0); 210 file.Seek(ncch_offset, 0);
211 file.ReadBytes(&ncch_header, sizeof(NCCH_Header)); 211 file.ReadBytes(&ncch_header, sizeof(NCCH_Header));
212 } 212 }
213 213
214 // Verify we are loading the correct file type... 214 // Verify we are loading the correct file type...
215 if (0 != memcmp(&ncch_header.magic, "NCCH", 4)) 215 if (0 != memcmp(&ncch_header.magic, "NCCH", 4))
216 return ResultStatus::ErrorInvalidFormat; 216 return ResultStatus::ErrorInvalidFormat;
diff --git a/src/core/loader/ncch.h b/src/core/loader/ncch.h
index f40a258b7..03116add8 100644
--- a/src/core/loader/ncch.h
+++ b/src/core/loader/ncch.h
@@ -215,7 +215,7 @@ private:
215 u32 entry_point; 215 u32 entry_point;
216 u32 ncch_offset; // Offset to NCCH header, can be 0 or after NCSD header 216 u32 ncch_offset; // Offset to NCCH header, can be 0 or after NCSD header
217 u32 exefs_offset; 217 u32 exefs_offset;
218 218
219 NCCH_Header ncch_header; 219 NCCH_Header ncch_header;
220 ExeFs_Header exefs_header; 220 ExeFs_Header exefs_header;
221 ExHeader_Header exheader_header; 221 ExHeader_Header exheader_header;
diff --git a/src/video_core/renderer_base.h b/src/video_core/renderer_base.h
index f1dbc9d17..bce402b88 100644
--- a/src/video_core/renderer_base.h
+++ b/src/video_core/renderer_base.h
@@ -25,7 +25,7 @@ public:
25 /// Swap buffers (render frame) 25 /// Swap buffers (render frame)
26 virtual void SwapBuffers() = 0; 26 virtual void SwapBuffers() = 0;
27 27
28 /** 28 /**
29 * Set the emulator window to use for renderer 29 * Set the emulator window to use for renderer
30 * @param window EmuWindow handle to emulator window to use for rendering 30 * @param window EmuWindow handle to emulator window to use for rendering
31 */ 31 */
diff --git a/src/video_core/utils.cpp b/src/video_core/utils.cpp
index c1848f923..f1156a493 100644
--- a/src/video_core/utils.cpp
+++ b/src/video_core/utils.cpp
@@ -20,7 +20,7 @@ namespace VideoCore {
20void DumpTGA(std::string filename, short width, short height, u8* raw_data) { 20void DumpTGA(std::string filename, short width, short height, u8* raw_data) {
21 TGAHeader hdr = {0, 0, 2, 0, 0, 0, 0, width, height, 24, 0}; 21 TGAHeader hdr = {0, 0, 2, 0, 0, 0, 0, width, height, 24, 0};
22 FILE* fout = fopen(filename.c_str(), "wb"); 22 FILE* fout = fopen(filename.c_str(), "wb");
23 23
24 fwrite(&hdr, sizeof(TGAHeader), 1, fout); 24 fwrite(&hdr, sizeof(TGAHeader), 1, fout);
25 25
26 for (int y = 0; y < height; y++) { 26 for (int y = 0; y < height; y++) {
@@ -30,7 +30,7 @@ void DumpTGA(std::string filename, short width, short height, u8* raw_data) {
30 putc(raw_data[(3 * (y * width)) + (3 * x) + 2], fout); // r 30 putc(raw_data[(3 * (y * width)) + (3 * x) + 2], fout); // r
31 } 31 }
32 } 32 }
33 33
34 fclose(fout); 34 fclose(fout);
35} 35}
36} // namespace 36} // namespace