Compare commits

...

2 Commits

Author SHA1 Message Date
Dana Yatsuta 688ef4d521
Merge 56f08ab6ba into a6914b2ddb 2024-09-14 21:02:43 +02:00
Dana Yatsuta 56f08ab6ba Load shader from command line 2022-11-11 23:33:16 +03:00
2 changed files with 12 additions and 1 deletions

View File

@ -20,6 +20,7 @@ struct mArguments {
char* cheatsFile; char* cheatsFile;
char* savestate; char* savestate;
char* bios; char* bios;
char* shader;
int logLevel; int logLevel;
int frameskip; int frameskip;

View File

@ -47,6 +47,7 @@ static const struct option _options[] = {
{ "log-level", required_argument, 0, 'l' }, { "log-level", required_argument, 0, 'l' },
{ "savestate", required_argument, 0, 't' }, { "savestate", required_argument, 0, 't' },
{ "patch", required_argument, 0, 'p' }, { "patch", required_argument, 0, 'p' },
{ "shader", required_argument, 0, 'a'},
{ "version", no_argument, 0, '\0' }, { "version", no_argument, 0, '\0' },
{ 0, 0, 0, 0 } { 0, 0, 0, 0 }
}; };
@ -81,7 +82,7 @@ static void _tableApply(const char* key, void* value, void* user) {
bool mArgumentsParse(struct mArguments* args, int argc, char* const* argv, struct mSubParser* subparsers, int nSubparsers) { bool mArgumentsParse(struct mArguments* args, int argc, char* const* argv, struct mSubParser* subparsers, int nSubparsers) {
int ch; int ch;
char options[128] = char options[128] =
"b:c:C:hl:p:s:t:" "b:c:C:hl:p:s:t:a:"
#ifdef USE_EDITLINE #ifdef USE_EDITLINE
"d" "d"
#endif #endif
@ -172,6 +173,9 @@ bool mArgumentsParse(struct mArguments* args, int argc, char* const* argv, struc
case 't': case 't':
args->savestate = strdup(optarg); args->savestate = strdup(optarg);
break; break;
case 'a':
args->shader = strdup(optarg);
break;
default: default:
for (i = 0; i < nSubparsers; ++i) { for (i = 0; i < nSubparsers; ++i) {
if (subparsers[i].parse) { if (subparsers[i].parse) {
@ -207,6 +211,9 @@ void mArgumentsApply(const struct mArguments* args, struct mSubParser* subparser
mCoreConfigSetOverrideValue(config, "bios", args->bios); mCoreConfigSetOverrideValue(config, "bios", args->bios);
mCoreConfigSetOverrideIntValue(config, "useBios", true); mCoreConfigSetOverrideIntValue(config, "useBios", true);
} }
if (args->shader) {
mCoreConfigSetOverrideValue(config, "shader", args->shader);
}
HashTableEnumerate(&args->configOverrides, _tableApply, config); HashTableEnumerate(&args->configOverrides, _tableApply, config);
int i; int i;
for (i = 0; i < nSubparsers; ++i) { for (i = 0; i < nSubparsers; ++i) {
@ -292,6 +299,9 @@ void mArgumentsDeinit(struct mArguments* args) {
free(args->bios); free(args->bios);
args->bios = 0; args->bios = 0;
free(args->shader);
args->shader = 0;
HashTableDeinit(&args->configOverrides); HashTableDeinit(&args->configOverrides);
} }