Changeset 677 for Daodan/src/Daodan.c
- Timestamp:
- Mar 3, 2013, 12:46:33 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Daodan/src/Daodan.c
r476 r677 9 9 #include "Daodan_BSL.h" 10 10 #include "Daodan_Console.h" 11 12 11 #include "Daodan_WindowHack.h" 13 12 … … 48 47 bool patch_usegettickcount = true; 49 48 bool patch_cheatsenabled = true; 50 bool patch_usedaodangl = true;51 bool patch_windowhack = false;49 bool patch_usedaodangl = false; 50 bool patch_windowhack = true; 52 51 bool patch_daodaninit = true; 53 52 bool patch_bsl = true; 54 53 bool patch_cheater = true; 55 56 // bool patch_newweapon = true; 57 54 bool patch_newweapon = true; 58 55 bool opt_usedaodanbsl = true; 59 56 bool opt_border = true; … … 61 58 bool opt_topmost = false; 62 59 60 typedef int (__cdecl *CHINESEPROC)(DWORD WINAPI); 61 bool patch_chinese = false; 63 62 bool DDrPatch_Init() 64 63 { … … 68 67 if (patch_fonttexturecache) 69 68 { 70 DDrPatch_Byte 71 DDrPatch_Byte 69 DDrPatch_Byte(OniExe + 0x00020ea7, 0x20); 70 DDrPatch_Byte(OniExe + 0x00020f4a, 0x40); 72 71 } 73 72 … … 83 82 if (patch_pathfinding) 84 83 { 84 const char pathfinding[2] = {0x90 , 0xE9 }; 85 85 DDrPatch_Byte (OniExe + 0x0010b03b, 0x20); 86 86 DDrPatch_Byte (OniExe + 0x0010b04c, 0x20); 87 88 //other stuff 89 DDrPatch_Const(0x440789, pathfinding); 87 90 } 88 91 … … 99 102 if (patch_directinput) 100 103 DDrPatch_Byte (OniExe + 0x00002e6d, 0xeb); 101 104 102 105 if (patch_wpfadetime) 103 106 { … … 108 111 109 112 // Sets the fadetime to 4800 by default 110 DDrPatch_Int16 (OniExe + 0x0011ab0e, 0x12c0); 111 } 112 113 DDrPatch_Int16 ((OniExe + 0x0011ab0e), 0x12c0); 114 } 115 116 // FIXME: add switches 117 //pathfinding fix 118 119 120 113 121 114 122 // Hackish fix for Konoko not kicking guns 123 // Don't use this, it breaks stairs. 115 124 if (patch_kickguns) 116 125 { … … 167 176 if (patch_cheattable) 168 177 { 169 DDrPatch_Int32 ( OniExe + 0x000f616b, (int)&DDr_CheatTable[0].name);178 DDrPatch_Int32 (0x004f616b, (int)&DDr_CheatTable[0].name); 170 179 DDrPatch_Int32 (OniExe + 0x000f617a, (int)&DDr_CheatTable[0].message_on); 171 180 } … … 179 188 180 189 //Test newweap patch 181 //if (patch_newweapon) {190 if (patch_newweapon) { 182 191 183 192 //Makes it always say "Recieved weapon_name." 184 193 //Needs check for loc_4DFC66 185 DDrPatch_NOOP( OniExe + 0x000E4DF8,2);194 //DDrPatch_NOOP( OniExe + 0x000E4DF8,2); 186 195 187 196 //Adds Weapon name and ammo meter to pickup autoprompt … … 191 200 192 201 //Moves location of colors 193 DDrPatch_Int32( OniExe + 0x0002E3D5, (int)&DDrDSayColors[0].Char);194 DDrPatch_Int32( OniExe + 0x0002E3DA, (int)&DDrDSayColors[0].Char);195 //}202 //DDrPatch_Int32( 0x0042E3D5, (int)&DDrDSayColors ); 203 //DDrPatch_Int32( 0x0042E3DA, (int)&DDrDSayColors ); 204 } 196 205 197 206 // Disable loading the vtuneapi.dll 198 if (patch_killvtune)199 DDrPatch_Byte (OniExe + 0x00026340, 0xC3);207 //if (patch_killvtune) 208 //DDrPatch_Byte (OniExe + 0x00026340, 0xC3); 200 209 201 210 // Disable Oni's internal CLrGetCommandLine function (to eventually replace it with our own) … … 207 216 DDrPatch_Int32 (OniExe + 0x000d3570, 0xc3c03366); 208 217 218 if (patch_bsl) 219 { 220 //Calculating the value of the needed offset is much more reliable when the compiler does it for you. 221 222 //TODO: fix moonshadow. 223 Character * Chr = 0; 224 int NoPath = (int)&(Chr[0].RegenHax) & 0x000000FF; 225 const char regen_patch[] = 226 {0x90, 0x90, 0x90, 0x90, 0x90, // mov al, _WPgRegenerationCheat -> NOOP 227 0x90, 0x90, // test al, al -> NOOP 228 0x90, 0x90, // jz short loc_51BB98 -> NOOP 229 0x8B, 0x86, (char)NoPath, 0x01, 0x00, 0x00, // mov eax, [esi+Character.field_1E8] 230 // -> mov eax, [esi+Character.RegenHax] 231 0x85, 0xC0, // test eax, eax 232 0x74, 0x21 // jnz 0x21 -> jz 0x21 233 }; 234 DDrPatch_Const(0x0051BB64, regen_patch); 235 } 236 237 if(patch_chinese) 238 { 239 HMODULE dll = LoadLibrary("xfhsm_oni.dll"); 240 if( dll ) 241 { 242 void* proc = GetProcAddress( dll, "InstallHook" ); 243 if(proc) 244 { 245 ((CHINESEPROC)proc)(GetCurrentThreadId()); 246 } 247 } 248 } 249 250 //Fix crappy ai2_shownames 251 if(1) 252 { 253 //Set distance above head to 4.0 254 DDrPatch_Int32(0x0048C998, 0x005296C8); 255 //texture height 256 DDrPatch_Byte( 0x0048C9DF, 0x3F ); 257 //texture width 258 DDrPatch_NOOP( (char*)0x0048C9CA, 6 ); 259 //Set the text color to whatever we like ;) 260 DDrPatch_NOOP( 0x0048C898, 6 ); 261 DDrPatch_Byte( 0x0048C898, 0x8B ); 262 DDrPatch_Byte( 0x0048C899, 0xCE ); 263 //FLATLINE? DDrPatch_MakeCall( 0x0048C8A3, FLrHook_DebugNameShadeHack); 264 265 //Make the background black for additive blending 266 //FLATLINE? DDrPatch_MakeCall( 0x0048C802, FLrHook_DebugNameTextureInit ); 267 } 268 269 if(1) 270 { 271 //DDrPatch_NOOP( 0x004E1957, 6 ); 272 //DDrPatch_MakeCall( 0x004E17F6, FLrHook_Lasers ); 273 } 274 275 //Flatline related stuff 276 // DDrPatch_MakeCall(0x004FBCEA, DDrText_Hook); 277 278 //FLATLINE? DDrPatch_Int32( 0x004B24D2, FLrSpawnHack); 279 280 //FLATLINE? DDrPatch_NOOP(0x004C26CB, 6); 281 282 //FLATLINE? DDrPatch_MakeCall( 0x004C26CB, FLrHook_DoorOpen); 283 //FLATLINE? DDrPatch_MakeCall( 0x004EE3CF, FLrHook_ConsoleActivate); 209 284 return true; 210 285 } … … 216 291 if (newsection) 217 292 { 218 if (! stricmp(section, "options"))293 if (!_stricmp(section, "options")) 219 294 ini_section = s_options; 220 else if (! stricmp(section, "patch"))295 else if (!_stricmp(section, "patch")) 221 296 ini_section = s_patch; 222 else if (! stricmp(section, "bsl"))297 else if (!_stricmp(section, "bsl")) 223 298 ini_section = s_bsl; 224 else if (! stricmp(section, "language"))299 else if (!_stricmp(section, "language")) 225 300 ini_section = s_language; 226 301 else … … 234 309 { 235 310 case s_options: 236 if (!stricmp(name, "usedaodanbsl")) 237 opt_usedaodanbsl = !stricmp(inifile_cleanstr(value), "true"); 238 else if (!stricmp(name, "border")) 239 opt_border = !stricmp(inifile_cleanstr(value), "true"); 240 else if (!stricmp(name, "shadow")) 241 opt_shadow = !stricmp(inifile_cleanstr(value), "true"); 242 else if (!stricmp(name, "topmost")) 243 opt_topmost = !stricmp(inifile_cleanstr(value), "true"); 244 else if (!stricmp(name, "multibyte")) 245 patch_multibyte = !stricmp(inifile_cleanstr(value), "true"); 246 else if (!stricmp(name, "debug")) 247 AKgDebug_DebugMaps = !stricmp(inifile_cleanstr(value), "true"); 248 else if (!stricmp(name, "debugfiles")) 249 BFgDebugFileEnable = !stricmp(inifile_cleanstr(value), "true"); 250 else if (!stricmp(name, "findsounds")) 251 SSgSearchOnDisk = !stricmp(inifile_cleanstr(value), "true"); 252 else if (!stricmp(name, "ignore_private_data")) 253 opt_ignore_private_data = !stricmp(inifile_cleanstr(value), "true"); 254 else if (!stricmp(name, "sound")) 255 opt_sound = !stricmp(inifile_cleanstr(value), "true"); 256 else if (!stricmp(name, "switch")) 257 M3gResolutionSwitch = !stricmp(inifile_cleanstr(value), "true"); 311 if (!_stricmp(name, "usedaodanbsl")) 312 opt_usedaodanbsl = !_stricmp(inifile_cleanstr(value), "true"); 313 else if (!_stricmp(name, "border")) 314 opt_border = !_stricmp(inifile_cleanstr(value), "true"); 315 else if (!_stricmp(name, "shadow")) 316 opt_shadow = !_stricmp(inifile_cleanstr(value), "true"); 317 else if (!_stricmp(name, "topmost")) 318 opt_topmost = !_stricmp(inifile_cleanstr(value), "true"); 319 else if (!_stricmp(name, "multibyte")) 320 patch_multibyte = !_stricmp(inifile_cleanstr(value), "true"); 321 else if (!_stricmp(name, "debug")) 322 AKgDebug_DebugMaps = !_stricmp(inifile_cleanstr(value), "true"); 323 else if (!_stricmp(name, "debugfiles")) 324 BFgDebugFileEnable = !_stricmp(inifile_cleanstr(value), "true"); 325 else if (!_stricmp(name, "findsounds")) 326 SSgSearchOnDisk = !_stricmp(inifile_cleanstr(value), "true"); 327 else if (!_stricmp(name, "ignore_private_data")) 328 opt_ignore_private_data = !_stricmp(inifile_cleanstr(value), "true"); 329 else if (!_stricmp(name, "sound")) 330 opt_sound = !_stricmp(inifile_cleanstr(value), "true"); 331 else if (!_stricmp(name, "switch")) 332 M3gResolutionSwitch = !_stricmp(inifile_cleanstr(value), "true"); 333 //else if (!_stricmp(name, "devmode")) 334 //turn_dev_mode_on = !_stricmp(inifile_cleanstr(value), "true"); 258 335 else 259 336 DDrStartupMessage("unrecognised option \"%s\"", name); 260 337 break; 261 338 case s_patch: 262 if (!stricmp(name, "fonttexturecache")) 263 patch_fonttexturecache = !stricmp(inifile_cleanstr(value), "true"); 264 else if (!stricmp(name, "largetextures")) 265 patch_largetextures = !stricmp(inifile_cleanstr(value), "true"); 266 else if (!stricmp(name, "levelplugins")) 267 patch_levelplugins = !stricmp(inifile_cleanstr(value), "true"); 268 else if (!stricmp(name, "pathfinding")) 269 patch_pathfinding = !stricmp(inifile_cleanstr(value), "true"); 270 else if (!stricmp(name, "projaware")) 271 patch_projaware = !stricmp(inifile_cleanstr(value), "true"); 272 else if (!stricmp(name, "directinput")) 273 patch_directinput = !stricmp(inifile_cleanstr(value), "true"); 274 else if (!stricmp(name, "wpfadetime")) 275 patch_wpfadetime = !stricmp(inifile_cleanstr(value), "true"); 276 else if (!stricmp(name, "kickguns")) 277 patch_kickguns = !stricmp(inifile_cleanstr(value), "true"); 278 else if (!stricmp(name, "cooldowntimer")) 279 patch_cooldowntimer = !stricmp(inifile_cleanstr(value), "true"); 280 else if (!stricmp(name, "throwtest")) 281 patch_throwtest = !stricmp(inifile_cleanstr(value), "true"); 282 else if (!stricmp(name, "alttab")) 283 patch_alttab = !stricmp(inifile_cleanstr(value), "true"); 284 else if (!stricmp(name, "particledisablebit")) 285 patch_particledisablebit = !stricmp(inifile_cleanstr(value), "true"); 286 else if (!stricmp(name, "multibyte")) 287 patch_multibyte = !stricmp(inifile_cleanstr(value), "true"); 288 else if (!stricmp(name, "cheattable")) 289 patch_cheattable = !stricmp(inifile_cleanstr(value), "true"); 290 else if (!stricmp(name, "argb8888")) 291 patch_argb8888 = !stricmp(inifile_cleanstr(value), "true"); 292 else if (!stricmp(name, "killvtune")) 293 patch_killvtune = !stricmp(inifile_cleanstr(value), "true"); 294 else if (!stricmp(name, "getcmdline")) 295 patch_getcmdline = !stricmp(inifile_cleanstr(value), "true"); 296 else if (!stricmp(name, "disablecmdline")) 297 patch_disablecmdline = !stricmp(inifile_cleanstr(value), "true"); 298 else if (!stricmp(name, "safeprintf")) 299 patch_safeprintf = !stricmp(inifile_cleanstr(value), "true"); 300 else if (!stricmp(name, "daodandisplayenum")) 301 patch_daodandisplayenum = !stricmp(inifile_cleanstr(value), "true"); 302 else if (!stricmp(name, "usegettickcount")) 303 patch_usegettickcount = !stricmp(inifile_cleanstr(value), "true"); 304 else if (!stricmp(name, "cheatsenabled")) 305 patch_cheatsenabled = !stricmp(inifile_cleanstr(value), "true"); 306 else if (!stricmp(name, "usedaodangl")) 307 patch_usedaodangl = !stricmp(inifile_cleanstr(value), "true"); 308 else if (!stricmp(name, "windowhack")) 309 patch_windowhack = !stricmp(inifile_cleanstr(value), "true"); 310 else if (!stricmp(name, "daodaninit")) 311 patch_daodaninit = !stricmp(inifile_cleanstr(value), "true"); 312 else if (!stricmp(name, "bsl")) 313 patch_bsl = !stricmp(inifile_cleanstr(value), "true"); 314 else if (!stricmp(name, "cheater")) 315 patch_cheater = !stricmp(inifile_cleanstr(value), "true"); 339 if (!_stricmp(name, "fonttexturecache")) 340 patch_fonttexturecache = !_stricmp(inifile_cleanstr(value), "true"); 341 else if (!_stricmp(name, "largetextures")) 342 patch_largetextures = !_stricmp(inifile_cleanstr(value), "true"); 343 else if (!_stricmp(name, "levelplugins")) 344 patch_levelplugins = !_stricmp(inifile_cleanstr(value), "true"); 345 else if (!_stricmp(name, "pathfinding")) 346 patch_pathfinding = !_stricmp(inifile_cleanstr(value), "true"); 347 else if (!_stricmp(name, "projaware")) 348 patch_projaware = !_stricmp(inifile_cleanstr(value), "true"); 349 else if (!_stricmp(name, "directinput")) 350 patch_directinput = !_stricmp(inifile_cleanstr(value), "true"); 351 else if (!_stricmp(name, "wpfadetime")) 352 patch_wpfadetime = !_stricmp(inifile_cleanstr(value), "true"); 353 else if (!_stricmp(name, "kickguns")) 354 patch_kickguns = !_stricmp(inifile_cleanstr(value), "true"); 355 else if (!_stricmp(name, "cooldowntimer")) 356 patch_cooldowntimer = !_stricmp(inifile_cleanstr(value), "true"); 357 else if (!_stricmp(name, "throwtest")) 358 patch_throwtest = !_stricmp(inifile_cleanstr(value), "true"); 359 else if (!_stricmp(name, "alttab")) 360 patch_alttab = !_stricmp(inifile_cleanstr(value), "true"); 361 else if (!_stricmp(name, "particledisablebit")) 362 patch_particledisablebit = !_stricmp(inifile_cleanstr(value), "true"); 363 else if (!_stricmp(name, "multibyte")) 364 patch_multibyte = !_stricmp(inifile_cleanstr(value), "true"); 365 else if (!_stricmp(name, "cheattable")) 366 patch_cheattable = !_stricmp(inifile_cleanstr(value), "true"); 367 else if (!_stricmp(name, "argb8888")) 368 patch_argb8888 = !_stricmp(inifile_cleanstr(value), "true"); 369 else if (!_stricmp(name, "killvtune")) 370 patch_killvtune = !_stricmp(inifile_cleanstr(value), "true"); 371 else if (!_stricmp(name, "getcmdline")) 372 patch_getcmdline = !_stricmp(inifile_cleanstr(value), "true"); 373 else if (!_stricmp(name, "disablecmdline")) 374 patch_disablecmdline = !_stricmp(inifile_cleanstr(value), "true"); 375 else if (!_stricmp(name, "safeprintf")) 376 patch_safeprintf = !_stricmp(inifile_cleanstr(value), "true"); 377 else if (!_stricmp(name, "daodandisplayenum")) 378 patch_daodandisplayenum = !_stricmp(inifile_cleanstr(value), "true"); 379 else if (!_stricmp(name, "usegettickcount")) 380 patch_usegettickcount = !_stricmp(inifile_cleanstr(value), "true"); 381 else if (!_stricmp(name, "cheatsenabled")) 382 patch_cheatsenabled = !_stricmp(inifile_cleanstr(value), "true"); 383 else if (!_stricmp(name, "usedaodangl")) 384 patch_usedaodangl = !_stricmp(inifile_cleanstr(value), "true"); 385 else if (!_stricmp(name, "windowhack")) 386 patch_windowhack = !_stricmp(inifile_cleanstr(value), "true"); 387 else if (!_stricmp(name, "daodaninit")) 388 patch_daodaninit = !_stricmp(inifile_cleanstr(value), "true"); 389 else if (!_stricmp(name, "bsl")) 390 patch_bsl = !_stricmp(inifile_cleanstr(value), "true"); 391 else if (!_stricmp(name, "cheater")) 392 patch_cheater = !_stricmp(inifile_cleanstr(value), "true"); 393 else if (!_stricmp(name, "newweap")) 394 patch_newweapon = !_stricmp(inifile_cleanstr(value), "true"); 316 395 else 317 396 DDrStartupMessage("unrecognised patch \"%s\"", name); 318 397 break; 319 398 case s_language: 320 if (!stricmp(name, "savepoint")) 399 if (!_stricmp(name, "chinese")) 400 patch_chinese = true; 401 else if (!_stricmp(name, "savepoint")) 321 402 { 322 char* str = strdup(value);403 char* str = _strdup(value); 323 404 DDrPatch_Int32(OniExe + 0x000fd730, (int)str); 324 405 DDrPatch_Int32(OniExe + 0x000fd738, (int)str); 325 406 } 326 else if (! stricmp(name, "syndicatewarehouse"))407 else if (!_stricmp(name, "syndicatewarehouse")) 327 408 { 328 char* str = strdup(value);409 char* str = _strdup(value); 329 410 DDrPatch_Int32(OniExe + 0x000fd71a, (int)str); 330 411 DDrPatch_Int32(OniExe + 0x0010ef75, (int)str); 331 412 } 332 else if (! stricmp(name, "damn"))333 DDrPatch_ StrDup(OniExe + 0x0010fb6e, value);334 else if (! stricmp(name, "blam"))335 DDrPatch_ StrDup(OniExe + 0x0010fb73, value);336 else if (! stricmp(name, "shapeshifter_on"))337 DDr_CheatTable[0].message_on = strdup(value);338 else if (! stricmp(name, "shapeshifter_off"))339 DDr_CheatTable[0].message_off = strdup(value);340 else if (! stricmp(name, "liveforever_on"))341 DDr_CheatTable[1].message_on = strdup(value);342 else if (! stricmp(name, "liveforever_off"))343 DDr_CheatTable[1].message_off = strdup(value);344 else if (! stricmp(name, "touchofdeath_on"))345 DDr_CheatTable[2].message_on = strdup(value);346 else if (! stricmp(name, "touchofdeath_off"))347 DDr_CheatTable[2].message_off = strdup(value);348 else if (! stricmp(name, "canttouchthis_on"))349 DDr_CheatTable[3].message_on = strdup(value);350 else if (! stricmp(name, "canttouchthis_off"))351 DDr_CheatTable[3].message_off = strdup(value);352 else if (! stricmp(name, "fatloot_on"))353 DDr_CheatTable[4].message_on = strdup(value);354 else if (! stricmp(name, "glassworld_on"))355 DDr_CheatTable[5].message_on = strdup(value);356 else if (! stricmp(name, "glassworld_off"))357 DDr_CheatTable[5].message_off = strdup(value);358 else if (! stricmp(name, "winlevel_on"))359 DDr_CheatTable[6].message_on = strdup(value);360 else if (! stricmp(name, "loselevel_on"))361 DDr_CheatTable[7].message_on = strdup(value);362 else if (! stricmp(name, "bighead_on"))363 DDr_CheatTable[8].message_on = strdup(value);364 else if (! stricmp(name, "bighead_off"))365 DDr_CheatTable[8].message_off = strdup(value);366 else if (! stricmp(name, "minime_on"))367 DDr_CheatTable[9].message_on = strdup(value);368 else if (! stricmp(name, "minime_off"))369 DDr_CheatTable[9].message_off = strdup(value);370 else if (! stricmp(name, "superammo_on"))371 DDr_CheatTable[10].message_on = strdup(value);372 else if (! stricmp(name, "superammo_off"))373 DDr_CheatTable[10].message_off = strdup(value);374 else if (! stricmp(name, "devmode_on"))413 else if (!_stricmp(name, "damn")) 414 DDrPatch__strdup(OniExe + 0x0010fb6e, value); 415 else if (!_stricmp(name, "blam")) 416 DDrPatch__strdup(OniExe + 0x0010fb73, value); 417 else if (!_stricmp(name, "shapeshifter_on")) 418 DDr_CheatTable[0].message_on = _strdup(value); 419 else if (!_stricmp(name, "shapeshifter_off")) 420 DDr_CheatTable[0].message_off = _strdup(value); 421 else if (!_stricmp(name, "liveforever_on")) 422 DDr_CheatTable[1].message_on = _strdup(value); 423 else if (!_stricmp(name, "liveforever_off")) 424 DDr_CheatTable[1].message_off = _strdup(value); 425 else if (!_stricmp(name, "touchofdeath_on")) 426 DDr_CheatTable[2].message_on = _strdup(value); 427 else if (!_stricmp(name, "touchofdeath_off")) 428 DDr_CheatTable[2].message_off = _strdup(value); 429 else if (!_stricmp(name, "canttouchthis_on")) 430 DDr_CheatTable[3].message_on = _strdup(value); 431 else if (!_stricmp(name, "canttouchthis_off")) 432 DDr_CheatTable[3].message_off = _strdup(value); 433 else if (!_stricmp(name, "fatloot_on")) 434 DDr_CheatTable[4].message_on = _strdup(value); 435 else if (!_stricmp(name, "glassworld_on")) 436 DDr_CheatTable[5].message_on = _strdup(value); 437 else if (!_stricmp(name, "glassworld_off")) 438 DDr_CheatTable[5].message_off = _strdup(value); 439 else if (!_stricmp(name, "winlevel_on")) 440 DDr_CheatTable[6].message_on = _strdup(value); 441 else if (!_stricmp(name, "loselevel_on")) 442 DDr_CheatTable[7].message_on = _strdup(value); 443 else if (!_stricmp(name, "bighead_on")) 444 DDr_CheatTable[8].message_on = _strdup(value); 445 else if (!_stricmp(name, "bighead_off")) 446 DDr_CheatTable[8].message_off = _strdup(value); 447 else if (!_stricmp(name, "minime_on")) 448 DDr_CheatTable[9].message_on = _strdup(value); 449 else if (!_stricmp(name, "minime_off")) 450 DDr_CheatTable[9].message_off = _strdup(value); 451 else if (!_stricmp(name, "superammo_on")) 452 DDr_CheatTable[10].message_on = _strdup(value); 453 else if (!_stricmp(name, "superammo_off")) 454 DDr_CheatTable[10].message_off = _strdup(value); 455 else if (!_stricmp(name, "devmode_on")) 375 456 { 376 char* str = strdup(value);457 char* str = _strdup(value); 377 458 DDr_CheatTable[11].message_on = str; 378 459 DDr_CheatTable[cheat_x].message_on = str; 379 460 } 380 else if (! stricmp(name, "devmode_off"))461 else if (!_stricmp(name, "devmode_off")) 381 462 { 382 char* str = strdup(value);463 char* str = _strdup(value); 383 464 DDr_CheatTable[11].message_off = str; 384 465 DDr_CheatTable[cheat_x].message_off = str; 385 466 } 386 else if (! stricmp(name, "reservoirdogs_on"))387 DDr_CheatTable[12].message_on = strdup(value);388 else if (! stricmp(name, "reservoirdogs_off"))389 DDr_CheatTable[12].message_off = strdup(value);390 else if (! stricmp(name, "roughjustice_on"))391 DDr_CheatTable[13].message_on = strdup(value);392 else if (! stricmp(name, "roughjustice_off"))393 DDr_CheatTable[13].message_off = strdup(value);394 else if (! stricmp(name, "chenille_on"))395 DDr_CheatTable[14].message_on = strdup(value);396 else if (! stricmp(name, "chenille_off"))397 DDr_CheatTable[14].message_off = strdup(value);398 else if (! stricmp(name, "behemoth_on"))399 DDr_CheatTable[15].message_on = strdup(value);400 else if (! stricmp(name, "behemoth_off"))401 DDr_CheatTable[15].message_off = strdup(value);402 else if (! stricmp(name, "elderrune_on"))403 DDr_CheatTable[16].message_on = strdup(value);404 else if (! stricmp(name, "elderrune_off"))405 DDr_CheatTable[16].message_off = strdup(value);406 else if (! stricmp(name, "moonshadow_on"))407 DDr_CheatTable[17].message_on = strdup(value);408 else if (! stricmp(name, "moonshadow_off"))409 DDr_CheatTable[17].message_off = strdup(value);410 else if (! stricmp(name, "munitionfrenzy_on"))411 DDr_CheatTable[18].message_on = strdup(value);412 else if (! stricmp(name, "fistsoflegend_on"))413 DDr_CheatTable[19].message_on = strdup(value);414 else if (! stricmp(name, "fistsoflegend_off"))415 DDr_CheatTable[19].message_off = strdup(value);416 else if (! stricmp(name, "killmequick_on"))417 DDr_CheatTable[20].message_on = strdup(value);418 else if (! stricmp(name, "killmequick_off"))419 DDr_CheatTable[20].message_off = strdup(value);420 else if (! stricmp(name, "carousel_on"))421 DDr_CheatTable[21].message_on = strdup(value);422 else if (! stricmp(name, "carousel_off"))423 DDr_CheatTable[21].message_off = strdup(value);467 else if (!_stricmp(name, "reservoirdogs_on")) 468 DDr_CheatTable[12].message_on = _strdup(value); 469 else if (!_stricmp(name, "reservoirdogs_off")) 470 DDr_CheatTable[12].message_off = _strdup(value); 471 else if (!_stricmp(name, "roughjustice_on")) 472 DDr_CheatTable[13].message_on = _strdup(value); 473 else if (!_stricmp(name, "roughjustice_off")) 474 DDr_CheatTable[13].message_off = _strdup(value); 475 else if (!_stricmp(name, "chenille_on")) 476 DDr_CheatTable[14].message_on = _strdup(value); 477 else if (!_stricmp(name, "chenille_off")) 478 DDr_CheatTable[14].message_off = _strdup(value); 479 else if (!_stricmp(name, "behemoth_on")) 480 DDr_CheatTable[15].message_on = _strdup(value); 481 else if (!_stricmp(name, "behemoth_off")) 482 DDr_CheatTable[15].message_off = _strdup(value); 483 else if (!_stricmp(name, "elderrune_on")) 484 DDr_CheatTable[16].message_on = _strdup(value); 485 else if (!_stricmp(name, "elderrune_off")) 486 DDr_CheatTable[16].message_off = _strdup(value); 487 else if (!_stricmp(name, "moonshadow_on")) 488 DDr_CheatTable[17].message_on = _strdup(value); 489 else if (!_stricmp(name, "moonshadow_off")) 490 DDr_CheatTable[17].message_off = _strdup(value); 491 else if (!_stricmp(name, "munitionfrenzy_on")) 492 DDr_CheatTable[18].message_on = _strdup(value); 493 else if (!_stricmp(name, "fistsoflegend_on")) 494 DDr_CheatTable[19].message_on = _strdup(value); 495 else if (!_stricmp(name, "fistsoflegend_off")) 496 DDr_CheatTable[19].message_off = _strdup(value); 497 else if (!_stricmp(name, "killmequick_on")) 498 DDr_CheatTable[20].message_on = _strdup(value); 499 else if (!_stricmp(name, "killmequick_off")) 500 DDr_CheatTable[20].message_off = _strdup(value); 501 else if (!_stricmp(name, "carousel_on")) 502 DDr_CheatTable[21].message_on = _strdup(value); 503 else if (!_stricmp(name, "carousel_off")) 504 DDr_CheatTable[21].message_off = _strdup(value); 424 505 else 425 506 DDrStartupMessage("unrecognised language item \"%s\"", name); … … 435 516 void DDrConfig() 436 517 { 518 437 519 if (GetFileAttributes("daodan.ini") == INVALID_FILE_ATTRIBUTES) 438 520 { 521 FILE* fp; 439 522 DDrStartupMessage("daodan.ini doesn't exist, creating"); 440 FILE*fp = fopen("daodan.ini", "w");523 fp = fopen("daodan.ini", "w"); 441 524 if (fp) 442 525 { … … 458 541 } 459 542 543 void DDrException() { 544 int* i = 0; 545 *i = 1; 546 } 547 #include <stdio.h> 548 549 //this was broken 550 FILE** _UUgError_WarningFile = (FILE**)0x005711B4; 551 FILE *__fastcall DDrPrintWarning(int filename, int linenumber, unsigned __int16 errornum, int message) 552 { 553 554 FILE *v4; // eax@1 555 FILE *result; // eax@4 556 char v6[512]; // [sp+0h] [bp-100h]@1 557 FILE* UUgError_WarningFile = *_UUgError_WarningFile; 558 sprintf_s( 559 v6, 512, 560 "Error %x reported from File: %s, Line: %d (message follows) \r\n%s", 561 errornum, 562 filename, 563 linenumber, 564 message); 565 566 if ( UUgError_WarningFile 567 || (UUgError_WarningFile = oni_fopen("debugger.txt", "wb"), UUgError_WarningFile ) ) 568 { 569 oni_fprintf(UUgError_WarningFile, "%s\r\n", v6); 570 oni_fflush(UUgError_WarningFile); 571 } 572 //oni_fprintf(stdout, v6); 573 //sprintf(&v6, "%s", message); 574 *_UUgError_WarningFile = UUgError_WarningFile; 575 result = UUgError_WarningFile; 576 return result; 577 } 578 460 579 void __cdecl DDrMain(int argc, char* argv[]) 461 580 { 462 DDrStartupMessage("daodan attached!");463 464 opt_ignore_private_data = false;465 opt_sound = true;466 467 DDrConfig();468 DDrStartupMessage("parsing command line...");469 581 int i; 470 582 char* section; 471 583 char* option; 472 584 bool falseoption; 585 586 DDrStartupMessage("daodan attached!"); 587 588 opt_ignore_private_data = false; 589 opt_sound = true; 590 591 DDrConfig(); 592 DDrStartupMessage("parsing command line..."); 473 593 for (i = 1; i < argc; i ++) 474 594 { … … 520 640 DDrPatch_MakeJump(UUrMachineTime_Sixtieths, DDrMachineTime_Sixtieths); 521 641 } 522 642 523 643 // Cheats always enabled 524 644 if (patch_cheatsenabled) 525 645 DDrPatch_MakeJump(ONrPersist_GetWonGame, DDrPersist_GetWonGame); 526 646 527 647 // Windowed mode 528 648 if (patch_usedaodangl) 529 649 { 650 DDrPatch_NOOP((char*)0x004032B7, 6); 651 DDrPatch_MakeCall((char*)0x004032B7, LIiP_SetCursorPosHook); 652 653 DDrPatch_NOOP((char*)0x00403349, 6); 654 DDrPatch_MakeCall((char*)0x00403349, LIiP_SetCursorPosHook); 530 655 DDrPatch_MakeJump(ONrPlatform_Initialize, DDrPlatform_Initialize); 531 656 DDrPatch_MakeJump(gl_platform_initialize, daodangl_platform_initialize); 532 657 } 533 534 658 // Hacked windowed mode (for when daodangl isn't working properly) 535 if (patch_windowhack)659 else if (patch_windowhack) 536 660 DDrWindowHack_Install(); 537 661 … … 542 666 if (patch_bsl) 543 667 SLrDaodan_Patch(); 544 668 545 669 if (patch_cheater) 546 670 { 547 671 DDrPatch_MakeCall(OniExe + 0x000f618f, DDrCheater); 548 672 DDrPatch_Int16(OniExe + 0x000deb45, 0x5590); 673 #if 1 549 674 DDrPatch_MakeCall(OniExe + 0x000deb47, FallingFrames); 675 #endif 550 676 DDrPatch_MakeJump(OniExe + 0x0010f021, DDrCheater_LevelLoad); 551 677 } 552 553 init_daodan_gl(); 554 555 ONiMain(argc, argv); 678 679 //DDrPatch_MakeJump(0x004378c0, DDrException); 680 DDrPatch_MakeJump(0x004245A0, DDrPrintWarning); 681 //init_daodan_gl(); 682 683 ONiMain(argc, argv); 556 684 } 557 685 /* … … 586 714 DDrONiModule = GetModuleHandle(NULL); 587 715 588 if (*(uint32_t*)( (void*)OniExe + 0x0011acd0) == 0x09d36852)716 if (*(uint32_t*)(OniExe + 0x0011acd0) == 0x09d36852) 589 717 DDrPatch_MakeCall(OniExe + 0x0010fb49, DDrMain); 590 718 else
Note:
See TracChangeset
for help on using the changeset viewer.