multiuser.patch 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. diff --git a/Src/OSD/SDL/Main.cpp b/Src/OSD/SDL/Main.cpp
  2. --- a/Src/OSD/SDL/Main.cpp
  3. +++ b/Src/OSD/SDL/Main.cpp
  4. @@ -307,7 +307,6 @@
  5. Configuration file management and input settings.
  6. ******************************************************************************/
  7. -#define CONFIG_FILE_PATH "Config/Supermodel.ini"
  8. #define CONFIG_FILE_COMMENT ";\n" \
  9. "; Supermodel Configuration File\n" \
  10. ";\n"
  11. @@ -315,9 +314,13 @@
  12. // Create and configure inputs
  13. static bool ConfigureInputs(CInputs *Inputs, bool configure)
  14. {
  15. + char configFilePath[512];
  16. +
  17. + sprintf(configFilePath, "%s/.supermodel/supermodel.ini", getenv("HOME"));
  18. +
  19. // Open and parse configuration file
  20. CINIFile INI;
  21. - INI.Open(CONFIG_FILE_PATH); // doesn't matter if it exists or not, will get overwritten
  22. + INI.Open(configFilePath); // doesn't matter if it exists or not, will get overwritten
  23. INI.SetDefaultSectionName("Global");
  24. INI.Parse();
  25. @@ -338,9 +341,9 @@
  26. Inputs->WriteToINIFile(&INI, "Global");
  27. if (OKAY != INI.Write(CONFIG_FILE_COMMENT))
  28. - ErrorLog("Unable to save configuration to '%s'.", CONFIG_FILE_PATH);
  29. + ErrorLog("Unable to save configuration to '%s'.", configFilePath);
  30. else
  31. - printf("Configuration successfully saved to '%s'.\n", CONFIG_FILE_PATH);
  32. + printf("Configuration successfully saved to '%s'.\n", configFilePath);
  33. }
  34. else
  35. puts("Configuration aborted...");
  36. @@ -412,9 +415,13 @@
  37. // Read settings (from a specific section) from the config file
  38. static void ReadConfigFile(const char *section)
  39. {
  40. + char configFilePath[512];
  41. +
  42. + sprintf(configFilePath, "%s/.supermodel/supermodel.ini", getenv("HOME"));
  43. +
  44. CINIFile INI;
  45. - INI.Open(CONFIG_FILE_PATH);
  46. + INI.Open(configFilePath);
  47. INI.SetDefaultSectionName("Global"); // required to read settings not associated with a specific section
  48. INI.Parse();
  49. ApplySettings(&INI, section);
  50. @@ -498,10 +505,10 @@
  51. static void SaveState(CModel3 *Model3)
  52. {
  53. CBlockFile SaveState;
  54. - char filePath[24];
  55. + char filePath[512];
  56. int fileVersion = STATE_FILE_VERSION;
  57. - sprintf(filePath, "Saves/%s.st%d", Model3->GetGameInfo()->id, saveSlot);
  58. + sprintf(filePath, "%s/.supermodel/saves/%s.st%d", getenv("HOME"), Model3->GetGameInfo()->id, saveSlot);
  59. if (OKAY != SaveState.Create(filePath, "Supermodel Save State", "Supermodel Version " SUPERMODEL_VERSION))
  60. {
  61. ErrorLog("Unable to save state to '%s'.", filePath);
  62. @@ -522,11 +529,11 @@
  63. static void LoadState(CModel3 *Model3)
  64. {
  65. CBlockFile SaveState;
  66. - char filePath[24];
  67. + char filePath[512];
  68. int fileVersion;
  69. // Generate file path
  70. - sprintf(filePath, "Saves/%s.st%d", Model3->GetGameInfo()->id, saveSlot);
  71. + sprintf(filePath, "%s/.supermodel/saves/%s.st%d", getenv("HOME"), Model3->GetGameInfo()->id, saveSlot);
  72. // Open and check to make sure format is correct
  73. if (OKAY != SaveState.Load(filePath))
  74. @@ -558,10 +565,10 @@
  75. static void SaveNVRAM(CModel3 *Model3)
  76. {
  77. CBlockFile NVRAM;
  78. - char filePath[24];
  79. + char filePath[512];
  80. int fileVersion = NVRAM_FILE_VERSION;
  81. - sprintf(filePath, "NVRAM/%s.nv", Model3->GetGameInfo()->id);
  82. + sprintf(filePath, "%s/.supermodel/NVRAM/%s.nv", getenv("HOME"), Model3->GetGameInfo()->id);
  83. if (OKAY != NVRAM.Create(filePath, "Supermodel NVRAM State", "Supermodel Version " SUPERMODEL_VERSION))
  84. {
  85. ErrorLog("Unable to save NVRAM to '%s'. Make sure directory exists!", filePath);
  86. @@ -581,11 +588,11 @@
  87. static void LoadNVRAM(CModel3 *Model3)
  88. {
  89. CBlockFile NVRAM;
  90. - char filePath[24];
  91. + char filePath[512];
  92. int fileVersion;
  93. // Generate file path
  94. - sprintf(filePath, "NVRAM/%s.nv", Model3->GetGameInfo()->id);
  95. + sprintf(filePath, "%s/.supermodel/NVRAM/%s.nv", getenv("HOME"), Model3->GetGameInfo()->id);
  96. // Open and check to make sure format is correct
  97. if (OKAY != NVRAM.Load(filePath))