mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-11-09 16:29:59 +00:00
Merge pull request #2733 from yuriks/cmake-cleanup
Dependencies and build system cleanup
This commit is contained in:
commit
4caa2bad9d
32 changed files with 111 additions and 104 deletions
|
@ -38,9 +38,10 @@ endif()
|
||||||
create_directory_groups(${SRCS} ${HEADERS})
|
create_directory_groups(${SRCS} ${HEADERS})
|
||||||
|
|
||||||
add_library(audio_core STATIC ${SRCS} ${HEADERS})
|
add_library(audio_core STATIC ${SRCS} ${HEADERS})
|
||||||
target_link_libraries(audio_core SoundTouch)
|
target_link_libraries(audio_core PUBLIC common core)
|
||||||
|
target_link_libraries(audio_core PRIVATE SoundTouch)
|
||||||
|
|
||||||
if(SDL2_FOUND)
|
if(SDL2_FOUND)
|
||||||
target_link_libraries(audio_core ${SDL2_LIBRARY})
|
target_link_libraries(audio_core PRIVATE ${SDL2_LIBRARY})
|
||||||
set_property(TARGET audio_core APPEND PROPERTY COMPILE_DEFINITIONS HAVE_SDL2)
|
target_compile_definitions(audio_core PRIVATE HAVE_SDL2)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -18,12 +18,12 @@ create_directory_groups(${SRCS} ${HEADERS})
|
||||||
include_directories(${SDL2_INCLUDE_DIR})
|
include_directories(${SDL2_INCLUDE_DIR})
|
||||||
|
|
||||||
add_executable(citra ${SRCS} ${HEADERS})
|
add_executable(citra ${SRCS} ${HEADERS})
|
||||||
target_link_libraries(citra core video_core audio_core common input_common)
|
target_link_libraries(citra PRIVATE common core input_common)
|
||||||
target_link_libraries(citra ${SDL2_LIBRARY} ${OPENGL_gl_LIBRARY} inih glad)
|
target_link_libraries(citra PRIVATE ${SDL2_LIBRARY} ${OPENGL_gl_LIBRARY} inih glad)
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
target_link_libraries(citra getopt)
|
target_link_libraries(citra PRIVATE getopt)
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(citra ${PLATFORM_LIBRARIES} Threads::Threads)
|
target_link_libraries(citra PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
|
||||||
|
|
||||||
if(UNIX AND NOT APPLE)
|
if(UNIX AND NOT APPLE)
|
||||||
install(TARGETS citra RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
|
install(TARGETS citra RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
#include "core/gdbstub/gdbstub.h"
|
#include "core/gdbstub/gdbstub.h"
|
||||||
#include "core/loader/loader.h"
|
#include "core/loader/loader.h"
|
||||||
#include "core/settings.h"
|
#include "core/settings.h"
|
||||||
#include "video_core/video_core.h"
|
|
||||||
|
|
||||||
static void PrintHelp(const char* argv0) {
|
static void PrintHelp(const char* argv0) {
|
||||||
std::cout << "Usage: " << argv0
|
std::cout << "Usage: " << argv0
|
||||||
|
|
|
@ -5,11 +5,11 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#include <inih/cpp/INIReader.h>
|
#include <inih/cpp/INIReader.h>
|
||||||
|
#include "citra/config.h"
|
||||||
#include "citra/default_ini.h"
|
#include "citra/default_ini.h"
|
||||||
#include "common/file_util.h"
|
#include "common/file_util.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "common/param_package.h"
|
#include "common/param_package.h"
|
||||||
#include "config.h"
|
|
||||||
#include "core/settings.h"
|
#include "core/settings.h"
|
||||||
#include "input_common/main.h"
|
#include "input_common/main.h"
|
||||||
|
|
||||||
|
@ -21,6 +21,8 @@ Config::Config() {
|
||||||
Reload();
|
Reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Config::~Config() = default;
|
||||||
|
|
||||||
bool Config::LoadINI(const std::string& default_contents, bool retry) {
|
bool Config::LoadINI(const std::string& default_contents, bool retry) {
|
||||||
const char* location = this->sdl2_config_loc.c_str();
|
const char* location = this->sdl2_config_loc.c_str();
|
||||||
if (sdl2_config->ParseError() < 0) {
|
if (sdl2_config->ParseError() < 0) {
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <inih/cpp/INIReader.h>
|
|
||||||
|
class INIReader;
|
||||||
|
|
||||||
class Config {
|
class Config {
|
||||||
std::unique_ptr<INIReader> sdl2_config;
|
std::unique_ptr<INIReader> sdl2_config;
|
||||||
|
@ -17,6 +18,7 @@ class Config {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Config();
|
Config();
|
||||||
|
~Config();
|
||||||
|
|
||||||
void Reload();
|
void Reload();
|
||||||
};
|
};
|
||||||
|
|
|
@ -12,10 +12,10 @@
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "common/scm_rev.h"
|
#include "common/scm_rev.h"
|
||||||
#include "common/string_util.h"
|
#include "common/string_util.h"
|
||||||
|
#include "core/3ds.h"
|
||||||
#include "core/settings.h"
|
#include "core/settings.h"
|
||||||
#include "input_common/keyboard.h"
|
#include "input_common/keyboard.h"
|
||||||
#include "input_common/main.h"
|
#include "input_common/main.h"
|
||||||
#include "video_core/video_core.h"
|
|
||||||
|
|
||||||
void EmuWindow_SDL2::OnMouseMotion(s32 x, s32 y) {
|
void EmuWindow_SDL2::OnMouseMotion(s32 x, s32 y) {
|
||||||
TouchMoved((unsigned)std::max(x, 0), (unsigned)std::max(y, 0));
|
TouchMoved((unsigned)std::max(x, 0), (unsigned)std::max(y, 0));
|
||||||
|
@ -80,11 +80,11 @@ EmuWindow_SDL2::EmuWindow_SDL2() {
|
||||||
|
|
||||||
std::string window_title = Common::StringFromFormat("Citra %s| %s-%s ", Common::g_build_name,
|
std::string window_title = Common::StringFromFormat("Citra %s| %s-%s ", Common::g_build_name,
|
||||||
Common::g_scm_branch, Common::g_scm_desc);
|
Common::g_scm_branch, Common::g_scm_desc);
|
||||||
render_window = SDL_CreateWindow(
|
render_window =
|
||||||
window_title.c_str(),
|
SDL_CreateWindow(window_title.c_str(),
|
||||||
SDL_WINDOWPOS_UNDEFINED, // x position
|
SDL_WINDOWPOS_UNDEFINED, // x position
|
||||||
SDL_WINDOWPOS_UNDEFINED, // y position
|
SDL_WINDOWPOS_UNDEFINED, // y position
|
||||||
VideoCore::kScreenTopWidth, VideoCore::kScreenTopHeight + VideoCore::kScreenBottomHeight,
|
Core::kScreenTopWidth, Core::kScreenTopHeight + Core::kScreenBottomHeight,
|
||||||
SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
|
SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
|
||||||
|
|
||||||
if (render_window == nullptr) {
|
if (render_window == nullptr) {
|
||||||
|
|
|
@ -91,9 +91,9 @@ if (APPLE)
|
||||||
else()
|
else()
|
||||||
add_executable(citra-qt ${SRCS} ${HEADERS} ${UI_HDRS})
|
add_executable(citra-qt ${SRCS} ${HEADERS} ${UI_HDRS})
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(citra-qt core video_core audio_core common input_common)
|
target_link_libraries(citra-qt PRIVATE audio_core common core input_common video_core)
|
||||||
target_link_libraries(citra-qt ${OPENGL_gl_LIBRARY} ${CITRA_QT_LIBS})
|
target_link_libraries(citra-qt PRIVATE ${OPENGL_gl_LIBRARY} ${CITRA_QT_LIBS} glad)
|
||||||
target_link_libraries(citra-qt ${PLATFORM_LIBRARIES} Threads::Threads)
|
target_link_libraries(citra-qt PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
|
||||||
|
|
||||||
if(UNIX AND NOT APPLE)
|
if(UNIX AND NOT APPLE)
|
||||||
install(TARGETS citra-qt RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
|
install(TARGETS citra-qt RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
|
||||||
|
|
|
@ -12,12 +12,11 @@
|
||||||
#include "common/microprofile.h"
|
#include "common/microprofile.h"
|
||||||
#include "common/scm_rev.h"
|
#include "common/scm_rev.h"
|
||||||
#include "common/string_util.h"
|
#include "common/string_util.h"
|
||||||
|
#include "core/3ds.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/settings.h"
|
#include "core/settings.h"
|
||||||
#include "input_common/keyboard.h"
|
#include "input_common/keyboard.h"
|
||||||
#include "input_common/main.h"
|
#include "input_common/main.h"
|
||||||
#include "video_core/debug_utils/debug_utils.h"
|
|
||||||
#include "video_core/video_core.h"
|
|
||||||
|
|
||||||
EmuThread::EmuThread(GRenderWindow* render_window)
|
EmuThread::EmuThread(GRenderWindow* render_window)
|
||||||
: exec_step(false), running(false), stop_run(false), render_window(render_window) {}
|
: exec_step(false), running(false), stop_run(false), render_window(render_window) {}
|
||||||
|
@ -266,8 +265,7 @@ void GRenderWindow::InitRenderTarget() {
|
||||||
child = new GGLWidgetInternal(fmt, this);
|
child = new GGLWidgetInternal(fmt, this);
|
||||||
QBoxLayout* layout = new QHBoxLayout(this);
|
QBoxLayout* layout = new QHBoxLayout(this);
|
||||||
|
|
||||||
resize(VideoCore::kScreenTopWidth,
|
resize(Core::kScreenTopWidth, Core::kScreenTopHeight + Core::kScreenBottomHeight);
|
||||||
VideoCore::kScreenTopHeight + VideoCore::kScreenBottomHeight);
|
|
||||||
layout->addWidget(child);
|
layout->addWidget(child);
|
||||||
layout->setMargin(0);
|
layout->setMargin(0);
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
|
@ -43,7 +43,6 @@
|
||||||
#include "core/gdbstub/gdbstub.h"
|
#include "core/gdbstub/gdbstub.h"
|
||||||
#include "core/loader/loader.h"
|
#include "core/loader/loader.h"
|
||||||
#include "core/settings.h"
|
#include "core/settings.h"
|
||||||
#include "video_core/video_core.h"
|
|
||||||
|
|
||||||
#ifdef QT_STATICPLUGIN
|
#ifdef QT_STATICPLUGIN
|
||||||
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin);
|
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin);
|
||||||
|
|
|
@ -27,7 +27,6 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/scm_rev.cpp.in" "${CMAKE_CURRENT_SOU
|
||||||
set(SRCS
|
set(SRCS
|
||||||
break_points.cpp
|
break_points.cpp
|
||||||
file_util.cpp
|
file_util.cpp
|
||||||
framebuffer_layout.cpp
|
|
||||||
hash.cpp
|
hash.cpp
|
||||||
logging/filter.cpp
|
logging/filter.cpp
|
||||||
logging/text_formatter.cpp
|
logging/text_formatter.cpp
|
||||||
|
@ -56,7 +55,6 @@ set(HEADERS
|
||||||
common_paths.h
|
common_paths.h
|
||||||
common_types.h
|
common_types.h
|
||||||
file_util.h
|
file_util.h
|
||||||
framebuffer_layout.h
|
|
||||||
hash.h
|
hash.h
|
||||||
linear_disk_cache.h
|
linear_disk_cache.h
|
||||||
logging/text_formatter.h
|
logging/text_formatter.h
|
||||||
|
@ -98,5 +96,5 @@ create_directory_groups(${SRCS} ${HEADERS})
|
||||||
|
|
||||||
add_library(common STATIC ${SRCS} ${HEADERS})
|
add_library(common STATIC ${SRCS} ${HEADERS})
|
||||||
if (ARCHITECTURE_x86_64)
|
if (ARCHITECTURE_x86_64)
|
||||||
target_link_libraries(common xbyak)
|
target_link_libraries(common PRIVATE xbyak)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#if !defined(ARCHITECTURE_x86_64) && !defined(_M_ARM)
|
#if !defined(ARCHITECTURE_x86_64) && !defined(_M_ARM)
|
||||||
#include <cstdlib> // for exit
|
#include <cstdlib> // for exit
|
||||||
#endif
|
#endif
|
||||||
#include "common_types.h"
|
#include "common/common_types.h"
|
||||||
|
|
||||||
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
|
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
#endif
|
||||||
#include "common_funcs.h"
|
#include "common/common_funcs.h"
|
||||||
#include "common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "hash.h"
|
#include "common/hash.h"
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "cpu_detect.h"
|
#include "common/x64/cpu_detect.h"
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#include <intrin.h>
|
#include <intrin.h>
|
||||||
|
|
21
src/core/3ds.h
Normal file
21
src/core/3ds.h
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
// Copyright 2017 Citra Emulator Project
|
||||||
|
// Licensed under GPLv2 or any later version
|
||||||
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
|
||||||
|
// 3DS Video Constants
|
||||||
|
// -------------------
|
||||||
|
|
||||||
|
// NOTE: The LCDs actually rotate the image 90 degrees when displaying. Because of that the
|
||||||
|
// framebuffers in video memory are stored in column-major order and rendered sideways, causing
|
||||||
|
// the widths and heights of the framebuffers read by the LCD to be switched compared to the
|
||||||
|
// heights and widths of the screens listed here.
|
||||||
|
constexpr int kScreenTopWidth = 400; ///< 3DS top screen width
|
||||||
|
constexpr int kScreenTopHeight = 240; ///< 3DS top screen height
|
||||||
|
constexpr int kScreenBottomWidth = 320; ///< 3DS bottom screen width
|
||||||
|
constexpr int kScreenBottomHeight = 240; ///< 3DS bottom screen height
|
||||||
|
|
||||||
|
} // namespace Core
|
|
@ -32,6 +32,7 @@ set(SRCS
|
||||||
frontend/camera/factory.cpp
|
frontend/camera/factory.cpp
|
||||||
frontend/camera/interface.cpp
|
frontend/camera/interface.cpp
|
||||||
frontend/emu_window.cpp
|
frontend/emu_window.cpp
|
||||||
|
frontend/framebuffer_layout.cpp
|
||||||
frontend/motion_emu.cpp
|
frontend/motion_emu.cpp
|
||||||
gdbstub/gdbstub.cpp
|
gdbstub/gdbstub.cpp
|
||||||
hle/config_mem.cpp
|
hle/config_mem.cpp
|
||||||
|
@ -178,6 +179,7 @@ set(SRCS
|
||||||
)
|
)
|
||||||
|
|
||||||
set(HEADERS
|
set(HEADERS
|
||||||
|
3ds.h
|
||||||
arm/arm_interface.h
|
arm/arm_interface.h
|
||||||
arm/dynarmic/arm_dynarmic.h
|
arm/dynarmic/arm_dynarmic.h
|
||||||
arm/dynarmic/arm_dynarmic_cp15.h
|
arm/dynarmic/arm_dynarmic_cp15.h
|
||||||
|
@ -216,6 +218,7 @@ set(HEADERS
|
||||||
frontend/camera/factory.h
|
frontend/camera/factory.h
|
||||||
frontend/camera/interface.h
|
frontend/camera/interface.h
|
||||||
frontend/emu_window.h
|
frontend/emu_window.h
|
||||||
|
frontend/framebuffer_layout.h
|
||||||
frontend/input.h
|
frontend/input.h
|
||||||
frontend/motion_emu.h
|
frontend/motion_emu.h
|
||||||
gdbstub/gdbstub.h
|
gdbstub/gdbstub.h
|
||||||
|
@ -377,5 +380,5 @@ include_directories(../../externals/cryptopp)
|
||||||
create_directory_groups(${SRCS} ${HEADERS})
|
create_directory_groups(${SRCS} ${HEADERS})
|
||||||
|
|
||||||
add_library(core STATIC ${SRCS} ${HEADERS})
|
add_library(core STATIC ${SRCS} ${HEADERS})
|
||||||
|
target_link_libraries(core PUBLIC common PRIVATE audio_core video_core)
|
||||||
target_link_libraries(core dynarmic cryptopp)
|
target_link_libraries(core PRIVATE cryptopp dynarmic)
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
|
#include "core/3ds.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/frontend/emu_window.h"
|
#include "core/frontend/emu_window.h"
|
||||||
#include "core/settings.h"
|
#include "core/settings.h"
|
||||||
#include "video_core/video_core.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the given x/y coordinates are within the touchpad specified by the framebuffer layout
|
* 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) {
|
||||||
if (!IsWithinTouchscreen(framebuffer_layout, framebuffer_x, framebuffer_y))
|
if (!IsWithinTouchscreen(framebuffer_layout, framebuffer_x, framebuffer_y))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
touch_x = VideoCore::kScreenBottomWidth *
|
touch_x = Core::kScreenBottomWidth * (framebuffer_x - framebuffer_layout.bottom_screen.left) /
|
||||||
(framebuffer_x - framebuffer_layout.bottom_screen.left) /
|
|
||||||
(framebuffer_layout.bottom_screen.right - framebuffer_layout.bottom_screen.left);
|
(framebuffer_layout.bottom_screen.right - framebuffer_layout.bottom_screen.left);
|
||||||
touch_y = VideoCore::kScreenBottomHeight *
|
touch_y = Core::kScreenBottomHeight * (framebuffer_y - framebuffer_layout.bottom_screen.top) /
|
||||||
(framebuffer_y - framebuffer_layout.bottom_screen.top) /
|
|
||||||
(framebuffer_layout.bottom_screen.bottom - framebuffer_layout.bottom_screen.top);
|
(framebuffer_layout.bottom_screen.bottom - framebuffer_layout.bottom_screen.top);
|
||||||
|
|
||||||
touch_pressed = true;
|
touch_pressed = true;
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/framebuffer_layout.h"
|
|
||||||
#include "common/math_util.h"
|
#include "common/math_util.h"
|
||||||
|
#include "core/frontend/framebuffer_layout.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstraction class used to provide an interface between emulation code and the frontend
|
* Abstraction class used to provide an interface between emulation code and the frontend
|
||||||
|
|
|
@ -5,16 +5,20 @@
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/framebuffer_layout.h"
|
#include "core/3ds.h"
|
||||||
|
#include "core/frontend/framebuffer_layout.h"
|
||||||
#include "core/settings.h"
|
#include "core/settings.h"
|
||||||
#include "video_core/video_core.h"
|
|
||||||
|
|
||||||
namespace Layout {
|
namespace Layout {
|
||||||
|
|
||||||
static const float TOP_SCREEN_ASPECT_RATIO =
|
static const float TOP_SCREEN_ASPECT_RATIO =
|
||||||
static_cast<float>(VideoCore::kScreenTopHeight) / VideoCore::kScreenTopWidth;
|
static_cast<float>(Core::kScreenTopHeight) / Core::kScreenTopWidth;
|
||||||
static const float BOT_SCREEN_ASPECT_RATIO =
|
static const float BOT_SCREEN_ASPECT_RATIO =
|
||||||
static_cast<float>(VideoCore::kScreenBottomHeight) / VideoCore::kScreenBottomWidth;
|
static_cast<float>(Core::kScreenBottomHeight) / Core::kScreenBottomWidth;
|
||||||
|
|
||||||
|
float FramebufferLayout::GetScalingRatio() const {
|
||||||
|
return static_cast<float>(top_screen.GetWidth()) / Core::kScreenTopWidth;
|
||||||
|
}
|
||||||
|
|
||||||
// Finds the largest size subrectangle contained in window area that is confined to the aspect ratio
|
// Finds the largest size subrectangle contained in window area that is confined to the aspect ratio
|
||||||
template <class T>
|
template <class T>
|
||||||
|
@ -106,10 +110,10 @@ FramebufferLayout LargeFrameLayout(unsigned width, unsigned height, bool swapped
|
||||||
float window_aspect_ratio = static_cast<float>(height) / width;
|
float window_aspect_ratio = static_cast<float>(height) / width;
|
||||||
float emulation_aspect_ratio =
|
float emulation_aspect_ratio =
|
||||||
swapped
|
swapped
|
||||||
? VideoCore::kScreenBottomHeight * 4 /
|
? Core::kScreenBottomHeight * 4 /
|
||||||
(VideoCore::kScreenBottomWidth * 4.0f + VideoCore::kScreenTopWidth)
|
(Core::kScreenBottomWidth * 4.0f + Core::kScreenTopWidth)
|
||||||
: VideoCore::kScreenTopHeight * 4 /
|
: Core::kScreenTopHeight * 4 /
|
||||||
(VideoCore::kScreenTopWidth * 4.0f + VideoCore::kScreenBottomWidth);
|
(Core::kScreenTopWidth * 4.0f + Core::kScreenBottomWidth);
|
||||||
float large_screen_aspect_ratio = swapped ? BOT_SCREEN_ASPECT_RATIO : TOP_SCREEN_ASPECT_RATIO;
|
float large_screen_aspect_ratio = swapped ? BOT_SCREEN_ASPECT_RATIO : TOP_SCREEN_ASPECT_RATIO;
|
||||||
float small_screen_aspect_ratio = swapped ? TOP_SCREEN_ASPECT_RATIO : BOT_SCREEN_ASPECT_RATIO;
|
float small_screen_aspect_ratio = swapped ? TOP_SCREEN_ASPECT_RATIO : BOT_SCREEN_ASPECT_RATIO;
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "common/math_util.h"
|
#include "common/math_util.h"
|
||||||
|
|
||||||
namespace Layout {
|
namespace Layout {
|
||||||
|
|
||||||
/// Describes the layout of the window framebuffer (size and top/bottom screen positions)
|
/// Describes the layout of the window framebuffer (size and top/bottom screen positions)
|
||||||
struct FramebufferLayout {
|
struct FramebufferLayout {
|
||||||
unsigned width;
|
unsigned width;
|
||||||
|
@ -14,6 +16,12 @@ struct FramebufferLayout {
|
||||||
bool bottom_screen_enabled;
|
bool bottom_screen_enabled;
|
||||||
MathUtil::Rectangle<unsigned> top_screen;
|
MathUtil::Rectangle<unsigned> top_screen;
|
||||||
MathUtil::Rectangle<unsigned> bottom_screen;
|
MathUtil::Rectangle<unsigned> bottom_screen;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the ration of pixel size of the top screen, compared to the native size of the 3DS
|
||||||
|
* screen.
|
||||||
|
*/
|
||||||
|
float GetScalingRatio() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -52,4 +60,5 @@ FramebufferLayout LargeFrameLayout(unsigned width, unsigned height, bool is_swap
|
||||||
* @return Newly created FramebufferLayout object with default screen regions initialized
|
* @return Newly created FramebufferLayout object with default screen regions initialized
|
||||||
*/
|
*/
|
||||||
FramebufferLayout CustomFrameLayout(unsigned width, unsigned height);
|
FramebufferLayout CustomFrameLayout(unsigned width, unsigned height);
|
||||||
}
|
|
||||||
|
} // namespace Layout
|
|
@ -11,7 +11,6 @@
|
||||||
#include "core/hle/kernel/kernel.h"
|
#include "core/hle/kernel/kernel.h"
|
||||||
#include "core/hle/kernel/shared_memory.h"
|
#include "core/hle/kernel/shared_memory.h"
|
||||||
#include "core/hle/result.h"
|
#include "core/hle/result.h"
|
||||||
#include "video_core/video_core.h"
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
#include "core/hle/service/gsp_gpu.h"
|
#include "core/hle/service/gsp_gpu.h"
|
||||||
#include "core/hle/service/hid/hid.h"
|
#include "core/hle/service/hid/hid.h"
|
||||||
#include "core/memory.h"
|
#include "core/memory.h"
|
||||||
#include "video_core/video_core.h"
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
|
@ -8,11 +8,11 @@
|
||||||
#include "core/hle/kernel/event.h"
|
#include "core/hle/kernel/event.h"
|
||||||
#include "core/hle/kernel/shared_memory.h"
|
#include "core/hle/kernel/shared_memory.h"
|
||||||
#include "core/hle/result.h"
|
#include "core/hle/result.h"
|
||||||
|
#include "core/hle/service/gsp_gpu.h"
|
||||||
#include "core/hw/gpu.h"
|
#include "core/hw/gpu.h"
|
||||||
#include "core/hw/hw.h"
|
#include "core/hw/hw.h"
|
||||||
#include "core/hw/lcd.h"
|
#include "core/hw/lcd.h"
|
||||||
#include "core/memory.h"
|
#include "core/memory.h"
|
||||||
#include "gsp_gpu.h"
|
|
||||||
#include "video_core/debug_utils/debug_utils.h"
|
#include "video_core/debug_utils/debug_utils.h"
|
||||||
#include "video_core/gpu_debugger.h"
|
#include "video_core/gpu_debugger.h"
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include "core/gdbstub/gdbstub.h"
|
#include "core/gdbstub/gdbstub.h"
|
||||||
#include "core/hle/service/hid/hid.h"
|
#include "core/hle/service/hid/hid.h"
|
||||||
#include "core/hle/service/ir/ir.h"
|
#include "core/hle/service/ir/ir.h"
|
||||||
#include "settings.h"
|
#include "core/settings.h"
|
||||||
#include "video_core/video_core.h"
|
#include "video_core/video_core.h"
|
||||||
|
|
||||||
#include "core/frontend/emu_window.h"
|
#include "core/frontend/emu_window.h"
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/file_util.h"
|
#include "common/file_util.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "recorder.h"
|
#include "core/tracer/recorder.h"
|
||||||
|
|
||||||
namespace CiTrace {
|
namespace CiTrace {
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <boost/crc.hpp>
|
#include <boost/crc.hpp>
|
||||||
#include "citrace.h"
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
#include "core/tracer/citrace.h"
|
||||||
|
|
||||||
namespace CiTrace {
|
namespace CiTrace {
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,9 @@ endif()
|
||||||
create_directory_groups(${SRCS} ${HEADERS})
|
create_directory_groups(${SRCS} ${HEADERS})
|
||||||
|
|
||||||
add_library(input_common STATIC ${SRCS} ${HEADERS})
|
add_library(input_common STATIC ${SRCS} ${HEADERS})
|
||||||
target_link_libraries(input_common common core)
|
target_link_libraries(input_common PUBLIC core PRIVATE common)
|
||||||
|
|
||||||
if(SDL2_FOUND)
|
if(SDL2_FOUND)
|
||||||
target_link_libraries(input_common ${SDL2_LIBRARY})
|
target_link_libraries(input_common PRIVATE ${SDL2_LIBRARY})
|
||||||
set_property(TARGET input_common APPEND PROPERTY COMPILE_DEFINITIONS HAVE_SDL2)
|
target_compile_definitions(input_common PRIVATE HAVE_SDL2)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -13,7 +13,8 @@ create_directory_groups(${SRCS} ${HEADERS})
|
||||||
include_directories(../../externals/catch/single_include/)
|
include_directories(../../externals/catch/single_include/)
|
||||||
|
|
||||||
add_executable(tests ${SRCS} ${HEADERS})
|
add_executable(tests ${SRCS} ${HEADERS})
|
||||||
target_link_libraries(tests core video_core audio_core common)
|
target_link_libraries(tests PRIVATE common core)
|
||||||
target_link_libraries(tests ${PLATFORM_LIBRARIES} Threads::Threads)
|
target_link_libraries(tests PRIVATE glad) # To support linker work-around
|
||||||
|
target_link_libraries(tests PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
|
||||||
|
|
||||||
add_test(NAME tests COMMAND $<TARGET_FILE:tests>)
|
add_test(NAME tests COMMAND $<TARGET_FILE:tests>)
|
||||||
|
|
|
@ -79,13 +79,15 @@ endif()
|
||||||
create_directory_groups(${SRCS} ${HEADERS})
|
create_directory_groups(${SRCS} ${HEADERS})
|
||||||
|
|
||||||
add_library(video_core STATIC ${SRCS} ${HEADERS})
|
add_library(video_core STATIC ${SRCS} ${HEADERS})
|
||||||
target_link_libraries(video_core glad)
|
target_link_libraries(video_core PUBLIC common core)
|
||||||
|
target_link_libraries(video_core PRIVATE glad)
|
||||||
|
|
||||||
if (ARCHITECTURE_x86_64)
|
if (ARCHITECTURE_x86_64)
|
||||||
target_link_libraries(video_core xbyak)
|
target_link_libraries(video_core PRIVATE xbyak)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (PNG_FOUND)
|
if (PNG_FOUND)
|
||||||
target_link_libraries(video_core ${PNG_LIBRARIES})
|
target_link_libraries(video_core PRIVATE ${PNG_LIBRARIES})
|
||||||
include_directories(${PNG_INCLUDE_DIRS})
|
target_include_directories(video_core PRIVATE ${PNG_INCLUDE_DIRS})
|
||||||
add_definitions(${PNG_DEFINITIONS})
|
target_compile_definitions(video_core PRIVATE ${PNG_DEFINITIONS})
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -561,20 +561,16 @@ RasterizerCacheOpenGL::GetFramebufferSurfaces(
|
||||||
color_params.is_tiled = depth_params.is_tiled = true;
|
color_params.is_tiled = depth_params.is_tiled = true;
|
||||||
|
|
||||||
// Set the internal resolution, assume the same scaling factor for top and bottom screens
|
// Set the internal resolution, assume the same scaling factor for top and bottom screens
|
||||||
const Layout::FramebufferLayout& layout = VideoCore::g_emu_window->GetFramebufferLayout();
|
float resolution_scale_factor = Settings::values.resolution_factor;
|
||||||
if (Settings::values.resolution_factor == 0.0f) {
|
if (resolution_scale_factor == 0.0f) {
|
||||||
// Auto - scale resolution to the window size
|
// Auto - scale resolution to the window size
|
||||||
color_params.res_scale_width = depth_params.res_scale_width =
|
resolution_scale_factor = VideoCore::g_emu_window->GetFramebufferLayout().GetScalingRatio();
|
||||||
(float)layout.top_screen.GetWidth() / VideoCore::kScreenTopWidth;
|
|
||||||
color_params.res_scale_height = depth_params.res_scale_height =
|
|
||||||
(float)layout.top_screen.GetHeight() / VideoCore::kScreenTopHeight;
|
|
||||||
} else {
|
|
||||||
// Otherwise, scale the resolution by the specified factor
|
|
||||||
color_params.res_scale_width = Settings::values.resolution_factor;
|
|
||||||
depth_params.res_scale_width = Settings::values.resolution_factor;
|
|
||||||
color_params.res_scale_height = Settings::values.resolution_factor;
|
|
||||||
depth_params.res_scale_height = Settings::values.resolution_factor;
|
|
||||||
}
|
}
|
||||||
|
// Scale the resolution by the specified factor
|
||||||
|
color_params.res_scale_width = resolution_scale_factor;
|
||||||
|
depth_params.res_scale_width = resolution_scale_factor;
|
||||||
|
color_params.res_scale_height = resolution_scale_factor;
|
||||||
|
depth_params.res_scale_height = resolution_scale_factor;
|
||||||
|
|
||||||
color_params.addr = config.GetColorBufferPhysicalAddress();
|
color_params.addr = config.GetColorBufferPhysicalAddress();
|
||||||
color_params.pixel_format = CachedSurface::PixelFormatFromColorFormat(config.color_format);
|
color_params.pixel_format = CachedSurface::PixelFormatFromColorFormat(config.color_format);
|
||||||
|
|
|
@ -94,14 +94,8 @@ static std::array<GLfloat, 3 * 2> MakeOrthographicMatrix(const float width, cons
|
||||||
return matrix;
|
return matrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// RendererOpenGL constructor
|
RendererOpenGL::RendererOpenGL() = default;
|
||||||
RendererOpenGL::RendererOpenGL() {
|
RendererOpenGL::~RendererOpenGL() = default;
|
||||||
resolution_width = std::max(VideoCore::kScreenTopWidth, VideoCore::kScreenBottomWidth);
|
|
||||||
resolution_height = VideoCore::kScreenTopHeight + VideoCore::kScreenBottomHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// RendererOpenGL destructor
|
|
||||||
RendererOpenGL::~RendererOpenGL() {}
|
|
||||||
|
|
||||||
/// Swap buffers (render frame)
|
/// Swap buffers (render frame)
|
||||||
void RendererOpenGL::SwapBuffers() {
|
void RendererOpenGL::SwapBuffers() {
|
||||||
|
|
|
@ -68,9 +68,6 @@ private:
|
||||||
|
|
||||||
EmuWindow* render_window; ///< Handle to render window
|
EmuWindow* render_window; ///< Handle to render window
|
||||||
|
|
||||||
int resolution_width; ///< Current resolution width
|
|
||||||
int resolution_height; ///< Current resolution height
|
|
||||||
|
|
||||||
OpenGLState state;
|
OpenGLState state;
|
||||||
|
|
||||||
// OpenGL object IDs
|
// OpenGL object IDs
|
||||||
|
|
|
@ -15,21 +15,6 @@ class RendererBase;
|
||||||
|
|
||||||
namespace VideoCore {
|
namespace VideoCore {
|
||||||
|
|
||||||
// 3DS Video Constants
|
|
||||||
// -------------------
|
|
||||||
|
|
||||||
// NOTE: The LCDs actually rotate the image 90 degrees when displaying. Because of that the
|
|
||||||
// framebuffers in video memory are stored in column-major order and rendered sideways, causing
|
|
||||||
// the widths and heights of the framebuffers read by the LCD to be switched compared to the
|
|
||||||
// heights and widths of the screens listed here.
|
|
||||||
static const int kScreenTopWidth = 400; ///< 3DS top screen width
|
|
||||||
static const int kScreenTopHeight = 240; ///< 3DS top screen height
|
|
||||||
static const int kScreenBottomWidth = 320; ///< 3DS bottom screen width
|
|
||||||
static const int kScreenBottomHeight = 240; ///< 3DS bottom screen height
|
|
||||||
|
|
||||||
// Video core renderer
|
|
||||||
// ---------------------
|
|
||||||
|
|
||||||
extern std::unique_ptr<RendererBase> g_renderer; ///< Renderer plugin
|
extern std::unique_ptr<RendererBase> g_renderer; ///< Renderer plugin
|
||||||
extern EmuWindow* g_emu_window; ///< Emu window
|
extern EmuWindow* g_emu_window; ///< Emu window
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue