summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/audio_core/CMakeLists.txt7
-rw-r--r--src/citra/CMakeLists.txt8
-rw-r--r--src/citra/citra.cpp1
-rw-r--r--src/citra/config.cpp4
-rw-r--r--src/citra/config.h4
-rw-r--r--src/citra/emu_window/emu_window_sdl2.cpp14
-rw-r--r--src/citra_qt/CMakeLists.txt6
-rw-r--r--src/citra_qt/bootmanager.cpp6
-rw-r--r--src/citra_qt/main.cpp1
-rw-r--r--src/common/CMakeLists.txt4
-rw-r--r--src/common/common_funcs.h2
-rw-r--r--src/common/hash.cpp6
-rw-r--r--src/common/x64/cpu_detect.cpp2
-rw-r--r--src/core/3ds.h21
-rw-r--r--src/core/CMakeLists.txt7
-rw-r--r--src/core/frontend/emu_window.cpp8
-rw-r--r--src/core/frontend/emu_window.h2
-rw-r--r--src/core/frontend/framebuffer_layout.cpp (renamed from src/common/framebuffer_layout.cpp)20
-rw-r--r--src/core/frontend/framebuffer_layout.h (renamed from src/common/framebuffer_layout.h)11
-rw-r--r--src/core/hle/applets/mii_selector.cpp1
-rw-r--r--src/core/hle/applets/swkbd.cpp1
-rw-r--r--src/core/hle/service/gsp_gpu.cpp2
-rw-r--r--src/core/settings.cpp2
-rw-r--r--src/core/tracer/recorder.cpp2
-rw-r--r--src/core/tracer/recorder.h2
-rw-r--r--src/input_common/CMakeLists.txt6
-rw-r--r--src/tests/CMakeLists.txt5
-rw-r--r--src/video_core/CMakeLists.txt12
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp20
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.cpp10
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.h3
-rw-r--r--src/video_core/video_core.h15
32 files changed, 111 insertions, 104 deletions
diff --git a/src/audio_core/CMakeLists.txt b/src/audio_core/CMakeLists.txt
index a72a907ef..c571213fc 100644
--- a/src/audio_core/CMakeLists.txt
+++ b/src/audio_core/CMakeLists.txt
@@ -38,9 +38,10 @@ endif()
38create_directory_groups(${SRCS} ${HEADERS}) 38create_directory_groups(${SRCS} ${HEADERS})
39 39
40add_library(audio_core STATIC ${SRCS} ${HEADERS}) 40add_library(audio_core STATIC ${SRCS} ${HEADERS})
41target_link_libraries(audio_core SoundTouch) 41target_link_libraries(audio_core PUBLIC common core)
42target_link_libraries(audio_core PRIVATE SoundTouch)
42 43
43if(SDL2_FOUND) 44if(SDL2_FOUND)
44 target_link_libraries(audio_core ${SDL2_LIBRARY}) 45 target_link_libraries(audio_core PRIVATE ${SDL2_LIBRARY})
45 set_property(TARGET audio_core APPEND PROPERTY COMPILE_DEFINITIONS HAVE_SDL2) 46 target_compile_definitions(audio_core PRIVATE HAVE_SDL2)
46endif() 47endif()
diff --git a/src/citra/CMakeLists.txt b/src/citra/CMakeLists.txt
index 47231ba71..9eddb342b 100644
--- a/src/citra/CMakeLists.txt
+++ b/src/citra/CMakeLists.txt
@@ -18,12 +18,12 @@ create_directory_groups(${SRCS} ${HEADERS})
18include_directories(${SDL2_INCLUDE_DIR}) 18include_directories(${SDL2_INCLUDE_DIR})
19 19
20add_executable(citra ${SRCS} ${HEADERS}) 20add_executable(citra ${SRCS} ${HEADERS})
21target_link_libraries(citra core video_core audio_core common input_common) 21target_link_libraries(citra PRIVATE common core input_common)
22target_link_libraries(citra ${SDL2_LIBRARY} ${OPENGL_gl_LIBRARY} inih glad) 22target_link_libraries(citra PRIVATE ${SDL2_LIBRARY} ${OPENGL_gl_LIBRARY} inih glad)
23if (MSVC) 23if (MSVC)
24 target_link_libraries(citra getopt) 24 target_link_libraries(citra PRIVATE getopt)
25endif() 25endif()
26target_link_libraries(citra ${PLATFORM_LIBRARIES} Threads::Threads) 26target_link_libraries(citra PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
27 27
28if(UNIX AND NOT APPLE) 28if(UNIX AND NOT APPLE)
29 install(TARGETS citra RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") 29 install(TARGETS citra RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp
index 76f5caeb1..c0dac9e8f 100644
--- a/src/citra/citra.cpp
+++ b/src/citra/citra.cpp
@@ -33,7 +33,6 @@
33#include "core/gdbstub/gdbstub.h" 33#include "core/gdbstub/gdbstub.h"
34#include "core/loader/loader.h" 34#include "core/loader/loader.h"
35#include "core/settings.h" 35#include "core/settings.h"
36#include "video_core/video_core.h"
37 36
38static void PrintHelp(const char* argv0) { 37static void PrintHelp(const char* argv0) {
39 std::cout << "Usage: " << argv0 38 std::cout << "Usage: " << argv0
diff --git a/src/citra/config.cpp b/src/citra/config.cpp
index a4162e9ad..f08b4069c 100644
--- a/src/citra/config.cpp
+++ b/src/citra/config.cpp
@@ -5,11 +5,11 @@
5#include <memory> 5#include <memory>
6#include <SDL.h> 6#include <SDL.h>
7#include <inih/cpp/INIReader.h> 7#include <inih/cpp/INIReader.h>
8#include "citra/config.h"
8#include "citra/default_ini.h" 9#include "citra/default_ini.h"
9#include "common/file_util.h" 10#include "common/file_util.h"
10#include "common/logging/log.h" 11#include "common/logging/log.h"
11#include "common/param_package.h" 12#include "common/param_package.h"
12#include "config.h"
13#include "core/settings.h" 13#include "core/settings.h"
14#include "input_common/main.h" 14#include "input_common/main.h"
15 15
@@ -21,6 +21,8 @@ Config::Config() {
21 Reload(); 21 Reload();
22} 22}
23 23
24Config::~Config() = default;
25
24bool Config::LoadINI(const std::string& default_contents, bool retry) { 26bool Config::LoadINI(const std::string& default_contents, bool retry) {
25 const char* location = this->sdl2_config_loc.c_str(); 27 const char* location = this->sdl2_config_loc.c_str();
26 if (sdl2_config->ParseError() < 0) { 28 if (sdl2_config->ParseError() < 0) {
diff --git a/src/citra/config.h b/src/citra/config.h
index b1c31f59c..abc90f642 100644
--- a/src/citra/config.h
+++ b/src/citra/config.h
@@ -6,7 +6,8 @@
6 6
7#include <memory> 7#include <memory>
8#include <string> 8#include <string>
9#include <inih/cpp/INIReader.h> 9
10class INIReader;
10 11
11class Config { 12class Config {
12 std::unique_ptr<INIReader> sdl2_config; 13 std::unique_ptr<INIReader> sdl2_config;
@@ -17,6 +18,7 @@ class Config {
17 18
18public: 19public:
19 Config(); 20 Config();
21 ~Config();
20 22
21 void Reload(); 23 void Reload();
22}; 24};
diff --git a/src/citra/emu_window/emu_window_sdl2.cpp b/src/citra/emu_window/emu_window_sdl2.cpp
index 6bc0b0d00..47aadd60c 100644
--- a/src/citra/emu_window/emu_window_sdl2.cpp
+++ b/src/citra/emu_window/emu_window_sdl2.cpp
@@ -12,10 +12,10 @@
12#include "common/logging/log.h" 12#include "common/logging/log.h"
13#include "common/scm_rev.h" 13#include "common/scm_rev.h"
14#include "common/string_util.h" 14#include "common/string_util.h"
15#include "core/3ds.h"
15#include "core/settings.h" 16#include "core/settings.h"
16#include "input_common/keyboard.h" 17#include "input_common/keyboard.h"
17#include "input_common/main.h" 18#include "input_common/main.h"
18#include "video_core/video_core.h"
19 19
20void EmuWindow_SDL2::OnMouseMotion(s32 x, s32 y) { 20void EmuWindow_SDL2::OnMouseMotion(s32 x, s32 y) {
21 TouchMoved((unsigned)std::max(x, 0), (unsigned)std::max(y, 0)); 21 TouchMoved((unsigned)std::max(x, 0), (unsigned)std::max(y, 0));
@@ -80,12 +80,12 @@ EmuWindow_SDL2::EmuWindow_SDL2() {
80 80
81 std::string window_title = Common::StringFromFormat("Citra %s| %s-%s ", Common::g_build_name, 81 std::string window_title = Common::StringFromFormat("Citra %s| %s-%s ", Common::g_build_name,
82 Common::g_scm_branch, Common::g_scm_desc); 82 Common::g_scm_branch, Common::g_scm_desc);
83 render_window = SDL_CreateWindow( 83 render_window =
84 window_title.c_str(), 84 SDL_CreateWindow(window_title.c_str(),
85 SDL_WINDOWPOS_UNDEFINED, // x position 85 SDL_WINDOWPOS_UNDEFINED, // x position
86 SDL_WINDOWPOS_UNDEFINED, // y position 86 SDL_WINDOWPOS_UNDEFINED, // y position
87 VideoCore::kScreenTopWidth, VideoCore::kScreenTopHeight + VideoCore::kScreenBottomHeight, 87 Core::kScreenTopWidth, Core::kScreenTopHeight + Core::kScreenBottomHeight,
88 SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI); 88 SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
89 89
90 if (render_window == nullptr) { 90 if (render_window == nullptr) {
91 LOG_CRITICAL(Frontend, "Failed to create SDL2 window! Exiting..."); 91 LOG_CRITICAL(Frontend, "Failed to create SDL2 window! Exiting...");
diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt
index 4e837668e..809e0b938 100644
--- a/src/citra_qt/CMakeLists.txt
+++ b/src/citra_qt/CMakeLists.txt
@@ -91,9 +91,9 @@ if (APPLE)
91else() 91else()
92 add_executable(citra-qt ${SRCS} ${HEADERS} ${UI_HDRS}) 92 add_executable(citra-qt ${SRCS} ${HEADERS} ${UI_HDRS})
93endif() 93endif()
94target_link_libraries(citra-qt core video_core audio_core common input_common) 94target_link_libraries(citra-qt PRIVATE audio_core common core input_common video_core)
95target_link_libraries(citra-qt ${OPENGL_gl_LIBRARY} ${CITRA_QT_LIBS}) 95target_link_libraries(citra-qt PRIVATE ${OPENGL_gl_LIBRARY} ${CITRA_QT_LIBS} glad)
96target_link_libraries(citra-qt ${PLATFORM_LIBRARIES} Threads::Threads) 96target_link_libraries(citra-qt PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
97 97
98if(UNIX AND NOT APPLE) 98if(UNIX AND NOT APPLE)
99 install(TARGETS citra-qt RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") 99 install(TARGETS citra-qt RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp
index bae576d6a..06b62f44c 100644
--- a/src/citra_qt/bootmanager.cpp
+++ b/src/citra_qt/bootmanager.cpp
@@ -12,12 +12,11 @@
12#include "common/microprofile.h" 12#include "common/microprofile.h"
13#include "common/scm_rev.h" 13#include "common/scm_rev.h"
14#include "common/string_util.h" 14#include "common/string_util.h"
15#include "core/3ds.h"
15#include "core/core.h" 16#include "core/core.h"
16#include "core/settings.h" 17#include "core/settings.h"
17#include "input_common/keyboard.h" 18#include "input_common/keyboard.h"
18#include "input_common/main.h" 19#include "input_common/main.h"
19#include "video_core/debug_utils/debug_utils.h"
20#include "video_core/video_core.h"
21 20
22EmuThread::EmuThread(GRenderWindow* render_window) 21EmuThread::EmuThread(GRenderWindow* render_window)
23 : exec_step(false), running(false), stop_run(false), render_window(render_window) {} 22 : exec_step(false), running(false), stop_run(false), render_window(render_window) {}
@@ -266,8 +265,7 @@ void GRenderWindow::InitRenderTarget() {
266 child = new GGLWidgetInternal(fmt, this); 265 child = new GGLWidgetInternal(fmt, this);
267 QBoxLayout* layout = new QHBoxLayout(this); 266 QBoxLayout* layout = new QHBoxLayout(this);
268 267
269 resize(VideoCore::kScreenTopWidth, 268 resize(Core::kScreenTopWidth, Core::kScreenTopHeight + Core::kScreenBottomHeight);
270 VideoCore::kScreenTopHeight + VideoCore::kScreenBottomHeight);
271 layout->addWidget(child); 269 layout->addWidget(child);
272 layout->setMargin(0); 270 layout->setMargin(0);
273 setLayout(layout); 271 setLayout(layout);
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp
index d7fad555f..eb2c7d613 100644
--- a/src/citra_qt/main.cpp
+++ b/src/citra_qt/main.cpp
@@ -43,7 +43,6 @@
43#include "core/gdbstub/gdbstub.h" 43#include "core/gdbstub/gdbstub.h"
44#include "core/loader/loader.h" 44#include "core/loader/loader.h"
45#include "core/settings.h" 45#include "core/settings.h"
46#include "video_core/video_core.h"
47 46
48#ifdef QT_STATICPLUGIN 47#ifdef QT_STATICPLUGIN
49Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin); 48Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin);
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index 6905d2d50..a33a8cdbe 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -27,7 +27,6 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/scm_rev.cpp.in" "${CMAKE_CURRENT_SOU
27set(SRCS 27set(SRCS
28 break_points.cpp 28 break_points.cpp
29 file_util.cpp 29 file_util.cpp
30 framebuffer_layout.cpp
31 hash.cpp 30 hash.cpp
32 logging/filter.cpp 31 logging/filter.cpp
33 logging/text_formatter.cpp 32 logging/text_formatter.cpp
@@ -56,7 +55,6 @@ set(HEADERS
56 common_paths.h 55 common_paths.h
57 common_types.h 56 common_types.h
58 file_util.h 57 file_util.h
59 framebuffer_layout.h
60 hash.h 58 hash.h
61 linear_disk_cache.h 59 linear_disk_cache.h
62 logging/text_formatter.h 60 logging/text_formatter.h
@@ -98,5 +96,5 @@ create_directory_groups(${SRCS} ${HEADERS})
98 96
99add_library(common STATIC ${SRCS} ${HEADERS}) 97add_library(common STATIC ${SRCS} ${HEADERS})
100if (ARCHITECTURE_x86_64) 98if (ARCHITECTURE_x86_64)
101 target_link_libraries(common xbyak) 99 target_link_libraries(common PRIVATE xbyak)
102endif() 100endif()
diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h
index b141e79ed..2e7877500 100644
--- a/src/common/common_funcs.h
+++ b/src/common/common_funcs.h
@@ -7,7 +7,7 @@
7#if !defined(ARCHITECTURE_x86_64) && !defined(_M_ARM) 7#if !defined(ARCHITECTURE_x86_64) && !defined(_M_ARM)
8#include <cstdlib> // for exit 8#include <cstdlib> // for exit
9#endif 9#endif
10#include "common_types.h" 10#include "common/common_types.h"
11 11
12#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) 12#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
13 13
diff --git a/src/common/hash.cpp b/src/common/hash.cpp
index f3d390dc5..a02e9e5b9 100644
--- a/src/common/hash.cpp
+++ b/src/common/hash.cpp
@@ -5,9 +5,9 @@
5#if defined(_MSC_VER) 5#if defined(_MSC_VER)
6#include <stdlib.h> 6#include <stdlib.h>
7#endif 7#endif
8#include "common_funcs.h" 8#include "common/common_funcs.h"
9#include "common_types.h" 9#include "common/common_types.h"
10#include "hash.h" 10#include "common/hash.h"
11 11
12namespace Common { 12namespace Common {
13 13
diff --git a/src/common/x64/cpu_detect.cpp b/src/common/x64/cpu_detect.cpp
index 2cb3ab9cc..62f17fbb5 100644
--- a/src/common/x64/cpu_detect.cpp
+++ b/src/common/x64/cpu_detect.cpp
@@ -6,7 +6,7 @@
6#include <string> 6#include <string>
7#include <thread> 7#include <thread>
8#include "common/common_types.h" 8#include "common/common_types.h"
9#include "cpu_detect.h" 9#include "common/x64/cpu_detect.h"
10 10
11#ifdef _MSC_VER 11#ifdef _MSC_VER
12#include <intrin.h> 12#include <intrin.h>
diff --git a/src/core/3ds.h b/src/core/3ds.h
new file mode 100644
index 000000000..8715e27db
--- /dev/null
+++ b/src/core/3ds.h
@@ -0,0 +1,21 @@
1// Copyright 2017 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7namespace Core {
8
9// 3DS Video Constants
10// -------------------
11
12// NOTE: The LCDs actually rotate the image 90 degrees when displaying. Because of that the
13// framebuffers in video memory are stored in column-major order and rendered sideways, causing
14// the widths and heights of the framebuffers read by the LCD to be switched compared to the
15// heights and widths of the screens listed here.
16constexpr int kScreenTopWidth = 400; ///< 3DS top screen width
17constexpr int kScreenTopHeight = 240; ///< 3DS top screen height
18constexpr int kScreenBottomWidth = 320; ///< 3DS bottom screen width
19constexpr int kScreenBottomHeight = 240; ///< 3DS bottom screen height
20
21} // namespace Core
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index b19335fe1..7aa81e885 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -32,6 +32,7 @@ set(SRCS
32 frontend/camera/factory.cpp 32 frontend/camera/factory.cpp
33 frontend/camera/interface.cpp 33 frontend/camera/interface.cpp
34 frontend/emu_window.cpp 34 frontend/emu_window.cpp
35 frontend/framebuffer_layout.cpp
35 frontend/motion_emu.cpp 36 frontend/motion_emu.cpp
36 gdbstub/gdbstub.cpp 37 gdbstub/gdbstub.cpp
37 hle/config_mem.cpp 38 hle/config_mem.cpp
@@ -178,6 +179,7 @@ set(SRCS
178 ) 179 )
179 180
180set(HEADERS 181set(HEADERS
182 3ds.h
181 arm/arm_interface.h 183 arm/arm_interface.h
182 arm/dynarmic/arm_dynarmic.h 184 arm/dynarmic/arm_dynarmic.h
183 arm/dynarmic/arm_dynarmic_cp15.h 185 arm/dynarmic/arm_dynarmic_cp15.h
@@ -216,6 +218,7 @@ set(HEADERS
216 frontend/camera/factory.h 218 frontend/camera/factory.h
217 frontend/camera/interface.h 219 frontend/camera/interface.h
218 frontend/emu_window.h 220 frontend/emu_window.h
221 frontend/framebuffer_layout.h
219 frontend/input.h 222 frontend/input.h
220 frontend/motion_emu.h 223 frontend/motion_emu.h
221 gdbstub/gdbstub.h 224 gdbstub/gdbstub.h
@@ -377,5 +380,5 @@ include_directories(../../externals/cryptopp)
377create_directory_groups(${SRCS} ${HEADERS}) 380create_directory_groups(${SRCS} ${HEADERS})
378 381
379add_library(core STATIC ${SRCS} ${HEADERS}) 382add_library(core STATIC ${SRCS} ${HEADERS})
380 383target_link_libraries(core PUBLIC common PRIVATE audio_core video_core)
381target_link_libraries(core dynarmic cryptopp) 384target_link_libraries(core PRIVATE cryptopp dynarmic)
diff --git a/src/core/frontend/emu_window.cpp b/src/core/frontend/emu_window.cpp
index 5fdb3a7e8..4f7d54a33 100644
--- a/src/core/frontend/emu_window.cpp
+++ b/src/core/frontend/emu_window.cpp
@@ -5,10 +5,10 @@
5#include <algorithm> 5#include <algorithm>
6#include <cmath> 6#include <cmath>
7#include "common/assert.h" 7#include "common/assert.h"
8#include "core/3ds.h"
8#include "core/core.h" 9#include "core/core.h"
9#include "core/frontend/emu_window.h" 10#include "core/frontend/emu_window.h"
10#include "core/settings.h" 11#include "core/settings.h"
11#include "video_core/video_core.h"
12 12
13/** 13/**
14 * Check if the given x/y coordinates are within the touchpad specified by the framebuffer layout 14 * Check if the given x/y coordinates are within the touchpad specified by the framebuffer layout
@@ -38,11 +38,9 @@ void EmuWindow::TouchPressed(unsigned framebuffer_x, unsigned framebuffer_y) {
38 if (!IsWithinTouchscreen(framebuffer_layout, framebuffer_x, framebuffer_y)) 38 if (!IsWithinTouchscreen(framebuffer_layout, framebuffer_x, framebuffer_y))
39 return; 39 return;
40 40
41 touch_x = VideoCore::kScreenBottomWidth * 41 touch_x = Core::kScreenBottomWidth * (framebuffer_x - framebuffer_layout.bottom_screen.left) /
42 (framebuffer_x - framebuffer_layout.bottom_screen.left) /
43 (framebuffer_layout.bottom_screen.right - framebuffer_layout.bottom_screen.left); 42 (framebuffer_layout.bottom_screen.right - framebuffer_layout.bottom_screen.left);
44 touch_y = VideoCore::kScreenBottomHeight * 43 touch_y = Core::kScreenBottomHeight * (framebuffer_y - framebuffer_layout.bottom_screen.top) /
45 (framebuffer_y - framebuffer_layout.bottom_screen.top) /
46 (framebuffer_layout.bottom_screen.bottom - framebuffer_layout.bottom_screen.top); 44 (framebuffer_layout.bottom_screen.bottom - framebuffer_layout.bottom_screen.top);
47 45
48 touch_pressed = true; 46 touch_pressed = true;
diff --git a/src/core/frontend/emu_window.h b/src/core/frontend/emu_window.h
index 36f2667fa..9414123a4 100644
--- a/src/core/frontend/emu_window.h
+++ b/src/core/frontend/emu_window.h
@@ -8,8 +8,8 @@
8#include <tuple> 8#include <tuple>
9#include <utility> 9#include <utility>
10#include "common/common_types.h" 10#include "common/common_types.h"
11#include "common/framebuffer_layout.h"
12#include "common/math_util.h" 11#include "common/math_util.h"
12#include "core/frontend/framebuffer_layout.h"
13 13
14/** 14/**
15 * Abstraction class used to provide an interface between emulation code and the frontend 15 * Abstraction class used to provide an interface between emulation code and the frontend
diff --git a/src/common/framebuffer_layout.cpp b/src/core/frontend/framebuffer_layout.cpp
index a2a0e7dad..d2d02f9ff 100644
--- a/src/common/framebuffer_layout.cpp
+++ b/src/core/frontend/framebuffer_layout.cpp
@@ -5,16 +5,20 @@
5#include <cmath> 5#include <cmath>
6 6
7#include "common/assert.h" 7#include "common/assert.h"
8#include "common/framebuffer_layout.h" 8#include "core/3ds.h"
9#include "core/frontend/framebuffer_layout.h"
9#include "core/settings.h" 10#include "core/settings.h"
10#include "video_core/video_core.h"
11 11
12namespace Layout { 12namespace Layout {
13 13
14static const float TOP_SCREEN_ASPECT_RATIO = 14static const float TOP_SCREEN_ASPECT_RATIO =
15 static_cast<float>(VideoCore::kScreenTopHeight) / VideoCore::kScreenTopWidth; 15 static_cast<float>(Core::kScreenTopHeight) / Core::kScreenTopWidth;
16static const float BOT_SCREEN_ASPECT_RATIO = 16static const float BOT_SCREEN_ASPECT_RATIO =
17 static_cast<float>(VideoCore::kScreenBottomHeight) / VideoCore::kScreenBottomWidth; 17 static_cast<float>(Core::kScreenBottomHeight) / Core::kScreenBottomWidth;
18
19float FramebufferLayout::GetScalingRatio() const {
20 return static_cast<float>(top_screen.GetWidth()) / Core::kScreenTopWidth;
21}
18 22
19// Finds the largest size subrectangle contained in window area that is confined to the aspect ratio 23// Finds the largest size subrectangle contained in window area that is confined to the aspect ratio
20template <class T> 24template <class T>
@@ -106,10 +110,10 @@ FramebufferLayout LargeFrameLayout(unsigned width, unsigned height, bool swapped
106 float window_aspect_ratio = static_cast<float>(height) / width; 110 float window_aspect_ratio = static_cast<float>(height) / width;
107 float emulation_aspect_ratio = 111 float emulation_aspect_ratio =
108 swapped 112 swapped
109 ? VideoCore::kScreenBottomHeight * 4 / 113 ? Core::kScreenBottomHeight * 4 /
110 (VideoCore::kScreenBottomWidth * 4.0f + VideoCore::kScreenTopWidth) 114 (Core::kScreenBottomWidth * 4.0f + Core::kScreenTopWidth)
111 : VideoCore::kScreenTopHeight * 4 / 115 : Core::kScreenTopHeight * 4 /
112 (VideoCore::kScreenTopWidth * 4.0f + VideoCore::kScreenBottomWidth); 116 (Core::kScreenTopWidth * 4.0f + Core::kScreenBottomWidth);
113 float large_screen_aspect_ratio = swapped ? BOT_SCREEN_ASPECT_RATIO : TOP_SCREEN_ASPECT_RATIO; 117 float large_screen_aspect_ratio = swapped ? BOT_SCREEN_ASPECT_RATIO : TOP_SCREEN_ASPECT_RATIO;
114 float small_screen_aspect_ratio = swapped ? TOP_SCREEN_ASPECT_RATIO : BOT_SCREEN_ASPECT_RATIO; 118 float small_screen_aspect_ratio = swapped ? TOP_SCREEN_ASPECT_RATIO : BOT_SCREEN_ASPECT_RATIO;
115 119
diff --git a/src/common/framebuffer_layout.h b/src/core/frontend/framebuffer_layout.h
index f1df5c55a..9a7738969 100644
--- a/src/common/framebuffer_layout.h
+++ b/src/core/frontend/framebuffer_layout.h
@@ -5,7 +5,9 @@
5#pragma once 5#pragma once
6 6
7#include "common/math_util.h" 7#include "common/math_util.h"
8
8namespace Layout { 9namespace Layout {
10
9/// Describes the layout of the window framebuffer (size and top/bottom screen positions) 11/// Describes the layout of the window framebuffer (size and top/bottom screen positions)
10struct FramebufferLayout { 12struct FramebufferLayout {
11 unsigned width; 13 unsigned width;
@@ -14,6 +16,12 @@ struct FramebufferLayout {
14 bool bottom_screen_enabled; 16 bool bottom_screen_enabled;
15 MathUtil::Rectangle<unsigned> top_screen; 17 MathUtil::Rectangle<unsigned> top_screen;
16 MathUtil::Rectangle<unsigned> bottom_screen; 18 MathUtil::Rectangle<unsigned> bottom_screen;
19
20 /**
21 * Returns the ration of pixel size of the top screen, compared to the native size of the 3DS
22 * screen.
23 */
24 float GetScalingRatio() const;
17}; 25};
18 26
19/** 27/**
@@ -52,4 +60,5 @@ FramebufferLayout LargeFrameLayout(unsigned width, unsigned height, bool is_swap
52 * @return Newly created FramebufferLayout object with default screen regions initialized 60 * @return Newly created FramebufferLayout object with default screen regions initialized
53 */ 61 */
54FramebufferLayout CustomFrameLayout(unsigned width, unsigned height); 62FramebufferLayout CustomFrameLayout(unsigned width, unsigned height);
55} 63
64} // namespace Layout
diff --git a/src/core/hle/applets/mii_selector.cpp b/src/core/hle/applets/mii_selector.cpp
index 07c7f5b99..89f08daa2 100644
--- a/src/core/hle/applets/mii_selector.cpp
+++ b/src/core/hle/applets/mii_selector.cpp
@@ -11,7 +11,6 @@
11#include "core/hle/kernel/kernel.h" 11#include "core/hle/kernel/kernel.h"
12#include "core/hle/kernel/shared_memory.h" 12#include "core/hle/kernel/shared_memory.h"
13#include "core/hle/result.h" 13#include "core/hle/result.h"
14#include "video_core/video_core.h"
15 14
16//////////////////////////////////////////////////////////////////////////////////////////////////// 15////////////////////////////////////////////////////////////////////////////////////////////////////
17 16
diff --git a/src/core/hle/applets/swkbd.cpp b/src/core/hle/applets/swkbd.cpp
index 059297fbc..fdf8807b0 100644
--- a/src/core/hle/applets/swkbd.cpp
+++ b/src/core/hle/applets/swkbd.cpp
@@ -14,7 +14,6 @@
14#include "core/hle/service/gsp_gpu.h" 14#include "core/hle/service/gsp_gpu.h"
15#include "core/hle/service/hid/hid.h" 15#include "core/hle/service/hid/hid.h"
16#include "core/memory.h" 16#include "core/memory.h"
17#include "video_core/video_core.h"
18 17
19//////////////////////////////////////////////////////////////////////////////////////////////////// 18////////////////////////////////////////////////////////////////////////////////////////////////////
20 19
diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp
index 46c4ed01a..94f6b8a9c 100644
--- a/src/core/hle/service/gsp_gpu.cpp
+++ b/src/core/hle/service/gsp_gpu.cpp
@@ -8,11 +8,11 @@
8#include "core/hle/kernel/event.h" 8#include "core/hle/kernel/event.h"
9#include "core/hle/kernel/shared_memory.h" 9#include "core/hle/kernel/shared_memory.h"
10#include "core/hle/result.h" 10#include "core/hle/result.h"
11#include "core/hle/service/gsp_gpu.h"
11#include "core/hw/gpu.h" 12#include "core/hw/gpu.h"
12#include "core/hw/hw.h" 13#include "core/hw/hw.h"
13#include "core/hw/lcd.h" 14#include "core/hw/lcd.h"
14#include "core/memory.h" 15#include "core/memory.h"
15#include "gsp_gpu.h"
16#include "video_core/debug_utils/debug_utils.h" 16#include "video_core/debug_utils/debug_utils.h"
17#include "video_core/gpu_debugger.h" 17#include "video_core/gpu_debugger.h"
18 18
diff --git a/src/core/settings.cpp b/src/core/settings.cpp
index d2e7c6b97..d4f0429d1 100644
--- a/src/core/settings.cpp
+++ b/src/core/settings.cpp
@@ -6,7 +6,7 @@
6#include "core/gdbstub/gdbstub.h" 6#include "core/gdbstub/gdbstub.h"
7#include "core/hle/service/hid/hid.h" 7#include "core/hle/service/hid/hid.h"
8#include "core/hle/service/ir/ir.h" 8#include "core/hle/service/ir/ir.h"
9#include "settings.h" 9#include "core/settings.h"
10#include "video_core/video_core.h" 10#include "video_core/video_core.h"
11 11
12#include "core/frontend/emu_window.h" 12#include "core/frontend/emu_window.h"
diff --git a/src/core/tracer/recorder.cpp b/src/core/tracer/recorder.cpp
index 276a5b288..55b3b5efc 100644
--- a/src/core/tracer/recorder.cpp
+++ b/src/core/tracer/recorder.cpp
@@ -6,7 +6,7 @@
6#include "common/assert.h" 6#include "common/assert.h"
7#include "common/file_util.h" 7#include "common/file_util.h"
8#include "common/logging/log.h" 8#include "common/logging/log.h"
9#include "recorder.h" 9#include "core/tracer/recorder.h"
10 10
11namespace CiTrace { 11namespace CiTrace {
12 12
diff --git a/src/core/tracer/recorder.h b/src/core/tracer/recorder.h
index aea363b95..39e6ec4fd 100644
--- a/src/core/tracer/recorder.h
+++ b/src/core/tracer/recorder.h
@@ -8,8 +8,8 @@
8#include <unordered_map> 8#include <unordered_map>
9#include <vector> 9#include <vector>
10#include <boost/crc.hpp> 10#include <boost/crc.hpp>
11#include "citrace.h"
12#include "common/common_types.h" 11#include "common/common_types.h"
12#include "core/tracer/citrace.h"
13 13
14namespace CiTrace { 14namespace CiTrace {
15 15
diff --git a/src/input_common/CMakeLists.txt b/src/input_common/CMakeLists.txt
index cfe5caaa3..5b306e42e 100644
--- a/src/input_common/CMakeLists.txt
+++ b/src/input_common/CMakeLists.txt
@@ -19,9 +19,9 @@ endif()
19create_directory_groups(${SRCS} ${HEADERS}) 19create_directory_groups(${SRCS} ${HEADERS})
20 20
21add_library(input_common STATIC ${SRCS} ${HEADERS}) 21add_library(input_common STATIC ${SRCS} ${HEADERS})
22target_link_libraries(input_common common core) 22target_link_libraries(input_common PUBLIC core PRIVATE common)
23 23
24if(SDL2_FOUND) 24if(SDL2_FOUND)
25 target_link_libraries(input_common ${SDL2_LIBRARY}) 25 target_link_libraries(input_common PRIVATE ${SDL2_LIBRARY})
26 set_property(TARGET input_common APPEND PROPERTY COMPILE_DEFINITIONS HAVE_SDL2) 26 target_compile_definitions(input_common PRIVATE HAVE_SDL2)
27endif() 27endif()
diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt
index d1144ba77..85f2f2985 100644
--- a/src/tests/CMakeLists.txt
+++ b/src/tests/CMakeLists.txt
@@ -13,7 +13,8 @@ create_directory_groups(${SRCS} ${HEADERS})
13include_directories(../../externals/catch/single_include/) 13include_directories(../../externals/catch/single_include/)
14 14
15add_executable(tests ${SRCS} ${HEADERS}) 15add_executable(tests ${SRCS} ${HEADERS})
16target_link_libraries(tests core video_core audio_core common) 16target_link_libraries(tests PRIVATE common core)
17target_link_libraries(tests ${PLATFORM_LIBRARIES} Threads::Threads) 17target_link_libraries(tests PRIVATE glad) # To support linker work-around
18target_link_libraries(tests PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
18 19
19add_test(NAME tests COMMAND $<TARGET_FILE:tests>) 20add_test(NAME tests COMMAND $<TARGET_FILE:tests>)
diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt
index e00b88f71..e455f03bd 100644
--- a/src/video_core/CMakeLists.txt
+++ b/src/video_core/CMakeLists.txt
@@ -79,13 +79,15 @@ endif()
79create_directory_groups(${SRCS} ${HEADERS}) 79create_directory_groups(${SRCS} ${HEADERS})
80 80
81add_library(video_core STATIC ${SRCS} ${HEADERS}) 81add_library(video_core STATIC ${SRCS} ${HEADERS})
82target_link_libraries(video_core glad) 82target_link_libraries(video_core PUBLIC common core)
83target_link_libraries(video_core PRIVATE glad)
84
83if (ARCHITECTURE_x86_64) 85if (ARCHITECTURE_x86_64)
84 target_link_libraries(video_core xbyak) 86 target_link_libraries(video_core PRIVATE xbyak)
85endif() 87endif()
86 88
87if (PNG_FOUND) 89if (PNG_FOUND)
88 target_link_libraries(video_core ${PNG_LIBRARIES}) 90 target_link_libraries(video_core PRIVATE ${PNG_LIBRARIES})
89 include_directories(${PNG_INCLUDE_DIRS}) 91 target_include_directories(video_core PRIVATE ${PNG_INCLUDE_DIRS})
90 add_definitions(${PNG_DEFINITIONS}) 92 target_compile_definitions(video_core PRIVATE ${PNG_DEFINITIONS})
91endif() 93endif()
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index 456443e86..8b717e43d 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -561,20 +561,16 @@ RasterizerCacheOpenGL::GetFramebufferSurfaces(
561 color_params.is_tiled = depth_params.is_tiled = true; 561 color_params.is_tiled = depth_params.is_tiled = true;
562 562
563 // Set the internal resolution, assume the same scaling factor for top and bottom screens 563 // Set the internal resolution, assume the same scaling factor for top and bottom screens
564 const Layout::FramebufferLayout& layout = VideoCore::g_emu_window->GetFramebufferLayout(); 564 float resolution_scale_factor = Settings::values.resolution_factor;
565 if (Settings::values.resolution_factor == 0.0f) { 565 if (resolution_scale_factor == 0.0f) {
566 // Auto - scale resolution to the window size 566 // Auto - scale resolution to the window size
567 color_params.res_scale_width = depth_params.res_scale_width = 567 resolution_scale_factor = VideoCore::g_emu_window->GetFramebufferLayout().GetScalingRatio();
568 (float)layout.top_screen.GetWidth() / VideoCore::kScreenTopWidth;
569 color_params.res_scale_height = depth_params.res_scale_height =
570 (float)layout.top_screen.GetHeight() / VideoCore::kScreenTopHeight;
571 } else {
572 // Otherwise, scale the resolution by the specified factor
573 color_params.res_scale_width = Settings::values.resolution_factor;
574 depth_params.res_scale_width = Settings::values.resolution_factor;
575 color_params.res_scale_height = Settings::values.resolution_factor;
576 depth_params.res_scale_height = Settings::values.resolution_factor;
577 } 568 }
569 // Scale the resolution by the specified factor
570 color_params.res_scale_width = resolution_scale_factor;
571 depth_params.res_scale_width = resolution_scale_factor;
572 color_params.res_scale_height = resolution_scale_factor;
573 depth_params.res_scale_height = resolution_scale_factor;
578 574
579 color_params.addr = config.GetColorBufferPhysicalAddress(); 575 color_params.addr = config.GetColorBufferPhysicalAddress();
580 color_params.pixel_format = CachedSurface::PixelFormatFromColorFormat(config.color_format); 576 color_params.pixel_format = CachedSurface::PixelFormatFromColorFormat(config.color_format);
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp
index e19375466..d90c776f9 100644
--- a/src/video_core/renderer_opengl/renderer_opengl.cpp
+++ b/src/video_core/renderer_opengl/renderer_opengl.cpp
@@ -94,14 +94,8 @@ static std::array<GLfloat, 3 * 2> MakeOrthographicMatrix(const float width, cons
94 return matrix; 94 return matrix;
95} 95}
96 96
97/// RendererOpenGL constructor 97RendererOpenGL::RendererOpenGL() = default;
98RendererOpenGL::RendererOpenGL() { 98RendererOpenGL::~RendererOpenGL() = default;
99 resolution_width = std::max(VideoCore::kScreenTopWidth, VideoCore::kScreenBottomWidth);
100 resolution_height = VideoCore::kScreenTopHeight + VideoCore::kScreenBottomHeight;
101}
102
103/// RendererOpenGL destructor
104RendererOpenGL::~RendererOpenGL() {}
105 99
106/// Swap buffers (render frame) 100/// Swap buffers (render frame)
107void RendererOpenGL::SwapBuffers() { 101void RendererOpenGL::SwapBuffers() {
diff --git a/src/video_core/renderer_opengl/renderer_opengl.h b/src/video_core/renderer_opengl/renderer_opengl.h
index 87c556cff..0b4f69e8f 100644
--- a/src/video_core/renderer_opengl/renderer_opengl.h
+++ b/src/video_core/renderer_opengl/renderer_opengl.h
@@ -68,9 +68,6 @@ private:
68 68
69 EmuWindow* render_window; ///< Handle to render window 69 EmuWindow* render_window; ///< Handle to render window
70 70
71 int resolution_width; ///< Current resolution width
72 int resolution_height; ///< Current resolution height
73
74 OpenGLState state; 71 OpenGLState state;
75 72
76 // OpenGL object IDs 73 // OpenGL object IDs
diff --git a/src/video_core/video_core.h b/src/video_core/video_core.h
index 4aba19ca0..94e0867f0 100644
--- a/src/video_core/video_core.h
+++ b/src/video_core/video_core.h
@@ -15,21 +15,6 @@ class RendererBase;
15 15
16namespace VideoCore { 16namespace VideoCore {
17 17
18// 3DS Video Constants
19// -------------------
20
21// NOTE: The LCDs actually rotate the image 90 degrees when displaying. Because of that the
22// framebuffers in video memory are stored in column-major order and rendered sideways, causing
23// the widths and heights of the framebuffers read by the LCD to be switched compared to the
24// heights and widths of the screens listed here.
25static const int kScreenTopWidth = 400; ///< 3DS top screen width
26static const int kScreenTopHeight = 240; ///< 3DS top screen height
27static const int kScreenBottomWidth = 320; ///< 3DS bottom screen width
28static const int kScreenBottomHeight = 240; ///< 3DS bottom screen height
29
30// Video core renderer
31// ---------------------
32
33extern std::unique_ptr<RendererBase> g_renderer; ///< Renderer plugin 18extern std::unique_ptr<RendererBase> g_renderer; ///< Renderer plugin
34extern EmuWindow* g_emu_window; ///< Emu window 19extern EmuWindow* g_emu_window; ///< Emu window
35 20