mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2025-12-22 07:52:18 +00:00
Merge ceeb831436 into ada0db62dc
This commit is contained in:
commit
29ea0c49b4
10 changed files with 35 additions and 26 deletions
|
|
@ -4,10 +4,6 @@ if (WIN32)
|
|||
option(UNLEASHED_RECOMP_D3D12 "Add D3D12 support for rendering" ON)
|
||||
endif()
|
||||
|
||||
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
option(UNLEASHED_RECOMP_FLATPAK "Configure the build for Flatpak compatibility." OFF)
|
||||
endif()
|
||||
|
||||
function(BIN2C)
|
||||
cmake_parse_arguments(BIN2C_ARGS "" "TARGET_OBJ;SOURCE_FILE;DEST_FILE;ARRAY_NAME;COMPRESSION_TYPE" "" ${ARGN})
|
||||
|
||||
|
|
@ -303,13 +299,6 @@ else()
|
|||
add_executable(UnleashedRecomp ${UNLEASHED_RECOMP_CXX_SOURCES})
|
||||
endif()
|
||||
|
||||
if (UNLEASHED_RECOMP_FLATPAK)
|
||||
target_compile_definitions(UnleashedRecomp PRIVATE
|
||||
"UNLEASHED_RECOMP_FLATPAK"
|
||||
"GAME_INSTALL_DIRECTORY=\"/var/data\""
|
||||
)
|
||||
endif()
|
||||
|
||||
if (UNLEASHED_RECOMP_D3D12)
|
||||
find_package(directx-headers CONFIG REQUIRED)
|
||||
find_package(directx12-agility CONFIG REQUIRED)
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ PPC_FUNC_IMPL(__imp__sub_824EB490);
|
|||
PPC_FUNC(sub_824EB490)
|
||||
{
|
||||
App::s_isInit = true;
|
||||
App::s_isMissingDLC = !Installer::checkAllDLC(GetGamePath());
|
||||
App::s_isMissingDLC = !Installer::checkAllDLC(g_gameInstallPath);
|
||||
App::s_language = Config::Language;
|
||||
|
||||
SWA::SGlobals::Init();
|
||||
|
|
|
|||
|
|
@ -315,11 +315,11 @@ uint32_t XamContentCreateEx(uint32_t dwUserIndex, const char* szRootName, const
|
|||
}
|
||||
else if (pContentData->dwContentType == XCONTENTTYPE_DLC)
|
||||
{
|
||||
root = GAME_INSTALL_DIRECTORY "/dlc";
|
||||
root = g_gameInstallPath / "dlc";
|
||||
}
|
||||
else
|
||||
{
|
||||
root = GAME_INSTALL_DIRECTORY;
|
||||
root = g_gameInstallPath;
|
||||
}
|
||||
|
||||
XamRegisterContent(*pContentData, root);
|
||||
|
|
|
|||
|
|
@ -69,8 +69,12 @@ void KiSystemStartup()
|
|||
|
||||
const auto gameContent = XamMakeContent(XCONTENTTYPE_RESERVED, "Game");
|
||||
const auto updateContent = XamMakeContent(XCONTENTTYPE_RESERVED, "Update");
|
||||
XamRegisterContent(gameContent, GAME_INSTALL_DIRECTORY "/game");
|
||||
XamRegisterContent(updateContent, GAME_INSTALL_DIRECTORY "/update");
|
||||
|
||||
std::u8string gamePathU8 = (g_gameInstallPath / "game").u8string();
|
||||
std::u8string updatePathU8 = (g_gameInstallPath / "update").u8string();
|
||||
|
||||
XamRegisterContent(gameContent, (const char*)(gamePathU8.c_str()));
|
||||
XamRegisterContent(updateContent, (const char*)(updatePathU8.c_str()));
|
||||
|
||||
const auto saveFilePath = GetSaveFilePath(true);
|
||||
bool saveFileExists = std::filesystem::exists(saveFilePath);
|
||||
|
|
@ -102,7 +106,7 @@ void KiSystemStartup()
|
|||
XamContentCreateEx(0, "D", &gameContent, OPEN_EXISTING, nullptr, nullptr, 0, 0, nullptr);
|
||||
|
||||
std::error_code ec;
|
||||
for (auto& file : std::filesystem::directory_iterator(GAME_INSTALL_DIRECTORY "/dlc", ec))
|
||||
for (auto& file : std::filesystem::directory_iterator(g_gameInstallPath / "dlc", ec))
|
||||
{
|
||||
if (file.is_directory())
|
||||
{
|
||||
|
|
@ -321,7 +325,7 @@ int main(int argc, char *argv[])
|
|||
HostStartup();
|
||||
|
||||
std::filesystem::path modulePath;
|
||||
bool isGameInstalled = Installer::checkGameInstall(GAME_INSTALL_DIRECTORY, modulePath);
|
||||
bool isGameInstalled = Installer::checkGameInstall(g_gameInstallPath, modulePath);
|
||||
bool runInstallerWizard = forceInstaller || forceDLCInstaller || !isGameInstalled;
|
||||
if (runInstallerWizard)
|
||||
{
|
||||
|
|
@ -331,7 +335,7 @@ int main(int argc, char *argv[])
|
|||
std::_Exit(1);
|
||||
}
|
||||
|
||||
if (!InstallerWizard::Run(GAME_INSTALL_DIRECTORY, isGameInstalled && forceDLCInstaller))
|
||||
if (!InstallerWizard::Run(g_gameInstallPath, isGameInstalled && forceDLCInstaller))
|
||||
{
|
||||
std::_Exit(0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ void ModLoader::Init()
|
|||
{
|
||||
configIni = {};
|
||||
|
||||
if (!configIni.read(GAME_INSTALL_DIRECTORY "/cpkredir.ini"))
|
||||
if (!configIni.read(g_gameInstallPath / "cpkredir.ini"))
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,14 @@
|
|||
#include <ui/game_window.h>
|
||||
#include <user/paths.h>
|
||||
|
||||
#if defined(__linux__)
|
||||
const bool g_isRunningUnderFlatpak = []()
|
||||
{
|
||||
std::error_code ec;
|
||||
return std::filesystem::exists("/.flatpak-info", ec);
|
||||
}();
|
||||
#endif
|
||||
|
||||
std::vector<IConfigDef*> g_configDefinitions;
|
||||
|
||||
#define CONFIG_DEFINE_ENUM_TEMPLATE(type) \
|
||||
|
|
|
|||
|
|
@ -2,6 +2,10 @@
|
|||
|
||||
#include <locale/locale.h>
|
||||
|
||||
#if defined(__linux__)
|
||||
extern const bool g_isRunningUnderFlatpak;
|
||||
#endif
|
||||
|
||||
class IConfigDef
|
||||
{
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
std::filesystem::path g_executableRoot = os::process::GetExecutablePath().remove_filename();
|
||||
std::filesystem::path g_userPath = BuildUserPath();
|
||||
extern const std::filesystem::path g_gameInstallPath = GetGamePath();
|
||||
|
||||
bool CheckPortable()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,23 +1,26 @@
|
|||
#pragma once
|
||||
|
||||
#include <mod/mod_loader.h>
|
||||
#include "config.h"
|
||||
|
||||
#define USER_DIRECTORY "UnleashedRecomp"
|
||||
|
||||
#ifndef GAME_INSTALL_DIRECTORY
|
||||
#define GAME_INSTALL_DIRECTORY "."
|
||||
#endif
|
||||
|
||||
extern std::filesystem::path g_executableRoot;
|
||||
|
||||
inline std::filesystem::path GetGamePath()
|
||||
{
|
||||
return GAME_INSTALL_DIRECTORY;
|
||||
#if defined(__linux__)
|
||||
if (g_isRunningUnderFlatpak)
|
||||
return "/var/data";
|
||||
else
|
||||
#endif
|
||||
return ".";
|
||||
}
|
||||
|
||||
bool CheckPortable();
|
||||
std::filesystem::path BuildUserPath();
|
||||
const std::filesystem::path& GetUserPath();
|
||||
extern const std::filesystem::path g_gameInstallPath;
|
||||
|
||||
inline std::filesystem::path GetSavePath(bool checkForMods)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
"name": "UnleashedRecomp",
|
||||
"buildsystem": "simple",
|
||||
"build-commands": [
|
||||
"cmake --preset linux-release -DUNLEASHED_RECOMP_FLATPAK=ON -DSDL2MIXER_VORBIS=VORBISFILE -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache",
|
||||
"cmake --preset linux-release -DSDL2MIXER_VORBIS=VORBISFILE -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache",
|
||||
"cmake --build out/build/linux-release --target UnleashedRecomp",
|
||||
"mkdir -p /app/bin",
|
||||
"cp out/build/linux-release/UnleashedRecomp/UnleashedRecomp /app/bin/UnleashedRecomp",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue