Skip to content

Commit

Permalink
Adjust configuration priority
Browse files Browse the repository at this point in the history
Updated the order of priority for configuration sources to improve flexibility and user control:
  1. Command line arguments (highest priority)
  2. User configuration settings (medium priority)
  3. System-wide defaults (lowest priority)
This change ensures that user-specified values take precedence, allowing for a more intuitive configuration experience.
  • Loading branch information
AKuHAK committed Oct 18, 2024
1 parent c6c8051 commit 2a53071
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions ee/loader/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -902,14 +902,6 @@ int main(int argc, char *argv[])
memset(&sys, 0, sizeof(struct SSystemSettings));
memset(&drv, 0, sizeof(struct SDriver));

/*
* Load system settings
*/
if (load_driver("system", NULL) < 0) {
printf("ERROR: failed to load system settings\n");
return -1;
}

/*
* Debugging / testing
* Becouse PSX2 does not support command line arguments, create a file
Expand All @@ -919,7 +911,7 @@ int main(int argc, char *argv[])
//sys.sCFGFile = "pcsx2";

/*
* Parse user commands
* Parse command line parameters
*/
const char *sDVDFile = NULL;
const char *sATAMode = "no";
Expand Down Expand Up @@ -981,7 +973,7 @@ int main(int argc, char *argv[])
}

/*
* Load user/game settings
* Load user/game settings. It will not overwrite values set by command line arguments
*/
if (sys.sCFGFile != NULL) {
if (load_driver(sys.sCFGFile, NULL) < 0) {
Expand All @@ -990,6 +982,15 @@ int main(int argc, char *argv[])
}
}

/*
* Load system settings. It will not overwrite values set by command line arguments and user configurable config file
*/
if (load_driver("system", NULL) < 0) {
printf("ERROR: failed to load system settings\n");
return -1;
}


// Make sure we don't pass loader arguments to the ELF
if (iELFArgcStart == -1)
iELFArgcStart = argc;
Expand Down

0 comments on commit 2a53071

Please sign in to comment.