| 1 | #include <windows.h> | 
 
 
 
 
 | 2 |  | 
 
 
 
 
 | 3 | #include "../Daodan.h" | 
 
 
 
 
 | 4 | #include "BSL.h" | 
 
 
 
 
 | 5 | #include "Cheater.h" | 
 
 
 
 
 | 6 | #include "../Daodan_Config.h" | 
 
 
 
 
 | 7 | #include "GL.h" | 
 
 
 
 
 | 8 | #include "../Daodan_Patch.h" | 
 
 
 
 
 | 9 | #include "Utility.h" | 
 
 
 
 
 | 10 | #include "Win32.h" | 
 
 
 
 
 | 11 |  | 
 
 
 
 
 | 12 | #include "../Oni/Oni.h" | 
 
 
 
 
 | 13 |  | 
 
 
 
 
 | 14 | typedef int (__cdecl *CHINESEPROC)(DWORD ThreadId); | 
 
 
 
 
 | 15 |  | 
 
 
 
 
 | 16 | // Hooked WMrSlider_SetRange() in ONiOGU_Options_InitDialog. Disables a gamma | 
 
 
 
 
 | 17 | // slider in windowed mode. | 
 
 
 
 
 | 18 | static void ONICALL DD_ONiOGU_GammaSlider_SetRange(void* window, int min_value, int max_value) | 
 
 
 
 
 | 19 | { | 
 
 
 
 
 | 20 | ConfigOption_t* co = DDrConfig_GetOptOfType("options.gamma", C_BOOL); | 
 
 
 
 
 | 21 | WMrWindow_SetEnabled(window, M3gResolutionSwitch && co->value.intBoolVal); | 
 
 
 
 
 | 22 | WMrSlider_SetRange(window, min_value, max_value); | 
 
 
 
 
 | 23 | } | 
 
 
 
 
 | 24 |  | 
 
 
 
 
 | 25 | void ONICALL DD_M3rDraw_BigBitmap(M3tTextureMap_Big* inBigBitmap, const M3tPointScreen* inDestPoint, UUtUns16 inWidth, UUtUns16 inHeight, UUtUns32 inShade, UUtUns16 inAlpha) /* 0 - M3cMaxAlpha */ | 
 
 
 
 
 | 26 | { | 
 
 
 
 
 | 27 | UUtUns16 x; | 
 
 
 
 
 | 28 | UUtUns16 y; | 
 
 
 
 
 | 29 |  | 
 
 
 
 
 | 30 | UUtUns16 index; | 
 
 
 
 
 | 31 | UUtUns16 remaining_width; | 
 
 
 
 
 | 32 | UUtUns16 remaining_height; | 
 
 
 
 
 | 33 |  | 
 
 
 
 
 | 34 | M3tPointScreen dest_point; | 
 
 
 
 
 | 35 | dest_point.z = inDestPoint->z; | 
 
 
 
 
 | 36 | dest_point.invW = inDestPoint->invW; | 
 
 
 
 
 | 37 |  | 
 
 
 
 
 | 38 | index = 0; | 
 
 
 
 
 | 39 | remaining_height = inHeight; | 
 
 
 
 
 | 40 | dest_point.y = (UUtInt16)((UUtUns16)inDestPoint->y); | 
 
 
 
 
 | 41 | for (y = 0; y < inBigBitmap->num_y; y++) | 
 
 
 
 
 | 42 | { | 
 
 
 
 
 | 43 | remaining_width = inWidth; | 
 
 
 
 
 | 44 | dest_point.x = (UUtInt16)((UUtUns16)inDestPoint->x); | 
 
 
 
 
 | 45 | for (x = 0; x < inBigBitmap->num_x; x++) | 
 
 
 
 
 | 46 | { | 
 
 
 
 
 | 47 | UUtUns16 width; | 
 
 
 
 
 | 48 | UUtUns16 height; | 
 
 
 
 
 | 49 |  | 
 
 
 
 
 | 50 | width = 256 < remaining_width ? 256 : remaining_width; | 
 
 
 
 
 | 51 | height = 256 < remaining_height ? 256 : remaining_height; | 
 
 
 
 
 | 52 |  | 
 
 
 
 
 | 53 | M3rDraw_Bitmap(inBigBitmap->textures[index], &dest_point, width, height, inShade, inAlpha); | 
 
 
 
 
 | 54 |  | 
 
 
 
 
 | 55 | dest_point.x += 256; | 
 
 
 
 
 | 56 | remaining_width -= 256; | 
 
 
 
 
 | 57 | index++; | 
 
 
 
 
 | 58 | } | 
 
 
 
 
 | 59 | dest_point.y += 256; | 
 
 
 
 
 | 60 | remaining_height -= 256; | 
 
 
 
 
 | 61 | } | 
 
 
 
 
 | 62 | } | 
 
 
 
 
 | 63 |  | 
 
 
 
 
 | 64 |  | 
 
 
 
 
 | 65 | uint8_t ONICALL DDrPersist_GetWonGame() | 
 
 
 
 
 | 66 | { | 
 
 
 
 
 | 67 | return 1; | 
 
 
 
 
 | 68 | } | 
 
 
 
 
 | 69 |  | 
 
 
 
 
 | 70 |  | 
 
 
 
 
 | 71 | void ONICALL DDrShowResumeButton(void* window, int visibility) | 
 
 
 
 
 | 72 | { | 
 
 
 
 
 | 73 | if (visibility) | 
 
 
 
 
 | 74 | WMrWindow_SetLocation(window, 150, 350); | 
 
 
 
 
 | 75 | WMrWindow_SetVisible(window, visibility); | 
 
 
 
 
 | 76 | } | 
 
 
 
 
 | 77 |  | 
 
 
 
 
 | 78 |  | 
 
 
 
 
 | 79 | /* Options always visible patch */ | 
 
 
 
 
 | 80 | void ONICALL DDrShowOptionsButton(void* window, int visibility) | 
 
 
 
 
 | 81 | { | 
 
 
 
 
 | 82 | WMrWindow_SetVisible(window, 1); | 
 
 
 
 
 | 83 | } | 
 
 
 
 
 | 84 |  | 
 
 
 
 
 | 85 | void ONICALL DDrGame_Init() | 
 
 
 
 
 | 86 | { | 
 
 
 
 
 | 87 | ConfigOption_t* co = DDrConfig_GetOptOfType("options.usedaodanbsl", C_BOOL); | 
 
 
 
 
 | 88 | if (co->value.intBoolVal) | 
 
 
 
 
 | 89 | SLrDaodan_Initialize(); | 
 
 
 
 
 | 90 | } | 
 
 
 
 
 | 91 |  | 
 
 
 
 
 | 92 |  | 
 
 
 
 
 | 93 | //this was broken | 
 
 
 
 
 | 94 | FILE** _UUgError_WarningFile = (FILE**)0x005711B4; | 
 
 
 
 
 | 95 | FILE* ONICALL DDrPrintWarning(int filename, int linenumber, unsigned __int16 errornum, int message) | 
 
 
 
 
 | 96 | { | 
 
 
 
 
 | 97 | FILE *v4; // eax@1 | 
 
 
 
 
 | 98 | FILE *result; // eax@4 | 
 
 
 
 
 | 99 | char v6[512]; // [sp+0h] [bp-100h]@1 | 
 
 
 
 
 | 100 | FILE* UUgError_WarningFile = *_UUgError_WarningFile; | 
 
 
 
 
 | 101 |  | 
 
 
 
 
 | 102 | if (filename && message && (strlen((const char*)filename)+strlen((const char*)message))<420) { | 
 
 
 
 
 | 103 | sprintf( | 
 
 
 
 
 | 104 | v6, | 
 
 
 
 
 | 105 | "Error %x reported from File: %s, Line: %d (message follows) \r\n%s", | 
 
 
 
 
 | 106 | errornum, | 
 
 
 
 
 | 107 | (const char*)filename, | 
 
 
 
 
 | 108 | linenumber, | 
 
 
 
 
 | 109 | (const char*)message); | 
 
 
 
 
 | 110 |  | 
 
 
 
 
 | 111 | if ( UUgError_WarningFile | 
 
 
 
 
 | 112 | || (UUgError_WarningFile = oni_fopen("debugger.txt", "wb"), UUgError_WarningFile ) ) | 
 
 
 
 
 | 113 | { | 
 
 
 
 
 | 114 | oni_fprintf(UUgError_WarningFile, "%s\r\n", v6); | 
 
 
 
 
 | 115 | oni_fflush(UUgError_WarningFile); | 
 
 
 
 
 | 116 | } | 
 
 
 
 
 | 117 | } | 
 
 
 
 
 | 118 | //oni_fprintf(stdout, v6); | 
 
 
 
 
 | 119 | //sprintf(&v6, "%s", message); | 
 
 
 
 
 | 120 | *_UUgError_WarningFile = UUgError_WarningFile; | 
 
 
 
 
 | 121 | result = UUgError_WarningFile; | 
 
 
 
 
 | 122 | return result; | 
 
 
 
 
 | 123 | } | 
 
 
 
 
 | 124 |  | 
 
 
 
 
 | 125 | _COrTextArea_Resize Oni_COrTextArea_Resize = (_COrTextArea_Resize)0; | 
 
 
 
 
 | 126 | int16_t ONICALL DD_COrTextArea_Resize(void* inTextArea, UUtRect* inBounds, int16_t inNumTextEntries) { | 
 
 
 
 
 | 127 | if (inTextArea == COgCommandLine) { | 
 
 
 
 
 | 128 | inBounds->top -= 10; | 
 
 
 
 
 | 129 | } else if (inTextArea == COgConsoleLines) { | 
 
 
 
 
 | 130 | inBounds->bottom -= 10; | 
 
 
 
 
 | 131 | } | 
 
 
 
 
 | 132 | return Oni_COrTextArea_Resize(inTextArea, inBounds, inNumTextEntries); | 
 
 
 
 
 | 133 | } | 
 
 
 
 
 | 134 |  | 
 
 
 
 
 | 135 | #define IMcShade_Red (0xFFFF0000) | 
 
 
 
 
 | 136 | #define IMcShade_Green (0xFF00FF00) | 
 
 
 
 
 | 137 | #define IMcShade_Blue (0xFF0000FF) | 
 
 
 
 
 | 138 | void ONICALL DD_OBJiTriggerVolume_Draw(OBJtObject* inObject, uint32_t inDrawFlags) | 
 
 
 
 
 | 139 | { | 
 
 
 
 
 | 140 | UUtUns32                                itr; | 
 
 
 
 
 | 141 | OBJtOSD_All                             *inOSD = (OBJtOSD_All *) inObject->object_data; | 
 
 
 
 
 | 142 | OBJtOSD_TriggerVolume   *trigger_osd = &inOSD->osd.trigger_volume_osd; | 
 
 
 
 
 | 143 | M3tPoint3D                              *points = trigger_osd->volume.worldPoints; | 
 
 
 
 
 | 144 | UUtUns32                                shade = 0xFFFFFF; | 
 
 
 
 
 | 145 |  | 
 
 
 
 
 | 146 | if (!OBJgTriggerVolume_Visible) { | 
 
 
 
 
 | 147 | return; | 
 
 
 
 
 | 148 | } | 
 
 
 
 
 | 149 |  | 
 
 
 
 
 | 150 | if (OBJrTriggerVolume_IntersectsCharacter(inObject, trigger_osd->team_mask, ONgGameState->PlayerCharacter)) { | 
 
 
 
 
 | 151 | shade = IMcShade_Red; | 
 
 
 
 
 | 152 | } | 
 
 
 
 
 | 153 | else | 
 
 
 
 
 | 154 | { | 
 
 
 
 
 | 155 | shade = IMcShade_Blue; | 
 
 
 
 
 | 156 | } | 
 
 
 
 
 | 157 |  | 
 
 
 
 
 | 158 | M3rGeom_Line_Light(points + 0, points + 1, shade); | 
 
 
 
 
 | 159 | M3rGeom_Line_Light(points + 1, points + 3, shade); | 
 
 
 
 
 | 160 | M3rGeom_Line_Light(points + 3, points + 2, shade); | 
 
 
 
 
 | 161 | M3rGeom_Line_Light(points + 2, points + 0, shade); | 
 
 
 
 
 | 162 |  | 
 
 
 
 
 | 163 | M3rGeom_Line_Light(points + 4, points + 5, shade); | 
 
 
 
 
 | 164 | M3rGeom_Line_Light(points + 5, points + 7, shade); | 
 
 
 
 
 | 165 | M3rGeom_Line_Light(points + 7, points + 6, shade); | 
 
 
 
 
 | 166 | M3rGeom_Line_Light(points + 6, points + 4, shade); | 
 
 
 
 
 | 167 |  | 
 
 
 
 
 | 168 | M3rGeom_Line_Light(points + 0, points + 4, shade); | 
 
 
 
 
 | 169 | M3rGeom_Line_Light(points + 1, points + 5, shade); | 
 
 
 
 
 | 170 | M3rGeom_Line_Light(points + 3, points + 7, shade); | 
 
 
 
 
 | 171 | M3rGeom_Line_Light(points + 2, points + 6, shade); | 
 
 
 
 
 | 172 | } | 
 
 
 
 
 | 173 |  | 
 
 
 
 
 | 174 | _ONrMechanics_Register Oni_ONrMechanics_Register = (_ONrMechanics_Register)0; | 
 
 
 
 
 | 175 | int16_t ONICALL DD_ONrMechanics_Register(uint32_t inObjectType, uint32_t inObjectTypeIndex, char* inGroupName, | 
 
 
 
 
 | 176 | uint32_t inSizeInMemory, OBJtMethods* inObjectMethods, uint32_t inFlags, void* inMechanicsMethods) | 
 
 
 
 
 | 177 | { | 
 
 
 
 
 | 178 | if (strcmp("Trigger Volume", inGroupName) == 0) { | 
 
 
 
 
 | 179 | inObjectMethods->rDraw = DD_OBJiTriggerVolume_Draw; | 
 
 
 
 
 | 180 | } | 
 
 
 
 
 | 181 | return Oni_ONrMechanics_Register(inObjectType, inObjectTypeIndex, inGroupName, inSizeInMemory, inObjectMethods, inFlags, inMechanicsMethods); | 
 
 
 
 
 | 182 | } | 
 
 
 
 
 | 183 |  | 
 
 
 
 
 | 184 | _ONrGameState_HandleUtilityInput Oni_ONrGameState_HandleUtilityInput = (_ONrGameState_HandleUtilityInput)0; | 
 
 
 
 
 | 185 | void ONICALL DD_ONrGameState_HandleUtilityInput(const void* inInput) | 
 
 
 
 
 | 186 | { | 
 
 
 
 
 | 187 | Oni_ONrGameState_HandleUtilityInput(inInput); | 
 
 
 
 
 | 188 |  | 
 
 
 
 
 | 189 | if (ONrDebugKey_WentDown(7)) { | 
 
 
 
 
 | 190 | OBJgTriggerVolume_Visible = !OBJgTriggerVolume_Visible; | 
 
 
 
 
 | 191 | } | 
 
 
 
 
 | 192 | } | 
 
 
 
 
 | 193 |  | 
 
 
 
 
 | 194 |  | 
 
 
 
 
 | 195 | int DD_Patch_DebugNameTextureInit(short width, short height, int type, int allocated, int flags, char* name, void** output) | 
 
 
 
 
 | 196 | { | 
 
 
 
 
 | 197 | //flags = (1 << 10); | 
 
 
 
 
 | 198 | type = 1; | 
 
 
 
 
 | 199 | //DDrPatch_Byte( 0x005EB83C + 3, 0xff ); | 
 
 
 
 
 | 200 | DDrPatch_Int32((int*)(OniExe + 0x001EB83C), 0xFF000000 ); | 
 
 
 
 
 | 201 | return M3rTextureMap_New(width, height, type, allocated, flags, name, output); | 
 
 
 
 
 | 202 | } | 
 
 
 
 
 | 203 |  | 
 
 
 
 
 | 204 | short DD_Patch_DebugNameShadeHack( Character* Char ) | 
 
 
 
 
 | 205 | { | 
 
 
 
 
 | 206 | return TSrContext_SetShade(*(void**)(OniExe + 0x001EB844), ONrCharacter_GetHealthShade( Char->Health, Char->MaxHealth )); | 
 
 
 
 
 | 207 | //return TSrContext_SetShade(*(void**)0x005EB844, 0xFFFFFFFF); | 
 
 
 
 
 | 208 | } | 
 
 
 
 
 | 209 |  | 
 
 
 
 
 | 210 |  | 
 
 
 
 
 | 211 | // Disable UUrPlatform_Initalize/Terminate, this enables the Alt-Tab and the | 
 
 
 
 
 | 212 | // Windows key but has the possible side effect of allowing the screensaver | 
 
 
 
 
 | 213 | // to enable itself in-game. | 
 
 
 
 
 | 214 | void DD_Patch_AltTab() | 
 
 
 
 
 | 215 | { | 
 
 
 
 
 | 216 | // 0xC3 = ret, so makes those functions just have a "ret" instruction at their start | 
 
 
 
 
 | 217 | DDrPatch_Byte  ((char*)UUrPlatform_Initialize, 0xC3); | 
 
 
 
 
 | 218 | DDrPatch_Byte  ((char*)UUrPlatform_Terminate, 0xC3); | 
 
 
 
 
 | 219 | } | 
 
 
 
 
 | 220 |  | 
 
 
 
 
 | 221 | // Textures using ARGB8888 can be used | 
 
 
 
 
 | 222 | void DD_Patch_ARGB8888() | 
 
 
 
 
 | 223 | { | 
 
 
 
 
 | 224 | DDrPatch_Byte  ((char*)(OniExe + 0x00135af0), 0x07); | 
 
 
 
 
 | 225 | DDrPatch_Byte  ((char*)(OniExe + 0x00135af4), 0x0B); | 
 
 
 
 
 | 226 | } | 
 
 
 
 
 | 227 |  | 
 
 
 
 
 | 228 | // Fix BinkBufferInit() call in BKrMovie_Play() to use GDI (DIB) blitting | 
 
 
 
 
 | 229 | // instead of DirectDraw; patch ONiRunGame to use the same method to play | 
 
 
 
 
 | 230 | // outro (ie., BKrMovie_Play() instead of ONrMovie_Play_Hardware() as the | 
 
 
 
 
 | 231 | // latter has problems on WINE). | 
 
 
 
 
 | 232 | void DD_Patch_BinkPlay() | 
 
 
 
 
 | 233 | { | 
 
 
 
 
 | 234 | // push BINKBUFFERAUTO -> push BINKBUFFERDIBSECTION. | 
 
 
 
 
 | 235 | DDrPatch_Byte((void*)(OniExe + 0x0008829b + 1), 0x02); | 
 
 
 
 
 | 236 | // call ONrMovie_Play_Hardware -> call ONrMovie_Play | 
 
 
 
 
 | 237 | DDrPatch_MakeCall((void*)(OniExe + 0x000d496f), ONrMovie_Play); | 
 
 
 
 
 | 238 | } | 
 
 
 
 
 | 239 |  | 
 
 
 
 
 | 240 | // Enables d_regen (unfinished) and prevents fly-in portraits from being | 
 
 
 
 
 | 241 | // stretched when playing in widescreen resolutions. | 
 
 
 
 
 | 242 | void DD_Patch_BSL() | 
 
 
 
 
 | 243 | { | 
 
 
 
 
 | 244 | //Calculating the value of the needed offset is much more reliable when the compiler does it for you. | 
 
 
 
 
 | 245 |  | 
 
 
 
 
 | 246 | //TODO: fix moonshadow. | 
 
 
 
 
 | 247 | Character * Chr = 0; | 
 
 
 
 
 | 248 | int NoPath = (int)&(Chr[0].RegenHax) & 0x000000FF; | 
 
 
 
 
 | 249 | const unsigned char regen_patch[] = | 
 
 
 
 
 | 250 | {0x90, 0x90, 0x90, 0x90, 0x90,                          // mov    al, _WPgRegenerationCheat     -> NOOP | 
 
 
 
 
 | 251 | 0x90, 0x90,                                                                     // test   al, al                                        -> NOOP | 
 
 
 
 
 | 252 | 0x90, 0x90,                                                                     // jz     short loc_51BB98                      -> NOOP | 
 
 
 
 
 | 253 | 0x8B, 0x86, (char)NoPath, 0x01, 0x00, 0x00, // mov     eax, [esi+Character.field_1E8] | 
 
 
 
 
 | 254 | //      -> mov     eax, [esi+Character.RegenHax] | 
 
 
 
 
 | 255 | 0x85, 0xC0,                                                                     // test eax, eax | 
 
 
 
 
 | 256 | 0x74, 0x21                                                                      // jnz 0x21 -> jz 0x21 | 
 
 
 
 
 | 257 | }; | 
 
 
 
 
 | 258 | DDrPatch_Const((char*)(OniExe + 0x0011BB64), regen_patch); | 
 
 
 
 
 | 259 |  | 
 
 
 
 
 | 260 | // Patches for existing BSL functions | 
 
 
 
 
 | 261 | SLrDaodan_Patch(); | 
 
 
 
 
 | 262 | } | 
 
 
 
 
 | 263 |  | 
 
 
 
 
 | 264 | // Adds new cheat codes if cheattable is also enabled | 
 
 
 
 
 | 265 | void DD_Patch_Cheater() | 
 
 
 
 
 | 266 | { | 
 
 
 
 
 | 267 | DDrPatch_MakeCall((void*)(OniExe + 0x000f618f), (void*)DDrCheater); | 
 
 
 
 
 | 268 | DDrPatch_Int16((short*)(OniExe + 0x000deb45), 0x5590); | 
 
 
 
 
 | 269 | #if 1 | 
 
 
 
 
 | 270 | DDrPatch_MakeCall((void*)(OniExe + 0x000deb47), (void*)FallingFrames); | 
 
 
 
 
 | 271 | #endif | 
 
 
 
 
 | 272 | DDrPatch_MakeJump((void*)(OniExe + 0x0010f021), (void*)DDrCheater_LevelLoad); | 
 
 
 
 
 | 273 | } | 
 
 
 
 
 | 274 |  | 
 
 
 
 
 | 275 | // Cheats always enabled | 
 
 
 
 
 | 276 | void DD_Patch_CheatsEnabled() | 
 
 
 
 
 | 277 | { | 
 
 
 
 
 | 278 | DDrPatch_MakeJump((void*)ONrPersist_GetWonGame, (void*)DDrPersist_GetWonGame); | 
 
 
 
 
 | 279 | } | 
 
 
 
 
 | 280 |  | 
 
 
 
 
 | 281 | // Use Daodan's own cheattable | 
 
 
 
 
 | 282 | void DD_Patch_CheatTable() | 
 
 
 
 
 | 283 | { | 
 
 
 
 
 | 284 | DDrPatch_Int32 ((int*)(OniExe + 0x000f616b), (int)&DDr_CheatTable[0].name); | 
 
 
 
 
 | 285 | DDrPatch_Int32 ((int*)(OniExe + 0x000f617a), (int)&DDr_CheatTable[0].message_on); | 
 
 
 
 
 | 286 | } | 
 
 
 
 
 | 287 |  | 
 
 
 
 
 | 288 | // Load chinese font DLL if available | 
 
 
 
 
 | 289 | void DD_Patch_Chinese() | 
 
 
 
 
 | 290 | { | 
 
 
 
 
 | 291 | if (GetFileAttributes("xfhsm_oni.dll") != INVALID_FILE_ATTRIBUTES) | 
 
 
 
 
 | 292 | { | 
 
 
 
 
 | 293 | HMODULE dll; | 
 
 
 
 
 | 294 | DWORD err; | 
 
 
 
 
 | 295 |  | 
 
 
 
 
 | 296 | STARTUPMESSAGE("Loading chinese DLL", 0); | 
 
 
 
 
 | 297 | dll = LoadLibrary("xfhsm_oni.dll"); | 
 
 
 
 
 | 298 | err = GetLastError(); | 
 
 
 
 
 | 299 | if( dll ) | 
 
 
 
 
 | 300 | { | 
 
 
 
 
 | 301 | void* proc = GetProcAddress( dll, "InstallHook" ); | 
 
 
 
 
 | 302 | if(proc) | 
 
 
 
 
 | 303 | { | 
 
 
 
 
 | 304 | ((CHINESEPROC)proc)(GetCurrentThreadId()); | 
 
 
 
 
 | 305 | } | 
 
 
 
 
 | 306 | } else { | 
 
 
 
 
 | 307 | char msg[100]; | 
 
 
 
 
 | 308 | FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, 0, msg, 100, NULL); | 
 
 
 
 
 | 309 | STARTUPMESSAGE("Loading DLL failed with error %i: %s", err, msg); | 
 
 
 
 
 | 310 | } | 
 
 
 
 
 | 311 | } | 
 
 
 
 
 | 312 | } | 
 
 
 
 
 | 313 |  | 
 
 
 
 
 | 314 | // Limit cursor to Oni's window | 
 
 
 
 
 | 315 | void DD_Patch_ClipCursor() | 
 
 
 
 
 | 316 | { | 
 
 
 
 
 | 317 | // LIrMode_Set: replace LIrPlatform_Mode_Set call with our hook. | 
 
 
 
 
 | 318 | DDrPatch_MakeCall((void*)(OniExe + 0x00003f9f), (void*) DD_LIrPlatform_Mode_Set); | 
 
 
 
 
 | 319 |  | 
 
 
 
 
 | 320 | // LIrMode_Set_Internal: replace LIrPlatform_Mode_Set call with our hook. | 
 
 
 
 
 | 321 | DDrPatch_MakeCall((void*)(OniExe + 0x00003fff), (void*) DD_LIrPlatform_Mode_Set); | 
 
 
 
 
 | 322 |  | 
 
 
 
 
 | 323 | // LIrTermiante: replace LIrPlatform_Terminate call with our hook. | 
 
 
 
 
 | 324 | DDrPatch_MakeCall((void*)(OniExe + 0x000004cb8), (void*) DD_LIrPlatform_Terminate); | 
 
 
 
 
 | 325 | } | 
 
 
 
 
 | 326 |  | 
 
 
 
 
 | 327 | // Disables weapon cooldown exploit | 
 
 
 
 
 | 328 | void DD_Patch_CooldownTimer() | 
 
 
 
 
 | 329 | { | 
 
 
 
 
 | 330 | 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 }; | 
 
 
 
 
 | 331 | DDrPatch_Const ((char*)(OniExe + 0x0011a825), cooldown_patch); | 
 
 
 
 
 | 332 | } | 
 
 
 
 
 | 333 |  | 
 
 
 
 
 | 334 | // Daodan device mode enumeration function | 
 
 
 
 
 | 335 | void DD_Patch_DaodanDisplayEnum() | 
 
 
 
 
 | 336 | { | 
 
 
 
 
 | 337 | DDrPatch_MakeJump((void*)gl_enumerate_valid_display_modes, (void*)DD_GLrEnumerateDisplayModes); | 
 
 
 
 
 | 338 | } | 
 
 
 
 
 | 339 |  | 
 
 
 
 
 | 340 | // Adds new BSL functions | 
 
 
 
 
 | 341 | void DD_Patch_DaodanInit() | 
 
 
 
 
 | 342 | { | 
 
 
 
 
 | 343 | DDrPatch_MakeCall((void*)(OniExe + 0x000d345a), (void*)DDrGame_Init); | 
 
 
 
 
 | 344 | } | 
 
 
 
 
 | 345 |  | 
 
 
 
 
 | 346 | // Forced DirectInput (for Windows NT) | 
 
 
 
 
 | 347 | void DD_Patch_DirectInput() | 
 
 
 
 
 | 348 | { | 
 
 
 
 
 | 349 | DDrPatch_Byte((char*)(OniExe + 0x00002e6d), 0xeb); | 
 
 
 
 
 | 350 | } | 
 
 
 
 
 | 351 |  | 
 
 
 
 
 | 352 | // Disable Oni's command line parser so it doesn't interfere with ours | 
 
 
 
 
 | 353 | void DD_Patch_DisableCmdLine() | 
 
 
 
 
 | 354 | { | 
 
 
 
 
 | 355 | // Replace start of OniParseCommandLine with XOR ax,ax; RET | 
 
 
 
 
 | 356 | //      DDrPatch_Int32 ((int*)(OniExe + 0x000d3570), 0xc3c03366); | 
 
 
 
 
 | 357 | // Replace start of OniParseCommandLine with XOR eax,eax; RET | 
 
 
 
 
 | 358 | DDrPatch_Int32 ((int*)(OniExe + 0x000d3570), 0x00c3c033); | 
 
 
 
 
 | 359 | } | 
 
 
 
 
 | 360 |  | 
 
 
 
 
 | 361 | // Font texture cache doubled | 
 
 
 
 
 | 362 | void DD_Patch_FontTextureCache() | 
 
 
 
 
 | 363 | { | 
 
 
 
 
 | 364 | DDrPatch_Byte((char*)(OniExe + 0x00020ea7), 0x20); | 
 
 
 
 
 | 365 | DDrPatch_Byte((char*)(OniExe + 0x00020f4a), 0x40); | 
 
 
 
 
 | 366 | } | 
 
 
 
 
 | 367 |  | 
 
 
 
 
 | 368 | // Disable Oni's internal CLrGetCommandLine function (to eventually replace it with our own) | 
 
 
 
 
 | 369 | void DD_Patch_GetCmdLine() | 
 
 
 
 
 | 370 | { | 
 
 
 
 
 | 371 | DDrPatch_NOOP  ((char*)(OniExe + 0x000d3280), 51); | 
 
 
 
 
 | 372 | } | 
 
 
 
 
 | 373 |  | 
 
 
 
 
 | 374 | // Allow HD screens with resolution < 1024*768 | 
 
 
 
 
 | 375 | void DD_Patch_HDScreens_LowRes() | 
 
 
 
 
 | 376 | { | 
 
 
 
 
 | 377 | DDrPatch_MakeJump((void*)M3rDraw_BigBitmap, (void*)DD_M3rDraw_BigBitmap); | 
 
 
 
 
 | 378 | } | 
 
 
 
 
 | 379 |  | 
 
 
 
 
 | 380 | void DD_Patch_HighresConsole() { | 
 
 
 
 
 | 381 | Oni_COrTextArea_Resize = DDrPatch_MakeDetour((void*)COrTextArea_Resize, (void*)DD_COrTextArea_Resize); | 
 
 
 
 
 | 382 | } | 
 
 
 
 
 | 383 |  | 
 
 
 
 
 | 384 | // Hackish fix for Konoko not kicking guns | 
 
 
 
 
 | 385 | // Don't use this, it breaks stairs. | 
 
 
 
 
 | 386 | void DD_Patch_KickGuns() | 
 
 
 
 
 | 387 | { | 
 
 
 
 
 | 388 | 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 }; | 
 
 
 
 
 | 389 | DDrPatch_Const ((char*)(OniExe + 0x000dc420), kickgun_patch); | 
 
 
 
 
 | 390 | } | 
 
 
 
 
 | 391 |  | 
 
 
 
 
 | 392 | // Disable loading the vtuneapi.dll | 
 
 
 
 
 | 393 | void DD_Patch_KillVTune() | 
 
 
 
 
 | 394 | { | 
 
 
 
 
 | 395 | DDrPatch_Byte  ((char*)(OniExe + 0x00026340), 0xC3); | 
 
 
 
 
 | 396 | } | 
 
 
 
 
 | 397 |  | 
 
 
 
 
 | 398 | // Now supports textures up to 512x512 | 
 
 
 
 
 | 399 | void DD_Patch_LargeTextures() | 
 
 
 
 
 | 400 | { | 
 
 
 
 
 | 401 | DDrPatch_Byte  ((char*)(OniExe + 0x00005251), 0x10); | 
 
 
 
 
 | 402 | } | 
 
 
 
 
 | 403 |  | 
 
 
 
 
 | 404 | // Non-"_Final" levels are now valid | 
 
 
 
 
 | 405 | void DD_Patch_LevelPlugins() | 
 
 
 
 
 | 406 | { | 
 
 
 
 
 | 407 | DDrPatch_Byte  ((char*)(OniExe + 0x000206a8), 0x01); | 
 
 
 
 
 | 408 | } | 
 
 
 
 
 | 409 |  | 
 
 
 
 
 | 410 | // Weapon on ground shown with name and magazine contents | 
 
 
 
 
 | 411 | void DD_Patch_NewWeap() | 
 
 
 
 
 | 412 | { | 
 
 
 
 
 | 413 | //Makes it always say "Received weapon_name." | 
 
 
 
 
 | 414 | //Needs check for loc_4DFC66 | 
 
 
 
 
 | 415 | //DDrPatch_NOOP((char*)(OniExe + 0x000E4DF8),2); | 
 
 
 
 
 | 416 |  | 
 
 
 
 
 | 417 | //Adds Weapon name and ammo meter to pickup autoprompt | 
 
 
 
 
 | 418 | DDrPatch_NOOP((char*)(OniExe + 0x000FAC73), 9); | 
 
 
 
 
 | 419 | DDrPatch_NOOP((char*)(OniExe + 0x000FAC80), 5); | 
 
 
 
 
 | 420 | DDrPatch_MakeCall((void*)(OniExe + 0xFAC85), (void*)DDrWeapon2Message); | 
 
 
 
 
 | 421 |  | 
 
 
 
 
 | 422 | //Moves location of colors | 
 
 
 
 
 | 423 | //DDrPatch_Int32((int*)(OniExe + 0x0002E3D5), (int)&DDrDSayColors ); | 
 
 
 
 
 | 424 | //DDrPatch_Int32((int*)(OniExe + 0x0002E3DA), (int)&DDrDSayColors ); | 
 
 
 
 
 | 425 | } | 
 
 
 
 
 | 426 |  | 
 
 
 
 
 | 427 | // Disable Multi-byte character awareness patch (multiple language support) | 
 
 
 
 
 | 428 | void DD_Patch_NoMultiByte() | 
 
 
 
 
 | 429 | { | 
 
 
 
 
 | 430 | DDrPatch_Byte  ((char*)(OniExe + 0x0002d8f8), 0xeb); | 
 
 
 
 
 | 431 | DDrPatch_Byte  ((char*)(OniExe + 0x0002d9ad), 0xeb); | 
 
 
 
 
 | 432 | DDrPatch_Byte  ((char*)(OniExe + 0x0002dbe2), 0xeb); | 
 
 
 
 
 | 433 | DDrPatch_Byte  ((char*)(OniExe + 0x0002dec3), 0xeb); | 
 
 
 
 
 | 434 | DDrPatch_Byte  ((char*)(OniExe + 0x0002e2ab), 0xeb); | 
 
 
 
 
 | 435 | DDrPatch_Byte  ((char*)(OniExe + 0x0002e2c4), 0xeb); | 
 
 
 
 
 | 436 | DDrPatch_Byte  ((char*)(OniExe + 0x0002e379), 0xeb); | 
 
 
 
 
 | 437 | DDrPatch_Byte  ((char*)(OniExe + 0x0002e48c), 0xeb); | 
 
 
 
 
 | 438 | DDrPatch_Byte  ((char*)(OniExe + 0x0002e4d0), 0xeb); | 
 
 
 
 
 | 439 | DDrPatch_Byte  ((char*)(OniExe + 0x0002e4f4), 0xeb); | 
 
 
 
 
 | 440 | DDrPatch_Byte  ((char*)(OniExe + 0x0002e646), 0xeb); | 
 
 
 
 
 | 441 | DDrPatch_Byte  ((char*)(OniExe + 0x0002e695), 0xeb); | 
 
 
 
 
 | 442 | DDrPatch_Byte  ((char*)(OniExe + 0x0002e944), 0xeb); | 
 
 
 
 
 | 443 | DDrPatch_Byte  ((char*)(OniExe + 0x0002e95d), 0xeb); | 
 
 
 
 
 | 444 | DDrPatch_Byte  ((char*)(OniExe + 0x0002e98e), 0xeb); | 
 
 
 
 
 | 445 | DDrPatch_Byte  ((char*)(OniExe + 0x0002e9dc), 0xeb); | 
 
 
 
 
 | 446 | } | 
 
 
 
 
 | 447 |  | 
 
 
 
 
 | 448 | // Fix options not visible in main menu when a game was started | 
 
 
 
 
 | 449 | void DD_Patch_OptionsVisible() | 
 
 
 
 
 | 450 | { | 
 
 
 
 
 | 451 | DDrPatch_MakeCall((void*)(OniExe + 0x000d2d2d), DDrShowOptionsButton); | 
 
 
 
 
 | 452 | DDrPatch_MakeCall((void*)(OniExe + 0x000d2d43), DDrShowResumeButton); | 
 
 
 
 
 | 453 | } | 
 
 
 
 
 | 454 |  | 
 
 
 
 
 | 455 | // Unlocks particle action disabling/enabling bits for all events. (Will be | 
 
 
 
 
 | 456 | // controlled by a command line switch when I figure out how to do that without | 
 
 
 
 
 | 457 | // Win32 hacks.) | 
 
 
 
 
 | 458 | void DD_Patch_ParticleDisableBit() | 
 
 
 
 
 | 459 | { | 
 
 
 
 
 | 460 | DDrPatch_Int16 ((short*)(OniExe + 0x001b184), 0x9090); | 
 
 
 
 
 | 461 | } | 
 
 
 
 
 | 462 |  | 
 
 
 
 
 | 463 | // Pathfinding grid cache size x8 | 
 
 
 
 
 | 464 | void DD_Patch_PathFinding() | 
 
 
 
 
 | 465 | { | 
 
 
 
 
 | 466 | const unsigned char pathfinding[2] = {0x90 , 0xE9 }; | 
 
 
 
 
 | 467 | DDrPatch_Byte  ((char*)(OniExe + 0x0010b03b), 0x20); | 
 
 
 
 
 | 468 | DDrPatch_Byte  ((char*)(OniExe + 0x0010b04c), 0x20); | 
 
 
 
 
 | 469 |  | 
 
 
 
 
 | 470 | //other stuff | 
 
 
 
 
 | 471 | DDrPatch_Const((char*)(OniExe + 0x00040789), pathfinding); | 
 
 
 
 
 | 472 | } | 
 
 
 
 
 | 473 |  | 
 
 
 
 
 | 474 | // Projectile awareness fixed | 
 
 
 
 
 | 475 | void DD_Patch_ProjAware() | 
 
 
 
 
 | 476 | { | 
 
 
 
 
 | 477 | DDrPatch_Byte  ((char*)(OniExe + 0x0009c07c), 0x6c); | 
 
 
 
 
 | 478 | DDrPatch_Byte  ((char*)(OniExe + 0x0009c080), 0x70); | 
 
 
 
 
 | 479 | DDrPatch_Byte  ((char*)(OniExe + 0x0009c084), 0x74); | 
 
 
 
 
 | 480 | DDrPatch_Byte  ((char*)(OniExe + 0x0009c110), 0x6c); | 
 
 
 
 
 | 481 | } | 
 
 
 
 
 | 482 |  | 
 
 
 
 
 | 483 | // Safe startup message printer | 
 
 
 
 
 | 484 | void DD_Patch_SafePrintf() | 
 
 
 
 
 | 485 | { | 
 
 
 
 
 | 486 | DDrPatch_MakeJump((void*)UUrStartupMessage, (void*)DDrStartupMessage); | 
 
 
 
 
 | 487 | } | 
 
 
 
 
 | 488 |  | 
 
 
 
 
 | 489 | // Show all (also enemies') lasersights | 
 
 
 
 
 | 490 | void DD_Patch_ShowAllLasersights() | 
 
 
 
 
 | 491 | { | 
 
 
 
 
 | 492 | DDrPatch_NOOP((char*)(OniExe + 0x000E1957), 6 ); | 
 
 
 
 
 | 493 | } | 
 
 
 
 
 | 494 |  | 
 
 
 
 
 | 495 | void DD_Patch_ShowTriggerVolumes() | 
 
 
 
 
 | 496 | { | 
 
 
 
 
 | 497 | Oni_ONrMechanics_Register = DDrPatch_MakeDetour((void*)ONrMechanics_Register, (void*)DD_ONrMechanics_Register); | 
 
 
 
 
 | 498 | Oni_ONrGameState_HandleUtilityInput = DDrPatch_MakeDetour((void*)ONrGameState_HandleUtilityInput, (void*)DD_ONrGameState_HandleUtilityInput); | 
 
 
 
 
 | 499 | } | 
 
 
 
 
 | 500 |  | 
 
 
 
 
 | 501 | // Experiment with allowing enemies to be thrown over railings | 
 
 
 
 
 | 502 | void DD_Patch_Throwtest() | 
 
 
 
 
 | 503 | { | 
 
 
 
 
 | 504 | const unsigned char throwtest_patch[] = { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }; | 
 
 
 
 
 | 505 | DDrPatch_Const((char*)(OniExe + 0x000dc190), throwtest_patch); | 
 
 
 
 
 | 506 | } | 
 
 
 
 
 | 507 |  | 
 
 
 
 
 | 508 | // DaodanGL with windowed mode support | 
 
 
 
 
 | 509 | void DD_Patch_UseDaodanGL() | 
 
 
 
 
 | 510 | { | 
 
 
 
 
 | 511 | // LIrPlatform_Mode_Set: GetWindowRect -> GetClientRect. | 
 
 
 
 
 | 512 | DDrPatch_NOOP((char*) OniExe + 0x00002dd6, 6); | 
 
 
 
 
 | 513 | DDrPatch_MakeCall((char*) OniExe + 0x00002dd6, (void*) GetClientRect); | 
 
 
 
 
 | 514 |  | 
 
 
 
 
 | 515 | // UUrWindow_GetSize: GetWindowRect -> GetClientRect. | 
 
 
 
 
 | 516 | DDrPatch_NOOP((char*) OniExe + 0x0002651c, 6); | 
 
 
 
 
 | 517 | DDrPatch_MakeCall((char*) OniExe + 0x0002651c, (void*) GetClientRect); | 
 
 
 
 
 | 518 |  | 
 
 
 
 
 | 519 | // LIrPlatform_PollInputForAction: fix GetCursorPos call to return client coordinates. | 
 
 
 
 
 | 520 | DDrPatch_NOOP((char*) OniExe + 0x000032cc, 6); | 
 
 
 
 
 | 521 | DDrPatch_MakeCall((char*) OniExe + 0x000032cc, (void*) DD_GetCursorPos); | 
 
 
 
 
 | 522 |  | 
 
 
 
 
 | 523 | // LIrPlatform_InputEvent_GetMouse: fix GetCursorPos call to return client coordinates. | 
 
 
 
 
 | 524 | DDrPatch_NOOP((char*) OniExe + 0x00002cc2, 6); | 
 
 
 
 
 | 525 | DDrPatch_MakeCall((char*) OniExe + 0x00002cc2, (void*) DD_GetCursorPos); | 
 
 
 
 
 | 526 |  | 
 
 
 
 
 | 527 | // LIrPlatform_PollInputForAction: translate SetCursorPos position to screen coordinates. | 
 
 
 
 
 | 528 | DDrPatch_NOOP((char*) OniExe + 0x000032b7, 6); | 
 
 
 
 
 | 529 | DDrPatch_MakeCall((char*) OniExe + 0x000032b7, (void*) DD_SetCursorPos); | 
 
 
 
 
 | 530 |  | 
 
 
 
 
 | 531 | // LIrPlatform_PollInputForAction: translate SetCursorPos position to screen coordinates. | 
 
 
 
 
 | 532 | DDrPatch_NOOP((char*) OniExe + 0x00003349, 6); | 
 
 
 
 
 | 533 | DDrPatch_MakeCall((char*) OniExe + 0x00003349, (void*) DD_SetCursorPos); | 
 
 
 
 
 | 534 |  | 
 
 
 
 
 | 535 | // Replace ONrPlatformInitialize. | 
 
 
 
 
 | 536 | DDrPatch_MakeJump((void*) ONrPlatform_Initialize, (void*) DD_ONrPlatform_Initialize); | 
 
 
 
 
 | 537 |  | 
 
 
 
 
 | 538 | // Replace gl_platform_initialize. | 
 
 
 
 
 | 539 | DDrPatch_MakeJump((void*) gl_platform_initialize, (void*) DD_GLrPlatform_Initialize); | 
 
 
 
 
 | 540 |  | 
 
 
 
 
 | 541 | // Replace gl_platform_dispose. | 
 
 
 
 
 | 542 | DDrPatch_MakeJump((void *) gl_platform_dispose, (void*) DD_GLrPlatform_Dispose); | 
 
 
 
 
 | 543 | } | 
 
 
 
 
 | 544 |  | 
 
 
 
 
 | 545 | // Performance patch | 
 
 
 
 
 | 546 | void DD_Patch_UseGetTickCount() | 
 
 
 
 
 | 547 | { | 
 
 
 
 
 | 548 | DDrPatch_MakeJump((void*)UUrMachineTime_High, (void*)DDrMachineTime_High); | 
 
 
 
 
 | 549 | DDrPatch_MakeJump((void*)UUrMachineTime_High_Frequency, (void*)DDrMachineTime_High_Frequency); | 
 
 
 
 
 | 550 | DDrPatch_MakeJump((void*)UUrMachineTime_Sixtieths, (void*)DDrMachineTime_Sixtieths); | 
 
 
 
 
 | 551 | } | 
 
 
 
 
 | 552 |  | 
 
 
 
 
 | 553 | // Adds working function for existing BSL command wp_fadetime, sets fade time to 4800 | 
 
 
 
 
 | 554 | void DD_Patch_WpFadetime() | 
 
 
 
 
 | 555 | { | 
 
 
 
 
 | 556 | // Makes wp_fadetime actually have a function | 
 
 
 
 
 | 557 | const unsigned char fadetime_patch[] = { 0x66, 0x8B, 0x1D, 0xC4, 0x7D, 0x62, 0x00, 0x66, 0x89, 0x5E, 0x46, 0x5B, 0x5E, 0x83, 0xC4, 0x14, 0xC3 }; | 
 
 
 
 
 | 558 | DDrPatch_Const ((char*)(OniExe + 0x0011a889), fadetime_patch); | 
 
 
 
 
 | 559 | DDrPatch_Byte  ((char*)(OniExe + 0x0011a560), 0x31); | 
 
 
 
 
 | 560 |  | 
 
 
 
 
 | 561 | // Sets the fadetime to 4800 by default | 
 
 
 
 
 | 562 | DDrPatch_Int16 ((short*)(OniExe + 0x0011ab0e), 0x12c0); | 
 
 
 
 
 | 563 | } | 
 
 
 
 
 | 564 |  | 
 
 
 
 
 | 565 | // Disable gamma slider in options in windowed mode | 
 
 
 
 
 | 566 | void DD_Patch_GammaSlider() | 
 
 
 
 
 | 567 | { | 
 
 
 
 
 | 568 | DDrPatch_MakeCall((void*)(OniExe + 0x000d262c), (void*)DD_ONiOGU_GammaSlider_SetRange); | 
 
 
 
 
 | 569 | } | 
 
 
 
 
 | 570 |  | 
 
 
 
 
 | 571 | // Fix the warning print method | 
 
 
 
 
 | 572 | void DD_Patch_PrintWarning() | 
 
 
 
 
 | 573 | { | 
 
 
 
 
 | 574 | DDrPatch_MakeJump((void*)(OniExe + 0x000245A0), (void*)DDrPrintWarning); | 
 
 
 
 
 | 575 | } | 
 
 
 
 
 | 576 |  | 
 
 
 
 
 | 577 | //Fix crappy ai2_shownames | 
 
 
 
 
 | 578 | void DD_Patch_ShowNames() | 
 
 
 
 
 | 579 | { | 
 
 
 
 
 | 580 | //Set distance above head to 4.0 | 
 
 
 
 
 | 581 | DDrPatch_Int32((int*)(OniExe + 0x0008C998), 0x005296C8); | 
 
 
 
 
 | 582 | //texture height | 
 
 
 
 
 | 583 | DDrPatch_Byte((char*)(OniExe + 0x0008C9DF), 0x3F ); | 
 
 
 
 
 | 584 | //texture       width | 
 
 
 
 
 | 585 | DDrPatch_NOOP((char*)(OniExe + 0x0008C9CA), 6 ); | 
 
 
 
 
 | 586 |  | 
 
 
 
 
 | 587 | /* | 
 
 
 
 
 | 588 | // Crashes game. | 
 
 
 
 
 | 589 | //Set the text color to whatever we like ;) | 
 
 
 
 
 | 590 | DDrPatch_NOOP((char*)(OniExe + 0x0008C898), 6 ); | 
 
 
 
 
 | 591 | DDrPatch_Byte((char*)(OniExe + 0x0008C898), 0x8B ); | 
 
 
 
 
 | 592 | DDrPatch_Byte((char*)(OniExe + 0x0008C899), 0xCE ); | 
 
 
 
 
 | 593 |  | 
 
 
 
 
 | 594 | DDrPatch_MakeCall((void*)(OniExe + 0x0008C8A3), DD_Patch_DebugNameShadeHack); | 
 
 
 
 
 | 595 |  | 
 
 
 
 
 | 596 | //Make the background black for additive blending | 
 
 
 
 
 | 597 | DDrPatch_MakeCall((void*)(OniExe + 0x0008C802), DD_Patch_DebugNameTextureInit ); | 
 
 
 
 
 | 598 | */ | 
 
 
 
 
 | 599 | } | 
 
 
 
 
 | 600 |  | 
 
 
 
 
 | 601 | /* | 
 
 
 
 
 | 602 | void DD_Patch_ShowTriggerVolumes() | 
 
 
 
 
 | 603 | { | 
 
 
 
 
 | 604 | DDrPatch_Int32((int*)(OniExe + 0x000cc9bb+4), (uint32_t)DD_OBJiTriggerVolume_Draw); | 
 
 
 
 
 | 605 | } | 
 
 
 
 
 | 606 |  | 
 
 
 
 
 | 607 | void DD_Patch_ShowFlags() | 
 
 
 
 
 | 608 | { | 
 
 
 
 
 | 609 | DDrPatch_Int32((int*)(OniExe + 0x000c4ed4+4), (uint32_t)DD_OBJiFlag_Draw); | 
 
 
 
 
 | 610 | } | 
 
 
 
 
 | 611 | */ | 
 
 
 
 
 | 612 |  | 
 
 
 
 
 | 613 | bool DD_Patch_Init() | 
 
 
 
 
 | 614 | { | 
 
 
 
 
 | 615 | STARTUPMESSAGE("Patching engine", 0); | 
 
 
 
 
 | 616 |  | 
 
 
 
 
 | 617 | if (DDrConfig_GetOptOfType("patches.alttab", C_BOOL)->value.intBoolVal) | 
 
 
 
 
 | 618 | DD_Patch_AltTab(); | 
 
 
 
 
 | 619 |  | 
 
 
 
 
 | 620 | if (DDrConfig_GetOptOfType("patches.argb8888", C_BOOL)->value.intBoolVal) | 
 
 
 
 
 | 621 | DD_Patch_ARGB8888(); | 
 
 
 
 
 | 622 |  | 
 
 
 
 
 | 623 | if (DDrConfig_GetOptOfType("patches.binkplay", C_BOOL)->value.intBoolVal) | 
 
 
 
 
 | 624 | DD_Patch_BinkPlay(); | 
 
 
 
 
 | 625 |  | 
 
 
 
 
 | 626 | if (DDrConfig_GetOptOfType("patches.bsl", C_BOOL)->value.intBoolVal) | 
 
 
 
 
 | 627 | DD_Patch_BSL(); | 
 
 
 
 
 | 628 |  | 
 
 
 
 
 | 629 | if (DDrConfig_GetOptOfType("patches.cheater", C_BOOL)->value.intBoolVal) | 
 
 
 
 
 | 630 | DD_Patch_Cheater(); | 
 
 
 
 
 | 631 |  | 
 
 
 
 
 | 632 | if (DDrConfig_GetOptOfType("patches.cheatsenabled", C_BOOL)->value.intBoolVal) | 
 
 
 
 
 | 633 | DD_Patch_CheatsEnabled(); | 
 
 
 
 
 | 634 |  | 
 
 
 
 
 | 635 | if (DDrConfig_GetOptOfType("patches.cheattable", C_BOOL)->value.intBoolVal) | 
 
 
 
 
 | 636 | DD_Patch_CheatTable(); | 
 
 
 
 
 | 637 |  | 
 
 
 
 
 | 638 | if (DDrConfig_GetOptOfType("patches.chinese", C_BOOL)->value.intBoolVal) | 
 
 
 
 
 | 639 | DD_Patch_Chinese(); | 
 
 
 
 
 | 640 |  | 
 
 
 
 
 | 641 | if (DDrConfig_GetOptOfType("patches.clipcursor", C_BOOL)->value.intBoolVal) | 
 
 
 
 
 | 642 | DD_Patch_ClipCursor(); | 
 
 
 
 
 | 643 |  | 
 
 
 
 
 | 644 | if (DDrConfig_GetOptOfType("patches.cooldowntimer", C_BOOL)->value.intBoolVal) | 
 
 
 
 
 | 645 | DD_Patch_CooldownTimer(); | 
 
 
 
 
 | 646 |  | 
 
 
 
 
 | 647 | if (DDrConfig_GetOptOfType("patches.daodandisplayenum", C_BOOL)->value.intBoolVal) | 
 
 
 
 
 | 648 | DD_Patch_DaodanDisplayEnum(); | 
 
 
 
 
 | 649 |  | 
 
 
 
 
 | 650 | if (DDrConfig_GetOptOfType("patches.directinput", C_BOOL)->value.intBoolVal) | 
 
 
 
 
 | 651 | DD_Patch_DirectInput(); | 
 
 
 
 
 | 652 |  | 
 
 
 
 
 | 653 | if (DDrConfig_GetOptOfType("patches.disablecmdline", C_BOOL)->value.intBoolVal) | 
 
 
 
 
 | 654 | DD_Patch_DisableCmdLine(); | 
 
 
 
 
 | 655 |  | 
 
 
 
 
 | 656 | if (DDrConfig_GetOptOfType("patches.fonttexturecache", C_BOOL)->value.intBoolVal) | 
 
 
 
 
 | 657 | DD_Patch_FontTextureCache(); | 
 
 
 
 
 | 658 |  | 
 
 
 
 
 | 659 | if (DDrConfig_GetOptOfType("patches.getcmdline", C_BOOL)->value.intBoolVal) | 
 
 
 
 
 | 660 | DD_Patch_GetCmdLine(); | 
 
 
 
 
 | 661 |  | 
 
 
 
 
 | 662 | if (DDrConfig_GetOptOfType("patches.hdscreens_lowres", C_BOOL)->value.intBoolVal) | 
 
 
 
 
 | 663 | DD_Patch_HDScreens_LowRes(); | 
 
 
 
 
 | 664 |  | 
 
 
 
 
 | 665 | if (DDrConfig_GetOptOfType("patches.highres_console", C_BOOL)->value.intBoolVal) | 
 
 
 
 
 | 666 | DD_Patch_HighresConsole(); | 
 
 
 
 
 | 667 |  | 
 
 
 
 
 | 668 | if (DDrConfig_GetOptOfType("patches.kickguns", C_BOOL)->value.intBoolVal) | 
 
 
 
 
 | 669 | DD_Patch_KickGuns(); | 
 
 
 
 
 | 670 |  | 
 
 
 
 
 | 671 | //if (patch_killvtune) | 
 
 
 
 
 | 672 | //      DD_Patch_KillVTune(); | 
 
 
 
 
 | 673 |  | 
 
 
 
 
 | 674 | if (DDrConfig_GetOptOfType("patches.largetextures", C_BOOL)->value.intBoolVal) | 
 
 
 
 
 | 675 | DD_Patch_LargeTextures(); | 
 
 
 
 
 | 676 |  | 
 
 
 
 
 | 677 | if (DDrConfig_GetOptOfType("patches.levelplugins", C_BOOL)->value.intBoolVal) | 
 
 
 
 
 | 678 | DD_Patch_LevelPlugins(); | 
 
 
 
 
 | 679 |  | 
 
 
 
 
 | 680 | if (DDrConfig_GetOptOfType("patches.newweap", C_BOOL)->value.intBoolVal) | 
 
 
 
 
 | 681 | DD_Patch_NewWeap(); | 
 
 
 
 
 | 682 |  | 
 
 
 
 
 | 683 | if (DDrConfig_GetOptOfType("patches.nomultibyte", C_BOOL)->value.intBoolVal) | 
 
 
 
 
 | 684 | DD_Patch_NoMultiByte(); | 
 
 
 
 
 | 685 |  | 
 
 
 
 
 | 686 | if (DDrConfig_GetOptOfType("patches.optionsvisible", C_BOOL)->value.intBoolVal) | 
 
 
 
 
 | 687 | DD_Patch_OptionsVisible(); | 
 
 
 
 
 | 688 |  | 
 
 
 
 
 | 689 | if (DDrConfig_GetOptOfType("patches.particledisablebit", C_BOOL)->value.intBoolVal) | 
 
 
 
 
 | 690 | DD_Patch_ParticleDisableBit(); | 
 
 
 
 
 | 691 |  | 
 
 
 
 
 | 692 | if (DDrConfig_GetOptOfType("patches.pathfinding", C_BOOL)->value.intBoolVal) | 
 
 
 
 
 | 693 | DD_Patch_PathFinding(); | 
 
 
 
 
 | 694 |  | 
 
 
 
 
 | 695 | if (DDrConfig_GetOptOfType("patches.projaware", C_BOOL)->value.intBoolVal) | 
 
 
 
 
 | 696 | DD_Patch_ProjAware(); | 
 
 
 
 
 | 697 |  | 
 
 
 
 
 | 698 | if (DDrConfig_GetOptOfType("patches.safeprintf", C_BOOL)->value.intBoolVal) | 
 
 
 
 
 | 699 | DD_Patch_SafePrintf(); | 
 
 
 
 
 | 700 |  | 
 
 
 
 
 | 701 | if (DDrConfig_GetOptOfType("patches.showalllasersights", C_BOOL)->value.intBoolVal) | 
 
 
 
 
 | 702 | DD_Patch_ShowAllLasersights(); | 
 
 
 
 
 | 703 |  | 
 
 
 
 
 | 704 | if (DDrConfig_GetOptOfType("patches.showtriggervolumes", C_BOOL)->value.intBoolVal) | 
 
 
 
 
 | 705 | DD_Patch_ShowTriggerVolumes(); | 
 
 
 
 
 | 706 |  | 
 
 
 
 
 | 707 | if (DDrConfig_GetOptOfType("patches.throwtest", C_BOOL)->value.intBoolVal) | 
 
 
 
 
 | 708 | DD_Patch_Throwtest(); | 
 
 
 
 
 | 709 |  | 
 
 
 
 
 | 710 | if (DDrConfig_GetOptOfType("patches.usedaodangl", C_BOOL)->value.intBoolVal) | 
 
 
 
 
 | 711 | DD_Patch_UseDaodanGL(); | 
 
 
 
 
 | 712 |  | 
 
 
 
 
 | 713 | if (DDrConfig_GetOptOfType("patches.usegettickcount", C_BOOL)->value.intBoolVal) | 
 
 
 
 
 | 714 | DD_Patch_UseGetTickCount(); | 
 
 
 
 
 | 715 |  | 
 
 
 
 
 | 716 | if (DDrConfig_GetOptOfType("patches.wpfadetime", C_BOOL)->value.intBoolVal) | 
 
 
 
 
 | 717 | DD_Patch_WpFadetime(); | 
 
 
 
 
 | 718 |  | 
 
 
 
 
 | 719 |  | 
 
 
 
 
 | 720 | DD_Patch_DaodanInit(); | 
 
 
 
 
 | 721 |  | 
 
 
 
 
 | 722 | DD_Patch_GammaSlider(); | 
 
 
 
 
 | 723 |  | 
 
 
 
 
 | 724 | DD_Patch_PrintWarning(); | 
 
 
 
 
 | 725 |  | 
 
 
 
 
 | 726 | DD_Patch_ShowNames(); | 
 
 
 
 
 | 727 |  | 
 
 
 
 
 | 728 | return true; | 
 
 
 
 
 | 729 | } | 
 
 
 
 
 | 730 |  |