mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-02 17:48:21 -04:00
Load from data/tphd/content if exists
This commit is contained in:
@@ -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
@@ -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() {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user