mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-08-20 05:16:24 -04:00
Merge remote-tracking branch 'origin/main' into feature/dynamic-aspect-ratio
This commit is contained in:
+57
-5
@@ -44,11 +44,12 @@
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
#include "SSystem/SComponent/c_API.h"
|
||||
#include "dusk/app_info.hpp"
|
||||
#include "dusk/dusk.h"
|
||||
#include "dusk/logging.h"
|
||||
#include "dusk/time.h"
|
||||
#include "dusk/main.h"
|
||||
#include "dusk/imgui/ImGuiEngine.hpp"
|
||||
#include "dusk/logging.h"
|
||||
#include "dusk/main.h"
|
||||
#include "dusk/time.h"
|
||||
|
||||
#include <aurora/aurora.h>
|
||||
#include <aurora/event.h>
|
||||
@@ -56,7 +57,9 @@
|
||||
#include <aurora/dvd.h>
|
||||
#include <dolphin/dvd.h>
|
||||
|
||||
#include "SDL3/SDL_filesystem.h"
|
||||
#include "cxxopts.hpp"
|
||||
#include "dusk/config.hpp"
|
||||
|
||||
// --- GLOBALS ---
|
||||
s8 mDoMain::developmentMode = -1;
|
||||
@@ -107,6 +110,7 @@ s32 LOAD_COPYDATE(void*) {
|
||||
}
|
||||
|
||||
AuroraInfo auroraInfo;
|
||||
const char* configPath;
|
||||
|
||||
void main01(void) {
|
||||
OS_REPORT("\x1b[m");
|
||||
@@ -233,10 +237,51 @@ static void aurora_imgui_init_callback(const AuroraWindowSize* size) {
|
||||
dusk::ImGuiEngine_Initialize(size->scale);
|
||||
}
|
||||
|
||||
static void ApplyCVarOverrides(const cxxopts::OptionValue& option) {
|
||||
if (option.count() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& cVars = option.as<std::vector<std::string>>();
|
||||
for (const auto& cvarArg : cVars) {
|
||||
const auto sep = cvarArg.find('=');
|
||||
if (sep == std::string::npos) {
|
||||
DuskLog.fatal("--cvar argument has no '=': '{}'", cvarArg);
|
||||
continue;
|
||||
}
|
||||
|
||||
const auto name = std::string_view(cvarArg).substr(0, sep);
|
||||
const auto value = std::string_view(cvarArg).substr(sep + 1);
|
||||
|
||||
const auto cVar = dusk::config::GetConfigVar(name);
|
||||
if (!cVar) {
|
||||
DuskLog.fatal("Unknown --cvar name: '{}'", name);
|
||||
}
|
||||
|
||||
try {
|
||||
cVar->getImpl()->loadFromArg(*cVar, value);
|
||||
} catch (const std::exception& e) {
|
||||
DuskLog.fatal("Unable to parse: '{}': {}", value, e.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static const char* CalculateConfigPath() {
|
||||
const auto result = SDL_GetPrefPath(dusk::OrgName, dusk::AppName);
|
||||
if (!result) {
|
||||
DuskLog.fatal("Unable to get PrefPath: {}", SDL_GetError());
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// PC ENTRY POINT
|
||||
// =========================================================================
|
||||
int game_main(int argc, char* argv[]) {
|
||||
dusk::registerSettings();
|
||||
dusk::config::FinishRegistration();
|
||||
|
||||
cxxopts::ParseResult parsed_arg_options;
|
||||
|
||||
try {
|
||||
@@ -246,7 +291,8 @@ int game_main(int argc, char* argv[]) {
|
||||
("l,log-level", "Log level from " + std::to_string(AuroraLogLevel::LOG_DEBUG) + " to " + std::to_string(AuroraLogLevel::LOG_FATAL), cxxopts::value<uint8_t>()->default_value("0"))
|
||||
("h,help", "Print usage")
|
||||
("dvd", "Path to DVD image file", cxxopts::value<std::string>()->default_value("game.iso"))
|
||||
("backend", "Graphics API backend to use (auto, d3d11, d3d12, metal, vulkan, opengl, opengles, webgpu, null)", cxxopts::value<std::string>()->default_value("auto"));
|
||||
("backend", "Graphics API backend to use (auto, d3d11, d3d12, metal, vulkan, opengl, opengles, webgpu, null)", cxxopts::value<std::string>()->default_value("auto"))
|
||||
("cvar", "Override configuration variables without modifying config", cxxopts::value<std::vector<std::string>>());
|
||||
|
||||
arg_options.parse_positional({"dvd"});
|
||||
arg_options.positional_help("<dvd-image>");
|
||||
@@ -265,8 +311,14 @@ int game_main(int argc, char* argv[]) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
configPath = CalculateConfigPath();
|
||||
|
||||
dusk::config::LoadFromUserPreferences();
|
||||
ApplyCVarOverrides(parsed_arg_options["cvar"]);
|
||||
|
||||
AuroraConfig config{};
|
||||
config.appName = "Dusk";
|
||||
config.appName = dusk::AppName;
|
||||
config.configPath = configPath;
|
||||
config.windowPosX = -1;
|
||||
config.windowPosY = -1;
|
||||
config.windowWidth = FB_WIDTH * 2;
|
||||
|
||||
Reference in New Issue
Block a user