--- Daodan/src/Daodan.c 2009/06/09 12:42:24 347 +++ Daodan/src/Daodan.c 2009/06/10 12:40:16 349 @@ -7,6 +7,8 @@ #include "Daodan_Cheater.h" #include "Daodan_Persistence.h" +#include "Daodan_WindowHack.h" + #include "Oni.h" #include "Oni_Persistence.h" @@ -22,8 +24,10 @@ HMODULE DDrONiModule; bool patch_fonttexturecache = true; bool patch_largetextures = true; +bool patch_levelplugins = true; bool patch_pathfinding = true; bool patch_projaware = true; +bool patch_directinput = true; bool patch_wpfadetime = true; bool patch_kickguns = false; bool patch_cooldowntimer = true; @@ -36,7 +40,9 @@ bool patch_cheattable = true; bool patch_safeprintf = true; bool patch_daodandisplayenum = true; bool patch_usegettickcount = true; +bool patch_cheatsenabled = true; bool patch_usedaodangl = false; +bool patch_windowhack = true; bool DDrPatch_Init() { @@ -54,7 +60,8 @@ bool DDrPatch_Init() DDrPatch_Byte (OniExe + 0x00005251, 0x10); // Non-"_Final" levels are now valid - DDrPatch_Byte (OniExe + 0x000206a8, 0x01); + if (patch_levelplugins) + DDrPatch_Byte (OniExe + 0x000206a8, 0x01); // Pathfinding grid cache size x8 if (patch_pathfinding) @@ -73,7 +80,8 @@ bool DDrPatch_Init() } // Forced DirectInput (for Windows NT) - DDrPatch_Byte (OniExe + 0x00002e6d, 0xeb); + if (patch_directinput) + DDrPatch_Byte (OniExe + 0x00002e6d, 0xeb); if (patch_wpfadetime) { @@ -173,10 +181,14 @@ bool DDrIniCallback(char* section, bool patch_fonttexturecache = !stricmp(value, "true"); else if (!stricmp(name, "largetextures")) patch_largetextures = !stricmp(value, "true"); + else if (!stricmp(name, "levelplugins")) + patch_levelplugins = !stricmp(value, "true"); else if (!stricmp(name, "pathfinding")) patch_pathfinding = !stricmp(value, "true"); else if (!stricmp(name, "projaware")) patch_projaware = !stricmp(value, "true"); + else if (!stricmp(name, "directinput")) + patch_directinput = !stricmp(value, "true"); else if (!stricmp(name, "wpfadetime")) patch_wpfadetime = !stricmp(value, "true"); else if (!stricmp(name, "kickguns")) @@ -199,8 +211,12 @@ bool DDrIniCallback(char* section, bool patch_daodandisplayenum = !stricmp(value, "true"); else if (!stricmp(name, "usegettickcount")) patch_usegettickcount = !stricmp(value, "true"); + else if (!stricmp(name, "cheatsenabled")) + patch_cheatsenabled = !stricmp(value, "true"); else if (!stricmp(name, "usedaodangl")) patch_usedaodangl = !stricmp(value, "true"); + else if (!stricmp(name, "windowhack")) + patch_windowhack = !stricmp(value, "true"); else DDrStartupMessage("unrecognised patch \"%s\"", name); break; @@ -221,6 +237,94 @@ bool DDrIniCallback(char* section, bool DDrPatch_StrDup(OniExe + 0x0010fb6e, value); else if (!stricmp(name, "blam")) DDrPatch_StrDup(OniExe + 0x0010fb73, value); + else if (!stricmp(name, "shapeshifter_on")) + DDr_CheatTable[0].message_on = strdup(value); + else if (!stricmp(name, "shapeshifter_off")) + DDr_CheatTable[0].message_off = strdup(value); + else if (!stricmp(name, "liveforever_on")) + DDr_CheatTable[1].message_on = strdup(value); + else if (!stricmp(name, "liveforever_off")) + DDr_CheatTable[1].message_off = strdup(value); + else if (!stricmp(name, "touchofdeath_on")) + DDr_CheatTable[2].message_on = strdup(value); + else if (!stricmp(name, "touchofdeath_off")) + DDr_CheatTable[2].message_off = strdup(value); + else if (!stricmp(name, "canttouchthis_on")) + DDr_CheatTable[3].message_on = strdup(value); + else if (!stricmp(name, "canttouchthis_off")) + DDr_CheatTable[3].message_off = strdup(value); + else if (!stricmp(name, "fatloot_on")) + DDr_CheatTable[4].message_on = strdup(value); + else if (!stricmp(name, "glassworld_on")) + DDr_CheatTable[5].message_on = strdup(value); + else if (!stricmp(name, "glassworld_off")) + DDr_CheatTable[5].message_off = strdup(value); + else if (!stricmp(name, "winlevel_on")) + DDr_CheatTable[6].message_on = strdup(value); + else if (!stricmp(name, "loselevel_on")) + DDr_CheatTable[7].message_on = strdup(value); + else if (!stricmp(name, "bighead_on")) + DDr_CheatTable[8].message_on = strdup(value); + else if (!stricmp(name, "bighead_off")) + DDr_CheatTable[8].message_off = strdup(value); + else if (!stricmp(name, "minime_on")) + DDr_CheatTable[9].message_on = strdup(value); + else if (!stricmp(name, "minime_off")) + DDr_CheatTable[9].message_off = strdup(value); + else if (!stricmp(name, "superammo_on")) + DDr_CheatTable[10].message_on = strdup(value); + else if (!stricmp(name, "superammo_off")) + DDr_CheatTable[10].message_off = strdup(value); + else if (!stricmp(name, "devmode_on")) + { + char* str = strdup(value); + DDr_CheatTable[11].message_on = str; + DDr_CheatTable[cheat_devmodex].message_on = str; + } + else if (!stricmp(name, "devmode_off")) + { + char* str = strdup(value); + DDr_CheatTable[11].message_off = str; + DDr_CheatTable[cheat_devmodex].message_off = str; + } + else if (!stricmp(name, "reservoirdogs_on")) + DDr_CheatTable[12].message_on = strdup(value); + else if (!stricmp(name, "reservoirdogs_off")) + DDr_CheatTable[12].message_off = strdup(value); + else if (!stricmp(name, "roughjustice_on")) + DDr_CheatTable[13].message_on = strdup(value); + else if (!stricmp(name, "roughjustice_off")) + DDr_CheatTable[13].message_off = strdup(value); + else if (!stricmp(name, "chenille_on")) + DDr_CheatTable[14].message_on = strdup(value); + else if (!stricmp(name, "chenille_off")) + DDr_CheatTable[14].message_off = strdup(value); + else if (!stricmp(name, "behemoth_on")) + DDr_CheatTable[15].message_on = strdup(value); + else if (!stricmp(name, "behemoth_off")) + DDr_CheatTable[15].message_off = strdup(value); + else if (!stricmp(name, "elderrune_on")) + DDr_CheatTable[16].message_on = strdup(value); + else if (!stricmp(name, "elderrune_off")) + DDr_CheatTable[16].message_off = strdup(value); + else if (!stricmp(name, "moonshadow_on")) + DDr_CheatTable[17].message_on = strdup(value); + else if (!stricmp(name, "moonshadow_off")) + DDr_CheatTable[17].message_off = strdup(value); + else if (!stricmp(name, "munitionfrenzy_on")) + DDr_CheatTable[18].message_on = strdup(value); + else if (!stricmp(name, "fistsoflegend_on")) + DDr_CheatTable[19].message_on = strdup(value); + else if (!stricmp(name, "fistsoflegend_off")) + DDr_CheatTable[19].message_off = strdup(value); + else if (!stricmp(name, "killmequick_on")) + DDr_CheatTable[20].message_on = strdup(value); + else if (!stricmp(name, "killmequick_off")) + DDr_CheatTable[20].message_off = strdup(value); + else if (!stricmp(name, "carousel_on")) + DDr_CheatTable[21].message_on = strdup(value); + else if (!stricmp(name, "carousel_off")) + DDr_CheatTable[21].message_off = strdup(value); else DDrStartupMessage("unrecognised language item \"%s\"", name); break; @@ -273,7 +377,8 @@ void __cdecl DDrMain(int argc, char* arg } // Cheats always enabled - DDrPatch_MakeJump(ONrPersist_GetWonGame, DDrPersist_GetWonGame); + if (patch_cheatsenabled) + DDrPatch_MakeJump(ONrPersist_GetWonGame, DDrPersist_GetWonGame); // Windowed mode if (patch_usedaodangl) @@ -282,6 +387,10 @@ void __cdecl DDrMain(int argc, char* arg DDrPatch_MakeJump(gl_platform_initialize, daodangl_platform_initialize); } + // Hacked windowed mode (for when daodangl isn't working properly) + if (patch_windowhack) + DDrWindowHack_Install(); + init_daodan_gl(); ONiMain(argc, argv);