Changeset 677
- Timestamp:
- Mar 3, 2013, 12:46:33 AM (12 years ago)
- Location:
- Daodan/src
- Files:
-
- 7 added
- 11 deleted
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
Daodan/src/BFW_ScriptLang.h
r474 r677 5 5 #include "Daodan.h" 6 6 7 #include <stdint.h>8 #include <stdbool.h>7 //#include <stdint.h> 8 #include "bool.h" 9 9 10 10 typedef enum { … … 33 33 } sl_callinfo; 34 34 35 typedef uint16_t (ONICALL *sl_func)(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret);36 35 37 uint16_t ONICALL SLrScript_Command_Register_ReturnType(char* name, char* desc, char* argfmt, sl_type type, sl_func callback); 38 uint16_t ONICALL SLrScript_Command_Register_Void(char* name, char* desc, char* argfmt, sl_func callback); 39 uint16_t ONICALL SLrGlobalVariable_Register_Int32(char* name, char* desc, int32_t* data); 40 uint16_t ONICALL SLrGlobalVariable_Register_Float(char* name, char* desc, float* data); 41 uint16_t ONICALL SLrGlobalVariable_Register_Bool(char* name, char* desc, uint32_t* data); 42 uint16_t ONICALL SLrGlobalVariable_Register_String(char* name, char* desc, char* data); 36 37 43 38 44 39 #endif -
Daodan/src/BFW_Utility.h
r484 r677 4 4 5 5 #include <stdio.h> 6 #include <stdint.h>6 //#include <stdint.h> 7 7 #include "Daodan.h" 8 8 9 void __cdecl UUrStartupMessage(const char* fmt, ...); 10 int64_t ONICALL UUrMachineTime_High(); 11 double ONICALL UUrMachineTime_High_Frequency(); 12 int64_t ONICALL UUrMachineTime_Sixtieths(); 13 void ONICALL UUrPlatform_Initialize(); 14 void ONICALL UUrPlatform_Terminate(); 9 //void __cdecl UUrStartupMessage(const char* fmt, ...); 15 10 16 11 typedef struct { … … 23 18 24 19 void* TestContext; 25 void ONICALL COrTextArea_Print(uint32_t area, uint32_t priority, uint32_t textshade, uint32_t textshadowshade, const char* text, uint32_t unk_alwaws_0, uint32_t fadetime);26 int ONICALL COrMessage_Print(char* Message, char* Key, void* noidea); 20 //void ONICALL COrTextArea_Print(uint32_t area, uint32_t priority, uint32_t textshade, uint32_t textshadowshade, const char* text, uint32_t unk_alwaws_0, uint32_t fadetime); 21 27 22 void ONICALL COrMessage_Remove(char* Key); 28 int16_t ONICALL TSrContext_DrawText(uint32_t TSrContext, char* Text, int alpha, uint32_t usuallyzero, OniRectangle* pRect); 29 int16_t ONICALL TSrContext_New( void* FontInstance, int size, int hthsik1,int hthsik2,int hthsik3, void* TSrContext); //int16_t TSrContext_New( TSFF*, size 7, ??? 1, ??? 1, ??? 0, TSrContext*); 30 int16_t ONICALL TMrInstance_GetDataPtr(int, char*, void*); //int TMrInstance_GetDataPtr( Type 'TSFF', char* "Tahoma", ptr); 31 char* ONICALL TMrInstance_GetInstanceName(void* InstancePointer); 32 int __cdecl AUrMessageBox(int Buttons, char *Message, ...); 23 //int16_t ONICALL TMrInstance_GetDataPtr(int, char*, void*); //int TMrInstance_GetDataPtr( Type 'TSFF', char* "Tahoma", ptr); 24 25 //int __cdecl AUrMessageBox(int Buttons, char *Message, ...); 33 26 34 27 extern uint32_t COgConsoleLines; -
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 -
Daodan/src/Daodan.h
r468 r677 4 4 5 5 #include <windows.h> 6 #include <stdbool.h>6 #include "bool.h" 7 7 8 8 #define ONICALL __fastcall … … 15 15 extern bool opt_topmost; 16 16 17 18 19 17 20 #endif -
Daodan/src/Daodan_BSL.c
r484 r677 1 1 #include <stdio.h> 2 #include <stdbool.h>2 #include "bool.h" 3 3 #include <time.h> 4 #include <ffi.h>4 //#include <ffi.h> 5 5 #include <math.h> 6 6 #include "inifile.h" 7 8 7 #include "Daodan_BSL.h" 9 #include "Flatline_BSL.h"10 8 #include "Daodan_Utility.h" 11 9 #include "Daodan_Patch.h" … … 15 13 #include "Oni_Character.h" 16 14 #include "oni_gl.h" 17 #include "dSFMT\dSFMT.h"18 15 #include "Daodan_Character.h" 19 16 #include "BFW_Utility.h" 20 17 21 18 … … 91 88 } 92 89 93 ret->value_int32 = start + ( dsfmt_gv_genrand_uint32() % (uint32_t)(end - start + 1));90 ret->value_int32 = start + (rand() % (uint32_t)(end - start + 1)); 94 91 ret->type = sl_int32; 95 92 return 0; … … 102 99 else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); 103 100 else index = args[0].value_int32; 104 int* killcount = ONgGameState + index * 0x16A0 + 0x1260 + 0x1670; 105 ret->value_int32 = *killcount; 101 //killcount = ONgGameState->CharacterStorage[index].Kills; 102 //ONgGameState + index * 0x16A0 + 0x1260 + 0x1670; 103 ret->value_int32 = ONgGameState->CharacterStorage[index].Kills; 106 104 ret->type = sl_int32; 107 105 return 0; … … 114 112 else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); 115 113 else index = args[0].value_int32; 116 int* killcount = ONgGameState + index * 0x16A0 + 0x1260 + 0x1674; 117 ret->value_int32 = *killcount; 118 ret->type = sl_int32; 119 return 0; 120 } 121 122 uint16_t ONICALL bsl_returnoffset(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) 123 { 124 //int offset = 140; 125 //if (== 1) offset = 148; 126 //else index = args[0].value_int32; 127 int* killcount = ONgGameState + args[0].value_int32; 128 ret->value_int32 = *killcount; 129 ret->type = sl_int32; 130 return 0; 131 } 114 ret->value_int32 = ONgGameState->CharacterStorage[index].Damage; 115 ret->type = sl_int32; 116 return 0; 117 } 118 132 119 133 120 … … 135 122 { 136 123 int index; 124 void* returnval; 125 bool is_lsi = 0; 126 Character* Chr = ONgGameState->CharacterStorage; 127 137 128 if (numargs < 2 || args[1].type != sl_str32) return 1; 138 129 else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); 139 130 else index = args[0].value_int32; 140 void* returnval; 141 bool is_lsi = 0;142 Character* Chr = ONgGameState + 0x1260; 131 132 133 143 134 if(!strcmp(args[1].value_str32,"ammo")) 144 135 { 145 returnval = &(Chr[index].Inventory _.AmmoUsed);136 returnval = &(Chr[index].Inventory.AmmoUsed); 146 137 } 147 138 else if(!strcmp(args[1].value_str32,"hypo")) 148 139 { 149 returnval = &(Chr[index].Inventory _.HypoUsed);140 returnval = &(Chr[index].Inventory.HypoUsed); 150 141 } 151 142 else if(!strcmp(args[1].value_str32,"cells")) 152 143 { 153 returnval = &(Chr[index].Inventory _.CellsUsed);144 returnval = &(Chr[index].Inventory.CellsUsed); 154 145 } 155 146 else if(!strcmp(args[1].value_str32,"invis")) 156 147 { 157 returnval = &(Chr[index].Inventory _.CloakUsed);148 returnval = &(Chr[index].Inventory.CloakUsed); 158 149 } 159 150 else if(!strcmp(args[1].value_str32,"shield")) 160 151 { 161 returnval = &(Chr[index].Inventory _.ShieldUsed);152 returnval = &(Chr[index].Inventory.ShieldUsed); 162 153 } 163 154 else if(!strcmp(args[1].value_str32,"lsi")) 164 155 { 165 returnval = &(Chr[index].Inventory _.hasLSI);156 returnval = &(Chr[index].Inventory.hasLSI); 166 157 is_lsi = 1; 167 158 } … … 196 187 { 197 188 int index; 189 Character* Chr; 190 int* health; 198 191 if (numargs == 0) index = 0; 199 192 else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); 200 193 else index = args[0].value_int32; 201 Ch aracter* Chr = ONgGameState + 0x1260;202 int*health = &Chr[index].Health;194 Chr = ONgGameState->CharacterStorage; 195 health = &Chr[index].Health; 203 196 204 197 ret->value_int32 = *health; 205 198 ret->type = sl_int32; 206 199 207 if ( numargs >=2) {200 if (args[1].value_int32) { 208 201 *health = args[1].value_int32; 209 202 } … … 216 209 { 217 210 int index; 211 Character* Chr; 218 212 if (numargs == 0) index = 0; 219 213 else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); 220 214 else index = args[0].value_int32; 221 Ch aracter* Chr = ONgGameState + 0x1260;222 int* health = (int*)Chr[index].ScriptNoPath;215 Chr = ONgGameState->CharacterStorage ; 216 223 217 224 218 /* … … 233 227 DDrConsole_PrintF("NoPath %s", Chr[index].ScriptNoPath); 234 228 */ 235 ret->value_int32 = *health;229 ret->value_int32 = Chr[index].RegenHax; 236 230 ret->type = sl_int32; 237 231 238 232 if (numargs >= 2) { 239 *health = args[1].value_int32; 240 } 241 return 0; 242 } 243 233 Chr[index].RegenHax = args[1].value_int32; 234 } 235 return 0; 236 } 237 238 //wow this is broken. 244 239 uint16_t ONICALL bsl_distance(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) { 245 246 if (numargs < 2) return 1;247 240 int index; 248 241 int index2; 242 Character* Chr = ONgGameState->CharacterStorage; 243 Character* Char1; 244 Character* Char2; 245 246 if (numargs < 2) return 1; 247 249 248 if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); 250 249 else index = args[0].value_int32; … … 254 253 else index2 = args[1].value_int32; 255 254 if (index2 == -1) index2 = args[1].value_int32; 256 257 Character* Chr = ONgGameState + 0x1260; 258 Character* Char1 = &Chr[index]; 259 Character* Char2 = &Chr[index2]; 255 Char1 = &Chr[index]; 256 Char2 = &Chr[index2]; 257 260 258 261 259 ret->value_float = sqrt( pow((Char1->Location.X - Char2->Location.X), 2) + pow((Char1->Location.Y - Char2->Location.Y), 2) + pow((Char1->Location.Z - Char2->Location.Z),2)); … … 264 262 } 265 263 uint16_t ONICALL bsl_location(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) { 266 int index; 264 int index, i; 265 float* loc; 266 Character* Chr; 267 numargs = 0; 268 for(i = 0; args[i].type < sl_void; i++) 269 { 270 numargs++; 271 } 272 273 267 274 if (numargs < 2) return 1; 268 275 if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); 269 276 else index = args[0].value_int32; 270 277 if (index == -1) index = args[0].value_int32; 271 Character* Chr = ONgGameState + 0x1260; 272 float* loc; 273 if (!strcmp(args[1].value_str32,"X") || !strcmp(args[1].value_str32,"x")) 274 loc = &(Chr[index].Position.X); 275 else if (!strcmp(args[1].value_str32,"Y") || !strcmp(args[1].value_str32,"y")) 276 loc = &(Chr[index].Position.Y); 277 else if (!strcmp(args[1].value_str32,"Z") || !strcmp(args[1].value_str32,"z")) 278 loc = &(Chr[index].Position.Z); 278 Chr = ONgGameState->CharacterStorage; 279 if(numargs == 3) 280 { 281 if (!strcmp(args[1].value_str32,"X") || !strcmp(args[1].value_str32,"x")) 282 loc = &(Chr[index].Position.X); 283 else if (!strcmp(args[1].value_str32,"Y") || !strcmp(args[1].value_str32,"y")) 284 loc = &(Chr[index].Position.Y); 285 else if (!strcmp(args[1].value_str32,"Z") || !strcmp(args[1].value_str32,"z")) 286 loc = &(Chr[index].Position.Z); 287 } 279 288 else if (numargs == 4) { 280 //currently broken. crashes oni. 281 Chr[index].Position.X = args[1].value_float; 282 Chr[index].Position.Y = args[2].value_float; 283 Chr[index].Position.Z = args[3].value_float; 289 ActiveCharacter* Active = (ActiveCharacter*)ONrGetActiveCharacter(&Chr[index]); 290 Chr[index].Location.X = args[1].value_float; 291 Chr[index].Location.Y = args[2].value_float; 292 Chr[index].Location.Z = args[3].value_float; 293 if(Active) 294 { 295 Active->PhyContext->Position = Chr[index].Location; 296 } 284 297 ret->value_float = 1; 285 298 ret->type = sl_float; … … 304 317 else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); 305 318 else index = args[0].value_int32; 306 Character* Chr = ONgGameState + 0x1260 ; 319 if(1) { 320 Character* Chr = ONgGameState->CharacterStorage ; 307 321 int* maxhealth = &Chr[index].MaxHealth; 308 322 int oldmaxhealth = Chr[index].MaxHealth; … … 317 331 ret->type = sl_int32; 318 332 return 0; 333 } 319 334 } 320 335 … … 327 342 else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); 328 343 else index = args[0].value_int32; 329 330 Character* Chr = ONgGameState + 0x1260;344 if(1) { 345 Character* Chr = ONgGameState->CharacterStorage; 331 346 ActiveCharacter* Active = (ActiveCharacter*)ONrGetActiveCharacter(&Chr[index]); 332 if ( (int)Active == 0) return 1;347 if (!Active) return 1; 333 348 // ret->value_int32 = Active->LastDamageSourceCharacter; 334 349 ret->type = sl_int32; 335 350 return 0; 351 } 336 352 } 337 353 … … 341 357 { 342 358 int index; 359 char* name; 360 343 361 if (numargs == 0) index = 0; 344 362 else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); … … 349 367 return 0; 350 368 } 351 char* name = ONgGameState + 0x1260 + index * 0x16A0 + 0x14;369 name = &ONgGameState->CharacterStorage[index].Name; 352 370 if (numargs == 2) { 353 371 strncpy(name, (char*)args[1].value_str32, 31); … … 374 392 RGBA color; 375 393 RGBA shade; 376 394 int i; 395 numargs = 0; 396 for(i = 0; args[i].type < sl_void; i++) 397 { 398 numargs++; 399 } 377 400 if(numargs == 0) return 0; 378 401 if(numargs > 1 ) color.R = (char)args[1].value_int32; … … 405 428 } 406 429 407 uint16_t ONICALL bsl_getactiveoffset(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret)408 {409 DDrConsole_PrintF("Character: 0x%x",(int)ONgGameState + 0x1260);410 DDrConsole_PrintF("ActiveChar: 0x%x",(int)ONrGetActiveCharacter((void*)((int)ONgGameState + 0x1260)));411 return 0;412 }413 430 typedef struct { 414 431 char Name[16]; … … 463 480 }; 464 481 uint16_t ONICALL bsl_holdkey(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) 465 { 466 int index; 467 468 if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); 469 else index = args[0].value_int32; 470 471 Character* Chr = ONgGameState + 0x1260; 472 ActiveCharacter* Active = (ActiveCharacter*)ONrGetActiveCharacter(&Chr[index]); 473 if ((int)Active == 0) return 1; 474 int i = 2; 475 int j = 0; 482 { 483 uint32_t index; 484 uint32_t i = 2; 485 uint32_t j = 0; 476 486 int Input1 = 0; 477 487 int Input2 = 0; 488 Character* Chr; 489 ActiveCharacter* Active; 490 if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32); 491 else index = args[0].value_int32; 492 493 Chr = &(ONgGameState->CharacterStorage[index]); 494 Active = ONrGetActiveCharacter(Chr); 495 if (!Active) return 1; 496 478 497 for(i = 1; i < numargs - 1; i++) { 479 498 for(j = 0; j < 32; j++) { … … 489 508 } 490 509 Active->Input.Current.Actions1 = Active->Input.Current.Actions1 | Input1; 491 Active->Input.Current.Actions2 = Active->Input.Current.Actions 1| Input2;510 Active->Input.Current.Actions2 = Active->Input.Current.Actions2 | Input2; 492 511 if( Input1 + Input2 == 0 ) { 493 512 DDrConsole_PrintF("Func \"%s\", File \"%s\", Line %d: semantic error, \"%s\": No valid keys given.", callinfo->name, callinfo->calllocation, callinfo->linenumber, callinfo->name); … … 512 531 // else index = args[0].value_int32; 513 532 514 // Character* Chr = ONgGameState + 0x1260;533 // Character* Chr = ONgGameState->CharacterStorage; 515 534 // ActiveCharacter* Active = (ActiveCharacter*)ONrGetActiveCharacter(&Chr[index]); 516 535 // if ((int)Active == 0) return 1; 517 int i = 2;518 int j = 0;536 uint32_t i = 2; 537 uint32_t j = 0; 519 538 int Input1 = 0; 520 539 int Input2 = 0; … … 536 555 ret->value_int32 = 0; 537 556 ret->type = sl_int32; 538 if ( ( (*(int*)(ONgGameState + 0xB8 + 0x10) & Input1) == Input1) && ((*(int*)(ONgGameState + 0xB8 + 0x14) & Input2)== Input2)) ret->value_int32 = 1;557 if ( (ONgGameState->Input.Current.Actions1 == Input1) && (ONgGameState->Input.Current.Actions2 == Input2)) ret->value_int32 = 1; 539 558 return 0; 540 559 } … … 547 566 // else index = args[0].value_int32; 548 567 549 // Character* Chr = ONgGameState + 0x1260;568 // Character* Chr = ONgGameState->CharacterStorage; 550 569 // ActiveCharacter* Active = (ActiveCharacter*)ONrGetActiveCharacter(&Chr[index]); 551 570 // if ((int)Active == 0) return 1; 571 552 572 int i = 2; 553 573 int j = 0; 554 574 int Input1 = 0; 555 575 int Input2 = 0; 556 for(i = 0; i < numargs; i++) { 576 /* 577 numargs = 0; 578 for(i = 0; args[i].type <= sl_void; i++) 579 { 580 //DDrConsole_PrintF("%i", args[i].type ); 581 numargs++; 582 583 } 584 if(numargs < 1 || args[0].value == 0) return; 585 //for(i = 0; i < numargs; i++) { 586 */ 587 i = 0; 557 588 for(j = 0; j < 32; j++) { 558 589 //DDrConsole_PrintF("Testing %s against %s 0x%x", args[i].value_str32, Actions1[j].Name, Actions1[j].Bit); … … 567 598 568 599 } 569 } 570 //DDrConsole_PrintF("Waiting..."); 571 if ( ((*(int*)(ONgGameState + 0xB8 + 0x10) & Input1) == Input1) && ((*(int*)(ONgGameState + 0xB8 + 0x14) & Input2) == Input2)) { 600 // } 601 DDrConsole_PrintF("Waiting..."); 602 if ( 603 (( ONgGameState->Input.Current.Actions1 & Input1) == Input1) && 604 (( ONgGameState->Input.Current.Actions2 & Input2) == Input2) 605 ) 606 { 607 DDrConsole_PrintF("Found key!"); 572 608 } 573 609 else { … … 576 612 *dontuse1 = 1; 577 613 } 578 /* 579 __asm__( 580 "movl 0x10(%esp), %edx\n\t" 581 "movl $1,(%eax)\n\t" 582 ); 583 //ret->type = sl_void 584 */ return 0; 585 } 586 614 return 0; 615 } 616 617 618 uint16_t ONICALL bsl_sprintf(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) 619 { 620 char output[1024]; 621 char buffer[1024]; 622 int i; 623 char* placeinoutput = output; 624 char* placeininput = args[0].value_str32; 625 int formatnum = 0; 626 //fix the broken bsl numargs... 627 numargs = 0; 628 629 for(i = 0; args[i].type < sl_void; i++) 630 { 631 numargs++; 632 } 633 634 635 if (numargs < 1) 636 return 1; 637 638 while(1) 639 { 640 int size; 641 //s is the pointer to the args 642 char* s = strchr(placeininput , '%'); 643 //we didnt find a %, break! 644 if(!s) 645 { 646 strcpy(placeinoutput, placeininput); 647 break; 648 } 649 size = (int)s - (int)placeininput ; 650 //we found one, so copy the portion of string 651 652 653 654 memcpy( placeinoutput,placeininput, size); 655 placeininput += size; 656 placeinoutput += size; 657 658 memset( placeinoutput, '%', (int)pow(2, formatnum)); 659 placeinoutput += (int)pow(2, formatnum); 660 661 662 placeininput += 1; 663 *placeinoutput = 0; 664 formatnum++; 665 666 } 667 //strcpy( output, args[0].value_str32 ); 668 669 for(i = 1; i < numargs; i++) { 670 //sprintf(output, output, args[i].value_str32); 671 memcpy(buffer, output, 1024); 672 if(args[i].value == 0) break; 673 switch(args[i].type) 674 { 675 case sl_bool: 676 case sl_int32: 677 sprintf(output, buffer, args[i].value_int32); 678 break; 679 case sl_float: 680 //crashes oni, why? 681 // sprintf(output, output, args[i].value_float); 682 break; 683 case sl_str32: 684 sprintf(output, buffer, args[i].value_str32); 685 break; 686 case sl_void: 687 default: 688 break; 689 } 690 } 691 //output[32] = 0; 692 ret->value_str32 = output; 693 ret->type = sl_str32; 694 return 0; 695 } 696 697 //Sorry rossy, I broke this. FFI isnt in windows 587 698 /* 588 699 uint16_t ONICALL bsl_sprintf(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) 589 700 { 590 if (numargs < 2) 591 return 1; 592 593 char output[255]; 594 int i; 595 for(i = 1; i < numargs; i++) { 596 sprintf(output, args[0].value_str32, args[i].value_str32); 597 } 598 599 ret->value_str32 = output; 600 ret->type = sl_str32; 601 return 0; 602 } 603 */ 604 uint16_t ONICALL bsl_sprintf(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) 605 { 606 if (numargs < 1 || args[0].type != sl_str32) 607 { 608 DDrConsole_PrintF("Func \"%s\", File \"%s\", Line %d: semantic error, \"%s\": parameter list does not match: format:string arg1 arg2 ...", callinfo->name, callinfo->calllocation, callinfo->linenumber, callinfo->name); 609 return 0; 610 } 611 612 if (!args[0].value_str32) 613 args[0].value_str32 = ""; 614 615 int ffi_ret; 701 702 703 int ffi_ret; 616 704 char* str = NULL; 617 705 int size = 0; … … 620 708 ffi_type* ffi_args[256]; 621 709 void* values[256]; 710 int i; 711 numargs = 0; 712 for(i = 0; args[i].type <= sl_void; i++) 713 { 714 //DDrConsole_PrintF("%i", args[i].type ); 715 numargs++; 716 717 } 718 719 if (numargs < 1 || args[0].type != sl_str32) 720 { 721 DDrConsole_PrintF("Func \"%s\", File \"%s\", Line %d: semantic error, \"%s\": parameter list does not match: format:string arg1 arg2 ...", callinfo->name, callinfo->calllocation, callinfo->linenumber, callinfo->name); 722 return 0; 723 } 724 725 if (!args[0].value_str32) 726 args[0].value_str32 = ""; 727 728 622 729 623 730 ffi_args[0] = &ffi_type_pointer; … … 626 733 values[1] = &size; 627 734 628 int i; 735 629 736 for(i = 2; i < numargs + 2; i ++) 630 737 { … … 647 754 if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, i, &ffi_type_sint32, ffi_args) != FFI_OK) 648 755 return 1; 649 ffi_call(&cif, (void*) snprintf, (void*)&ffi_ret, values);756 ffi_call(&cif, (void*)_snprintf, (void*)&ffi_ret, values); 650 757 str = malloc(ffi_ret + 1); 651 758 size = ffi_ret + 1; 652 ffi_call(&cif, (void*) snprintf, (void*)&ffi_ret, values);759 ffi_call(&cif, (void*)_snprintf, (void*)&ffi_ret, values); 653 760 ret->value_str32 = str; 654 761 ret->type = sl_str32; 655 762 return 0; 656 763 } 657 764 */ 658 765 // Widescreen patch for talking heads. 659 766 uint16_t ONICALL cinematic_start_patch(sl_callinfo* callinfo, unsigned int numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) 660 767 { 661 args[1].value_int32 = (double)args[1].value_int32 / (double)(gl ->DisplayMode.Width) * (4.0 / 3.0 * (double)(gl->DisplayMode.Height));768 args[1].value_int32 = (double)args[1].value_int32 / (double)(gl_eng->DisplayMode.Width) * (4.0 / 3.0 * (double)(gl_eng->DisplayMode.Height)); 662 769 return ((sl_func)(OniExe + 0x000f3830))(callinfo, numargs, args, dontuse1, dontuse2, ret); 663 770 } … … 666 773 bool SLrIniCallback(char* section, bool newsection, char* name, char* value) 667 774 { 668 if (newsection && ! stricmp(section, "bsl"))775 if (newsection && !_stricmp(section, "bsl")) 669 776 ini_inbsl = true; 670 777 671 778 if (ini_inbsl) 672 779 { 780 char* type = value; 673 781 bool isptr = false; 674 782 sl_type bsl_type; … … 680 788 } 681 789 682 char* type = value;790 683 791 684 792 for (; *type; type++) … … 753 861 } 754 862 863 void ONICALL SLrDaodan_Register_ReturnType(char* name, char* desc, char* argfmt, sl_type type, sl_func callback) { 864 char argfmt2[512]; 865 uint16_t errornum; 866 sprintf_s(argfmt2, 512, "%s [|]", argfmt); 867 errornum = SLrScript_Command_Register_ReturnType(name, desc, argfmt2, type, callback); 868 if(errornum) 869 { 870 DDrStartupMessage("Registration of script command %s failed with error %i", name, errornum); 871 } 872 873 } 874 875 void* TSrTest = 0; 876 uint16_t ONICALL new_text(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) 877 { 878 void* TSFFTahoma; 879 int returnval; 880 881 if(!TSrTest){ 882 TMrInstance_GetDataPtr( 'TSFF', "Tahoma", &TSFFTahoma); 883 returnval = TSrContext_New( TSFFTahoma, 7, 1, 1, 0, &TSrTest); 884 } 885 DDrPatch_MakeCall(0x004FBCEA, DDrText_Hook); 886 887 *dontuse2 = 1; 888 return 0; 889 } 890 755 891 void SLrDaodan_Initalize() 756 892 { 757 758 759 //Calculating the value of the needed offset is much more reliable when the compiler does it for you. 760 761 //TODO: fix moonshadow. 762 Character * Chr = 0; 763 char NoPath = (char)(0x100 - (int)(Chr->ScriptNoPath)); 764 const char regen_patch[] = 765 {0x90, 0x90, 0x90, 0x90, 0x90, // mov al, _WPgRegenerationCheat 766 0x90, 0x90, // test al, al 767 0x90, 0x90, // jz short loc_51BB98 768 0x8B, 0x86, NoPath}; 769 DDrPatch_Const(OniExe + 0x0011BB64, regen_patch); 770 771 SLrConfig(); 893 SLrConfig(); 894 895 SLrScript_Command_Register_Void("debug_daodan","Adds text to screen", "", new_text); 772 896 773 897 SLrScript_Command_Register_ReturnType("int32mul", "Multiplies two numbers", "n1:int n2:int", sl_int32, bsl_int32mul); 774 898 SLrScript_Command_Register_ReturnType("mul", "Multiplies two numbers", "[int1:int|float1:float] [int2:int|float2:float]", sl_float, bsl_mul); 775 776 899 SLrScript_Command_Register_ReturnType("int32div", "Divides two numbers", "n1:int n2:int", sl_int32, bsl_int32div); 777 900 SLrScript_Command_Register_ReturnType("div", "Divides two numbers", "[int1:int|float1:float] [int2:int|float2:float]", sl_float, bsl_div); 778 779 dsfmt_gv_init_gen_rand((uint32_t)time(NULL)); 901 srand((uint32_t)time(NULL)); 780 902 SLrScript_Command_Register_ReturnType("int32rand", "Returns a pseudo-random number between two numbers (inclusive).", "start:int end:int", sl_int32, bsl_int32rand); 781 782 SLrScript_Command_Register_ReturnType("d_getkills","Gets the number of kills a character has", "[ai_name:str | script_id:int]", sl_int32, bsl_getkills); 903 SLrScript_Command_Register_ReturnType("d_getkills","Gets the number of kills a character has", "[ai_name:string | script_id:int] [|]", sl_int32, bsl_getkills); 783 904 SLrScript_Command_Register_ReturnType("d_getdamage","Gets the amount of damage a character has caused", "[ai_name:string | script_id:int]", sl_int32, bsl_getdamage); 784 SLrScript_Command_Register_ReturnType("d_name","Gets or sets a character's name", "[ai_name:str | script_id:int] [newname:string]", sl_str32, bsl_chrname);905 SLrScript_Command_Register_ReturnType("d_name","Gets or sets a character's name", "[ai_name:string | script_id:int] [newname:string|]", sl_str32, bsl_chrname); 785 906 SLrScript_Command_Register_ReturnType("d_getindex","Converts a character's name to its index", "ai_name:string", sl_int32, bsl_nametoindex); 786 SLrScript_Command_Register_ReturnType("d_health","Gets or sets a character's health", "[ai_name:str | script_id:int] [newhealth:int]", sl_str32, bsl_health); 787 SLrScript_Command_Register_ReturnType("d_regen","Gets or sets a character's health", "[ai_name:str | script_id:int] [newhealth:int]", sl_str32, bsl_regen); 788 SLrScript_Command_Register_ReturnType("d_maxhealth","Gets or sets a character's maximum health", "[ai_name:str | script_id:int] [newmaxhealth:int] [scalehealth:bool]", sl_str32, bsl_maxhealth); 789 SLrScript_Command_Register_ReturnType("d_powerup","Gets or sets a character's powerups", "ai_name:str|script_id:int powerup:str", sl_int32, bsl_powerup); 790 SLrScript_Command_Register_ReturnType("d_holdkey","Makes a character hold a key", "[ai_name:string | script_id:int] keys frames:int", sl_int32, bsl_holdkey); 791 SLrScript_Command_Register_ReturnType("d_isheld","Checks if player is holding a key", "keys", sl_int32, bsl_isheld); 792 SLrScript_Command_Register_ReturnType("d_location","Returns the X, Y or Z coord of a character", "ai_name:str | script_id:int xyz:string [newlocation:float]", sl_float, bsl_location); 793 SLrScript_Command_Register_ReturnType("d_distance","Returns the distance between two characters", "ai_name:str | script_id:int ai_name:str | script_id:int ", sl_float, bsl_distance); 794 SLrScript_Command_Register_Void("d_waitforkey","Waits for a keypress from the player", "keys", bsl_waitforkey); 907 SLrScript_Command_Register_ReturnType("d_health","Gets or sets a character's health", "[ai_name:string | script_id:int] [newhealth:int]", sl_str32, bsl_health); 908 SLrScript_Command_Register_ReturnType("d_regen","Gets or sets a character's regeneration abilities", "[ai_name:string | script_id:int] [newhealth:int]", sl_str32, bsl_regen); 909 SLrScript_Command_Register_ReturnType("d_maxhealth","Gets or sets a character's maximum health", "[ai_name:string | script_id:int] [newmaxhealth:int] [scalehealth:bool]", sl_str32, bsl_maxhealth); 910 SLrScript_Command_Register_ReturnType("d_powerup","Gets or sets a character's powerups", "[ai_name:string | script_id:int] powerup:string", sl_int32, bsl_powerup); 911 //d_holdkey is broken! 912 SLrScript_Command_Register_ReturnType("d_holdkey","Makes a character hold a key", "[ai_name:string | script_id:int] frames:int keys:string", sl_int32, bsl_holdkey); 913 SLrScript_Command_Register_ReturnType("d_isheld","Checks if player is holding a key", "[ai_name:string | script_id:int] [keys:string]", sl_int32, bsl_isheld); 914 SLrScript_Command_Register_ReturnType("d_location","Returns the X, Y or Z coord of a character", "", sl_float, bsl_location); 915 SLrScript_Command_Register_ReturnType("d_distance","Returns the distance between two characters", "ai_name:string | script_id:int ai_name:string | script_id:int", sl_float, bsl_distance); 916 SLrScript_Command_Register_Void("d_waitforkey","Waits for a keypress from the player", "key:string", bsl_waitforkey); 795 917 796 918 //broken, only works for one damage type. 797 //SLr Script_Command_Register_ReturnType("d_getattacker","Gets the last person to hurt a character", "[ai_name:string | script_id:int]", sl_int32, bsl_getattacker);919 //SLrDaodan_Register_ReturnType("d_getattacker","Gets the last person to hurt a character", "[ai_name:string | script_id:int]", sl_int32, bsl_getattacker); 798 920 799 921 //used for debugging. 800 SLrScript_Command_Register_ReturnType("d_active","Returns a hex offset. ;)", "[ai_name:string | script_id:int]", sl_int32, bsl_getactiveoffset); 801 802 SLrScript_Command_Register_ReturnType("sprintf", "C-style sprintf.", "format:string arg1 arg2 ...", sl_str32, bsl_sprintf); 803 804 SLrScript_Command_Register_ReturnType("st", "prints to console in color", "text:string [color: r b g] [color: r b g]", sl_void, bsl_dprintcolored); 805 806 //Flatline 807 SLrFlatline_Initialize(); 808 922 // SLrDaodan_Register_ReturnType("d_active","Returns a hex offset. ;)", "[ai_name:string | script_id:int]", sl_int32, bsl_getactiveoffset); 923 924 SLrScript_Command_Register_Void("sprintf", "C-style sprintf.", "", bsl_sprintf); 925 SLrScript_Command_Register_ReturnType("st", "prints to console in color", "", sl_void, bsl_dprintcolored); 926 SLrScript_Command_Register_ReturnType("d_dprint", "prints to console in color", "", sl_void, bsl_dprintcolored); 809 927 } 810 928 -
Daodan/src/Daodan_Character.c
r468 r677 19 19 20 20 uint32_t DDrGetCharacterIndexFromName(char* input) { 21 Character **characterlist; //pointer to array of Character pointers22 characterlist = ONgGameState + 0x00167500; //Character List23 int* total_characters = ONgGameState + 0x00167700; //Max number of characters24 21 int i; 25 for(i = 0; i < *total_characters; i++) { 22 Character **characterlist = ONgGameState->PresentCharacterList; //pointer to array of Character pointers 23 int total_characters = ONgGameState->PresentCharacterListCount; //Max number of characters 24 for(i = 0; i < total_characters; i++) { 26 25 if (characterlist[i] != 0) //anti Blam! 27 26 if (!strcmp(characterlist[i]->Name, input)) { //checks for the same name -
Daodan/src/Daodan_Character.h
r446 r677 4 4 5 5 #include "Daodan.h" 6 #include <stdint.h>6 //#include <stdint.h> 7 7 8 8 int DDr_TeamToTeamID(const char* team_string); -
Daodan/src/Daodan_Cheater.c
r476 r677 1 1 #include <string.h> 2 #include <stdbool.h>3 2 #include "bool.h" 3 #include <math.h> 4 4 #include "Oni.h" 5 5 #include "Oni_Character.h" … … 7 7 #include "Daodan.h" 8 8 #include "Daodan_Cheater.h" 9 union MSVC_EVIL_FLOAT_HACK 10 { 11 unsigned __int8 Bytes[4]; 12 float Value; 13 }; 14 static union MSVC_EVIL_FLOAT_HACK INFINITY_HACK = {{0x00, 0x00, 0x80, 0x7F}}; 15 #define INFINITY (INFINITY_HACK.Value) 9 16 10 17 oniCheatCode DDr_CheatTable[] = { … … 76 83 #define ONCC_bodysize_max (0x00000C8C) /* float */ 77 84 78 #define kangaroo_h ( 60)79 #define kangaroo_jp ( 0.06)80 #define marypoppins_jp ( 0.14)85 #define kangaroo_h (short)(60) 86 #define kangaroo_jp (float)(0.06) 87 #define marypoppins_jp (float)(0.14) 81 88 82 89 uint16_t cheat_oldshield = 0; … … 88 95 float cheat_oldheight2 = 135; 89 96 bool inc_fallingframes = true; 90 97 extern bool patch_bsl; 91 98 uint8_t ONICALL DDrCheater(uint32_t cheat) 92 99 { … … 95 102 case cheat_bigbadboss: 96 103 { 97 char* player = *((char**)(ONgGameState + GSA_player)); 98 if (*(unsigned int*)(player + CHR_flags) & chr_bossshield) 99 { 100 *(unsigned int*)(player + CHR_flags) = *(unsigned int*)(player + CHR_flags) & ~chr_bossshield; 101 return 0; 102 } 103 else 104 { 105 *(unsigned int*)(player + CHR_flags) = *(unsigned int*)(player + CHR_flags) | chr_bossshield; 104 GameState* GameState = ONgGameState; 105 106 Character* player = ONgGameState->PlayerCharacter; 107 //char* player = *((char**)(ONgGameState + GSA_player)); 108 if (player->Flags & chr_bossshield) 109 { 110 player->Flags = player->Flags & ~chr_bossshield; 111 return 0; 112 } 113 else 114 { 115 player->Flags = player->Flags | chr_bossshield; 106 116 return 1; 107 117 } … … 109 119 case cheat_bulletproof: 110 120 { 111 char* player = *((char**)(ONgGameState + GSA_player));112 if ( *(unsigned int*)(player + CHR_flags)& chr_weaponimmune)113 { 114 *(unsigned int*)(player + CHR_flags) = *(unsigned int*)(player + CHR_flags)& ~chr_weaponimmune;115 *(unsigned short*)(player + CHR_shield)= cheat_oldshield;116 return 0; 117 } 118 else 119 { 120 *(unsigned int*)(player + CHR_flags) = *(unsigned int*)(player + CHR_flags) |chr_weaponimmune;121 cheat_oldshield = *(unsigned short*)(player + CHR_shield);122 *(unsigned short*)(player + CHR_shield)= 100;121 Character* player = ONgGameState->PlayerCharacter; 122 if (player->Flags & chr_weaponimmune) 123 { 124 player->Flags = player->Flags & ~chr_weaponimmune; 125 player->Inventory.ShieldUsed = cheat_oldshield; 126 return 0; 127 } 128 else 129 { 130 player->Flags |= chr_weaponimmune; 131 cheat_oldshield = player->Inventory.ShieldUsed; 132 player->Inventory.ShieldUsed = 100; 123 133 return 1; 124 134 } … … 126 136 case cheat_kangaroo: 127 137 { 128 char* player = *((char**)(ONgGameState + GSA_player));129 char* oncc = *(char**)(player + CHR_oncc);138 Character* player = ONgGameState->PlayerCharacter; 139 //char* oncc = *(char**)(player + CHR_oncc); 130 140 if (!inc_fallingframes) 131 141 inc_fallingframes = true; 132 if ( *(unsigned int*)(oncc + ONCC_jet_timer)== kangaroo_h)133 { 134 *(float*)(oncc + ONCC_jet_accel)= cheat_oldjet_accel;135 *(unsigned short*)(oncc + ONCC_jet_timer)= cheat_oldjet_timer;136 *(float*)(oncc + ONCC_height1)= cheat_oldheight1;137 *(float*)(oncc + ONCC_height2)= cheat_oldheight2;138 return 0; 139 } 140 else if ( *(unsigned int*)(oncc + ONCC_jet_timer)== 0xFFFF)141 { 142 *(float*)(oncc + ONCC_jet_accel)= kangaroo_jp;143 *(unsigned short*)(oncc + ONCC_jet_timer)= kangaroo_h;144 *(float*)(oncc + ONCC_height1) = 0x7f800000;145 *(float*)(oncc + ONCC_height2) = 0x7f800000;146 return 1; 147 } 148 else 149 { 150 cheat_oldjet_accel = *(float*)(oncc + ONCC_jet_accel);151 cheat_oldjet_timer = *(unsigned short*)(oncc + ONCC_jet_timer);152 cheat_oldheight1 = *(float*)(oncc + ONCC_height1);153 cheat_oldheight2 = *(float*)(oncc + ONCC_height2);154 *(float*)(oncc + ONCC_jet_accel)= kangaroo_jp;155 *(unsigned short*)(oncc + ONCC_jet_timer)= kangaroo_h;156 *(float*)(oncc + ONCC_height1) = 0x7f800000;157 *(float*)(oncc + ONCC_height2) = 0x7f800000;142 if (player->ONCC->JetpackTimer == kangaroo_h) 143 { 144 player->ONCC->JumpAcceleration = cheat_oldjet_accel; 145 player->ONCC->JetpackTimer = cheat_oldjet_timer; 146 player->ONCC->MaxFallingHeightWithoutDamage = cheat_oldheight1; 147 player->ONCC->MaxFallingHeightWithDamage = cheat_oldheight2; 148 return 0; 149 } 150 else if (player->ONCC->JetpackTimer == 0xFFFF) 151 { 152 player->ONCC->JumpAcceleration = kangaroo_jp; 153 player->ONCC->JetpackTimer = kangaroo_h; 154 player->ONCC->MaxFallingHeightWithoutDamage = INFINITY; 155 player->ONCC->MaxFallingHeightWithDamage = INFINITY; 156 return 1; 157 } 158 else 159 { 160 cheat_oldjet_accel = player->ONCC->JumpAcceleration; 161 cheat_oldjet_timer = player->ONCC->JetpackTimer; 162 cheat_oldheight1 = player->ONCC->MaxFallingHeightWithoutDamage ; 163 cheat_oldheight2 = player->ONCC->MaxFallingHeightWithDamage; 164 player->ONCC->JumpAcceleration = kangaroo_jp; 165 player->ONCC->JetpackTimer = kangaroo_h; 166 player->ONCC->MaxFallingHeightWithoutDamage = INFINITY; 167 player->ONCC->MaxFallingHeightWithDamage = INFINITY; 158 168 return 1; 159 169 } … … 161 171 case cheat_marypoppins: 162 172 { 163 char* player = *((char**)(ONgGameState + GSA_player)); 164 char* oncc = *(char**)(player + CHR_oncc); 173 Character* player = ONgGameState->PlayerCharacter; 165 174 if (!inc_fallingframes) 166 175 { 167 176 inc_fallingframes = true; 168 if ( *(unsigned int*)(oncc + ONCC_jet_timer)== 0xFFFF)177 if (player->ONCC->JetpackTimer == 0xFFFF) 169 178 { 170 *(float*)(oncc + ONCC_jet_accel)= cheat_oldjet_accel;171 *(unsigned short*)(oncc + ONCC_jet_timer)= cheat_oldjet_timer;172 *(float*)(oncc + ONCC_height1)= cheat_oldheight1;173 *(float*)(oncc + ONCC_height2)= cheat_oldheight2;179 player->ONCC->JumpAcceleration = cheat_oldjet_accel; 180 player->ONCC->JetpackTimer = cheat_oldjet_timer; 181 player->ONCC->MaxFallingHeightWithoutDamage = cheat_oldheight1; 182 player->ONCC->MaxFallingHeightWithDamage = cheat_oldheight2; 174 183 } 175 184 return 0; 176 185 } 177 else if ( *(unsigned int*)(oncc + ONCC_jet_timer)== kangaroo_h)178 { 179 *(float*)(oncc + ONCC_jet_accel)= marypoppins_jp;180 *(unsigned short*)(oncc + ONCC_jet_timer)= 0xFFFF;181 *(float*)(oncc + ONCC_height1)= 0x7f800000;182 *(float*)(oncc + ONCC_height2)= 0x7f800000;186 else if (player->ONCC->JetpackTimer == kangaroo_h) 187 { 188 player->ONCC->JumpAcceleration = marypoppins_jp; 189 player->ONCC->JetpackTimer = 0xFFFF; 190 player->ONCC->MaxFallingHeightWithoutDamage = 0x7f800000; 191 player->ONCC->MaxFallingHeightWithDamage = 0x7f800000; 183 192 inc_fallingframes = false; 184 193 return 1; … … 186 195 else 187 196 { 188 cheat_oldjet_accel = *(float*)(oncc + ONCC_jet_accel);189 cheat_oldjet_timer = *(unsigned short*)(oncc + ONCC_jet_timer);190 cheat_oldheight1 = *(float*)(oncc + ONCC_height1);191 cheat_oldheight2 = *(float*)(oncc + ONCC_height2);192 *(float*)(oncc + ONCC_jet_accel)= marypoppins_jp;193 *(unsigned short*)(oncc + ONCC_jet_timer)= 0xFFFF;194 *(float*)(oncc + ONCC_height1)= 0x7f800000;195 *(float*)(oncc + ONCC_height2)= 0x7f800000;197 cheat_oldjet_accel = player->ONCC->JumpAcceleration; 198 cheat_oldjet_timer = player->ONCC->JetpackTimer; 199 cheat_oldheight1 = player->ONCC->MaxFallingHeightWithoutDamage; 200 cheat_oldheight2 = player->ONCC->MaxFallingHeightWithDamage ; 201 player->ONCC->JumpAcceleration = marypoppins_jp; 202 player->ONCC->JetpackTimer = 0xFFFF; 203 player->ONCC->MaxFallingHeightWithoutDamage = 0x7f800000; 204 player->ONCC->MaxFallingHeightWithDamage = 0x7f800000; 196 205 inc_fallingframes = false; 197 206 return 1; … … 200 209 case cheat_buddha: 201 210 { 202 char* player = *((char**)(ONgGameState + GSA_player));203 if ( *(unsigned int*)(player + CHR_flags)& chr_unkillable)204 { 205 *(unsigned int*)(player + CHR_flags) = *(unsigned int*)(player + CHR_flags)& ~chr_unkillable;206 return 0; 207 } 208 else 209 { 210 *(unsigned int*)(player + CHR_flags) = *(unsigned int*)(player + CHR_flags)| chr_unkillable;211 Character* player = ONgGameState->PlayerCharacter; 212 if (player->Flags& chr_unkillable) 213 { 214 player->Flags= player->Flags& ~chr_unkillable; 215 return 0; 216 } 217 else 218 { 219 player->Flags= player->Flags| chr_unkillable; 211 220 return 1; 212 221 } … … 214 223 case cheat_shinobi: 215 224 { 216 Character* player = (Character*)*((void**)(ONgGameState + GSA_player));225 Character* player = ONgGameState->PlayerCharacter; 217 226 if (player->MaxHealth == 1) 218 227 { … … 237 246 case cheat_testcheat: 238 247 { 239 char* player = *((char**)(ONgGameState + GSA_player));240 *(unsigned int*)(player + CHR_flags) = *(unsigned int*)(player + CHR_flags)| chr_noncombatant;248 Character* player = ONgGameState->PlayerCharacter; 249 player->Flags = player->Flags | chr_noncombatant; 241 250 return 1; 242 251 } 252 case cheat_elderrune: 253 { 254 if(patch_bsl) { 255 int* Regeneration = &ONgGameState->PlayerCharacter->RegenHax; 256 if(*Regeneration) 257 { 258 *Regeneration = 0; 259 return 0; 260 } 261 else 262 { 263 *Regeneration = 1; 264 return 1; 265 } 266 } 267 else 268 { 269 return ONrCheater(cheat_elderrune); 270 } 271 } 272 243 273 case cheat_tellmetheversion: 244 274 return 1; … … 256 286 257 287 // Biggest hack in the entire thing ^_^ 258 __stdcall voidFallingFrames(void* Ebp)288 void __stdcall FallingFrames(void* Ebp) 259 289 { 260 290 if (inc_fallingframes) 261 ++*((unsigned int*)( Ebp + 0xf6));291 ++*((unsigned int*)((char*)Ebp + 0xf6)); 262 292 } 293 -
Daodan/src/Daodan_Cheater.h
r471 r677 3 3 #define DAODAN_CHEATER_H 4 4 5 #include <stdint.h>5 //#include <stdint.h> 6 6 7 7 typedef struct { … … 46 46 47 47 extern oniCheatCode DDr_CheatTable[]; 48 48 extern int turn_dev_mode_on; 49 49 uint8_t ONICALL DDrCheater(uint32_t cheat); 50 50 void __stdcall FallingFrames(void* Ebp); -
Daodan/src/Daodan_Console.c
r477 r677 1 1 #include <stdlib.h> 2 2 #include <stdarg.h> 3 #include <stdint.h>3 //#include <stdint.h> 4 4 5 5 #include "Daodan_Console.h" 6 6 #include "BFW_Utility.h" 7 #include "Oni_Symbols.h" 7 8 8 9 void DDrConsole_Print(const char* text) … … 20 21 void DDrConsole_PrintF(const char* fmt, ...) 21 22 { 23 char* buffer; 22 24 va_list ap; 23 25 va_start(ap, fmt); 24 char*buffer = malloc(vsnprintf(NULL, 0, fmt, ap) + 1);26 buffer = malloc(vsnprintf(NULL, 0, fmt, ap) + 1); 25 27 26 28 vsprintf(buffer, fmt, ap); … … 33 35 34 36 TStColorFormattingCharacter DDrDSayColors[] = { 35 {'r', 0, 0 , 0xFFEB5050}, //red36 {'y', 0, 0 , 0xFFFCFF1C}, //yellow37 {'b', 0, 0 , 0xFF93BBE9}, //blue38 {'u', 0, 0 , 0xFFF67603}, //umber39 {'g', 0, 0 , 0xFFA2DAA5}, //green40 {'l', 0, 0 , 0xFFBE90D9}, //lilac41 {'o', 0, 0 , 0xFFFBA500}, //orange42 {'c', 0, 0 , 0xFF93EAEB}, //cyan37 {'r', 0, 0xFFEB5050}, //red 38 {'y', 0, 0xFFFCFF1C}, //yellow 39 {'b', 0, 0xFF93BBE9}, //blue 40 {'u', 0, 0xFFF67603}, //umber 41 {'g', 0, 0xFFA2DAA5}, //green 42 {'l', 0, 0xFFBE90D9}, //lilac 43 {'o', 0, 0xFFFBA500}, //orange 44 {'c', 0, 0xFF93EAEB}, //cyan 43 45 //New Colors Here... 44 {'k', 0, 0 , 0xFF000000}, //black45 {'v', 0, 0 , 0xFFEB40EB}, //violet46 {'w', 0, 0 , 0xFFFFFFFF}, //white...47 {'e', 0, 0 , 0xFF505050}, //darkgrey48 {'f', 0, 0 , 0xFFAAAAAA}, //grey46 {'k', 0, 0xFF000000}, //black 47 {'v', 0, 0xFFEB40EB}, //violet 48 {'w', 0, 0xFFFFFFFF}, //white... 49 {'e', 0, 0xFF505050}, //darkgrey 50 {'f', 0, 0xFFAAAAAA}, //grey 49 51 {0} //POWER RANGERS GO! 50 52 }; -
Daodan/src/Daodan_Console.h
r477 r677 3 3 #define DAODAN_CONSOLE_H 4 4 5 #include <stdint.h>5 //#include <stdint.h> 6 6 7 7 #include "Daodan.h" … … 24 24 typedef struct { 25 25 char Char; 26 char ignored; 27 char alsoignored; 26 short ignored; 28 27 int Color; //ARGB Color; 29 28 } TStColorFormattingCharacter; … … 31 30 extern TStColorFormattingCharacter* TStColorFormattingCharacters; 32 31 extern TStColorFormattingCharacter DDrDSayColors[]; 32 33 #ifdef __cplusplus 34 extern "C" 35 #endif 33 36 void DDrConsole_Print(const char* text); 37 38 #ifdef __cplusplus 39 extern "C" 40 #endif 34 41 void DDrConsole_PrintColored(const char* text, int priority, RGBA color, RGBA shade); 42 43 #ifdef __cplusplus 44 extern "C" 45 #endif 35 46 void DDrConsole_PrintF(const char* fmt, ...); 36 47 -
Daodan/src/Daodan_Patch.c
r351 r677 10 10 if (VirtualProtect(from, 5, PAGE_EXECUTE_READWRITE, &oldp)) 11 11 { 12 *(char*)from++ = 0xe9; // jmp rel32 12 *((char*)from) = 0xe9; // jmp rel32 13 from = (char*)from + 1; 13 14 *(int*)from = (unsigned int)to - (unsigned int)from - 4; 14 15 VirtualProtect(from, 5, oldp, &oldp); … … 25 26 if (VirtualProtect(from, 5, PAGE_EXECUTE_READWRITE, &oldp)) 26 27 { 27 *(char*)from++ = 0xe8; // call rel32 28 *((char*)from) = 0xe8; // call rel32 29 from = (char*)from + 1; 28 30 *(int*)from = (unsigned int)to - (unsigned int)from - 4; 29 31 VirtualProtect(from, 5, oldp, &oldp); … … 90 92 } 91 93 92 bool DDrPatch_ StrDup(int* dest, const char* value)94 bool DDrPatch__strdup(int* dest, const char* value) 93 95 { 94 96 DWORD oldp; … … 96 98 if (VirtualProtect(dest, 4, PAGE_EXECUTE_READWRITE, &oldp)) 97 99 { 98 *dest = (int) strdup(value);100 *dest = (int)_strdup(value); 99 101 VirtualProtect(dest, 4, oldp, &oldp); 100 102 return true; -
Daodan/src/Daodan_Patch.h
r351 r677 3 3 #define DAODAN_PATCH_H 4 4 5 #include <stdbool.h>5 #include "bool.h" 6 6 7 7 #define DDrPatch_Const(d, c) DDrPatch_String(d, c, sizeof(c)) 8 8 9 #define OniExe (( void*)0x00400000)9 #define OniExe ((char*)0x00400000) 10 10 11 11 bool DDrPatch_MakeJump(void* from, void* to); … … 15 15 bool DDrPatch_Int32(int* dest, int value); 16 16 bool DDrPatch_Int16(short* dest, short value); 17 bool DDrPatch_ StrDup(int* dest, const char* value);17 bool DDrPatch__strdup(int* dest, const char* value); 18 18 bool DDrPatch_NOOP(char* dest, unsigned int length); 19 19 -
Daodan/src/Daodan_Persistence.h
r339 r677 3 3 #define DAODAN_PERSISTENCE_H 4 4 5 #include <stdint.h>5 //#include <stdint.h> 6 6 7 7 #include "Daodan.h" -
Daodan/src/Daodan_Utility.c
r476 r677 2 2 #include <stdlib.h> 3 3 #include <stdarg.h> 4 #include <stdint.h>4 //#include <stdint.h> 5 5 #include "oni_stdio.h" 6 6 … … 13 13 void __cdecl DDrStartupMessage(const char* fmt, ...) 14 14 { 15 16 char* buffer; 15 17 va_list ap; 16 18 va_start(ap, fmt); 17 char* buffer = malloc(vsnprintf(NULL, 0, fmt, ap) + 1); 19 20 buffer = malloc(vsnprintf(NULL, 0, fmt, ap) + 1); 18 21 19 22 vsprintf(buffer, fmt, ap); … … 85 88 } 86 89 87 void ONICALL DDrWeapon2Message(int* weapon, void* output_ptr) { 90 void ONICALL DDrWeapon2Message(int* weapon, void* output_ptr) 91 { 88 92 char buffer[128] = {0}; 89 93 char* weapon_string = (char*)(*(weapon + 1)+0x5C); … … 91 95 int16_t maxammo = *(int16_t *)(*(weapon + 1)+0xC0); 92 96 float ratio = (float)ammo / (float)maxammo; 93 char ammocolor = ' '; 94 if(ratio >= .9) ammocolor = 'g'; 95 else if (ratio >= .5) ammocolor = 'y'; 96 else if (ratio >= .2) ammocolor = 'o'; 97 else ammocolor = 'r'; 97 98 char ammocolor; 99 if (ratio >= .9) ammocolor = 'g'; 100 else if (ratio >= .5) ammocolor = 'y'; 101 else if (ratio >= .2) ammocolor = 'o'; 102 else ammocolor = 'r'; 103 98 104 DDrMake_Weapon_Message( weapon_string, buffer); //gets the name of the weapon and formats it...probably doesn't need to be in seperate func. 99 sprintf(SSrMessage_Find("autoprompt_weapon"), "%s |[% s.%i/%i]|", buffer, &ammocolor, ammo, maxammo); //copies the new string to ONGS105 sprintf(SSrMessage_Find("autoprompt_weapon"), "%s |[%c.%i/%i]|", buffer, ammocolor, ammo, maxammo); //copies the new string to ONGS 100 106 ONiGameState_FindAutoPromptMessage("weapon", output_ptr); //does what the code i replaced does. Basically tells the game to show the msg. 101 107 } 102 108 103 109 104 void ONICALL DDrMake_Weapon_Message(char* weapon_string, char* output_ptr) { 110 void ONICALL DDrMake_Weapon_Message(char* weapon_string, char* output_ptr) 111 { 105 112 char* weapon_msg = NULL; //The normal "You have recieved X" message. 106 113 char weapon_name[64] = {'\0'}; //The stripped weapon name … … 112 119 //this probably could be reorganized 113 120 if(weapon_msg) { //SSrMsgblah returns NULL if it can't find the message key 114 memcpy(weapon_name, weapon_msg, (strstr(weapon_msg," received.") - weapon_msg)); //strips uneeded characters121 memcpy(weapon_name, weapon_msg, (strstr(weapon_msg,"] ") - weapon_msg + 1)); //strips uneeded characters 115 122 sprintf(output_ptr, "Press [c.Q] to pick up %s", weapon_name); 116 123 } … … 120 127 121 128 } 129 130 typedef struct 131 { 132 uint16_t x; 133 uint16_t y; 134 135 } IMtPoint2D; 136 IMtPoint2D Point = {256, 250}; 137 extern void* TSrTest; 138 extern void* TSrScores; 139 unsigned int lastPasteTime; 140 141 //TODO: Fix what happens when you hold down paste 142 //Check if console is open 143 void DDrPasteHack() 144 { 145 COtTextArea* cons = *(COtTextArea**)0x00571B74; 146 char* clipboardText = 0; 147 if(ONgGameState->Input.Current.Actions1 & Action_Console && GetKeyState(0x56) & 0x80 && GetKeyState(VK_CONTROL) & 0x80 ) 148 { 149 if(cons && cons->text_entries && cons->num_text_entries) 150 { 151 //why abs()? so we dont have to reset the timer after a level load. 152 if( abs(ONgGameState->GameTime - lastPasteTime) > 60) { 153 //DDrConsole_Print(cons->text_entries[0].text); 154 if(OpenClipboard(ONgPlatformData.Window)) 155 { 156 unsigned short charsUsed = strlen(cons->text_entries[0].text); 157 //get rid of the v character 158 if(charsUsed) charsUsed--; 159 clipboardText = GetClipboardData(CF_TEXT); 160 if(clipboardText && strlen(clipboardText) + charsUsed < 502) 161 { 162 strcpy_s( cons->text_entries[0].text + charsUsed, 502 - charsUsed - 1, clipboardText); 163 lastPasteTime = ONgGameState->GameTime; 164 } 165 CloseClipboard(); 166 } 167 168 } 169 else 170 { 171 //need to hook whatever controls however often you can repeat characters...i guess. 172 //cons->text_entries[0].text[strlen(cons->text_entries[0].text) - 1] = 0; 173 } 174 } 175 } 176 } 177 178 void ONICALL DDrText_Hook() 179 { 180 181 if(TSrTest) 182 { 183 TSrContext_DrawText(TSrTest, "FINALLY THIS BLOODY TEXT THING WORKS\n Gotta call it at the right point...", 128, 0, &Point); 184 185 } 186 187 188 DDrPasteHack(); 189 190 COrConsole_StatusLine_Display(); 191 192 } -
Daodan/src/Daodan_Utility.h
r476 r677 3 3 #define DAODAN_UTILITY_H 4 4 5 #include <stdint.h>5 //#include <stdint.h> 6 6 #include "Daodan.h" 7 7 8 #ifdef __cplusplus 9 extern "C" 10 #endif 8 11 void __cdecl DDrStartupMessage(const char* fmt, ...); 9 12 int64_t ONICALL DDrMachineTime_High(); … … 12 15 void ONICALL DDrMake_Weapon_Message(char* weapon_string, char* output_ptr); 13 16 void ONICALL DDrWeapon2Message(int* weapon, void* output_ptr); 17 void ONICALL DDrText_Hook(); 14 18 #endif -
Daodan/src/Daodan_Win32.c
r492 r677 7 7 8 8 #include "Oni.h" 9 9 extern HWND onihwnd; 10 10 short ONICALL DDrPlatform_Initialize(ONtPlatformData *PlatformData) 11 11 { … … 13 13 RECT Rect; 14 14 const int Width = 640, Height = 480; 15 HINSTANCE temp_Instance = PlatformData->Instance; 15 16 16 17 PlatformData->Instance = g_Instance; … … 22 23 WndClass.hInstance = PlatformData->Instance; 23 24 WndClass.hCursor = LoadCursor(NULL, IDC_ARROW); 24 WndClass.hIcon = LoadIcon( NULL, IDI_APPLICATION);25 WndClass.hIconSm = LoadIcon( NULL, IDI_APPLICATION);25 WndClass.hIcon = LoadIcon(g_Instance, MAKEINTRESOURCE(103) ); 26 WndClass.hIconSm = LoadIcon(g_Instance, MAKEINTRESOURCE(103)); 26 27 WndClass.hbrBackground = GetStockObject(BLACK_BRUSH); 27 28 WndClass.lpszMenuName = NULL; … … 36 37 Rect.bottom = Rect.top + Height; 37 38 AdjustWindowRect(&Rect, WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_POPUP | WS_TILEDWINDOW , FALSE); 38 PlatformData->Window = CreateWindowEx(0, "ONI ", "ONI ", WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_POPUP | WS_TILEDWINDOW, Rect.left, Rect.top, Rect.right - Rect.left, Rect.bottom - Rect.top, NULL, NULL, PlatformData->Instance, NULL);39 39 PlatformData->Window = CreateWindowEx(0, "ONI ", "ONI ", WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_POPUP | WS_TILEDWINDOW, Rect.left, Rect.top, Rect.right - Rect.left, Rect.bottom - Rect.top, NULL, NULL, PlatformData->Instance, NULL); 40 onihwnd = PlatformData->Window; 40 41 ShowWindow(PlatformData->Window, SW_SHOWNORMAL); 41 42 UpdateWindow(PlatformData->Window); … … 45 46 // I dont know why this is needed but Oni doesn't init without it. 46 47 ONgPlatformData.Window = PlatformData->Window; 47 //ONgPlatformData.Instance = PlatformData->Instance;48 ONgPlatformData.Instance = PlatformData->Instance; 48 49 49 50 return 0; -
Daodan/src/Daodan_WindowHack.c
r468 r677 61 61 { 62 62 MSG Msg; 63 63 RECT re; 64 64 WNDCLASSEX wc; 65 65 … … 78 78 RegisterClassEx(&wc); 79 79 80 RECT re;80 81 81 re.left = (GetSystemMetrics(SM_CXSCREEN) / 2) - (640 / 2); 82 82 re.top = (GetSystemMetrics(SM_CYSCREEN) / 2) - (480 / 2); … … 109 109 BOOL WINAPI glpi_SetWindowPosHook(HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags) 110 110 { 111 RECT re; 111 112 SetWindowLong(onihwnd, GWL_STYLE, WS_CHILD | WS_VISIBLE); 112 113 SetCursor(LoadCursor(NULL, IDC_ARROW)); 113 114 114 RECT re;115 115 116 re.left = (GetSystemMetrics(SM_CXSCREEN) / 2) - (cx / 2); 116 117 re.top = (GetSystemMetrics(SM_CYSCREEN) / 2) - (cy / 2); … … 129 130 if (GetAsyncKeyState(VK_F4) || dragging) 130 131 { 131 lpPoint->x = gl ->DisplayMode.Width / 2;132 lpPoint->y = gl ->DisplayMode.Height / 2;132 lpPoint->x = gl_eng->DisplayMode.Width / 2; 133 lpPoint->y = gl_eng->DisplayMode.Height / 2; 133 134 } 134 135 else -
Daodan/src/Daodan_WindowHack.h
r349 r677 4 4 5 5 void DDrWindowHack_Install(); 6 BOOL WINAPI LIiP_GetCursorPosHook(LPPOINT lpPoint); 7 BOOL WINAPI LIiP_SetCursorPosHook(int X, int Y); 6 8 7 9 #endif -
Daodan/src/Oni.h
r484 r677 4 4 5 5 #include "Daodan.h" 6 7 #include <stdint.h>6 #include "oni_gl.h" 7 //#include <stdint.h> 8 8 #include <windows.h> 9 9 #include "Oni_GameState.h" 10 10 typedef unsigned char onibool; 11 11 … … 15 15 HWND Window; 16 16 } ONtPlatformData; 17 17 /* 18 18 void __cdecl ONiMain(int ArgCount, char *ArgList[]); 19 19 short ONICALL ONrPlatform_Initialize(ONtPlatformData *PlatformData); 20 20 LRESULT CALLBACK ONrPlatform_WindowProc(HWND Window, UINT Message, WPARAM WParam, LPARAM LParam); 21 */ 22 //uint8_t ONICALL ONrCheater(uint32_t cheat); 21 23 22 uint8_t ONICALL ONrCheater(uint32_t cheat); 23 24 char* ONICALL SSrMessage_Find(char* message_key); //Returns a prompt message from a message key 25 void ONICALL ONiGameState_FindAutoPromptMessage(char* Note, void* ptr); 24 //char* ONICALL SSrMessage_Find(char* message_key); //Returns a prompt message from a message key 25 //void ONICALL ONiGameState_FindAutoPromptMessage(char* Note, void* ptr); 26 26 27 27 // 28 28 void ONICALL TMrInstance_GetDataPtr_List( 29 char Tag[4], 30 int MaxCount, 29 char Tag[4], //as in 'ONWC' 30 int MaxCount, //# of elements in PointerList 31 31 void** PointerList, //Where the found pointers go 32 32 int* FoundCount //Where the number of pointers found go. 33 33 ); 34 34 35 extern HINSTANCE g_Instance; 36 extern ONtPlatformData ONgPlatformData; 37 38 extern void* ONgGameState; 39 extern onibool ai2_deaf; 40 41 extern char M3gResolutionSwitch; 42 43 extern char opt_sound; 44 extern uint32_t opt_ignore_private_data; 45 46 extern char AKgDebug_DebugMaps; 47 extern char BFgDebugFileEnable; 48 extern char SSgSearchOnDisk; 49 50 35 #include "Oni_Symbols.h" 51 36 52 37 #endif -
Daodan/src/Oni_Character.h
r484 r677 3 3 #define ONI_CHARACTER_H 4 4 5 #include "Oni.h" 6 #include <stdint.h> 7 #include <stdbool.h> 8 9 typedef struct { 10 float X; 11 float Y; 12 float Z; 13 } Vector3; //probably move to utilities... 14 15 typedef struct { 16 float X; 17 float Y; 18 float Z; 19 float W; 20 } Quaternion; 21 22 typedef struct { 23 float RotationScale[9]; 24 Vector3 Translation; 25 } Matrix4x3; 26 27 typedef struct { 28 Vector3 Center; 29 float Radius; 30 } Sphere; 31 32 typedef struct { 33 Sphere Sphere_; //fix this name 34 int Child1; 35 int Child2; 36 } SphereTreeNode; 37 38 typedef struct { 39 Vector3 Min; 40 Vector3 Max; 41 } BoundingBox; 42 43 44 enum { //action flags 45 Action_Escape = 1, 46 Action_Console = 2, 47 Action_PauseScreen = 4, 48 Action_Cutscene_1 = 8, 49 Action_Cutscene_2 = 0x10, 50 Action_F4 = 0x20, 51 Action_F5 = 0x40, 52 Action_F6 = 0x80, 53 Action_F7 = 0x100, 54 Action_F8 = 0x200, 55 Action_StartRecord = 0x400, 56 Action_StopRecord = 0x800, 57 Action_PlayRecord = 0x1000, 58 Action_F12 = 0x2000, 59 Action_Unknown1 = 0x4000, 60 Action_LookMode = 0x8000, 61 Action_Screenshot = 0x10000, 62 Action_Unknown2 = 0x20000, 63 Action_Unknown3 = 0x40000, 64 Action_Unknown4 = 0x80000, 65 Action_Unknown5 = 0x100000, 66 Action_Forward = 0x200000, 67 Action_Backward = 0x400000, 68 Action_TurnLeft = 0x800000, 69 Action_TurnRight = 0x1000000, 70 Action_StepLeft = 0x2000000, 71 Action_StepRight = 0x4000000, 72 Action_Jump = 0x8000000, 73 Action_Crouch = 0x10000000, 74 Action_Punch = 0x20000000, 75 Action_Kick = 0x40000000, 76 Action_Block = 0x80000000, 77 //used in second action field 78 Action2_Walk = 1, 79 Action2_Action = 2, 80 Action2_Hypo = 4, 81 Action2_Reload = 8, 82 Action2_Swap = 0x10, 83 Action2_Drop = 0x20, 84 Action2_Fire1 = 0x40, 85 Action2_Fire2 = 0x80, 86 Action2_Fire3 = 0x100, 87 }; 88 89 90 typedef struct { 91 int32_t Actions1; 92 int32_t Actions2; 93 } InputAction; 94 95 96 typedef struct { 97 float MouseDeltaX; 98 float MouseDeltaY; 99 float field_8; 100 float field_C; 101 InputAction Current; 102 InputAction Stopped; 103 InputAction Start; 104 InputAction Stop; 105 } GameInput; 106 107 typedef struct { 108 int Type; //'CHAR' etc. 109 int ObjectId; //not needed 110 int Flags; //The flags of the object...not used for CHAR 111 Vector3 Position; //Position of Object 112 Vector3 Rotation; //Rotation of Object 113 int EditorCallbacks; //Lets try not to mess with it for now. :P 114 int field_28; //unknown 115 } OSD_Header; 116 117 typedef struct { 118 int32_t Flags; 119 int32_t Frame; 120 int32_t field_8; 121 int32_t field_C; 122 int32_t field_10; 123 int32_t field_14; 124 int32_t field_18; 125 int32_t field_1C; 126 int32_t FILMInstance; 127 } PlayingFilm; 128 129 typedef enum { 130 chr_isplayer = 1 << 0, 131 chr_randomskin = 1 << 1, 132 chr_notprespawned = 1 << 2, 133 chr_noncombatant = 1 << 3, 134 chr_multispawnable = 1 << 4, 135 chr_unkillable = 1 << 5, 136 chr_superammo = 1 << 6, 137 chr_omniscient = 1 << 8, 138 chr_haslsi = 1 << 9, 139 chr_boss = 1 << 10, 140 chr_upgradedifficulty = 1 << 11, 141 chr_noautodrop = 1 << 12, 142 chr_dontaim = 1 << 13, 143 chr_nocollision = 1 << 17, 144 chr_noshadow = 1 << 24, 145 chr_invincible = 1 << 25, 146 chr_bossshield = 1 << 30, 147 chr_weaponimmune = 1 << 31, 148 } chr_flags; 149 /* 150 enum { 151 chr_isplayer = 0x00000001, //is player character 152 chr_randomskin = 0x00000002, //gets random skin from ONCV 153 chr_notprespawned = 0x00000004, //isn't spawned at level creation 154 chr_noncombatant = 0x00000008, //doesn't fight 155 chr_multispawnable = 0x00000010, //can spawn up to 5 without forcing 156 chr_unknown = 0x00000020, // 157 chr_unkillable = 0x00000040, //can only be brought to 1 hp 158 chr_superammo = 0x00000080, //infinite ammo 159 chr_omniscient = 0x00000100, //touchofdeath 160 chr_haslsi = 0x00000200, //drops an lsi 161 chr_boss = 0x00000400, //is a boss character 162 chr_upgradedifficulty = 0x00000800, //upgrade the difficulty if you play on med\hard 163 chr_noautodrop = 0x00001000, //uses drop fields instead of has fields on death 164 }; // 165 */ 166 167 typedef struct { 168 uint32_t Options; //A bitset. Someone had better define these 169 char Class[64]; //Name of the ONCC we use. ONCCName in idb 170 char Name[32]; //Name of the character. ie: ai2_spawn Muro 171 char Weapon[64]; //Name of the weapon he holds. ONWCName in idb 172 char ScriptSpawn[32]; //Script function called when char spawns 173 char ScriptDie[32]; //Script function called when char dies 174 char ScriptAware[32]; //Script function called when char detects something 175 char ScriptAlarm[32]; //Script function called when char is alarmed at something 176 char ScriptHurt[32]; //Script function called when char is hurt for the first time 177 char ScriptDefeat[32]; //Script function called when char is at 1 HP 178 char ScriptNoPath[32]; //Script function called when char loses path. Broken. 179 char ScriptNoAmmo[32]; //Script function called when char is out of ammo for the first time. Char must have ammo at spawn. 180 int32_t AdditionalHealth; //Additional Health given to the character 181 int16_t AmmoUsed; //Ammo given for the char to use 182 int16_t AmmoDropped; //Ammo the char drops 183 int16_t CellsUsed; //Cells given for the char to use 184 int16_t CellsDropped; //Cells the char drops 185 int16_t HypoUsed; //Hypo given for the char to use 186 int16_t HypoDropped; //Hypo the char drops 187 int16_t ShieldUsed; //Bullet shield given for the char to use 188 int16_t ShieldDropped; //Bullet shield the char drops 189 int16_t CloakUsed; //Phase Cloak given for the char to use 190 int16_t CloakDropped; //Phase Cloak the char drops 191 int16_t NCIUsed; //Don't use this... 192 int16_t NCIDropped; //Don't use this... 193 int32_t TeamID; //Team ID 194 int32_t AmmoPercent; //Percent of weapon ammo full 195 int32_t JobID; //Job ID... 196 //0 - none 197 //1 - idle 198 //2 - guard (never used in Oni) 199 //3 - patrol 200 //4 - teambattle (never used in Oni) 201 int16_t PatrolID; //patrol path ID (reference to the Patrol_Path.BINA file) 202 int16_t CombatID; //combat ID (reference to the Combat.BINA file) 203 int16_t MeleeID; //melee ID (reference to the Melee Profile.BINA file) 204 int16_t NeutralID; //neutral ID (reference to the Neutral.BINA file) 205 int32_t AlarmGroups; //Bitset. http://wiki.oni2.net/CHAR 206 int32_t InitialAlertLevel; //0 - lull, 1 - low, 2 - medium, 3 - high, 4 - combat 207 int32_t MinimalAlertLevel; //0 - lull, 1 - low, 2 - medium, 3 - high, 4 - combat 208 int32_t StartJobAlertLevel; //0 - lull, 1 - low, 2 - medium, 3 - high, 4 - combat 209 int32_t InvestigatingAlertLevel;//0 - lull, 1 - low, 2 - medium, 3 - high, 4 - combat 210 int32_t PursuitStrongLow; 211 int32_t PursuitWeakLow; 212 int32_t PursuitStrongHigh; 213 int32_t PursuitWeakHigh; 214 int32_t Pursuit5; 215 int32_t field_1FC; 216 } CharacterOSD; 217 218 typedef struct { 219 OSD_Header Header; 220 CharacterOSD OSD; 221 } CharacterObject; 222 223 typedef struct { 224 Vector3 Center; 225 float Radius; 226 } BoundingSphere; 227 228 typedef struct { 229 int32_t ONCP; //probably pointer 230 int32_t field_4; //who knows? 231 int32_t Instance; //probably link to actual particle 232 int32_t Bone; //duh 233 } AttachedParticle; 234 235 typedef struct { //Inventory 236 int32_t Weapons[3]; 237 int16_t field_1A0; //10 bucks says this is the current weapon 238 int16_t AmmoUsed; //Ammo given for the char to use 239 int16_t HypoUsed; //Hypo given for the char to use 240 int16_t CellsUsed; //Cells given for the char to use 241 int16_t AmmoDropped; //Ammo the char drops 242 int16_t HypoDropped; //Hypo the char drops 243 int16_t CellsDropped; //Cells the char drops 244 int16_t field_1A; //who knows? InverseHypoRegenRate? 245 int16_t field_1C; 246 int16_t field_1E; 247 char hasLSI; 248 char field_1B5; 249 int16_t field_1B6; 250 int16_t ShieldUsed; //Bullet shield given for the char to use 251 int16_t CloakUsed; //Phase Cloak given for the char to use 252 int32_t field_28; //probably bullet shield dropped 253 int32_t DoorKeys; //Lol. We can use this later for other sorts of items. 254 } Inventory; 255 256 typedef struct { 257 uint32_t SphereTree; 258 Vector3 ObBox[8]; 259 Vector3 * ObBowPtr; 260 Vector3 Velocity; 261 Quaternion field_74; 262 Vector3 Position; 263 Quaternion Rotation; 264 float Scale; 265 Matrix4x3 Matrix; 266 Matrix4x3 InitMatrix; 267 float field_104; 268 float Gravity; 269 float field_10C; 270 float field_110; 271 float Friction_1; 272 float Friction_2; 273 Vector3 Force; 274 uint32_t Flags; 275 uint32_t Type; 276 char AnimState[0x18]; 277 void* Callbacks; 278 void* Owner; 279 } PhyContext; 280 281 typedef struct { //ActiveCharacter 282 int16_t Number; 283 int16_t field_2; //probably Number is an int32 284 PhyContext * PhyContext_; 285 SphereTreeNode SphereTree1; //probably SphereTree[7]... 286 SphereTreeNode SphereTree3[4]; 287 SphereTreeNode SphereTree2[2]; 288 int16_t field_B0; 289 int16_t field_B2; 290 int16_t field_B4; 291 int16_t field_B6; 292 Vector3 field_B8; 293 Vector3 AccelerateWith; 294 int32_t field_D0; 295 Vector3 field_D4; 296 int32_t field_E0; 297 int32_t field_E4; 298 int32_t field_E8; 299 int32_t field_EC; 300 float SomePhyPosY; 301 int16_t field_F4; 302 int16_t IsInAirTimer; 303 Vector3 FallingVelocity; 304 Vector3 JumpVelocity; 305 char StartJumpPending; 306 char field_111; 307 int16_t field_112; 308 Vector3 field_114; 309 int32_t LastDamageSourceCharacter; 310 int32_t field_11C; 311 int32_t field_120; 312 int32_t field_124; 313 int32_t field_128; 314 int32_t field_12C; 315 BoundingSphere BoundingSphere_; //fix this name 316 Vector3 field_140; 317 Vector3 field_14C; 318 int32_t field_158; 319 int32_t field_15C; 320 Vector3 Location; 321 int32_t field_16C[6]; //16C-184 ??? 322 int32_t AkiraNode; 323 int32_t GraphNode; 324 int32_t PelvisHeight; 325 int32_t MovementStatePtr; 326 int32_t ActiveWeapon; //NOTE: FIGURE OUT THIS MESS OF INVENTORY... 327 int32_t field_198; //maybe weap 3, maybe not... 328 int32_t InventoryWeapon; 329 int16_t field_1A0; //unused? 330 int16_t AmmoUsable; //Ammo given for the char to use 331 int16_t HypoUsable; //Hypo given for the char to use 332 int16_t CellsUsable; //Cells given for the char to use 333 int16_t AmmoDropped; //Ammo the char drops 334 int16_t HypoDropped; //Hypo the char drops 335 int16_t CellsDropped; //Cells the char drops 336 int16_t field_1AE; 337 int16_t InverseHypoRegenRate; 338 int16_t ShieldDropped; 339 int16_t CloakDropped; 340 int16_t field_1B4; 341 int16_t field_1B6; 342 int16_t ShieldUsable; 343 int16_t CloakUsable; 344 int16_t field_1BC[9]; //1BC-1E0 345 int32_t NotIdleStartTime; 346 int32_t TimeToIdle; 347 int32_t field_1E8[1315]; //1E8-1648 what the hell is all this? 348 BoundingBox BoundingBox_; //fix this name 349 int32_t field_1660; 350 int32_t field_1664; 351 int32_t ShieldPower; //Same as Boss Shield Power??? 352 int32_t field_166C; 353 int32_t NumberOfKills; //^_^ 354 int32_t InflictedDamage; //^_^ 355 int32_t field_1678[260]; //1678-1A88 more wtf 356 int32_t field_1A88; //here starts animation junk? It was 4 bools in idb O_o 357 int32_t Executor_AimingDirection; //possibly throw junk? 358 int32_t field_1A98; 359 int32_t field_1A9C; 360 int32_t Executor_ActualMovementMode; 361 int32_t field_1AA4; 362 int32_t field_1AA8; 363 int32_t field_1AAC; 364 int32_t Executor_HasFacingOverride; //a bool... 365 float Executor_AimingSpeed; 366 onibool field_1AB8; //actually a bitset... 367 onibool Executor_HasMoveOverride; 368 int16_t field_1ABA; 369 int32_t field_1ABC; 370 int32_t field_1AC0; 371 int32_t field_1AC4; 372 int32_t Executor_FacingOverride; 373 int32_t Executor_HasAttackOverride; //another bool :P 374 int32_t field_1AD0; 375 int32_t field_1AD4; 376 int32_t field_1AD8; 377 int32_t field_1ADC; 378 int32_t field_1AE0; 379 int32_t field_1AE4; 380 int32_t Executor_HasThrowOverride; //another another bool 381 int32_t field_1AEC; 382 int32_t field_1AF0; 383 int32_t field_1AF4; 384 int32_t Animation; 385 int16_t AnimationToState; 386 int16_t AnimationFromState; 387 int16_t AnimationType; 388 int16_t NextAnimationType; 389 int16_t field_1B04; 390 int16_t field_1B06; 391 int32_t Stitch; //bool 392 float StitchHeight; 393 int16_t InterpolationFromState; 394 int16_t field_1B12; 395 Vector3 StitchVelocity; 396 int16_t InterpolationCurrentFrame; 397 int16_t InterpolationLength; 398 Quaternion InterpolationStartRotations[19]; 399 int32_t field_1C54; 400 int32_t field_1C58; 401 int32_t field_1C5C; 402 int32_t field_1C60; 403 int32_t Overlay; 404 int32_t field_1C68; 405 int32_t field_1C6C; 406 int32_t field_1C70; 407 int32_t field_1C74; 408 int32_t field_1C78; 409 int32_t field_1C7C; 410 int32_t field_1C80; 411 int32_t field_1C84; 412 int16_t Frame; 413 int16_t SoftPause; 414 int16_t HardPause; 415 int16_t field1C8E; 416 int32_t field1C90; 417 int16_t field1C94; 418 int16_t field1C96; 419 int16_t Dizzy; 420 int16_t field1C9A; 421 int32_t field1C9C; 422 int16_t AnimationVarient; 423 int16_t TimeToPeace; 424 int16_t NumAnimationAttachedParticles; 425 int16_t field_1CA6; //spacing 426 AttachedParticle AnimationAttachedParticles[16]; 427 int32_t TRAMParticles; 428 onibool FixedParticlesAttached; 429 onibool FixedParticlesStarted; 430 int16_t NumFixedParticles; 431 AttachedParticle FixedParticles[16]; 432 int16_t CurrentAnimationType; 433 int16_t field_1EB2; //spacing 434 int32_t field_1EB4; 435 int32_t field_1EB8; 436 int32_t field_1EBC; 437 int32_t field_1EC0; 438 int32_t field_1EC4; 439 int32_t field_1EC8; 440 int32_t field_1ED0; 441 int32_t field_1ED4; 442 int32_t field_1ED8; 443 int32_t field_1EE0; 444 int32_t field_1EE4; 445 int32_t field_1EE8; 446 Quaternion Rotations[19]; 447 Quaternion OverlayRotations[19]; 448 int32_t field_2150; 449 int32_t field_2154; 450 GameInput Input; 451 InputAction PreviousActions; 452 int32_t SprintTimer; 453 int32_t field_2194; 454 Vector3 field_2198; 455 int32_t field_21A4; 456 int32_t field_21A8; 457 int32_t field_21AC; 458 Vector3 field_21B0; 459 float HeadFacing; 460 float HeadPitch; 461 int32_t field_21C4; 462 int32_t field_21C8; 463 int32_t field_21D0; 464 int32_t field_21D4; 465 onibool field_21D8; 466 onibool field_21D9; 467 onibool field_21DA; 468 onibool field_21DB; 469 onibool field_21DC; 470 onibool field_21DD; 471 onibool field_21DE; 472 onibool field_21DF; 473 onibool field_21E0; 474 onibool HasAlternateTrigger; 475 onibool field_21E2; 476 onibool ReleaseTrigger; 477 onibool ReleaseAlternateTrigger; 478 onibool TurningLeft; 479 onibool TurningRight; 480 onibool field_21E7; 481 int32_t field_21E8; 482 int32_t field_21EC; 483 int32_t field_21F0; 484 PlayingFilm PlayingFilm_; //fix this name 485 int32_t field_2218[24]; //2218-2278 486 Matrix4x3 BoneMatrices[19]; 487 Matrix4x3 WeaponMatrix; 488 int32_t field_2638[113]; //2638-27FC 489 int16_t ShadowIndex; 490 int16_t field_27FE; 491 int16_t field_2780; 492 onibool ShieldParts[19]; 493 onibool field_2815; //padding... 494 onibool field_2816; 495 onibool field_2817; 496 int32_t field_2818[8]; 497 } ActiveCharacter; 498 499 //This struct is good. 500 typedef struct { //Character 501 char Number; 502 char field_2; 503 int16_t ActiveCharacterIndex; 504 int32_t Flags; 505 int32_t field_8; 506 int32_t* ONCC; //change type to ONCC when we get that far... 507 int16_t field_10; 508 int16_t Team; 509 char Name[32]; 510 float BodySize; 511 int32_t Health; 512 int32_t MaxHealth; 513 int32_t ASIA_ID; //might be 16 with 2 byte padding 514 int32_t field_44; 515 char ScriptSpawn[32]; //Script function called when char spawns 516 char ScriptDie[32]; //Script function called when char dies 517 char ScriptAware[32]; //Script function called when char detects something 518 char ScriptAlarm[32]; //Script function called when char is alarmed at something 519 char ScriptHurt[32]; //Script function called when char is hurt for the first time 520 char ScriptDefeat[32]; //Script function called when char is at 1 HP 521 char ScriptNoAmmo[32]; //Script function called when char is out of ammo for the first time. Char must have ammo at spawn. 522 char ScriptNoPath[32]; //Script function called when char loses path. Broken. 523 Vector3 Position; 524 Vector3 LastPosition; 525 Vector3 Location; 526 float Facing; 527 float DesiredFacing; 528 float CosmeticFacing; 529 float field_178; 530 float field_17C; 531 float field_180; 532 int32_t BNV; 533 int32_t GraphNode; 534 float PelvisHeight; 535 float field_190; 536 Inventory Inventory_; //is there a better way to do this? 537 Vector3 Velocity; 538 int32_t field_1D0; 539 int32_t Recoil; 540 int32_t field_1D8; 541 int32_t field_1DC; 542 int32_t LastNotIdleGameTime; 543 int32_t IdleDelay; 544 int32_t Type; 545 int32_t field_1EC; 546 int32_t CombatFlags; 547 int32_t JobId; 548 int32_t Goal; 549 int32_t field_1FC; 550 int32_t field_200; 551 int32_t field_204; 552 int32_t field_208[428]; //208-8B8 553 int32_t CombatState; //I think.... 554 int32_t field_8BC; 555 int32_t PatrolPathOSD[10]; //actually another struct. Not needed atm. 556 int32_t PatrolPathPoints[5][64]; //64 of another struct 557 int32_t field_DE8[98]; //DE8-F70 558 int32_t CombatStatePtr; 559 int32_t KnowledgeState[4]; //Another struct 560 int32_t field_F84; 561 int32_t AlertDecayTimer; 562 int32_t field_F8C; 563 int32_t field_F90; 564 int32_t InitialAlertLevel; //0 - lull, 1 - low, 2 - medium, 3 - high, 4 - combat 565 int32_t MinimalAlertLevel; //0 - lull, 1 - low, 2 - medium, 3 - high, 4 - combat 566 int32_t StartJobAlertLevel; //0 - lull, 1 - low, 2 - medium, 3 - high, 4 - combat 567 int32_t InvestigatingAlertLevel;//0 - lull, 1 - low, 2 - medium, 3 - high, 4 - combat 568 int32_t StartleTime; 569 int32_t field_FA8; 570 int32_t field_FAC; 571 int32_t field_FB0; 572 int32_t PursuitStrongLow; 573 int32_t PursuitWeakLow; 574 int32_t PursuitStrongHigh; 575 int32_t PursuitWeakHigh; 576 int32_t Pursuit5; 577 int32_t field_FC8[4]; 578 int32_t AlarmGroups; //a bitset 579 int32_t field_FDC[17]; //FDC-1020 580 int32_t DazeTimer; 581 int32_t field_1024[17]; //1024-1068 582 int32_t MeleePtr; //probably MELE. Looks somewhat important. 583 int32_t field_106C[270]; //106C-14A4 skipping lots of junk and a little pathfinding stuff that we might want later. 584 int32_t MovementMode; 585 int32_t field_14A8; 586 int32_t field_14AC; 587 int32_t MovementModifiers; //hopefully sprinting, pistol, rifle, etc. 588 int32_t field_14B4[101]; //14B4-1648 Glossing over a few other things we don't need having to do with AI direction. 589 BoundingBox BoundingBox_; 590 int32_t field_1660; 591 int32_t BossShieldPower; //a multiplier? or just a flag? who knows 592 int32_t field_1668[6]; 593 int32_t CurrentConsoleActionMarker; //not sure. 594 int32_t field_1684[7]; 595 } Character; 5 //#include <stdint.h> 6 #include "bool.h" 596 7 597 8 enum { … … 605 16 team_syndicateaccessory, 606 17 }; 18 /* 607 19 int16_t ONICALL ONrGameState_NewCharacter(CharacterObject* CHAR, void* AISA, void* flag, uint32_t* list_location); 608 20 int32_t* ONICALL ONrGetActiveCharacter(void* CharacterPtr); 609 21 //int16_t ONICALL ONrGameState_GetPlayerCharacter(); 610 22 */ 611 23 //probably need to name these better. 24 /* 612 25 #define char_unkillable (1 << 5) 613 26 #define char_superammo (1 << 6) … … 620 33 #define char_bossshield (1 << 30) 621 34 #define char_weaponimmune (1 << 31) 622 35 */ 623 36 624 37 //We need a Oni_Structs #include file. 625 38 626 typedef struct { 627 uint32_t TimerMode; 628 char TimerName[32]; 629 uint32_t TimerDuration; 630 uint32_t field_28; 631 uint32_t field_2C; 632 uint32_t Letterbox[3]; 633 uint32_t field_3C; 634 uint32_t field_40; 635 uint32_t CutsceneSyncMark; 636 uint32_t SomeCutsceneSyncMarkField; 637 uint32_t field_4C; 638 uint32_t SplashScreenMachineTime; 639 uint32_t field_54; 640 uint32_t field_58; 641 uint32_t field_5C; 642 uint32_t field_60; 643 uint32_t field_64; 644 uint32_t field_68; 645 uint32_t field_6C; 646 uint32_t field_70; 647 uint32_t FadeStartTime; 648 uint32_t FadeEndTime; 649 uint32_t field_7C; 650 uint32_t Camera; 651 char PathFindingGraph[0x28]; 652 struct Character *PlayerCharacter; 653 uint32_t field_B0; 654 uint32_t field_B4; 655 GameInput Input; 656 uint32_t field_E8; 657 uint32_t field_EC; 658 uint32_t ScreenshotEveryFrame; //bool? 659 uint32_t field_F4; 660 char field_F8; 661 char field_F9; 662 char field_FA; 663 char field_FB; 664 uint32_t field_FC; 665 uint32_t field_100; 666 uint32_t SlowMo; //bool 667 uint32_t SlowMotion; 668 uint32_t field_10C; 669 uint32_t field_110; 670 uint32_t field_114; 671 char SplashScreenTextureName[32]; 672 uint32_t field_138; 673 uint32_t field_13C; 674 uint32_t field_140; 675 uint32_t GameTime; 676 uint32_t field_148; 677 uint32_t field_14C; 678 uint32_t Level; 679 uint32_t field_154; 680 char MotionBlur[0x44][64]; 681 uint32_t MotionBlurCount; 682 uint16_t field_125C; 683 uint16_t field_125E; 684 Character CharacterStorage[128]; 685 uint16_t CharacterCount; 686 uint16_t padding_1; 687 uint32_t field_B6264; 688 char ActiveCharacters[0x2838][64]; //Active Character Struct isn't the proper size atm. 689 uint16_t ActiveCharactersCount; 690 char Shadows[32][0x804]; 691 uint32_t field_1670EA; 692 uint32_t ShadowCount; 693 ActiveCharacter* ActiveCharacterList[128]; //or just Character*? Anyways, we wont need to use this. 694 uint32_t ActiveCharacterListCount; 695 uint32_t ActiveCharacterListLock; 696 Character* LivingCharacterList[128]; 697 uint32_t LivingCharacterListCount; 698 uint32_t LivingCharacterListLock; 699 ActiveCharacter* PresentCharacterList[128]; 700 uint32_t PresentCharacterListCount; 701 uint32_t PresentCharacterListLock; 702 void* ObjectList; 703 char DoorArray[8]; 704 char Sky[0x290]; 705 uint32_t field_1679A4; 706 uint32_t Triggers; 707 char IsGamePaused; 708 char IsInputEnabled; 709 char field_1679AE; 710 char field_1679AF; 711 uint32_t LockedActions1; 712 uint32_t LockedActions2; 713 uint32_t field_1679B8; 714 uint32_t WinLose; 715 uint32_t ConditionSoundsCount; 716 uint32_t ConditionSounds[5]; 717 uint16_t LevelNumber; 718 uint16_t padding_5; 719 uint16_t field_1679DC; 720 } GameState; 39 typedef enum { 40 ONcCharacterFlag_Dead_1_Animating = 0x00000001, // health is 0 41 ONcCharacterFlag_Dead = ONcCharacterFlag_Dead_1_Animating, 42 ONcCharacterFlag_Dead_2_Moving = 0x00000002, // no longer animating 43 ONcCharacterFlag_Dead_3_Cosmetic = 0x00000004, // no longer moving 44 ONcCharacterFlag_Dead_4_Gone = 0x00000008, // dead except but still drawn 721 45 46 ONcCharacterFlag_HastyAnim = 0x00000010, // do this queued animation ASAP 47 ONcCharacterFlag_Unkillable = 0x00000020, // the character cannot be killed, only defeated 48 ONcCharacterFlag_InfiniteAmmo = 0x00000040, // the character always has infinite ammo 49 ONcCharacterFlag_PleaseBlock = 0x00000080, // set if the character should block, cleared once block begins 50 51 ONcCharacterFlag_Unstoppable = 0x00000100, // this character cannot be knocked down, staggered, stunned, etc 52 ONcCharacterFlag_ScriptControl = 0x00000200, // set if the character is completely under script control 53 ONcCharacterFlag_DeathLock = 0x00000400, // this character should never die all the way 54 ONcCharacterFlag_WasUpdated = 0x00000800, // this character's animation was changed 55 56 ONcCharacterFlag_BeingThrown = 0x00001000, // this character is being thrown 57 ONcCharacterFlag_DontUseGunVarient = 0x00002000, // this character should not use a weapon varient 58 ONcCharacterFlag_Draw = 0x00004000, // DoFrame has been executed for this character 59 ONcCharacterFlag_InUse = 0x00008000, // this character is active and in use 60 61 ONcCharacterFlag_DontUseFightVarient = 0x00010000, 62 ONcCharacterFlag_NoCollision = 0x00020000, // no collision for this character 63 ONcCharacterFlag_Teleporting = 0x00040000, // this character is teleporting and does not accept collision 64 ONcCharacterFlag_NoCorpse = 0x00080000, // no corpse for this character 65 66 ONcCharacterFlag_ActiveLock = 0x00100000, // the character is locked active 67 ONcCharacterFlag_ChrAnimate = 0x00200000, // the character is currently runing a chr_animate command 68 ONcCharacterFlag_AIMovement = 0x00400000, // the character is using AI movement 69 ONcCharacterFlag_NeutralUninterruptable = 0x00800000, // running an uninterruptable neutral interaction 70 71 ONcCharacterFlag_NoShadow = 0x01000000, // 72 ONcCharacterFlag_Invincible = 0x02000000, // character is invincible 73 ONcCharacterFlag_NoAutoDrop = 0x04000000, // character should not automatically drop items when killed (invisibility, shield, LSI) 74 ONcCharacterFlag_RestrictedMovement = 0x08000000, // character cannot move fast (used for player holding barabbas' gun) 75 76 ONcCharacterFlag_Boss = 0x10000000, // character is a boss (used for final muro group fight) 77 ONcCharacterFlag_FinalFlash = 0x20000000, // 'final flash' has been played for this character's death 78 ONcCharacterFlag_BossShield = 0x40000000, // this character has the boss shield 79 ONcCharacterFlag_WeaponImmune = 0x80000000 // this character is immune to weapon damage 80 81 } ONtCharacterFlags; 82 83 typedef enum { 84 ONcCharacterFlag2_WeaponEmpty = 0x00000001, // character's weapon is empty, punch instead 85 ONcCharacterFlag2_UltraMode = 0x00000002 86 87 } ONtCharacterFlags2; 722 88 723 89 #endif -
Daodan/src/Oni_Persistence.h
r339 r677 3 3 #define ONI_PERSISTENCE_H 4 4 5 #include <stdint.h>5 //#include <stdint.h> 6 6 #include "Daodan.h" 7 7 /* 8 8 float ONICALL ONrPersist_GetGamma(); 9 9 uint8_t ONICALL ONrPersist_GetWonGame(); 10 10 */ 11 11 #endif -
Daodan/src/binkw32.def
r449 r677 1 LIBRARY binkw32.dll 1 LIBRARY 2 2 3 EXPORTS 3 BinkBufferBlit@12 = _BinkBufferBlit@12 @1 4 BinkBufferCheckWinPos@12 = _BinkBufferCheckWinPos@12 @2 5 BinkBufferClear@8 = _BinkBufferClear@8 @3 6 BinkBufferClose@4 = _BinkBufferClose@4 @4 7 BinkBufferGetDescription@4 = _BinkBufferGetDescription@4 @5 8 BinkBufferGetError@0 = _BinkBufferGetError@0 @6 9 BinkBufferLock@4 = _BinkBufferLock@4 @7 10 BinkBufferOpen@16 = _BinkBufferOpen@16 @8 11 BinkBufferSetDirectDraw@8 = _BinkBufferSetDirectDraw@8 @9 12 BinkBufferSetHWND@8 = _BinkBufferSetHWND@8 @10 13 BinkBufferSetOffset@12 = _BinkBufferSetOffset@12 @11 14 BinkBufferSetResolution@12 = _BinkBufferSetResolution@12 @12 15 BinkBufferSetScale@12 = _BinkBufferSetScale@12 @13 16 BinkBufferUnlock@4 = _BinkBufferUnlock@4 @14 17 BinkCheckCursor@20 = _BinkCheckCursor@20 @15 18 BinkClose@4 = _BinkClose@4 @16 19 BinkCloseTrack@4 = _BinkCloseTrack@4 @17 20 BinkCopyToBuffer@28 = _BinkCopyToBuffer@28 @18 21 BinkDDSurfaceType@4 = _BinkDDSurfaceType@4 @19 22 BinkDoFrame@4 = _BinkDoFrame@4 @20 23 BinkGetError@0 = _BinkGetError@0 @21 24 BinkGetKeyFrame@12 = _BinkGetKeyFrame@12 @22 25 BinkGetRealtime@12 = _BinkGetRealtime@12 @23 26 BinkGetRects@8 = _BinkGetRects@8 @24 27 BinkGetSummary@8 = _BinkGetSummary@8 @25 28 BinkGetTrackData@8 = _BinkGetTrackData@8 @26 29 BinkGetTrackID@8 = _BinkGetTrackID@8 @27 30 BinkGetTrackMaxSize@8 = _BinkGetTrackMaxSize@8 @28 31 BinkGetTrackType@8 = _BinkGetTrackType@8 @29 32 BinkGoto@12 = _BinkGoto@12 @30 33 BinkIsSoftwareCursor@8 = _BinkIsSoftwareCursor@8 @31 34 BinkLogoAddress@0 = _BinkLogoAddress@0 @32 35 BinkNextFrame@4 = _BinkNextFrame@4 @33 36 BinkOpen@8 = _BinkOpen@8 @34 37 BinkOpenDirectSound@4 = _BinkOpenDirectSound@4 @35 38 BinkOpenMiles@4 = _BinkOpenMiles@4 @36 39 BinkOpenTrack@8 = _BinkOpenTrack@8 @37 40 BinkOpenWaveOut@4 = _BinkOpenWaveOut@4 @38 41 BinkPause@8 = _BinkPause@8 @39 42 BinkRestoreCursor@4 = _BinkRestoreCursor@4 @40 43 BinkService@4 = _BinkService@4 @41 44 BinkSetError@4 = _BinkSetError@4 @42 45 BinkSetFrameRate@8 = _BinkSetFrameRate@8 @43 46 BinkSetIO@4 = _BinkSetIO@4 @44 47 BinkSetIOSize@4 = _BinkSetIOSize@4 @45 48 BinkSetPan@8 = _BinkSetPan@8 @46 49 BinkSetSimulate@4 = _BinkSetSimulate@4 @47 50 BinkSetSoundOnOff@8 = _BinkSetSoundOnOff@8 @48 51 BinkSetSoundSystem@8 = _BinkSetSoundSystem@8 @49 52 BinkSetSoundTrack@4 = _BinkSetSoundTrack@4 @50 53 BinkSetVideoOnOff@8 = _BinkSetVideoOnOff@8 @51 54 BinkSetVolume@8 = _BinkSetVolume@8 @52 55 BinkWait@4 = _BinkWait@4 @53 56 ExpandBink@56 = _ExpandBink@56 @54 57 ExpandBundleSizes@8 = _ExpandBundleSizes@8 @55 58 RADSetMemory@8 = _RADSetMemory@8 @56 59 RADTimerRead@0 = _RADTimerRead@0 @57 60 YUV_blit_16a1bpp@52 = _YUV_blit_16a1bpp@52 @58 61 YUV_blit_16a1bpp_mask@52 = _YUV_blit_16a1bpp_mask@52 @59 62 YUV_blit_16a4bpp@52 = _YUV_blit_16a4bpp@52 @60 63 YUV_blit_16a4bpp_mask@52 = _YUV_blit_16a4bpp_mask@52 @61 64 YUV_blit_16bpp@48 = _YUV_blit_16bpp@48 @62 65 YUV_blit_16bpp_mask@48 = _YUV_blit_16bpp_mask@48 @63 66 YUV_blit_24bpp@48 = _YUV_blit_24bpp@48 @64 67 YUV_blit_24bpp_mask@48 = _YUV_blit_24bpp_mask@48 @65 68 YUV_blit_24rbpp@48 = _YUV_blit_24rbpp@48 @66 69 YUV_blit_24rbpp_mask@48 = _YUV_blit_24rbpp_mask@48 @67 70 YUV_blit_32abpp@52 = _YUV_blit_32abpp@52 @68 71 YUV_blit_32abpp_mask@52 = _YUV_blit_32abpp_mask@52 @69 72 YUV_blit_32bpp@48 = _YUV_blit_32bpp@48 @70 73 YUV_blit_32bpp_mask@48 = _YUV_blit_32bpp_mask@48 @71 74 YUV_blit_32rabpp@52 = _YUV_blit_32rabpp@52 @72 75 YUV_blit_32rabpp_mask@52 = _YUV_blit_32rabpp_mask@52 @73 76 YUV_blit_32rbpp@48 = _YUV_blit_32rbpp@48 @74 77 YUV_blit_32rbpp_mask@48 = _YUV_blit_32rbpp_mask@48 @75 78 YUV_blit_UYVY@48 = _YUV_blit_UYVY@48 @76 79 YUV_blit_UYVY_mask@48 = _YUV_blit_UYVY_mask@48 @77 80 YUV_blit_YUY2@48 = _YUV_blit_YUY2@48 @78 81 YUV_blit_YUY2_mask@48 = _YUV_blit_YUY2_mask@48 @79 82 YUV_blit_YV12@52 = _YUV_blit_YV12@52 @80 83 YUV_init@4 = _YUV_init@4 @81 84 radfree@4 = _radfree@4 @82 85 radmalloc@4 = _radmalloc@4 @83 4 5 _BinkBufferBlit@12 = REALBINK._BinkBufferBlit@12 @1 6 _BinkBufferCheckWinPos@12 = REALBINK._BinkBufferCheckWinPos@12 @2 7 _BinkBufferClear@8 = REALBINK._BinkBufferClear@8 @3 8 _BinkBufferClose@4 = REALBINK._BinkBufferClose@4 @4 9 _BinkBufferGetDescription@4 = REALBINK._BinkBufferGetDescription@4 @5 10 _BinkBufferGetError@0 = REALBINK._BinkBufferGetError@0 @6 11 _BinkBufferLock@4 = REALBINK._BinkBufferLock@4 @7 12 _BinkBufferOpen@16 = REALBINK._BinkBufferOpen@16 @8 13 _BinkBufferSetDirectDraw@8 = REALBINK._BinkBufferSetDirectDraw@8 @9 14 _BinkBufferSetHWND@8 = REALBINK._BinkBufferSetHWND@8 @10 15 _BinkBufferSetOffset@12 = REALBINK._BinkBufferSetOffset@12 @11 16 _BinkBufferSetResolution@12 = REALBINK._BinkBufferSetResolution@12 @12 17 _BinkBufferSetScale@12 = REALBINK._BinkBufferSetScale@12 @13 18 _BinkBufferUnlock@4 = REALBINK._BinkBufferUnlock@4 @14 19 _BinkCheckCursor@20 = REALBINK._BinkCheckCursor@20 @15 20 _BinkClose@4 = REALBINK._BinkClose@4 @16 21 _BinkCloseTrack@4 = REALBINK._BinkCloseTrack@4 @17 22 _BinkCopyToBuffer@28 = REALBINK._BinkCopyToBuffer@28 @18 23 _BinkDDSurfaceType@4 = REALBINK._BinkDDSurfaceType@4 @19 24 _BinkDoFrame@4 = REALBINK._BinkDoFrame@4 @20 25 _BinkGetError@0 = REALBINK._BinkGetError@0 @21 26 _BinkGetKeyFrame@12 = REALBINK._BinkGetKeyFrame@12 @22 27 _BinkGetRealtime@12 = REALBINK._BinkGetRealtime@12 @23 28 _BinkGetRects@8 = REALBINK._BinkGetRects@8 @24 29 _BinkGetSummary@8 = REALBINK._BinkGetSummary@8 @25 30 _BinkGetTrackData@8 = REALBINK._BinkGetTrackData@8 @26 31 _BinkGetTrackID@8 = REALBINK._BinkGetTrackID@8 @27 32 _BinkGetTrackMaxSize@8 = REALBINK._BinkGetTrackMaxSize@8 @28 33 _BinkGetTrackType@8 = REALBINK._BinkGetTrackType@8 @29 34 _BinkGoto@12 = REALBINK._BinkGoto@12 @30 35 _BinkIsSoftwareCursor@8 = REALBINK._BinkIsSoftwareCursor@8 @31 36 _BinkLogoAddress@0 = REALBINK._BinkLogoAddress@0 @32 37 _BinkNextFrame@4 = REALBINK._BinkNextFrame@4 @33 38 _BinkOpen@8 = REALBINK._BinkOpen@8 @34 39 _BinkOpenDirectSound@4 = REALBINK._BinkOpenDirectSound@4 @35 40 _BinkOpenMiles@4 = REALBINK._BinkOpenMiles@4 @36 41 _BinkOpenTrack@8 = REALBINK._BinkOpenTrack@8 @37 42 _BinkOpenWaveOut@4 = REALBINK._BinkOpenWaveOut@4 @38 43 _BinkPause@8 = REALBINK._BinkPause@8 @39 44 _BinkRestoreCursor@4 = REALBINK._BinkRestoreCursor@4 @40 45 _BinkService@4 = REALBINK._BinkService@4 @41 46 _BinkSetError@4 = REALBINK._BinkSetError@4 @42 47 _BinkSetFrameRate@8 = REALBINK._BinkSetFrameRate@8 @43 48 _BinkSetIO@4 = REALBINK._BinkSetIO@4 @44 49 _BinkSetIOSize@4 = REALBINK._BinkSetIOSize@4 @45 50 _BinkSetPan@8 = REALBINK._BinkSetPan@8 @46 51 _BinkSetSimulate@4 = REALBINK._BinkSetSimulate@4 @47 52 _BinkSetSoundOnOff@8 = REALBINK._BinkSetSoundOnOff@8 @48 53 _BinkSetSoundSystem@8 = REALBINK._BinkSetSoundSystem@8 @49 54 _BinkSetSoundTrack@4 = REALBINK._BinkSetSoundTrack@4 @50 55 _BinkSetVideoOnOff@8 = REALBINK._BinkSetVideoOnOff@8 @51 56 _BinkSetVolume@8 = REALBINK._BinkSetVolume@8 @52 57 _BinkWait@4 = REALBINK._BinkWait@4 @53 58 _ExpandBink@56 = REALBINK._ExpandBink@56 @54 59 _ExpandBundleSizes@8 = REALBINK._ExpandBundleSizes@8 @55 60 _RADSetMemory@8 = REALBINK._RADSetMemory@8 @56 61 _RADTimerRead@0 = REALBINK._RADTimerRead@0 @57 62 _YUV_blit_16a1bpp@52 = REALBINK._YUV_blit_16a1bpp@52 @58 63 _YUV_blit_16a1bpp_mask@52 = REALBINK._YUV_blit_16a1bpp_mask@52 @59 64 _YUV_blit_16a4bpp@52 = REALBINK._YUV_blit_16a4bpp@52 @60 65 _YUV_blit_16a4bpp_mask@52 = REALBINK._YUV_blit_16a4bpp_mask@52 @61 66 _YUV_blit_16bpp@48 = REALBINK._YUV_blit_16bpp@48 @62 67 _YUV_blit_16bpp_mask@48 = REALBINK._YUV_blit_16bpp_mask@48 @63 68 _YUV_blit_24bpp@48 = REALBINK._YUV_blit_24bpp@48 @64 69 _YUV_blit_24bpp_mask@48 = REALBINK._YUV_blit_24bpp_mask@48 @65 70 _YUV_blit_24rbpp@48 = REALBINK._YUV_blit_24rbpp@48 @66 71 _YUV_blit_24rbpp_mask@48 = REALBINK._YUV_blit_24rbpp_mask@48 @67 72 _YUV_blit_32abpp@52 = REALBINK._YUV_blit_32abpp@52 @68 73 _YUV_blit_32abpp_mask@52 = REALBINK._YUV_blit_32abpp_mask@52 @69 74 _YUV_blit_32bpp@48 = REALBINK._YUV_blit_32bpp@48 @70 75 _YUV_blit_32bpp_mask@48 = REALBINK._YUV_blit_32bpp_mask@48 @71 76 _YUV_blit_32rabpp@52 = REALBINK._YUV_blit_32rabpp@52 @72 77 _YUV_blit_32rabpp_mask@52 = REALBINK._YUV_blit_32rabpp_mask@52 @73 78 _YUV_blit_32rbpp@48 = REALBINK._YUV_blit_32rbpp@48 @74 79 _YUV_blit_32rbpp_mask@48 = REALBINK._YUV_blit_32rbpp_mask@48 @75 80 _YUV_blit_UYVY@48 = REALBINK._YUV_blit_UYVY@48 @76 81 _YUV_blit_UYVY_mask@48 = REALBINK._YUV_blit_UYVY_mask@48 @77 82 _YUV_blit_YUY2@48 = REALBINK._YUV_blit_YUY2@48 @78 83 _YUV_blit_YUY2_mask@48 = REALBINK._YUV_blit_YUY2_mask@48 @79 84 _YUV_blit_YV12@52 = REALBINK._YUV_blit_YV12@52 @80 85 _YUV_init@4 = REALBINK._YUV_init@4 @81 86 _radfree@4 = REALBINK._radfree@4 @82 87 _radmalloc@4 = REALBINK._radmalloc@4 @83 88 89 -
Daodan/src/daodan_gl.c
r476 r677 5 5 #include "Oni_Persistence.h" 6 6 #include "Daodan_Utility.h" 7 7 #include <GL/gl.h> 8 #include <GL/glu.h> 9 #include "Daodan_Win32.h" 8 10 #include "BFW_Utility.h" 9 11 … … 45 47 { 1920, 1440, 0, 0 }, 46 48 }; 47 48 short daodan_resdepths[] = { 16, 32 };49 49 //Just going to always use 32 bits for now... 50 //short daodan_resdepths[] = { 16, 32 }; 51 short daodan_resdepths[] = { 32 }; 50 52 DEVMODE orig_devmode, cur_devmode, new_devmode; 51 53 … … 83 85 { 84 86 unsigned int vmodes = 0; 85 unsigned int screen_x = orig_devmode.dmPelsWidth;86 unsigned int screen_y = orig_devmode.dmPelsHeight;87 88 int i, j;87 unsigned int screen_x = GetSystemMetrics(SM_CXSCREEN); 88 unsigned int screen_y = GetSystemMetrics(SM_CYSCREEN); 89 90 uint16_t i, j; 89 91 90 92 DDrStartupMessage("listing display modes"); 91 93 /* 92 94 if (!M3gResolutionSwitch) 93 95 daodan_resdepths[0] = orig_devmode.dmBitsPerPel; 94 96 */ 95 97 for (i = 0; i < builtin_depths; i ++) 96 98 { … … 179 181 180 182 update_cdmode(); 181 gl ->DisplayMode.Width = cur_devmode.dmPelsWidth;182 gl ->DisplayMode.Height = cur_devmode.dmPelsHeight;183 gl_eng->DisplayMode.Width = cur_devmode.dmPelsWidth; 184 gl_eng->DisplayMode.Height = cur_devmode.dmPelsHeight; 183 185 if (cur_devmode.dmBitsPerPel > depth) 184 gl ->DisplayMode.Depth = cur_devmode.dmBitsPerPel;186 gl_eng->DisplayMode.Depth = cur_devmode.dmBitsPerPel; 185 187 } 186 188 else … … 188 190 update_cdmode(); 189 191 if (cur_devmode.dmBitsPerPel > depth) 190 gl ->DisplayMode.Depth = cur_devmode.dmBitsPerPel;192 gl_eng->DisplayMode.Depth = cur_devmode.dmBitsPerPel; 191 193 } 192 194 return 1; 193 195 } 194 195 void daodan_set_gamma(float gamma)196 {197 WORD ramp[3][256];198 int i;199 200 if (!gl_gamma_ramp_valid)201 return;202 203 gamma = (1.0f - gamma) * 1.2f + 0.4f;204 205 for (i = 0; i < 256; i++)206 {207 int value = (int)(pow(gl_gamma_ramp[i] / 65535.0f, gamma) * 65535.0f);208 209 if (value < 0)210 value = 0;211 else if (value > 65535)212 value = 65535;213 214 ramp[0][i] = ramp[1][i] = ramp[2][i] = value;215 }216 217 if (gl_api->wglSetDeviceGammaRamp3DFX)218 gl_api->wglSetDeviceGammaRamp3DFX(gl->HDC, ramp);219 else220 SetDeviceGammaRamp(gl->HDC, ramp);221 }222 223 196 int ONICALL daodangl_platform_initialize() 224 197 { 225 198 static M3tDisplayMode lastmode = {0, 0, 0, 0}; 226 199 227 if (lastmode.Width != gl ->DisplayMode.Width || lastmode.Height != gl->DisplayMode.Height || lastmode.Depth != gl->DisplayMode.Depth)228 if (!daodan_set_display_mode(gl ->DisplayMode.Width, gl->DisplayMode.Height, gl->DisplayMode.Depth))229 if (gl ->DisplayMode.Width != 640 || gl->DisplayMode.Height != 480 || gl->DisplayMode.Depth != 16)200 if (lastmode.Width != gl_eng->DisplayMode.Width || lastmode.Height != gl_eng->DisplayMode.Height || lastmode.Depth != gl_eng->DisplayMode.Depth) 201 if (!daodan_set_display_mode(gl_eng->DisplayMode.Width, gl_eng->DisplayMode.Height, gl_eng->DisplayMode.Depth)) 202 if (gl_eng->DisplayMode.Width != 640 || gl_eng->DisplayMode.Height != 480 || gl_eng->DisplayMode.Depth != 16) 230 203 { 231 gl ->DisplayMode.Width = 640;232 gl ->DisplayMode.Height = 480;204 gl_eng->DisplayMode.Width = 640; 205 gl_eng->DisplayMode.Height = 480; 233 206 if (!daodan_set_display_mode(640, 480, 16)) 234 207 goto exit_err; 235 208 } 236 209 237 if (lastmode.Width != gl ->DisplayMode.Width || lastmode.Height != gl->DisplayMode.Height)210 if (lastmode.Width != gl_eng->DisplayMode.Width || lastmode.Height != gl_eng->DisplayMode.Height) 238 211 { 239 212 RECT Rect; 240 Rect.left = (GetSystemMetrics(SM_CXSCREEN) / 2) - (gl ->DisplayMode.Width / 2);241 Rect.top = (GetSystemMetrics(SM_CYSCREEN) / 2) - (gl ->DisplayMode.Height / 2);242 Rect.right = Rect.left + gl ->DisplayMode.Width;243 Rect.bottom = Rect.top + gl ->DisplayMode.Height;213 Rect.left = (GetSystemMetrics(SM_CXSCREEN) / 2) - (gl_eng->DisplayMode.Width / 2); 214 Rect.top = (GetSystemMetrics(SM_CYSCREEN) / 2) - (gl_eng->DisplayMode.Height / 2); 215 Rect.right = Rect.left + gl_eng->DisplayMode.Width; 216 Rect.bottom = Rect.top + gl_eng->DisplayMode.Height; 244 217 AdjustWindowRect(&Rect, WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_CAPTION |WS_TILEDWINDOW , FALSE); 245 218 … … 247 220 } 248 221 249 if (gl ->HDC == NULL)250 if ((gl ->HDC = GetDC(ONgPlatformData.Window)) == NULL)222 if (gl_eng->HDC == NULL) 223 if ((gl_eng->HDC = GetDC(ONgPlatformData.Window)) == NULL) 251 224 goto exit_err; 252 225 … … 255 228 DDrStartupMessage("Using 3DFX gamma adjustment"); 256 229 257 if (gl_api->wglGetDeviceGammaRamp3DFX(gl ->HDC, gl_gamma_ramp))230 if (gl_api->wglGetDeviceGammaRamp3DFX(gl_eng->HDC, gl_gamma_ramp)) 258 231 gl_gamma_ramp_valid = 1; 259 232 } … … 262 235 DDrStartupMessage("Using standard Windows gamma adjustment"); 263 236 264 if (GetDeviceGammaRamp(gl ->HDC, gl_gamma_ramp))237 if (GetDeviceGammaRamp(gl_eng->HDC, gl_gamma_ramp)) 265 238 gl_gamma_ramp_valid = 1; 266 239 } 267 240 /* 268 241 if (gl_gamma_ramp_valid) 269 242 daodan_set_gamma(ONrPersist_GetGamma()); 270 else 243 else*/ 271 244 DDrStartupMessage("gamma adjustment not supported"); 272 245 273 if (!gl_platform_set_pixel_format(gl ->HDC))274 if (gl ->DisplayMode.Depth != 16)246 if (!gl_platform_set_pixel_format(gl_eng->HDC)) 247 if (gl_eng->DisplayMode.Depth != 16) 275 248 { 276 if (!daodan_set_display_mode(gl ->DisplayMode.Width, gl->DisplayMode.Height, 16))249 if (!daodan_set_display_mode(gl_eng->DisplayMode.Width, gl_eng->DisplayMode.Height, 16)) 277 250 goto exit_err; 278 251 279 if (!gl_platform_set_pixel_format(gl ->HDC))252 if (!gl_platform_set_pixel_format(gl_eng->HDC)) 280 253 goto exit_err; 281 254 } 282 255 283 lastmode.Width = gl ->DisplayMode.Width;284 lastmode.Height = gl ->DisplayMode.Height;285 lastmode.Depth = gl ->DisplayMode.Depth;256 lastmode.Width = gl_eng->DisplayMode.Width; 257 lastmode.Height = gl_eng->DisplayMode.Height; 258 lastmode.Depth = gl_eng->DisplayMode.Depth; 286 259 return 1; 287 260 -
Daodan/src/daodan_gl.h
r326 r677 15 15 void daodan_set_gamma(float gamma); 16 16 int ONICALL daodangl_platform_initialize(); 17 17 daodan_init_msaa(); 18 18 #endif -
Daodan/src/inifile.h
r451 r677 3 3 #define INIFILE_H 4 4 5 #include <stdbool.h>6 #include <stdint.h>5 #include "bool.h" 6 //#include <stdint.h> 7 7 8 8 enum {inifile_cantread = -20}; -
Daodan/src/inifile_reader.c
r466 r677 1 1 #include <stdio.h> 2 2 #include <stdlib.h> 3 #include <stdbool.h>3 #include "bool.h" 4 4 #include <string.h> 5 5 #include <ctype.h> … … 113 113 if (inisection[0]) 114 114 free(inisection); 115 inisection = strdup(readptr + 1); // Skip the first [115 inisection = _strdup(readptr + 1); // Skip the first [ 116 116 newsection = true; 117 117 } -
Daodan/src/oni_gl.h
r326 r677 3 3 #define ONI_GL_H 4 4 5 #include <GL/ GL.h>5 #include <GL/gl.h> 6 6 7 7 #include "Daodan.h" … … 440 440 } gl_api_t; 441 441 442 extern gl_engine_t* gl; 443 extern gl_api_t* gl_api; 444 445 extern WORD gl_gamma_ramp[3 * 256]; 446 extern int gl_gamma_ramp_valid; 447 448 unsigned int ONICALL gl_enumerate_valid_display_modes(M3tDisplayMode modes[16]); 449 int ONICALL gl_platform_set_pixel_format(HDC hdc); 450 int ONICALL gl_platform_initialize(); 442 443 451 444 452 445 #endif -
Daodan/src/oni_stdio.h
r272 r677 4 4 5 5 #include <stdio.h> 6 6 /* 7 7 FILE* __cdecl oni_fopen(const char*, const char*); 8 8 int __cdecl oni_fprintf(FILE*, const char*, ...); 9 9 int __cdecl oni_fflush(FILE*); 10 10 */ 11 11 #endif
Note:
See TracChangeset
for help on using the changeset viewer.