Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-ports-kde
Path: blob/main/emulators/fbsd-duckstation/files/patch-relocate-resources.txt
16462 views
1
Allow relocation of resource files and translations
2
3
--- CMakeLists.txt.orig 2024-06-14 05:59:32 UTC
4
+++ CMakeLists.txt
5
@@ -34,6 +34,10 @@ include(DuckStationBuildOptions)
6
# Build options. Depends on system attributes.
7
include(DuckStationBuildOptions)
8
9
+if(DEFINED DUCKSTATION_APPLICATION_DIR_PATH)
10
+ add_compile_definitions(DUCKSTATION_APPLICATION_DIR_PATH="${DUCKSTATION_APPLICATION_DIR_PATH}")
11
+endif()
12
+
13
# Set _DEBUG macro for Debug builds.
14
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
15
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
16
--- src/duckstation-qt/qthost.cpp.orig 2024-06-14 05:59:32 UTC
17
+++ src/duckstation-qt/qthost.cpp
18
@@ -503,6 +503,10 @@ void QtHost::SetResourcesDirectory()
19
20
void QtHost::SetResourcesDirectory()
21
{
22
+#ifdef DUCKSTATION_APPLICATION_DIR_PATH
23
+ // Resources' path specified at compile time
24
+ EmuFolders::Resources = Path::Canonicalize(DUCKSTATION_APPLICATION_DIR_PATH "/resources");
25
+#else
26
#ifndef __APPLE__
27
// On Windows/Linux, these are in the binary directory.
28
EmuFolders::Resources = Path::Combine(EmuFolders::AppRoot, "resources");
29
@@ -510,6 +514,7 @@ void QtHost::SetResourcesDirectory()
30
// On macOS, this is in the bundle resources directory.
31
EmuFolders::Resources = Path::Canonicalize(Path::Combine(EmuFolders::AppRoot, "../Resources"));
32
#endif
33
+#endif // DUCKSTATION_APPLICATION_DIR_PATH
34
}
35
36
bool QtHost::SetDataDirectory()
37
--- src/duckstation-qt/qttranslations.cpp.orig 2024-06-14 05:59:32 UTC
38
+++ src/duckstation-qt/qttranslations.cpp
39
@@ -80,11 +80,15 @@ void QtHost::InstallTranslator(QWidget* dialog_parent)
40
FixLanguageName(QString::fromStdString(Host::GetBaseStringSettingValue("Main", "Language", GetDefaultLanguage())));
41
42
// install the base qt translation first
43
+#ifdef DUCKSTATION_APPLICATION_DIR_PATH
44
+ const QString base_dir = QStringLiteral(DUCKSTATION_APPLICATION_DIR_PATH "/translations");
45
+#else
46
#ifndef __APPLE__
47
const QString base_dir = QStringLiteral("%1/translations").arg(qApp->applicationDirPath());
48
#else
49
const QString base_dir = QStringLiteral("%1/../Resources/translations").arg(qApp->applicationDirPath());
50
#endif
51
+#endif // DUCKSTATION_APPLICATION_DIR_PATH
52
53
// Qt base uses underscores instead of hyphens.
54
const QString qt_language = QString(language).replace(QChar('-'), QChar('_'));
55
56