Revert "Add config path sepcification"
This commit is contained in:
parent
3bf76eba5f
commit
ab1f51a72d
@ -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);
|
||||
|
@ -264,7 +264,7 @@ typedef struct
|
||||
} EmulatorConfig;
|
||||
|
||||
KeyMapping getDefaultKeymap();
|
||||
int initConfig(const char* configPath);
|
||||
int initConfig();
|
||||
EmulatorConfig *getConfig();
|
||||
char *getGameName();
|
||||
char *getDVPName();
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user