Changeset 993 for Daodan/src/Daodan_Config.c
- Timestamp:
- Apr 6, 2014, 7:06:02 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Daodan/src/Daodan_Config.c
r992 r993 11 11 #include "Inifile_Reader.h" 12 12 13 bool patch_alttab = true; 14 bool patch_argb8888 = true; 15 bool patch_binkplay = true; 16 bool patch_bsl = true; 17 bool patch_cheater = true; 18 bool patch_cheatsenabled = true; 19 bool patch_cheattable = true; 20 bool patch_clipcursor = true; 21 bool patch_cooldowntimer = true; 22 bool patch_daodandisplayenum = true; 23 bool patch_directinput = true; 24 bool patch_disablecmdline = true; 25 bool patch_flatline = true; 26 bool patch_fonttexturecache = true; 27 bool patch_getcmdline = true; 28 bool patch_hdscreens_lowres = true; 29 bool patch_highres_console = true; 30 bool patch_kickguns = false; 31 bool patch_killvtune = true; 32 bool patch_largetextures = true; 33 bool patch_levelplugins = true; 34 bool patch_newweapon = true; 35 bool patch_nomultibyte = true; 36 bool patch_optionsvisible = true; 37 bool patch_particledisablebit = false; 38 bool patch_pathfinding = true; 39 bool patch_projaware = true; 40 bool patch_safeprintf = true; 41 bool patch_showalllasersights = false; 42 bool patch_showtriggervolumes = true; 43 bool patch_throwtest = false; 44 bool patch_usedaodangl = true; 45 bool patch_usegettickcount = true; 46 bool patch_wpfadetime = true; 47 48 bool opt_border = true; 49 bool opt_gamma = true; 50 bool opt_topmost = false; 51 bool opt_usedaodanbsl = true; 52 53 bool patch_chinese = true; 54 55 56 enum {s_unknown, s_options, s_patch, s_bsl, s_language} ini_section; 57 58 bool DDrIniCallback(char* section, bool newsection, char* name, char* value) 59 { 60 if (newsection) 13 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) 14 15 static const char* iniName = "daodan.ini"; 16 17 ConfigSection_t config[] = { 18 { "patches", "Patches", { 19 { "alttab", 20 "Allows user to switch applications while in Oni (Alt-Tab) and use Windows key, however it may enable the screensaver as well.", 21 C_BOOL, 22 {.intBoolVal = true}, 23 {.intBoolVal = true} }, 24 { "argb8888", 25 "Textures using ARGB8888 can be used.", 26 C_BOOL, 27 {.intBoolVal = true}, 28 {.intBoolVal = true} }, 29 { "binkplay", 30 "Fix binkplay calls to use GDI and outro same mode as intro.", 31 C_BOOL, 32 {.intBoolVal = true}, 33 {.intBoolVal = true} }, 34 { "bsl", 35 "Enables d_regen (unfinished) and prevents fly-in portraits from being stretched when playing in widescreen resolutions.", 36 C_BOOL, 37 {.intBoolVal = true}, 38 {.intBoolVal = true} }, 39 { "cheater", 40 "Adds new cheat codes (see section below).", 41 C_BOOL, 42 {.intBoolVal = true}, 43 {.intBoolVal = true} }, 44 { "cheatsenabled", 45 "Enables cheats without having to beat the game first.", 46 C_BOOL, 47 {.intBoolVal = true}, 48 {.intBoolVal = true} }, 49 { "cheattable", 50 "Replaces Oni's cheat table with table that includes new cheats (see section below).", 51 C_BOOL, 52 {.intBoolVal = true}, 53 {.intBoolVal = true} }, 54 { "chinese", 55 "Allow for chinese fonts to be shown.", 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} }, 64 { "cooldowntimer", 65 "Disables weapon cooldown exploit.", 66 C_BOOL, 67 {.intBoolVal = true}, 68 {.intBoolVal = true} }, 69 { "daodandisplayenum", 70 "Offers more display modes in the Options menu.", 71 C_BOOL, 72 {.intBoolVal = true}, 73 {.intBoolVal = true} }, 74 { "directinput", 75 "Forces on DirectInput.", 76 C_BOOL, 77 {.intBoolVal = true}, 78 {.intBoolVal = true} }, 79 { "disablecmdline", 80 "Replaces existing command line parser with Daodan's in order to add new commands. Meant to be used with getcmdline.", 81 C_BOOL, 82 {.intBoolVal = true}, 83 {.intBoolVal = true} }, 84 { "fonttexturecache", 85 "Doubles size of font texture cache.", 86 C_BOOL, 87 {.intBoolVal = true}, 88 {.intBoolVal = true} }, 89 { "getcmdline", 90 "Replaces existing command line parser with Daodan's in order to add new commands. Meant to be used with disablecmdline.", 91 C_BOOL, 92 {.intBoolVal = true}, 93 {.intBoolVal = true} }, 94 { "hdscreens_lowres", 95 "???", 96 C_BOOL, 97 {.intBoolVal = true}, 98 {.intBoolVal = true} }, 99 { "highres_console", 100 "Fixes bug where console line becomes invisible at higher resolutions.", 101 C_BOOL, 102 {.intBoolVal = true}, 103 {.intBoolVal = true} }, 104 { "kickguns", 105 "Unfinished, do not use.", 106 C_BOOL, 107 {.intBoolVal = false}, 108 {.intBoolVal = false} }, 109 { "largetextures", 110 "Textures up to 512x512 can be used.", 111 C_BOOL, 112 {.intBoolVal = true}, 113 {.intBoolVal = true} }, 114 { "levelplugins", 115 "Allows level files to be loaded from the GDF which do not end in \"_Final\".", 116 C_BOOL, 117 {.intBoolVal = true}, 118 {.intBoolVal = true} }, 119 { "newweap", 120 "Picking up a weapon displays a message containing the weapon name and amount of ammo.", 121 C_BOOL, 122 {.intBoolVal = true}, 123 {.intBoolVal = true} }, 124 { "nomultibyte", 125 "Enables languages which use multibyte coding (such as Chinese).", 126 C_BOOL, 127 {.intBoolVal = true}, 128 {.intBoolVal = true} }, 129 { "optionsvisible", 130 "Always show options button in main menu, even when pausing from a game.", 131 C_BOOL, 132 {.intBoolVal = true}, 133 {.intBoolVal = true} }, 134 { "particledisablebit", 135 "Unlocks particle action disabling/enabling bits for all events so that a particle event can occur multiple times.", 136 C_BOOL, 137 {.intBoolVal = false}, 138 {.intBoolVal = false} }, 139 { "pathfinding", 140 "Multiplies size of pathfinding grid cache by eight in order to prevent crashes in large levels.", 141 C_BOOL, 142 {.intBoolVal = true}, 143 {.intBoolVal = true} }, 144 { "projaware", 145 "Allows AI to dodge incoming gunfire properly.", 146 C_BOOL, 147 {.intBoolVal = true}, 148 {.intBoolVal = true} }, 149 { "safeprintf", 150 "Replaces Oni's function that prints to startup.txt with a safer one.", 151 C_BOOL, 152 {.intBoolVal = true}, 153 {.intBoolVal = true} }, 154 { "showalllasersights", 155 "Show all (also enemies') weapon lasersights.", 156 C_BOOL, 157 {.intBoolVal = false}, 158 {.intBoolVal = false} }, 159 { "showtriggervolumes", 160 "Allows BSL variable \"show_triggervolumes\" to work when set to 1.", 161 C_BOOL, 162 {.intBoolVal = true}, 163 {.intBoolVal = true} }, 164 { "throwtest", 165 "Not recommended for use; experiment with allowing enemies to be thrown over railings.", 166 C_BOOL, 167 {.intBoolVal = false}, 168 {.intBoolVal = false} }, 169 { "usedaodangl", 170 "Provides an improved windowed mode (-noswitch); this patch is known to break the hiding of the Windows taskbar in fullscreen mode.", 171 C_BOOL, 172 {.intBoolVal = true}, 173 {.intBoolVal = true} }, 174 { "usegettickcount", 175 "Replaces Oni's timing functions with more accurate ones.", 176 C_BOOL, 177 {.intBoolVal = true}, 178 {.intBoolVal = true} }, 179 { "wpfadetime", 180 "Adds working function for existing BSL command wp_fadetime, sets fade time to 4800.", 181 C_BOOL, 182 {.intBoolVal = true}, 183 {.intBoolVal = true} }, 184 { 0, 0, 0, {0}, {0} } 185 } }, 186 { "options", "Options", { 187 { "border", 188 "If \"windowhack\" patch is active, make sure game window has border in windowed mode.", 189 C_BOOL, 190 {.intBoolVal = true}, 191 {.intBoolVal = true} }, 192 { "debug", 193 "???", 194 EXT_BOOL, 195 {.intBoolVal = false }, 196 {.extBoolVal = &AKgDebug_DebugMaps } }, 197 { "debugfiles", 198 "???", 199 EXT_BOOL, 200 {.intBoolVal = false }, 201 {.extBoolVal = &BFgDebugFileEnable } }, 202 { "findsounds", 203 "???", 204 EXT_BOOL, 205 {.intBoolVal = false }, 206 {.extBoolVal = &SSgSearchOnDisk } }, 207 { "gamma", 208 "Enable gamma slider in fullscreen.", 209 C_BOOL, 210 {.intBoolVal = true}, 211 {.intBoolVal = true} }, 212 { "ignore_private_data", 213 "???", 214 EXT_BOOL, 215 {.intBoolVal = false }, 216 {.extBoolVal = &opt_ignore_private_data } }, 217 { "sound", 218 "???", 219 EXT_BOOL, 220 {.intBoolVal = true }, 221 {.extBoolVal = &opt_sound } }, 222 { "switch", 223 "Always switch screen to resolution on Oni's Options screen, making the game fullscreen; opposite of Oni's built-in argument \"noswitch\".", 224 EXT_BOOL, 225 {.intBoolVal = true}, 226 {.extBoolVal = &M3gResolutionSwitch} }, 227 { "topmost", 228 "Keep game window on top in windowed mode, even when switching applications.", 229 C_BOOL, 230 {.intBoolVal = false}, 231 {.intBoolVal = false} }, 232 { "usedaodanbsl", 233 "Adds new BSL commands (see below).", 234 C_BOOL, 235 {.intBoolVal = true}, 236 {.intBoolVal = true} }, 237 { "language", 238 "Localization for hardcoded strings (e.g. \"Savepoints\").", 239 C_STRING, 240 {.stringVal = "en"}, 241 {.stringVal = "en"} }, 242 { 0, 0, 0, {0}, {0} } 243 } } 244 }; 245 246 247 void DDrConfig_Print() 248 { 249 for (unsigned int s = 0; s < ARRAY_SIZE(config); s++) { 250 for (ConfigOption_t* co = config[s].options; co->name != 0; co++) { 251 switch (co->type) { 252 case C_STRING: 253 STARTUPMESSAGE("Option %s.%s = %s (def %s)", config[s].name, co->name, co->value.stringVal, co->defaultValue.stringVal); 254 break; 255 case EXT_BOOL: 256 STARTUPMESSAGE("Option %s.%s = %d (def %d)", config[s].name, co->name, *co->value.extBoolVal, co->defaultValue.intBoolVal); 257 break; 258 default: 259 STARTUPMESSAGE("Option %s.%s = %d (def %d)", config[s].name, co->name, co->value.intBoolVal, co->defaultValue.intBoolVal); 260 } 261 } 262 } 263 } 264 265 const char* DDrConfig_GetOptionTypeName(OptionType_t type) 266 { 267 switch (type) { 268 case C_INT: 269 return "Int"; 270 case C_BOOL: 271 return "Bool"; 272 case C_STRING: 273 return "String"; 274 case EXT_BOOL: 275 return "pBool"; 276 default: 277 return "unknown"; 278 } 279 } 280 281 static ConfigOption_t* DDrConfig_GetOption(const char* fullOptName) 282 { 283 char section[50]; 284 strcpy(section, fullOptName); 285 286 char* option = strchr(section, '.'); 287 if (option == 0) { 288 STARTUPMESSAGE("Could not find option separator in \"%s\"", fullOptName); 289 return 0; 290 } 291 *option++ = 0; 292 293 for (unsigned int s = 0; s < ARRAY_SIZE(config); s++) { 294 if (!_stricmp(config[s].name, section)) { 295 for (ConfigOption_t* co = config[s].options; co->name != 0; co++) { 296 if (!_stricmp(co->name, option)) { 297 return co; 298 } 299 } 300 STARTUPMESSAGE("Could not find option \"%s\" in section \"%s\"", option, section); 301 return 0; 302 } 303 } 304 STARTUPMESSAGE("Could not find section \"%s\" for option \"%s\"", section, option); 305 return 0; 306 } 307 308 309 310 ConfigOption_t* DDrConfig_GetOptOfType(const char* fullOptName, OptionType_t type) 311 { 312 ConfigOption_t* co = DDrConfig_GetOption(fullOptName); 313 if (co == 0) 314 return 0; 315 316 if (co->type != type) { 317 STARTUPMESSAGE("Option \"%s\" is not of type %s", fullOptName, DDrConfig_GetOptionTypeName(type)); 318 return 0; 319 } 320 return co; 321 } 322 323 324 void DDrConfig_InitExtBools() 325 { 326 for (unsigned int s = 0; s < ARRAY_SIZE(config); s++) { 327 for (ConfigOption_t* co = config[s].options; co->name != 0; co++) { 328 if (co->type == EXT_BOOL) { 329 *co->value.extBoolVal = co->defaultValue.intBoolVal; 330 } 331 } 332 } 333 } 334 335 336 337 void DDrIniCallback(char* section, char* name, char* value) 338 { 339 static char curSection[20]; 340 char fullOptName[50]; 341 342 if (!_stricmp(section, "patch")) 343 section = "patches"; 344 345 strcpy(curSection, section); 346 347 strcpy(fullOptName, curSection); 348 fullOptName[strlen(curSection)] = '.'; 349 strcpy(fullOptName+strlen(curSection)+1, name); 350 351 ConfigOption_t* co = DDrConfig_GetOption(fullOptName); 352 353 if (co) 61 354 { 62 if (!_stricmp(section, "options")) 63 ini_section = s_options; 64 else if (!_stricmp(section, "patch") || !_stricmp(section, "patches")) 65 ini_section = s_patch; 66 else if (!_stricmp(section, "bsl")) 67 ini_section = s_bsl; 68 else if (!_stricmp(section, "language")) 69 ini_section = s_language; 355 switch (co->type) { 356 case C_INT: 357 co->value.intBoolVal = strtol(value, NULL, 0); 358 break; 359 case C_BOOL: 360 co->value.intBoolVal = !_stricmp(value, "true"); 361 break; 362 case C_STRING: 363 co->value.stringVal = value; 364 break; 365 case EXT_BOOL: 366 *(co->value.extBoolVal) = !_stricmp(value, "true"); 367 break; 368 default: 369 STARTUPMESSAGE("Config value type unknown: %d", co->type); 370 } 371 } 372 } 373 374 void DDrConfig_WriteTemplateIni() 375 { 376 FILE* fp; 377 STARTUPMESSAGE("%s doesn't exist, creating", iniName); 378 fp = fopen(iniName, "w"); 379 if (fp) 380 { 381 for (unsigned int s = 0; s < ARRAY_SIZE(config); s++) { 382 fprintf(fp, "[%s]\n", config[s].name); 383 } 384 fclose(fp); 385 } 386 } 387 388 389 void DDrConfig(int argc, char* argv[]) 390 { 391 int i; 392 char* section; 393 char* option; 394 bool falseoption; 395 396 DDrConfig_InitExtBools(); 397 398 if (GetFileAttributes(iniName) == INVALID_FILE_ATTRIBUTES) 399 DDrConfig_WriteTemplateIni(); 400 401 STARTUPMESSAGE("Parsing daodan.ini...", 0); 402 if (!Inifile_Read(iniName, DDrIniCallback)) 403 STARTUPMESSAGE("Error reading daodan.ini, check your syntax!", 0); 404 STARTUPMESSAGE("Finished parsing", 0); 405 406 407 408 STARTUPMESSAGE("Parsing command line...", 0); 409 for (i = 1; i < argc; i ++) 410 { 411 if (argv[i][0] == '-') 412 { 413 section = argv[i] + 1; 414 if ((option = strchr(argv[i], '.'))) 415 { 416 *option = '\0'; 417 falseoption = (option[1] == 'n' || option[1] == 'N') && (option[2] == 'o' || option[2] == 'O'); 418 if (i < (argc - 1) && argv[i + 1][0] != '-') 419 DDrIniCallback(section, option + 1, argv[++i]); 420 else 421 DDrIniCallback(section, option + (falseoption ? 3 : 1), (falseoption ? "false" : "true")); 422 *option = '.'; 423 } 424 else 425 { 426 falseoption = (section[0] == 'n' || section[0] == 'N') && (section[1] == 'o' || section[1] == 'O'); 427 if (i < (argc - 1) && argv[i + 1][0] != '-') 428 DDrIniCallback("options", section, argv[++i]); 429 else 430 DDrIniCallback("options", section + (falseoption ? 2 : 0), (falseoption ? "false" : "true")); 431 } 432 } 70 433 else 71 434 { 72 ini_section = s_unknown; 73 DDrStartupMessage("Daodan: Unrecognised ini section \"%s\"", section); 74 } 75 } 76 77 switch (ini_section) 78 { 79 case s_options: 80 if (!_stricmp(name, "border")) 81 opt_border = !_stricmp(inifile_cleanstr(value), "true"); 82 else if (!_stricmp(name, "debug")) 83 AKgDebug_DebugMaps = !_stricmp(inifile_cleanstr(value), "true"); 84 else if (!_stricmp(name, "debugfiles")) 85 BFgDebugFileEnable = !_stricmp(inifile_cleanstr(value), "true"); 86 else if (!_stricmp(name, "findsounds")) 87 SSgSearchOnDisk = !_stricmp(inifile_cleanstr(value), "true"); 88 else if (!_stricmp(name, "gamma")) 89 opt_gamma = !_stricmp(inifile_cleanstr(value), "true"); 90 else if (!_stricmp(name, "ignore_private_data")) 91 opt_ignore_private_data = !_stricmp(inifile_cleanstr(value), "true"); 92 else if (!_stricmp(name, "nomultibyte")) 93 patch_nomultibyte = !_stricmp(inifile_cleanstr(value), "true"); 94 else if (!_stricmp(name, "sound")) 95 opt_sound = !_stricmp(inifile_cleanstr(value), "true"); 96 else if (!_stricmp(name, "switch")) 97 M3gResolutionSwitch = !_stricmp(inifile_cleanstr(value), "true"); 98 else if (!_stricmp(name, "topmost")) 99 opt_topmost = !_stricmp(inifile_cleanstr(value), "true"); 100 else if (!_stricmp(name, "usedaodanbsl")) 101 opt_usedaodanbsl = !_stricmp(inifile_cleanstr(value), "true"); 102 else 103 DDrStartupMessage("Daodan: Unrecognised ini option \"%s\"", name); 435 STARTUPMESSAGE("Parse error \"%s\"", argv[i]); 104 436 break; 105 case s_patch: 106 if (!_stricmp(name, "alttab")) 107 patch_alttab = !_stricmp(inifile_cleanstr(value), "true"); 108 else if (!_stricmp(name, "argb8888")) 109 patch_argb8888 = !_stricmp(inifile_cleanstr(value), "true"); 110 else if (!_stricmp(name, "binkplay")) 111 patch_binkplay = !_stricmp(inifile_cleanstr(value), "true"); 112 else if (!_stricmp(name, "bsl")) 113 patch_bsl = !_stricmp(inifile_cleanstr(value), "true"); 114 else if (!_stricmp(name, "cheater")) 115 patch_cheater = !_stricmp(inifile_cleanstr(value), "true"); 116 else if (!_stricmp(name, "cheatsenabled")) 117 patch_cheatsenabled = !_stricmp(inifile_cleanstr(value), "true"); 118 else if (!_stricmp(name, "cheattable")) 119 patch_cheattable = !_stricmp(inifile_cleanstr(value), "true"); 120 else if (!_stricmp(name, "clipcursor")) 121 patch_clipcursor = !_stricmp(inifile_cleanstr(value), "true"); 122 else if (!_stricmp(name, "cooldowntimer")) 123 patch_cooldowntimer = !_stricmp(inifile_cleanstr(value), "true"); 124 else if (!_stricmp(name, "daodandisplayenum")) 125 patch_daodandisplayenum = !_stricmp(inifile_cleanstr(value), "true"); 126 else if (!_stricmp(name, "directinput")) 127 patch_directinput = !_stricmp(inifile_cleanstr(value), "true"); 128 else if (!_stricmp(name, "disablecmdline")) 129 patch_disablecmdline = !_stricmp(inifile_cleanstr(value), "true"); 130 else if (!_stricmp(name, "flatline")) 131 patch_flatline = !_stricmp(inifile_cleanstr(value), "true"); 132 else if (!_stricmp(name, "fonttexturecache")) 133 patch_fonttexturecache = !_stricmp(inifile_cleanstr(value), "true"); 134 else if (!_stricmp(name, "getcmdline")) 135 patch_getcmdline = !_stricmp(inifile_cleanstr(value), "true"); 136 else if (!_stricmp(name, "hdscreens_lowres")) 137 patch_hdscreens_lowres = !_stricmp(inifile_cleanstr(value), "true"); 138 else if (!_stricmp(name, "highres_console")) 139 patch_highres_console = !_stricmp(inifile_cleanstr(value), "true"); 140 else if (!_stricmp(name, "kickguns")) 141 patch_kickguns = !_stricmp(inifile_cleanstr(value), "true"); 142 else if (!_stricmp(name, "killvtune")) 143 patch_killvtune = !_stricmp(inifile_cleanstr(value), "true"); 144 else if (!_stricmp(name, "largetextures")) 145 patch_largetextures = !_stricmp(inifile_cleanstr(value), "true"); 146 else if (!_stricmp(name, "levelplugins")) 147 patch_levelplugins = !_stricmp(inifile_cleanstr(value), "true"); 148 else if (!_stricmp(name, "nomultibyte")) 149 patch_nomultibyte = !_stricmp(inifile_cleanstr(value), "true"); 150 else if (!_stricmp(name, "newweap")) 151 patch_newweapon = !_stricmp(inifile_cleanstr(value), "true"); 152 else if (!_stricmp(name, "optionsvisible")) 153 patch_optionsvisible = !_stricmp(inifile_cleanstr(value), "true"); 154 else if (!_stricmp(name, "particledisablebit")) 155 patch_particledisablebit = !_stricmp(inifile_cleanstr(value), "true"); 156 else if (!_stricmp(name, "pathfinding")) 157 patch_pathfinding = !_stricmp(inifile_cleanstr(value), "true"); 158 else if (!_stricmp(name, "projaware")) 159 patch_projaware = !_stricmp(inifile_cleanstr(value), "true"); 160 else if (!_stricmp(name, "safeprintf")) 161 patch_safeprintf = !_stricmp(inifile_cleanstr(value), "true"); 162 else if (!_stricmp(name, "showalllasersights")) 163 patch_showalllasersights = !_stricmp(inifile_cleanstr(value), "true"); 164 else if (!_stricmp(name, "showtriggervolumes")) 165 patch_showtriggervolumes = !_stricmp(inifile_cleanstr(value), "true"); 166 else if (!_stricmp(name, "throwtest")) 167 patch_throwtest = !_stricmp(inifile_cleanstr(value), "true"); 168 else if (!_stricmp(name, "usedaodangl")) 169 patch_usedaodangl = !_stricmp(inifile_cleanstr(value), "true"); 170 else if (!_stricmp(name, "usegettickcount")) 171 patch_usegettickcount = !_stricmp(inifile_cleanstr(value), "true"); 172 else if (!_stricmp(name, "wpfadetime")) 173 patch_wpfadetime = !_stricmp(inifile_cleanstr(value), "true"); 174 else 175 DDrStartupMessage("Daodan: Unrecognised ini patch \"%s\"", name); 176 break; 437 } 438 } 439 STARTUPMESSAGE("Finished parsing", 0); 440 } 441 442 443 /* 177 444 case s_language: 178 if (!_stricmp(name, "chinese"))179 patch_chinese = !_stricmp(inifile_cleanstr(value), "true");180 445 else if (!_stricmp(name, "blam")) 181 446 DDrPatch__strdup((int*)(OniExe + 0x0010fb73), value); … … 282 547 else if (!_stricmp(name, "carousel_off")) 283 548 DDr_CheatTable[21].message_off = _strdup(value); 284 else 285 DDrStartupMessage("Daodan: Unrecognised ini language item \"%s\"", name); 286 break; 287 case s_bsl: 288 default: 289 break; 290 } 291 292 return true; 293 } 294 295 void DDrConfig(int argc, char* argv[]) 296 { 297 int i; 298 char* section; 299 char* option; 300 bool falseoption; 301 302 303 // Tell Oni to not load non levelX_final-files by default: 304 opt_ignore_private_data = false; 305 306 // Enable sound by default: 307 opt_sound = true; 308 309 310 if (GetFileAttributes("daodan.ini") == INVALID_FILE_ATTRIBUTES) 311 { 312 FILE* fp; 313 DDrStartupMessage("Daodan: daodan.ini doesn't exist, creating"); 314 fp = fopen("daodan.ini", "w"); 315 if (fp) 316 { 317 fputs("[Options]\n", fp); 318 fputs("[Patch]\n", fp); 319 fputs("[BSL]\n", fp); 320 fputs("[Language]\n", fp); 321 fclose(fp); 322 } 323 } 324 325 DDrStartupMessage("Daodan: Parsing daodan.ini..."); 326 if (!inifile_read("daodan.ini", DDrIniCallback)) 327 DDrStartupMessage("Daodan: Error reading daodan.ini, check your syntax!"); 328 DDrStartupMessage("Daodan: Finished parsing"); 329 330 331 332 DDrStartupMessage("Daodan: Parsing command line..."); 333 for (i = 1; i < argc; i ++) 334 { 335 if (argv[i][0] == '-') 336 { 337 section = argv[i] + 1; 338 if ((option = strchr(argv[i], '.'))) 339 { 340 *option = '\0'; 341 falseoption = (option[1] == 'n' || option[1] == 'N') && (option[2] == 'o' || option[2] == 'O'); 342 if (i < (argc - 1) && argv[i + 1][0] != '-') 343 DDrIniCallback(section, true, option + 1, argv[++i]); 344 else 345 DDrIniCallback(section, true, option + (falseoption ? 3 : 1), (falseoption ? "false" : "true")); 346 *option = '.'; 347 } 348 else 349 { 350 falseoption = (section[0] == 'n' || section[0] == 'N') && (section[1] == 'o' || section[1] == 'O'); 351 ini_section = s_options; 352 if (i < (argc - 1) && argv[i + 1][0] != '-') 353 DDrIniCallback(NULL, false, section, argv[++i]); 354 else 355 DDrIniCallback(NULL, false, section + (falseoption ? 2 : 0), (falseoption ? "false" : "true")); 356 } 357 } 358 else 359 { 360 DDrStartupMessage("Daodan: Parse error \"%s\"", argv[i]); 361 break; 362 } 363 } 364 DDrStartupMessage("Daodan: Finished parsing"); 365 } 366 549 */ 550
Note:
See TracChangeset
for help on using the changeset viewer.