summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x.travis-build.sh6
-rwxr-xr-x.travis-deps.sh20
-rw-r--r--.travis-upload.sh1
-rw-r--r--.travis.yml22
-rw-r--r--CMakeLists.txt32
-rw-r--r--CONTRIBUTING.md38
-rw-r--r--src/citra/citra.cpp4
-rw-r--r--src/citra/config.cpp3
-rw-r--r--src/citra/config.h6
-rw-r--r--src/citra/emu_window/emu_window_glfw.cpp12
-rw-r--r--src/citra/emu_window/emu_window_glfw.h2
-rw-r--r--src/citra_qt/bootmanager.cpp4
-rw-r--r--src/citra_qt/config.cpp2
-rw-r--r--src/citra_qt/config.h4
-rw-r--r--src/citra_qt/debugger/disassembler.cpp2
-rw-r--r--src/citra_qt/hotkeys.cpp5
-rw-r--r--src/citra_qt/hotkeys.h4
-rw-r--r--src/citra_qt/main.cpp6
-rw-r--r--src/common/CMakeLists.txt2
-rw-r--r--src/common/assert.h1
-rw-r--r--src/common/bit_field.h1
-rw-r--r--src/common/chunk_file.h10
-rw-r--r--src/common/common_funcs.h11
-rw-r--r--src/common/common_types.h2
-rw-r--r--src/common/emu_window.cpp6
-rw-r--r--src/common/emu_window.h12
-rw-r--r--src/common/fifo_queue.h111
-rw-r--r--src/common/file_util.cpp11
-rw-r--r--src/common/file_util.h3
-rw-r--r--src/common/logging/filter.h1
-rw-r--r--src/common/logging/log.h4
-rw-r--r--src/common/make_unique.h1
-rw-r--r--src/common/memory_util.cpp11
-rw-r--r--src/common/memory_util.h4
-rw-r--r--src/common/misc.cpp5
-rw-r--r--src/common/platform.h55
-rw-r--r--src/common/profiler.cpp11
-rw-r--r--src/common/profiler_reporting.h5
-rw-r--r--src/common/string_util.cpp9
-rw-r--r--src/common/string_util.h3
-rw-r--r--src/common/swap.h10
-rw-r--r--src/common/synchronized_wrapper.h1
-rw-r--r--src/common/thread.cpp17
-rw-r--r--src/common/thread.h16
-rw-r--r--src/common/thunk.h42
-rw-r--r--src/core/arm/disassembler/load_symbol_map.cpp1
-rw-r--r--src/core/arm/dyncom/arm_dyncom.h5
-rw-r--r--src/core/arm/skyeye_common/vfp/vfp.cpp6
-rw-r--r--src/core/arm/skyeye_common/vfp/vfpsingle.cpp4
-rw-r--r--src/core/core.cpp3
-rw-r--r--src/core/core_timing.cpp4
-rw-r--r--src/core/file_sys/archive_backend.cpp2
-rw-r--r--src/core/file_sys/archive_extsavedata.cpp5
-rw-r--r--src/core/file_sys/archive_extsavedata.h7
-rw-r--r--src/core/file_sys/archive_romfs.cpp3
-rw-r--r--src/core/file_sys/archive_romfs.h4
-rw-r--r--src/core/file_sys/archive_savedata.cpp4
-rw-r--r--src/core/file_sys/archive_savedata.h7
-rw-r--r--src/core/file_sys/archive_savedatacheck.cpp6
-rw-r--r--src/core/file_sys/archive_savedatacheck.h9
-rw-r--r--src/core/file_sys/archive_sdmc.cpp3
-rw-r--r--src/core/file_sys/archive_sdmc.h7
-rw-r--r--src/core/file_sys/archive_systemsavedata.cpp6
-rw-r--r--src/core/file_sys/archive_systemsavedata.h7
-rw-r--r--src/core/file_sys/disk_archive.cpp4
-rw-r--r--src/core/file_sys/disk_archive.h7
-rw-r--r--src/core/file_sys/file_backend.h2
-rw-r--r--src/core/file_sys/ivfc_archive.cpp2
-rw-r--r--src/core/file_sys/ivfc_archive.h4
-rw-r--r--src/core/hle/hle.cpp1
-rw-r--r--src/core/hle/kernel/kernel.cpp2
-rw-r--r--src/core/hle/kernel/kernel.h7
-rw-r--r--src/core/hle/kernel/process.h3
-rw-r--r--src/core/hle/kernel/session.h6
-rw-r--r--src/core/hle/kernel/thread.h1
-rw-r--r--src/core/hle/kernel/vm_manager.cpp2
-rw-r--r--src/core/hle/kernel/vm_manager.h1
-rw-r--r--src/core/hle/result.h2
-rw-r--r--src/core/hle/service/dsp_dsp.h2
-rw-r--r--src/core/hle/service/fs/archive.cpp10
-rw-r--r--src/core/hle/service/fs/archive.h13
-rw-r--r--src/core/hle/service/gsp_gpu.cpp4
-rw-r--r--src/core/hle/service/gsp_gpu.h3
-rw-r--r--src/core/hle/service/hid/hid.cpp1
-rw-r--r--src/core/hle/service/hid/hid.h16
-rw-r--r--src/core/hle/service/service.h3
-rw-r--r--src/core/hle/service/soc_u.cpp75
-rw-r--r--src/core/hle/service/soc_u.h2
-rw-r--r--src/core/hle/service/y2r_u.cpp1
-rw-r--r--src/core/hle/service/y2r_u.h2
-rw-r--r--src/core/hle/shared_page.cpp6
-rw-r--r--src/core/hle/shared_page.h3
-rw-r--r--src/core/hw/gpu.cpp11
-rw-r--r--src/core/hw/gpu.h1
-rw-r--r--src/core/hw/lcd.cpp2
-rw-r--r--src/core/hw/lcd.h1
-rw-r--r--src/core/hw/y2r.cpp4
-rw-r--r--src/core/loader/elf.cpp3
-rw-r--r--src/core/loader/loader.cpp2
-rw-r--r--src/core/loader/loader.h8
-rw-r--r--src/core/loader/ncch.cpp3
-rw-r--r--src/core/mem_map.cpp5
-rw-r--r--src/core/memory.cpp3
-rw-r--r--src/core/memory.h2
-rw-r--r--src/video_core/command_processor.cpp12
-rw-r--r--src/video_core/command_processor.h4
-rw-r--r--src/video_core/debug_utils/debug_utils.cpp1
-rw-r--r--src/video_core/hwrasterizer_base.h9
-rw-r--r--src/video_core/pica.h14
-rw-r--r--src/video_core/rasterizer.cpp31
-rw-r--r--src/video_core/renderer_base.h4
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp9
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.h5
-rw-r--r--src/video_core/renderer_opengl/pica_to_gl.h2
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.cpp15
-rw-r--r--src/video_core/vertex_shader.h5
-rw-r--r--src/video_core/video_core.h7
117 files changed, 466 insertions, 513 deletions
diff --git a/.travis-build.sh b/.travis-build.sh
index 8ec2ed70c..22a3a9fd6 100755
--- a/.travis-build.sh
+++ b/.travis-build.sh
@@ -11,8 +11,12 @@ fi
11 11
12#if OS is linux or is not set 12#if OS is linux or is not set
13if [ "$TRAVIS_OS_NAME" = "linux" -o -z "$TRAVIS_OS_NAME" ]; then 13if [ "$TRAVIS_OS_NAME" = "linux" -o -z "$TRAVIS_OS_NAME" ]; then
14 export CC=gcc-4.9
15 export CXX=g++-4.9
16 export PKG_CONFIG_PATH=$HOME/.local/lib/pkgconfig:$PKG_CONFIG_PATH
17
14 mkdir build && cd build 18 mkdir build && cd build
15 cmake -DUSE_QT5=OFF .. 19 cmake -DCITRA_FORCE_QT4=ON ..
16 make -j4 20 make -j4
17elif [ "$TRAVIS_OS_NAME" = "osx" ]; then 21elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
18 export Qt5_DIR=$(brew --prefix)/opt/qt5 22 export Qt5_DIR=$(brew --prefix)/opt/qt5
diff --git a/.travis-deps.sh b/.travis-deps.sh
index b9561bb66..d10973410 100755
--- a/.travis-deps.sh
+++ b/.travis-deps.sh
@@ -5,24 +5,24 @@ set -x
5 5
6#if OS is linux or is not set 6#if OS is linux or is not set
7if [ "$TRAVIS_OS_NAME" = "linux" -o -z "$TRAVIS_OS_NAME" ]; then 7if [ "$TRAVIS_OS_NAME" = "linux" -o -z "$TRAVIS_OS_NAME" ]; then
8 sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y 8 export CC=gcc-4.9
9 sudo apt-get -qq update 9 export CXX=g++-4.9
10 sudo apt-get -qq install g++-4.9 xorg-dev libglu1-mesa-dev libxcursor-dev 10 mkdir -p $HOME/.local
11 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 90 11
12 curl http://www.cmake.org/files/v2.8/cmake-2.8.11-Linux-i386.tar.gz \
13 | tar -xz -C $HOME/.local --strip-components=1
14
12 ( 15 (
13 git clone https://github.com/glfw/glfw.git --branch 3.0.4 --depth 1 16 git clone https://github.com/glfw/glfw.git --branch 3.1.1 --depth 1
14 mkdir glfw/build && cd glfw/build 17 mkdir glfw/build && cd glfw/build
15 cmake -DBUILD_SHARED_LIBS=ON \ 18 cmake -DBUILD_SHARED_LIBS=ON \
16 -DGLFW_BUILD_EXAMPLES=OFF \ 19 -DGLFW_BUILD_EXAMPLES=OFF \
17 -DGLFW_BUILD_TESTS=OFF \ 20 -DGLFW_BUILD_TESTS=OFF \
21 -DCMAKE_INSTALL_PREFIX=$HOME/.local \
18 .. 22 ..
19 make -j4 && sudo make install 23 make -j4 && make install
20 ) 24 )
21 25
22 sudo apt-get install lib32stdc++6
23 sudo mkdir -p /usr/local
24 curl http://www.cmake.org/files/v2.8/cmake-2.8.11-Linux-i386.tar.gz \
25 | sudo tar -xz -C /usr/local --strip-components=1
26elif [ "$TRAVIS_OS_NAME" = "osx" ]; then 26elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
27 brew tap homebrew/versions 27 brew tap homebrew/versions
28 brew install qt5 glfw3 pkgconfig 28 brew install qt5 glfw3 pkgconfig
diff --git a/.travis-upload.sh b/.travis-upload.sh
index 0904b646a..3a15e8f6a 100644
--- a/.travis-upload.sh
+++ b/.travis-upload.sh
@@ -7,7 +7,6 @@ if [ "$TRAVIS_BRANCH" = "master" ]; then
7 UPLOAD_DIR="/citra/nightly/linux-amd64" 7 UPLOAD_DIR="/citra/nightly/linux-amd64"
8 mkdir "$REV_NAME" 8 mkdir "$REV_NAME"
9 9
10 sudo apt-get -qq install lftp
11 cp build/src/citra/citra "$REV_NAME" 10 cp build/src/citra/citra "$REV_NAME"
12 cp build/src/citra_qt/citra-qt "$REV_NAME" 11 cp build/src/citra_qt/citra-qt "$REV_NAME"
13 elif [ "$TRAVIS_OS_NAME" = "osx" ]; then 12 elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
diff --git a/.travis.yml b/.travis.yml
index 5c882a574..4d21257bc 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,11 +8,21 @@ env:
8 global: 8 global:
9 - secure: "AXHFIafTmbGDsHD3mUVj5a4I397DQjti/WoqAJGUp2PglxTcc04BwxZ9Z+xLuf5N2Hs5r9ojAJLT8OGxJCLBDXzneQTNSqXbFuYSLbqrEAiIRlA9eRIotWCg+wYcO+5e8MKX+cHVKwiIWasUB21AtCdq6msh6Y3pUshZp212VPg=" 9 - secure: "AXHFIafTmbGDsHD3mUVj5a4I397DQjti/WoqAJGUp2PglxTcc04BwxZ9Z+xLuf5N2Hs5r9ojAJLT8OGxJCLBDXzneQTNSqXbFuYSLbqrEAiIRlA9eRIotWCg+wYcO+5e8MKX+cHVKwiIWasUB21AtCdq6msh6Y3pUshZp212VPg="
10 10
11before_install: 11sudo: false
12 - sh .travis-deps.sh
13 12
14script: 13addons:
15 - sh .travis-build.sh 14 apt:
15 sources:
16 - ubuntu-toolchain-r-test
17 packages:
18 - gcc-4.9
19 - g++-4.9
20 - xorg-dev
21 - libglu1-mesa-dev
22 - libxcursor-dev
23 - lib32stdc++6 # For CMake
24 - lftp # To upload builds
16 25
17after_success: 26install: ./.travis-deps.sh
18 - sh .travis-upload.sh 27script: ./.travis-build.sh
28after_success: ./.travis-upload.sh
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6805ebed8..3658ef48e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,32 +22,34 @@ else()
22 22
23 # set up output paths for executable binaries (.exe-files, and .dll-files on DLL-capable platforms) 23 # set up output paths for executable binaries (.exe-files, and .dll-files on DLL-capable platforms)
24 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 24 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
25 set(CMAKE_CONFIGURATION_TYPES Debug Release RelWithDebInfo CACHE STRING "" FORCE) 25 set(CMAKE_CONFIGURATION_TYPES Debug Release CACHE STRING "" FORCE)
26 26
27 # Tweak optimization settings 27 # Tweak optimization settings
28 # As far as I can tell, there's no way to override the CMake defaults while leaving user 28 # As far as I can tell, there's no way to override the CMake defaults while leaving user
29 # changes intact, so we'll just clobber everything and say sorry. 29 # changes intact, so we'll just clobber everything and say sorry.
30 message(STATUS "Cache compiler flags ignored, please edit CMakeLists.txt to change the flags.") 30 message(STATUS "Cache compiler flags ignored, please edit CMakeLists.txt to change the flags.")
31 # /O2 - Optimization level 2 31
32 # /Oy- - Don't omit frame pointer 32 # /W3 - Level 3 warnings
33 # /GR- - Disable RTTI
34 # /GS- - No stack buffer overflow checks
35 # /EHsc - C++-only exception handling semantics
36 set(optimization_flags "/O2 /Oy- /GR- /GS- /EHsc")
37 # /MP - Multi-threaded compilation 33 # /MP - Multi-threaded compilation
38 # /Zi - Output debugging information 34 # /Zi - Output debugging information
39 # /Zo - enahnced debug info for optimized builds 35 # /Zo - enahnced debug info for optimized builds
36 set(CMAKE_C_FLAGS "/W3 /MP /Zi /Zo" CACHE STRING "" FORCE)
37 # /GR- - Disable RTTI
38 # /EHsc - C++-only exception handling semantics
39 set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} /GR- /EHsc" CACHE STRING "" FORCE)
40
40 # /MDd - Multi-threaded Debug Runtime DLL 41 # /MDd - Multi-threaded Debug Runtime DLL
41 set(CMAKE_C_FLAGS_DEBUG "/MP /MDd /Zi" CACHE STRING "" FORCE) 42 set(CMAKE_C_FLAGS_DEBUG "/Od /MDd" CACHE STRING "" FORCE)
42 set(CMAKE_CXX_FLAGS_DEBUG "/MP /MDd /Zi" CACHE STRING "" FORCE) 43 set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}" CACHE STRING "" FORCE)
44
45 # /O2 - Optimization level 2
46 # /GS- - No stack buffer overflow checks
43 # /MD - Multi-threaded runtime DLL 47 # /MD - Multi-threaded runtime DLL
44 set(CMAKE_C_FLAGS_RELEASE "${optimization_flags} /MP /MD" CACHE STRING "" FORCE) 48 set(CMAKE_C_FLAGS_RELEASE "/O2 /GS- /MD" CACHE STRING "" FORCE)
45 set(CMAKE_CXX_FLAGS_RELEASE "${optimization_flags} /MP /MD" CACHE STRING "" FORCE) 49 set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}" CACHE STRING "" FORCE)
46 set(CMAKE_C_FLAGS_RELWITHDEBINFO "${optimization_flags} /MP /MD /Zi /Zo" CACHE STRING "" FORCE)
47 set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${optimization_flags} /MP /MD /Zi /Zo" CACHE STRING "" FORCE)
48 50
49 set(CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG" CACHE STRING "" FORCE) 51 set(CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG" CACHE STRING "" FORCE)
50 set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "/DEBUG" CACHE STRING "" FORCE) 52 set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/DEBUG" CACHE STRING "" FORCE)
51endif() 53endif()
52 54
53add_definitions(-DSINGLETHREADED) 55add_definitions(-DSINGLETHREADED)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 906a4bc7d..f2dbdf1a4 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -7,19 +7,14 @@ Citra is a brand new project, so we have a great opportunity to keep things clea
7* Don't ever introduce new external dependencies into Core 7* Don't ever introduce new external dependencies into Core
8* Don't use any platform specific code in Core 8* Don't use any platform specific code in Core
9* Use namespaces often 9* Use namespaces often
10* Avoid the use of C-style casts and instead prefer C++-style `static_cast` and `reinterpret_cast`. Never use `const_cast` or `dynamic_cast` (we build with RTTI disabled). The only exception to this rule is for casting between two numeric types, where C-style casts are encouraged for brevity and readability.
10 11
11### Naming Rules 12### Naming Rules
12* Functions 13* Functions: `PascalCase`
13 * PascalCase, "_" may also be used for clarity (e.g. ARM_InitCore) 14* Variables: `lower_case_underscored`. Prefix with `g_` if global.
14* Variables 15* Classes: `PascalCase`
15 * lower_case_underscored 16* Files and Directories: `lower_case_underscored`
16 * Prefix "g_" if global 17* Namespaces: `PascalCase`, `_` may also be used for clarity (e.g. `ARM_InitCore`)
17* Classes
18 * PascalCase, "_" may also be used for clarity (e.g. OGL_VideoInterface)
19* Files/Folders
20 * lower_case_underscored
21* Namespaces
22 * PascalCase, "_" may also be used for clarity (e.g. ARM_InitCore)
23 18
24### Indentation/Whitespace Style 19### Indentation/Whitespace Style
25Follow the indentation/whitespace style shown below. Do not use tabs, use 4-spaces instead. 20Follow the indentation/whitespace style shown below. Do not use tabs, use 4-spaces instead.
@@ -36,25 +31,25 @@ namespace Example {
36 31
37// Declare globals at the top 32// Declare globals at the top
38int g_foo = 0; 33int g_foo = 0;
39char* g_some_pointer; // Notice the position of the * 34char* g_some_pointer; // Pointer * and reference & stick to the type name
40 35
41/// A colorful enum. 36/// A colorful enum.
42enum SomeEnum { 37enum SomeEnum {
43 COLOR_RED, ///< The color of fire. 38 COLOR_RED, ///< The color of fire.
44 COLOR_GREEN, ///< The color of grass. 39 COLOR_GREEN, ///< The color of grass.
45 COLOR_BLUE ///< Not actually the color of water. 40 COLOR_BLUE, ///< Not actually the color of water.
46}; 41};
47 42
48/** 43/**
49 * Very important struct that does a lot of stuff. 44 * Very important struct that does a lot of stuff.
50 * Note that the asterisks are indented by one space. 45 * Note that the asterisks are indented by one space to align to the first line.
51 */ 46 */
52struct Position { 47struct Position {
53 int x, y; 48 int x, y;
54}; 49};
55 50
56// Use "typename" rather than "class" here, just to be consistent 51// Use "typename" rather than "class" here
57template 52template <typename T>
58void FooBar() { 53void FooBar() {
59 int some_array[] = { 54 int some_array[] = {
60 5, 55 5,
@@ -72,7 +67,7 @@ void FooBar() {
72 // Comment directly above code when possible 67 // Comment directly above code when possible
73 if (some_condition) single_statement(); 68 if (some_condition) single_statement();
74 69
75 // Place a single space after the for loop semicolons 70 // Place a single space after the for loop semicolons, prefer pre-increment
76 for (int i = 0; i != 25; ++i) { 71 for (int i = 0; i != 25; ++i) {
77 // This is how we write loops 72 // This is how we write loops
78 } 73 }
@@ -83,6 +78,9 @@ void FooBar() {
83 if (this || condition_takes_up_multiple && 78 if (this || condition_takes_up_multiple &&
84 lines && like && this || everything || 79 lines && like && this || everything ||
85 alright || then) { 80 alright || then) {
81
82 // Leave a blank space before the if block body if the condition was continued across
83 // several lines.
86 } 84 }
87 85
88 switch (var) { 86 switch (var) {
@@ -101,11 +99,7 @@ void FooBar() {
101 break; 99 break;
102 } 100 }
103 101
104 std::vector 102 std::vector<T> you_can_declare, a_few, variables, like_this;
105 you_can_declare,
106 a_few,
107 variables,
108 like_this;
109} 103}
110 104
111} 105}
diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp
index ce8d7dd25..a59726c78 100644
--- a/src/citra/citra.cpp
+++ b/src/citra/citra.cpp
@@ -2,13 +2,11 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <thread> 5#include <string>
6 6
7#include "common/logging/log.h" 7#include "common/logging/log.h"
8#include "common/logging/text_formatter.h"
9#include "common/logging/backend.h" 8#include "common/logging/backend.h"
10#include "common/logging/filter.h" 9#include "common/logging/filter.h"
11#include "common/scope_exit.h"
12 10
13#include "core/settings.h" 11#include "core/settings.h"
14#include "core/system.h" 12#include "core/system.h"
diff --git a/src/citra/config.cpp b/src/citra/config.cpp
index 1378567c1..506cb7939 100644
--- a/src/citra/config.cpp
+++ b/src/citra/config.cpp
@@ -2,7 +2,9 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#define GLFW_INCLUDE_NONE
5#include <GLFW/glfw3.h> 6#include <GLFW/glfw3.h>
7#include <inih/cpp/INIReader.h>
6 8
7#include "citra/default_ini.h" 9#include "citra/default_ini.h"
8 10
@@ -10,7 +12,6 @@
10#include "common/logging/log.h" 12#include "common/logging/log.h"
11 13
12#include "core/settings.h" 14#include "core/settings.h"
13#include "core/core.h"
14 15
15#include "config.h" 16#include "config.h"
16 17
diff --git a/src/citra/config.h b/src/citra/config.h
index 0eb176c7d..c326ec669 100644
--- a/src/citra/config.h
+++ b/src/citra/config.h
@@ -4,11 +4,9 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <map> 7#include <string>
8 8
9#include <inih/cpp/INIReader.h> 9class INIReader;
10
11#include "common/common_types.h"
12 10
13class Config { 11class Config {
14 INIReader* glfw_config; 12 INIReader* glfw_config;
diff --git a/src/citra/emu_window/emu_window_glfw.cpp b/src/citra/emu_window/emu_window_glfw.cpp
index 341b48d2a..42fb683a9 100644
--- a/src/citra/emu_window/emu_window_glfw.cpp
+++ b/src/citra/emu_window/emu_window_glfw.cpp
@@ -2,13 +2,25 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <algorithm>
6#include <cstdlib>
7#include <string>
8
9// Let’s use our own GL header, instead of one from GLFW.
10#include "video_core/renderer_opengl/generated/gl_3_2_core.h"
11#define GLFW_INCLUDE_NONE
5#include <GLFW/glfw3.h> 12#include <GLFW/glfw3.h>
6 13
14#include "common/assert.h"
15#include "common/key_map.h"
7#include "common/logging/log.h" 16#include "common/logging/log.h"
17#include "common/scm_rev.h"
18#include "common/string_util.h"
8 19
9#include "video_core/video_core.h" 20#include "video_core/video_core.h"
10 21
11#include "core/settings.h" 22#include "core/settings.h"
23#include "core/hle/service/hid/hid.h"
12 24
13#include "citra/emu_window/emu_window_glfw.h" 25#include "citra/emu_window/emu_window_glfw.h"
14 26
diff --git a/src/citra/emu_window/emu_window_glfw.h b/src/citra/emu_window/emu_window_glfw.h
index 16c109b79..7ccd5e6aa 100644
--- a/src/citra/emu_window/emu_window_glfw.h
+++ b/src/citra/emu_window/emu_window_glfw.h
@@ -4,6 +4,8 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <utility>
8
7#include "common/emu_window.h" 9#include "common/emu_window.h"
8 10
9struct GLFWwindow; 11struct GLFWwindow;
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp
index 3db09c65b..9d36364dd 100644
--- a/src/citra_qt/bootmanager.cpp
+++ b/src/citra_qt/bootmanager.cpp
@@ -11,6 +11,10 @@
11#include "bootmanager.h" 11#include "bootmanager.h"
12#include "main.h" 12#include "main.h"
13 13
14#include "common/string_util.h"
15#include "common/scm_rev.h"
16#include "common/key_map.h"
17
14#include "core/core.h" 18#include "core/core.h"
15#include "core/settings.h" 19#include "core/settings.h"
16#include "core/system.h" 20#include "core/system.h"
diff --git a/src/citra_qt/config.cpp b/src/citra_qt/config.cpp
index 2a9af1f38..5c056446e 100644
--- a/src/citra_qt/config.cpp
+++ b/src/citra_qt/config.cpp
@@ -2,11 +2,11 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <QSettings>
5#include <QString> 6#include <QString>
6#include <QStringList> 7#include <QStringList>
7 8
8#include "core/settings.h" 9#include "core/settings.h"
9#include "core/core.h"
10#include "common/file_util.h" 10#include "common/file_util.h"
11 11
12#include "config.h" 12#include "config.h"
diff --git a/src/citra_qt/config.h b/src/citra_qt/config.h
index 4485cae73..dd0b2ef0b 100644
--- a/src/citra_qt/config.h
+++ b/src/citra_qt/config.h
@@ -4,9 +4,9 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <QSettings> 7#include <string>
8 8
9#include "common/common_types.h" 9class QSettings;
10 10
11class Config { 11class Config {
12 QSettings* qt_config; 12 QSettings* qt_config;
diff --git a/src/citra_qt/debugger/disassembler.cpp b/src/citra_qt/debugger/disassembler.cpp
index e99ec1b30..b41c40a0e 100644
--- a/src/citra_qt/debugger/disassembler.cpp
+++ b/src/citra_qt/debugger/disassembler.cpp
@@ -2,6 +2,8 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <QShortcut>
6
5#include "disassembler.h" 7#include "disassembler.h"
6 8
7#include "../bootmanager.h" 9#include "../bootmanager.h"
diff --git a/src/citra_qt/hotkeys.cpp b/src/citra_qt/hotkeys.cpp
index 322c25c9e..5ed6cf0b1 100644
--- a/src/citra_qt/hotkeys.cpp
+++ b/src/citra_qt/hotkeys.cpp
@@ -2,10 +2,13 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <map>
6
5#include <QKeySequence> 7#include <QKeySequence>
6#include <QSettings> 8#include <QSettings>
9#include <QShortcut>
10
7#include "hotkeys.h" 11#include "hotkeys.h"
8#include <map>
9 12
10struct Hotkey 13struct Hotkey
11{ 14{
diff --git a/src/citra_qt/hotkeys.h b/src/citra_qt/hotkeys.h
index 75c7cc625..2317f8188 100644
--- a/src/citra_qt/hotkeys.h
+++ b/src/citra_qt/hotkeys.h
@@ -2,12 +2,12 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <QShortcut>
6#include <QDialog>
7#include "ui_hotkeys.h" 5#include "ui_hotkeys.h"
8 6
7class QDialog;
9class QKeySequence; 8class QKeySequence;
10class QSettings; 9class QSettings;
10class QShortcut;
11 11
12/** 12/**
13 * Register a hotkey. 13 * Register a hotkey.
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp
index 8041816a0..d23bafafc 100644
--- a/src/citra_qt/main.cpp
+++ b/src/citra_qt/main.cpp
@@ -10,18 +10,16 @@
10#include "qhexedit.h" 10#include "qhexedit.h"
11#include "main.h" 11#include "main.h"
12 12
13#include "common/string_util.h"
13#include "common/logging/text_formatter.h" 14#include "common/logging/text_formatter.h"
14#include "common/logging/log.h" 15#include "common/logging/log.h"
15#include "common/logging/backend.h" 16#include "common/logging/backend.h"
16#include "common/logging/filter.h" 17#include "common/logging/filter.h"
17#include "common/make_unique.h" 18#include "common/make_unique.h"
18#include "common/platform.h" 19#include "common/platform.h"
20#include "common/scm_rev.h"
19#include "common/scope_exit.h" 21#include "common/scope_exit.h"
20 22
21#if EMU_PLATFORM == PLATFORM_LINUX
22#include <unistd.h>
23#endif
24
25#include "bootmanager.h" 23#include "bootmanager.h"
26#include "hotkeys.h" 24#include "hotkeys.h"
27 25
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index e78f4f144..4c086cd2f 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -31,7 +31,6 @@ set(HEADERS
31 cpu_detect.h 31 cpu_detect.h
32 debug_interface.h 32 debug_interface.h
33 emu_window.h 33 emu_window.h
34 fifo_queue.h
35 file_util.h 34 file_util.h
36 key_map.h 35 key_map.h
37 linear_disk_cache.h 36 linear_disk_cache.h
@@ -53,7 +52,6 @@ set(HEADERS
53 synchronized_wrapper.h 52 synchronized_wrapper.h
54 thread.h 53 thread.h
55 thread_queue_list.h 54 thread_queue_list.h
56 thunk.h
57 timer.h 55 timer.h
58 vector_math.h 56 vector_math.h
59 ) 57 )
diff --git a/src/common/assert.h b/src/common/assert.h
index 7b7d8bf28..6849778b7 100644
--- a/src/common/assert.h
+++ b/src/common/assert.h
@@ -4,7 +4,6 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <cstdio>
8#include <cstdlib> 7#include <cstdlib>
9 8
10#include "common/common_funcs.h" 9#include "common/common_funcs.h"
diff --git a/src/common/bit_field.h b/src/common/bit_field.h
index 1f3ecf844..6595b5ba4 100644
--- a/src/common/bit_field.h
+++ b/src/common/bit_field.h
@@ -32,6 +32,7 @@
32 32
33#pragma once 33#pragma once
34 34
35#include <cstddef>
35#include <limits> 36#include <limits>
36#include <type_traits> 37#include <type_traits>
37 38
diff --git a/src/common/chunk_file.h b/src/common/chunk_file.h
index dcd80525e..8be0b1109 100644
--- a/src/common/chunk_file.h
+++ b/src/common/chunk_file.h
@@ -26,16 +26,18 @@
26// - Zero backwards/forwards compatibility 26// - Zero backwards/forwards compatibility
27// - Serialization code for anything complex has to be manually written. 27// - Serialization code for anything complex has to be manually written.
28 28
29#include <map> 29#include <cstring>
30#include <vector>
31#include <deque> 30#include <deque>
32#include <string>
33#include <list> 31#include <list>
32#include <map>
34#include <set> 33#include <set>
34#include <string>
35#include <type_traits> 35#include <type_traits>
36#include <utility>
37#include <vector>
36 38
39#include "common/assert.h"
37#include "common/common_types.h" 40#include "common/common_types.h"
38#include "common/file_util.h"
39#include "common/logging/log.h" 41#include "common/logging/log.h"
40 42
41template <class T> 43template <class T>
diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h
index 91b74c6bc..c4fb3d9cc 100644
--- a/src/common/common_funcs.h
+++ b/src/common/common_funcs.h
@@ -5,15 +5,6 @@
5#pragma once 5#pragma once
6 6
7#include "common_types.h" 7#include "common_types.h"
8#include <cstdlib>
9
10
11#define b2(x) ( (x) | ( (x) >> 1) )
12#define b4(x) ( b2(x) | ( b2(x) >> 2) )
13#define b8(x) ( b4(x) | ( b4(x) >> 4) )
14#define b16(x) ( b8(x) | ( b8(x) >> 8) )
15#define b32(x) (b16(x) | (b16(x) >>16) )
16#define ROUND_UP_POW2(x) (b32(x - 1) + 1)
17 8
18#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) 9#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
19 10
@@ -43,8 +34,6 @@
43 34
44#ifndef _MSC_VER 35#ifndef _MSC_VER
45 36
46#include <errno.h>
47
48#if defined(__x86_64__) || defined(_M_X64) 37#if defined(__x86_64__) || defined(_M_X64)
49#define Crash() __asm__ __volatile__("int $3") 38#define Crash() __asm__ __volatile__("int $3")
50#elif defined(_M_ARM) 39#elif defined(_M_ARM)
diff --git a/src/common/common_types.h b/src/common/common_types.h
index c4f1d7ba4..fa3e0b8d6 100644
--- a/src/common/common_types.h
+++ b/src/common/common_types.h
@@ -24,9 +24,7 @@
24 24
25#pragma once 25#pragma once
26 26
27#include <cmath>
28#include <cstdint> 27#include <cstdint>
29#include <cstdlib>
30 28
31#ifdef _MSC_VER 29#ifdef _MSC_VER
32#ifndef __func__ 30#ifndef __func__
diff --git a/src/common/emu_window.cpp b/src/common/emu_window.cpp
index 43facb85c..b69b05cb9 100644
--- a/src/common/emu_window.cpp
+++ b/src/common/emu_window.cpp
@@ -2,6 +2,12 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <algorithm>
6#include <cmath>
7
8#include "common/assert.h"
9#include "common/key_map.h"
10
5#include "emu_window.h" 11#include "emu_window.h"
6#include "video_core/video_core.h" 12#include "video_core/video_core.h"
7 13
diff --git a/src/common/emu_window.h b/src/common/emu_window.h
index 8eca6b5d5..a0ae4c9fa 100644
--- a/src/common/emu_window.h
+++ b/src/common/emu_window.h
@@ -4,11 +4,17 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <tuple>
8#include <utility>
9
7#include "common/common_types.h" 10#include "common/common_types.h"
8#include "common/key_map.h"
9#include "common/math_util.h" 11#include "common/math_util.h"
10#include "common/scm_rev.h" 12
11#include "common/string_util.h" 13#include "core/hle/service/hid/hid.h"
14
15namespace KeyMap {
16struct HostDeviceKey;
17}
12 18
13/** 19/**
14 * Abstraction class used to provide an interface between emulation code and the frontend 20 * Abstraction class used to provide an interface between emulation code and the frontend
diff --git a/src/common/fifo_queue.h b/src/common/fifo_queue.h
deleted file mode 100644
index b426e6596..000000000
--- a/src/common/fifo_queue.h
+++ /dev/null
@@ -1,111 +0,0 @@
1#pragma once
2
3// a simple lockless thread-safe,
4// single reader, single writer queue
5
6#include "common/atomic.h"
7
8namespace Common
9{
10
11template <typename T>
12class FifoQueue
13{
14public:
15 FifoQueue() : m_size(0)
16 {
17 m_write_ptr = m_read_ptr = new ElementPtr();
18 }
19
20 ~FifoQueue()
21 {
22 // this will empty out the whole queue
23 delete m_read_ptr;
24 }
25
26 u32 Size() const
27 {
28 return m_size;
29 }
30
31 bool Empty() const
32 {
33 //return (m_read_ptr == m_write_ptr);
34 return (0 == m_size);
35 }
36
37 T& Front() const
38 {
39 return *m_read_ptr->current;
40 }
41
42 template <typename Arg>
43 void Push(Arg&& t)
44 {
45 // create the element, add it to the queue
46 m_write_ptr->current = new T(std::forward<Arg>(t));
47 // set the next pointer to a new element ptr
48 // then advance the write pointer
49 m_write_ptr = m_write_ptr->next = new ElementPtr();
50 Common::AtomicIncrement(m_size);
51 }
52
53 void Pop()
54 {
55 Common::AtomicDecrement(m_size);
56 ElementPtr *const tmpptr = m_read_ptr;
57 // advance the read pointer
58 m_read_ptr = m_read_ptr->next;
59 // set the next element to NULL to stop the recursive deletion
60 tmpptr->next = nullptr;
61 delete tmpptr; // this also deletes the element
62 }
63
64 bool Pop(T& t)
65 {
66 if (Empty())
67 return false;
68
69 t = std::move(Front());
70 Pop();
71
72 return true;
73 }
74
75 // not thread-safe
76 void Clear()
77 {
78 m_size = 0;
79 delete m_read_ptr;
80 m_write_ptr = m_read_ptr = new ElementPtr();
81 }
82
83private:
84 // stores a pointer to element
85 // and a pointer to the next ElementPtr
86 class ElementPtr
87 {
88 public:
89 ElementPtr() : current(nullptr), next(nullptr) {}
90
91 ~ElementPtr()
92 {
93 if (current)
94 {
95 delete current;
96 // recusion ftw
97 if (next)
98 delete next;
99 }
100 }
101
102 T *volatile current;
103 ElementPtr *volatile next;
104 };
105
106 ElementPtr *volatile m_write_ptr;
107 ElementPtr *volatile m_read_ptr;
108 volatile u32 m_size;
109};
110
111}
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp
index 24648ea33..836b58d52 100644
--- a/src/common/file_util.cpp
+++ b/src/common/file_util.cpp
@@ -17,6 +17,8 @@
17 #include <direct.h> // getcwd 17 #include <direct.h> // getcwd
18 #include <tchar.h> 18 #include <tchar.h>
19 19
20 #include "common/string_util.h"
21
20 // 64 bit offsets for windows 22 // 64 bit offsets for windows
21 #define fseeko _fseeki64 23 #define fseeko _fseeki64
22 #define ftello _ftelli64 24 #define ftello _ftelli64
@@ -25,8 +27,13 @@
25 #define fstat64 _fstat64 27 #define fstat64 _fstat64
26 #define fileno _fileno 28 #define fileno _fileno
27#else 29#else
28 #include <sys/param.h> 30 #ifdef __APPLE__
29 #include <sys/types.h> 31 #include <sys/param.h>
32 #endif
33 #include <cctype>
34 #include <cerrno>
35 #include <cstdlib>
36 #include <cstring>
30 #include <dirent.h> 37 #include <dirent.h>
31 #include <pwd.h> 38 #include <pwd.h>
32 #include <unistd.h> 39 #include <unistd.h>
diff --git a/src/common/file_util.h b/src/common/file_util.h
index b65829291..8fe772aee 100644
--- a/src/common/file_util.h
+++ b/src/common/file_util.h
@@ -6,13 +6,12 @@
6 6
7#include <array> 7#include <array>
8#include <fstream> 8#include <fstream>
9#include <cstddef>
9#include <cstdio> 10#include <cstdio>
10#include <cstring>
11#include <string> 11#include <string>
12#include <vector> 12#include <vector>
13 13
14#include "common/common_types.h" 14#include "common/common_types.h"
15#include "common/string_util.h"
16 15
17// User directory indices for GetUserPath 16// User directory indices for GetUserPath
18enum { 17enum {
diff --git a/src/common/logging/filter.h b/src/common/logging/filter.h
index 0b71ea3b2..a2b4eca43 100644
--- a/src/common/logging/filter.h
+++ b/src/common/logging/filter.h
@@ -5,6 +5,7 @@
5#pragma once 5#pragma once
6 6
7#include <array> 7#include <array>
8#include <cstddef>
8#include <string> 9#include <string>
9 10
10#include "common/logging/log.h" 11#include "common/logging/log.h"
diff --git a/src/common/logging/log.h b/src/common/logging/log.h
index 5b3a731e9..e16dde7fc 100644
--- a/src/common/logging/log.h
+++ b/src/common/logging/log.h
@@ -4,10 +4,6 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <cassert>
8#include <chrono>
9#include <string>
10
11#include "common/common_types.h" 7#include "common/common_types.h"
12 8
13namespace Log { 9namespace Log {
diff --git a/src/common/make_unique.h b/src/common/make_unique.h
index 2a7b76412..f6e7f017c 100644
--- a/src/common/make_unique.h
+++ b/src/common/make_unique.h
@@ -4,6 +4,7 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <algorithm>
7#include <memory> 8#include <memory>
8 9
9namespace Common { 10namespace Common {
diff --git a/src/common/memory_util.cpp b/src/common/memory_util.cpp
index 20b791a10..2b3ace528 100644
--- a/src/common/memory_util.cpp
+++ b/src/common/memory_util.cpp
@@ -3,14 +3,17 @@
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5 5
6#include "common/common_funcs.h"
7#include "common/logging/log.h" 6#include "common/logging/log.h"
8#include "common/memory_util.h" 7#include "common/memory_util.h"
9#include "common/string_util.h"
10 8
11#ifdef _WIN32 9#ifdef _WIN32
12#include <windows.h> 10 #include <windows.h>
13#include <psapi.h> 11 #include <psapi.h>
12 #include "common/common_funcs.h"
13 #include "common/string_util.h"
14#else
15 #include <cstdlib>
16 #include <sys/mman.h>
14#endif 17#endif
15 18
16#if !defined(_WIN32) && defined(__x86_64__) && !defined(MAP_32BIT) 19#if !defined(_WIN32) && defined(__x86_64__) && !defined(MAP_32BIT)
diff --git a/src/common/memory_util.h b/src/common/memory_util.h
index 9fdbf1f12..9bf37c44f 100644
--- a/src/common/memory_util.h
+++ b/src/common/memory_util.h
@@ -4,9 +4,7 @@
4 4
5#pragma once 5#pragma once
6 6
7#ifndef _WIN32 7#include <cstddef>
8#include <sys/mman.h>
9#endif
10#include <string> 8#include <string>
11 9
12void* AllocateExecutableMemory(size_t size, bool low = true); 10void* AllocateExecutableMemory(size_t size, bool low = true);
diff --git a/src/common/misc.cpp b/src/common/misc.cpp
index 53cacf37c..d2a049b63 100644
--- a/src/common/misc.cpp
+++ b/src/common/misc.cpp
@@ -2,12 +2,13 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include "common/common_funcs.h" 5#include <cstddef>
6 6
7#ifdef _WIN32 7#ifdef _WIN32
8#include <windows.h> 8#include <windows.h>
9#else 9#else
10#include <string.h> 10#include <cerrno>
11#include <cstring>
11#endif 12#endif
12 13
13// Neither Android nor OS X support TLS 14// Neither Android nor OS X support TLS
diff --git a/src/common/platform.h b/src/common/platform.h
index df780ac6f..0a912dda3 100644
--- a/src/common/platform.h
+++ b/src/common/platform.h
@@ -24,66 +24,11 @@
24 24
25#pragma once 25#pragma once
26 26
27#include "common/common_types.h"
28
29////////////////////////////////////////////////////////////////////////////////////////////////////
30// Platform definitions
31
32/// Enumeration for defining the supported platforms
33#define PLATFORM_NULL 0
34#define PLATFORM_WINDOWS 1
35#define PLATFORM_MACOSX 2
36#define PLATFORM_LINUX 3
37#define PLATFORM_ANDROID 4
38
39//////////////////////////////////////////////////////////////////////////////////////////////////// 27////////////////////////////////////////////////////////////////////////////////////////////////////
40// Platform detection 28// Platform detection
41 29
42#ifndef EMU_PLATFORM
43
44#if defined( __WIN32__ ) || defined( _WIN32 )
45#define EMU_PLATFORM PLATFORM_WINDOWS
46
47#elif defined( __APPLE__ ) || defined( __APPLE_CC__ )
48#define EMU_PLATFORM PLATFORM_MACOSX
49
50#elif defined(__linux__)
51#define EMU_PLATFORM PLATFORM_LINUX
52
53#else // Assume linux otherwise
54#define EMU_PLATFORM PLATFORM_LINUX
55
56#endif
57
58#endif
59
60#if defined(__x86_64__) || defined(_M_X64) || defined(__aarch64__) 30#if defined(__x86_64__) || defined(_M_X64) || defined(__aarch64__)
61 #define EMU_ARCH_BITS 64 31 #define EMU_ARCH_BITS 64
62#elif defined(__i386) || defined(_M_IX86) || defined(__arm__) || defined(_M_ARM) 32#elif defined(__i386) || defined(_M_IX86) || defined(__arm__) || defined(_M_ARM)
63 #define EMU_ARCH_BITS 32 33 #define EMU_ARCH_BITS 32
64#endif 34#endif
65
66////////////////////////////////////////////////////////////////////////////////////////////////////
67// Feature detection
68
69#if defined _M_GENERIC
70# define _M_SSE 0x0
71#elif defined __GNUC__
72# if defined __SSE4_2__
73# define _M_SSE 0x402
74# elif defined __SSE4_1__
75# define _M_SSE 0x401
76# elif defined __SSSE3__
77# define _M_SSE 0x301
78# elif defined __SSE3__
79# define _M_SSE 0x300
80# endif
81#elif (_MSC_VER >= 1500) || __INTEL_COMPILER // Visual Studio 2008
82# define _M_SSE 0x402
83#endif
84
85////////////////////////////////////////////////////////////////////////////////////////////////////
86// Compiler-Specific Definitions
87
88#define GCC_VERSION_AVAILABLE(major, minor) (defined(__GNUC__) && (__GNUC__ > (major) || \
89 (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor))))
diff --git a/src/common/profiler.cpp b/src/common/profiler.cpp
index cf6b6b258..7792edd2f 100644
--- a/src/common/profiler.cpp
+++ b/src/common/profiler.cpp
@@ -2,13 +2,18 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <algorithm>
6#include <cstddef>
7#include <vector>
8
9#include "common/assert.h"
5#include "common/profiler.h" 10#include "common/profiler.h"
6#include "common/profiler_reporting.h" 11#include "common/profiler_reporting.h"
7#include "common/assert.h" 12#include "common/synchronized_wrapper.h"
8 13
9#if defined(_MSC_VER) && _MSC_VER <= 1800 // MSVC 2013. 14#if defined(_MSC_VER) && _MSC_VER <= 1800 // MSVC 2013.
10#define WIN32_LEAN_AND_MEAN 15 #define WIN32_LEAN_AND_MEAN
11#include <Windows.h> // For QueryPerformanceCounter/Frequency 16 #include <Windows.h> // For QueryPerformanceCounter/Frequency
12#endif 17#endif
13 18
14namespace Common { 19namespace Common {
diff --git a/src/common/profiler_reporting.h b/src/common/profiler_reporting.h
index 3abb73315..df98e05b7 100644
--- a/src/common/profiler_reporting.h
+++ b/src/common/profiler_reporting.h
@@ -4,10 +4,7 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <array> 7#include <cstddef>
8#include <chrono>
9#include <mutex>
10#include <utility>
11#include <vector> 8#include <vector>
12 9
13#include "common/profiler.h" 10#include "common/profiler.h"
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp
index 7dc0ba7ba..2e80809ab 100644
--- a/src/common/string_util.cpp
+++ b/src/common/string_util.cpp
@@ -2,9 +2,13 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <boost/range/algorithm.hpp> 5#include <cctype>
6#include <cerrno>
7#include <cstdio>
8#include <cstdlib>
9#include <cstring>
10#include <boost/range/algorithm/transform.hpp>
6 11
7#include "common/common_funcs.h"
8#include "common/common_paths.h" 12#include "common/common_paths.h"
9#include "common/logging/log.h" 13#include "common/logging/log.h"
10#include "common/string_util.h" 14#include "common/string_util.h"
@@ -12,6 +16,7 @@
12#ifdef _MSC_VER 16#ifdef _MSC_VER
13 #include <Windows.h> 17 #include <Windows.h>
14 #include <codecvt> 18 #include <codecvt>
19 #include "common/common_funcs.h"
15#else 20#else
16 #include <iconv.h> 21 #include <iconv.h>
17#endif 22#endif
diff --git a/src/common/string_util.h b/src/common/string_util.h
index fdc410499..c5c474c6f 100644
--- a/src/common/string_util.h
+++ b/src/common/string_util.h
@@ -5,9 +5,10 @@
5#pragma once 5#pragma once
6 6
7#include <cstdarg> 7#include <cstdarg>
8#include <cstddef>
8#include <iomanip> 9#include <iomanip>
9#include <string>
10#include <sstream> 10#include <sstream>
11#include <string>
11#include <vector> 12#include <vector>
12 13
13#include "common/common_types.h" 14#include "common/common_types.h"
diff --git a/src/common/swap.h b/src/common/swap.h
index 588cebc70..b92e5bfa4 100644
--- a/src/common/swap.h
+++ b/src/common/swap.h
@@ -17,12 +17,16 @@
17 17
18#pragma once 18#pragma once
19 19
20#if defined(__linux__) 20#if defined(_MSC_VER)
21#include <byteswap.h> 21 #include <cstdlib>
22#elif defined(__linux__)
23 #include <byteswap.h>
22#elif defined(__FreeBSD__) 24#elif defined(__FreeBSD__)
23#include <sys/endian.h> 25 #include <sys/endian.h>
24#endif 26#endif
25 27
28#include "common/common_types.h"
29
26// GCC 4.6+ 30// GCC 4.6+
27#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) 31#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
28 32
diff --git a/src/common/synchronized_wrapper.h b/src/common/synchronized_wrapper.h
index 946252b8c..ae5e8b1ed 100644
--- a/src/common/synchronized_wrapper.h
+++ b/src/common/synchronized_wrapper.h
@@ -4,6 +4,7 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <algorithm>
7#include <mutex> 8#include <mutex>
8 9
9namespace Common { 10namespace Common {
diff --git a/src/common/thread.cpp b/src/common/thread.cpp
index 8bf005857..7bbf080bc 100644
--- a/src/common/thread.cpp
+++ b/src/common/thread.cpp
@@ -5,11 +5,20 @@
5#include "common/thread.h" 5#include "common/thread.h"
6 6
7#ifdef __APPLE__ 7#ifdef __APPLE__
8#include <mach/mach.h> 8 #include <mach/mach.h>
9#elif defined(BSD4_4) || defined(__OpenBSD__)
10#include <pthread_np.h>
11#elif defined(_WIN32) 9#elif defined(_WIN32)
12#include <Windows.h> 10 #include <Windows.h>
11#else
12 #if defined(BSD4_4) || defined(__OpenBSD__)
13 #include <pthread_np.h>
14 #else
15 #include <pthread.h>
16 #endif
17 #include <sched.h>
18#endif
19
20#ifndef _WIN32
21 #include <unistd.h>
13#endif 22#endif
14 23
15namespace Common 24namespace Common
diff --git a/src/common/thread.h b/src/common/thread.h
index 7bc419497..8255ee6d3 100644
--- a/src/common/thread.h
+++ b/src/common/thread.h
@@ -4,24 +4,12 @@
4 4
5#pragma once 5#pragma once
6 6
7#include "common/common_types.h" 7#include <cstddef>
8#include <cstdio>
9#include <cstring>
10#include <thread> 8#include <thread>
11#include <condition_variable> 9#include <condition_variable>
12#include <mutex> 10#include <mutex>
13 11
14// This may not be defined outside _WIN32 12#include "common/common_types.h"
15#ifndef _WIN32
16#ifndef INFINITE
17#define INFINITE 0xffffffff
18#endif
19
20//for gettimeofday and struct time(spec|val)
21#include <time.h>
22#include <sys/time.h>
23#include <unistd.h>
24#endif
25 13
26// Support for C++11's thread_local keyword was surprisingly spotty in compilers until very 14// Support for C++11's thread_local keyword was surprisingly spotty in compilers until very
27// recently. Fortunately, thread local variables have been well supported for compilers for a while, 15// recently. Fortunately, thread local variables have been well supported for compilers for a while,
diff --git a/src/common/thunk.h b/src/common/thunk.h
deleted file mode 100644
index 533480056..000000000
--- a/src/common/thunk.h
+++ /dev/null
@@ -1,42 +0,0 @@
1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include <map>
8
9#include "common/common_types.h"
10
11// This simple class creates a wrapper around a C/C++ function that saves all fp state
12// before entering it, and restores it upon exit. This is required to be able to selectively
13// call functions from generated code, without inflicting the performance hit and increase
14// of complexity that it means to protect the generated code from this problem.
15
16// This process is called thunking.
17
18// There will only ever be one level of thunking on the stack, plus,
19// we don't want to pollute the stack, so we store away regs somewhere global.
20// NOT THREAD SAFE. This may only be used from the CPU thread.
21// Any other thread using this stuff will be FATAL.
22
23class ThunkManager : public Gen::XCodeBlock
24{
25 std::map<void *, const u8 *> thunks;
26
27 const u8 *save_regs;
28 const u8 *load_regs;
29
30public:
31 ThunkManager() {
32 Init();
33 }
34 ~ThunkManager() {
35 Shutdown();
36 }
37 void *ProtectFunction(void *function, int num_params);
38private:
39 void Init();
40 void Shutdown();
41 void Reset();
42};
diff --git a/src/core/arm/disassembler/load_symbol_map.cpp b/src/core/arm/disassembler/load_symbol_map.cpp
index 13d26d170..eb20bf6f7 100644
--- a/src/core/arm/disassembler/load_symbol_map.cpp
+++ b/src/core/arm/disassembler/load_symbol_map.cpp
@@ -2,6 +2,7 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <sstream>
5#include <string> 6#include <string>
6#include <vector> 7#include <vector>
7 8
diff --git a/src/core/arm/dyncom/arm_dyncom.h b/src/core/arm/dyncom/arm_dyncom.h
index 2488c879c..cc9355722 100644
--- a/src/core/arm/dyncom/arm_dyncom.h
+++ b/src/core/arm/dyncom/arm_dyncom.h
@@ -10,6 +10,11 @@
10 10
11#include "core/arm/arm_interface.h" 11#include "core/arm/arm_interface.h"
12#include "core/arm/skyeye_common/armdefs.h" 12#include "core/arm/skyeye_common/armdefs.h"
13#include "core/arm/skyeye_common/arm_regformat.h"
14
15namespace Core {
16struct ThreadContext;
17}
13 18
14class ARM_DynCom final : virtual public ARM_Interface { 19class ARM_DynCom final : virtual public ARM_Interface {
15public: 20public:
diff --git a/src/core/arm/skyeye_common/vfp/vfp.cpp b/src/core/arm/skyeye_common/vfp/vfp.cpp
index 592d32a74..1ffc1f9af 100644
--- a/src/core/arm/skyeye_common/vfp/vfp.cpp
+++ b/src/core/arm/skyeye_common/vfp/vfp.cpp
@@ -20,6 +20,7 @@
20 20
21/* Note: this file handles interface with arm core and vfp registers */ 21/* Note: this file handles interface with arm core and vfp registers */
22 22
23#include "common/common_funcs.h"
23#include "common/logging/log.h" 24#include "common/logging/log.h"
24 25
25#include "core/arm/skyeye_common/armdefs.h" 26#include "core/arm/skyeye_common/armdefs.h"
@@ -143,9 +144,8 @@ void vfp_raise_exceptions(ARMul_State* state, u32 exceptions, u32 inst, u32 fpsc
143 LOG_TRACE(Core_ARM11, "VFP: raising exceptions %08x\n", exceptions); 144 LOG_TRACE(Core_ARM11, "VFP: raising exceptions %08x\n", exceptions);
144 145
145 if (exceptions == VFP_EXCEPTION_ERROR) { 146 if (exceptions == VFP_EXCEPTION_ERROR) {
146 LOG_TRACE(Core_ARM11, "unhandled bounce %x\n", inst); 147 LOG_CRITICAL(Core_ARM11, "unhandled bounce %x\n", inst);
147 exit(-1); 148 Crash();
148 return;
149 } 149 }
150 150
151 /* 151 /*
diff --git a/src/core/arm/skyeye_common/vfp/vfpsingle.cpp b/src/core/arm/skyeye_common/vfp/vfpsingle.cpp
index 5a655a6f2..e5d339252 100644
--- a/src/core/arm/skyeye_common/vfp/vfpsingle.cpp
+++ b/src/core/arm/skyeye_common/vfp/vfpsingle.cpp
@@ -53,6 +53,8 @@
53 53
54#include <cinttypes> 54#include <cinttypes>
55 55
56#include "common/common_funcs.h"
57#include "common/common_types.h"
56#include "common/logging/log.h" 58#include "common/logging/log.h"
57 59
58#include "core/arm/skyeye_common/vfp/vfp_helper.h" 60#include "core/arm/skyeye_common/vfp/vfp_helper.h"
@@ -1246,7 +1248,7 @@ u32 vfp_single_cpdo(ARMul_State* state, u32 inst, u32 fpscr)
1246 1248
1247 if (!fop->fn) { 1249 if (!fop->fn) {
1248 LOG_CRITICAL(Core_ARM11, "could not find single op %d, inst=0x%x@0x%x", FEXT_TO_IDX(inst), inst, state->Reg[15]); 1250 LOG_CRITICAL(Core_ARM11, "could not find single op %d, inst=0x%x@0x%x", FEXT_TO_IDX(inst), inst, state->Reg[15]);
1249 exit(-1); 1251 Crash();
1250 goto invalid; 1252 goto invalid;
1251 } 1253 }
1252 1254
diff --git a/src/core/core.cpp b/src/core/core.cpp
index 79038cd52..dddc16708 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -2,15 +2,12 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include "common/common_types.h"
6#include "common/logging/log.h" 5#include "common/logging/log.h"
7 6
8#include "core/core.h" 7#include "core/core.h"
9#include "core/core_timing.h" 8#include "core/core_timing.h"
10 9
11#include "core/settings.h"
12#include "core/arm/arm_interface.h" 10#include "core/arm/arm_interface.h"
13#include "core/arm/disassembler/arm_disasm.h"
14#include "core/arm/dyncom/arm_dyncom.h" 11#include "core/arm/dyncom/arm_dyncom.h"
15#include "core/hle/hle.h" 12#include "core/hle/hle.h"
16#include "core/hle/kernel/thread.h" 13#include "core/hle/kernel/thread.h"
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp
index e53c2e606..72006a53e 100644
--- a/src/core/core_timing.cpp
+++ b/src/core/core_timing.cpp
@@ -3,12 +3,12 @@
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <atomic> 5#include <atomic>
6#include <cstdio>
7#include <mutex> 6#include <mutex>
8#include <vector> 7#include <vector>
9 8
10#include "common/assert.h"
11#include "common/chunk_file.h" 9#include "common/chunk_file.h"
10#include "common/logging/log.h"
11#include "common/string_util.h"
12 12
13#include "core/arm/arm_interface.h" 13#include "core/arm/arm_interface.h"
14#include "core/core.h" 14#include "core/core.h"
diff --git a/src/core/file_sys/archive_backend.cpp b/src/core/file_sys/archive_backend.cpp
index 45a559ce8..3f81447df 100644
--- a/src/core/file_sys/archive_backend.cpp
+++ b/src/core/file_sys/archive_backend.cpp
@@ -2,6 +2,8 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <cstddef>
6#include <iomanip>
5#include <sstream> 7#include <sstream>
6 8
7#include "common/logging/log.h" 9#include "common/logging/log.h"
diff --git a/src/core/file_sys/archive_extsavedata.cpp b/src/core/file_sys/archive_extsavedata.cpp
index e50c58a52..92dad8e6f 100644
--- a/src/core/file_sys/archive_extsavedata.cpp
+++ b/src/core/file_sys/archive_extsavedata.cpp
@@ -2,17 +2,18 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <sys/stat.h> 5#include <algorithm>
6#include <vector>
6 7
7#include "common/common_types.h" 8#include "common/common_types.h"
8#include "common/file_util.h" 9#include "common/file_util.h"
9#include "common/logging/log.h" 10#include "common/logging/log.h"
10#include "common/make_unique.h" 11#include "common/make_unique.h"
12#include "common/string_util.h"
11 13
12#include "core/file_sys/archive_extsavedata.h" 14#include "core/file_sys/archive_extsavedata.h"
13#include "core/file_sys/disk_archive.h" 15#include "core/file_sys/disk_archive.h"
14#include "core/hle/service/fs/archive.h" 16#include "core/hle/service/fs/archive.h"
15#include "core/settings.h"
16 17
17//////////////////////////////////////////////////////////////////////////////////////////////////// 18////////////////////////////////////////////////////////////////////////////////////////////////////
18// FileSys namespace 19// FileSys namespace
diff --git a/src/core/file_sys/archive_extsavedata.h b/src/core/file_sys/archive_extsavedata.h
index ef0b27bde..ec8d770fc 100644
--- a/src/core/file_sys/archive_extsavedata.h
+++ b/src/core/file_sys/archive_extsavedata.h
@@ -4,10 +4,13 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <memory>
8#include <string>
9
7#include "common/common_types.h" 10#include "common/common_types.h"
8 11
9#include "core/file_sys/disk_archive.h" 12#include "core/file_sys/archive_backend.h"
10#include "core/loader/loader.h" 13#include "core/hle/result.h"
11 14
12//////////////////////////////////////////////////////////////////////////////////////////////////// 15////////////////////////////////////////////////////////////////////////////////////////////////////
13// FileSys namespace 16// FileSys namespace
diff --git a/src/core/file_sys/archive_romfs.cpp b/src/core/file_sys/archive_romfs.cpp
index d4a12ed10..c1e45dfeb 100644
--- a/src/core/file_sys/archive_romfs.cpp
+++ b/src/core/file_sys/archive_romfs.cpp
@@ -2,14 +2,15 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <algorithm>
5#include <memory> 6#include <memory>
6 7
7#include "common/common_types.h" 8#include "common/common_types.h"
8#include "common/file_util.h"
9#include "common/logging/log.h" 9#include "common/logging/log.h"
10#include "common/make_unique.h" 10#include "common/make_unique.h"
11 11
12#include "core/file_sys/archive_romfs.h" 12#include "core/file_sys/archive_romfs.h"
13#include "core/file_sys/ivfc_archive.h"
13 14
14//////////////////////////////////////////////////////////////////////////////////////////////////// 15////////////////////////////////////////////////////////////////////////////////////////////////////
15// FileSys namespace 16// FileSys namespace
diff --git a/src/core/file_sys/archive_romfs.h b/src/core/file_sys/archive_romfs.h
index 409bc670a..c69ff91c3 100644
--- a/src/core/file_sys/archive_romfs.h
+++ b/src/core/file_sys/archive_romfs.h
@@ -5,11 +5,13 @@
5#pragma once 5#pragma once
6 6
7#include <memory> 7#include <memory>
8#include <string>
8#include <vector> 9#include <vector>
9 10
10#include "common/common_types.h" 11#include "common/common_types.h"
11 12
12#include "core/file_sys/ivfc_archive.h" 13#include "core/file_sys/archive_backend.h"
14#include "core/hle/result.h"
13#include "core/loader/loader.h" 15#include "core/loader/loader.h"
14 16
15//////////////////////////////////////////////////////////////////////////////////////////////////// 17////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/file_sys/archive_savedata.cpp b/src/core/file_sys/archive_savedata.cpp
index a92309377..98823aec3 100644
--- a/src/core/file_sys/archive_savedata.cpp
+++ b/src/core/file_sys/archive_savedata.cpp
@@ -2,18 +2,18 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <sys/stat.h> 5#include <algorithm>
6 6
7#include "common/common_types.h" 7#include "common/common_types.h"
8#include "common/file_util.h" 8#include "common/file_util.h"
9#include "common/logging/log.h" 9#include "common/logging/log.h"
10#include "common/make_unique.h" 10#include "common/make_unique.h"
11#include "common/string_util.h"
11 12
12#include "core/file_sys/archive_savedata.h" 13#include "core/file_sys/archive_savedata.h"
13#include "core/file_sys/disk_archive.h" 14#include "core/file_sys/disk_archive.h"
14#include "core/hle/kernel/process.h" 15#include "core/hle/kernel/process.h"
15#include "core/hle/service/fs/archive.h" 16#include "core/hle/service/fs/archive.h"
16#include "core/settings.h"
17 17
18//////////////////////////////////////////////////////////////////////////////////////////////////// 18////////////////////////////////////////////////////////////////////////////////////////////////////
19// FileSys namespace 19// FileSys namespace
diff --git a/src/core/file_sys/archive_savedata.h b/src/core/file_sys/archive_savedata.h
index db17afc92..1f65297dd 100644
--- a/src/core/file_sys/archive_savedata.h
+++ b/src/core/file_sys/archive_savedata.h
@@ -4,10 +4,11 @@
4 4
5#pragma once 5#pragma once
6 6
7#include "common/common_types.h" 7#include <memory>
8#include <string>
8 9
9#include "core/file_sys/disk_archive.h" 10#include "core/file_sys/archive_backend.h"
10#include "core/loader/loader.h" 11#include "core/hle/result.h"
11 12
12//////////////////////////////////////////////////////////////////////////////////////////////////// 13////////////////////////////////////////////////////////////////////////////////////////////////////
13// FileSys namespace 14// FileSys namespace
diff --git a/src/core/file_sys/archive_savedatacheck.cpp b/src/core/file_sys/archive_savedatacheck.cpp
index e7e4fbf1d..dec838cae 100644
--- a/src/core/file_sys/archive_savedatacheck.cpp
+++ b/src/core/file_sys/archive_savedatacheck.cpp
@@ -2,11 +2,17 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <algorithm>
6#include <vector>
7
8#include "common/common_types.h"
5#include "common/file_util.h" 9#include "common/file_util.h"
6#include "common/logging/log.h" 10#include "common/logging/log.h"
7#include "common/make_unique.h" 11#include "common/make_unique.h"
12#include "common/string_util.h"
8 13
9#include "core/file_sys/archive_savedatacheck.h" 14#include "core/file_sys/archive_savedatacheck.h"
15#include "core/file_sys/ivfc_archive.h"
10#include "core/hle/service/fs/archive.h" 16#include "core/hle/service/fs/archive.h"
11 17
12//////////////////////////////////////////////////////////////////////////////////////////////////// 18////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/file_sys/archive_savedatacheck.h b/src/core/file_sys/archive_savedatacheck.h
index f78a6f02e..b14aefe8b 100644
--- a/src/core/file_sys/archive_savedatacheck.h
+++ b/src/core/file_sys/archive_savedatacheck.h
@@ -4,12 +4,11 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <vector> 7#include <memory>
8#include <string>
8 9
9#include "common/common_types.h" 10#include "core/file_sys/archive_backend.h"
10 11#include "core/hle/result.h"
11#include "core/file_sys/ivfc_archive.h"
12#include "core/loader/loader.h"
13 12
14//////////////////////////////////////////////////////////////////////////////////////////////////// 13////////////////////////////////////////////////////////////////////////////////////////////////////
15// FileSys namespace 14// FileSys namespace
diff --git a/src/core/file_sys/archive_sdmc.cpp b/src/core/file_sys/archive_sdmc.cpp
index c1234a186..5c825f429 100644
--- a/src/core/file_sys/archive_sdmc.cpp
+++ b/src/core/file_sys/archive_sdmc.cpp
@@ -2,9 +2,8 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <sys/stat.h> 5#include <algorithm>
6 6
7#include "common/common_types.h"
8#include "common/file_util.h" 7#include "common/file_util.h"
9#include "common/logging/log.h" 8#include "common/logging/log.h"
10#include "common/make_unique.h" 9#include "common/make_unique.h"
diff --git a/src/core/file_sys/archive_sdmc.h b/src/core/file_sys/archive_sdmc.h
index 1becf6c0f..10b273bdb 100644
--- a/src/core/file_sys/archive_sdmc.h
+++ b/src/core/file_sys/archive_sdmc.h
@@ -4,10 +4,11 @@
4 4
5#pragma once 5#pragma once
6 6
7#include "common/common_types.h" 7#include <memory>
8#include <string>
8 9
9#include "core/file_sys/disk_archive.h" 10#include "core/file_sys/archive_backend.h"
10#include "core/loader/loader.h" 11#include "core/hle/result.h"
11 12
12//////////////////////////////////////////////////////////////////////////////////////////////////// 13////////////////////////////////////////////////////////////////////////////////////////////////////
13// FileSys namespace 14// FileSys namespace
diff --git a/src/core/file_sys/archive_systemsavedata.cpp b/src/core/file_sys/archive_systemsavedata.cpp
index 4fe785c97..896f89529 100644
--- a/src/core/file_sys/archive_systemsavedata.cpp
+++ b/src/core/file_sys/archive_systemsavedata.cpp
@@ -2,15 +2,17 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <sys/stat.h> 5#include <algorithm>
6#include <vector>
6 7
7#include "common/common_types.h" 8#include "common/common_types.h"
8#include "common/file_util.h" 9#include "common/file_util.h"
9#include "common/make_unique.h" 10#include "common/make_unique.h"
11#include "common/string_util.h"
10 12
11#include "core/file_sys/archive_systemsavedata.h" 13#include "core/file_sys/archive_systemsavedata.h"
14#include "core/file_sys/disk_archive.h"
12#include "core/hle/service/fs/archive.h" 15#include "core/hle/service/fs/archive.h"
13#include "core/settings.h"
14 16
15//////////////////////////////////////////////////////////////////////////////////////////////////// 17////////////////////////////////////////////////////////////////////////////////////////////////////
16// FileSys namespace 18// FileSys namespace
diff --git a/src/core/file_sys/archive_systemsavedata.h b/src/core/file_sys/archive_systemsavedata.h
index 3431fed88..afc689848 100644
--- a/src/core/file_sys/archive_systemsavedata.h
+++ b/src/core/file_sys/archive_systemsavedata.h
@@ -4,10 +4,13 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <memory>
8#include <string>
9
7#include "common/common_types.h" 10#include "common/common_types.h"
8 11
9#include "core/file_sys/disk_archive.h" 12#include "core/file_sys/archive_backend.h"
10#include "core/loader/loader.h" 13#include "core/hle/result.h"
11 14
12//////////////////////////////////////////////////////////////////////////////////////////////////// 15////////////////////////////////////////////////////////////////////////////////////////////////////
13// FileSys namespace 16// FileSys namespace
diff --git a/src/core/file_sys/disk_archive.cpp b/src/core/file_sys/disk_archive.cpp
index 9980cced1..85151a311 100644
--- a/src/core/file_sys/disk_archive.cpp
+++ b/src/core/file_sys/disk_archive.cpp
@@ -2,7 +2,8 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <sys/stat.h> 5#include <algorithm>
6#include <cstdio>
6 7
7#include "common/common_types.h" 8#include "common/common_types.h"
8#include "common/file_util.h" 9#include "common/file_util.h"
@@ -10,7 +11,6 @@
10#include "common/make_unique.h" 11#include "common/make_unique.h"
11 12
12#include "core/file_sys/disk_archive.h" 13#include "core/file_sys/disk_archive.h"
13#include "core/settings.h"
14 14
15//////////////////////////////////////////////////////////////////////////////////////////////////// 15////////////////////////////////////////////////////////////////////////////////////////////////////
16// FileSys namespace 16// FileSys namespace
diff --git a/src/core/file_sys/disk_archive.h b/src/core/file_sys/disk_archive.h
index a22d3837a..5cfcddf6c 100644
--- a/src/core/file_sys/disk_archive.h
+++ b/src/core/file_sys/disk_archive.h
@@ -4,13 +4,18 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <cstddef>
8#include <memory>
9#include <string>
10#include <vector>
11
7#include "common/common_types.h" 12#include "common/common_types.h"
8#include "common/file_util.h" 13#include "common/file_util.h"
9 14
10#include "core/file_sys/archive_backend.h" 15#include "core/file_sys/archive_backend.h"
11#include "core/file_sys/directory_backend.h" 16#include "core/file_sys/directory_backend.h"
12#include "core/file_sys/file_backend.h" 17#include "core/file_sys/file_backend.h"
13#include "core/loader/loader.h" 18#include "core/hle/result.h"
14 19
15//////////////////////////////////////////////////////////////////////////////////////////////////// 20////////////////////////////////////////////////////////////////////////////////////////////////////
16// FileSys namespace 21// FileSys namespace
diff --git a/src/core/file_sys/file_backend.h b/src/core/file_sys/file_backend.h
index 0fcff1845..f5f72c722 100644
--- a/src/core/file_sys/file_backend.h
+++ b/src/core/file_sys/file_backend.h
@@ -4,6 +4,8 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <cstddef>
8
7#include "common/common_types.h" 9#include "common/common_types.h"
8 10
9//////////////////////////////////////////////////////////////////////////////////////////////////// 11////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/file_sys/ivfc_archive.cpp b/src/core/file_sys/ivfc_archive.cpp
index 2d2509d16..c88b39bcd 100644
--- a/src/core/file_sys/ivfc_archive.cpp
+++ b/src/core/file_sys/ivfc_archive.cpp
@@ -2,10 +2,10 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <cstring>
5#include <memory> 6#include <memory>
6 7
7#include "common/common_types.h" 8#include "common/common_types.h"
8#include "common/file_util.h"
9#include "common/logging/log.h" 9#include "common/logging/log.h"
10#include "common/make_unique.h" 10#include "common/make_unique.h"
11 11
diff --git a/src/core/file_sys/ivfc_archive.h b/src/core/file_sys/ivfc_archive.h
index 10415798d..1850b3b17 100644
--- a/src/core/file_sys/ivfc_archive.h
+++ b/src/core/file_sys/ivfc_archive.h
@@ -4,7 +4,9 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <cstddef>
7#include <memory> 8#include <memory>
9#include <string>
8#include <vector> 10#include <vector>
9 11
10#include "common/common_types.h" 12#include "common/common_types.h"
@@ -12,7 +14,7 @@
12#include "core/file_sys/archive_backend.h" 14#include "core/file_sys/archive_backend.h"
13#include "core/file_sys/directory_backend.h" 15#include "core/file_sys/directory_backend.h"
14#include "core/file_sys/file_backend.h" 16#include "core/file_sys/file_backend.h"
15#include "core/loader/loader.h" 17#include "core/hle/result.h"
16 18
17//////////////////////////////////////////////////////////////////////////////////////////////////// 19////////////////////////////////////////////////////////////////////////////////////////////////////
18// FileSys namespace 20// FileSys namespace
diff --git a/src/core/hle/hle.cpp b/src/core/hle/hle.cpp
index fdeb9a028..cd0a400dc 100644
--- a/src/core/hle/hle.cpp
+++ b/src/core/hle/hle.cpp
@@ -10,7 +10,6 @@
10#include "core/hle/hle.h" 10#include "core/hle/hle.h"
11#include "core/hle/config_mem.h" 11#include "core/hle/config_mem.h"
12#include "core/hle/shared_page.h" 12#include "core/hle/shared_page.h"
13#include "core/hle/kernel/thread.h"
14#include "core/hle/service/service.h" 13#include "core/hle/service/service.h"
15 14
16//////////////////////////////////////////////////////////////////////////////////////////////////// 15////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index 20e11da16..5711c0405 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -7,8 +7,6 @@
7#include "common/assert.h" 7#include "common/assert.h"
8#include "common/logging/log.h" 8#include "common/logging/log.h"
9 9
10#include "core/arm/arm_interface.h"
11#include "core/core.h"
12#include "core/hle/kernel/kernel.h" 10#include "core/hle/kernel/kernel.h"
13#include "core/hle/kernel/resource_limit.h" 11#include "core/hle/kernel/resource_limit.h"
14#include "core/hle/kernel/process.h" 12#include "core/hle/kernel/process.h"
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h
index 64595f758..b29260b5d 100644
--- a/src/core/hle/kernel/kernel.h
+++ b/src/core/hle/kernel/kernel.h
@@ -4,10 +4,11 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <boost/intrusive_ptr.hpp> 7#include <boost/smart_ptr/intrusive_ptr.hpp>
8 8
9#include <algorithm>
9#include <array> 10#include <array>
10#include <memory> 11#include <cstddef>
11#include <string> 12#include <string>
12#include <vector> 13#include <vector>
13 14
@@ -16,8 +17,6 @@
16#include "core/hle/hle.h" 17#include "core/hle/hle.h"
17#include "core/hle/result.h" 18#include "core/hle/result.h"
18 19
19struct ApplicationInfo;
20
21namespace Kernel { 20namespace Kernel {
22 21
23class Thread; 22class Thread;
diff --git a/src/core/hle/kernel/process.h b/src/core/hle/kernel/process.h
index 7b8a68610..674f5093a 100644
--- a/src/core/hle/kernel/process.h
+++ b/src/core/hle/kernel/process.h
@@ -5,6 +5,8 @@
5#pragma once 5#pragma once
6 6
7#include <bitset> 7#include <bitset>
8#include <cstddef>
9#include <string>
8 10
9#include <boost/container/static_vector.hpp> 11#include <boost/container/static_vector.hpp>
10 12
@@ -12,7 +14,6 @@
12#include "common/common_types.h" 14#include "common/common_types.h"
13 15
14#include "core/hle/kernel/kernel.h" 16#include "core/hle/kernel/kernel.h"
15#include "core/hle/result.h"
16 17
17namespace Kernel { 18namespace Kernel {
18 19
diff --git a/src/core/hle/kernel/session.h b/src/core/hle/kernel/session.h
index 257da9105..adaffcafe 100644
--- a/src/core/hle/kernel/session.h
+++ b/src/core/hle/kernel/session.h
@@ -4,8 +4,14 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <string>
8
9#include "common/assert.h"
10#include "common/common_types.h"
11
7#include "core/hle/kernel/kernel.h" 12#include "core/hle/kernel/kernel.h"
8#include "core/hle/kernel/thread.h" 13#include "core/hle/kernel/thread.h"
14#include "core/hle/result.h"
9#include "core/memory.h" 15#include "core/memory.h"
10 16
11namespace IPC { 17namespace IPC {
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h
index b8160bb2c..1ff1d9b97 100644
--- a/src/core/hle/kernel/thread.h
+++ b/src/core/hle/kernel/thread.h
@@ -13,6 +13,7 @@
13 13
14#include "core/core.h" 14#include "core/core.h"
15 15
16#include "core/hle/hle.h"
16#include "core/hle/kernel/kernel.h" 17#include "core/hle/kernel/kernel.h"
17#include "core/hle/result.h" 18#include "core/hle/result.h"
18 19
diff --git a/src/core/hle/kernel/vm_manager.cpp b/src/core/hle/kernel/vm_manager.cpp
index b2dd21542..ec437cd61 100644
--- a/src/core/hle/kernel/vm_manager.cpp
+++ b/src/core/hle/kernel/vm_manager.cpp
@@ -2,6 +2,8 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <iterator>
6
5#include "common/assert.h" 7#include "common/assert.h"
6 8
7#include "core/hle/kernel/vm_manager.h" 9#include "core/hle/kernel/vm_manager.h"
diff --git a/src/core/hle/kernel/vm_manager.h b/src/core/hle/kernel/vm_manager.h
index 22b724603..271e2333e 100644
--- a/src/core/hle/kernel/vm_manager.h
+++ b/src/core/hle/kernel/vm_manager.h
@@ -6,7 +6,6 @@
6 6
7#include <map> 7#include <map>
8#include <memory> 8#include <memory>
9#include <string>
10#include <vector> 9#include <vector>
11 10
12#include "common/common_types.h" 11#include "common/common_types.h"
diff --git a/src/core/hle/result.h b/src/core/hle/result.h
index ce633d841..cb2d681e0 100644
--- a/src/core/hle/result.h
+++ b/src/core/hle/result.h
@@ -4,7 +4,7 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <cstddef> 7#include <new>
8#include <type_traits> 8#include <type_traits>
9#include <utility> 9#include <utility>
10 10
diff --git a/src/core/hle/service/dsp_dsp.h b/src/core/hle/service/dsp_dsp.h
index fa13bfb7c..54109b2a9 100644
--- a/src/core/hle/service/dsp_dsp.h
+++ b/src/core/hle/service/dsp_dsp.h
@@ -4,6 +4,8 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <string>
8
7#include "core/hle/service/service.h" 9#include "core/hle/service/service.h"
8 10
9//////////////////////////////////////////////////////////////////////////////////////////////////// 11////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp
index 4e275cb13..ba272f05f 100644
--- a/src/core/hle/service/fs/archive.cpp
+++ b/src/core/hle/service/fs/archive.cpp
@@ -2,29 +2,35 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <cstddef>
6#include <system_error>
7#include <type_traits>
5#include <memory> 8#include <memory>
6#include <unordered_map> 9#include <unordered_map>
10#include <utility>
7 11
8#include <boost/container/flat_map.hpp> 12#include <boost/container/flat_map.hpp>
9 13
14#include "common/assert.h"
10#include "common/common_types.h" 15#include "common/common_types.h"
11#include "common/file_util.h" 16#include "common/file_util.h"
12#include "common/logging/log.h" 17#include "common/logging/log.h"
13#include "common/make_unique.h" 18#include "common/make_unique.h"
14#include "common/math_util.h"
15 19
16#include "core/file_sys/archive_backend.h" 20#include "core/file_sys/archive_backend.h"
17#include "core/file_sys/archive_extsavedata.h" 21#include "core/file_sys/archive_extsavedata.h"
18#include "core/file_sys/archive_romfs.h"
19#include "core/file_sys/archive_savedata.h" 22#include "core/file_sys/archive_savedata.h"
20#include "core/file_sys/archive_savedatacheck.h" 23#include "core/file_sys/archive_savedatacheck.h"
21#include "core/file_sys/archive_sdmc.h" 24#include "core/file_sys/archive_sdmc.h"
22#include "core/file_sys/archive_systemsavedata.h" 25#include "core/file_sys/archive_systemsavedata.h"
23#include "core/file_sys/directory_backend.h" 26#include "core/file_sys/directory_backend.h"
27#include "core/file_sys/file_backend.h"
28#include "core/hle/hle.h"
24#include "core/hle/service/service.h" 29#include "core/hle/service/service.h"
25#include "core/hle/service/fs/archive.h" 30#include "core/hle/service/fs/archive.h"
26#include "core/hle/service/fs/fs_user.h" 31#include "core/hle/service/fs/fs_user.h"
27#include "core/hle/result.h" 32#include "core/hle/result.h"
33#include "core/memory.h"
28 34
29// Specializes std::hash for ArchiveIdCode, so that we can use it in std::unordered_map. 35// Specializes std::hash for ArchiveIdCode, so that we can use it in std::unordered_map.
30// Workaroung for libstdc++ bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60970 36// Workaroung for libstdc++ bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60970
diff --git a/src/core/hle/service/fs/archive.h b/src/core/hle/service/fs/archive.h
index 357b6b096..f61125953 100644
--- a/src/core/hle/service/fs/archive.h
+++ b/src/core/hle/service/fs/archive.h
@@ -4,22 +4,25 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <memory>
8#include <string>
9
7#include "common/common_types.h" 10#include "common/common_types.h"
8 11
9#include "core/file_sys/archive_backend.h" 12#include "core/file_sys/archive_backend.h"
10#include "core/hle/kernel/kernel.h"
11#include "core/hle/kernel/session.h" 13#include "core/hle/kernel/session.h"
12#include "core/hle/result.h" 14#include "core/hle/result.h"
13 15
16namespace FileSys {
17class DirectoryBackend;
18class FileBackend;
19}
20
14/// The unique system identifier hash, also known as ID0 21/// The unique system identifier hash, also known as ID0
15extern const std::string SYSTEM_ID; 22extern const std::string SYSTEM_ID;
16/// The scrambled SD card CID, also known as ID1 23/// The scrambled SD card CID, also known as ID1
17extern const std::string SDCARD_ID; 24extern const std::string SDCARD_ID;
18 25
19namespace Kernel {
20 class Session;
21}
22
23namespace Service { 26namespace Service {
24namespace FS { 27namespace FS {
25 28
diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp
index 4b0b4229d..f56bbe50f 100644
--- a/src/core/hle/service/gsp_gpu.cpp
+++ b/src/core/hle/service/gsp_gpu.cpp
@@ -9,14 +9,16 @@
9#include "core/hle/kernel/event.h" 9#include "core/hle/kernel/event.h"
10#include "core/hle/kernel/shared_memory.h" 10#include "core/hle/kernel/shared_memory.h"
11#include "core/hle/result.h" 11#include "core/hle/result.h"
12#include "gsp_gpu.h"
13#include "core/hw/hw.h" 12#include "core/hw/hw.h"
14#include "core/hw/gpu.h" 13#include "core/hw/gpu.h"
15#include "core/hw/lcd.h" 14#include "core/hw/lcd.h"
16 15
17#include "video_core/gpu_debugger.h" 16#include "video_core/gpu_debugger.h"
17#include "video_core/renderer_base.h"
18#include "video_core/video_core.h" 18#include "video_core/video_core.h"
19 19
20#include "gsp_gpu.h"
21
20// Main graphics debugger object - TODO: Here is probably not the best place for this 22// Main graphics debugger object - TODO: Here is probably not the best place for this
21GraphicsDebugger g_debugger; 23GraphicsDebugger g_debugger;
22 24
diff --git a/src/core/hle/service/gsp_gpu.h b/src/core/hle/service/gsp_gpu.h
index a435d418a..d9e9a1a60 100644
--- a/src/core/hle/service/gsp_gpu.h
+++ b/src/core/hle/service/gsp_gpu.h
@@ -5,8 +5,11 @@
5#pragma once 5#pragma once
6 6
7#include <cstddef> 7#include <cstddef>
8#include <string>
8 9
9#include "common/bit_field.h" 10#include "common/bit_field.h"
11#include "common/common_types.h"
12
10#include "core/hle/service/service.h" 13#include "core/hle/service/service.h"
11 14
12//////////////////////////////////////////////////////////////////////////////////////////////////// 15////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index c7c1bb5ab..70caa7d80 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -3,6 +3,7 @@
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include "common/logging/log.h" 5#include "common/logging/log.h"
6#include "common/emu_window.h"
6 7
7#include "core/hle/service/service.h" 8#include "core/hle/service/service.h"
8#include "core/hle/service/hid/hid.h" 9#include "core/hle/service/hid/hid.h"
diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h
index 68e2bcee0..d50d479f8 100644
--- a/src/core/hle/service/hid/hid.h
+++ b/src/core/hle/service/hid/hid.h
@@ -6,16 +6,18 @@
6 6
7#include <array> 7#include <array>
8 8
9#include "core/hle/kernel/kernel.h" 9#ifndef _MSC_VER
10#include "core/hle/service/service.h" 10#include <cstddef>
11#include "common/bit_field.h" 11#endif
12 12
13namespace Kernel { 13#include "common/bit_field.h"
14 class SharedMemory; 14#include "common/common_funcs.h"
15 class Event; 15#include "common/common_types.h"
16}
17 16
18namespace Service { 17namespace Service {
18
19class Interface;
20
19namespace HID { 21namespace HID {
20 22
21/** 23/**
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h
index 77bfb9ff1..f31135212 100644
--- a/src/core/hle/service/service.h
+++ b/src/core/hle/service/service.h
@@ -4,6 +4,7 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <cstddef>
7#include <string> 8#include <string>
8#include <unordered_map> 9#include <unordered_map>
9 10
@@ -11,8 +12,8 @@
11 12
12#include "common/common_types.h" 13#include "common/common_types.h"
13 14
14#include "core/hle/kernel/kernel.h"
15#include "core/hle/kernel/session.h" 15#include "core/hle/kernel/session.h"
16#include "core/hle/result.h"
16 17
17//////////////////////////////////////////////////////////////////////////////////////////////////// 18////////////////////////////////////////////////////////////////////////////////////////////////////
18// Namespace Service 19// Namespace Service
diff --git a/src/core/hle/service/soc_u.cpp b/src/core/hle/service/soc_u.cpp
index 1bd420552..d0e166fdf 100644
--- a/src/core/hle/service/soc_u.cpp
+++ b/src/core/hle/service/soc_u.cpp
@@ -2,40 +2,47 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <algorithm>
6#include <cstring>
7#include <unordered_map>
8
9#include "common/assert.h"
10#include "common/bit_field.h"
11#include "common/common_types.h"
5#include "common/logging/log.h" 12#include "common/logging/log.h"
6#include "common/platform.h" 13#include "common/scope_exit.h"
7
8#if EMU_PLATFORM == PLATFORM_WINDOWS
9#include <winsock2.h>
10#include <ws2tcpip.h>
11
12// MinGW does not define several errno constants
13#ifndef _MSC_VER
14#define EBADMSG 104
15#define ENODATA 120
16#define ENOMSG 122
17#define ENOSR 124
18#define ENOSTR 125
19#define ETIME 137
20#define EIDRM 2001
21#define ENOLINK 2002
22#endif // _MSC_VER
23 14
15#include "core/hle/kernel/session.h"
16#include "core/hle/result.h"
17#include "core/hle/service/soc_u.h"
18#include "core/memory.h"
19
20#ifdef _WIN32
21 #include <winsock2.h>
22 #include <ws2tcpip.h>
23
24 // MinGW does not define several errno constants
25 #ifndef _MSC_VER
26 #define EBADMSG 104
27 #define ENODATA 120
28 #define ENOMSG 122
29 #define ENOSR 124
30 #define ENOSTR 125
31 #define ETIME 137
32 #define EIDRM 2001
33 #define ENOLINK 2002
34 #endif // _MSC_VER
24#else 35#else
25#include <sys/socket.h> 36 #include <cerrno>
26#include <netinet/in.h> 37 #include <fcntl.h>
27#include <netdb.h> 38 #include <netinet/in.h>
28#include <arpa/inet.h> 39 #include <netdb.h>
29#include <fcntl.h> 40 #include <poll.h>
30#include <poll.h> 41 #include <sys/socket.h>
42 #include <unistd.h>
31#endif 43#endif
32 44
33#include "common/scope_exit.h" 45#ifdef _WIN32
34#include "core/hle/hle.h"
35#include "core/hle/service/soc_u.h"
36#include <unordered_map>
37
38#if EMU_PLATFORM == PLATFORM_WINDOWS
39# define WSAEAGAIN WSAEWOULDBLOCK 46# define WSAEAGAIN WSAEWOULDBLOCK
40# define WSAEMULTIHOP -1 // Invalid dummy value 47# define WSAEMULTIHOP -1 // Invalid dummy value
41# define ERRNO(x) WSA##x 48# define ERRNO(x) WSA##x
@@ -371,7 +378,7 @@ static void Fcntl(Service::Interface* self) {
371 }); 378 });
372 379
373 if (ctr_cmd == 3) { // F_GETFL 380 if (ctr_cmd == 3) { // F_GETFL
374#if EMU_PLATFORM == PLATFORM_WINDOWS 381#ifdef _WIN32
375 posix_ret = 0; 382 posix_ret = 0;
376 auto iter = open_sockets.find(socket_handle); 383 auto iter = open_sockets.find(socket_handle);
377 if (iter != open_sockets.end() && iter->second.blocking == false) 384 if (iter != open_sockets.end() && iter->second.blocking == false)
@@ -388,7 +395,7 @@ static void Fcntl(Service::Interface* self) {
388 posix_ret |= 4; // O_NONBLOCK 395 posix_ret |= 4; // O_NONBLOCK
389#endif 396#endif
390 } else if (ctr_cmd == 4) { // F_SETFL 397 } else if (ctr_cmd == 4) { // F_SETFL
391#if EMU_PLATFORM == PLATFORM_WINDOWS 398#ifdef _WIN32
392 unsigned long tmp = (ctr_arg & 4 /* O_NONBLOCK */) ? 1 : 0; 399 unsigned long tmp = (ctr_arg & 4 /* O_NONBLOCK */) ? 1 : 0;
393 int ret = ioctlsocket(socket_handle, FIONBIO, &tmp); 400 int ret = ioctlsocket(socket_handle, FIONBIO, &tmp);
394 if (ret == SOCKET_ERROR_VALUE) { 401 if (ret == SOCKET_ERROR_VALUE) {
@@ -682,7 +689,7 @@ static void Connect(Service::Interface* self) {
682 689
683static void InitializeSockets(Service::Interface* self) { 690static void InitializeSockets(Service::Interface* self) {
684 // TODO(Subv): Implement 691 // TODO(Subv): Implement
685#if EMU_PLATFORM == PLATFORM_WINDOWS 692#ifdef _WIN32
686 WSADATA data; 693 WSADATA data;
687 WSAStartup(MAKEWORD(2, 2), &data); 694 WSAStartup(MAKEWORD(2, 2), &data);
688#endif 695#endif
@@ -696,7 +703,7 @@ static void ShutdownSockets(Service::Interface* self) {
696 // TODO(Subv): Implement 703 // TODO(Subv): Implement
697 CleanupSockets(); 704 CleanupSockets();
698 705
699#if EMU_PLATFORM == PLATFORM_WINDOWS 706#ifdef _WIN32
700 WSACleanup(); 707 WSACleanup();
701#endif 708#endif
702 709
@@ -747,7 +754,7 @@ Interface::Interface() {
747 754
748Interface::~Interface() { 755Interface::~Interface() {
749 CleanupSockets(); 756 CleanupSockets();
750#if EMU_PLATFORM == PLATFORM_WINDOWS 757#ifdef _WIN32
751 WSACleanup(); 758 WSACleanup();
752#endif 759#endif
753} 760}
diff --git a/src/core/hle/service/soc_u.h b/src/core/hle/service/soc_u.h
index 483b3111b..a091f597c 100644
--- a/src/core/hle/service/soc_u.h
+++ b/src/core/hle/service/soc_u.h
@@ -4,6 +4,8 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <string>
8
7#include "core/hle/service/service.h" 9#include "core/hle/service/service.h"
8 10
9//////////////////////////////////////////////////////////////////////////////////////////////////// 11////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/hle/service/y2r_u.cpp b/src/core/hle/service/y2r_u.cpp
index ac1967da8..e121a54e3 100644
--- a/src/core/hle/service/y2r_u.cpp
+++ b/src/core/hle/service/y2r_u.cpp
@@ -12,6 +12,7 @@
12#include "core/hw/y2r.h" 12#include "core/hw/y2r.h"
13#include "core/mem_map.h" 13#include "core/mem_map.h"
14 14
15#include "video_core/renderer_base.h"
15#include "video_core/utils.h" 16#include "video_core/utils.h"
16#include "video_core/video_core.h" 17#include "video_core/video_core.h"
17 18
diff --git a/src/core/hle/service/y2r_u.h b/src/core/hle/service/y2r_u.h
index 7df47fcb9..9454e5aab 100644
--- a/src/core/hle/service/y2r_u.h
+++ b/src/core/hle/service/y2r_u.h
@@ -5,9 +5,11 @@
5#pragma once 5#pragma once
6 6
7#include <array> 7#include <array>
8#include <string>
8 9
9#include "common/common_types.h" 10#include "common/common_types.h"
10 11
12#include "core/hle/result.h"
11#include "core/hle/service/service.h" 13#include "core/hle/service/service.h"
12 14
13//////////////////////////////////////////////////////////////////////////////////////////////////// 15////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/hle/shared_page.cpp b/src/core/hle/shared_page.cpp
index 4014eee98..26d87c7e2 100644
--- a/src/core/hle/shared_page.cpp
+++ b/src/core/hle/shared_page.cpp
@@ -4,12 +4,6 @@
4 4
5#include <cstring> 5#include <cstring>
6 6
7#include "common/common_types.h"
8#include "common/common_funcs.h"
9
10#include "core/core.h"
11#include "core/memory.h"
12#include "core/hle/config_mem.h"
13#include "core/hle/shared_page.h" 7#include "core/hle/shared_page.h"
14 8
15//////////////////////////////////////////////////////////////////////////////////////////////////// 9////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/hle/shared_page.h b/src/core/hle/shared_page.h
index fd2ab66a2..db6a5340b 100644
--- a/src/core/hle/shared_page.h
+++ b/src/core/hle/shared_page.h
@@ -10,9 +10,12 @@
10 * write access, according to 3dbrew; this is not emulated) 10 * write access, according to 3dbrew; this is not emulated)
11 */ 11 */
12 12
13#include "common/common_funcs.h"
13#include "common/common_types.h" 14#include "common/common_types.h"
14#include "common/swap.h" 15#include "common/swap.h"
15 16
17#include "core/memory.h"
18
16//////////////////////////////////////////////////////////////////////////////////////////////////// 19////////////////////////////////////////////////////////////////////////////////////////////////////
17 20
18namespace SharedPage { 21namespace SharedPage {
diff --git a/src/core/hw/gpu.cpp b/src/core/hw/gpu.cpp
index dd3b31650..a1789f9c7 100644
--- a/src/core/hw/gpu.cpp
+++ b/src/core/hw/gpu.cpp
@@ -2,17 +2,18 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <cstring>
6#include <type_traits>
7
5#include "common/color.h" 8#include "common/color.h"
6#include "common/common_types.h" 9#include "common/common_types.h"
7 10#include "common/logging/log.h"
8#include "core/arm/arm_interface.h" 11#include "common/vector_math.h"
9 12
10#include "core/settings.h" 13#include "core/settings.h"
11#include "core/core.h"
12#include "core/memory.h" 14#include "core/memory.h"
13#include "core/core_timing.h" 15#include "core/core_timing.h"
14 16
15#include "core/hle/hle.h"
16#include "core/hle/service/gsp_gpu.h" 17#include "core/hle/service/gsp_gpu.h"
17#include "core/hle/service/dsp_dsp.h" 18#include "core/hle/service/dsp_dsp.h"
18#include "core/hle/service/hid/hid.h" 19#include "core/hle/service/hid/hid.h"
@@ -21,6 +22,8 @@
21#include "core/hw/gpu.h" 22#include "core/hw/gpu.h"
22 23
23#include "video_core/command_processor.h" 24#include "video_core/command_processor.h"
25#include "video_core/hwrasterizer_base.h"
26#include "video_core/renderer_base.h"
24#include "video_core/utils.h" 27#include "video_core/utils.h"
25#include "video_core/video_core.h" 28#include "video_core/video_core.h"
26 29
diff --git a/src/core/hw/gpu.h b/src/core/hw/gpu.h
index 699bcd2a5..5b8c43f8b 100644
--- a/src/core/hw/gpu.h
+++ b/src/core/hw/gpu.h
@@ -5,6 +5,7 @@
5#pragma once 5#pragma once
6 6
7#include <cstddef> 7#include <cstddef>
8#include <type_traits>
8 9
9#include "common/assert.h" 10#include "common/assert.h"
10#include "common/bit_field.h" 11#include "common/bit_field.h"
diff --git a/src/core/hw/lcd.cpp b/src/core/hw/lcd.cpp
index 963c8d981..cdb757a18 100644
--- a/src/core/hw/lcd.cpp
+++ b/src/core/hw/lcd.cpp
@@ -7,8 +7,6 @@
7#include "common/common_types.h" 7#include "common/common_types.h"
8#include "common/logging/log.h" 8#include "common/logging/log.h"
9 9
10#include "core/arm/arm_interface.h"
11#include "core/hle/hle.h"
12#include "core/hw/hw.h" 10#include "core/hw/hw.h"
13#include "core/hw/lcd.h" 11#include "core/hw/lcd.h"
14 12
diff --git a/src/core/hw/lcd.h b/src/core/hw/lcd.h
index 8631eb201..bcce6d8cf 100644
--- a/src/core/hw/lcd.h
+++ b/src/core/hw/lcd.h
@@ -5,6 +5,7 @@
5#pragma once 5#pragma once
6 6
7#include <cstddef> 7#include <cstddef>
8#include <type_traits>
8 9
9#include "common/bit_field.h" 10#include "common/bit_field.h"
10#include "common/common_funcs.h" 11#include "common/common_funcs.h"
diff --git a/src/core/hw/y2r.cpp b/src/core/hw/y2r.cpp
index 5b7fb39e1..b40f13cae 100644
--- a/src/core/hw/y2r.cpp
+++ b/src/core/hw/y2r.cpp
@@ -2,8 +2,10 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <algorithm>
5#include <array> 6#include <array>
6#include <numeric> 7#include <cstddef>
8#include <memory>
7 9
8#include "common/assert.h" 10#include "common/assert.h"
9#include "common/color.h" 11#include "common/color.h"
diff --git a/src/core/loader/elf.cpp b/src/core/loader/elf.cpp
index f00753a79..a7eea78aa 100644
--- a/src/core/loader/elf.cpp
+++ b/src/core/loader/elf.cpp
@@ -2,6 +2,7 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <cstring>
5#include <string> 6#include <string>
6#include <memory> 7#include <memory>
7 8
@@ -10,7 +11,7 @@
10#include "common/logging/log.h" 11#include "common/logging/log.h"
11#include "common/symbols.h" 12#include "common/symbols.h"
12 13
13#include "core/hle/kernel/kernel.h" 14#include "core/hle/kernel/process.h"
14#include "core/hle/kernel/resource_limit.h" 15#include "core/hle/kernel/resource_limit.h"
15#include "core/loader/elf.h" 16#include "core/loader/elf.h"
16#include "core/memory.h" 17#include "core/memory.h"
diff --git a/src/core/loader/loader.cpp b/src/core/loader/loader.cpp
index 8b14edf00..2e450fce4 100644
--- a/src/core/loader/loader.cpp
+++ b/src/core/loader/loader.cpp
@@ -2,10 +2,12 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <memory>
5#include <string> 6#include <string>
6 7
7#include "common/logging/log.h" 8#include "common/logging/log.h"
8#include "common/make_unique.h" 9#include "common/make_unique.h"
10#include "common/string_util.h"
9 11
10#include "core/file_sys/archive_romfs.h" 12#include "core/file_sys/archive_romfs.h"
11#include "core/hle/kernel/process.h" 13#include "core/hle/kernel/process.h"
diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h
index 87e16fb98..52bbf35b8 100644
--- a/src/core/loader/loader.h
+++ b/src/core/loader/loader.h
@@ -4,12 +4,18 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <algorithm>
8#include <initializer_list>
9#include <memory>
10#include <string>
7#include <vector> 11#include <vector>
8 12
9#include "common/common_types.h" 13#include "common/common_types.h"
10#include "common/file_util.h" 14#include "common/file_util.h"
11 15
12#include "core/hle/kernel/process.h" 16namespace Kernel {
17struct AddressMapping;
18}
13 19
14//////////////////////////////////////////////////////////////////////////////////////////////////// 20////////////////////////////////////////////////////////////////////////////////////////////////////
15// Loader namespace 21// Loader namespace
diff --git a/src/core/loader/ncch.cpp b/src/core/loader/ncch.cpp
index 6a9d866ae..2b26b31cf 100644
--- a/src/core/loader/ncch.cpp
+++ b/src/core/loader/ncch.cpp
@@ -3,6 +3,7 @@
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 <cstring>
6#include <memory> 7#include <memory>
7 8
8#include "common/logging/log.h" 9#include "common/logging/log.h"
@@ -10,7 +11,7 @@
10#include "common/string_util.h" 11#include "common/string_util.h"
11#include "common/swap.h" 12#include "common/swap.h"
12 13
13#include "core/hle/kernel/kernel.h" 14#include "core/hle/kernel/process.h"
14#include "core/hle/kernel/resource_limit.h" 15#include "core/hle/kernel/resource_limit.h"
15#include "core/loader/ncch.h" 16#include "core/loader/ncch.h"
16#include "core/memory.h" 17#include "core/memory.h"
diff --git a/src/core/mem_map.cpp b/src/core/mem_map.cpp
index bf814b945..d8cae50dd 100644
--- a/src/core/mem_map.cpp
+++ b/src/core/mem_map.cpp
@@ -3,13 +3,14 @@
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 <memory>
7#include <utility>
8#include <vector>
6 9
7#include "common/common_types.h" 10#include "common/common_types.h"
8#include "common/logging/log.h" 11#include "common/logging/log.h"
9 12
10#include "core/hle/config_mem.h" 13#include "core/hle/config_mem.h"
11#include "core/hle/kernel/kernel.h"
12#include "core/hle/kernel/shared_memory.h"
13#include "core/hle/kernel/vm_manager.h" 14#include "core/hle/kernel/vm_manager.h"
14#include "core/hle/result.h" 15#include "core/hle/result.h"
15#include "core/hle/shared_page.h" 16#include "core/hle/shared_page.h"
diff --git a/src/core/memory.cpp b/src/core/memory.cpp
index 28844a915..172ae9054 100644
--- a/src/core/memory.cpp
+++ b/src/core/memory.cpp
@@ -9,9 +9,6 @@
9#include "common/logging/log.h" 9#include "common/logging/log.h"
10#include "common/swap.h" 10#include "common/swap.h"
11 11
12#include "core/hle/config_mem.h"
13#include "core/hle/shared_page.h"
14#include "core/hw/hw.h"
15#include "core/mem_map.h" 12#include "core/mem_map.h"
16#include "core/memory.h" 13#include "core/memory.h"
17#include "core/memory_setup.h" 14#include "core/memory_setup.h"
diff --git a/src/core/memory.h b/src/core/memory.h
index 0b8ff9ec4..418609de0 100644
--- a/src/core/memory.h
+++ b/src/core/memory.h
@@ -4,6 +4,8 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <cstddef>
8
7#include "common/common_types.h" 9#include "common/common_types.h"
8 10
9namespace Memory { 11namespace Memory {
diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp
index b46fadd9f..110caec76 100644
--- a/src/video_core/command_processor.cpp
+++ b/src/video_core/command_processor.cpp
@@ -6,18 +6,20 @@
6 6
7#include "common/profiler.h" 7#include "common/profiler.h"
8 8
9#include "core/hle/service/gsp_gpu.h"
10#include "core/hw/gpu.h"
11#include "core/settings.h"
12
13#include "debug_utils/debug_utils.h"
14
9#include "clipper.h" 15#include "clipper.h"
10#include "command_processor.h" 16#include "command_processor.h"
11#include "math.h" 17#include "math.h"
12#include "pica.h" 18#include "pica.h"
13#include "primitive_assembly.h" 19#include "primitive_assembly.h"
20#include "renderer_base.h"
14#include "vertex_shader.h" 21#include "vertex_shader.h"
15#include "video_core.h" 22#include "video_core.h"
16#include "core/hle/service/gsp_gpu.h"
17#include "core/hw/gpu.h"
18#include "core/settings.h"
19
20#include "debug_utils/debug_utils.h"
21 23
22namespace Pica { 24namespace Pica {
23 25
diff --git a/src/video_core/command_processor.h b/src/video_core/command_processor.h
index bb3d4150f..022a71f5e 100644
--- a/src/video_core/command_processor.h
+++ b/src/video_core/command_processor.h
@@ -4,11 +4,11 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <type_traits>
8
7#include "common/bit_field.h" 9#include "common/bit_field.h"
8#include "common/common_types.h" 10#include "common/common_types.h"
9 11
10#include "pica.h"
11
12namespace Pica { 12namespace Pica {
13 13
14namespace CommandProcessor { 14namespace CommandProcessor {
diff --git a/src/video_core/debug_utils/debug_utils.cpp b/src/video_core/debug_utils/debug_utils.cpp
index 7b8ab72b6..d24c0f11e 100644
--- a/src/video_core/debug_utils/debug_utils.cpp
+++ b/src/video_core/debug_utils/debug_utils.cpp
@@ -23,6 +23,7 @@
23#include "common/vector_math.h" 23#include "common/vector_math.h"
24 24
25#include "video_core/pica.h" 25#include "video_core/pica.h"
26#include "video_core/renderer_base.h"
26#include "video_core/utils.h" 27#include "video_core/utils.h"
27#include "video_core/video_core.h" 28#include "video_core/video_core.h"
28 29
diff --git a/src/video_core/hwrasterizer_base.h b/src/video_core/hwrasterizer_base.h
index dec193f8b..c8746c608 100644
--- a/src/video_core/hwrasterizer_base.h
+++ b/src/video_core/hwrasterizer_base.h
@@ -4,8 +4,13 @@
4 4
5#pragma once 5#pragma once
6 6
7#include "common/emu_window.h" 7#include "common/common_types.h"
8#include "video_core/vertex_shader.h" 8
9namespace Pica {
10namespace VertexShader {
11struct OutputVertex;
12}
13}
9 14
10class HWRasterizer { 15class HWRasterizer {
11public: 16public:
diff --git a/src/video_core/pica.h b/src/video_core/pica.h
index 9628a7589..feb20214a 100644
--- a/src/video_core/pica.h
+++ b/src/video_core/pica.h
@@ -5,10 +5,10 @@
5#pragma once 5#pragma once
6 6
7#include <array> 7#include <array>
8#include <cmath>
8#include <cstddef> 9#include <cstddef>
9#include <initializer_list>
10#include <map> 10#include <map>
11#include <vector> 11#include <string>
12 12
13#include "common/assert.h" 13#include "common/assert.h"
14#include "common/bit_field.h" 14#include "common/bit_field.h"
@@ -114,11 +114,17 @@ struct Regs {
114 struct TextureConfig { 114 struct TextureConfig {
115 enum WrapMode : u32 { 115 enum WrapMode : u32 {
116 ClampToEdge = 0, 116 ClampToEdge = 0,
117 ClampToBorder = 1,
117 Repeat = 2, 118 Repeat = 2,
118 MirroredRepeat = 3, 119 MirroredRepeat = 3,
119 }; 120 };
120 121
121 INSERT_PADDING_WORDS(0x1); 122 union {
123 BitField< 0, 8, u32> r;
124 BitField< 8, 8, u32> g;
125 BitField<16, 8, u32> b;
126 BitField<24, 8, u32> a;
127 } border_color;
122 128
123 union { 129 union {
124 BitField< 0, 16, u32> height; 130 BitField< 0, 16, u32> height;
@@ -1014,7 +1020,7 @@ struct float24 {
1014 u32 mantissa = hex & 0xFFFF; 1020 u32 mantissa = hex & 0xFFFF;
1015 u32 exponent = (hex >> 16) & 0x7F; 1021 u32 exponent = (hex >> 16) & 0x7F;
1016 u32 sign = hex >> 23; 1022 u32 sign = hex >> 23;
1017 ret.value = powf(2.0f, (float)exponent-63.0f) * (1.0f + mantissa * powf(2.0f, -16.f)); 1023 ret.value = std::pow(2.0f, (float)exponent-63.0f) * (1.0f + mantissa * std::pow(2.0f, -16.f));
1018 if (sign) 1024 if (sign)
1019 ret.value = -ret.value; 1025 ret.value = -ret.value;
1020 } 1026 }
diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp
index 59d156ee7..70b115744 100644
--- a/src/video_core/rasterizer.cpp
+++ b/src/video_core/rasterizer.cpp
@@ -349,6 +349,9 @@ static void ProcessTriangleInternal(const VertexShader::OutputVertex& v0,
349 val = std::min(val, (int)size - 1); 349 val = std::min(val, (int)size - 1);
350 return val; 350 return val;
351 351
352 case Regs::TextureConfig::ClampToBorder:
353 return val;
354
352 case Regs::TextureConfig::Repeat: 355 case Regs::TextureConfig::Repeat:
353 return (int)((unsigned)val % size); 356 return (int)((unsigned)val % size);
354 357
@@ -367,17 +370,23 @@ static void ProcessTriangleInternal(const VertexShader::OutputVertex& v0,
367 } 370 }
368 }; 371 };
369 372
370 // Textures are laid out from bottom to top, hence we invert the t coordinate. 373 if ((texture.config.wrap_s == Regs::TextureConfig::ClampToBorder && (s < 0 || s >= texture.config.width))
371 // NOTE: This may not be the right place for the inversion. 374 || (texture.config.wrap_t == Regs::TextureConfig::ClampToBorder && (t < 0 || t >= texture.config.height))) {
372 // TODO: Check if this applies to ETC textures, too. 375 auto border_color = texture.config.border_color;
373 s = GetWrappedTexCoord(texture.config.wrap_s, s, texture.config.width); 376 texture_color[i] = { border_color.r, border_color.g, border_color.b, border_color.a };
374 t = texture.config.height - 1 - GetWrappedTexCoord(texture.config.wrap_t, t, texture.config.height); 377 } else {
375 378 // Textures are laid out from bottom to top, hence we invert the t coordinate.
376 u8* texture_data = Memory::GetPhysicalPointer(texture.config.GetPhysicalAddress()); 379 // NOTE: This may not be the right place for the inversion.
377 auto info = DebugUtils::TextureInfo::FromPicaRegister(texture.config, texture.format); 380 // TODO: Check if this applies to ETC textures, too.
378 381 s = GetWrappedTexCoord(texture.config.wrap_s, s, texture.config.width);
379 texture_color[i] = DebugUtils::LookupTexture(texture_data, s, t, info); 382 t = texture.config.height - 1 - GetWrappedTexCoord(texture.config.wrap_t, t, texture.config.height);
380 DebugUtils::DumpTexture(texture.config, texture_data); 383
384 u8* texture_data = Memory::GetPhysicalPointer(texture.config.GetPhysicalAddress());
385 auto info = DebugUtils::TextureInfo::FromPicaRegister(texture.config, texture.format);
386
387 texture_color[i] = DebugUtils::LookupTexture(texture_data, s, t, info);
388 DebugUtils::DumpTexture(texture.config, texture_data);
389 }
381 } 390 }
382 391
383 // Texture environment - consists of 6 stages of color and alpha combining. 392 // Texture environment - consists of 6 stages of color and alpha combining.
diff --git a/src/video_core/renderer_base.h b/src/video_core/renderer_base.h
index 5757ac75d..6587bcf27 100644
--- a/src/video_core/renderer_base.h
+++ b/src/video_core/renderer_base.h
@@ -4,10 +4,14 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <memory>
8
7#include "common/common_types.h" 9#include "common/common_types.h"
8 10
9#include "video_core/hwrasterizer_base.h" 11#include "video_core/hwrasterizer_base.h"
10 12
13class EmuWindow;
14
11class RendererBase : NonCopyable { 15class RendererBase : NonCopyable {
12public: 16public:
13 17
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 518f79331..935a9f281 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -2,10 +2,15 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <cstring>
6#include <memory>
7
5#include "common/color.h" 8#include "common/color.h"
9#include "common/math_util.h"
6 10
7#include "core/settings.h"
8#include "core/hw/gpu.h" 11#include "core/hw/gpu.h"
12#include "core/memory.h"
13#include "core/settings.h"
9 14
10#include "video_core/pica.h" 15#include "video_core/pica.h"
11#include "video_core/utils.h" 16#include "video_core/utils.h"
@@ -16,8 +21,6 @@
16 21
17#include "generated/gl_3_2_core.h" 22#include "generated/gl_3_2_core.h"
18 23
19#include <memory>
20
21static bool IsPassThroughTevStage(const Pica::Regs::TevStageConfig& stage) { 24static bool IsPassThroughTevStage(const Pica::Regs::TevStageConfig& stage) {
22 return (stage.color_op == Pica::Regs::TevStageConfig::Operation::Replace && 25 return (stage.color_op == Pica::Regs::TevStageConfig::Operation::Replace &&
23 stage.alpha_op == Pica::Regs::TevStageConfig::Operation::Replace && 26 stage.alpha_op == Pica::Regs::TevStageConfig::Operation::Replace &&
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h
index d7d422b1f..ae7b26fc6 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer.h
@@ -4,7 +4,12 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <vector>
8
9#include "common/common_types.h"
10
7#include "video_core/hwrasterizer_base.h" 11#include "video_core/hwrasterizer_base.h"
12#include "video_core/vertex_shader.h"
8 13
9#include "gl_state.h" 14#include "gl_state.h"
10#include "gl_rasterizer_cache.h" 15#include "gl_rasterizer_cache.h"
diff --git a/src/video_core/renderer_opengl/pica_to_gl.h b/src/video_core/renderer_opengl/pica_to_gl.h
index e566f9f7a..73f63c55d 100644
--- a/src/video_core/renderer_opengl/pica_to_gl.h
+++ b/src/video_core/renderer_opengl/pica_to_gl.h
@@ -15,7 +15,7 @@ namespace PicaToGL {
15inline GLenum WrapMode(Pica::Regs::TextureConfig::WrapMode mode) { 15inline GLenum WrapMode(Pica::Regs::TextureConfig::WrapMode mode) {
16 static const GLenum wrap_mode_table[] = { 16 static const GLenum wrap_mode_table[] = {
17 GL_CLAMP_TO_EDGE, // WrapMode::ClampToEdge 17 GL_CLAMP_TO_EDGE, // WrapMode::ClampToEdge
18 0, // Unknown 18 GL_CLAMP_TO_BORDER,// WrapMode::ClampToBorder
19 GL_REPEAT, // WrapMode::Repeat 19 GL_REPEAT, // WrapMode::Repeat
20 GL_MIRRORED_REPEAT // WrapMode::MirroredRepeat 20 GL_MIRRORED_REPEAT // WrapMode::MirroredRepeat
21 }; 21 };
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp
index 3399ca123..9799f74fa 100644
--- a/src/video_core/renderer_opengl/renderer_opengl.cpp
+++ b/src/video_core/renderer_opengl/renderer_opengl.cpp
@@ -2,23 +2,26 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <algorithm>
6#include <cstddef>
7#include <cstdlib>
8
9#include "common/assert.h"
10#include "common/emu_window.h"
11#include "common/logging/log.h"
12#include "common/profiler_reporting.h"
13
5#include "core/hw/gpu.h" 14#include "core/hw/gpu.h"
6#include "core/hw/hw.h" 15#include "core/hw/hw.h"
7#include "core/hw/lcd.h" 16#include "core/hw/lcd.h"
8#include "core/memory.h" 17#include "core/memory.h"
9#include "core/settings.h" 18#include "core/settings.h"
10 19
11#include "common/emu_window.h"
12#include "common/logging/log.h"
13#include "common/profiler_reporting.h"
14
15#include "video_core/video_core.h" 20#include "video_core/video_core.h"
16#include "video_core/renderer_opengl/renderer_opengl.h" 21#include "video_core/renderer_opengl/renderer_opengl.h"
17#include "video_core/renderer_opengl/gl_shader_util.h" 22#include "video_core/renderer_opengl/gl_shader_util.h"
18#include "video_core/renderer_opengl/gl_shaders.h" 23#include "video_core/renderer_opengl/gl_shaders.h"
19 24
20#include <algorithm>
21
22/** 25/**
23 * Vertex structure that the drawn screen rectangles are composed of. 26 * Vertex structure that the drawn screen rectangles are composed of.
24 */ 27 */
diff --git a/src/video_core/vertex_shader.h b/src/video_core/vertex_shader.h
index 7471a6de8..c997e6a77 100644
--- a/src/video_core/vertex_shader.h
+++ b/src/video_core/vertex_shader.h
@@ -4,11 +4,10 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <initializer_list> 7#include <type_traits>
8 8
9#include <common/common_types.h> 9#include "common/vector_math.h"
10 10
11#include "math.h"
12#include "pica.h" 11#include "pica.h"
13 12
14namespace Pica { 13namespace Pica {
diff --git a/src/video_core/video_core.h b/src/video_core/video_core.h
index 3f24df7bd..14b33c9dd 100644
--- a/src/video_core/video_core.h
+++ b/src/video_core/video_core.h
@@ -4,12 +4,11 @@
4 4
5#pragma once 5#pragma once
6 6
7#include "common/emu_window.h"
8
9#include "renderer_base.h"
10
11#include <atomic> 7#include <atomic>
12 8
9class EmuWindow;
10class RendererBase;
11
13//////////////////////////////////////////////////////////////////////////////////////////////////// 12////////////////////////////////////////////////////////////////////////////////////////////////////
14// Video Core namespace 13// Video Core namespace
15 14