ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/Daodan/src/Daodan_Config.c
(Generate patch)

Comparing Daodan/src/Daodan_Config.c (file contents):
Revision 995 by alloc, Wed Apr 9 00:10:18 2014 UTC vs.
Revision 1008 by alloc, Mon Aug 25 23:21:09 2014 UTC

# Line 18 | Line 18 | static const char* helpFile = "daodan_he
18  
19   static const char* defaultSection = "options";
20  
21 < static char invalidCurParamaters[1000] = "";
22 < static char invalidTotalParamaters[3000] = "";
21 > static char invalidCurParamaters[2000] = "";
22 > static char invalidTotalParamaters[4000] = "";
23  
24   void DDrConfig_PrintHelp();
25  
26  
27   ConfigSection_t config[] = {
28 <        { "patches", "Patches", {
29 <                { "alttab",
30 <                        "Allows to Alt-Tab out of Oni and use Windows key. May enable the screensaver as well.",
28 >        { "", "Command line only", {
29 >                { "help",
30 >                        "Generates this help file.",
31 >                        C_CMD,
32 >                        {.intBoolVal = 0},
33 >                        {.callback = DDrConfig_PrintHelp} },
34 >                { 0, 0, 0, {0}, {0} }
35 >        } },
36 >        { "devmode", "Developer Mode", {
37 >                { "highres_console",
38 >                        "Fixes bug where console line becomes invisible at higher resolutions.",
39                          C_BOOL,
40                          {.intBoolVal = true},
41                          {.intBoolVal = true} },
42 <                { "argb8888",
43 <                        "Allows using textures with ARGB8888.",
42 >                { "showtriggervolumes",
43 >                        "Allows BSL variable \"show_triggervolumes\" and Ctrl+Shift+X (in devmode) to work.",
44                          C_BOOL,
45                          {.intBoolVal = true},
46                          {.intBoolVal = true} },
47 <                { "binkplay",
48 <                        "Fix binkplay calls to use GDI and outro same mode as intro.",
47 >                { 0, 0, 0, {0}, {0} }
48 >        } },
49 >        { "gameplay", "Gameplay", {
50 >                { "characterawareness",
51 >                        "Makes AI remember the player.",
52                          C_BOOL,
53                          {.intBoolVal = true},
54                          {.intBoolVal = true} },
# Line 51 | Line 62 | ConfigSection_t config[] = {
62                          C_BOOL,
63                          {.intBoolVal = true},
64                          {.intBoolVal = true} },
54                { "chinese",
55                        "Allow for chinese fonts to be shown if the required DLL is available.",
56                        C_BOOL,
57                        {.intBoolVal = true},
58                        {.intBoolVal = true} },
59                { "clipcursor",
60                        "Limit cursor to Oni's window.",
61                        C_BOOL,
62                        {.intBoolVal = true},
63                        {.intBoolVal = true} },
65                  { "cooldowntimer",
66                          "Disables weapon cooldown exploit.",
67                          C_BOOL,
68                          {.intBoolVal = true},
69                          {.intBoolVal = true} },
70 <                { "d_regen",
71 <                        "Enables script command d_regen (query/set regeneration for any character).",
70 >                { "kickguns",
71 >                        "EXPERIMENTAL! Unfinished, do not use.",
72                          C_BOOL,
73 <                        {.intBoolVal = true},
74 <                        {.intBoolVal = true} },
75 <                { "daodandisplayenum",
76 <                        "Offers a more accurate list of available display modes in the Options menu.",
73 >                        {.intBoolVal = false},
74 >                        {.intBoolVal = false} },
75 >                { "pathfinding",
76 >                        "Size of pathfinding grid cache increased by eight times in order to prevent crashes in large levels.",
77                          C_BOOL,
78                          {.intBoolVal = true},
79                          {.intBoolVal = true} },
80 <                { "directinput",
81 <                        "Enforces the usage of DirectInput on every system. Should be off for Linux/Wine.",
80 >                { "projaware",
81 >                        "Allows AI to dodge incoming gunfire properly.",
82                          C_BOOL,
83                          {.intBoolVal = true},
84                          {.intBoolVal = true} },
85 <                { "disablecmdline",
86 <                        "Disables Oni's existing command line parser as Daodan has its own.",
85 >                { "throwtest",
86 >                        "EXPERIMENTAL! Experiment with allowing enemies to be thrown over railings.",
87                          C_BOOL,
88 <                        {.intBoolVal = true},
89 <                        {.intBoolVal = true} },
90 <                { "fonttexturecache",
91 <                        "Doubles size of font texture cache.",
88 >                        {.intBoolVal = false},
89 >                        {.intBoolVal = false} },
90 >                { "wpfadetime",
91 >                        "Adds working function for existing BSL command wp_fadetime, sets fade time to 4800.",
92                          C_BOOL,
93                          {.intBoolVal = true},
94                          {.intBoolVal = true} },
95 <                { "hdscreens_lowres",
96 <                        "Allow HD intro/ending screens on game resolutions smaller than 1024x768.",
95 >                { 0, 0, 0, {0}, {0} }
96 >        } },
97 >        { "graphics", "Graphics", {
98 >                { "binkplay",
99 >                        "Fix binkplay calls to use GDI and outro same mode as intro.",
100                          C_BOOL,
101                          {.intBoolVal = true},
102                          {.intBoolVal = true} },
103 <                { "highres_console",
104 <                        "Fixes bug where console line becomes invisible at higher resolutions.",
103 >                { "daodangl",
104 >                        "Provides an improved windowed mode (-noswitch).",
105                          C_BOOL,
106                          {.intBoolVal = true},
107                          {.intBoolVal = true} },
108 <                { "kickguns",
109 <                        "EXPERIMENTAL! Unfinished, do not use.",
106 <                        C_BOOL,
107 <                        {.intBoolVal = false},
108 <                        {.intBoolVal = false} },
109 <                { "killvtune",
110 <                        "Prevent loading of vtuneapi.dll.",
111 <                        C_BOOL,
112 <                        {.intBoolVal = false},
113 <                        {.intBoolVal = false} },
114 <                { "largetextures",
115 <                        "Textures up to 512x512 can be used.",
108 >                { "displayenum",
109 >                        "Offers a more accurate list of available display modes in the Options menu.",
110                          C_BOOL,
111                          {.intBoolVal = true},
112                          {.intBoolVal = true} },
113 <                { "levelplugins",
114 <                        "Allows level files to be loaded which do not end in \"_Final\".",
113 >                { "gamma",
114 >                        "Enable gamma slider in fullscreen, disable in windowed mode.",
115                          C_BOOL,
116                          {.intBoolVal = true},
117                          {.intBoolVal = true} },
# Line 126 | Line 120 | ConfigSection_t config[] = {
120                          C_BOOL,
121                          {.intBoolVal = true},
122                          {.intBoolVal = true} },
129                { "nomultibyte",
130                        "Enables languages which use multibyte coding (such as Chinese).",
131                        C_BOOL,
132                        {.intBoolVal = true},
133                        {.intBoolVal = true} },
123                  { "optionsvisible",
124                          "Always show options button in main menu, even when pausing from a game.",
125                          C_BOOL,
126                          {.intBoolVal = true},
127                          {.intBoolVal = true} },
128 <                { "pathfinding",
129 <                        "Size of pathfinding grid cache increased by eight times in order to prevent crashes in large levels.",
128 >                { "showalllasersights",
129 >                        "Show all (also enemies') weapon lasersights.",
130 >                        C_BOOL,
131 >                        {.intBoolVal = false},
132 >                        {.intBoolVal = false} },
133 >                { "widescreenportraits",
134 >                        "Prevents fly-in portraits from being stretched when playing in widescreen resolutions.",
135                          C_BOOL,
136                          {.intBoolVal = true},
137                          {.intBoolVal = true} },
138 <                { "projaware",
139 <                        "Allows AI to dodge incoming gunfire properly.",
138 >                { 0, 0, 0, {0}, {0} }
139 >        } },
140 >        { "language", "Language", {
141 >                { "chinese",
142 >                        "Allow for chinese fonts to be shown if the required DLL is available.",
143                          C_BOOL,
144                          {.intBoolVal = true},
145                          {.intBoolVal = true} },
146 <                { "safeprintf",
147 <                        "Replaces Oni's function that prints to startup.txt with a safer one.",
146 >                { "fonttexturecache",
147 >                        "Doubles size of font texture cache.",
148                          C_BOOL,
149                          {.intBoolVal = true},
150                          {.intBoolVal = true} },
151 <                { "showalllasersights",
152 <                        "Show all (also enemies') weapon lasersights.",
153 <                        C_BOOL,
154 <                        {.intBoolVal = false},
155 <                        {.intBoolVal = false} },
156 <                { "showtriggervolumes",
157 <                        "Allows BSL variable \"show_triggervolumes\" and Ctrl+Shift+X (in devmode) to work.",
151 >                { "language",
152 >                        "Localization for hardcoded strings (e.g. \"Savepoints\").",
153 >                        C_STRING,
154 >                        {.stringVal = "en"},
155 >                        {.stringVal = "en"} },
156 >                { "nomultibyte",
157 >                        "Enables languages which use multibyte coding (such as Chinese).",
158                          C_BOOL,
159                          {.intBoolVal = true},
160                          {.intBoolVal = true} },
161 <                { "throwtest",
162 <                        "EXPERIMENTAL! Experiment with allowing enemies to be thrown over railings.",
163 <                        C_BOOL,
164 <                        {.intBoolVal = false},
165 <                        {.intBoolVal = false} },
169 <                { "usedaodanbsl",
170 <                        "Adds new BSL commands.",
161 >                { 0, 0, 0, {0}, {0} }
162 >        } },
163 >        { "modding", "Modding", {
164 >                { "argb8888",
165 >                        "Allows using textures with ARGB8888.",
166                          C_BOOL,
167                          {.intBoolVal = true},
168                          {.intBoolVal = true} },
169 <                { "usedaodangl",
170 <                        "Provides an improved windowed mode (-noswitch).",
169 >                { "d_regen",
170 >                        "Enables script command d_regen (query/set regeneration for any character).",
171                          C_BOOL,
172                          {.intBoolVal = true},
173                          {.intBoolVal = true} },
174 <                { "usegettickcount",
175 <                        "Replaces Oni's timing functions with more accurate ones.",
174 >                { "daodanbsl",
175 >                        "Adds new BSL commands.",
176                          C_BOOL,
177                          {.intBoolVal = true},
178                          {.intBoolVal = true} },
179 <                { "widescreenportraits",
180 <                        "Prevents fly-in portraits from being stretched when playing in widescreen resolutions.",
179 >                { "hdscreens_lowres",
180 >                        "Allow HD intro/ending screens on game resolutions smaller than 1024x768.",
181                          C_BOOL,
182                          {.intBoolVal = true},
183                          {.intBoolVal = true} },
184 <                { "wpfadetime",
185 <                        "Adds working function for existing BSL command wp_fadetime, sets fade time to 4800.",
184 >                { "largetextures",
185 >                        "Textures up to 512x512 can be used.",
186                          C_BOOL,
187                          {.intBoolVal = true},
188                          {.intBoolVal = true} },
189 <                { 0, 0, 0, {0}, {0} }
190 <        } },
196 <        { "options", "Options", {
197 <                { "border",
198 <                        "Add a border if in windowed mode and \"usedaodangl\" patch is active.",
189 >                { "levelplugins",
190 >                        "Allows level files to be loaded which do not end in \"_Final\".",
191                          C_BOOL,
192                          {.intBoolVal = true},
193                          {.intBoolVal = true} },
194 +                { 0, 0, 0, {0}, {0} }
195 +        } },
196 +        { "oni", "Original Oni Options", {
197                  { "debug",
198                          "Not useful, probably does nothing.",
199                          EXT_BOOL,
200                          {.intBoolVal = false },
201                          {.extBoolVal = &AKgDebug_DebugMaps } },
202                  { "debugfiles",
203 <                        "Not useful, probably does nothing.",
203 >                        "Logs called BSL functions to script_debug.txt.",
204                          EXT_BOOL,
205                          {.intBoolVal = false },
206                          {.extBoolVal = &BFgDebugFileEnable } },
# Line 214 | Line 209 | ConfigSection_t config[] = {
209                          EXT_BOOL,
210                          {.intBoolVal = false },
211                          {.extBoolVal = &SSgSearchOnDisk } },
217                { "gamma",
218                        "Enable gamma slider in fullscreen, disable in windowed mode.",
219                        C_BOOL,
220                        {.intBoolVal = true},
221                        {.intBoolVal = true} },
222                { "help",
223                        "Generates this help file.",
224                        C_CMD,
225                        {.intBoolVal = 0},
226                        {.callback = DDrConfig_PrintHelp} },
212                  { "ignore_private_data",
213                          "Not useful, probably does nothing.",
214                          EXT_BOOL,
# Line 239 | Line 224 | ConfigSection_t config[] = {
224                          EXT_BOOL,
225                          {.intBoolVal = true},
226                          {.extBoolVal = &M3gResolutionSwitch} },
227 +                { 0, 0, 0, {0}, {0} }
228 +        } },
229 +        { "windows", "Windows", {
230 +                { "alttab",
231 +                        "Allows to Alt-Tab out of Oni and use Windows key. May enable the screensaver as well.",
232 +                        C_BOOL,
233 +                        {.intBoolVal = true},
234 +                        {.intBoolVal = true} },
235 +                { "border",
236 +                        "Add a border if in windowed mode and \"usedaodangl\" patch is active.",
237 +                        C_BOOL,
238 +                        {.intBoolVal = true},
239 +                        {.intBoolVal = true} },
240 +                { "clipcursor",
241 +                        "Limit cursor to Oni's window.",
242 +                        C_BOOL,
243 +                        {.intBoolVal = true},
244 +                        {.intBoolVal = true} },
245 +                { "directinput",
246 +                        "Enforces the usage of DirectInput on every system. Should be off for Linux/Wine.",
247 +                        C_BOOL,
248 +                        {.intBoolVal = true},
249 +                        {.intBoolVal = true} },
250 +                { "disablecmdline",
251 +                        "Disables Oni's existing command line parser as Daodan has its own.",
252 +                        C_BOOL,
253 +                        {.intBoolVal = true},
254 +                        {.intBoolVal = true} },
255 +                { "killvtune",
256 +                        "Prevent loading of vtuneapi.dll.",
257 +                        C_BOOL,
258 +                        {.intBoolVal = false},
259 +                        {.intBoolVal = false} },
260 +                { "safeprintf",
261 +                        "Replaces Oni's function that prints to startup.txt with a safer one.",
262 +                        C_BOOL,
263 +                        {.intBoolVal = true},
264 +                        {.intBoolVal = true} },
265                  { "topmost",
266                          "Keep game window on top in windowed mode, even when switching applications.",
267                          C_BOOL,
268                          {.intBoolVal = false},
269                          {.intBoolVal = false} },
270 <                { "language",
271 <                        "Localization for hardcoded strings (e.g. \"Savepoints\").",
272 <                        C_STRING,
273 <                        {.stringVal = "en"},
274 <                        {.stringVal = "en"} },
270 >                { "usegettickcount",
271 >                        "Replaces Oni's timing functions with more accurate ones.",
272 >                        C_BOOL,
273 >                        {.intBoolVal = true},
274 >                        {.intBoolVal = true} },
275                  { 0, 0, 0, {0}, {0} }
276          } }
277   };
# Line 298 | Line 321 | void DDrConfig_PrintHelp()
321                                  char* name = co->name;
322                                  char* desc = co->description;
323                                  const char* tName = DDrConfig_GetOptionTypeName(co->type);
324 <                                int boolV = co->defaultValue.intBoolVal;
325 <                                char* val;
326 <                                switch (co->type) {
304 <                                        case C_STRING:
305 <                                                val = co->defaultValue.stringVal;
306 <                                                break;
307 <                                        case EXT_BOOL:
308 <                                                val = (boolV ? "true" : "false");
309 <                                                break;
310 <                                        case C_BOOL:
311 <                                                val = (boolV ? "true" : "false");
312 <                                                break;
313 <                                        case C_CMD:
314 <                                                val = "";
315 <                                                break;
316 <                                        default:
317 <                                                val = malloc(20);
318 <                                                sprintf(val, "%d", boolV);
319 <                                }
324 >                                const char* val = DDrConfig_GetOptionValueString(co, 1);
325 >                                if (!val)
326 >                                        val = "";
327                                  fprintf(fp, "        %-22s %6s=%-5s %s\n", name, tName, val, desc);
328                          }
329                          fprintf(fp, "\n");
# Line 325 | Line 332 | void DDrConfig_PrintHelp()
332                  fprintf(fp, "In daodan.ini each section of parameters has its own section in the ini file started by [section name]. Parameters are given within that section by their name only, followed by an equals sign and the desired value. Example:\n");
333                  fprintf(fp, "    [sectionX]\n    parameterName = false\n");
334                  fprintf(fp, "\nTo pass the parameter on the command line:\n");
335 <                fprintf(fp, "    Oni.exe -sectionX.parameterName false\n");
335 >                fprintf(fp, "    Oni.exe -parameterName false\n");
336                  fprintf(fp, "For bool parameters the value can be ommitted so it is regarded as \"true\":\n");
337 <                fprintf(fp, "    Oni.exe -sectionX.parameterName\n");
337 >                fprintf(fp, "    Oni.exe -parameterName\n");
338                  fprintf(fp, "To disable a bool parameter you can prefix \"no\" to the parameter name like this:\n");
339 <                fprintf(fp, "    Oni.exe -sectionX.noparameterName\n");
333 <                fprintf(fp, "If no section is given it is assumed to be \"%s\", e.g.\n", defaultSection);
334 <                fprintf(fp, "    Oni.exe -%s.parametername\n", defaultSection);
335 <                fprintf(fp, "can simply be written as\n");
336 <                fprintf(fp, "    Oni.exe -parametername\n");
339 >                fprintf(fp, "    Oni.exe -noparameterName\n");
340  
341                  fclose(fp);
342          }
# Line 361 | Line 364 | const char* DDrConfig_GetOptionTypeName(
364          }
365   }
366  
367 + const char* DDrConfig_GetOptionValueString(ConfigOption_t* opt, char printdefault)
368 + {
369 +        OptionValue_t* optVal = (printdefault ? &opt->defaultValue : &opt->value);
370 +        int boolV = optVal->intBoolVal;
371 +        char* val = 0;
372 +        switch (opt->type) {
373 +                case C_STRING:
374 +                        return optVal->stringVal;
375 +                case EXT_BOOL:
376 +                        if (printdefault)
377 +                                return (boolV ? "true" : "false");
378 +                        else
379 +                                return (*optVal->extBoolVal ? "true" : "false");
380 +                case C_BOOL:
381 +                        return (boolV ? "true" : "false");
382 +                case C_CMD:
383 +                        return 0;
384 +                default:
385 +                        val = malloc(20);
386 +                        sprintf(val, "%d", boolV);
387 +                        return val;
388 +        }
389 + }
390 +
391 + char DDrConfig_NonDefaultOptionValue(ConfigOption_t* opt)
392 + {
393 +        switch (opt->type) {
394 +                case C_STRING:
395 +                        return _stricmp(opt->defaultValue.stringVal, opt->value.stringVal);
396 +                case EXT_BOOL:
397 +                        return !opt->defaultValue.intBoolVal != !*opt->value.extBoolVal;
398 +                case C_BOOL:
399 +                        return !opt->defaultValue.intBoolVal != !opt->value.intBoolVal;
400 +                case C_CMD:
401 +                        return 0;
402 +                case C_INT:
403 +                        return opt->defaultValue.intBoolVal != opt->value.intBoolVal;
404 +        }
405 +        return 0;
406 + }
407 +
408   static ConfigOption_t* DDrConfig_GetOption(const char* fullOptName)
409   {
410          char section[50];
# Line 373 | Line 417 | static ConfigOption_t* DDrConfig_GetOpti
417          }
418          *option++ = 0;
419  
420 +        char isWildcardSection = !_stricmp(section, "*");
421 +
422          for (unsigned int s = 0; s < ARRAY_SIZE(config); s++) {
423 <                if (!_stricmp(config[s].name, section)) {
423 >                if (isWildcardSection || !_stricmp(config[s].name, section)) {
424                          for (ConfigOption_t* co = config[s].options; co->name != 0; co++) {
425                                  if (!_stricmp(co->name, option)) {
426                                          return co;
427                                  }
428                          }
429 <                        STARTUPMESSAGE("Could not find option \"%s\" in section \"%s\"", option, section);
430 <                        return 0;
429 >                        if (!isWildcardSection) {
430 >                                STARTUPMESSAGE("Could not find option \"%s\" in section \"%s\"", option, section);
431 >                                return 0;
432 >                        }
433                  }
434          }
435 <        STARTUPMESSAGE("Could not find section \"%s\" for option \"%s\"", section, option);
435 >        if (!isWildcardSection)
436 >                STARTUPMESSAGE("Could not find section \"%s\" for option \"%s\"", section, option);
437 >        else
438 >                STARTUPMESSAGE("Could not find option \"%s\"", option);
439          return 0;
440   }
441  
# Line 418 | Line 469 | void DDrConfig_InitExtBools()
469  
470  
471  
472 < void DDrConfig_WriteTemplateIni()
472 > void DDrConfig_WriteIni()
473   {
474          FILE* fp;
475          STARTUPMESSAGE("%s doesn't exist, creating", iniName);
# Line 426 | Line 477 | void DDrConfig_WriteTemplateIni()
477          if (fp)
478          {
479                  for (unsigned int s = 0; s < ARRAY_SIZE(config); s++) {
480 <                        fprintf(fp, "[%s]\n", config[s].name);
480 >                        if (strlen(config[s].name)) {
481 >                                fprintf(fp, "[%s]\n", config[s].name);
482 >                                for (ConfigOption_t* co = config[s].options; co->name != 0; co++) {
483 >                                        char* name = co->name;
484 >                                        const char* val = DDrConfig_GetOptionValueString(co, 0);
485 >                                        if (val && DDrConfig_NonDefaultOptionValue(co))
486 >                                                fprintf(fp, "%s = %s\n", name, val);
487 >                                }
488 >                                fprintf(fp, "\n");
489 >                        }
490                  }
491                  fclose(fp);
492          }
# Line 439 | Line 499 | void DDrConfig_WriteTemplateIni()
499  
500   void DDrIniCallback(const char* section, const char* name, const char* value)
501   {
442        static char curSection[20];
502          char fullOptName[50];
503  
504          if (!_stricmp(section, "patch"))
505                  section = "patches";
506  
507 <        strcpy(curSection, section);
508 <
509 <        strcpy(fullOptName, curSection);
451 <        fullOptName[strlen(curSection)] = '.';
452 <        strcpy(fullOptName+strlen(curSection)+1, name);
507 >        strcpy(fullOptName, section);
508 >        fullOptName[strlen(section)] = '.';
509 >        strcpy(fullOptName+strlen(section)+1, name);
510  
511          ConfigOption_t* co = DDrConfig_GetOption(fullOptName);
512  
# Line 478 | Line 535 | void DDrIniCallback(const char* section,
535                                  STARTUPMESSAGE("Config value type unknown: %d", co->type);
536                  }
537          } else {
538 <                char buf[50];
539 <                sprintf_s(buf, sizeof(buf), "  %s.%s\n", section, name);
538 >                char buf[100];
539 >                if (!_stricmp(section, "*"))
540 >                        sprintf(buf, "  %s\n", name);
541 >                else
542 >                        sprintf(buf, "  %s.%s\n", section, name);
543                  if (strlen(buf) + strlen(invalidCurParamaters) < sizeof(invalidCurParamaters) - 1) {
544                          strcpy(invalidCurParamaters + strlen(invalidCurParamaters), buf);
545                  }
# Line 493 | Line 553 | bool DDrConfig_ParseCommandLine(int argc
553          {
554                  if (argv[i][0] == '-')
555                  {
496                        const char* section;
497                        char* optionsep;
556                          char* option;
557                          bool invertedOption;
558  
559 <                        if ((optionsep = strchr(argv[i], '.')))
502 <                        // Is "section.option"
503 <                        {
504 <                                *optionsep = 0;
505 <                                option = optionsep+1;
506 <                                section = argv[i]+1;
507 <                        }
508 <                        else
509 <                        // Is just "option"
510 <                        {
511 <                                section = defaultSection;
512 <                                option = argv[i]+1;
513 <                        }
559 >                        option = argv[i]+1;
560  
561                          invertedOption = (option[0] == 'n' || option[0] == 'N') && (option[1] == 'o' || option[1] == 'O');
562                          if (invertedOption)
# Line 519 | Line 565 | bool DDrConfig_ParseCommandLine(int argc
565                          if (i < (argc - 1) && argv[i+1][0] != '-')
566                          // Has value in next field
567                          {
568 <                                DDrIniCallback(section, option, argv[++i]);
568 >                                DDrIniCallback("*", option, argv[++i]);
569                          }
570                          else
571                          // Implicit value
572                          {
573 <                                DDrIniCallback(section, option, (invertedOption ? "false" : "true"));
573 >                                DDrIniCallback("*", option, (invertedOption ? "false" : "true"));
574                          }
529
530                        if (optionsep)
531                                *optionsep = '.';
575                  }
576                  else
577                  {
# Line 545 | Line 588 | void DDrConfig(int argc, char* argv[])
588          DDrConfig_InitExtBools();
589  
590          if (GetFileAttributes(iniName) == INVALID_FILE_ATTRIBUTES)
591 <                DDrConfig_WriteTemplateIni();
591 >                DDrConfig_WriteIni();
592          
593          STARTUPMESSAGE("Parsing daodan.ini...", 0);
594          if (!Inifile_Read(iniName, DDrIniCallback))
# Line 554 | Line 597 | void DDrConfig(int argc, char* argv[])
597  
598          if (strlen(invalidCurParamaters) > 0)
599          {
600 <                sprintf_s(invalidTotalParamaters, sizeof(invalidTotalParamaters), "In %s:\n%s\n", iniName, invalidCurParamaters);
600 >                sprintf(invalidTotalParamaters, "In %s:\n%s\n", iniName, invalidCurParamaters);
601                  invalidCurParamaters[0] = 0;
602          }
603  
# Line 564 | Line 607 | void DDrConfig(int argc, char* argv[])
607  
608          if (strlen(invalidCurParamaters) > 0)
609          {
610 <                sprintf_s(invalidTotalParamaters, sizeof(invalidTotalParamaters), "%sOn command line:\n%s\n", invalidTotalParamaters, invalidCurParamaters);
610 >                sprintf(invalidTotalParamaters, "%sOn command line:\n%s\n", invalidTotalParamaters, invalidCurParamaters);
611          }
612  
613          if (strlen(invalidTotalParamaters) > 0)
614          {
615 <                char msg[3200];
616 <                sprintf_s(msg, sizeof(msg), "Invalid parameters given:\n%sContinue launching Oni?", invalidTotalParamaters);
615 >                char msg[4096];
616 >                sprintf(msg, "Invalid parameters given:\n%sContinue launching Oni?", invalidTotalParamaters);
617                  int res = MessageBox(NULL, msg, "Parameters invalid", MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON1);
618                  if (res == IDNO) {
619                          exit(0);
620                  }
621          }
622  
623 +        DDrConfig_WriteIni();
624 +
625   //      DDrConfig_Print();
626   }
627  

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)