--- Daodan/src/Daodan.c 2013/03/03 04:37:58 681 +++ Daodan/src/Daodan.c 2013/03/04 15:52:19 689 @@ -66,51 +66,51 @@ bool DDrPatch_Init() // Font texture cache doubled if (patch_fonttexturecache) { - DDrPatch_Byte(OniExe + 0x00020ea7, 0x20); - DDrPatch_Byte(OniExe + 0x00020f4a, 0x40); + DDrPatch_Byte((char*)(OniExe + 0x00020ea7), 0x20); + DDrPatch_Byte((char*)(OniExe + 0x00020f4a), 0x40); } // Now supports textures up to 512x512 if (patch_largetextures) - DDrPatch_Byte (OniExe + 0x00005251, 0x10); + DDrPatch_Byte ((char*)(OniExe + 0x00005251), 0x10); // Non-"_Final" levels are now valid if (patch_levelplugins) - DDrPatch_Byte (OniExe + 0x000206a8, 0x01); + DDrPatch_Byte ((char*)(OniExe + 0x000206a8), 0x01); // Pathfinding grid cache size x8 if (patch_pathfinding) { - const char pathfinding[2] = {0x90 , 0xE9 }; - DDrPatch_Byte (OniExe + 0x0010b03b, 0x20); - DDrPatch_Byte (OniExe + 0x0010b04c, 0x20); + const unsigned char pathfinding[2] = {0x90 , 0xE9 }; + DDrPatch_Byte ((char*)(OniExe + 0x0010b03b), 0x20); + DDrPatch_Byte ((char*)(OniExe + 0x0010b04c), 0x20); //other stuff - DDrPatch_Const(0x440789, pathfinding); + DDrPatch_Const((char*)(OniExe + 0x00040789), pathfinding); } // Projectile awareness fixed if (patch_projaware) { - DDrPatch_Byte (OniExe + 0x0009c07c, 0x6c); - DDrPatch_Byte (OniExe + 0x0009c080, 0x70); - DDrPatch_Byte (OniExe + 0x0009c084, 0x74); - DDrPatch_Byte (OniExe + 0x0009c110, 0x6c); + DDrPatch_Byte ((char*)(OniExe + 0x0009c07c), 0x6c); + DDrPatch_Byte ((char*)(OniExe + 0x0009c080), 0x70); + DDrPatch_Byte ((char*)(OniExe + 0x0009c084), 0x74); + DDrPatch_Byte ((char*)(OniExe + 0x0009c110), 0x6c); } // Forced DirectInput (for Windows NT) if (patch_directinput) - DDrPatch_Byte (OniExe + 0x00002e6d, 0xeb); + DDrPatch_Byte((char*)(OniExe + 0x00002e6d), 0xeb); if (patch_wpfadetime) { // Makes wp_fadetime actually have a function - const char fadetime_patch[] = { 0x66, 0x8B, 0x1D, 0xC4, 0x7D, 0x62, 0x00, 0x66, 0x89, 0x5E, 0x46, 0x5B, 0x5E, 0x83, 0xC4, 0x14, 0xC3 }; - DDrPatch_Const (OniExe + 0x0011a889, fadetime_patch); - DDrPatch_Byte (OniExe + 0x0011a560, 0x31); + const unsigned char fadetime_patch[] = { 0x66, 0x8B, 0x1D, 0xC4, 0x7D, 0x62, 0x00, 0x66, 0x89, 0x5E, 0x46, 0x5B, 0x5E, 0x83, 0xC4, 0x14, 0xC3 }; + DDrPatch_Const ((char*)(OniExe + 0x0011a889), fadetime_patch); + DDrPatch_Byte ((char*)(OniExe + 0x0011a560), 0x31); // Sets the fadetime to 4800 by default - DDrPatch_Int16 ((OniExe + 0x0011ab0e), 0x12c0); + DDrPatch_Int16 ((short*)(OniExe + 0x0011ab0e), 0x12c0); } // FIXME: add switches @@ -123,67 +123,67 @@ bool DDrPatch_Init() // Don't use this, it breaks stairs. if (patch_kickguns) { - const char kickgun_patch[] = { 0x00, 0x05, 0x00, 0x00, 0x00, 0xC7, 0x05, 0x1C, 0xC9, 0x5E, 0x00, 0x70, 0xB8, 0x43, 0x00, 0xC7, 0x05, 0x20, 0xC9, 0x5E, 0x00, 0x20, 0xBE, 0x43 }; - DDrPatch_Const (OniExe + 0x000dc420, kickgun_patch); + const unsigned char kickgun_patch[] = { 0x00, 0x05, 0x00, 0x00, 0x00, 0xC7, 0x05, 0x1C, 0xC9, 0x5E, 0x00, 0x70, 0xB8, 0x43, 0x00, 0xC7, 0x05, 0x20, 0xC9, 0x5E, 0x00, 0x20, 0xBE, 0x43 }; + DDrPatch_Const ((char*)(OniExe + 0x000dc420), kickgun_patch); } // Cooldown timer exploit fix ^_^ if (patch_cooldowntimer) { - const char cooldown_patch[] = { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }; - DDrPatch_Const (OniExe + 0x0011a825, cooldown_patch); + const unsigned char cooldown_patch[] = { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }; + DDrPatch_Const ((char*)(OniExe + 0x0011a825), cooldown_patch); } if (patch_throwtest) { - const char throwtest_patch[] = { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }; - DDrPatch_Const(OniExe + 0x000dc190, throwtest_patch); + const unsigned char throwtest_patch[] = { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }; + DDrPatch_Const((char*)(OniExe + 0x000dc190), throwtest_patch); } // Disable UUrPlatform_Initalize/Terminate, this enables the Alt-Tab and the Windows key but has the possible side effect of allowing the screensaver to enable itself in-game. if (patch_alttab) { - DDrPatch_Byte ((void*)UUrPlatform_Initialize, 0xC3); - DDrPatch_Byte ((void*)UUrPlatform_Terminate, 0xC3); + DDrPatch_Byte ((char*)UUrPlatform_Initialize, 0xC3); + DDrPatch_Byte ((char*)UUrPlatform_Terminate, 0xC3); } // Unlocks particle action disabling/enabling bits for all events. (Will be controlled by a command line switch when I figure out how to do that without Win32 hacks.) if (patch_particledisablebit) - DDrPatch_Int16 (OniExe + 0x001b184, 0x9090); + DDrPatch_Int16 ((short*)(OniExe + 0x001b184), 0x9090); // Multi-byte patch (multiple language support) if (!patch_multibyte) { - DDrPatch_Byte (OniExe + 0x0002d8f8, 0xeb); - DDrPatch_Byte (OniExe + 0x0002d9ad, 0xeb); - DDrPatch_Byte (OniExe + 0x0002dbe2, 0xeb); - DDrPatch_Byte (OniExe + 0x0002dec3, 0xeb); - DDrPatch_Byte (OniExe + 0x0002e2ab, 0xeb); - DDrPatch_Byte (OniExe + 0x0002e2c4, 0xeb); - DDrPatch_Byte (OniExe + 0x0002e379, 0xeb); - DDrPatch_Byte (OniExe + 0x0002e48c, 0xeb); - DDrPatch_Byte (OniExe + 0x0002e4d0, 0xeb); - DDrPatch_Byte (OniExe + 0x0002e4f4, 0xeb); - DDrPatch_Byte (OniExe + 0x0002e646, 0xeb); - DDrPatch_Byte (OniExe + 0x0002e695, 0xeb); - DDrPatch_Byte (OniExe + 0x0002e944, 0xeb); - DDrPatch_Byte (OniExe + 0x0002e95d, 0xeb); - DDrPatch_Byte (OniExe + 0x0002e98e, 0xeb); - DDrPatch_Byte (OniExe + 0x0002e9dc, 0xeb); + DDrPatch_Byte ((char*)(OniExe + 0x0002d8f8), 0xeb); + DDrPatch_Byte ((char*)(OniExe + 0x0002d9ad), 0xeb); + DDrPatch_Byte ((char*)(OniExe + 0x0002dbe2), 0xeb); + DDrPatch_Byte ((char*)(OniExe + 0x0002dec3), 0xeb); + DDrPatch_Byte ((char*)(OniExe + 0x0002e2ab), 0xeb); + DDrPatch_Byte ((char*)(OniExe + 0x0002e2c4), 0xeb); + DDrPatch_Byte ((char*)(OniExe + 0x0002e379), 0xeb); + DDrPatch_Byte ((char*)(OniExe + 0x0002e48c), 0xeb); + DDrPatch_Byte ((char*)(OniExe + 0x0002e4d0), 0xeb); + DDrPatch_Byte ((char*)(OniExe + 0x0002e4f4), 0xeb); + DDrPatch_Byte ((char*)(OniExe + 0x0002e646), 0xeb); + DDrPatch_Byte ((char*)(OniExe + 0x0002e695), 0xeb); + DDrPatch_Byte ((char*)(OniExe + 0x0002e944), 0xeb); + DDrPatch_Byte ((char*)(OniExe + 0x0002e95d), 0xeb); + DDrPatch_Byte ((char*)(OniExe + 0x0002e98e), 0xeb); + DDrPatch_Byte ((char*)(OniExe + 0x0002e9dc), 0xeb); } // Cheat table patch if (patch_cheattable) { - DDrPatch_Int32 (0x004f616b, (int)&DDr_CheatTable[0].name); - DDrPatch_Int32 (OniExe + 0x000f617a, (int)&DDr_CheatTable[0].message_on); + DDrPatch_Int32 ((int*)(OniExe + 0x000f616b), (int)&DDr_CheatTable[0].name); + DDrPatch_Int32 ((int*)(OniExe + 0x000f617a), (int)&DDr_CheatTable[0].message_on); } // ARGB8888 textures if (patch_argb8888) { - DDrPatch_Byte (OniExe + 0x00135af0, 0x07); - DDrPatch_Byte (OniExe + 0x00135af4, 0x0B); + DDrPatch_Byte ((char*)(OniExe + 0x00135af0), 0x07); + DDrPatch_Byte ((char*)(OniExe + 0x00135af4), 0x0B); } //Test newweap patch @@ -191,29 +191,29 @@ bool DDrPatch_Init() //Makes it always say "Recieved weapon_name." //Needs check for loc_4DFC66 - //DDrPatch_NOOP( OniExe + 0x000E4DF8,2); + //DDrPatch_NOOP((char*)(OniExe + 0x000E4DF8),2); //Adds Weapon name and ammo meter to pickup autoprompt - DDrPatch_NOOP( OniExe + 0x000FAC73, 9); - DDrPatch_NOOP( OniExe + 0x000FAC80, 5); - DDrPatch_MakeCall( OniExe + 0xFAC85, DDrWeapon2Message); + DDrPatch_NOOP((char*)(OniExe + 0x000FAC73), 9); + DDrPatch_NOOP((char*)(OniExe + 0x000FAC80), 5); + DDrPatch_MakeCall((void*)(OniExe + 0xFAC85), (void*)DDrWeapon2Message); //Moves location of colors - //DDrPatch_Int32( 0x0042E3D5, (int)&DDrDSayColors ); - //DDrPatch_Int32( 0x0042E3DA, (int)&DDrDSayColors ); + //DDrPatch_Int32((int*)(OniExe + 0x0002E3D5), (int)&DDrDSayColors ); + //DDrPatch_Int32((int*)(OniExe + 0x0002E3DA), (int)&DDrDSayColors ); } // Disable loading the vtuneapi.dll //if (patch_killvtune) - //DDrPatch_Byte (OniExe + 0x00026340, 0xC3); + //DDrPatch_Byte ((char*)(OniExe + 0x00026340), 0xC3); // Disable Oni's internal CLrGetCommandLine function (to eventually replace it with our own) if (patch_getcmdline) - DDrPatch_NOOP (OniExe + 0x000d3280, 51); + DDrPatch_NOOP ((char*)(OniExe + 0x000d3280), 51); // Disable Oni's command line parser so it doesn't interfere with ours if (patch_disablecmdline) - DDrPatch_Int32 (OniExe + 0x000d3570, 0xc3c03366); + DDrPatch_Int32 ((int*)(OniExe + 0x000d3570), 0xc3c03366); if (patch_bsl) { @@ -222,7 +222,7 @@ bool DDrPatch_Init() //TODO: fix moonshadow. Character * Chr = 0; int NoPath = (int)&(Chr[0].RegenHax) & 0x000000FF; - const char regen_patch[] = + const unsigned char regen_patch[] = {0x90, 0x90, 0x90, 0x90, 0x90, // mov al, _WPgRegenerationCheat -> NOOP 0x90, 0x90, // test al, al -> NOOP 0x90, 0x90, // jz short loc_51BB98 -> NOOP @@ -231,7 +231,7 @@ bool DDrPatch_Init() 0x85, 0xC0, // test eax, eax 0x74, 0x21 // jnz 0x21 -> jz 0x21 }; - DDrPatch_Const(0x0051BB64, regen_patch); + DDrPatch_Const((char*)(OniExe + 0x0011BB64), regen_patch); } if(patch_chinese) @@ -251,36 +251,36 @@ bool DDrPatch_Init() if(1) { //Set distance above head to 4.0 - DDrPatch_Int32(0x0048C998, 0x005296C8); + DDrPatch_Int32((int*)(OniExe + 0x0008C998), 0x005296C8); //texture height - DDrPatch_Byte( 0x0048C9DF, 0x3F ); + DDrPatch_Byte((char*)(OniExe + 0x0008C9DF), 0x3F ); //texture width - DDrPatch_NOOP( (char*)0x0048C9CA, 6 ); + DDrPatch_NOOP((char*)(OniExe + 0x0008C9CA), 6 ); //Set the text color to whatever we like ;) - DDrPatch_NOOP( 0x0048C898, 6 ); - DDrPatch_Byte( 0x0048C898, 0x8B ); - DDrPatch_Byte( 0x0048C899, 0xCE ); -//FLATLINE? DDrPatch_MakeCall( 0x0048C8A3, FLrHook_DebugNameShadeHack); + DDrPatch_NOOP((char*)(OniExe + 0x0008C898), 6 ); + DDrPatch_Byte((char*)(OniExe + 0x0008C898), 0x8B ); + DDrPatch_Byte((char*)(OniExe + 0x0008C899), 0xCE ); +//FLATLINE? DDrPatch_MakeCall((void*)(OniExe + 0x0008C8A3), FLrHook_DebugNameShadeHack); //Make the background black for additive blending -//FLATLINE? DDrPatch_MakeCall( 0x0048C802, FLrHook_DebugNameTextureInit ); +//FLATLINE? DDrPatch_MakeCall((void*)(OniExe + 0x0008C802), FLrHook_DebugNameTextureInit ); } if(1) { - //DDrPatch_NOOP( 0x004E1957, 6 ); - //DDrPatch_MakeCall( 0x004E17F6, FLrHook_Lasers ); + //DDrPatch_NOOP((char*)(OniExe + 0x000E1957), 6 ); + //DDrPatch_MakeCall((void*)(OniExe + 0x000E17F6), FLrHook_Lasers ); } //Flatline related stuff -// DDrPatch_MakeCall(0x004FBCEA, DDrText_Hook); +// DDrPatch_MakeCall((void*)(OniExe + 0x000FBCEA), DDrText_Hook); -//FLATLINE? DDrPatch_Int32( 0x004B24D2, FLrSpawnHack); +//FLATLINE? DDrPatch_Int32((int*)(OniExe + 0x000B24D2), FLrSpawnHack); -//FLATLINE? DDrPatch_NOOP(0x004C26CB, 6); +//FLATLINE? DDrPatch_NOOP((char*)(OniExe + 0x000C26CB), 6); -//FLATLINE? DDrPatch_MakeCall( 0x004C26CB, FLrHook_DoorOpen); -//FLATLINE? DDrPatch_MakeCall( 0x004EE3CF, FLrHook_ConsoleActivate); +//FLATLINE? DDrPatch_MakeCall((void*)(OniExe + 0x000C26CB), FLrHook_DoorOpen); +//FLATLINE? DDrPatch_MakeCall((void*)(OniExe + 0x000EE3CF), FLrHook_ConsoleActivate); return true; } @@ -401,19 +401,19 @@ bool DDrIniCallback(char* section, bool else if (!_stricmp(name, "savepoint")) { char* str = _strdup(value); - DDrPatch_Int32(OniExe + 0x000fd730, (int)str); - DDrPatch_Int32(OniExe + 0x000fd738, (int)str); + DDrPatch_Int32((int*)(OniExe + 0x000fd730), (int)str); + DDrPatch_Int32((int*)(OniExe + 0x000fd738), (int)str); } else if (!_stricmp(name, "syndicatewarehouse")) { char* str = _strdup(value); - DDrPatch_Int32(OniExe + 0x000fd71a, (int)str); - DDrPatch_Int32(OniExe + 0x0010ef75, (int)str); + DDrPatch_Int32((int*)(OniExe + 0x000fd71a), (int)str); + DDrPatch_Int32((int*)(OniExe + 0x0010ef75), (int)str); } else if (!_stricmp(name, "damn")) - DDrPatch__strdup(OniExe + 0x0010fb6e, value); + DDrPatch__strdup((int*)(OniExe + 0x0010fb6e), value); else if (!_stricmp(name, "blam")) - DDrPatch__strdup(OniExe + 0x0010fb73, value); + DDrPatch__strdup((int*)(OniExe + 0x0010fb73), value); else if (!_stricmp(name, "shapeshifter_on")) DDr_CheatTable[0].message_on = _strdup(value); else if (!_stricmp(name, "shapeshifter_off")) @@ -556,14 +556,14 @@ FILE *__fastcall DDrPrintWarning(int fil char v6[512]; // [sp+0h] [bp-100h]@1 FILE* UUgError_WarningFile = *_UUgError_WarningFile; - if (filename && message && (strlen(filename)+strlen(message))<420) { + if (filename && message && (strlen((const char*)filename)+strlen((const char*)message))<420) { sprintf( v6, "Error %x reported from File: %s, Line: %d (message follows) \r\n%s", errornum, - filename, + (const char*)filename, linenumber, - message); + (const char*)message); if ( UUgError_WarningFile || (UUgError_WarningFile = oni_fopen("debugger.txt", "wb"), UUgError_WarningFile ) ) @@ -629,41 +629,41 @@ void __cdecl DDrMain(int argc, char* arg // Safe startup message printer if (patch_safeprintf) - DDrPatch_MakeJump(UUrStartupMessage, DDrStartupMessage); + DDrPatch_MakeJump((void*)UUrStartupMessage, (void*)DDrStartupMessage); // Daodan device mode enumeration function if (patch_daodandisplayenum) - DDrPatch_MakeJump(gl_enumerate_valid_display_modes, daodan_enumerate_valid_display_modes); + DDrPatch_MakeJump((void*)gl_enumerate_valid_display_modes, (void*)daodan_enumerate_valid_display_modes); // Performance patch if (patch_usegettickcount) { - DDrPatch_MakeJump(UUrMachineTime_High, DDrMachineTime_High); - DDrPatch_MakeJump(UUrMachineTime_High_Frequency, DDrMachineTime_High_Frequency); - DDrPatch_MakeJump(UUrMachineTime_Sixtieths, DDrMachineTime_Sixtieths); + DDrPatch_MakeJump((void*)UUrMachineTime_High, (void*)DDrMachineTime_High); + DDrPatch_MakeJump((void*)UUrMachineTime_High_Frequency, (void*)DDrMachineTime_High_Frequency); + DDrPatch_MakeJump((void*)UUrMachineTime_Sixtieths, (void*)DDrMachineTime_Sixtieths); } // Cheats always enabled if (patch_cheatsenabled) - DDrPatch_MakeJump(ONrPersist_GetWonGame, DDrPersist_GetWonGame); + DDrPatch_MakeJump((void*)ONrPersist_GetWonGame, (void*)DDrPersist_GetWonGame); // Windowed mode if (patch_usedaodangl) { - DDrPatch_NOOP((char*)0x004032B7, 6); - DDrPatch_MakeCall((char*)0x004032B7, LIiP_SetCursorPosHook); + DDrPatch_NOOP((char*)(OniExe + 0x000032B7), 6); + DDrPatch_MakeCall((void*)(OniExe + 0x000032B7), (void*)LIiP_SetCursorPosHook); - DDrPatch_NOOP((char*)0x00403349, 6); - DDrPatch_MakeCall((char*)0x00403349, LIiP_SetCursorPosHook); - DDrPatch_MakeJump(ONrPlatform_Initialize, DDrPlatform_Initialize); - DDrPatch_MakeJump(gl_platform_initialize, daodangl_platform_initialize); + DDrPatch_NOOP((char*)(OniExe + 0x00003349), 6); + DDrPatch_MakeCall((void*)(OniExe + 0x00003349), (void*)LIiP_SetCursorPosHook); + DDrPatch_MakeJump((void*)ONrPlatform_Initialize, (void*)DDrPlatform_Initialize); + DDrPatch_MakeJump((void*)gl_platform_initialize, (void*)daodangl_platform_initialize); } // Hacked windowed mode (for when daodangl isn't working properly) else if (patch_windowhack) DDrWindowHack_Install(); if (patch_daodaninit) - DDrPatch_MakeCall(OniExe + 0x000d345a, DDrGame_Init); + DDrPatch_MakeCall((void*)(OniExe + 0x000d345a), (void*)DDrGame_Init); // Patches for existing BSL functions if (patch_bsl) @@ -671,16 +671,16 @@ void __cdecl DDrMain(int argc, char* arg if (patch_cheater) { - DDrPatch_MakeCall(OniExe + 0x000f618f, DDrCheater); - DDrPatch_Int16(OniExe + 0x000deb45, 0x5590); + DDrPatch_MakeCall((void*)(OniExe + 0x000f618f), (void*)DDrCheater); + DDrPatch_Int16((short*)(OniExe + 0x000deb45), 0x5590); #if 1 - DDrPatch_MakeCall(OniExe + 0x000deb47, FallingFrames); + DDrPatch_MakeCall((void*)(OniExe + 0x000deb47), (void*)FallingFrames); #endif - DDrPatch_MakeJump(OniExe + 0x0010f021, DDrCheater_LevelLoad); + DDrPatch_MakeJump((void*)(OniExe + 0x0010f021), (void*)DDrCheater_LevelLoad); } - //DDrPatch_MakeJump(0x004378c0, DDrException); - DDrPatch_MakeJump(0x004245A0, DDrPrintWarning); + //DDrPatch_MakeJump((void*)(OniExe + 0x000378c0, (void*)DDrException); + DDrPatch_MakeJump((void*)(OniExe + 0x000245A0), (void*)DDrPrintWarning); //init_daodan_gl(); ONiMain(argc, argv); @@ -717,7 +717,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DDrONiModule = GetModuleHandle(NULL); if (*(uint32_t*)(OniExe + 0x0011acd0) == 0x09d36852) - DDrPatch_MakeCall(OniExe + 0x0010fb49, DDrMain); + DDrPatch_MakeCall((void*)(OniExe + 0x0010fb49), (void*)DDrMain); else ExitProcess(0); break;