summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/citra_qt/bootmanager.cpp17
-rw-r--r--src/common/atomic.h5
-rw-r--r--src/common/atomic_gcc.h5
-rw-r--r--src/common/atomic_win32.h5
-rw-r--r--src/common/break_points.h5
-rw-r--r--src/common/chunk_file.h5
-rw-r--r--src/common/common.h11
-rw-r--r--src/common/common_funcs.h5
-rw-r--r--src/common/common_paths.h5
-rw-r--r--src/common/common_types.h2
-rw-r--r--src/common/console_listener.cpp10
-rw-r--r--src/common/console_listener.h5
-rw-r--r--src/common/cpu_detect.h5
-rw-r--r--src/common/debug_interface.h7
-rw-r--r--src/common/extended_trace.cpp3
-rw-r--r--src/common/extended_trace.h5
-rw-r--r--src/common/fifo_queue.h6
-rw-r--r--src/common/file_search.h7
-rw-r--r--src/common/file_util.cpp4
-rw-r--r--src/common/file_util.h6
-rw-r--r--src/common/fixed_size_queue.h7
-rw-r--r--src/common/hash.h5
-rw-r--r--src/common/linear_disk_cache.h6
-rw-r--r--src/common/log.h5
-rw-r--r--src/common/log_manager.h7
-rw-r--r--src/common/math_util.h6
-rw-r--r--src/common/mem_arena.cpp47
-rw-r--r--src/common/mem_arena.h5
-rw-r--r--src/common/memory_util.cpp4
-rw-r--r--src/common/memory_util.h6
-rw-r--r--src/common/msg_handler.cpp2
-rw-r--r--src/common/msg_handler.h5
-rw-r--r--src/common/platform.h5
-rw-r--r--src/common/std_condition_variable.h4
-rw-r--r--src/common/std_mutex.h5
-rw-r--r--src/common/std_thread.h5
-rw-r--r--src/common/string_util.cpp6
-rw-r--r--src/common/string_util.h12
-rw-r--r--src/common/thread.h9
-rw-r--r--src/common/thunk.h5
-rw-r--r--src/common/timer.h5
-rw-r--r--src/common/utf8.cpp8
-rw-r--r--src/core/hle/svc.cpp5
-rw-r--r--src/core/mem_map_funcs.cpp12
44 files changed, 101 insertions, 208 deletions
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp
index b0aa1e561..250df59f8 100644
--- a/src/citra_qt/bootmanager.cpp
+++ b/src/citra_qt/bootmanager.cpp
@@ -32,17 +32,14 @@ void EmuThread::run()
32{ 32{
33 while (true) 33 while (true)
34 { 34 {
35 for (int tight_loop = 0; tight_loop < 10000; ++tight_loop) 35 if (cpu_running || exec_cpu_step)
36 { 36 {
37 if (cpu_running || exec_cpu_step) 37 if (exec_cpu_step)
38 { 38 exec_cpu_step = false;
39 if (exec_cpu_step) 39
40 exec_cpu_step = false; 40 Core::SingleStep();
41 41 if (!cpu_running)
42 Core::SingleStep(); 42 emit CPUStepped();
43 if (!cpu_running)
44 emit CPUStepped();
45 }
46 } 43 }
47 } 44 }
48 45
diff --git a/src/common/atomic.h b/src/common/atomic.h
index ff2fb23d3..941f5ad5e 100644
--- a/src/common/atomic.h
+++ b/src/common/atomic.h
@@ -2,8 +2,7 @@
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#ifndef _ATOMIC_H_ 5#pragma once
6#define _ATOMIC_H_
7 6
8#ifdef _WIN32 7#ifdef _WIN32
9 8
@@ -15,5 +14,3 @@
15#include "common/atomic_gcc.h" 14#include "common/atomic_gcc.h"
16 15
17#endif 16#endif
18
19#endif
diff --git a/src/common/atomic_gcc.h b/src/common/atomic_gcc.h
index 953c82c6c..117e342f6 100644
--- a/src/common/atomic_gcc.h
+++ b/src/common/atomic_gcc.h
@@ -2,8 +2,7 @@
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#ifndef _ATOMIC_GCC_H_ 5#pragma once
6#define _ATOMIC_GCC_H_
7 6
8#include "common/common.h" 7#include "common/common.h"
9 8
@@ -109,5 +108,3 @@ LONG SyncInterlockedExchange(LONG *Dest, LONG Val)
109#endif 108#endif
110} 109}
111#endif 110#endif
112
113#endif
diff --git a/src/common/atomic_win32.h b/src/common/atomic_win32.h
index f8ec80520..0808905f0 100644
--- a/src/common/atomic_win32.h
+++ b/src/common/atomic_win32.h
@@ -2,8 +2,7 @@
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#ifndef _ATOMIC_WIN32_H_ 5#pragma once
6#define _ATOMIC_WIN32_H_
7 6
8#include "common/common.h" 7#include "common/common.h"
9#include <intrin.h> 8#include <intrin.h>
@@ -68,5 +67,3 @@ inline void AtomicStoreRelease(volatile u32& dest, u32 value) {
68} 67}
69 68
70} 69}
71
72#endif
diff --git a/src/common/break_points.h b/src/common/break_points.h
index da14ca7f3..cf3884fbc 100644
--- a/src/common/break_points.h
+++ b/src/common/break_points.h
@@ -2,8 +2,7 @@
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#ifndef _DEBUGGER_BREAKPOINTS_H 5#pragma once
6#define _DEBUGGER_BREAKPOINTS_H
7 6
8#include <vector> 7#include <vector>
9#include <string> 8#include <string>
@@ -98,5 +97,3 @@ public:
98 97
99 void Clear() { m_MemChecks.clear(); }; 98 void Clear() { m_MemChecks.clear(); };
100}; 99};
101
102#endif
diff --git a/src/common/chunk_file.h b/src/common/chunk_file.h
index 8c9f839da..2b0f120e6 100644
--- a/src/common/chunk_file.h
+++ b/src/common/chunk_file.h
@@ -15,8 +15,7 @@
15// Official SVN repository and contact information can be found at 15// Official SVN repository and contact information can be found at
16// http://code.google.com/p/dolphin-emu/ 16// http://code.google.com/p/dolphin-emu/
17 17
18#ifndef _POINTERWRAP_H_ 18#pragma once
19#define _POINTERWRAP_H_
20 19
21// Extremely simple serialization framework. 20// Extremely simple serialization framework.
22 21
@@ -871,5 +870,3 @@ private:
871 char GitVersion[32]; 870 char GitVersion[32];
872 }; 871 };
873}; */ 872}; */
874
875#endif // _POINTERWRAP_H_
diff --git a/src/common/common.h b/src/common/common.h
index 09027cae1..cb69eabe4 100644
--- a/src/common/common.h
+++ b/src/common/common.h
@@ -2,15 +2,14 @@
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#ifndef _COMMON_H_ 5#pragma once
6#define _COMMON_H_
7 6
8// DO NOT EVER INCLUDE <windows.h> directly _or indirectly_ from this file 7// DO NOT EVER INCLUDE <windows.h> directly _or indirectly_ from this file
9// since it slows down the build a lot. 8// since it slows down the build a lot.
10 9
11#include <stdlib.h> 10#include <cstdlib>
12#include <stdio.h> 11#include <cstdio>
13#include <string.h> 12#include <cstring>
14 13
15// Force enable logging in the right modes. For some reason, something had changed 14// Force enable logging in the right modes. For some reason, something had changed
16// so that debugfast no longer logged. 15// so that debugfast no longer logged.
@@ -200,5 +199,3 @@ inline double bswapd(double f) {
200} 199}
201 200
202#include "swap.h" 201#include "swap.h"
203
204#endif // _COMMON_H_
diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h
index dca4dc47f..c18afe119 100644
--- a/src/common/common_funcs.h
+++ b/src/common/common_funcs.h
@@ -2,8 +2,7 @@
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#ifndef _COMMONFUNCS_H_ 5#pragma once
6#define _COMMONFUNCS_H_
7 6
8#ifdef _WIN32 7#ifdef _WIN32
9#define SLEEP(x) Sleep(x) 8#define SLEEP(x) Sleep(x)
@@ -233,5 +232,3 @@ inline T FromBigEndian(T data)
233} 232}
234 233
235} // Namespace Common 234} // Namespace Common
236
237#endif // _COMMONFUNCS_H_
diff --git a/src/common/common_paths.h b/src/common/common_paths.h
index 252e93fa9..a36de9227 100644
--- a/src/common/common_paths.h
+++ b/src/common/common_paths.h
@@ -2,8 +2,7 @@
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#ifndef _COMMON_PATHS_H_ 5#pragma once
6#define _COMMON_PATHS_H_
7 6
8// Make sure we pick up USER_DIR if set in config.h 7// Make sure we pick up USER_DIR if set in config.h
9#include "common/common.h" 8#include "common/common.h"
@@ -75,5 +74,3 @@
75 74
76// Files in the directory returned by GetUserPath(D_SYSCONF_IDX) 75// Files in the directory returned by GetUserPath(D_SYSCONF_IDX)
77#define SYSCONF "SYSCONF" 76#define SYSCONF "SYSCONF"
78
79#endif // _COMMON_PATHS_H_
diff --git a/src/common/common_types.h b/src/common/common_types.h
index 402410507..9d41e5971 100644
--- a/src/common/common_types.h
+++ b/src/common/common_types.h
@@ -24,7 +24,7 @@
24 24
25#pragma once 25#pragma once
26 26
27#include <math.h> 27#include <cmath>
28#include <xmmintrin.h> // data_types__m128.cpp 28#include <xmmintrin.h> // data_types__m128.cpp
29 29
30#ifdef _WIN32 30#ifdef _WIN32
diff --git a/src/common/console_listener.cpp b/src/common/console_listener.cpp
index db48abbf6..27697ef1f 100644
--- a/src/common/console_listener.cpp
+++ b/src/common/console_listener.cpp
@@ -2,15 +2,15 @@
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> // min 5#include <algorithm>
6#include <string> // System: To be able to add strings with "+" 6#include <cmath>
7#include <stdio.h> 7#include <cstdio>
8#include <math.h> 8#include <string>
9#ifdef _WIN32 9#ifdef _WIN32
10#include <windows.h> 10#include <windows.h>
11#include <array> 11#include <array>
12#else 12#else
13#include <stdarg.h> 13#include <cstdarg>
14#endif 14#endif
15 15
16#include "common/common.h" 16#include "common/common.h"
diff --git a/src/common/console_listener.h b/src/common/console_listener.h
index 224d17017..3c0e420c6 100644
--- a/src/common/console_listener.h
+++ b/src/common/console_listener.h
@@ -2,8 +2,7 @@
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#ifndef _CONSOLELISTENER_H 5#pragma once
6#define _CONSOLELISTENER_H
7 6
8#include "common/log_manager.h" 7#include "common/log_manager.h"
9 8
@@ -37,5 +36,3 @@ private:
37#endif 36#endif
38 bool bUseColor; 37 bool bUseColor;
39}; 38};
40
41#endif // _CONSOLELISTENER_H
diff --git a/src/common/cpu_detect.h b/src/common/cpu_detect.h
index e93cf333a..def6afdee 100644
--- a/src/common/cpu_detect.h
+++ b/src/common/cpu_detect.h
@@ -4,8 +4,7 @@
4 4
5 5
6// Detect the cpu, so we'll know which optimizations to use 6// Detect the cpu, so we'll know which optimizations to use
7#ifndef _CPUDETECT_H_ 7#pragma once
8#define _CPUDETECT_H_
9 8
10#include <string> 9#include <string>
11 10
@@ -77,5 +76,3 @@ private:
77}; 76};
78 77
79extern CPUInfo cpu_info; 78extern CPUInfo cpu_info;
80
81#endif // _CPUDETECT_H_
diff --git a/src/common/debug_interface.h b/src/common/debug_interface.h
index 49cc54a80..32f55cb59 100644
--- a/src/common/debug_interface.h
+++ b/src/common/debug_interface.h
@@ -1,8 +1,7 @@
1#ifndef _DEBUGINTERFACE_H 1#pragma once
2#define _DEBUGINTERFACE_H
3 2
3#include <cstring>
4#include <string> 4#include <string>
5#include <string.h>
6 5
7class DebugInterface 6class DebugInterface
8{ 7{
@@ -35,5 +34,3 @@ public:
35 virtual int getColor(unsigned int /*address*/){return 0xFFFFFFFF;} 34 virtual int getColor(unsigned int /*address*/){return 0xFFFFFFFF;}
36 virtual std::string getDescription(unsigned int /*address*/) = 0; 35 virtual std::string getDescription(unsigned int /*address*/) = 0;
37}; 36};
38
39#endif
diff --git a/src/common/extended_trace.cpp b/src/common/extended_trace.cpp
index 0a1c6a67a..66dae4935 100644
--- a/src/common/extended_trace.cpp
+++ b/src/common/extended_trace.cpp
@@ -13,9 +13,8 @@
13// -------------------------------------------------------------------------------------- 13// --------------------------------------------------------------------------------------
14 14
15#if defined(WIN32) 15#if defined(WIN32)
16 16#include <cstdio>
17#include <windows.h> 17#include <windows.h>
18#include <stdio.h>
19#include "common/extended_trace.h" 18#include "common/extended_trace.h"
20#include "common/string_util.h" 19#include "common/string_util.h"
21using namespace std; 20using namespace std;
diff --git a/src/common/extended_trace.h b/src/common/extended_trace.h
index 1552e901b..ed3113a24 100644
--- a/src/common/extended_trace.h
+++ b/src/common/extended_trace.h
@@ -12,8 +12,7 @@
12// 12//
13// ---------------------------------------------------------------------------------------- 13// ----------------------------------------------------------------------------------------
14 14
15#ifndef _EXTENDEDTRACE_H_INCLUDED_ 15#pragma once
16#define _EXTENDEDTRACE_H_INCLUDED_
17 16
18#if defined(WIN32) 17#if defined(WIN32)
19 18
@@ -49,5 +48,3 @@ extern char g_uefbuf[UEFBUFSIZE];
49#define STACKTRACE2(file, eip, esp, ebp) ((void)0) 48#define STACKTRACE2(file, eip, esp, ebp) ((void)0)
50 49
51#endif // WIN32 50#endif // WIN32
52
53#endif // _EXTENDEDTRACE_H_INCLUDED_
diff --git a/src/common/fifo_queue.h b/src/common/fifo_queue.h
index 4e80f53b4..78a8f561d 100644
--- a/src/common/fifo_queue.h
+++ b/src/common/fifo_queue.h
@@ -1,6 +1,4 @@
1 1#pragma once
2#ifndef _FIFO_QUEUE_H_
3#define _FIFO_QUEUE_H_
4 2
5// a simple lockless thread-safe, 3// a simple lockless thread-safe,
6// single reader, single writer queue 4// single reader, single writer queue
@@ -111,5 +109,3 @@ private:
111}; 109};
112 110
113} 111}
114
115#endif
diff --git a/src/common/file_search.h b/src/common/file_search.h
index 2a9ff801f..f966a008d 100644
--- a/src/common/file_search.h
+++ b/src/common/file_search.h
@@ -2,9 +2,7 @@
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 5#pragma once
6#ifndef _FILESEARCH_H_
7#define _FILESEARCH_H_
8 6
9#include <string> 7#include <string>
10#include <vector> 8#include <vector>
@@ -23,6 +21,3 @@ private:
23 21
24 XStringVector m_FileNames; 22 XStringVector m_FileNames;
25}; 23};
26
27#endif // _FILESEARCH_H_
28
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp
index 47ad964db..b6ff2e40b 100644
--- a/src/common/file_util.cpp
+++ b/src/common/file_util.cpp
@@ -16,11 +16,11 @@
16#include <io.h> 16#include <io.h>
17#include <direct.h> // getcwd 17#include <direct.h> // getcwd
18#else 18#else
19#include <cerrno>
20#include <cstdlib>
19#include <sys/param.h> 21#include <sys/param.h>
20#include <sys/types.h> 22#include <sys/types.h>
21#include <dirent.h> 23#include <dirent.h>
22#include <errno.h>
23#include <stdlib.h>
24#endif 24#endif
25 25
26#if defined(__APPLE__) 26#if defined(__APPLE__)
diff --git a/src/common/file_util.h b/src/common/file_util.h
index 5edb43f6a..0871734d4 100644
--- a/src/common/file_util.h
+++ b/src/common/file_util.h
@@ -2,9 +2,7 @@
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 5#pragma once
6#ifndef _FILEUTIL_H_
7#define _FILEUTIL_H_
8 6
9#include <fstream> 7#include <fstream>
10#include <cstdio> 8#include <cstdio>
@@ -220,5 +218,3 @@ void OpenFStream(T& fstream, const std::string& filename, std::ios_base::openmod
220 fstream.open(filename.c_str(), openmode); 218 fstream.open(filename.c_str(), openmode);
221#endif 219#endif
222} 220}
223
224#endif
diff --git a/src/common/fixed_size_queue.h b/src/common/fixed_size_queue.h
index 1f507f4ae..1e3a5dea6 100644
--- a/src/common/fixed_size_queue.h
+++ b/src/common/fixed_size_queue.h
@@ -2,9 +2,7 @@
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 5#pragma once
6#ifndef _FIXED_SIZE_QUEUE_H_
7#define _FIXED_SIZE_QUEUE_H_
8 6
9// STL-look-a-like interface, but name is mixed case to distinguish it clearly from the 7// STL-look-a-like interface, but name is mixed case to distinguish it clearly from the
10// real STL classes. 8// real STL classes.
@@ -70,6 +68,3 @@ public:
70 return count; 68 return count;
71 } 69 }
72}; 70};
73
74#endif // _FIXED_SIZE_QUEUE_H_
75
diff --git a/src/common/hash.h b/src/common/hash.h
index c69908415..29f699d7f 100644
--- a/src/common/hash.h
+++ b/src/common/hash.h
@@ -2,9 +2,7 @@
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 5#pragma once
6#ifndef _HASH_H_
7#define _HASH_H_
8 6
9#include "common/common.h" 7#include "common/common.h"
10 8
@@ -17,4 +15,3 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples);
17u64 GetMurmurHash3(const u8 *src, int len, u32 samples); 15u64 GetMurmurHash3(const u8 *src, int len, u32 samples);
18u64 GetHash64(const u8 *src, int len, u32 samples); 16u64 GetHash64(const u8 *src, int len, u32 samples);
19void SetHash64Function(bool useHiresTextures); 17void SetHash64Function(bool useHiresTextures);
20#endif // _HASH_H_
diff --git a/src/common/linear_disk_cache.h b/src/common/linear_disk_cache.h
index a24687615..96dce3155 100644
--- a/src/common/linear_disk_cache.h
+++ b/src/common/linear_disk_cache.h
@@ -2,9 +2,7 @@
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 5#pragma once
6#ifndef _LINEAR_DISKCACHE
7#define _LINEAR_DISKCACHE
8 6
9#include "common/common.h" 7#include "common/common.h"
10#include <fstream> 8#include <fstream>
@@ -187,5 +185,3 @@ private:
187 std::fstream m_file; 185 std::fstream m_file;
188 u32 m_num_entries; 186 u32 m_num_entries;
189}; 187};
190
191#endif // _LINEAR_DISKCACHE
diff --git a/src/common/log.h b/src/common/log.h
index e923224ed..f1f6ffae6 100644
--- a/src/common/log.h
+++ b/src/common/log.h
@@ -2,8 +2,7 @@
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#ifndef _LOG_H_ 5#pragma once
6#define _LOG_H_
7 6
8#define LOGGING 7#define LOGGING
9 8
@@ -160,5 +159,3 @@ void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type, const char*file, int
160#else // GEKKO 159#else // GEKKO
161#define _assert_msg_(_t_, _a_, _fmt_, ...) 160#define _assert_msg_(_t_, _a_, _fmt_, ...)
162#endif 161#endif
163
164#endif // _LOG_H_
diff --git a/src/common/log_manager.h b/src/common/log_manager.h
index 6d3d7c7ff..81d808825 100644
--- a/src/common/log_manager.h
+++ b/src/common/log_manager.h
@@ -2,16 +2,15 @@
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#ifndef _LOGMANAGER_H_ 5#pragma once
6#define _LOGMANAGER_H_
7 6
8#include "common/log.h" 7#include "common/log.h"
9#include "common/string_util.h" 8#include "common/string_util.h"
10#include "common/thread.h" 9#include "common/thread.h"
11#include "common/file_util.h" 10#include "common/file_util.h"
12 11
12#include <cstring>
13#include <set> 13#include <set>
14#include <string.h>
15 14
16#define MAX_MESSAGES 8000 15#define MAX_MESSAGES 8000
17#define MAX_MSGLEN 1024 16#define MAX_MSGLEN 1024
@@ -165,5 +164,3 @@ public:
165 static void Init(); 164 static void Init();
166 static void Shutdown(); 165 static void Shutdown();
167}; 166};
168
169#endif // _LOGMANAGER_H_
diff --git a/src/common/math_util.h b/src/common/math_util.h
index 9167d2012..65220fbdf 100644
--- a/src/common/math_util.h
+++ b/src/common/math_util.h
@@ -2,9 +2,7 @@
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 5#pragma once
6#ifndef _MATH_UTIL_H_
7#define _MATH_UTIL_H_
8 6
9#include "common/common.h" 7#include "common/common.h"
10 8
@@ -196,5 +194,3 @@ public:
196 194
197 float data[16]; 195 float data[16];
198}; 196};
199
200#endif // _MATH_UTIL_H_
diff --git a/src/common/mem_arena.cpp b/src/common/mem_arena.cpp
index b918eb568..b76ac92d3 100644
--- a/src/common/mem_arena.cpp
+++ b/src/common/mem_arena.cpp
@@ -19,6 +19,7 @@
19 19
20#include "common/memory_util.h" 20#include "common/memory_util.h"
21#include "common/mem_arena.h" 21#include "common/mem_arena.h"
22#include "common/string_util.h"
22 23
23#ifndef _WIN32 24#ifndef _WIN32
24#include <sys/stat.h> 25#include <sys/stat.h>
@@ -98,15 +99,7 @@ int ashmem_unpin_region(int fd, size_t offset, size_t len)
98#endif // Android 99#endif // Android
99 100
100 101
101 102#if defined(_WIN32) && !defined(_XBOX)
102#ifndef _WIN32
103// do not make this "static"
104#if defined(MAEMO) || defined(MEEGO_EDITION_HARMATTAN)
105std::string ram_temp_file = "/home/user/gc_mem.tmp";
106#else
107std::string ram_temp_file = "/tmp/gc_mem.tmp";
108#endif
109#elif !defined(_XBOX)
110SYSTEM_INFO sysInfo; 103SYSTEM_INFO sysInfo;
111#endif 104#endif
112 105
@@ -145,20 +138,26 @@ void MemArena::GrabLowMemSpace(size_t size)
145 return; 138 return;
146 } 139 }
147#else 140#else
148 mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH; 141 // Try to find a non-existing filename for our shared memory.
149 fd = open(ram_temp_file.c_str(), O_RDWR | O_CREAT, mode); 142 // In most cases the first one will be available, but it's nicer to search
150 if (fd < 0) 143 // a bit more.
151 { 144 for (int i = 0; i < 10000; i++)
152 ERROR_LOG(MEMMAP, "Failed to grab memory space as a file: %s of size: %08x errno: %d", ram_temp_file.c_str(), (int)size, (int)(errno));
153 return;
154 }
155 // delete immediately, we keep the fd so it still lives
156 unlink(ram_temp_file.c_str());
157 if (ftruncate(fd, size) != 0)
158 { 145 {
159 ERROR_LOG(MEMMAP, "Failed to ftruncate %d to size %08x", (int)fd, (int)size); 146 std::string file_name = StringFromFormat("/citramem.%d", i);
147 fd = shm_open(file_name.c_str(), O_RDWR | O_CREAT | O_EXCL, 0600);
148 if (fd != -1)
149 {
150 shm_unlink(file_name.c_str());
151 break;
152 }
153 else if (errno != EEXIST)
154 {
155 ERROR_LOG(MEMMAP, "shm_open failed: %s", strerror(errno));
156 return;
157 }
160 } 158 }
161 return; 159 if (ftruncate(fd, size) < 0)
160 ERROR_LOG(MEMMAP, "Failed to allocate low memory space");
162#endif 161#endif
163} 162}
164 163
@@ -198,12 +197,12 @@ void *MemArena::CreateView(s64 offset, size_t size, void *base)
198#elif defined(__FreeBSD__) 197#elif defined(__FreeBSD__)
199 MAP_NOSYNC | 198 MAP_NOSYNC |
200#endif 199#endif
201 ((base == 0) ? 0 : MAP_FIXED), fd, offset); 200 ((base == nullptr) ? 0 : MAP_FIXED), fd, offset);
202 201
203 if (retval == MAP_FAILED) 202 if (retval == MAP_FAILED)
204 { 203 {
205 NOTICE_LOG(MEMMAP, "mmap on %s (fd: %d) failed", ram_temp_file.c_str(), (int)fd); 204 NOTICE_LOG(MEMMAP, "mmap failed");
206 return 0; 205 return nullptr;
207 } 206 }
208 return retval; 207 return retval;
209#endif 208#endif
diff --git a/src/common/mem_arena.h b/src/common/mem_arena.h
index 667efbea9..b5f0aa890 100644
--- a/src/common/mem_arena.h
+++ b/src/common/mem_arena.h
@@ -15,8 +15,7 @@
15// Official SVN repository and contact information can be found at 15// Official SVN repository and contact information can be found at
16// http://code.google.com/p/dolphin-emu/ 16// http://code.google.com/p/dolphin-emu/
17 17
18#ifndef _MEMARENA_H_ 18#pragma once
19#define _MEMARENA_H_
20 19
21#ifdef _WIN32 20#ifdef _WIN32
22#include <windows.h> 21#include <windows.h>
@@ -77,5 +76,3 @@ struct MemoryView
77// a passed-in list of MemoryView structures. 76// a passed-in list of MemoryView structures.
78u8 *MemoryMap_Setup(const MemoryView *views, int num_views, u32 flags, MemArena *arena); 77u8 *MemoryMap_Setup(const MemoryView *views, int num_views, u32 flags, MemArena *arena);
79void MemoryMap_Shutdown(const MemoryView *views, int num_views, u32 flags, MemArena *arena); 78void MemoryMap_Shutdown(const MemoryView *views, int num_views, u32 flags, MemArena *arena);
80
81#endif // _MEMARENA_H_
diff --git a/src/common/memory_util.cpp b/src/common/memory_util.cpp
index 5cc869aea..e01e63175 100644
--- a/src/common/memory_util.cpp
+++ b/src/common/memory_util.cpp
@@ -11,8 +11,8 @@
11#include <windows.h> 11#include <windows.h>
12#include <psapi.h> 12#include <psapi.h>
13#else 13#else
14#include <errno.h> 14#include <cerrno>
15#include <stdio.h> 15#include <cstdio>
16#endif 16#endif
17 17
18#if !defined(_WIN32) && defined(__x86_64__) && !defined(MAP_32BIT) 18#if !defined(_WIN32) && defined(__x86_64__) && !defined(MAP_32BIT)
diff --git a/src/common/memory_util.h b/src/common/memory_util.h
index 49b2589da..922bd44b2 100644
--- a/src/common/memory_util.h
+++ b/src/common/memory_util.h
@@ -2,9 +2,7 @@
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 5#pragma once
6#ifndef _MEMORYUTIL_H
7#define _MEMORYUTIL_H
8 6
9#ifndef _WIN32 7#ifndef _WIN32
10#include <sys/mman.h> 8#include <sys/mman.h>
@@ -21,5 +19,3 @@ void UnWriteProtectMemory(void* ptr, size_t size, bool allowExecute = false);
21std::string MemUsage(); 19std::string MemUsage();
22 20
23inline int GetPageSize() { return 4096; } 21inline int GetPageSize() { return 4096; }
24
25#endif
diff --git a/src/common/msg_handler.cpp b/src/common/msg_handler.cpp
index c1386cdaa..3e02ec4d7 100644
--- a/src/common/msg_handler.cpp
+++ b/src/common/msg_handler.cpp
@@ -2,7 +2,7 @@
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 <stdio.h> // System 5#include <cstdio>
6 6
7#include "common/common.h" // Local 7#include "common/common.h" // Local
8#include "common/string_util.h" 8#include "common/string_util.h"
diff --git a/src/common/msg_handler.h b/src/common/msg_handler.h
index bde2808fa..7c5319ec3 100644
--- a/src/common/msg_handler.h
+++ b/src/common/msg_handler.h
@@ -2,8 +2,7 @@
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#ifndef _MSGHANDLER_H_ 5#pragma once
6#define _MSGHANDLER_H_
7 6
8#include <string> 7#include <string>
9 8
@@ -69,5 +68,3 @@ void SetEnableAlert(bool enable);
69 #define AskYesNoT(format, ...) ; 68 #define AskYesNoT(format, ...) ;
70 #define CriticalAlertT(format, ...) ; 69 #define CriticalAlertT(format, ...) ;
71#endif 70#endif
72
73#endif // _MSGHANDLER_H_
diff --git a/src/common/platform.h b/src/common/platform.h
index b02b52cd2..d9f095433 100644
--- a/src/common/platform.h
+++ b/src/common/platform.h
@@ -22,8 +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#ifndef COMMON_PLATFORM_H_ 25#pragma once
26#define COMMON_PLATFORM_H_
27 26
28#include "common/common_types.h" 27#include "common/common_types.h"
29 28
@@ -110,5 +109,3 @@ typedef void EXCEPTION_POINTERS;
110 109
111#define GCC_VERSION_AVAILABLE(major, minor) (defined(__GNUC__) && (__GNUC__ > (major) || \ 110#define GCC_VERSION_AVAILABLE(major, minor) (defined(__GNUC__) && (__GNUC__ > (major) || \
112 (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))) 111 (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor))))
113
114#endif // COMMON_PLATFORM_H_
diff --git a/src/common/std_condition_variable.h b/src/common/std_condition_variable.h
index 8964b4f6f..ad2022f5a 100644
--- a/src/common/std_condition_variable.h
+++ b/src/common/std_condition_variable.h
@@ -1,6 +1,5 @@
1 1
2#ifndef CONDITION_VARIABLE_H_ 2#pragma once
3#define CONDITION_VARIABLE_H_
4 3
5#define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z)) 4#define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z))
6#define GCC_VERSION GCC_VER(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) 5#define GCC_VERSION GCC_VER(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
@@ -167,4 +166,3 @@ private:
167} 166}
168 167
169#endif 168#endif
170#endif
diff --git a/src/common/std_mutex.h b/src/common/std_mutex.h
index 26eb58b62..5711d791b 100644
--- a/src/common/std_mutex.h
+++ b/src/common/std_mutex.h
@@ -1,6 +1,4 @@
1 1#pragma once
2#ifndef MUTEX_H_
3#define MUTEX_H_
4 2
5#define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z)) 3#define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z))
6#define GCC_VERSION GCC_VER(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) 4#define GCC_VERSION GCC_VER(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
@@ -362,4 +360,3 @@ void swap(unique_lock<Mutex>& x, unique_lock<Mutex>& y)
362} 360}
363 361
364#endif 362#endif
365#endif
diff --git a/src/common/std_thread.h b/src/common/std_thread.h
index 9ed0072c3..ce1336ee7 100644
--- a/src/common/std_thread.h
+++ b/src/common/std_thread.h
@@ -1,6 +1,4 @@
1 1#pragma once
2#ifndef STD_THREAD_H_
3#define STD_THREAD_H_
4 2
5#define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z)) 3#define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z))
6#define GCC_VERSION GCC_VER(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) 4#define GCC_VERSION GCC_VER(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
@@ -314,4 +312,3 @@ inline thread::id get_id()
314#undef THREAD_HANDLE 312#undef THREAD_HANDLE
315 313
316#endif 314#endif
317#endif
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp
index e5a9ba322..c1f22bda3 100644
--- a/src/common/string_util.cpp
+++ b/src/common/string_util.cpp
@@ -2,9 +2,9 @@
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 <stdlib.h>
6#include <stdio.h>
7#include <algorithm> 5#include <algorithm>
6#include <cstdlib>
7#include <cstdio>
8 8
9#include "common/common.h" 9#include "common/common.h"
10#include "common/common_paths.h" 10#include "common/common_paths.h"
@@ -13,8 +13,8 @@
13#ifdef _WIN32 13#ifdef _WIN32
14 #include <Windows.h> 14 #include <Windows.h>
15#else 15#else
16 #include <cerrno>
16 #include <iconv.h> 17 #include <iconv.h>
17 #include <errno.h>
18#endif 18#endif
19 19
20/// Make a string lowercase 20/// Make a string lowercase
diff --git a/src/common/string_util.h b/src/common/string_util.h
index b3c99a807..ba4cd363e 100644
--- a/src/common/string_util.h
+++ b/src/common/string_util.h
@@ -2,15 +2,13 @@
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#ifndef _STRINGUTIL_H_ 5#pragma once
6#define _STRINGUTIL_H_
7 6
8#include <stdarg.h> 7#include <cstdarg>
9 8#include <iomanip>
10#include <vector>
11#include <string> 9#include <string>
12#include <sstream> 10#include <sstream>
13#include <iomanip> 11#include <vector>
14 12
15#include "common/common.h" 13#include "common/common.h"
16 14
@@ -113,5 +111,3 @@ inline std::string UTF8ToTStr(const std::string& str)
113#endif 111#endif
114 112
115#endif 113#endif
116
117#endif // _STRINGUTIL_H_
diff --git a/src/common/thread.h b/src/common/thread.h
index d72ac7b47..dbb9da53b 100644
--- a/src/common/thread.h
+++ b/src/common/thread.h
@@ -2,8 +2,7 @@
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#ifndef _THREAD_H_ 5#pragma once
6#define _THREAD_H_
7 6
8#include "common/std_condition_variable.h" 7#include "common/std_condition_variable.h"
9#include "common/std_mutex.h" 8#include "common/std_mutex.h"
@@ -11,8 +10,8 @@
11 10
12// Don't include common.h here as it will break LogManager 11// Don't include common.h here as it will break LogManager
13#include "common/common_types.h" 12#include "common/common_types.h"
14#include <stdio.h> 13#include <cstdio>
15#include <string.h> 14#include <cstring>
16 15
17// This may not be defined outside _WIN32 16// This may not be defined outside _WIN32
18#ifndef _WIN32 17#ifndef _WIN32
@@ -152,5 +151,3 @@ inline void YieldCPU()
152void SetCurrentThreadName(const char *name); 151void SetCurrentThreadName(const char *name);
153 152
154} // namespace Common 153} // namespace Common
155
156#endif // _THREAD_H_
diff --git a/src/common/thunk.h b/src/common/thunk.h
index 2c2f23cd0..90c8be888 100644
--- a/src/common/thunk.h
+++ b/src/common/thunk.h
@@ -2,8 +2,7 @@
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#ifndef _THUNK_H_ 5#pragma once
6#define _THUNK_H_
7 6
8#include <map> 7#include <map>
9 8
@@ -41,5 +40,3 @@ private:
41 void Shutdown(); 40 void Shutdown();
42 void Reset(); 41 void Reset();
43}; 42};
44
45#endif // _THUNK_H_
diff --git a/src/common/timer.h b/src/common/timer.h
index cfa5cf609..86418e7a7 100644
--- a/src/common/timer.h
+++ b/src/common/timer.h
@@ -2,8 +2,7 @@
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#ifndef _TIMER_H_ 5#pragma once
6#define _TIMER_H_
7 6
8#include "common/common.h" 7#include "common/common.h"
9#include <string> 8#include <string>
@@ -42,5 +41,3 @@ private:
42}; 41};
43 42
44} // Namespace Common 43} // Namespace Common
45
46#endif // _TIMER_H_
diff --git a/src/common/utf8.cpp b/src/common/utf8.cpp
index fe5270183..c83824d35 100644
--- a/src/common/utf8.cpp
+++ b/src/common/utf8.cpp
@@ -18,10 +18,10 @@
18#undef max 18#undef max
19#endif 19#endif
20 20
21#include <stdlib.h> 21#include <cstdlib>
22#include <stdio.h> 22#include <cstdio>
23#include <string.h> 23#include <cstring>
24#include <stdarg.h> 24#include <cstdarg>
25 25
26#include <algorithm> 26#include <algorithm>
27#include <string> 27#include <string>
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp
index 19f717bd2..8720bed31 100644
--- a/src/core/hle/svc.cpp
+++ b/src/core/hle/svc.cpp
@@ -5,6 +5,7 @@
5#include <map> 5#include <map>
6#include <string> 6#include <string>
7 7
8#include "common/string_util.h"
8#include "common/symbols.h" 9#include "common/symbols.h"
9 10
10#include "core/mem_map.h" 11#include "core/mem_map.h"
@@ -220,9 +221,7 @@ Result CreateThread(u32 priority, u32 entry_point, u32 arg, u32 stack_top, u32 p
220 TSymbol symbol = Symbols::GetSymbol(entry_point); 221 TSymbol symbol = Symbols::GetSymbol(entry_point);
221 name = symbol.name; 222 name = symbol.name;
222 } else { 223 } else {
223 char buff[100]; 224 name = StringFromFormat("unknown-%08x", entry_point);
224 sprintf(buff, "%s", "unknown-%08X", entry_point);
225 name = buff;
226 } 225 }
227 226
228 Handle thread = Kernel::CreateThread(name.c_str(), entry_point, priority, arg, processor_id, 227 Handle thread = Kernel::CreateThread(name.c_str(), entry_point, priority, arg, processor_id,
diff --git a/src/core/mem_map_funcs.cpp b/src/core/mem_map_funcs.cpp
index 5772cca52..ecdaa06d7 100644
--- a/src/core/mem_map_funcs.cpp
+++ b/src/core/mem_map_funcs.cpp
@@ -289,11 +289,15 @@ void Write64(const u32 addr, const u64 data) {
289 289
290void WriteBlock(const u32 addr, const u8* data, const int size) { 290void WriteBlock(const u32 addr, const u8* data, const int size) {
291 int offset = 0; 291 int offset = 0;
292 while (offset < (size & ~3)) 292 while (offset < (size & ~3)) {
293 Write32(addr + offset, *(u32*)&data[offset += 4]); 293 Write32(addr + offset, *(u32*)&data[offset]);
294 offset += 4;
295 }
294 296
295 if (size & 2) 297 if (size & 2) {
296 Write16(addr + offset, *(u16*)&data[offset += 2]); 298 Write16(addr + offset, *(u16*)&data[offset]);
299 offset += 2;
300 }
297 301
298 if (size & 1) 302 if (size & 1)
299 Write8(addr + offset, data[offset]); 303 Write8(addr + offset, data[offset]);