Changeset 993 for Daodan/src
- Timestamp:
- Apr 6, 2014, 7:06:02 PM (11 years ago)
- Location:
- Daodan/src
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
Daodan/src/Daodan.c
r992 r993 27 27 time(&rawtime); 28 28 timeinfo = localtime(&rawtime); 29 strftime(buffer, 80, " Daodan:%Y-%m-%d %H:%M:%S", timeinfo);29 strftime(buffer, 80, "%Y-%m-%d %H:%M:%S", timeinfo); 30 30 31 DDrStartupMessage("Daodan: Daodan v."DAODAN_VERSION_STRING" attached!");32 DDrStartupMessage(buffer);31 STARTUPMESSAGE("Daodan v."DAODAN_VERSION_STRING" attached!", 0); 32 STARTUPMESSAGE("%s", buffer); 33 33 34 34 DDrConfig(argc, argv); 35 35 36 36 if(GetKeyState(VK_SHIFT) & 0x8000) { 37 DDrStartupMessage("Daodan: Shift");37 STARTUPMESSAGE("Shift", 0); 38 38 guitest(DDrONiModule); 39 39 } -
Daodan/src/Daodan_BSL.c
r992 r993 726 726 727 727 if (!*type) 728 DDrStartupMessage("Daodan:Badly formed bsl definition for \"%s\"", name);728 STARTUPMESSAGE("Badly formed bsl definition for \"%s\"", name); 729 729 730 730 if (!strcmp(type, "int")) … … 738 738 else 739 739 { 740 DDrStartupMessage("Daodan:Unknown type in bsl definition for \"%s\"", name);740 STARTUPMESSAGE("Unknown type in bsl definition for \"%s\"", name); 741 741 return true; 742 742 } … … 783 783 void SLrConfig() 784 784 { 785 DDrStartupMessage("Daodan: Re-parsing daodan.ini for bsl...");785 STARTUPMESSAGE("Re-parsing daodan.ini for bsl...", 0); 786 786 inifile_read("daodan.ini", SLrIniCallback); 787 DDrStartupMessage("Daodan: Finished parsing");787 STARTUPMESSAGE("Finished parsing", 0); 788 788 } 789 789 */ … … 797 797 if(errornum) 798 798 { 799 DDrStartupMessage("Daodan:Registration of script command %s failed with error %i", name, errornum);799 STARTUPMESSAGE("Registration of script command %s failed with error %i", name, errornum); 800 800 } 801 801 } else { 802 DDrStartupMessage("Daodan:Registration of script command %s failed because of a too long argfmt", name);802 STARTUPMESSAGE("Registration of script command %s failed because of a too long argfmt", name); 803 803 } 804 804 } -
Daodan/src/Daodan_Cheater.c
r992 r993 8 8 9 9 #include "Daodan.h" 10 #include "Daodan_Config.h" 10 11 #include "Daodan_Cheater.h" 11 12 … … 97 98 float cheat_oldheight2 = 135; 98 99 bool inc_fallingframes = true; 99 extern bool patch_bsl; 100 100 101 uint8_t ONICALL DDrCheater(uint32_t cheat) 101 102 { … … 252 253 case cheat_elderrune: 253 254 { 254 if(patch_bsl) { 255 ConfigOption_t* co = DDrConfig_GetOptOfType("patch.bsl", C_BOOL); 256 if (co->value.intBoolVal) 257 { 255 258 int* Regeneration = &ONgGameState->PlayerCharacter->RegenHax; 256 259 if(*Regeneration) -
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 -
Daodan/src/Daodan_Config.h
r984 r993 4 4 #include "stdint.h" 5 5 6 typedef enum { 7 C_BOOL, 8 C_INT, 9 C_STRING, 10 EXT_BOOL 11 } OptionType_t; 12 13 typedef union { 14 int intBoolVal; 15 uint8_t* extBoolVal; 16 char* stringVal; 17 } OptionValue_t; 18 19 typedef struct { 20 char* name; 21 char* description; 22 OptionType_t type; 23 OptionValue_t defaultValue; 24 OptionValue_t value; 25 } ConfigOption_t; 26 27 typedef struct { 28 char* name; 29 char* description; 30 ConfigOption_t options[50]; 31 } ConfigSection_t; 32 33 6 34 void DDrConfig(int argc, char* argv[]); 7 35 8 extern bool patch_alttab; 9 extern bool patch_argb8888; 10 extern bool patch_binkplay; 11 extern bool patch_bsl; 12 extern bool patch_cheater; 13 extern bool patch_cheatsenabled; 14 extern bool patch_cheattable; 15 extern bool patch_clipcursor; 16 extern bool patch_cooldowntimer; 17 extern bool patch_daodandisplayenum; 18 extern bool patch_directinput; 19 extern bool patch_disablecmdline; 20 extern bool patch_flatline; 21 extern bool patch_fonttexturecache; 22 extern bool patch_getcmdline; 23 extern bool patch_hdscreens_lowres; 24 extern bool patch_highres_console; 25 extern bool patch_kickguns; 26 extern bool patch_killvtune; 27 extern bool patch_largetextures; 28 extern bool patch_levelplugins; 29 extern bool patch_newweapon; 30 extern bool patch_nomultibyte; 31 extern bool patch_optionsvisible; 32 extern bool patch_particledisablebit; 33 extern bool patch_pathfinding; 34 extern bool patch_projaware; 35 extern bool patch_safeprintf; 36 extern bool patch_showalllasersights; 37 extern bool patch_showtriggervolumes; 38 extern bool patch_throwtest; 39 extern bool patch_usedaodangl; 40 extern bool patch_usegettickcount; 41 extern bool patch_wpfadetime; 42 43 extern bool opt_border; 44 extern bool opt_gamma; 45 extern bool opt_topmost; 46 extern bool opt_usedaodanbsl; 47 48 extern bool patch_chinese; 36 ConfigOption_t* DDrConfig_GetOptOfType(const char* fullOptName, OptionType_t type); 37 const char* DDrConfig_GetOptionTypeName(OptionType_t type); 49 38 50 39 #endif -
Daodan/src/Daodan_GL.c
r992 r993 67 67 signed int j; 68 68 69 DDrStartupMessage("Daodan: Listing display modes");69 STARTUPMESSAGE("Listing display modes", 0); 70 70 71 71 memset(modes, 0, sizeof(M3tDisplayMode) * DD_MAX_MODES); … … 170 170 } 171 171 172 DDrStartupMessage("Daodan:%u modes available:", vmodes);172 STARTUPMESSAGE("%u modes available:", vmodes); 173 173 for (i = 0; i < vmodes; ++i) 174 DDrStartupMessage("Daodan:%ux%ux%u", modes[i].Width, modes[i].Height, modes[i].Depth);174 STARTUPMESSAGE(" %ux%ux%u", modes[i].Width, modes[i].Height, modes[i].Depth); 175 175 176 176 return vmodes; … … 254 254 else 255 255 { 256 if (opt_border) 256 ConfigOption_t* co = DDrConfig_GetOptOfType("options.border", C_BOOL); 257 if (co && co->value.intBoolVal) 257 258 { 258 259 pt.x = rc.left; … … 317 318 static void ONICALL DD_GLiGamma_Restore(void) 318 319 { 319 if (opt_gamma) 320 ConfigOption_t* co = DDrConfig_GetOptOfType("options.gamma", C_BOOL); 321 if (co->value.intBoolVal) 320 322 { 321 323 if (gl_api->wglSetDeviceGammaRamp3DFX) … … 328 330 static void ONICALL DD_GLiGamma_Initialize(void) 329 331 { 330 if (opt_gamma) 332 ConfigOption_t* co = DDrConfig_GetOptOfType("options.gamma", C_BOOL); 333 if (co->value.intBoolVal) 331 334 { 332 335 if (gl_api->wglSetDeviceGammaRamp3DFX) … … 399 402 } 400 403 401 if (!M3gResolutionSwitch && opt_gamma) 404 ConfigOption_t* co = DDrConfig_GetOptOfType("options.gamma", C_BOOL); 405 if (!M3gResolutionSwitch && co->value.intBoolVal) 402 406 { 403 407 UUrStartupMessage("Daodan: Ignoring gamma setting due to windowed mode"); 404 opt_gamma= false;408 co->value.intBoolVal = false; 405 409 } 406 410 -
Daodan/src/Daodan_Patch.c
r990 r993 45 45 DISASM MyDisasm; 46 46 int i = 0; 47 DDrStartupMessage("");48 DDrStartupMessage("");47 STARTUPMESSAGE("", 0); 48 STARTUPMESSAGE("", 0); 49 49 50 50 memset (&MyDisasm, 0, sizeof(DISASM)); 51 51 MyDisasm.EIP = (UIntPtr) from; 52 52 i = 0; 53 DDrStartupMessage("Orig before @ 0x%06x", from);53 STARTUPMESSAGE("Orig before @ 0x%06x", from); 54 54 while (i<10){ 55 55 len = Disasm(&MyDisasm); 56 56 if (len != UNKNOWN_OPCODE) { 57 DDrStartupMessage("%s, Opcode: 0x%x, len: %d, branch: %d, to: 0x%06x", MyDisasm.CompleteInstr, MyDisasm.Instruction.Opcode, len, MyDisasm.Instruction.BranchType, MyDisasm.Instruction.AddrValue);58 DDrStartupMessage(" Cat: 0x%04x, prefix count: %d", MyDisasm.Instruction.Category & 0xffff, MyDisasm.Prefix.Number );57 STARTUPMESSAGE("%s, Opcode: 0x%x, len: %d, branch: %d, to: 0x%06x", MyDisasm.CompleteInstr, MyDisasm.Instruction.Opcode, len, MyDisasm.Instruction.BranchType, MyDisasm.Instruction.AddrValue); 58 STARTUPMESSAGE(" Cat: 0x%04x, prefix count: %d", MyDisasm.Instruction.Category & 0xffff, MyDisasm.Prefix.Number ); 59 59 MyDisasm.EIP += (UIntPtr)len; 60 60 i++; 61 61 } 62 62 }; 63 DDrStartupMessage("");63 STARTUPMESSAGE("", 0); 64 64 */ 65 65 … … 78 78 if ((disasm.Instruction.Category & 0xffff) == CONTROL_TRANSFER) { 79 79 if (disasm.Prefix.Number > 0) { 80 DDrStartupMessage("Daodan:Detour: Branch in trampoline area from address 0x%08x with prefixes", from);80 STARTUPMESSAGE("Detour: Branch in trampoline area from address 0x%08x with prefixes", from); 81 81 return (void*)-1; 82 82 } … … 145 145 break; 146 146 default: 147 DDrStartupMessage("Daodan:Detour: Unknown branch in trampoline area from address 0x%08x", from);147 STARTUPMESSAGE("Detour: Unknown branch in trampoline area from address 0x%08x", from); 148 148 return (void*)-1; 149 149 } … … 155 155 } 156 156 else { 157 DDrStartupMessage("Daodan:Detour: Unknown opcode in trampoline area from address 0x%08x", from);157 STARTUPMESSAGE("Detour: Unknown opcode in trampoline area from address 0x%08x", from); 158 158 return (void*)-1; 159 159 } … … 161 161 162 162 if (branches > 1) { 163 DDrStartupMessage("Daodan:Detour: Too many branches in trampoline'd code from address 0x%08x: %d", from, branches);163 STARTUPMESSAGE("Detour: Too many branches in trampoline'd code from address 0x%08x: %d", from, branches); 164 164 return (void*)-1; 165 165 } … … 171 171 DWORD oldp; 172 172 if (!VirtualProtect(trampoline, 40, PAGE_EXECUTE_READWRITE, &oldp)) { 173 DDrStartupMessage("Daodan:Detour: Could not mark page for trampoline as executable: from address 0x%08x", from);173 STARTUPMESSAGE("Detour: Could not mark page for trampoline as executable: from address 0x%08x", from); 174 174 return (void*)-1; 175 175 } … … 179 179 MyDisasm.EIP = (UIntPtr) trampoline; 180 180 i = 0; 181 DDrStartupMessage("Trampoline @ 0x%06x", trampoline);181 STARTUPMESSAGE("Trampoline @ 0x%06x", trampoline); 182 182 while (i<10){ 183 183 len = Disasm(&MyDisasm); 184 184 if (len != UNKNOWN_OPCODE) { 185 DDrStartupMessage(MyDisasm.CompleteInstr);185 STARTUPMESSAGE("%s", MyDisasm.CompleteInstr); 186 186 MyDisasm.EIP += (UIntPtr)len; 187 187 i++; 188 188 } 189 189 }; 190 DDrStartupMessage("");190 STARTUPMESSAGE("", 0); 191 191 192 192 memset (&MyDisasm, 0, sizeof(DISASM)); 193 193 MyDisasm.EIP = disasm.EIP; 194 194 i = 0; 195 DDrStartupMessage("Orig after @ 0x%06x", disasm.EIP);195 STARTUPMESSAGE("Orig after @ 0x%06x", disasm.EIP); 196 196 while (i<7){ 197 197 len = Disasm(&MyDisasm); 198 198 if (len != UNKNOWN_OPCODE) { 199 DDrStartupMessage(MyDisasm.CompleteInstr);199 STARTUPMESSAGE("%s", MyDisasm.CompleteInstr); 200 200 MyDisasm.EIP += (UIntPtr)len; 201 201 i++; 202 202 } 203 203 }; 204 DDrStartupMessage("");204 STARTUPMESSAGE("", 0); 205 205 206 206 memset (&MyDisasm, 0, sizeof(DISASM)); 207 207 MyDisasm.EIP = (UIntPtr) from; 208 208 i = 0; 209 DDrStartupMessage("Orig start after @ 0x%06x", from);209 STARTUPMESSAGE("Orig start after @ 0x%06x", from); 210 210 while (i<3){ 211 211 len = Disasm(&MyDisasm); 212 212 if (len != UNKNOWN_OPCODE) { 213 DDrStartupMessage(MyDisasm.CompleteInstr);213 STARTUPMESSAGE("%s", MyDisasm.CompleteInstr); 214 214 MyDisasm.EIP += (UIntPtr)len; 215 215 i++; 216 216 } 217 217 }; 218 DDrStartupMessage("");219 DDrStartupMessage("");220 DDrStartupMessage("");218 STARTUPMESSAGE("", 0); 219 STARTUPMESSAGE("", 0); 220 STARTUPMESSAGE("", 0); 221 221 */ 222 222 -
Daodan/src/Daodan_Utility.h
r692 r993 3 3 4 4 #include "Daodan.h" 5 6 #define WHERESTR "Daodan [%-22s:%4d ]: " 7 #define WHEREARG __FILE__, __LINE__ 8 #define DEBUGPRINT2(...) DDrStartupMessage(__VA_ARGS__) 9 #define STARTUPMESSAGE(_fmt, ...) DEBUGPRINT2(WHERESTR _fmt, WHEREARG, __VA_ARGS__) 10 5 11 6 12 void __cdecl DDrStartupMessage(const char* fmt, ...); -
Daodan/src/Daodan_Win32.c
r992 r993 153 153 else 154 154 { 155 ConfigOption_t* co = DDrConfig_GetOptOfType("options.border", C_BOOL); 156 int opt_border = 0; 157 if (co && co->value.intBoolVal) 158 opt_border = 1; 159 co = DDrConfig_GetOptOfType("options.topmost", C_BOOL); 160 int opt_topmost = 0; 161 if (co && co->value.intBoolVal) 162 opt_topmost = 1; 163 155 164 window_style = (opt_border) ? WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_DLGFRAME | WS_MINIMIZEBOX : WS_POPUP; 156 165 window_style_ex = (opt_topmost) ? WS_EX_TOPMOST : 0; -
Daodan/src/Inifile_Reader.c
r692 r993 7 7 #include "Inifile_Reader.h" 8 8 9 char* inifile_cleanstr(char* str)9 static char* strtrim(char* string) 10 10 { 11 int i; 12 for (i = strlen(str) - 1; i >= 0; i --) 13 if (isspace(str[i])) 14 str[i] = '\0'; 11 while (isspace(*string)) 12 string++; 13 for (int i = strlen(string) - 1; i >= 0; i--) 14 { 15 if (isspace(string[i])) 16 { 17 string[i] = 0; 18 } 15 19 else 20 { 16 21 break; 17 18 while (isspace(*str)) 19 str++; 20 21 return str; 22 } 23 } 24 return string; 22 25 } 23 26 24 int64_t inifile_parseint(const char* str, bool issigned)27 static char* newlines(char* string) 25 28 { 26 int64_t ret = 0; 27 bool neg = false; 28 if (str[0] == '0' && str[1] == 'x') 29 for (char* i = string + strlen(string) - 1; i >= string; i--) 29 30 { 30 int i; 31 if (str[2] == '\0') 32 return 0x100000000LL; 33 34 for (i = 0, str += 2; *str; i++, str++) 31 if ((*i == '\\') && (*(i+1) == 'n')) 35 32 { 36 if (i == 8) 37 return 0x100000000LL; 38 39 ret <<= 4; 40 if (*str >= '0' && *str <= '9') 41 ret |= *str - '0'; 42 else if (*str >= 'a' && *str <= 'f') 43 ret |= *str - 'a' + 10; 44 else if (*str >= 'A' && *str <= 'F') 45 ret |= *str - 'A' + 10; 46 else 47 return 0x100000000LL; 33 *i = '\n'; 34 memmove(i+1, i+2, strlen(i+1)); 48 35 } 49 return ret;50 36 } 51 else if ((*str >= '0' && *str <= '9') || (neg = (*str == '-'))) 52 { 53 int i; 54 if (neg) 55 str++; 56 for (i = 0; *str; i++, str++) 57 { 58 if (i == 10) 59 return 0x100000000LL; 60 else if (i == 9 && !issigned && (ret > 429496729LL || (ret == 429496729LL && *str > '5'))) 61 return 0x100000000LL; 62 else if (i == 9 && issigned && (ret > 214748364LL || (ret == 214748364LL && *str > (neg ? '8' : '7')))) 63 return 0x100000000LL; 64 65 ret *= 10; 66 if (*str >= '0' && *str <= '9') 67 ret += *str - '0'; 68 else 69 return 0x100000000LL; 70 } 71 if (neg) 72 ret *= -1; 73 return ret; 74 } 75 else 76 return 0x100000000LL; 37 return string; 77 38 } 78 39 79 bool inifile_read(const char* filename, inifile_callback callback)40 bool Inifile_Read(const char* filename, inifile_callback callback) 80 41 { 81 42 FILE* fp = fopen(filename, "r"); 82 char* inisection = ""; 43 44 char inisection[30] = ""; 45 char option[30] = ""; 46 char value[200] = ""; 47 83 48 char readbuf[4096] = ""; 84 49 char* readptr; 50 85 51 bool success = true; 86 bool newsection = false;87 52 88 53 if (!fp) 89 return inifile_cantread;54 return false; 90 55 91 56 while ((readptr = fgets(readbuf, sizeof(readbuf), fp))) // Loop through each line. … … 93 58 while (isspace(readptr[0])) // Skip whitespace. 94 59 readptr++; 95 60 96 61 if (readptr[0] == '\0' || readptr[0] == '#' || readptr[0] == '!') // Skip empty lines and comments. 97 62 continue; 98 else if (readptr[0] == '[' && readptr[1] != ']') // It's a section header. 63 64 if (sscanf(readptr, "[%[^]]]", inisection) == 1) 99 65 { 100 int i;101 for (i = 2; readptr[i]; i ++) // Look for the ]102 if (readptr[i] == ']')103 break;104 105 if (readptr[i]) // Replace with a null or crash with error.106 readptr[i] = '\0';107 else108 {109 success = false;110 break;111 }112 113 if (inisection[0])114 free(inisection);115 inisection = _strdup(readptr + 1); // Skip the first [116 newsection = true;117 66 } 118 else // It's a value.67 else if (sscanf(readptr, "%[^=]=%[^\n]", option, value) == 2) 119 68 { 120 int i; 121 int equals = 0; 122 for (i = 0; readptr[i]; i ++) // Find the = 123 if (readptr[i] == '=') 124 equals = i; 125 126 if (readptr[i - 1] == '\n') 127 readptr[i - 1] = '\0'; // Remove the trailing newline. 128 129 if (equals) 130 { 131 readptr[equals] = '\0'; 132 if (!callback(inisection, newsection, readptr, readptr + equals + 1)) // If the callback is false, exit. 133 break; 134 newsection = false; 135 } 136 else // If there's no equals, crash with error. 137 { 138 success = false; 139 break; 140 } 69 callback(inisection, strtrim(option), newlines(strtrim(value))); 70 } 71 else 72 { 73 success = false; 141 74 } 142 75 } 143 144 if (inisection[0])145 free(inisection);146 76 147 77 fclose(fp); 148 78 return success; 149 79 } 80 -
Daodan/src/Inifile_Reader.h
r692 r993 4 4 #include "stdint.h" 5 5 6 enum { 7 inifile_cantread = -20 8 }; 6 typedef void (*inifile_callback)(char* section, char* name, char* value); 9 7 10 typedef bool (*inifile_callback)(char* section, bool newsection, char* name, char* value); 11 12 char* inifile_cleanstr(char* str); 13 int64_t inifile_parseint(const char* str, bool issigned); 14 bool inifile_read(const char* filename, inifile_callback callback); 8 bool Inifile_Read(const char* filename, inifile_callback callback); 15 9 16 10 #endif -
Daodan/src/Oni/Symbols_Var.h
r992 r993 12 12 13 13 // Option "debug" ... but what does it do? 14 #define AKgDebug_DebugMaps (*(( char*)0x002b2204))14 #define AKgDebug_DebugMaps (*((onibool*)0x002b2204)) 15 15 16 16 // Option "debugfiles" ... but what does it do? 17 #define BFgDebugFileEnable (*(( bool*)0x0055c8d0))17 #define BFgDebugFileEnable (*((onibool*)0x0055c8d0)) 18 18 19 19 // Command line instance … … 57 57 // False to prevent Oni from changing display settings (however Bink 58 58 // player does not respect this setting). 59 #define M3gResolutionSwitch (*(( char*)0x00531634))59 #define M3gResolutionSwitch (*((onibool*)0x00531634)) 60 60 61 61 // Startup.txt file handle … … 69 69 70 70 // Load non levelX_final-files yes/no 71 #define opt_ignore_private_data (*(( char*)0x006370f0))71 #define opt_ignore_private_data (*((onibool*)0x006370f0)) 72 72 73 73 // Play sound yes/no 74 #define opt_sound (*(( char*)0x006370fc))74 #define opt_sound (*((onibool*)0x006370fc)) 75 75 76 76 // Option "findsounds" ... but what does it do? 77 #define SSgSearchOnDisk (*(( bool*)0x005eb758))77 #define SSgSearchOnDisk (*((onibool*)0x005eb758)) 78 78 79 79 // OBJgTriggerVolume_Visible - bsl var to show trigger volumes -
Daodan/src/bink-proxy.c
r990 r993 54 54 DWORD err; 55 55 56 DDrStartupMessage("Daodan: Loading real Bink DLL");56 STARTUPMESSAGE("Loading real Bink DLL", 0); 57 57 realbink = LoadLibrary("realbink.dll"); 58 58 err = GetLastError(); … … 63 63 if(!BinkBufferBlit) 64 64 { 65 DDrStartupMessage("Daodan: Retrieving function address from real Bink DLL failed for: BinkBufferBlit");65 STARTUPMESSAGE("Retrieving function address from real Bink DLL failed for: BinkBufferBlit", 0); 66 66 goto exit_err; 67 67 } … … 69 69 if(!BinkBufferClose) 70 70 { 71 DDrStartupMessage("Daodan: Retrieving function address from real Bink DLL failed for: BinkBufferClose");71 STARTUPMESSAGE("Retrieving function address from real Bink DLL failed for: BinkBufferClose", 0); 72 72 goto exit_err; 73 73 } … … 75 75 if(!BinkBufferLock) 76 76 { 77 DDrStartupMessage("Daodan: Retrieving function address from real Bink DLL failed for: BinkBufferLock");77 STARTUPMESSAGE("Retrieving function address from real Bink DLL failed for: BinkBufferLock", 0); 78 78 goto exit_err; 79 79 } … … 81 81 if(!BinkBufferOpen) 82 82 { 83 DDrStartupMessage("Daodan: Retrieving function address from real Bink DLL failed for: BinkBufferOpen");83 STARTUPMESSAGE("Retrieving function address from real Bink DLL failed for: BinkBufferOpen", 0); 84 84 goto exit_err; 85 85 } … … 87 87 if(!BinkBufferSetOffset) 88 88 { 89 DDrStartupMessage("Daodan: Retrieving function address from real Bink DLL failed for: BinkBufferSetOffset");89 STARTUPMESSAGE("Retrieving function address from real Bink DLL failed for: BinkBufferSetOffset", 0); 90 90 goto exit_err; 91 91 } … … 93 93 if(!BinkBufferUnlock) 94 94 { 95 DDrStartupMessage("Daodan: Retrieving function address from real Bink DLL failed for: BinkBufferUnlock");95 STARTUPMESSAGE("Retrieving function address from real Bink DLL failed for: BinkBufferUnlock", 0); 96 96 goto exit_err; 97 97 } … … 99 99 if(!BinkClose) 100 100 { 101 DDrStartupMessage("Daodan: Retrieving function address from real Bink DLL failed for: BinkClose");101 STARTUPMESSAGE("Retrieving function address from real Bink DLL failed for: BinkClose", 0); 102 102 goto exit_err; 103 103 } … … 105 105 if(!BinkCopyToBuffer) 106 106 { 107 DDrStartupMessage("Daodan: Retrieving function address from real Bink DLL failed for: BinkCopyToBuffer");107 STARTUPMESSAGE("Retrieving function address from real Bink DLL failed for: BinkCopyToBuffer", 0); 108 108 goto exit_err; 109 109 } … … 111 111 if(!BinkDoFrame) 112 112 { 113 DDrStartupMessage("Daodan: Retrieving function address from real Bink DLL failed for: BinkDoFrame");113 STARTUPMESSAGE("Retrieving function address from real Bink DLL failed for: BinkDoFrame", 0); 114 114 goto exit_err; 115 115 } … … 117 117 if(!BinkGetRects) 118 118 { 119 DDrStartupMessage("Daodan: Retrieving function address from real Bink DLL failed for: BinkGetRects");119 STARTUPMESSAGE("Retrieving function address from real Bink DLL failed for: BinkGetRects", 0); 120 120 goto exit_err; 121 121 } … … 123 123 if(!BinkNextFrame) 124 124 { 125 DDrStartupMessage("Daodan: Retrieving function address from real Bink DLL failed for: BinkNextFrame");125 STARTUPMESSAGE("Retrieving function address from real Bink DLL failed for: BinkNextFrame", 0); 126 126 goto exit_err; 127 127 } … … 129 129 if(!BinkOpen) 130 130 { 131 DDrStartupMessage("Daodan: Retrieving function address from real Bink DLL failed for: BinkOpen");131 STARTUPMESSAGE("Retrieving function address from real Bink DLL failed for: BinkOpen", 0); 132 132 goto exit_err; 133 133 } … … 135 135 if(!BinkOpenDirectSound) 136 136 { 137 DDrStartupMessage("Daodan: Retrieving function address from real Bink DLL failed for: BinkOpenDirectSound");137 STARTUPMESSAGE("Retrieving function address from real Bink DLL failed for: BinkOpenDirectSound", 0); 138 138 goto exit_err; 139 139 } … … 141 141 if(!BinkService) 142 142 { 143 DDrStartupMessage("Daodan: Retrieving function address from real Bink DLL failed for: BinkService");143 STARTUPMESSAGE("Retrieving function address from real Bink DLL failed for: BinkService", 0); 144 144 goto exit_err; 145 145 } … … 147 147 if(!BinkSetIOSize) 148 148 { 149 DDrStartupMessage("Daodan: Retrieving function address from real Bink DLL failed for: BinkSetIOSize");149 STARTUPMESSAGE("Retrieving function address from real Bink DLL failed for: BinkSetIOSize", 0); 150 150 goto exit_err; 151 151 } … … 153 153 if(!BinkSetSoundOnOff) 154 154 { 155 DDrStartupMessage("Daodan: Retrieving function address from real Bink DLL failed for: BinkSetSoundOnOff");155 STARTUPMESSAGE("Retrieving function address from real Bink DLL failed for: BinkSetSoundOnOff", 0); 156 156 goto exit_err; 157 157 } … … 159 159 if(!BinkSetSoundSystem) 160 160 { 161 DDrStartupMessage("Daodan: Retrieving function address from real Bink DLL failed for: BinkSetSoundSystem");161 STARTUPMESSAGE("Retrieving function address from real Bink DLL failed for: BinkSetSoundSystem", 0); 162 162 goto exit_err; 163 163 } … … 165 165 if(!BinkSetVolume) 166 166 { 167 DDrStartupMessage("Daodan: Retrieving function address from real Bink DLL failed for: BinkSetVolume");167 STARTUPMESSAGE("Retrieving function address from real Bink DLL failed for: BinkSetVolume", 0); 168 168 goto exit_err; 169 169 } … … 171 171 if(!BinkWait) 172 172 { 173 DDrStartupMessage("Daodan: Retrieving function address from real Bink DLL failed for: BinkWait");173 STARTUPMESSAGE("Retrieving function address from real Bink DLL failed for: BinkWait", 0); 174 174 goto exit_err; 175 175 } … … 178 178 char msg[100]; 179 179 FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, 0, msg, 100, NULL); 180 DDrStartupMessage("Daodan:Loading real Bink DLL failed with error %i: %s", err, msg);180 STARTUPMESSAGE("Loading real Bink DLL failed with error %i: %s", err, msg); 181 181 } 182 182 } -
Daodan/src/patches/Patches.c
r992 r993 19 19 static void ONICALL DD_ONiOGU_GammaSlider_SetRange(void* window, int min_value, int max_value) 20 20 { 21 WMrWindow_SetEnabled(window, M3gResolutionSwitch && opt_gamma); 21 ConfigOption_t* co = DDrConfig_GetOptOfType("options.gamma", C_BOOL); 22 WMrWindow_SetEnabled(window, M3gResolutionSwitch && co->value.intBoolVal); 22 23 WMrSlider_SetRange(window, min_value, max_value); 23 24 } … … 79 80 void ONICALL DDrGame_Init() 80 81 { 81 if (opt_usedaodanbsl) 82 ConfigOption_t* co = DDrConfig_GetOptOfType("options.usedaodanbsl", C_BOOL); 83 if (co->value.intBoolVal) 82 84 SLrDaodan_Initialize(); 83 85 } … … 287 289 DWORD err; 288 290 289 DDrStartupMessage("Daodan: Loading chinese DLL");291 STARTUPMESSAGE("Loading chinese DLL", 0); 290 292 dll = LoadLibrary("xfhsm_oni.dll"); 291 293 err = GetLastError(); … … 300 302 char msg[100]; 301 303 FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, 0, msg, 100, NULL); 302 DDrStartupMessage("Daodan:Loading DLL failed with error %i: %s", err, msg);304 STARTUPMESSAGE("Loading DLL failed with error %i: %s", err, msg); 303 305 } 304 306 } … … 606 608 bool DD_Patch_Init() 607 609 { 608 DDrStartupMessage("Daodan: Patching engine");609 610 if ( patch_alttab)610 STARTUPMESSAGE("Patching engine", 0); 611 612 if (DDrConfig_GetOptOfType("patches.alttab", C_BOOL)->value.intBoolVal) 611 613 DD_Patch_AltTab(); 612 614 613 if ( patch_argb8888)615 if (DDrConfig_GetOptOfType("patches.argb8888", C_BOOL)->value.intBoolVal) 614 616 DD_Patch_ARGB8888(); 615 617 616 if ( patch_binkplay)618 if (DDrConfig_GetOptOfType("patches.binkplay", C_BOOL)->value.intBoolVal) 617 619 DD_Patch_BinkPlay(); 618 620 619 if ( patch_bsl)621 if (DDrConfig_GetOptOfType("patches.bsl", C_BOOL)->value.intBoolVal) 620 622 DD_Patch_BSL(); 621 623 622 if ( patch_cheater)624 if (DDrConfig_GetOptOfType("patches.cheater", C_BOOL)->value.intBoolVal) 623 625 DD_Patch_Cheater(); 624 626 625 if ( patch_cheatsenabled)627 if (DDrConfig_GetOptOfType("patches.cheatsenabled", C_BOOL)->value.intBoolVal) 626 628 DD_Patch_CheatsEnabled(); 627 629 628 if ( patch_cheattable)630 if (DDrConfig_GetOptOfType("patches.cheattable", C_BOOL)->value.intBoolVal) 629 631 DD_Patch_CheatTable(); 630 632 631 if ( patch_chinese)633 if (DDrConfig_GetOptOfType("patches.chinese", C_BOOL)->value.intBoolVal) 632 634 DD_Patch_Chinese(); 633 635 634 if ( patch_clipcursor)636 if (DDrConfig_GetOptOfType("patches.clipcursor", C_BOOL)->value.intBoolVal) 635 637 DD_Patch_ClipCursor(); 636 638 637 if ( patch_cooldowntimer)639 if (DDrConfig_GetOptOfType("patches.cooldowntimer", C_BOOL)->value.intBoolVal) 638 640 DD_Patch_CooldownTimer(); 639 641 640 if ( patch_daodandisplayenum)642 if (DDrConfig_GetOptOfType("patches.daodandisplayenum", C_BOOL)->value.intBoolVal) 641 643 DD_Patch_DaodanDisplayEnum(); 642 644 643 if ( patch_directinput)645 if (DDrConfig_GetOptOfType("patches.directinput", C_BOOL)->value.intBoolVal) 644 646 DD_Patch_DirectInput(); 645 647 646 if ( patch_disablecmdline)648 if (DDrConfig_GetOptOfType("patches.disablecmdline", C_BOOL)->value.intBoolVal) 647 649 DD_Patch_DisableCmdLine(); 648 650 649 if ( patch_fonttexturecache)651 if (DDrConfig_GetOptOfType("patches.fonttexturecache", C_BOOL)->value.intBoolVal) 650 652 DD_Patch_FontTextureCache(); 651 653 652 if ( patch_getcmdline)654 if (DDrConfig_GetOptOfType("patches.getcmdline", C_BOOL)->value.intBoolVal) 653 655 DD_Patch_GetCmdLine(); 654 656 655 if ( patch_hdscreens_lowres)657 if (DDrConfig_GetOptOfType("patches.hdscreens_lowres", C_BOOL)->value.intBoolVal) 656 658 DD_Patch_HDScreens_LowRes(); 657 659 658 if ( patch_highres_console)660 if (DDrConfig_GetOptOfType("patches.highres_console", C_BOOL)->value.intBoolVal) 659 661 DD_Patch_HighresConsole(); 660 662 661 if ( patch_kickguns)663 if (DDrConfig_GetOptOfType("patches.kickguns", C_BOOL)->value.intBoolVal) 662 664 DD_Patch_KickGuns(); 663 665 … … 665 667 // DD_Patch_KillVTune(); 666 668 667 if ( patch_largetextures)669 if (DDrConfig_GetOptOfType("patches.largetextures", C_BOOL)->value.intBoolVal) 668 670 DD_Patch_LargeTextures(); 669 671 670 if ( patch_levelplugins)672 if (DDrConfig_GetOptOfType("patches.levelplugins", C_BOOL)->value.intBoolVal) 671 673 DD_Patch_LevelPlugins(); 672 674 673 if ( patch_newweapon)675 if (DDrConfig_GetOptOfType("patches.newweap", C_BOOL)->value.intBoolVal) 674 676 DD_Patch_NewWeap(); 675 677 676 if ( patch_nomultibyte)678 if (DDrConfig_GetOptOfType("patches.nomultibyte", C_BOOL)->value.intBoolVal) 677 679 DD_Patch_NoMultiByte(); 678 680 679 if (patch_optionsvisible)681 if (DDrConfig_GetOptOfType("patches.optionsvisible", C_BOOL)->value.intBoolVal) 680 682 DD_Patch_OptionsVisible(); 681 683 682 if ( patch_particledisablebit)684 if (DDrConfig_GetOptOfType("patches.particledisablebit", C_BOOL)->value.intBoolVal) 683 685 DD_Patch_ParticleDisableBit(); 684 686 685 if ( patch_pathfinding)687 if (DDrConfig_GetOptOfType("patches.pathfinding", C_BOOL)->value.intBoolVal) 686 688 DD_Patch_PathFinding(); 687 689 688 if ( patch_projaware)690 if (DDrConfig_GetOptOfType("patches.projaware", C_BOOL)->value.intBoolVal) 689 691 DD_Patch_ProjAware(); 690 692 691 if ( patch_safeprintf)693 if (DDrConfig_GetOptOfType("patches.safeprintf", C_BOOL)->value.intBoolVal) 692 694 DD_Patch_SafePrintf(); 693 695 694 if ( patch_showalllasersights)696 if (DDrConfig_GetOptOfType("patches.showalllasersights", C_BOOL)->value.intBoolVal) 695 697 DD_Patch_ShowAllLasersights(); 696 698 697 if ( patch_showtriggervolumes)699 if (DDrConfig_GetOptOfType("patches.showtriggervolumes", C_BOOL)->value.intBoolVal) 698 700 DD_Patch_ShowTriggerVolumes(); 699 701 700 if ( patch_throwtest)702 if (DDrConfig_GetOptOfType("patches.throwtest", C_BOOL)->value.intBoolVal) 701 703 DD_Patch_Throwtest(); 702 704 703 if ( patch_usedaodangl)705 if (DDrConfig_GetOptOfType("patches.usedaodangl", C_BOOL)->value.intBoolVal) 704 706 DD_Patch_UseDaodanGL(); 705 707 706 if ( patch_usegettickcount)708 if (DDrConfig_GetOptOfType("patches.usegettickcount", C_BOOL)->value.intBoolVal) 707 709 DD_Patch_UseGetTickCount(); 708 710 709 if ( patch_wpfadetime)711 if (DDrConfig_GetOptOfType("patches.wpfadetime", C_BOOL)->value.intBoolVal) 710 712 DD_Patch_WpFadetime(); 711 713
Note:
See TracChangeset
for help on using the changeset viewer.