Remove deprecated code

This commit is contained in:
mason 2023-01-06 17:25:51 +00:00
parent 6a9bd6a2db
commit 39bdb2da55
No known key found for this signature in database
GPG key ID: 84D9278A11FA112B
23 changed files with 16 additions and 1099 deletions

View file

@ -2,42 +2,26 @@
# Copyright (C) 2022-present BrooksyTech (https://github.com/brooksytech) # Copyright (C) 2022-present BrooksyTech (https://github.com/brooksytech)
PKG_NAME="dolphinsa" PKG_NAME="dolphinsa"
PKG_VERSION="e4c007e2e1a442dbab620f91ca5f6b9b2b27dd5b"
PKG_LICENSE="GPLv2" PKG_LICENSE="GPLv2"
PKG_SITE="https://github.com/dolphin-emu/dolphin"
PKG_URL="${PKG_SITE}.git"
PKG_DEPENDS_TARGET="toolchain libevdev libdrm ffmpeg zlib libpng lzo libusb zstd ecm" PKG_DEPENDS_TARGET="toolchain libevdev libdrm ffmpeg zlib libpng lzo libusb zstd ecm"
PKG_LONGDESC="Dolphin is a GameCube / Wii emulator, allowing you to play games for these two platforms on PC with improvements. " PKG_LONGDESC="Dolphin is a GameCube / Wii emulator, allowing you to play games for these two platforms on PC with improvements. "
PKG_TOOLCHAIN="cmake"
case ${DEVICE} in PKG_PATCH_DIRS+="${DEVICE}"
handheld)
PKG_SITE="https://github.com/dolphin-emu/dolphin"
PKG_URL="${PKG_SITE}.git"
PKG_VERSION="e4c007e2e1a442dbab620f91ca5f6b9b2b27dd5b"
PKG_PATCH_DIRS+=" wayland"
;;
*)
PKG_SITE="https://github.com/rtissera/dolphin"
PKG_URL="${PKG_SITE}.git"
PKG_VERSION="0b160db48796f727311cea16072174d96b784f80"
PKG_GIT_CLONE_BRANCH="egldrm"
PKG_PATCH_DIRS+=" legacy"
;;
esac
if [ ! "${OPENGL}" = "no" ]; then if [ ! "${OPENGL}" = "no" ]; then
PKG_DEPENDS_TARGET+=" ${OPENGL} glu libglvnd" PKG_DEPENDS_TARGET+=" ${OPENGL} glu libglvnd"
PKG_CMAKE_OPTS_TARGET+=" -DENABLE_X11=OFF \
-DENABLE_EGL=ON"
fi fi
if [ "${OPENGLES_SUPPORT}" = yes ]; then if [ "${OPENGLES_SUPPORT}" = yes ]; then
PKG_DEPENDS_TARGET+=" ${OPENGLES}" PKG_DEPENDS_TARGET+=" ${OPENGLES}"
PKG_CMAKE_OPTS_TARGET+=" -DENABLE_X11=OFF \
-DENABLE_EGL=ON"
fi fi
if [ "${DISPLAYSERVER}" = "wl" ]; then if [ "${DISPLAYSERVER}" = "wl" ]; then
PKG_DEPENDS_TARGET+=" wayland ${WINDOWMANAGER} xorg-server xrandr libXi" PKG_DEPENDS_TARGET+=" wayland ${WINDOWMANAGER} xorg-server xrandr libXi"
PKG_CMAKE_OPTS_TARGET+=" -DENABLE_WAYLAND=ON \ PKG_CMAKE_OPTS_TARGET+=" -DENABLE_WAYLAND=ON"
-DENABLE_X11=OFF"
fi fi
if [ "${VULKAN_SUPPORT}" = "yes" ] if [ "${VULKAN_SUPPORT}" = "yes" ]
@ -48,7 +32,6 @@ fi
PKG_CMAKE_OPTS_TARGET+=" -DENABLE_HEADLESS=ON \ PKG_CMAKE_OPTS_TARGET+=" -DENABLE_HEADLESS=ON \
-DENABLE_EVDEV=ON \ -DENABLE_EVDEV=ON \
-DTHREADS_PTHREAD_ARG=OFF \
-DUSE_DISCORD_PRESENCE=OFF \ -DUSE_DISCORD_PRESENCE=OFF \
-DBUILD_SHARED_LIBS=OFF \ -DBUILD_SHARED_LIBS=OFF \
-DUSE_MGBA=OFF \ -DUSE_MGBA=OFF \
@ -59,7 +42,8 @@ PKG_CMAKE_OPTS_TARGET+=" -DENABLE_HEADLESS=ON \
-DENABLE_LTO=ON \ -DENABLE_LTO=ON \
-DENABLE_QT=OFF \ -DENABLE_QT=OFF \
-DENCODE_FRAMEDUMPS=OFF \ -DENCODE_FRAMEDUMPS=OFF \
-DENABLE_CLI_TOOL=OFF" -DENABLE_CLI_TOOL=OFF \
-DENABLE_X11=OFF"
makeinstall_target() { makeinstall_target() {
@ -74,16 +58,3 @@ makeinstall_target() {
cp -rf ${PKG_BUILD}/Data/Sys/* ${INSTALL}/usr/config/dolphin-emu cp -rf ${PKG_BUILD}/Data/Sys/* ${INSTALL}/usr/config/dolphin-emu
cp -rf ${PKG_DIR}/config/${DEVICE}/* ${INSTALL}/usr/config/dolphin-emu cp -rf ${PKG_DIR}/config/${DEVICE}/* ${INSTALL}/usr/config/dolphin-emu
} }
post_install() {
case ${DEVICE} in
*)
DOLPHIN_PLATFORM="wayland"
;;
esac
sed -e "s/@DOLPHIN_PLATFORM@/${DOLPHIN_PLATFORM}/g" \
-i ${INSTALL}/usr/bin/start_dolphin_gc.sh
sed -e "s/@DOLPHIN_PLATFORM@/${DOLPHIN_PLATFORM}/g" \
-i ${INSTALL}/usr/bin/start_dolphin_wii.sh
}

View file

@ -1,118 +0,0 @@
diff --git a/Source/Core/Core/HW/GCPadEmu.cpp b/Source/Core/Core/HW/GCPadEmu.cpp
index c8e7016..fb089c4 100644
--- a/Source/Core/Core/HW/GCPadEmu.cpp
+++ b/Source/Core/Core/HW/GCPadEmu.cpp
@@ -26,6 +26,7 @@ static const u16 button_bitmasks[] = {
PAD_BUTTON_Y,
PAD_TRIGGER_Z,
PAD_BUTTON_START,
+ PAD_BUTTON_HOTKEY,
0 // MIC HAX
};
@@ -37,7 +38,7 @@ static const u16 trigger_bitmasks[] = {
static const u16 dpad_bitmasks[] = {PAD_BUTTON_UP, PAD_BUTTON_DOWN, PAD_BUTTON_LEFT,
PAD_BUTTON_RIGHT};
-static const char* const named_buttons[] = {"A", "B", "X", "Y", "Z", "Start"};
+static const char* const named_buttons[] = {"A", "B", "X", "Y", "Z", "Start", "Hotkey"};
static const char* const named_triggers[] = {
// i18n: The left trigger button (labeled L on real controllers)
diff --git a/Source/Core/DolphinNoGUI/PlatformDRM.cpp b/Source/Core/DolphinNoGUI/PlatformDRM.cpp
index b210cea..77d4e86 100644
--- a/Source/Core/DolphinNoGUI/PlatformDRM.cpp
+++ b/Source/Core/DolphinNoGUI/PlatformDRM.cpp
@@ -11,6 +11,12 @@
#include "Core/Core.h"
#include "Core/State.h"
+#include "Core/HW/GCPad.h"
+#include "InputCommon/GCPadStatus.h"
+#include <fmt/format.h>
+#include "Core/Config/GraphicsSettings.h"
+#include "VideoCommon/VideoConfig.h"
+
#include <climits>
#include <cstdio>
@@ -54,9 +60,67 @@ void PlatformDRM::MainLoop()
{
while (IsRunning())
{
+ static int hotkey = 0;
+ static int slot = 0;
+ static int stereo = 0;
+
UpdateRunningFlag();
Core::HostDispatchJobs();
+ if(Pad::IsInitialized()) {
+ GCPadStatus x = Pad::GetStatus(0);
+
+ if( (x.button & PAD_BUTTON_HOTKEY) == PAD_BUTTON_HOTKEY) { // hotkey pressed
+ if(hotkey == 1) {
+ hotkey = 2;
+ }
+ } else {
+ hotkey = 1; // assure hotkey is released between actions
+ }
+
+ if(hotkey == 2) { // hotkey pressed
+ if( (x.button & PAD_BUTTON_START) == PAD_BUTTON_START) {
+ RequestShutdown();
+ hotkey = 0;
+ }
+
+ if( (x.button & PAD_TRIGGER_L) == PAD_TRIGGER_L) {
+ State::Load(slot);
+ hotkey = 0;
+ }
+ if( (x.button & PAD_TRIGGER_R) == PAD_TRIGGER_R) {
+ State::Save(slot);
+ hotkey = 0;
+ }
+ if( (x.button & PAD_BUTTON_DOWN) == PAD_BUTTON_DOWN) {
+ if(slot > 0) slot--;
+ Core::DisplayMessage(fmt::format("Slot {} selected", slot), 4000);
+ hotkey = 0;
+ }
+ if( (x.button & PAD_BUTTON_UP) == PAD_BUTTON_UP) {
+ if(slot < 10) slot++;
+ Core::DisplayMessage(fmt::format("Slot {} selected", slot), 4000);
+ hotkey = 0;
+ }
+ if( (x.button & PAD_BUTTON_Y) == PAD_BUTTON_Y) {
+ Core::SaveScreenShot();
+ hotkey = 0;
+ }
+ if( (x.button & PAD_BUTTON_X) == PAD_BUTTON_X) {
+ if(stereo == 0) {
+ Config::SetCurrent(Config::GFX_STEREO_MODE, StereoMode::SBS);
+ stereo = 1;
+ } else {
+ Config::SetCurrent(Config::GFX_STEREO_MODE, StereoMode::Off);
+ stereo = 0;
+ }
+ hotkey = 0;
+ }
+ }
+
+ }
+ //
+
// TODO: Is this sleep appropriate?
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
diff --git a/Source/Core/InputCommon/GCPadStatus.h b/Source/Core/InputCommon/GCPadStatus.h
index 7da1bbd..57d294d 100644
--- a/Source/Core/InputCommon/GCPadStatus.h
+++ b/Source/Core/InputCommon/GCPadStatus.h
@@ -27,6 +27,7 @@ enum PadButton
PAD_BUTTON_X = 0x0400,
PAD_BUTTON_Y = 0x0800,
PAD_BUTTON_START = 0x1000,
+ PAD_BUTTON_HOTKEY = 0x2000,
};
struct GCPadStatus

View file

@ -1,12 +0,0 @@
diff --git a/CMake/FindLibevdev.cmake b/CMake/FindLibevdev.cmake
index e89a5f229d..a7c73e0536 100644
--- a/CMake/FindLibevdev.cmake
+++ b/CMake/FindLibevdev.cmake
@@ -12,6 +12,7 @@ FIND_PATH(
HINTS ${PC_LIBEVDEV_INCLUDEDIR} ${PC_LIBEVDEV_INCLUDE_DIRS}
/usr/include
/usr/local/include
+ /usr/include/libevdev-1.0
${LIBEVDEV_PATH_INCLUDES}
)

View file

@ -1,203 +0,0 @@
diff --git a/Source/Core/Common/Config/Config.cpp b/Source/Core/Common/Config/Config.cpp
index 2211d0d5fb..29004787e4 100644
--- a/Source/Core/Common/Config/Config.cpp
+++ b/Source/Core/Common/Config/Config.cpp
@@ -5,6 +5,7 @@
#include <algorithm>
#include <list>
#include <map>
+#include <mutex>
#include <shared_mutex>
#include "Common/Config/Config.h"
diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64_RegCache.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64_RegCache.cpp
index dc775ef607..0802a06039 100644
--- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_RegCache.cpp
+++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_RegCache.cpp
@@ -133,13 +133,13 @@ const OpArg& Arm64GPRCache::GetGuestGPROpArg(size_t preg) const
Arm64GPRCache::GuestRegInfo Arm64GPRCache::GetGuestGPR(size_t preg)
{
ASSERT(preg < GUEST_GPR_COUNT);
- return {32, PPCSTATE_OFF(gpr[preg]), m_guest_registers[GUEST_GPR_OFFSET + preg]};
+ return {32, PPCSTATE_OFF_GPR(preg), m_guest_registers[GUEST_GPR_OFFSET + preg]};
}
Arm64GPRCache::GuestRegInfo Arm64GPRCache::GetGuestCR(size_t preg)
{
ASSERT(preg < GUEST_CR_COUNT);
- return {64, PPCSTATE_OFF(cr.fields[preg]), m_guest_registers[GUEST_CR_OFFSET + preg]};
+ return {64, PPCSTATE_OFF_CR(preg), m_guest_registers[GUEST_CR_OFFSET + preg]};
}
Arm64GPRCache::GuestRegInfo Arm64GPRCache::GetGuestByIndex(size_t index)
@@ -450,8 +450,9 @@ ARM64Reg Arm64FPRCache::R(size_t preg, RegType type)
{
// Load the high 64bits from the file and insert them in to the high 64bits of the host
// register
- ARM64Reg tmp_reg = GetReg();
- m_float_emit->LDR(64, INDEX_UNSIGNED, tmp_reg, PPC_REG, u32(PPCSTATE_OFF(ps[preg].ps1)));
+ const ARM64Reg tmp_reg = GetReg();
+ m_float_emit->LDR(64, INDEX_UNSIGNED, tmp_reg, PPC_REG,
+ static_cast<s32>(PPCSTATE_OFF_PS1(preg)));
m_float_emit->INS(64, host_reg, 1, tmp_reg, 0);
UnlockRegister(tmp_reg);
@@ -505,7 +506,7 @@ ARM64Reg Arm64FPRCache::R(size_t preg, RegType type)
}
reg.SetDirty(false);
m_float_emit->LDR(load_size, INDEX_UNSIGNED, host_reg, PPC_REG,
- u32(PPCSTATE_OFF(ps[preg].ps0)));
+ static_cast<s32>(PPCSTATE_OFF_PS0(preg)));
return host_reg;
}
default:
@@ -553,7 +554,8 @@ ARM64Reg Arm64FPRCache::RW(size_t preg, RegType type)
// We are doing a full 128bit store because it takes 2 cycles on a Cortex-A57 to do a 128bit
// store.
// It would take longer to do an insert to a temporary and a 64bit store than to just do this.
- m_float_emit->STR(128, INDEX_UNSIGNED, flush_reg, PPC_REG, u32(PPCSTATE_OFF(ps[preg].ps0)));
+ m_float_emit->STR(128, INDEX_UNSIGNED, flush_reg, PPC_REG,
+ static_cast<s32>(PPCSTATE_OFF_PS0(preg)));
break;
case REG_DUP_SINGLE:
flush_reg = GetReg();
@@ -561,7 +563,8 @@ ARM64Reg Arm64FPRCache::RW(size_t preg, RegType type)
[[fallthrough]];
case REG_DUP:
// Store PSR1 (which is equal to PSR0) in memory.
- m_float_emit->STR(64, INDEX_UNSIGNED, flush_reg, PPC_REG, u32(PPCSTATE_OFF(ps[preg].ps1)));
+ m_float_emit->STR(64, INDEX_UNSIGNED, flush_reg, PPC_REG,
+ static_cast<s32>(PPCSTATE_OFF_PS1(preg)));
break;
default:
// All other types doesn't store anything in PSR1.
@@ -688,7 +691,7 @@ void Arm64FPRCache::FlushRegister(size_t preg, bool maintain_state)
if (dirty)
{
m_float_emit->STR(store_size, INDEX_UNSIGNED, host_reg, PPC_REG,
- u32(PPCSTATE_OFF(ps[preg].ps0)));
+ static_cast<s32>(PPCSTATE_OFF_PS0(preg)));
}
if (!maintain_state)
@@ -701,12 +704,18 @@ void Arm64FPRCache::FlushRegister(size_t preg, bool maintain_state)
{
if (dirty)
{
- // If the paired registers were at the start of ppcState we could do an STP here.
- // Too bad moving them would break savestate compatibility between x86_64 and AArch64
- // m_float_emit->STP(64, INDEX_SIGNED, host_reg, host_reg, PPC_REG,
- // PPCSTATE_OFF(ps[preg].ps0));
- m_float_emit->STR(64, INDEX_UNSIGNED, host_reg, PPC_REG, u32(PPCSTATE_OFF(ps[preg].ps0)));
- m_float_emit->STR(64, INDEX_UNSIGNED, host_reg, PPC_REG, u32(PPCSTATE_OFF(ps[preg].ps1)));
+ if (PPCSTATE_OFF_PS0(preg) <= 504)
+ {
+ m_float_emit->STP(64, INDEX_SIGNED, host_reg, host_reg, PPC_REG,
+ static_cast<s32>(PPCSTATE_OFF_PS0(preg)));
+ }
+ else
+ {
+ m_float_emit->STR(64, INDEX_UNSIGNED, host_reg, PPC_REG,
+ static_cast<s32>(PPCSTATE_OFF_PS0(preg)));
+ m_float_emit->STR(64, INDEX_UNSIGNED, host_reg, PPC_REG,
+ static_cast<s32>(PPCSTATE_OFF_PS1(preg)));
+ }
}
if (!maintain_state)
diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64_RegCache.h b/Source/Core/Core/PowerPC/JitArm64/JitArm64_RegCache.h
index 9860e4843e..c1b71f1212 100644
--- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_RegCache.h
+++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_RegCache.h
@@ -22,6 +22,18 @@ static const Arm64Gen::ARM64Reg DISPATCHER_PC =
#define PPCSTATE_OFF(elem) (offsetof(PowerPC::PowerPCState, elem))
+#define PPCSTATE_OFF_ARRAY(elem, i) \
+ (offsetof(PowerPC::PowerPCState, elem[0]) + sizeof(PowerPC::PowerPCState::elem[0]) * (i))
+
+#define PPCSTATE_OFF_GPR(i) PPCSTATE_OFF_ARRAY(gpr, i)
+#define PPCSTATE_OFF_CR(i) PPCSTATE_OFF_ARRAY(cr.fields, i)
+#define PPCSTATE_OFF_SR(i) PPCSTATE_OFF_ARRAY(sr, i)
+#define PPCSTATE_OFF_SPR(i) PPCSTATE_OFF_ARRAY(spr, i)
+
+static_assert(std::is_same_v<decltype(PowerPC::PowerPCState::ps[0]), PowerPC::PairedSingle&>);
+#define PPCSTATE_OFF_PS0(i) (PPCSTATE_OFF_ARRAY(ps, i) + offsetof(PowerPC::PairedSingle, ps0))
+#define PPCSTATE_OFF_PS1(i) (PPCSTATE_OFF_ARRAY(ps, i) + offsetof(PowerPC::PairedSingle, ps1))
+
// Some asserts to make sure we will be able to load everything
static_assert(PPCSTATE_OFF(spr[1023]) <= 16380, "LDR(32bit) can't reach the last SPR");
static_assert((PPCSTATE_OFF(ps[0].ps0) % 8) == 0,
diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64_SystemRegisters.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64_SystemRegisters.cpp
index d5889fd62c..427afe8c15 100644
--- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_SystemRegisters.cpp
+++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_SystemRegisters.cpp
@@ -111,7 +111,7 @@ void JitArm64::mfsr(UGeckoInstruction inst)
JITDISABLE(bJITSystemRegistersOff);
gpr.BindToRegister(inst.RD, false);
- LDR(INDEX_UNSIGNED, gpr.R(inst.RD), PPC_REG, PPCSTATE_OFF(sr[inst.SR]));
+ LDR(INDEX_UNSIGNED, gpr.R(inst.RD), PPC_REG, PPCSTATE_OFF_SR(inst.SR));
}
void JitArm64::mtsr(UGeckoInstruction inst)
@@ -120,7 +120,7 @@ void JitArm64::mtsr(UGeckoInstruction inst)
JITDISABLE(bJITSystemRegistersOff);
gpr.BindToRegister(inst.RS, true);
- STR(INDEX_UNSIGNED, gpr.R(inst.RS), PPC_REG, PPCSTATE_OFF(sr[inst.SR]));
+ STR(INDEX_UNSIGNED, gpr.R(inst.RS), PPC_REG, PPCSTATE_OFF_SR(inst.SR));
}
void JitArm64::mfsrin(UGeckoInstruction inst)
diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStorePaired.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStorePaired.cpp
index f6a63ee2e6..91da6b2643 100644
--- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStorePaired.cpp
+++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStorePaired.cpp
@@ -77,7 +77,7 @@ void JitArm64::psq_l(UGeckoInstruction inst)
}
else
{
- LDR(INDEX_UNSIGNED, scale_reg, PPC_REG, PPCSTATE_OFF(spr[SPR_GQR0 + inst.I]));
+ //LDR(INDEX_UNSIGNED, scale_reg, PPC_REG, PPCSTATE_OFF(spr[SPR_GQR0 + inst.I]));
UBFM(type_reg, scale_reg, 16, 18); // Type
UBFM(scale_reg, scale_reg, 24, 29); // Scale
@@ -179,7 +179,7 @@ void JitArm64::psq_st(UGeckoInstruction inst)
m_float_emit.FCVTN(32, D0, VS);
}
- LDR(INDEX_UNSIGNED, scale_reg, PPC_REG, PPCSTATE_OFF(spr[SPR_GQR0 + inst.I]));
+ //LDR(INDEX_UNSIGNED, scale_reg, PPC_REG, PPCSTATE_OFF(spr[SPR_GQR0 + inst.I]));
UBFM(type_reg, scale_reg, 0, 2); // Type
UBFM(scale_reg, scale_reg, 8, 13); // Scale
diff --git a/Source/Core/DiscIO/WIACompression.cpp b/Source/Core/DiscIO/WIACompression.cpp
index 20d19c4877..10d6d67c22 100644
--- a/Source/Core/DiscIO/WIACompression.cpp
+++ b/Source/Core/DiscIO/WIACompression.cpp
@@ -165,18 +165,18 @@ bool Bzip2Decompressor::Decompress(const DecompressionBuffer& in, DecompressionB
m_started = true;
}
- constexpr auto clamped_cast = [](size_t x) {
- return static_cast<unsigned int>(
- std::min<size_t>(std::numeric_limits<unsigned int>().max(), x));
- };
+ //constexpr auto clamped_cast = [](size_t x) {
+ //return static_cast<unsigned int>(
+ //std::min<size_t>(std::numeric_limits<unsigned int>().max(), x));
+ //};
char* const in_ptr = reinterpret_cast<char*>(const_cast<u8*>(in.data.data() + *in_bytes_read));
m_stream.next_in = in_ptr;
- m_stream.avail_in = clamped_cast(in.bytes_written - *in_bytes_read);
+ //m_stream.avail_in = clamped_cast(in.bytes_written - *in_bytes_read);
char* const out_ptr = reinterpret_cast<char*>(out->data.data() + out->bytes_written);
m_stream.next_out = out_ptr;
- m_stream.avail_out = clamped_cast(out->data.size() - out->bytes_written);
+ //m_stream.avail_out = clamped_cast(out->data.size() - out->bytes_written);
const int result = BZ2_bzDecompress(&m_stream);

View file

@ -142,4 +142,4 @@ rm -rf /storage/.local/share/dolphin-emu
ln -sf /storage/.config/dolphin-emu /storage/.local/share/dolphin-emu ln -sf /storage/.config/dolphin-emu /storage/.local/share/dolphin-emu
#Run Dolphin emulator #Run Dolphin emulator
/usr/bin/dolphin-emu-nogui -p @DOLPHIN_PLATFORM@ -a HLE -e "${1}" /usr/bin/dolphin-emu-nogui -p wayland -a HLE -e "${1}"

View file

@ -153,4 +153,4 @@ rm -rf /storage/.local/share/dolphin-emu
ln -sf /storage/.config/dolphin-emu /storage/.local/share/dolphin-emu ln -sf /storage/.config/dolphin-emu /storage/.local/share/dolphin-emu
#Run Dolphin emulator #Run Dolphin emulator
/usr/bin/dolphin-emu-nogui -p @DOLPHIN_PLATFORM@ -a HLE -e "${1}" /usr/bin/dolphin-emu-nogui -p wayland -a HLE -e "${1}"

View file

@ -3,39 +3,25 @@
PKG_NAME="duckstationsa" PKG_NAME="duckstationsa"
PKG_LICENSE="GPLv3" PKG_LICENSE="GPLv3"
PKG_VERSION="06d6447e59f208f21ba42f4df1665b789db13fb7"
PKG_DEPENDS_TARGET="toolchain SDL2 nasm:host pulseaudio openssl libidn2 nghttp2 zlib curl libevdev ecm" PKG_DEPENDS_TARGET="toolchain SDL2 nasm:host pulseaudio openssl libidn2 nghttp2 zlib curl libevdev ecm"
PKG_SITE="https://github.com/stenzek/duckstation" PKG_SITE="https://github.com/stenzek/duckstation"
PKG_URL="${PKG_SITE}.git" PKG_URL="${PKG_SITE}.git"
PKG_SHORTDESC="Fast PlayStation 1 emulator for x86-64/AArch32/AArch64 " PKG_SHORTDESC="Fast PlayStation 1 emulator for x86-64/AArch32/AArch64 "
PKG_TOOLCHAIN="cmake"
case ${DEVICE} in PKG_PATCH_DIRS+="${DEVICE}"
handheld)
PKG_VERSION="06d6447e59f208f21ba42f4df1665b789db13fb7"
PKG_PATCH_DIRS+=" new"
;;
*)
PKG_VERSION="5ab5070d73f1acc51e064bd96be4ba6ce3c06f5c"
PKG_PATCH_DIRS+=" legacy"
;;
esac
if [ ! "${OPENGL}" = "no" ]; then if [ ! "${OPENGL}" = "no" ]; then
PKG_DEPENDS_TARGET+=" ${OPENGL} glu libglvnd" PKG_DEPENDS_TARGET+=" ${OPENGL} glu libglvnd"
PKG_CMAKE_OPTS_TARGET+=" -DUSE_X11=OFF"
fi fi
if [ "${OPENGLES_SUPPORT}" = yes ]; then if [ "${OPENGLES_SUPPORT}" = yes ]; then
PKG_DEPENDS_TARGET+=" ${OPENGLES}" PKG_DEPENDS_TARGET+=" ${OPENGLES}"
PKG_CMAKE_OPTS_TARGET+=" -DUSE_X11=OFF \
-DUSE_DRMKMS=ON \
-DENABLE_EGL=ON \
-DUSE_MALI=OFF \
-DENABLE_VULKAN=OFF"
fi fi
if [ "${DISPLAYSERVER}" = "wl" ]; then if [ "${DISPLAYSERVER}" = "wl" ]; then
PKG_DEPENDS_TARGET+=" wayland ${WINDOWMANAGER} xorg-server xrandr libXi" PKG_DEPENDS_TARGET+=" wayland ${WINDOWMANAGER} xorg-server xrandr libXi"
PKG_CMAKE_OPTS_TARGET+=" -DUSE_X11=OFF -DUSE_WAYLAND=ON" PKG_CMAKE_OPTS_TARGET+=" -DUSE_WAYLAND=ON"
fi fi
if [ "${VULKAN_SUPPORT}" = "yes" ]; then if [ "${VULKAN_SUPPORT}" = "yes" ]; then
@ -53,7 +39,8 @@ pre_configure_target() {
-DUSE_SDL2=ON \ -DUSE_SDL2=ON \
-DENABLE_CHEEVOS=ON \ -DENABLE_CHEEVOS=ON \
-DUSE_FBDEV=OFF \ -DUSE_FBDEV=OFF \
-DUSE_EVDEV=ON" -DUSE_EVDEV=ON \
-DUSE_X11=OFF"
} }
makeinstall_target() { makeinstall_target() {

View file

@ -1,129 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a02270e7..dbb48953 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -40,6 +40,7 @@ if(SUPPORTS_WAYLAND)
endif()
if((LINUX OR FREEBSD) OR ANDROID)
option(USE_EGL "Support EGL OpenGL context creation" ON)
+ option(USE_MALI "Link with libmali for EGL support" OFF)
endif()
if((LINUX OR FREEBSD) AND NOT ANDROID)
option(USE_DRMKMS "Support DRM/KMS OpenGL contexts" OFF)
@@ -232,7 +233,7 @@ elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86" OR ${CMAKE_SYSTEM_PROCESSOR} STR
elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm64")
set(CPU_ARCH "aarch64")
elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "armv7-a" OR
- ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "armv7l")
+ ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "armv7l" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "armv8l")
set(CPU_ARCH "aarch32")
if(ANDROID)
# Force ARM mode, since apparently ANDROID_ARM_MODE isn't working..
@@ -240,8 +241,13 @@ elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm" OR ${CMAKE_SYSTEM_PROCESSOR} STR
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -marm")
else()
# Enable NEON.
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -marm -march=armv7-a")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -marm -march=armv7-a")
+ if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "armv8l")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -marm -mtune=cortex-a55")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -marm -mtune=cortex-a55")
+ else()
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -marm -march=armv7-a")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -marm -march=armv7-a")
+ endif()
endif()
else()
message(FATAL_ERROR "Unknown system processor: " ${CMAKE_SYSTEM_PROCESSOR})
diff -u -r /home/romain/duckstation/CMakeModules/FindEGL.cmake ./CMakeModules/FindEGL.cmake
--- /home/romain/duckstation/CMakeModules/FindEGL.cmake 2021-02-13 00:29:48.693304818 +0100
+++ ./CMakeModules/FindEGL.cmake 2021-02-13 00:45:35.564462969 +0100
@@ -86,6 +86,17 @@
${PKG_EGL_LIBRARY_DIRS}
)
+if(USE_MALI)
+pkg_check_modules(PKG_MALI QUIET mali)
+find_library(MALI_LIBRARY
+ NAMES
+ mali
+ HINTS
+ ${PKG_MALI_LIBRARY_DIRS}
+)
+endif()
+
+
# NB: We do *not* use the version information from pkg-config, as that
# is the implementation version (eg: the Mesa version)
if(EGL_INCLUDE_DIR)
@@ -117,7 +128,11 @@
cmake_push_check_state(RESET)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${EGL_LIBRARY}")
+if(USE_MALI)
+list(APPEND CMAKE_REQUIRED_LIBRARIES "${MALI_LIBRARY}")
+endif()
list(APPEND CMAKE_REQUIRED_INCLUDES "${EGL_INCLUDE_DIR}")
+list(APPEND CMAKE_REQUIRED_DEFINITIONS "-DEGL_NO_X11 -DUSE_X11=NO")
check_cxx_source_compiles("
#include <EGL/egl.h>
@@ -161,7 +176,11 @@
mark_as_advanced(EGL_LIBRARY EGL_INCLUDE_DIR HAVE_EGL)
# compatibility variables
+if (USE_MALI)
+set(EGL_LIBRARIES ${EGL_LIBRARY} ${MALI_LIBRARY})
+else()
set(EGL_LIBRARIES ${EGL_LIBRARY})
+endif()
set(EGL_INCLUDE_DIRS ${EGL_INCLUDE_DIR})
set(EGL_VERSION_STRING ${EGL_VERSION})
Seulement dans ./CMakeModules: FindEGL.cmake.orig
diff -u -r /home/romain/duckstation/dep/glad/CMakeLists.txt ./dep/glad/CMakeLists.txt
--- /home/romain/duckstation/dep/glad/CMakeLists.txt 2021-02-13 00:29:48.765302377 +0100
+++ ./dep/glad/CMakeLists.txt 2021-02-13 00:42:20.848512028 +0100
@@ -17,8 +17,9 @@
target_sources(glad PRIVATE src/glad_wgl.c)
else()
if(USE_EGL)
+ target_compile_definitions(glad PRIVATE -DEGL_NO_X11)
target_sources(glad PRIVATE src/glad_egl.c)
- target_link_libraries(glad PRIVATE EGL::EGL)
+ target_link_libraries(glad PRIVATE EGL)
endif()
if(USE_X11)
target_sources(glad PRIVATE src/glad_glx.c)
diff -u -r /home/romain/duckstation/src/common/CMakeLists.txt ./src/common/CMakeLists.txt
--- /home/romain/duckstation/src/common/CMakeLists.txt 2021-02-13 00:29:48.885298307 +0100
+++ ./src/common/CMakeLists.txt 2021-02-13 00:42:20.848512028 +0100
@@ -175,12 +175,13 @@
)
endif()
if(USE_DRMKMS)
+ target_compile_definitions(common PRIVATE "-DEGL_NO_X11=1")
target_compile_definitions(common PRIVATE "-DUSE_GBM=1")
target_sources(common PRIVATE
gl/context_egl_gbm.cpp
gl/context_egl_gbm.h
)
- target_link_libraries(common PUBLIC GBM::GBM)
+ target_link_libraries(common PUBLIC gbm EGL)
endif()
endif()
diff -u -r /home/romain/duckstation/src/duckstation-nogui/CMakeLists.txt ./src/duckstation-nogui/CMakeLists.txt
--- /home/romain/duckstation/src/duckstation-nogui/CMakeLists.txt 2021-02-13 00:29:48.901297765 +0100
+++ ./src/duckstation-nogui/CMakeLists.txt 2021-02-13 00:56:19.913224314 +0100
@@ -29,6 +29,10 @@
target_compile_definitions(duckstation-nogui PRIVATE "-DUSE_LIBEVDEV=1")
target_include_directories(duckstation-nogui PRIVATE ${LIBEVDEV_INCLUDE_DIRS})
target_link_libraries(duckstation-nogui PRIVATE ${LIBEVDEV_LIBRARIES})
+if (USE_MALI)
+ target_link_libraries(duckstation-nogui PRIVATE ${MALI_LIBRARY})
+endif()
+
endif()
if(WIN32)

View file

@ -1,22 +0,0 @@
diff --git a/src/common/file_system.cpp b/src/common/file_system.cpp
index 6a24732..a287703 100644
--- a/src/common/file_system.cpp
+++ b/src/common/file_system.cpp
@@ -1179,6 +1179,8 @@ bool FileSystem::DeleteDirectory(const char* Path, bool Recursive)
std::string GetProgramPath()
{
+ return "/storage/.config/duckstation";
+
std::wstring buffer;
buffer.resize(MAX_PATH);
@@ -1549,6 +1551,8 @@ bool DeleteDirectory(const char* Path, bool Recursive)
std::string GetProgramPath()
{
+ return "/storage/.config/duckstation";
+
#if defined(__linux__)
static const char* exeFileName = "/proc/self/exe";

View file

@ -1,14 +0,0 @@
diff --git a/src/common/file_system.cpp b/src/common/file_system.cpp
index ceb2f08..0fa5a04 100644
--- a/src/common/file_system.cpp
+++ b/src/common/file_system.cpp
@@ -683,6 +683,9 @@ std::string GetDisplayNameFromPath(const std::string_view& path)
std::string_view GetPathDirectory(const std::string_view& path)
{
+
+ return "/storage/.config/duckstation";
+
std::string::size_type pos = GetLastSeperatorPosition(path, false);
if (pos == std::string_view::npos)
return {};

View file

@ -1,13 +0,0 @@
diff --git a/src/duckstation-qt/qthostinterface.cpp b/src/duckstation-qt/qthostinterface.cpp
index 8052278..4f338d7 100644
--- a/src/duckstation-qt/qthostinterface.cpp
+++ b/src/duckstation-qt/qthostinterface.cpp
@@ -137,7 +137,7 @@ void QtHostInterface::installTranslator()
const QString language(QString::fromStdString(GetStringSettingValue("Main", "Language", "en")));
// install the base qt translation first
- const QString base_dir(QStringLiteral("%1/translations").arg(qApp->applicationDirPath()));
+ const QString base_dir(QStringLiteral("%1/translations").arg("/storage/.config/duckstation"));
const QString base_path(QStringLiteral("%1/qtbase_%2.qm").arg(base_dir).arg(language));
if (QFile::exists(base_path))
{

View file

@ -1,389 +0,0 @@
diff --git a/src/common/gl/program.h b/src/common/gl/program.h
index d877a462..3fa9a7a7 100644
--- a/src/common/gl/program.h
+++ b/src/common/gl/program.h
@@ -40,6 +40,7 @@ public:
void Destroy();
int RegisterUniform(const char* name);
+ GLint GetUniformLocation(int index) const { return m_uniform_locations[index]; }
void Uniform1ui(int index, u32 x) const;
void Uniform2ui(int index, u32 x, u32 y) const;
void Uniform3ui(int index, u32 x, u32 y, u32 z) const;
@@ -97,6 +98,6 @@ private:
GLuint m_fragment_shader_id = 0;
std::vector<GLint> m_uniform_locations;
-};
+}; // namespace GL
} // namespace GL
\ No newline at end of file
diff --git a/src/core/host_display.cpp b/src/core/host_display.cpp
index d0469fd3..790be30f 100644
--- a/src/core/host_display.cpp
+++ b/src/core/host_display.cpp
@@ -103,6 +103,11 @@ bool HostDisplay::GetHostRefreshRate(float* refresh_rate)
return WindowInfo::QueryRefreshRateForWindow(m_window_info, refresh_rate);
}
+bool HostDisplay::SetDisplayRotation(Rotation rotation)
+{
+ return false;
+}
+
void HostDisplay::SetSoftwareCursor(std::unique_ptr<HostDisplayTexture> texture, float scale /*= 1.0f*/)
{
m_cursor_texture = std::move(texture);
diff --git a/src/core/host_display.h b/src/core/host_display.h
index ea01f846..b5a3563e 100644
--- a/src/core/host_display.h
+++ b/src/core/host_display.h
@@ -60,6 +60,15 @@ public:
std::vector<std::string> fullscreen_modes;
};
+ enum class Rotation
+ {
+ None,
+ R90Degrees,
+ R180Degrees,
+ R270Degrees,
+ Count
+ };
+
virtual ~HostDisplay();
ALWAYS_INLINE const WindowInfo& GetWindowInfo() const { return m_window_info; }
@@ -201,6 +210,7 @@ public:
virtual bool SetDisplayPixels(HostDisplayPixelFormat format, u32 width, u32 height, const void* buffer, u32 pitch);
virtual bool GetHostRefreshRate(float* refresh_rate);
+ virtual bool SetDisplayRotation(Rotation rotation);
void SetDisplayLinearFiltering(bool enabled) { m_display_linear_filtering = enabled; }
void SetDisplayTopMargin(s32 height) { m_display_top_margin = height; }
@@ -283,6 +293,7 @@ protected:
s32 m_display_top_margin = 0;
Alignment m_display_alignment = Alignment::Center;
+ Rotation m_display_rotation = Rotation::None;
std::unique_ptr<HostDisplayTexture> m_cursor_texture;
float m_cursor_texture_scale = 1.0f;
diff --git a/src/core/settings.cpp b/src/core/settings.cpp
index 833b6b9f..4381b848 100644
--- a/src/core/settings.cpp
+++ b/src/core/settings.cpp
@@ -230,6 +230,7 @@ void Settings::Load(SettingsInterface& si)
display_line_start_offset = static_cast<s8>(si.GetIntValue("Display", "LineStartOffset", 0));
display_line_end_offset = static_cast<s8>(si.GetIntValue("Display", "LineEndOffset", 0));
display_linear_filtering = si.GetBoolValue("Display", "LinearFiltering", true);
+ display_rotate = static_cast<s8>(si.GetIntValue("Display", "Rotate", 0));
display_integer_scaling = si.GetBoolValue("Display", "IntegerScaling", false);
display_stretch = si.GetBoolValue("Display", "Stretch", false);
display_post_processing = si.GetBoolValue("Display", "PostProcessing", false);
diff --git a/src/core/settings.h b/src/core/settings.h
index e837f8b2..199ecac7 100644
--- a/src/core/settings.h
+++ b/src/core/settings.h
@@ -136,6 +136,7 @@ struct Settings
s16 display_active_end_offset = 0;
s8 display_line_start_offset = 0;
s8 display_line_end_offset = 0;
+ s8 display_rotate = 0;
bool display_force_4_3_for_24bit = false;
bool gpu_24bit_chroma_smoothing = false;
bool display_linear_filtering = true;
diff --git a/src/duckstation-nogui/nogui_host_interface.cpp b/src/duckstation-nogui/nogui_host_interface.cpp
index 638af4ea..6cef355a 100644
--- a/src/duckstation-nogui/nogui_host_interface.cpp
+++ b/src/duckstation-nogui/nogui_host_interface.cpp
@@ -136,6 +136,15 @@ bool NoGUIHostInterface::CreateDisplay(bool fullscreen)
return false;
}
+ switch(g_settings.display_rotate & 3)
+ {
+ case 1: m_display->SetDisplayRotation(HostDisplay::Rotation::R90Degrees);
+ case 2: m_display->SetDisplayRotation(HostDisplay::Rotation::R180Degrees);
+ case 3: m_display->SetDisplayRotation(HostDisplay::Rotation::R270Degrees);
+ case 0:
+ default: break;
+ }
+
if (fullscreen)
SetFullscreen(true);
diff --git a/src/frontend-common/opengl_host_display.cpp b/src/frontend-common/opengl_host_display.cpp
index 7092b455..ff1c7939 100644
--- a/src/frontend-common/opengl_host_display.cpp
+++ b/src/frontend-common/opengl_host_display.cpp
@@ -203,6 +203,77 @@ void OpenGLHostDisplay::UpdateDisplayPixelsTextureFilter()
m_display_texture_is_linear_filtered = m_display_linear_filtering;
}
+bool OpenGLHostDisplay::SetDisplayRotation(Rotation rotation)
+{
+ m_display_rotation = rotation;
+ UpdateDisplayRotationFramebuffer();
+ return true;
+}
+
+void OpenGLHostDisplay::UpdateDisplayRotationFramebuffer()
+{
+ m_window_info.surface_width = m_gl_context->GetSurfaceWidth();
+ m_window_info.surface_height = m_gl_context->GetSurfaceHeight();
+
+ if (m_display_rotation_framebuffer_fbo != 0)
+ {
+ glDeleteFramebuffers(1, &m_display_rotation_framebuffer_fbo);
+ m_display_rotation_framebuffer_fbo = 0;
+ glDeleteTextures(1, &m_display_rotation_framebuffer_texture);
+ m_display_rotation_framebuffer_texture = 0;
+ }
+
+ if (m_display_rotation != Rotation::None)
+ {
+ if (m_display_rotation_framebuffer_texture == 0)
+ glGenTextures(1, &m_display_rotation_framebuffer_texture);
+ if (m_display_rotation_framebuffer_fbo == 0)
+ glGenFramebuffers(1, &m_display_rotation_framebuffer_fbo);
+
+ if (m_display_rotation == Rotation::R90Degrees || m_display_rotation == Rotation::R270Degrees)
+ std::swap(m_window_info.surface_width, m_window_info.surface_height);
+
+ GLint old_texture;
+ glGetIntegerv(GL_TEXTURE_BINDING_2D, &old_texture);
+
+ glBindTexture(GL_TEXTURE_2D, m_display_rotation_framebuffer_texture);
+
+ if (GLAD_GL_ARB_texture_storage || GLAD_GL_ES_VERSION_3_1)
+ {
+ glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, m_window_info.surface_width, m_window_info.surface_height);
+ }
+ else
+ {
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, m_window_info.surface_width, m_window_info.surface_height, 0, GL_RGBA,
+ GL_UNSIGNED_BYTE, nullptr);
+ }
+
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 1);
+
+ const GLenum framebuffer_binding = m_use_gles2_draw_path ? GL_FRAMEBUFFER : GL_DRAW_FRAMEBUFFER;
+ GLint old_framebuffer;
+ glGetIntegerv(m_use_gles2_draw_path ? GL_FRAMEBUFFER_BINDING : GL_DRAW_FRAMEBUFFER_BINDING, &old_framebuffer);
+
+ glBindFramebuffer(framebuffer_binding, m_display_rotation_framebuffer_fbo);
+ glFramebufferTexture2D(framebuffer_binding, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
+ m_display_rotation_framebuffer_texture, 0);
+ Assert(glCheckFramebufferStatus(framebuffer_binding) == GL_FRAMEBUFFER_COMPLETE);
+
+ glBindFramebuffer(framebuffer_binding, old_framebuffer);
+ glBindTexture(GL_TEXTURE_2D, old_texture);
+ }
+
+ if (ImGui::GetCurrentContext())
+ {
+ ImGui::GetIO().DisplaySize =
+ ImVec2(static_cast<float>(m_window_info.surface_width), static_cast<float>(m_window_info.surface_height));
+ }
+}
+
bool OpenGLHostDisplay::SupportsDisplayPixelFormat(HostDisplayPixelFormat format) const
{
const auto [gl_internal_format, gl_format, gl_type] = GetPixelFormatMapping(m_gl_context->IsGLES(), format);
@@ -435,7 +506,7 @@ bool OpenGLHostDisplay::InitializeRenderDevice(std::string_view shader_cache_dir
glDebugMessageCallback(GLDebugCallback, nullptr);
glEnable(GL_DEBUG_OUTPUT);
- // glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
+ glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
}
if (!CreateResources())
@@ -484,7 +555,17 @@ bool OpenGLHostDisplay::ChangeRenderWindow(const WindowInfo& new_wi)
return false;
}
- m_window_info = m_gl_context->GetWindowInfo();
+ m_window_info = new_wi;
+ m_window_info.surface_width = m_gl_context->GetSurfaceWidth();
+ m_window_info.surface_height = m_gl_context->GetSurfaceHeight();
+
+ if (ImGui::GetCurrentContext())
+ {
+ ImGui::GetIO().DisplaySize.x = static_cast<float>(m_window_info.surface_width);
+ ImGui::GetIO().DisplaySize.y = static_cast<float>(m_window_info.surface_height);
+ }
+
+ UpdateDisplayRotationFramebuffer();
return true;
}
@@ -494,7 +575,16 @@ void OpenGLHostDisplay::ResizeRenderWindow(s32 new_window_width, s32 new_window_
return;
m_gl_context->ResizeSurface(static_cast<u32>(new_window_width), static_cast<u32>(new_window_height));
- m_window_info = m_gl_context->GetWindowInfo();
+ m_window_info.surface_width = m_gl_context->GetSurfaceWidth();
+ m_window_info.surface_height = m_gl_context->GetSurfaceHeight();
+
+ if (ImGui::GetCurrentContext())
+ {
+ ImGui::GetIO().DisplaySize.x = static_cast<float>(m_window_info.surface_width);
+ ImGui::GetIO().DisplaySize.y = static_cast<float>(m_window_info.surface_height);
+ }
+
+ UpdateDisplayRotationFramebuffer();
}
bool OpenGLHostDisplay::SupportsFullscreen() const
@@ -560,12 +650,17 @@ bool OpenGLHostDisplay::CreateResources()
{
static constexpr char fullscreen_quad_vertex_shader[] = R"(
uniform vec4 u_src_rect;
+uniform mat2 u_rotation_matrix;
out vec2 v_tex0;
void main()
{
vec2 pos = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));
- v_tex0 = u_src_rect.xy + pos * u_src_rect.zw;
+ v_tex0 = (u_src_rect.xy + pos * u_src_rect.zw);
+
+ vec2 center = vec2(0.5, 0.5);
+ v_tex0 = center + (u_rotation_matrix * (v_tex0 - center));
+
gl_Position = vec4(pos * vec2(2.0f, -2.0f) + vec2(-1.0f, 1.0f), 0.0f, 1.0f);
}
)";
@@ -617,12 +712,14 @@ void main()
m_display_program.Bind();
m_display_program.RegisterUniform("u_src_rect");
+ m_display_program.RegisterUniform("u_rotation_matrix");
m_display_program.RegisterUniform("samp0");
- m_display_program.Uniform1i(1, 0);
+ m_display_program.Uniform1i(2, 0);
m_cursor_program.Bind();
m_cursor_program.RegisterUniform("u_src_rect");
+ m_cursor_program.RegisterUniform("u_rotation_matrix");
m_cursor_program.RegisterUniform("samp0");
- m_cursor_program.Uniform1i(1, 0);
+ m_cursor_program.Uniform1i(2, 0);
glGenVertexArrays(1, &m_display_vao);
@@ -749,7 +846,7 @@ bool OpenGLHostDisplay::Render()
}
glDisable(GL_SCISSOR_TEST);
- glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_display_rotation_framebuffer_fbo);
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
@@ -760,6 +857,12 @@ bool OpenGLHostDisplay::Render()
RenderSoftwareCursor();
+ if (m_display_rotation_framebuffer_fbo != 0)
+ {
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+ RenderRotatedFramebuffer();
+ }
+
m_gl_context->SwapBuffers();
return true;
}
@@ -833,6 +936,13 @@ void OpenGLHostDisplay::RenderDisplay()
m_display_texture_view_width, m_display_texture_view_height, m_display_linear_filtering);
}
+static const std::array<std::array<float, 4>, static_cast<u32>(HostDisplay::Rotation::Count)> s_rotation_matrices = {{
+ {{1.0f, 0.0f, 0.0f, 1.0f}},
+ {{0.0f, 1.0f, 1.0f, 0.0f}},
+ {{-1.0f, 0.0f, 0.0f, 1.0f}},
+ {{0.0f, -1.0f, -1.0f, 0.0f}},
+}};
+
static void DrawFullscreenQuadES2(s32 tex_view_x, s32 tex_view_y, s32 tex_view_width, s32 tex_view_height,
s32 tex_width, s32 tex_height)
{
@@ -879,6 +989,8 @@ void OpenGLHostDisplay::RenderDisplay(s32 left, s32 bottom, s32 width, s32 heigh
(static_cast<float>(texture_view_y) + (position_adjust * flip_adjust)) / static_cast<float>(texture_height),
(static_cast<float>(texture_view_width) - size_adjust) / static_cast<float>(texture_width),
(static_cast<float>(texture_view_height) - (size_adjust * flip_adjust)) / static_cast<float>(texture_height));
+ glUniformMatrix2fv(m_display_program.GetUniformLocation(1), 1, GL_TRUE,
+ s_rotation_matrices[static_cast<u32>(HostDisplay::Rotation::None)].data());
glBindSampler(0, linear_filter ? m_display_linear_sampler : m_display_nearest_sampler);
glBindVertexArray(m_display_vao);
glDrawArrays(GL_TRIANGLES, 0, 3);
@@ -894,6 +1006,30 @@ void OpenGLHostDisplay::RenderDisplay(s32 left, s32 bottom, s32 width, s32 heigh
}
}
+void OpenGLHostDisplay::RenderRotatedFramebuffer()
+{
+ const u32 width = m_gl_context->GetSurfaceWidth();
+ const u32 height = m_gl_context->GetSurfaceHeight();
+
+ glViewport(0, 0, width, height);
+ glDisable(GL_BLEND);
+ glDisable(GL_CULL_FACE);
+ glDisable(GL_DEPTH_TEST);
+ glDisable(GL_SCISSOR_TEST);
+ glDepthMask(GL_FALSE);
+
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ m_display_program.Bind();
+ m_display_program.Uniform4f(0, 0.0f, 0.0f, 1.0f, 1.0f);
+ glUniformMatrix2fv(m_display_program.GetUniformLocation(1), 1, GL_TRUE,
+ s_rotation_matrices[static_cast<u32>(m_display_rotation)].data());
+ glBindTexture(GL_TEXTURE_2D, m_display_rotation_framebuffer_texture);
+
+ glBindVertexArray(m_display_vao);
+ glDrawArrays(GL_TRIANGLES, 0, 3);
+}
+
void OpenGLHostDisplay::RenderSoftwareCursor()
{
if (!HasSoftwareCursor())
diff --git a/src/frontend-common/opengl_host_display.h b/src/frontend-common/opengl_host_display.h
index 23e8d700..585ab4b5 100644
--- a/src/frontend-common/opengl_host_display.h
+++ b/src/frontend-common/opengl_host_display.h
@@ -51,6 +51,8 @@ public:
bool SetPostProcessingChain(const std::string_view& config) override;
+ bool SetDisplayRotation(Rotation rotation) override;
+
std::unique_ptr<HostDisplayTexture> CreateTexture(u32 width, u32 height, u32 layers, u32 levels, u32 samples,
HostDisplayPixelFormat format, const void* data, u32 data_stride,
bool dynamic = false) override;
@@ -83,6 +85,8 @@ protected:
void BindDisplayPixelsTexture();
void UpdateDisplayPixelsTextureFilter();
+ void UpdateDisplayRotationFramebuffer();
+ void RenderRotatedFramebuffer();
void RenderDisplay();
void RenderImGui();
@@ -121,6 +125,9 @@ protected:
u32 m_display_pixels_texture_pbo_map_size = 0;
std::vector<u8> m_gles_pixels_repack_buffer;
+ GLuint m_display_rotation_framebuffer_texture = 0;
+ GLuint m_display_rotation_framebuffer_fbo = 0;
+
PostProcessingChain m_post_processing_chain;
GL::Texture m_post_processing_input_texture;
std::unique_ptr<GL::StreamBuffer> m_post_processing_ubo;

View file

@ -1,110 +0,0 @@
diff --git a/src/frontend-common/sdl_controller_interface.cpp b/src/frontend-common/sdl_controller_interface.cpp
index 20e81daf..1deac2ce 100644
--- a/src/frontend-common/sdl_controller_interface.cpp
+++ b/src/frontend-common/sdl_controller_interface.cpp
@@ -6,6 +6,7 @@
#include "core/host_interface.h"
#include "core/system.h"
#include "sdl_initializer.h"
+#include "fullscreen_ui.h"
#include <SDL.h>
#include <cmath>
Log_SetChannel(SDLControllerInterface);
@@ -93,6 +94,8 @@ void SDLControllerInterface::PollEvents()
bool SDLControllerInterface::ProcessSDLEvent(const SDL_Event* event)
{
+ if (m_slots < 0) { m_host_interface->AddOSDMessage("State Slot set to #0", 5.f); m_slots = 0; }
+
switch (event->type)
{
case SDL_CONTROLLERDEVICEADDED:
@@ -204,6 +207,7 @@ bool SDLControllerInterface::OpenGameController(int index)
cd.joystick_id = joystick_id;
cd.haptic_left_right_effect = -1;
cd.game_controller = gcontroller;
+ cd.hotkey_down = false;
#if SDL_VERSION_ATLEAST(2, 0, 9)
cd.use_game_controller_rumble = (SDL_GameControllerRumble(gcontroller, 0, 0, 0) == 0);
@@ -712,15 +716,59 @@ bool SDLControllerInterface::HandleControllerButtonEvent(const SDL_ControllerBut
m_host_interface->SetControllerNavigationButtonState(nav_button_mapping[ev->button], pressed);
}
+ if (ev->button >= MAX_NUM_BUTTONS)
+ return false;
+
+ //------ Mimic Retroarch
+ if (ev->button == SDL_CONTROLLER_BUTTON_GUIDE || ev->button == SDL_CONTROLLER_BUTTON_BACK) it->hotkey_down = pressed;
+ else if (it->hotkey_down)
+ {
+ if (!pressed)
+ switch(ev->button)
+ {
+ case SDL_CONTROLLER_BUTTON_A : m_host_interface->SaveScreenshot(); break;
+ case SDL_CONTROLLER_BUTTON_B : m_host_interface->ResetSystem(); break;
+ case SDL_CONTROLLER_BUTTON_X : if (FullscreenUI::HasActiveWindow()) FullscreenUI::CloseQuickMenu(); else FullscreenUI::OpenQuickMenu(); break;
+ case SDL_CONTROLLER_BUTTON_Y : m_host_interface->ToggleWidescreen(); break;
+ case SDL_CONTROLLER_BUTTON_START :
+ case SDL_CONTROLLER_BUTTON_LEFTSTICK :
+ case SDL_CONTROLLER_BUTTON_RIGHTSTICK : break;
+ case SDL_CONTROLLER_BUTTON_LEFTSHOULDER : m_host_interface->LoadState(false, m_slots); break;
+ case SDL_CONTROLLER_BUTTON_RIGHTSHOULDER: m_host_interface->SaveState(false, m_slots); break;
+ case SDL_CONTROLLER_BUTTON_DPAD_UP : m_slots = ++m_slots % 10; m_host_interface->AddOSDMessage(std::string("State Slot set to #") + (char)(0x30 + m_slots), 5.f); break;
+ case SDL_CONTROLLER_BUTTON_DPAD_DOWN : m_slots = (m_slots + 9) % 10; m_host_interface->AddOSDMessage(std::string("State Slot set to #") + (char)(0x30 + m_slots), 5.f); break;
+ case SDL_CONTROLLER_BUTTON_DPAD_LEFT : m_host_interface->SetRewindState(!System::IsRewinding()); break;
+ case SDL_CONTROLLER_BUTTON_DPAD_RIGHT : m_host_interface->SetFastForwardEnabled(!m_host_interface->IsFastForwardEnabled()); break;
+ default: break;
+ }
+ else
+ switch(ev->button)
+ {
+ case SDL_CONTROLLER_BUTTON_START : m_host_interface->RequestExit(); break;
+ case SDL_CONTROLLER_BUTTON_A :
+ case SDL_CONTROLLER_BUTTON_B :
+ case SDL_CONTROLLER_BUTTON_X :
+ case SDL_CONTROLLER_BUTTON_Y :
+ case SDL_CONTROLLER_BUTTON_LEFTSTICK :
+ case SDL_CONTROLLER_BUTTON_RIGHTSTICK :
+ case SDL_CONTROLLER_BUTTON_LEFTSHOULDER :
+ case SDL_CONTROLLER_BUTTON_RIGHTSHOULDER:
+ case SDL_CONTROLLER_BUTTON_DPAD_UP :
+ case SDL_CONTROLLER_BUTTON_DPAD_DOWN :
+ case SDL_CONTROLLER_BUTTON_DPAD_LEFT :
+ case SDL_CONTROLLER_BUTTON_DPAD_RIGHT :
+ default: break;
+ }
+
+ return true;
+ }
+
if (m_host_interface->IsControllerNavigationActive())
{
// UI consumed the event
return true;
}
- if (ev->button >= MAX_NUM_BUTTONS)
- return false;
-
const ButtonCallback& cb = it->button_mapping[ev->button];
if (cb)
{
diff --git a/src/frontend-common/sdl_controller_interface.h b/src/frontend-common/sdl_controller_interface.h
index 06963a5c..ffc2ffac 100644
--- a/src/frontend-common/sdl_controller_interface.h
+++ b/src/frontend-common/sdl_controller_interface.h
@@ -57,6 +57,7 @@ private:
int joystick_id;
int player_id;
bool use_game_controller_rumble;
+ bool hotkey_down;
float deadzone = 0.25f;
@@ -93,4 +94,5 @@ private:
Hook::Callback m_event_intercept_callback;
bool m_sdl_subsystem_initialized = false;
+ int m_slots = -1;
};

View file

@ -1,13 +0,0 @@
diff --git a/src/frontend-common/controller_interface.h b/src/frontend-common/controller_interface.h
index f97d0f6..563b5f4 100644
--- a/src/frontend-common/sdl_controller_interface.h
+++ b/src/frontend-common/sdl_controller_interface.h
@@ -46,7 +46,7 @@
enum : int
{
MAX_NUM_AXES = 7,
- MAX_NUM_BUTTONS = 16,
+ MAX_NUM_BUTTONS = 256,
};
struct ControllerData

View file

@ -1,17 +0,0 @@
diff --git a/src/duckstation-nogui/nogui_host_interface.cpp b/src/duckstation-nogui/nogui_host_interface.cpp
index a8e4ddf2..eda7baa3 100644
--- a/src/duckstation-nogui/nogui_host_interface.cpp
+++ b/src/duckstation-nogui/nogui_host_interface.cpp
@@ -105,10 +105,10 @@ bool NoGUIHostInterface::CreateDisplay(bool fullscreen)
Assert(!m_display);
switch (g_settings.gpu_renderer)
{
- case GPURenderer::HardwareVulkan:
+/* case GPURenderer::HardwareVulkan:
m_display = std::make_unique<FrontendCommon::VulkanHostDisplay>();
break;
-
+*/
case GPURenderer::HardwareOpenGL:
#ifndef _WIN32
default:

View file

@ -65,7 +65,6 @@ d /storage/roms/ngp 0755 root root - -
d /storage/roms/ngpc 0755 root root - - d /storage/roms/ngpc 0755 root root - -
d /storage/roms/odyssey 0755 root root - - d /storage/roms/odyssey 0755 root root - -
d /storage/roms/openbor 0755 root root - - d /storage/roms/openbor 0755 root root - -
d /storage/roms/opt 0755 root root - -
d /storage/roms/pc 0755 root root - - d /storage/roms/pc 0755 root root - -
d /storage/roms/pc88 0755 root root - - d /storage/roms/pc88 0755 root root - -
d /storage/roms/pc98 0755 root root - - d /storage/roms/pc98 0755 root root - -