--- Daodan/src/Daodan.c 2009/06/10 12:04:27 348 +++ Daodan/src/Daodan.c 2009/07/19 11:03:44 445 @@ -6,6 +6,9 @@ #include "Daodan_Win32.h" #include "Daodan_Cheater.h" #include "Daodan_Persistence.h" +#include "Daodan_BSL.h" + +#include "Daodan_WindowHack.h" #include "Oni.h" #include "Oni_Persistence.h" @@ -22,8 +25,8 @@ HMODULE DDrONiModule; bool patch_fonttexturecache = true; bool patch_largetextures = true; -bool patch_pathfinding = true; bool patch_levelplugins = true; +bool patch_pathfinding = true; bool patch_projaware = true; bool patch_directinput = true; bool patch_wpfadetime = true; @@ -32,14 +35,19 @@ bool patch_cooldowntimer = true; bool patch_throwtest = false; bool patch_alttab = true; bool patch_particledisablebit = false; -bool patch_multibyte = true; +bool patch_multibyte = false; bool patch_cheattable = true; +bool patch_argb8888 = 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 patch_daodaninit = true; + +bool opt_usedaodanbsl = true; bool DDrPatch_Init() { @@ -124,7 +132,7 @@ bool DDrPatch_Init() DDrPatch_Int16 (OniExe + 0x001b184, 0x9090); // Multi-byte patch (multiple language support) - if (patch_multibyte) + if (!patch_multibyte) { DDrPatch_Byte (OniExe + 0x0002d8f8, 0xeb); DDrPatch_Byte (OniExe + 0x0002d9ad, 0xeb); @@ -151,17 +159,27 @@ bool DDrPatch_Init() DDrPatch_Int32 (OniExe + 0x000f617a, (int)&DDr_CheatTable[0].message_on); } + if (patch_argb8888) + { + DDrPatch_Byte (OniExe + 0x00135af0, 0x07); + DDrPatch_Byte (OniExe + 0x00135af4, 0x0B); + } + return true; } -enum {s_unknown, s_patch, s_language} ini_section; +enum {s_unknown, s_options, s_patch, s_bsl, s_language} ini_section; bool DDrIniCallback(char* section, bool newsection, char* name, char* value) { if (newsection) { - if (!stricmp(section, "patch")) + if (!stricmp(section, "options")) + ini_section = s_options; + else if (!stricmp(section, "patch")) ini_section = s_patch; + else if (!stricmp(section, "bsl")) + ini_section = s_bsl; else if (!stricmp(section, "language")) ini_section = s_language; else @@ -173,17 +191,21 @@ bool DDrIniCallback(char* section, bool switch (ini_section) { + case s_options: + if (!stricmp(name, "usedaodanbsl")) + opt_usedaodanbsl = !stricmp(value, "true"); + break; case s_patch: if (!stricmp(name, "fonttexturecache")) 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, "levelplugins")) - patch_levelplugins = !stricmp(value, "true"); else if (!stricmp(name, "directinput")) patch_directinput = !stricmp(value, "true"); else if (!stricmp(name, "wpfadetime")) @@ -202,6 +224,8 @@ bool DDrIniCallback(char* section, bool patch_multibyte = !stricmp(value, "true"); else if (!stricmp(name, "cheattable")) patch_cheattable = !stricmp(value, "true"); + else if (!stricmp(name, "argb8888")) + patch_argb8888 = !stricmp(value, "true"); else if (!stricmp(name, "safeprintf")) patch_safeprintf = !stricmp(value, "true"); else if (!stricmp(name, "daodandisplayenum")) @@ -212,9 +236,16 @@ bool DDrIniCallback(char* section, bool 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 if (!stricmp(name, "daodaninit")) + patch_daodaninit = !stricmp(value, "true"); else DDrStartupMessage("unrecognised patch \"%s\"", name); break; + case s_bsl: + + break; case s_language: if (!stricmp(name, "savepoint")) { @@ -249,7 +280,77 @@ bool DDrIniCallback(char* section, bool else if (!stricmp(name, "canttouchthis_off")) DDr_CheatTable[3].message_off = strdup(value); else if (!stricmp(name, "fatloot_on")) - DDr_CheatTable[4].message_off = strdup(value); + 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; @@ -279,6 +380,12 @@ void DDrConfig() DDrStartupMessage("finished parsing"); } +void ONICALL DDrGame_Init() +{ + if (opt_usedaodanbsl) + SLrDaodan_Initalize(); +} + void __cdecl DDrMain(int argc, char* argv[]) { DDrStartupMessage("daodan attached!"); @@ -312,6 +419,13 @@ 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(); + + if (patch_daodaninit) + DDrPatch_MakeCall(OniExe + 0x000d345a, DDrGame_Init); + init_daodan_gl(); ONiMain(argc, argv);