summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--CMakeLists.txt7
-rw-r--r--src/citra/citra.cpp2
-rw-r--r--src/citra_qt/main.cpp2
-rw-r--r--src/common/common.h43
-rw-r--r--src/common/common_funcs.h10
-rw-r--r--src/common/file_util.cpp4
-rw-r--r--src/common/platform.h40
-rw-r--r--src/common/profiler.cpp1
8 files changed, 17 insertions, 92 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 516aba554..b0fe285db 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,8 +8,11 @@ if (NOT MSVC)
8 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-attributes -pthread") 8 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-attributes -pthread")
9 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread") 9 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
10else() 10else()
11 # Silence deprecation warnings 11 # Silence "deprecation" warnings
12 add_definitions(/D_CRT_SECURE_NO_WARNINGS) 12 add_definitions(/D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE)
13 # Avoid windows.h junk
14 add_definitions(/DNOMINMAX)
15
13 # set up output paths for executable binaries (.exe-files, and .dll-files on DLL-capable platforms) 16 # set up output paths for executable binaries (.exe-files, and .dll-files on DLL-capable platforms)
14 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 17 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
15 18
diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp
index 2c6ced920..634faf76b 100644
--- a/src/citra/citra.cpp
+++ b/src/citra/citra.cpp
@@ -19,7 +19,7 @@
19#include "citra/emu_window/emu_window_glfw.h" 19#include "citra/emu_window/emu_window_glfw.h"
20 20
21/// Application entry point 21/// Application entry point
22int __cdecl main(int argc, char **argv) { 22int main(int argc, char **argv) {
23 std::shared_ptr<Log::Logger> logger = Log::InitGlobalLogger(); 23 std::shared_ptr<Log::Logger> logger = Log::InitGlobalLogger();
24 Log::Filter log_filter(Log::Level::Debug); 24 Log::Filter log_filter(Log::Level::Debug);
25 Log::SetFilter(&log_filter); 25 Log::SetFilter(&log_filter);
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp
index dd0e4de8f..b78594fb6 100644
--- a/src/citra_qt/main.cpp
+++ b/src/citra_qt/main.cpp
@@ -349,7 +349,7 @@ void GMainWindow::closeEvent(QCloseEvent* event)
349#undef main 349#undef main
350#endif 350#endif
351 351
352int __cdecl main(int argc, char* argv[]) 352int main(int argc, char* argv[])
353{ 353{
354 std::shared_ptr<Log::Logger> logger = Log::InitGlobalLogger(); 354 std::shared_ptr<Log::Logger> logger = Log::InitGlobalLogger();
355 Log::Filter log_filter(Log::Level::Info); 355 Log::Filter log_filter(Log::Level::Info);
diff --git a/src/common/common.h b/src/common/common.h
index a4a403fb9..00d1d14f9 100644
--- a/src/common/common.h
+++ b/src/common/common.h
@@ -11,8 +11,6 @@
11#include <cstdio> 11#include <cstdio>
12#include <cstring> 12#include <cstring>
13 13
14#define STACKALIGN
15
16#include "common/assert.h" 14#include "common/assert.h"
17#include "common/logging/log.h" 15#include "common/logging/log.h"
18#include "common/common_types.h" 16#include "common/common_types.h"
@@ -20,56 +18,25 @@
20#include "common/common_paths.h" 18#include "common/common_paths.h"
21#include "common/platform.h" 19#include "common/platform.h"
22 20
23#ifdef __APPLE__ 21#ifdef _WIN32
24// The Darwin ABI requires that stack frames be aligned to 16-byte boundaries. 22 // Alignment
25// This is only needed on i386 gcc - x86_64 already aligns to 16 bytes.
26 #if defined __i386__ && defined __GNUC__
27 #undef STACKALIGN
28 #define STACKALIGN __attribute__((__force_align_arg_pointer__))
29 #endif
30#elif defined _WIN32
31// Check MSC ver
32 #if defined _MSC_VER && _MSC_VER <= 1000
33 #error needs at least version 1000 of MSC
34 #endif
35
36 #ifndef NOMINMAX
37 #define NOMINMAX
38 #endif
39
40// Alignment
41 #define MEMORY_ALIGNED16(x) __declspec(align(16)) x 23 #define MEMORY_ALIGNED16(x) __declspec(align(16)) x
42 #define MEMORY_ALIGNED32(x) __declspec(align(32)) x 24 #define MEMORY_ALIGNED32(x) __declspec(align(32)) x
43 #define MEMORY_ALIGNED64(x) __declspec(align(64)) x 25 #define MEMORY_ALIGNED64(x) __declspec(align(64)) x
44 #define MEMORY_ALIGNED128(x) __declspec(align(128)) x 26 #define MEMORY_ALIGNED128(x) __declspec(align(128)) x
45 #define MEMORY_ALIGNED16_DECL(x) __declspec(align(16)) x 27#else
46 #define MEMORY_ALIGNED64_DECL(x) __declspec(align(64)) x 28 // Windows compatibility
47#endif
48
49// Windows compatibility
50#ifndef _WIN32
51 #ifdef _LP64 29 #ifdef _LP64
52 #define _M_X64 1 30 #define _M_X64 1
53 #else 31 #else
54 #define _M_IX86 1 32 #define _M_IX86 1
55 #endif 33 #endif
34
56 #define __forceinline inline __attribute__((always_inline)) 35 #define __forceinline inline __attribute__((always_inline))
57 #define MEMORY_ALIGNED16(x) __attribute__((aligned(16))) x 36 #define MEMORY_ALIGNED16(x) __attribute__((aligned(16))) x
58 #define MEMORY_ALIGNED32(x) __attribute__((aligned(32))) x 37 #define MEMORY_ALIGNED32(x) __attribute__((aligned(32))) x
59 #define MEMORY_ALIGNED64(x) __attribute__((aligned(64))) x 38 #define MEMORY_ALIGNED64(x) __attribute__((aligned(64))) x
60 #define MEMORY_ALIGNED128(x) __attribute__((aligned(128))) x 39 #define MEMORY_ALIGNED128(x) __attribute__((aligned(128))) x
61 #define MEMORY_ALIGNED16_DECL(x) __attribute__((aligned(16))) x
62 #define MEMORY_ALIGNED64_DECL(x) __attribute__((aligned(64))) x
63#endif
64
65#ifdef _MSC_VER
66 #define __strdup _strdup
67 #define __getcwd _getcwd
68 #define __chdir _chdir
69#else
70 #define __strdup strdup
71 #define __getcwd getcwd
72 #define __chdir chdir
73#endif 40#endif
74 41
75#if defined _M_GENERIC 42#if defined _M_GENERIC
diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h
index e76cb7d68..9e666d77e 100644
--- a/src/common/common_funcs.h
+++ b/src/common/common_funcs.h
@@ -73,16 +73,12 @@ inline u64 _rotr64(u64 x, unsigned int shift){
73} 73}
74 74
75#else // _MSC_VER 75#else // _MSC_VER
76#include <locale.h> 76 #include <locale.h>
77 77
78// Function Cross-Compatibility 78 // Function Cross-Compatibility
79 #define strcasecmp _stricmp
80 #define strncasecmp _strnicmp
81 #define unlink _unlink
82 #define snprintf _snprintf 79 #define snprintf _snprintf
83 #define vscprintf _vscprintf
84 80
85// Locale Cross-Compatibility 81 // Locale Cross-Compatibility
86 #define locale_t _locale_t 82 #define locale_t _locale_t
87 #define freelocale _free_locale 83 #define freelocale _free_locale
88 #define newlocale(mask, locale, base) _create_locale(mask, locale) 84 #define newlocale(mask, locale, base) _create_locale(mask, locale)
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp
index 4ef4918d7..25d7d4b9f 100644
--- a/src/common/file_util.cpp
+++ b/src/common/file_util.cpp
@@ -589,7 +589,7 @@ std::string GetCurrentDir()
589{ 589{
590 char *dir; 590 char *dir;
591 // Get the current working directory (getcwd uses malloc) 591 // Get the current working directory (getcwd uses malloc)
592 if (!(dir = __getcwd(nullptr, 0))) { 592 if (!(dir = getcwd(nullptr, 0))) {
593 593
594 LOG_ERROR(Common_Filesystem, "GetCurrentDirectory failed: %s", 594 LOG_ERROR(Common_Filesystem, "GetCurrentDirectory failed: %s",
595 GetLastErrorMsg()); 595 GetLastErrorMsg());
@@ -603,7 +603,7 @@ std::string GetCurrentDir()
603// Sets the current directory to the given directory 603// Sets the current directory to the given directory
604bool SetCurrentDir(const std::string &directory) 604bool SetCurrentDir(const std::string &directory)
605{ 605{
606 return __chdir(directory.c_str()) == 0; 606 return chdir(directory.c_str()) == 0;
607} 607}
608 608
609#if defined(__APPLE__) 609#if defined(__APPLE__)
diff --git a/src/common/platform.h b/src/common/platform.h
index e27d6e31f..fc680d549 100644
--- a/src/common/platform.h
+++ b/src/common/platform.h
@@ -66,45 +66,5 @@
66//////////////////////////////////////////////////////////////////////////////////////////////////// 66////////////////////////////////////////////////////////////////////////////////////////////////////
67// Compiler-Specific Definitions 67// Compiler-Specific Definitions
68 68
69#if EMU_PLATFORM == PLATFORM_WINDOWS
70
71#include <time.h>
72
73#ifndef NOMINMAX
74#define NOMINMAX
75#endif
76#define EMU_FASTCALL __fastcall
77
78#ifdef _MSC_VER
79inline struct tm* localtime_r(const time_t *clock, struct tm *result) {
80 if (localtime_s(result, clock) == 0)
81 return result;
82 return nullptr;
83}
84#endif
85
86#else // EMU_PLATFORM != PLATFORM_WINDOWS
87
88#define EMU_FASTCALL __attribute__((fastcall))
89#define __stdcall
90#define __cdecl
91
92#define BOOL bool
93#define DWORD u32
94
95// TODO: Hacks..
96#include <limits.h>
97
98#include <strings.h>
99#define stricmp(str1, str2) strcasecmp(str1, str2)
100#define _stricmp(str1, str2) strcasecmp(str1, str2)
101#define _snprintf snprintf
102#define _getcwd getcwd
103#define _tzset tzset
104
105typedef void EXCEPTION_POINTERS;
106
107#endif
108
109#define GCC_VERSION_AVAILABLE(major, minor) (defined(__GNUC__) && (__GNUC__ > (major) || \ 69#define GCC_VERSION_AVAILABLE(major, minor) (defined(__GNUC__) && (__GNUC__ > (major) || \
110 (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))) 70 (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor))))
diff --git a/src/common/profiler.cpp b/src/common/profiler.cpp
index 65c3df167..b8cde1785 100644
--- a/src/common/profiler.cpp
+++ b/src/common/profiler.cpp
@@ -7,7 +7,6 @@
7#include "common/assert.h" 7#include "common/assert.h"
8 8
9#if defined(_MSC_VER) && _MSC_VER <= 1800 // MSVC 2013. 9#if defined(_MSC_VER) && _MSC_VER <= 1800 // MSVC 2013.
10#define NOMINMAX
11#define WIN32_LEAN_AND_MEAN 10#define WIN32_LEAN_AND_MEAN
12#include <Windows.h> // For QueryPerformanceCounter/Frequency 11#include <Windows.h> // For QueryPerformanceCounter/Frequency
13#endif 12#endif