summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/citra/config.cpp17
-rw-r--r--src/citra/default_ini.h15
-rw-r--r--src/citra_qt/CMakeLists.txt46
-rw-r--r--src/citra_qt/bootmanager.cpp5
-rw-r--r--src/citra_qt/bootmanager.h2
-rw-r--r--src/citra_qt/configuration/config.cpp (renamed from src/citra_qt/config.cpp)20
-rw-r--r--src/citra_qt/configuration/config.h (renamed from src/citra_qt/config.h)0
-rw-r--r--src/citra_qt/configuration/configure.ui (renamed from src/citra_qt/configure.ui)12
-rw-r--r--src/citra_qt/configuration/configure_audio.cpp (renamed from src/citra_qt/configure_audio.cpp)2
-rw-r--r--src/citra_qt/configuration/configure_audio.h (renamed from src/citra_qt/configure_audio.h)0
-rw-r--r--src/citra_qt/configuration/configure_audio.ui (renamed from src/citra_qt/configure_audio.ui)0
-rw-r--r--src/citra_qt/configuration/configure_debug.cpp (renamed from src/citra_qt/configure_debug.cpp)2
-rw-r--r--src/citra_qt/configuration/configure_debug.h (renamed from src/citra_qt/configure_debug.h)0
-rw-r--r--src/citra_qt/configuration/configure_debug.ui (renamed from src/citra_qt/configure_debug.ui)0
-rw-r--r--src/citra_qt/configuration/configure_dialog.cpp (renamed from src/citra_qt/configure_dialog.cpp)4
-rw-r--r--src/citra_qt/configuration/configure_dialog.h (renamed from src/citra_qt/configure_dialog.h)0
-rw-r--r--src/citra_qt/configuration/configure_general.cpp (renamed from src/citra_qt/configure_general.cpp)2
-rw-r--r--src/citra_qt/configuration/configure_general.h (renamed from src/citra_qt/configure_general.h)0
-rw-r--r--src/citra_qt/configuration/configure_general.ui (renamed from src/citra_qt/configure_general.ui)0
-rw-r--r--src/citra_qt/configuration/configure_graphics.cpp (renamed from src/citra_qt/configure_graphics.cpp)4
-rw-r--r--src/citra_qt/configuration/configure_graphics.h (renamed from src/citra_qt/configure_graphics.h)0
-rw-r--r--src/citra_qt/configuration/configure_graphics.ui (renamed from src/citra_qt/configure_graphics.ui)2
-rw-r--r--src/citra_qt/configuration/configure_input.cpp (renamed from src/citra_qt/configure_input.cpp)4
-rw-r--r--src/citra_qt/configuration/configure_input.h (renamed from src/citra_qt/configure_input.h)0
-rw-r--r--src/citra_qt/configuration/configure_input.ui (renamed from src/citra_qt/configure_input.ui)0
-rw-r--r--src/citra_qt/configuration/configure_system.cpp (renamed from src/citra_qt/configure_system.cpp)2
-rw-r--r--src/citra_qt/configuration/configure_system.h (renamed from src/citra_qt/configure_system.h)0
-rw-r--r--src/citra_qt/configuration/configure_system.ui (renamed from src/citra_qt/configure_system.ui)0
-rw-r--r--src/citra_qt/main.cpp5
-rw-r--r--src/common/framebuffer_layout.cpp19
-rw-r--r--src/common/framebuffer_layout.h8
-rw-r--r--src/core/frontend/emu_window.cpp26
-rw-r--r--src/core/hle/function_wrappers.h4
-rw-r--r--src/core/hle/service/apt/apt.cpp2
-rw-r--r--src/core/hle/service/ptm/ptm.cpp2
-rw-r--r--src/core/hle/service/soc_u.cpp71
-rw-r--r--src/core/hle/shared_page.cpp7
-rw-r--r--src/core/hle/shared_page.h10
-rw-r--r--src/core/hle/svc.cpp4
-rw-r--r--src/core/settings.h10
-rw-r--r--src/input_common/keyboard.cpp11
-rw-r--r--src/input_common/keyboard.h2
42 files changed, 217 insertions, 103 deletions
diff --git a/src/citra/config.cpp b/src/citra/config.cpp
index ef1229912..a4162e9ad 100644
--- a/src/citra/config.cpp
+++ b/src/citra/config.cpp
@@ -94,6 +94,23 @@ void Config::ReadValues() {
Settings::values.layout_option =
static_cast<Settings::LayoutOption>(sdl2_config->GetInteger("Layout", "layout_option", 0));
Settings::values.swap_screen = sdl2_config->GetBoolean("Layout", "swap_screen", false);
+ Settings::values.custom_layout = sdl2_config->GetBoolean("Layout", "custom_layout", false);
+ Settings::values.custom_top_left =
+ static_cast<u16>(sdl2_config->GetInteger("Layout", "custom_top_left", 0));
+ Settings::values.custom_top_top =
+ static_cast<u16>(sdl2_config->GetInteger("Layout", "custom_top_top", 0));
+ Settings::values.custom_top_right =
+ static_cast<u16>(sdl2_config->GetInteger("Layout", "custom_top_right", 400));
+ Settings::values.custom_top_bottom =
+ static_cast<u16>(sdl2_config->GetInteger("Layout", "custom_top_bottom", 240));
+ Settings::values.custom_bottom_left =
+ static_cast<u16>(sdl2_config->GetInteger("Layout", "custom_bottom_left", 40));
+ Settings::values.custom_bottom_top =
+ static_cast<u16>(sdl2_config->GetInteger("Layout", "custom_bottom_top", 240));
+ Settings::values.custom_bottom_right =
+ static_cast<u16>(sdl2_config->GetInteger("Layout", "custom_bottom_right", 360));
+ Settings::values.custom_bottom_bottom =
+ static_cast<u16>(sdl2_config->GetInteger("Layout", "custom_bottom_bottom", 480));
// Audio
Settings::values.sink_id = sdl2_config->Get("Audio", "output_engine", "auto");
diff --git a/src/citra/default_ini.h b/src/citra/default_ini.h
index af9f7aa2a..084372df4 100644
--- a/src/citra/default_ini.h
+++ b/src/citra/default_ini.h
@@ -84,6 +84,21 @@ bg_green =
# 0 (default): Default Top Bottom Screen, 1: Single Screen Only, 2: Large Screen Small Screen
layout_option =
+# Toggle custom layout (using the settings below) on or off.
+# 0 (default): Off , 1: On
+custom_layout =
+
+# Screen placement when using Custom layout option
+# 0x, 0y is the top left corner of the render window.
+custom_top_left =
+custom_top_top =
+custom_top_right =
+custom_top_bottom =
+custom_bottom_left =
+custom_bottom_top =
+custom_bottom_right =
+custom_bottom_bottom =
+
#Whether to toggle frame limiter on or off.
# 0: Off , 1 (default): On
toggle_framelimit =
diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt
index 2b1c59a92..3e6106f0a 100644
--- a/src/citra_qt/CMakeLists.txt
+++ b/src/citra_qt/CMakeLists.txt
@@ -3,7 +3,14 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules)
set(SRCS
- config.cpp
+ configuration/config.cpp
+ configuration/configure_audio.cpp
+ configuration/configure_debug.cpp
+ configuration/configure_dialog.cpp
+ configuration/configure_general.cpp
+ configuration/configure_graphics.cpp
+ configuration/configure_input.cpp
+ configuration/configure_system.cpp
debugger/callstack.cpp
debugger/disassembler.cpp
debugger/graphics/graphics.cpp
@@ -19,13 +26,6 @@ set(SRCS
util/spinbox.cpp
util/util.cpp
bootmanager.cpp
- configure_audio.cpp
- configure_debug.cpp
- configure_dialog.cpp
- configure_general.cpp
- configure_graphics.cpp
- configure_system.cpp
- configure_input.cpp
game_list.cpp
hotkeys.cpp
main.cpp
@@ -35,7 +35,14 @@ set(SRCS
)
set(HEADERS
- config.h
+ configuration/config.h
+ configuration/configure_audio.h
+ configuration/configure_debug.h
+ configuration/configure_dialog.h
+ configuration/configure_general.h
+ configuration/configure_graphics.h
+ configuration/configure_input.h
+ configuration/configure_system.h
debugger/callstack.h
debugger/disassembler.h
debugger/graphics/graphics.h
@@ -52,13 +59,6 @@ set(HEADERS
util/spinbox.h
util/util.h
bootmanager.h
- configure_audio.h
- configure_debug.h
- configure_dialog.h
- configure_general.h
- configure_graphics.h
- configure_system.h
- configure_input.h
game_list.h
game_list_p.h
hotkeys.h
@@ -67,16 +67,16 @@ set(HEADERS
)
set(UIS
+ configuration/configure.ui
+ configuration/configure_audio.ui
+ configuration/configure_debug.ui
+ configuration/configure_general.ui
+ configuration/configure_graphics.ui
+ configuration/configure_input.ui
+ configuration/configure_system.ui
debugger/callstack.ui
debugger/disassembler.ui
debugger/registers.ui
- configure.ui
- configure_audio.ui
- configure_debug.ui
- configure_general.ui
- configure_graphics.ui
- configure_system.ui
- configure_input.ui
hotkeys.ui
main.ui
)
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp
index 28264df9a..bae576d6a 100644
--- a/src/citra_qt/bootmanager.cpp
+++ b/src/citra_qt/bootmanager.cpp
@@ -235,7 +235,10 @@ void GRenderWindow::mouseReleaseEvent(QMouseEvent* event) {
motion_emu->EndTilt();
}
-void GRenderWindow::ReloadSetKeymaps() {}
+void GRenderWindow::focusOutEvent(QFocusEvent* event) {
+ QWidget::focusOutEvent(event);
+ InputCommon::GetKeyboard()->ReleaseAllKeys();
+}
void GRenderWindow::OnClientAreaResized(unsigned width, unsigned height) {
NotifyClientAreaSizeChanged(std::make_pair(width, height));
diff --git a/src/citra_qt/bootmanager.h b/src/citra_qt/bootmanager.h
index 923a5b456..9d39f1af8 100644
--- a/src/citra_qt/bootmanager.h
+++ b/src/citra_qt/bootmanager.h
@@ -128,7 +128,7 @@ public:
void mouseMoveEvent(QMouseEvent* event) override;
void mouseReleaseEvent(QMouseEvent* event) override;
- void ReloadSetKeymaps();
+ void focusOutEvent(QFocusEvent* event) override;
void OnClientAreaResized(unsigned width, unsigned height);
diff --git a/src/citra_qt/config.cpp b/src/citra_qt/configuration/config.cpp
index 6ccfa1577..0b9b73f9e 100644
--- a/src/citra_qt/config.cpp
+++ b/src/citra_qt/configuration/config.cpp
@@ -3,7 +3,7 @@
// Refer to the license.txt file included.
#include <QSettings>
-#include "citra_qt/config.h"
+#include "citra_qt/configuration/config.h"
#include "citra_qt/ui_settings.h"
#include "common/file_util.h"
#include "input_common/main.h"
@@ -79,6 +79,15 @@ void Config::ReadValues() {
Settings::values.layout_option =
static_cast<Settings::LayoutOption>(qt_config->value("layout_option").toInt());
Settings::values.swap_screen = qt_config->value("swap_screen", false).toBool();
+ Settings::values.custom_layout = qt_config->value("custom_layout", false).toBool();
+ Settings::values.custom_top_left = qt_config->value("custom_top_left", 0).toInt();
+ Settings::values.custom_top_top = qt_config->value("custom_top_top", 0).toInt();
+ Settings::values.custom_top_right = qt_config->value("custom_top_right", 400).toInt();
+ Settings::values.custom_top_bottom = qt_config->value("custom_top_bottom", 240).toInt();
+ Settings::values.custom_bottom_left = qt_config->value("custom_bottom_left", 40).toInt();
+ Settings::values.custom_bottom_top = qt_config->value("custom_bottom_top", 240).toInt();
+ Settings::values.custom_bottom_right = qt_config->value("custom_bottom_right", 360).toInt();
+ Settings::values.custom_bottom_bottom = qt_config->value("custom_bottom_bottom", 480).toInt();
qt_config->endGroup();
qt_config->beginGroup("Audio");
@@ -207,6 +216,15 @@ void Config::SaveValues() {
qt_config->beginGroup("Layout");
qt_config->setValue("layout_option", static_cast<int>(Settings::values.layout_option));
qt_config->setValue("swap_screen", Settings::values.swap_screen);
+ qt_config->setValue("custom_layout", Settings::values.custom_layout);
+ qt_config->setValue("custom_top_left", Settings::values.custom_top_left);
+ qt_config->setValue("custom_top_top", Settings::values.custom_top_top);
+ qt_config->setValue("custom_top_right", Settings::values.custom_top_right);
+ qt_config->setValue("custom_top_bottom", Settings::values.custom_top_bottom);
+ qt_config->setValue("custom_bottom_left", Settings::values.custom_bottom_left);
+ qt_config->setValue("custom_bottom_top", Settings::values.custom_bottom_top);
+ qt_config->setValue("custom_bottom_right", Settings::values.custom_bottom_right);
+ qt_config->setValue("custom_bottom_bottom", Settings::values.custom_bottom_bottom);
qt_config->endGroup();
qt_config->beginGroup("Audio");
diff --git a/src/citra_qt/config.h b/src/citra_qt/configuration/config.h
index cbf745ea2..cbf745ea2 100644
--- a/src/citra_qt/config.h
+++ b/src/citra_qt/configuration/config.h
diff --git a/src/citra_qt/configure.ui b/src/citra_qt/configuration/configure.ui
index 28b4a3b90..85e206e42 100644
--- a/src/citra_qt/configure.ui
+++ b/src/citra_qt/configuration/configure.ui
@@ -64,37 +64,37 @@
<customwidget>
<class>ConfigureGeneral</class>
<extends>QWidget</extends>
- <header>configure_general.h</header>
+ <header>configuration/configure_general.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ConfigureSystem</class>
<extends>QWidget</extends>
- <header>configure_system.h</header>
+ <header>configuration/configure_system.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ConfigureAudio</class>
<extends>QWidget</extends>
- <header>configure_audio.h</header>
+ <header>configuration/configure_audio.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ConfigureDebug</class>
<extends>QWidget</extends>
- <header>configure_debug.h</header>
+ <header>configuration/configure_debug.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ConfigureInput</class>
<extends>QWidget</extends>
- <header>configure_input.h</header>
+ <header>configuration/configure_input.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ConfigureGraphics</class>
<extends>QWidget</extends>
- <header>configure_graphics.h</header>
+ <header>configuration/configure_graphics.h</header>
<container>1</container>
</customwidget>
</customwidgets>
diff --git a/src/citra_qt/configure_audio.cpp b/src/citra_qt/configuration/configure_audio.cpp
index 3ddcf9232..3fd1d127a 100644
--- a/src/citra_qt/configure_audio.cpp
+++ b/src/citra_qt/configuration/configure_audio.cpp
@@ -6,7 +6,7 @@
#include "audio_core/audio_core.h"
#include "audio_core/sink.h"
#include "audio_core/sink_details.h"
-#include "citra_qt/configure_audio.h"
+#include "citra_qt/configuration/configure_audio.h"
#include "core/settings.h"
#include "ui_configure_audio.h"
diff --git a/src/citra_qt/configure_audio.h b/src/citra_qt/configuration/configure_audio.h
index 8190e694f..8190e694f 100644
--- a/src/citra_qt/configure_audio.h
+++ b/src/citra_qt/configuration/configure_audio.h
diff --git a/src/citra_qt/configure_audio.ui b/src/citra_qt/configuration/configure_audio.ui
index dd870eb61..dd870eb61 100644
--- a/src/citra_qt/configure_audio.ui
+++ b/src/citra_qt/configuration/configure_audio.ui
diff --git a/src/citra_qt/configure_debug.cpp b/src/citra_qt/configuration/configure_debug.cpp
index dcc398eee..263f73f38 100644
--- a/src/citra_qt/configure_debug.cpp
+++ b/src/citra_qt/configuration/configure_debug.cpp
@@ -2,7 +2,7 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
-#include "citra_qt/configure_debug.h"
+#include "citra_qt/configuration/configure_debug.h"
#include "core/settings.h"
#include "ui_configure_debug.h"
diff --git a/src/citra_qt/configure_debug.h b/src/citra_qt/configuration/configure_debug.h
index d167eb996..d167eb996 100644
--- a/src/citra_qt/configure_debug.h
+++ b/src/citra_qt/configuration/configure_debug.h
diff --git a/src/citra_qt/configure_debug.ui b/src/citra_qt/configuration/configure_debug.ui
index bbbb0e3f4..bbbb0e3f4 100644
--- a/src/citra_qt/configure_debug.ui
+++ b/src/citra_qt/configuration/configure_debug.ui
diff --git a/src/citra_qt/configure_dialog.cpp b/src/citra_qt/configuration/configure_dialog.cpp
index 525a7cc4e..dfc8c03a7 100644
--- a/src/citra_qt/configure_dialog.cpp
+++ b/src/citra_qt/configuration/configure_dialog.cpp
@@ -2,8 +2,8 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
-#include "citra_qt/config.h"
-#include "citra_qt/configure_dialog.h"
+#include "citra_qt/configuration/config.h"
+#include "citra_qt/configuration/configure_dialog.h"
#include "core/settings.h"
#include "ui_configure.h"
diff --git a/src/citra_qt/configure_dialog.h b/src/citra_qt/configuration/configure_dialog.h
index 21fa1f501..21fa1f501 100644
--- a/src/citra_qt/configure_dialog.h
+++ b/src/citra_qt/configuration/configure_dialog.h
diff --git a/src/citra_qt/configure_general.cpp b/src/citra_qt/configuration/configure_general.cpp
index ac90a6df4..a21176c34 100644
--- a/src/citra_qt/configure_general.cpp
+++ b/src/citra_qt/configuration/configure_general.cpp
@@ -2,7 +2,7 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
-#include "citra_qt/configure_general.h"
+#include "citra_qt/configuration/configure_general.h"
#include "citra_qt/ui_settings.h"
#include "core/core.h"
#include "core/settings.h"
diff --git a/src/citra_qt/configure_general.h b/src/citra_qt/configuration/configure_general.h
index 447552d8c..447552d8c 100644
--- a/src/citra_qt/configure_general.h
+++ b/src/citra_qt/configuration/configure_general.h
diff --git a/src/citra_qt/configure_general.ui b/src/citra_qt/configuration/configure_general.ui
index c739605a4..c739605a4 100644
--- a/src/citra_qt/configure_general.ui
+++ b/src/citra_qt/configuration/configure_general.ui
diff --git a/src/citra_qt/configure_graphics.cpp b/src/citra_qt/configuration/configure_graphics.cpp
index 54f799b47..b5a5ab1e1 100644
--- a/src/citra_qt/configure_graphics.cpp
+++ b/src/citra_qt/configuration/configure_graphics.cpp
@@ -2,7 +2,7 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
-#include "citra_qt/configure_graphics.h"
+#include "citra_qt/configuration/configure_graphics.h"
#include "core/core.h"
#include "core/settings.h"
#include "ui_configure_graphics.h"
@@ -14,6 +14,8 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent)
this->setConfiguration();
ui->toggle_vsync->setEnabled(!Core::System::GetInstance().IsPoweredOn());
+
+ ui->layoutBox->setEnabled(!Settings::values.custom_layout);
}
ConfigureGraphics::~ConfigureGraphics() {}
diff --git a/src/citra_qt/configure_graphics.h b/src/citra_qt/configuration/configure_graphics.h
index 5497a55f7..5497a55f7 100644
--- a/src/citra_qt/configure_graphics.h
+++ b/src/citra_qt/configuration/configure_graphics.h
diff --git a/src/citra_qt/configure_graphics.ui b/src/citra_qt/configuration/configure_graphics.ui
index a091f4c60..228f2a869 100644
--- a/src/citra_qt/configure_graphics.ui
+++ b/src/citra_qt/configuration/configure_graphics.ui
@@ -126,7 +126,7 @@
</layout>
</item>
<item>
- <widget class="QGroupBox" name="groupBox2">
+ <widget class="QGroupBox" name="layoutBox">
<property name="title">
<string>Layout</string>
</property>
diff --git a/src/citra_qt/configure_input.cpp b/src/citra_qt/configuration/configure_input.cpp
index b59713e2c..daac9b63a 100644
--- a/src/citra_qt/configure_input.cpp
+++ b/src/citra_qt/configuration/configure_input.cpp
@@ -6,8 +6,8 @@
#include <memory>
#include <utility>
#include <QTimer>
-#include "citra_qt/config.h"
-#include "citra_qt/configure_input.h"
+#include "citra_qt/configuration/config.h"
+#include "citra_qt/configuration/configure_input.h"
#include "common/param_package.h"
#include "input_common/main.h"
diff --git a/src/citra_qt/configure_input.h b/src/citra_qt/configuration/configure_input.h
index c950fbcb4..c950fbcb4 100644
--- a/src/citra_qt/configure_input.h
+++ b/src/citra_qt/configuration/configure_input.h
diff --git a/src/citra_qt/configure_input.ui b/src/citra_qt/configuration/configure_input.ui
index 2760787e5..2760787e5 100644
--- a/src/citra_qt/configure_input.ui
+++ b/src/citra_qt/configuration/configure_input.ui
diff --git a/src/citra_qt/configure_system.cpp b/src/citra_qt/configuration/configure_system.cpp
index 040185e82..a3a9015a4 100644
--- a/src/citra_qt/configure_system.cpp
+++ b/src/citra_qt/configuration/configure_system.cpp
@@ -2,7 +2,7 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
-#include "citra_qt/configure_system.h"
+#include "citra_qt/configuration/configure_system.h"
#include "citra_qt/ui_settings.h"
#include "core/core.h"
#include "core/hle/service/cfg/cfg.h"
diff --git a/src/citra_qt/configure_system.h b/src/citra_qt/configuration/configure_system.h
index db0ead13c..db0ead13c 100644
--- a/src/citra_qt/configure_system.h
+++ b/src/citra_qt/configuration/configure_system.h
diff --git a/src/citra_qt/configure_system.ui b/src/citra_qt/configuration/configure_system.ui
index cc54fa37f..cc54fa37f 100644
--- a/src/citra_qt/configure_system.ui
+++ b/src/citra_qt/configuration/configure_system.ui
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp
index fd51659b9..73b4dd34f 100644
--- a/src/citra_qt/main.cpp
+++ b/src/citra_qt/main.cpp
@@ -14,8 +14,8 @@
#include <QtGui>
#include <QtWidgets>
#include "citra_qt/bootmanager.h"
-#include "citra_qt/config.h"
-#include "citra_qt/configure_dialog.h"
+#include "citra_qt/configuration/config.h"
+#include "citra_qt/configuration/configure_dialog.h"
#include "citra_qt/debugger/callstack.h"
#include "citra_qt/debugger/disassembler.h"
#include "citra_qt/debugger/graphics/graphics.h"
@@ -612,7 +612,6 @@ void GMainWindow::OnConfigure() {
auto result = configureDialog.exec();
if (result == QDialog::Accepted) {
configureDialog.applyConfiguration();
- render_window->ReloadSetKeymaps();
config->Save();
}
}
diff --git a/src/common/framebuffer_layout.cpp b/src/common/framebuffer_layout.cpp
index 46c008d9c..a2a0e7dad 100644
--- a/src/common/framebuffer_layout.cpp
+++ b/src/common/framebuffer_layout.cpp
@@ -6,6 +6,7 @@
#include "common/assert.h"
#include "common/framebuffer_layout.h"
+#include "core/settings.h"
#include "video_core/video_core.h"
namespace Layout {
@@ -135,4 +136,22 @@ FramebufferLayout LargeFrameLayout(unsigned width, unsigned height, bool swapped
res.bottom_screen = swapped ? large_screen : small_screen;
return res;
}
+
+FramebufferLayout CustomFrameLayout(unsigned width, unsigned height) {
+ ASSERT(width > 0);
+ ASSERT(height > 0);
+
+ FramebufferLayout res{width, height, true, true, {}, {}};
+
+ MathUtil::Rectangle<unsigned> top_screen{
+ Settings::values.custom_top_left, Settings::values.custom_top_top,
+ Settings::values.custom_top_right, Settings::values.custom_top_bottom};
+ MathUtil::Rectangle<unsigned> bot_screen{
+ Settings::values.custom_bottom_left, Settings::values.custom_bottom_top,
+ Settings::values.custom_bottom_right, Settings::values.custom_bottom_bottom};
+
+ res.top_screen = top_screen;
+ res.bottom_screen = bot_screen;
+ return res;
+}
}
diff --git a/src/common/framebuffer_layout.h b/src/common/framebuffer_layout.h
index a125646a3..f1df5c55a 100644
--- a/src/common/framebuffer_layout.h
+++ b/src/common/framebuffer_layout.h
@@ -44,4 +44,12 @@ FramebufferLayout SingleFrameLayout(unsigned width, unsigned height, bool is_swa
* @return Newly created FramebufferLayout object with default screen regions initialized
*/
FramebufferLayout LargeFrameLayout(unsigned width, unsigned height, bool is_swapped);
+
+/**
+ * Factory method for constructing a custom FramebufferLayout
+ * @param width Window framebuffer width in pixels
+ * @param height Window framebuffer height in pixels
+ * @return Newly created FramebufferLayout object with default screen regions initialized
+ */
+FramebufferLayout CustomFrameLayout(unsigned width, unsigned height);
}
diff --git a/src/core/frontend/emu_window.cpp b/src/core/frontend/emu_window.cpp
index 73a44bfe7..5fdb3a7e8 100644
--- a/src/core/frontend/emu_window.cpp
+++ b/src/core/frontend/emu_window.cpp
@@ -89,17 +89,21 @@ void EmuWindow::GyroscopeChanged(float x, float y, float z) {
void EmuWindow::UpdateCurrentFramebufferLayout(unsigned width, unsigned height) {
Layout::FramebufferLayout layout;
- switch (Settings::values.layout_option) {
- case Settings::LayoutOption::SingleScreen:
- layout = Layout::SingleFrameLayout(width, height, Settings::values.swap_screen);
- break;
- case Settings::LayoutOption::LargeScreen:
- layout = Layout::LargeFrameLayout(width, height, Settings::values.swap_screen);
- break;
- case Settings::LayoutOption::Default:
- default:
- layout = Layout::DefaultFrameLayout(width, height, Settings::values.swap_screen);
- break;
+ if (Settings::values.custom_layout == true) {
+ layout = Layout::CustomFrameLayout(width, height);
+ } else {
+ switch (Settings::values.layout_option) {
+ case Settings::LayoutOption::SingleScreen:
+ layout = Layout::SingleFrameLayout(width, height, Settings::values.swap_screen);
+ break;
+ case Settings::LayoutOption::LargeScreen:
+ layout = Layout::LargeFrameLayout(width, height, Settings::values.swap_screen);
+ break;
+ case Settings::LayoutOption::Default:
+ default:
+ layout = Layout::DefaultFrameLayout(width, height, Settings::values.swap_screen);
+ break;
+ }
}
NotifyFramebufferLayoutChanged(layout);
}
diff --git a/src/core/hle/function_wrappers.h b/src/core/hle/function_wrappers.h
index 7875971ce..f6eb900f0 100644
--- a/src/core/hle/function_wrappers.h
+++ b/src/core/hle/function_wrappers.h
@@ -256,9 +256,9 @@ void Wrap() {
func(((s64)PARAM(1) << 32) | PARAM(0));
}
-template <void func(const char*)>
+template <void func(const char*, int len)>
void Wrap() {
- func((char*)Memory::GetPointer(PARAM(0)));
+ func((char*)Memory::GetPointer(PARAM(0)), PARAM(1));
}
template <void func(u8)>
diff --git a/src/core/hle/service/apt/apt.cpp b/src/core/hle/service/apt/apt.cpp
index a8ddceb8c..366d1eacf 100644
--- a/src/core/hle/service/apt/apt.cpp
+++ b/src/core/hle/service/apt/apt.cpp
@@ -600,7 +600,7 @@ void Unwrap(Service::Interface* self) {
// Decrypts the ciphertext using AES-CCM
auto pdata = HW::AES::DecryptVerifyCCM(cipher, nonce, HW::AES::KeySlotID::APTWrap);
- IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
+ IPC::RequestBuilder rb = rp.MakeBuilder(1, 4);
if (!pdata.empty()) {
// Splits the plaintext and put the nonce in between
Memory::WriteBlock(output, pdata.data(), nonce_offset);
diff --git a/src/core/hle/service/ptm/ptm.cpp b/src/core/hle/service/ptm/ptm.cpp
index 8a343a613..e373ed47a 100644
--- a/src/core/hle/service/ptm/ptm.cpp
+++ b/src/core/hle/service/ptm/ptm.cpp
@@ -138,9 +138,9 @@ void Init() {
ASSERT_MSG(archive_result.Succeeded(), "Could not open the PTM SharedExtSaveData archive!");
FileSys::Path gamecoin_path("/gamecoin.dat");
+ Service::FS::CreateFileInArchive(*archive_result, gamecoin_path, sizeof(GameCoin));
FileSys::Mode open_mode = {};
open_mode.write_flag.Assign(1);
- open_mode.create_flag.Assign(1);
// Open the file and write the default gamecoin information
auto gamecoin_result =
Service::FS::OpenFileFromArchive(*archive_result, gamecoin_path, open_mode);
diff --git a/src/core/hle/service/soc_u.cpp b/src/core/hle/service/soc_u.cpp
index dcc5c3c90..530614e6f 100644
--- a/src/core/hle/service/soc_u.cpp
+++ b/src/core/hle/service/soc_u.cpp
@@ -362,18 +362,18 @@ static void Socket(Interface* self) {
return;
}
- u32 socket_handle = static_cast<u32>(::socket(domain, type, protocol));
+ u32 ret = static_cast<u32>(::socket(domain, type, protocol));
- if ((s32)socket_handle != SOCKET_ERROR_VALUE)
- open_sockets[socket_handle] = {socket_handle, true};
+ if ((s32)ret != SOCKET_ERROR_VALUE)
+ open_sockets[ret] = {ret, true};
int result = 0;
- if ((s32)socket_handle == SOCKET_ERROR_VALUE)
- result = TranslateError(GET_ERRNO);
+ if ((s32)ret == SOCKET_ERROR_VALUE)
+ ret = TranslateError(GET_ERRNO);
cmd_buffer[0] = IPC::MakeHeader(2, 2, 0);
cmd_buffer[1] = result;
- cmd_buffer[2] = socket_handle;
+ cmd_buffer[2] = ret;
}
static void Bind(Interface* self) {
@@ -393,15 +393,15 @@ static void Bind(Interface* self) {
sockaddr sock_addr = CTRSockAddr::ToPlatform(ctr_sock_addr);
- int res = ::bind(socket_handle, &sock_addr, std::max<u32>(sizeof(sock_addr), len));
+ int ret = ::bind(socket_handle, &sock_addr, std::max<u32>(sizeof(sock_addr), len));
int result = 0;
- if (res != 0)
- result = TranslateError(GET_ERRNO);
+ if (ret != 0)
+ ret = TranslateError(GET_ERRNO);
cmd_buffer[0] = IPC::MakeHeader(5, 2, 0);
cmd_buffer[1] = result;
- cmd_buffer[2] = res;
+ cmd_buffer[2] = ret;
}
static void Fcntl(Interface* self) {
@@ -426,8 +426,7 @@ static void Fcntl(Interface* self) {
#else
int ret = ::fcntl(socket_handle, F_GETFL, 0);
if (ret == SOCKET_ERROR_VALUE) {
- result = TranslateError(GET_ERRNO);
- posix_ret = -1;
+ posix_ret = TranslateError(GET_ERRNO);
return;
}
posix_ret = 0;
@@ -439,8 +438,7 @@ static void Fcntl(Interface* self) {
unsigned long tmp = (ctr_arg & 4 /* O_NONBLOCK */) ? 1 : 0;
int ret = ioctlsocket(socket_handle, FIONBIO, &tmp);
if (ret == SOCKET_ERROR_VALUE) {
- result = TranslateError(GET_ERRNO);
- posix_ret = -1;
+ posix_ret = TranslateError(GET_ERRNO);
return;
}
auto iter = open_sockets.find(socket_handle);
@@ -449,8 +447,7 @@ static void Fcntl(Interface* self) {
#else
int flags = ::fcntl(socket_handle, F_GETFL, 0);
if (flags == SOCKET_ERROR_VALUE) {
- result = TranslateError(GET_ERRNO);
- posix_ret = -1;
+ posix_ret = TranslateError(GET_ERRNO);
return;
}
@@ -460,15 +457,13 @@ static void Fcntl(Interface* self) {
int ret = ::fcntl(socket_handle, F_SETFL, flags);
if (ret == SOCKET_ERROR_VALUE) {
- result = TranslateError(GET_ERRNO);
- posix_ret = -1;
+ posix_ret = TranslateError(GET_ERRNO);
return;
}
#endif
} else {
LOG_ERROR(Service_SOC, "Unsupported command (%d) in fcntl call", ctr_cmd);
- result = TranslateError(EINVAL); // TODO: Find the correct error
- posix_ret = -1;
+ posix_ret = TranslateError(EINVAL); // TODO: Find the correct error
return;
}
}
@@ -481,7 +476,7 @@ static void Listen(Interface* self) {
int ret = ::listen(socket_handle, backlog);
int result = 0;
if (ret != 0)
- result = TranslateError(GET_ERRNO);
+ ret = TranslateError(GET_ERRNO);
cmd_buffer[0] = IPC::MakeHeader(3, 2, 0);
cmd_buffer[1] = result;
@@ -504,7 +499,7 @@ static void Accept(Interface* self) {
int result = 0;
if ((s32)ret == SOCKET_ERROR_VALUE) {
- result = TranslateError(GET_ERRNO);
+ ret = TranslateError(GET_ERRNO);
} else {
CTRSockAddr ctr_addr = CTRSockAddr::FromPlatform(addr);
Memory::WriteBlock(cmd_buffer[0x104 >> 2], &ctr_addr, sizeof(ctr_addr));
@@ -545,7 +540,7 @@ static void Close(Interface* self) {
int result = 0;
if (ret != 0)
- result = TranslateError(GET_ERRNO);
+ ret = TranslateError(GET_ERRNO);
cmd_buffer[2] = ret;
cmd_buffer[1] = result;
@@ -589,7 +584,7 @@ static void SendTo(Interface* self) {
int result = 0;
if (ret == SOCKET_ERROR_VALUE)
- result = TranslateError(GET_ERRNO);
+ ret = TranslateError(GET_ERRNO);
cmd_buffer[2] = ret;
cmd_buffer[1] = result;
@@ -638,7 +633,7 @@ static void RecvFrom(Interface* self) {
int result = 0;
int total_received = ret;
if (ret == SOCKET_ERROR_VALUE) {
- result = TranslateError(GET_ERRNO);
+ ret = TranslateError(GET_ERRNO);
total_received = 0;
} else {
// Write only the data we received to avoid overwriting parts of the buffer with zeros
@@ -673,7 +668,7 @@ static void Poll(Interface* self) {
std::vector<pollfd> platform_pollfd(nfds);
std::transform(ctr_fds.begin(), ctr_fds.end(), platform_pollfd.begin(), CTRPollFD::ToPlatform);
- const int ret = ::poll(platform_pollfd.data(), nfds, timeout);
+ int ret = ::poll(platform_pollfd.data(), nfds, timeout);
// Now update the output pollfd structure
std::transform(platform_pollfd.begin(), platform_pollfd.end(), ctr_fds.begin(),
@@ -683,7 +678,7 @@ static void Poll(Interface* self) {
int result = 0;
if (ret == SOCKET_ERROR_VALUE)
- result = TranslateError(GET_ERRNO);
+ ret = TranslateError(GET_ERRNO);
cmd_buffer[1] = result;
cmd_buffer[2] = ret;
@@ -710,7 +705,7 @@ static void GetSockName(Interface* self) {
int result = 0;
if (ret != 0)
- result = TranslateError(GET_ERRNO);
+ ret = TranslateError(GET_ERRNO);
cmd_buffer[2] = ret;
cmd_buffer[1] = result;
@@ -724,7 +719,7 @@ static void Shutdown(Interface* self) {
int ret = ::shutdown(socket_handle, how);
int result = 0;
if (ret != 0)
- result = TranslateError(GET_ERRNO);
+ ret = TranslateError(GET_ERRNO);
cmd_buffer[2] = ret;
cmd_buffer[1] = result;
}
@@ -750,7 +745,7 @@ static void GetPeerName(Interface* self) {
int result = 0;
if (ret != 0)
- result = TranslateError(GET_ERRNO);
+ ret = TranslateError(GET_ERRNO);
cmd_buffer[2] = ret;
cmd_buffer[1] = result;
@@ -777,7 +772,7 @@ static void Connect(Interface* self) {
int ret = ::connect(socket_handle, &input_addr, sizeof(input_addr));
int result = 0;
if (ret != 0)
- result = TranslateError(GET_ERRNO);
+ ret = TranslateError(GET_ERRNO);
cmd_buffer[0] = IPC::MakeHeader(6, 2, 0);
cmd_buffer[1] = result;
@@ -815,7 +810,7 @@ static void GetSockOpt(Interface* self) {
int optname = TranslateSockOpt(cmd_buffer[3]);
socklen_t optlen = (socklen_t)cmd_buffer[4];
- int ret = -1;
+ int ret = 0;
int err = 0;
if (optname < 0) {
@@ -830,9 +825,8 @@ static void GetSockOpt(Interface* self) {
// >> 2 = convert to u32 offset instead of byte offset (cmd_buffer = u32*)
char* optval = reinterpret_cast<char*>(Memory::GetPointer(cmd_buffer[0x104 >> 2]));
- ret = ::getsockopt(socket_handle, level, optname, optval, &optlen);
- err = 0;
- if (ret == SOCKET_ERROR_VALUE) {
+ err = ::getsockopt(socket_handle, level, optname, optval, &optlen);
+ if (err == SOCKET_ERROR_VALUE) {
err = TranslateError(GET_ERRNO);
}
}
@@ -849,7 +843,7 @@ static void SetSockOpt(Interface* self) {
u32 level = cmd_buffer[2];
int optname = TranslateSockOpt(cmd_buffer[3]);
- int ret = -1;
+ int ret = 0;
int err = 0;
if (optname < 0) {
@@ -862,9 +856,8 @@ static void SetSockOpt(Interface* self) {
socklen_t optlen = static_cast<socklen_t>(cmd_buffer[4]);
const char* optval = reinterpret_cast<const char*>(Memory::GetPointer(cmd_buffer[8]));
- ret = static_cast<u32>(::setsockopt(socket_handle, level, optname, optval, optlen));
- err = 0;
- if (ret == SOCKET_ERROR_VALUE) {
+ err = static_cast<u32>(::setsockopt(socket_handle, level, optname, optval, optlen));
+ if (err == SOCKET_ERROR_VALUE) {
err = TranslateError(GET_ERRNO);
}
}
diff --git a/src/core/hle/shared_page.cpp b/src/core/hle/shared_page.cpp
index d0d92487d..5978ccdd4 100644
--- a/src/core/hle/shared_page.cpp
+++ b/src/core/hle/shared_page.cpp
@@ -6,6 +6,7 @@
#include <cstring>
#include <ctime>
#include "core/core_timing.h"
+#include "core/hle/service/ptm/ptm.h"
#include "core/hle/shared_page.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -73,6 +74,12 @@ void Init() {
// Some games wait until this value becomes 0x1, before asking running_hw
shared_page.unknown_value = 0x1;
+ // Set to a completely full battery
+ shared_page.battery_state.charge_level.Assign(
+ static_cast<u8>(Service::PTM::ChargeLevels::CompletelyFull));
+ shared_page.battery_state.is_adapter_connected.Assign(1);
+ shared_page.battery_state.is_charging.Assign(1);
+
update_time_event =
CoreTiming::RegisterEvent("SharedPage::UpdateTimeCallback", UpdateTimeCallback);
CoreTiming::ScheduleEvent(0, update_time_event);
diff --git a/src/core/hle/shared_page.h b/src/core/hle/shared_page.h
index 106e47efc..864695ae1 100644
--- a/src/core/hle/shared_page.h
+++ b/src/core/hle/shared_page.h
@@ -10,6 +10,7 @@
* write access, according to 3dbrew; this is not emulated)
*/
+#include "common/bit_field.h"
#include "common/common_funcs.h"
#include "common/common_types.h"
#include "common/swap.h"
@@ -29,6 +30,13 @@ struct DateTime {
};
static_assert(sizeof(DateTime) == 0x20, "Datetime size is wrong");
+union BatteryState {
+ u8 raw;
+ BitField<0, 1, u8> is_adapter_connected;
+ BitField<1, 1, u8> is_charging;
+ BitField<2, 3, u8> charge_level;
+};
+
struct SharedPageDef {
// Most of these names are taken from the 3dbrew page linked above.
u32_le date_time_counter; // 0
@@ -44,7 +52,7 @@ struct SharedPageDef {
INSERT_PADDING_BYTES(0x80 - 0x68); // 68
float_le sliderstate_3d; // 80
u8 ledstate_3d; // 84
- INSERT_PADDING_BYTES(1); // 85
+ BatteryState battery_state; // 85
u8 unknown_value; // 86
INSERT_PADDING_BYTES(0xA0 - 0x87); // 87
u64_le menu_title_id; // A0
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp
index 4e0c3fb8b..2db823c61 100644
--- a/src/core/hle/svc.cpp
+++ b/src/core/hle/svc.cpp
@@ -467,8 +467,8 @@ static void Break(u8 break_reason) {
}
/// Used to output a message on a debug hardware unit - does nothing on a retail unit
-static void OutputDebugString(const char* string) {
- LOG_DEBUG(Debug_Emulated, "%s", string);
+static void OutputDebugString(const char* string, int len) {
+ LOG_DEBUG(Debug_Emulated, "%.*s", len, string);
}
/// Get resource limit
diff --git a/src/core/settings.h b/src/core/settings.h
index d1a9f0da8..03c64c94c 100644
--- a/src/core/settings.h
+++ b/src/core/settings.h
@@ -15,7 +15,6 @@ enum class LayoutOption {
Default,
SingleScreen,
LargeScreen,
- Custom,
};
namespace NativeButton {
@@ -99,6 +98,15 @@ struct Values {
LayoutOption layout_option;
bool swap_screen;
+ bool custom_layout;
+ u16 custom_top_left;
+ u16 custom_top_top;
+ u16 custom_top_right;
+ u16 custom_top_bottom;
+ u16 custom_bottom_left;
+ u16 custom_bottom_top;
+ u16 custom_bottom_right;
+ u16 custom_bottom_bottom;
float bg_red;
float bg_green;
diff --git a/src/input_common/keyboard.cpp b/src/input_common/keyboard.cpp
index a8fc01f2e..0f0d10f23 100644
--- a/src/input_common/keyboard.cpp
+++ b/src/input_common/keyboard.cpp
@@ -53,6 +53,13 @@ public:
}
}
+ void ChangeAllKeyStatus(bool pressed) {
+ std::lock_guard<std::mutex> guard(mutex);
+ for (const KeyButtonPair& pair : list) {
+ pair.key_button->status.store(pressed);
+ }
+ }
+
private:
std::mutex mutex;
std::list<KeyButtonPair> list;
@@ -79,4 +86,8 @@ void Keyboard::ReleaseKey(int key_code) {
key_button_list->ChangeKeyStatus(key_code, false);
}
+void Keyboard::ReleaseAllKeys() {
+ key_button_list->ChangeAllKeyStatus(false);
+}
+
} // namespace InputCommon
diff --git a/src/input_common/keyboard.h b/src/input_common/keyboard.h
index 76359aa30..861950472 100644
--- a/src/input_common/keyboard.h
+++ b/src/input_common/keyboard.h
@@ -38,6 +38,8 @@ public:
*/
void ReleaseKey(int key_code);
+ void ReleaseAllKeys();
+
private:
std::shared_ptr<KeyButtonList> key_button_list;
};