1
0
mirror of synced 2025-01-31 12:03:42 +01:00

Revert "Add config path sepcification"

This commit is contained in:
Bobby Dilley 2025-01-08 17:15:32 +00:00 committed by GitHub
parent 3bf76eba5f
commit ab1f51a72d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 39 deletions

View File

@ -1297,7 +1297,7 @@ KeyMapping getDefaultKeymap()
return defaultKeyMapping;
}
int initConfig(const char* configPath)
int initConfig()
{
config.emulateRideboard = 0;
config.emulateDriveboard = 0;
@ -1348,20 +1348,15 @@ int initConfig(const char* configPath)
}
config.inputMode = 0; // Default to all inputs
char* configFilePath = CONFIG_PATH;
if (configPath != NULL)
strcpy(configFilePath, configPath);
configFile = fopen(configFilePath, "r");
configFile = fopen(CONFIG_PATH, "r");
if (configFile == NULL)
{
printf("Warning: Cannot open %s, using default config values.\n", configFilePath);
printf("Warning: Cannot open %s, using default values.\n", CONFIG_PATH);
return 1;
}
readConfig(configFile, &config);
fclose(configFile);

View File

@ -264,7 +264,7 @@ typedef struct
} EmulatorConfig;
KeyMapping getDefaultKeymap();
int initConfig(const char* configPath);
int initConfig();
EmulatorConfig *getConfig();
char *getGameName();
char *getDVPName();

View File

@ -49,6 +49,7 @@
#include "evdevinput.h"
#define HOOK_FILE_NAME "/dev/zero"
#define BASEBOARD 0
#define EEPROM 1
#define SERIAL0 2
@ -170,11 +171,8 @@ void __attribute__((constructor)) hook_init()
act.sa_sigaction = handleSegfault;
act.sa_flags = SA_SIGINFO;
sigaction(SIGSEGV, &act, NULL);
// use unmodified version of getenv
char *(*_getenv)(const char *name) = dlsym(RTLD_NEXT, "getenv");
char* envPath = _getenv("LINDBERGH_CONFIG_PATH");
initConfig(envPath);
initConfig();
if (getConfig()->fpsLimiter == 1)
{

View File

@ -3,13 +3,11 @@
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <limits.h>
#include "evdevinput.h"
#include "version.h"
#define LD_LIBRARY_PATH "LD_LIBRARY_PATH"
#define LINDBERGH_CONFIG_PATH "LINDBERGH_CONFIG_PATH"
#define LD_PRELOAD "LD_PRELOAD"
#define PRELOAD_FILE_NAME "lindbergh.so"
#define TEAM "bobbydilley, retrofan, dkeruza-neo, doozer, francesco, rolel, caviar-x"
@ -120,7 +118,6 @@ void printUsage(char *argv[])
printf(" --list-controllers Lists available controllers and inputs\n");
printf(" --version Displays the version of the loader and team's names\n");
printf(" --help Displays this usage text\n");
printf(" --config | -c Specifies configuration path\n");
}
/**
@ -250,10 +247,8 @@ int main(int argc, char *argv[])
int gdb = 0;
int forceGame = 0;
int segaboot = 0;
int extConfig = 0;
char envConfigPath[PATH_MAX] = {0};
char forceGamePath[128] = {0};
char forceGamePath[128] = {0};
for (int i = 1; i < argc; i++)
{
if (strcmp(argv[i], "-t") == 0 || strcmp(argv[i], "--test") == 0)
@ -273,31 +268,12 @@ int main(int argc, char *argv[])
gdb = 1;
continue;
}
if (strcmp(argv[i], "--config") == 0 || strcmp(argv[i], "-c") == 0)
{
// prevent wild pointer
if (i+1 >= argc)
{
printf("Unable to read config file because it's the end of argument list\n");
break;
}
extConfig = 1;
strcpy(envConfigPath, argv[i+1]);
// skip the next argument
i += 1;
continue;
}
// Treat the argument as the game name
strcpy(forceGamePath, argv[i]);
forceGame = 1;
}
if (extConfig)
{
// always override the old environment
setenv(LINDBERGH_CONFIG_PATH, envConfigPath, 1);
}
char command[128] = {0};
strcpy(command, "./");
if (forceGame)