Load from data/tphd/content if exists

This commit is contained in:
Luke Street
2026-05-30 15:38:33 -06:00
parent 7c17b1f5f7
commit 458ffb17c2
3 changed files with 25 additions and 3 deletions
+2
View File
@@ -2,6 +2,7 @@
#define DUSK_CONFIG_H
#include <array>
#include <filesystem>
#include "dusk/config_var.hpp"
@@ -274,6 +275,7 @@ struct UserSettings {
UserSettings& getSettings();
std::filesystem::path tphd_content_path();
bool tphd_active();
void registerSettings();
+22 -2
View File
@@ -1,5 +1,8 @@
#include "dusk/settings.h"
#include "dusk/config.hpp"
#include "dusk/main.h"
#include <system_error>
namespace dusk {
@@ -189,9 +192,26 @@ UserSettings& getSettings() {
return g_userSettings;
}
bool tphd_active() {
std::filesystem::path tphd_content_path() {
#if DUSK_TPHD
const std::string& hdPath = g_userSettings.backend.hdContentPath;
return !hdPath.empty();
if (!hdPath.empty()) {
return hdPath;
}
if (!ConfigPath.empty()) {
std::error_code ec;
auto localPath = ConfigPath / "tphd" / "content";
if (std::filesystem::is_directory(localPath, ec)) {
return localPath;
}
}
#endif
return {};
}
bool tphd_active() {
return !tphd_content_path().empty();
}
void registerSettings() {
+1 -1
View File
@@ -740,7 +740,7 @@ int game_main(int argc, char* argv[]) {
#if DUSK_TPHD
{
const std::string& hdPath = dusk::getSettings().backend.hdContentPath;
const auto hdPath = dusk::tphd_content_path();
if (!hdPath.empty()) {
dusk::tphd::set_hd_content_path(hdPath);
}