eliminat soport per a arguments

This commit is contained in:
2026-04-14 13:09:54 +02:00
parent cf7ea6cc9c
commit 4ac34b8583
17 changed files with 53 additions and 100 deletions

View File

@@ -3,15 +3,13 @@
#include <SDL3/SDL.h> // Para SDL_SetLogPriority, SDL_LogCategory, SDL_LogPriority, SDL_Quit
#include <cstdlib> // Para srand, exit, rand, EXIT_FAILURE
#include <ctime> // Para time
#include <filesystem> // Para path, absolute
#include <fstream> // Para ifstream, ofstream
#include <iostream> // Para basic_ostream, operator<<, cerr
#include <memory> // Para make_unique, unique_ptr
#include <span> // Para span
#include <stdexcept> // Para runtime_error
#include <string> // Para allocator, basic_string, char_traits, operator+, string, operator==
#include <cstdlib> // Para srand, exit, rand, EXIT_FAILURE
#include <ctime> // Para time
#include <fstream> // Para ifstream, ofstream
#include <iostream> // Para basic_ostream, operator<<, cerr
#include <memory> // Para make_unique, unique_ptr
#include <stdexcept> // Para runtime_error
#include <string> // Para allocator, basic_string, char_traits, operator+, string, operator==
#include "asset.hpp" // Para Asset
#include "audio.hpp" // Para Audio
@@ -38,10 +36,9 @@
#include "system_utils.hpp" // Para createApplicationFolder, resultToString, Result
#include "ui/notifier.hpp" // Para Notifier
#include "ui/service_menu.hpp" // Para ServiceMenu
#include "utils.hpp" // Para Overrides, overrides
// Constructor
Director::Director(int argc, std::span<char*> argv) {
Director::Director() {
Section::attract_mode = Section::AttractMode::TITLE_TO_DEMO;
// Establece el nivel de prioridad de la categoría de registro
@@ -53,8 +50,9 @@ Director::Director(int argc, std::span<char*> argv) {
std::cout << "Game start\n";
// Comprueba los parametros del programa
checkProgramArguments(argc, argv);
// Obtener la ruta del ejecutable desde SDL
const char* base_path = SDL_GetBasePath();
executable_path_ = (base_path != nullptr) ? base_path : "";
// Crea la carpeta del sistema donde guardar los datos persistentes
createSystemFolder("jailgames");
@@ -173,11 +171,7 @@ void Director::loadScoreFile() {
#ifdef _DEBUG
manager->clear();
#else
if (overrides.clear_hi_score_table) {
manager->clear();
} else {
manager->loadFromFile(Asset::get()->getPath("score.bin"));
}
manager->loadFromFile(Asset::get()->getPath("score.bin"));
#endif
}
@@ -199,29 +193,6 @@ void Director::loadAssets() {
}
}
// Comprueba los parametros del programa
void Director::checkProgramArguments(int argc, std::span<char*> argv) {
// Obtener la ruta absoluta del ejecutable
std::filesystem::path exe_path = std::filesystem::absolute(argv[0]);
executable_path_ = exe_path.parent_path().string();
// Asegurar que termine con separador de directorio
if (!executable_path_.empty() && executable_path_.back() != '/' && executable_path_.back() != '\\') {
executable_path_ += "/";
}
// Comprueba el resto de parámetros
for (int i = 1; i < argc; ++i) {
std::string arg = argv[i];
if (arg == "--320x240") {
overrides.param_file = arg;
} else if (arg == "--clear_score") {
overrides.clear_hi_score_table = true;
}
}
}
// Carga debug.yaml desde la carpeta del sistema (solo en _DEBUG)
void Director::loadDebugConfig() {
const std::string DEBUG_FILE = system_folder_ + "/debug.yaml";