From 45b17ed7c245691c4fb565036e3055a6469e25ec Mon Sep 17 00:00:00 2001
From: 1024x2
Date: Mon, 6 May 2024 15:17:26 +0100
Subject: Initial commit

---
 games-emulation/simple64-gui/files/fix-paths.patch | 43 +++++++++++++++++
 .../simple64-gui/simple64-gui-9999.ebuild          | 56 ++++++++++++++++++++++
 2 files changed, 99 insertions(+)
 create mode 100644 games-emulation/simple64-gui/files/fix-paths.patch
 create mode 100644 games-emulation/simple64-gui/simple64-gui-9999.ebuild

(limited to 'games-emulation/simple64-gui')

diff --git a/games-emulation/simple64-gui/files/fix-paths.patch b/games-emulation/simple64-gui/files/fix-paths.patch
new file mode 100644
index 0000000..e153eb6
--- /dev/null
+++ b/games-emulation/simple64-gui/files/fix-paths.patch
@@ -0,0 +1,43 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 4f967af..bb8833b 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -11,6 +11,12 @@ endif()
+ include_directories(../mupen64plus-core/src/api)
+ 
+ add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x0602ff -DNETPLAY_VER=16)
++if(DEFINED PLUGIN_DIR_PATH)
++    add_definitions(-DPLUGIN_DIR_PATH="${PLUGIN_DIR_PATH}")
++endif()
++if(DEFINED CORE_LIBRARY_PATH)
++    add_definitions(-DCORE_LIBRARY_PATH="${CORE_LIBRARY_PATH}")
++endif()
+ 
+ if(DEFINED ENV{NETPLAY_AUTH_CODE})
+   add_definitions(-DNETPLAY_AUTH_CODE="$ENV{NETPLAY_AUTH_CODE}")
+diff --git a/cheats.cpp b/cheats.cpp
+index 84bac85..475b7a2 100644
+--- a/cheats.cpp
++++ b/cheats.cpp
+@@ -229,7 +229,7 @@ QString getCheatGameName()
+ 
+ QJsonObject loadCheatData(QString gameName)
+ {
+-    QString cheats_path = QDir(QCoreApplication::applicationDirPath()).filePath("cheats.json");
++    QString cheats_path = QDir(QStringLiteral(u"/usr/share/mupen64plus")).filePath("cheats.json");
+     QFile file(cheats_path);
+     file.open(QIODevice::ReadOnly | QIODevice::Text);
+ 
+diff --git a/mainwindow.cpp b/mainwindow.cpp
+index 2d46d81..3c29dd3 100644
+--- a/mainwindow.cpp
++++ b/mainwindow.cpp
+@@ -353,7 +353,7 @@ void MainWindow::updateApp()
+ 
+ void MainWindow::setupDiscord()
+ {
+-    QLibrary *discordLib = new QLibrary((QDir(QCoreApplication::applicationDirPath()).filePath("discord_game_sdk")), this);
++    QLibrary *discordLib = new QLibrary(QStringLiteral("discord_game_sdk"), this);
+ 
+     memset(&discord_app, 0, sizeof(discord_app));
+ 
diff --git a/games-emulation/simple64-gui/simple64-gui-9999.ebuild b/games-emulation/simple64-gui/simple64-gui-9999.ebuild
new file mode 100644
index 0000000..c18d794
--- /dev/null
+++ b/games-emulation/simple64-gui/simple64-gui-9999.ebuild
@@ -0,0 +1,56 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake
+
+DESCRIPTION="Accurate Nintendo 64 Emulator, GUI frontend"
+HOMEPAGE="https://simple64.github.io/"
+
+if [[ ${PV} == 9999 ]] ; then
+	inherit git-r3
+	EGIT_REPO_URI="https://github.com/simple64/mupen64plus-gui.git"
+else
+	_git_commit="5e2995912bf712deac247b1cd7d768f6d7f0ceb3"
+	SRC_URI="https://github.com/simple64/mupen64plus-gui/archive/${_git_commit}.tar.gz -> ${PN}-${_git_commit}.tar.gz"
+	KEYWORDS="~amd64 ~x86"
+fi
+
+LICENSE="GPL-2 Apache-2.0 BSD-2 LGPL-2.1+ ZLIB BitstreamVera"
+SLOT="0/${PV}"
+IUSE="discord"
+
+DEPEND="
+	games-emulation/simple64-core:=
+	dev-qt/qtbase:6=[widgets]
+	dev-qt/qtwebsockets:6=
+	discord? ( dev-libs/discord-game-sdk )
+"
+RDEPEND="${DEPEND}"
+
+PATCHES=(
+	"${FILESDIR}/fix-paths.patch"
+)
+
+src_prepare() {
+	local commit="${_git_commit}"
+	if [[ ${PV} == 9999 ]]; then
+		commit="$(git rev-parse HEAD)"
+	fi
+	echo "#define GUI_VERSION \"${_git_commit}\"" >version.h
+	sed -i 's|include_directories(../mupen64plus-core/src/api)|include_directories(/usr/include/mupen64plus)|' CMakeLists.txt
+	cmake_src_prepare
+}
+
+src_configure() {
+	local mycmakeargs=(
+		-DCORE_LIBRARY_PATH="/usr/$(get_libdir)"
+		-DPLUGIN_DIR_PATH="/usr/$(get_libdir)/mupen64plus"
+	)
+	cmake_src_configure
+}
+
+src_install() {
+	dobin "${BUILD_DIR}/simple64-gui"
+}
-- 
cgit v1.2.3