- Timestamp:
- Jul 14, 2010, 9:35:40 AM (14 years ago)
- Location:
- Daodan/MSVC
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
Daodan/MSVC/Daodan.c
r567 r569 83 83 if (patch_pathfinding) 84 84 { 85 const char pathfinding[2] = {0x90 , 0xE9 }; 85 86 DDrPatch_Byte (OniExe + 0x0010b03b, 0x20); 86 87 DDrPatch_Byte (OniExe + 0x0010b04c, 0x20); 88 89 //other stuff 90 DDrPatch_Const(0x440789, pathfinding); 87 91 } 88 92 … … 99 103 if (patch_directinput) 100 104 DDrPatch_Byte (OniExe + 0x00002e6d, 0xeb); 101 105 102 106 if (patch_wpfadetime) 103 107 { … … 111 115 } 112 116 117 // FIXME: add switches 118 //pathfinding fix 119 120 121 113 122 114 123 // Hackish fix for Konoko not kicking guns … … 208 217 DDrPatch_Int32 (OniExe + 0x000d3570, 0xc3c03366); 209 218 219 if (patch_bsl) 220 { 221 //Calculating the value of the needed offset is much more reliable when the compiler does it for you. 222 223 //TODO: fix moonshadow. 224 Character * Chr = 0; 225 int NoPath = (int)&(Chr[0].RegenHax) & 0x000000FF; 226 const char regen_patch[] = 227 {0x90, 0x90, 0x90, 0x90, 0x90, // mov al, _WPgRegenerationCheat -> NOOP 228 0x90, 0x90, // test al, al -> NOOP 229 0x90, 0x90, // jz short loc_51BB98 -> NOOP 230 0x8B, 0x86, (char)NoPath, 0x01, 0x00, 0x00, // mov eax, [esi+Character.field_1E8] 231 // -> mov eax, [esi+Character.RegenHax] 232 0x85, 0xC0, // test eax, eax 233 0x74, 0x21 // jnz 0x21 -> jz 0x21 234 }; 235 DDrPatch_Const(0x0051BB64, regen_patch); 236 } 237 238 210 239 return true; 211 240 } … … 562 591 if (patch_cheatsenabled) 563 592 DDrPatch_MakeJump(ONrPersist_GetWonGame, DDrPersist_GetWonGame); 564 #if 0593 //#if 0 565 594 // Windowed mode 566 if (patch_usedaodangl) 567 { 595 // if (patch_usedaodangl) 596 { 597 DDrPatch_NOOP((char*)0x004032B7, 6); 598 DDrPatch_MakeCall((char*)0x004032B7, LIiP_SetCursorPosHook); 599 600 DDrPatch_NOOP((char*)0x00403349, 6); 601 DDrPatch_MakeCall((char*)0x00403349, LIiP_SetCursorPosHook); 568 602 DDrPatch_MakeJump(ONrPlatform_Initialize, DDrPlatform_Initialize); 569 603 DDrPatch_MakeJump(gl_platform_initialize, daodangl_platform_initialize); 570 604 } 571 #endif605 //#endif 572 606 // Hacked windowed mode (for when daodangl isn't working properly) 573 607 //if (patch_windowhack) 574 608 575 DDrWindowHack_Install();609 // DDrWindowHack_Install(); 576 610 577 611 if (patch_daodaninit) -
Daodan/MSVC/Daodan_BSL.c
r568 r569 553 553 // ActiveCharacter* Active = (ActiveCharacter*)ONrGetActiveCharacter(&Chr[index]); 554 554 // if ((int)Active == 0) return 1; 555 555 556 int i = 2; 556 557 int j = 0; 557 558 int Input1 = 0; 558 559 int Input2 = 0; 559 for(i = 0; i < numargs; i++) { 560 /* 561 numargs = 0; 562 for(i = 0; args[i].type <= sl_void; i++) 563 { 564 //DDrConsole_PrintF("%i", args[i].type ); 565 numargs++; 566 567 } 568 if(numargs < 1 || args[0].value == 0) return; 569 //for(i = 0; i < numargs; i++) { 570 */ 571 i = 0; 560 572 for(j = 0; j < 32; j++) { 561 573 //DDrConsole_PrintF("Testing %s against %s 0x%x", args[i].value_str32, Actions1[j].Name, Actions1[j].Bit); … … 570 582 571 583 } 572 }573 //DDrConsole_PrintF("Waiting...");584 // } 585 DDrConsole_PrintF("Waiting..."); 574 586 if ( 575 587 (( ONgGameState->Input.Current.Actions1 & Input1) == Input1) && 576 588 (( ONgGameState->Input.Current.Actions2 & Input2) == Input2) 577 ){ 589 ) 590 { 591 DDrConsole_PrintF("Found key!"); 578 592 } 579 593 else { … … 582 596 *dontuse1 = 1; 583 597 } 584 /* 585 __asm__( 586 "movl 0x10(%esp), %edx\n\t" 587 "movl $1,(%eax)\n\t" 588 ); 589 //ret->type = sl_void 590 */ return 0; 591 } 592 598 return 0; 599 } 600 601 602 uint16_t ONICALL bsl_sprintf(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) 603 { 604 char output[1024]; 605 char buffer[1024]; 606 int i; 607 char* placeinoutput = output; 608 char* placeininput = args[0].value_str32; 609 int formatnum = 0; 610 //fix the broken bsl numargs... 611 numargs = 0; 612 613 for(i = 0; args[i].type < sl_void; i++) 614 { 615 numargs++; 616 } 617 618 619 if (numargs < 1) 620 return 1; 621 622 while(1) 623 { 624 int size; 625 //s is the pointer to the args 626 char* s = strchr(placeininput , '%'); 627 //we didnt find a %, break! 628 if(!s) 629 { 630 strcpy(placeinoutput, placeininput); 631 break; 632 } 633 size = (int)s - (int)placeininput ; 634 //we found one, so copy the portion of string 635 636 637 638 memcpy( placeinoutput,placeininput, size); 639 placeininput += size; 640 placeinoutput += size; 641 642 memset( placeinoutput, '%', (int)pow(2, formatnum)); 643 placeinoutput += (int)pow(2, formatnum); 644 645 646 placeininput += 1; 647 *placeinoutput = 0; 648 formatnum++; 649 650 } 651 //strcpy( output, args[0].value_str32 ); 652 653 for(i = 1; i < numargs; i++) { 654 //sprintf(output, output, args[i].value_str32); 655 memcpy(buffer, output, 1024); 656 if(args[i].value == 0) break; 657 switch(args[i].type) 658 { 659 case sl_bool: 660 case sl_int32: 661 sprintf(output, buffer, args[i].value_int32); 662 break; 663 case sl_float: 664 //crashes oni, why? 665 // sprintf(output, output, args[i].value_float); 666 break; 667 case sl_str32: 668 sprintf(output, buffer, args[i].value_str32); 669 break; 670 case sl_void: 671 default: 672 break; 673 } 674 } 675 //output[32] = 0; 676 ret->value_str32 = output; 677 ret->type = sl_str32; 678 return 0; 679 } 680 681 //Sorry rossy, I broke this. FFI isnt in windows 593 682 /* 594 683 uint16_t ONICALL bsl_sprintf(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) 595 684 { 596 if (numargs < 2) 597 return 1; 598 599 char output[255]; 600 int i; 601 for(i = 1; i < numargs; i++) { 602 sprintf(output, args[0].value_str32, args[i].value_str32); 603 } 604 605 ret->value_str32 = output; 606 ret->type = sl_str32; 607 return 0; 608 } 609 */ 610 /* 611 uint16_t ONICALL bsl_sprintf(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) 612 { 613 if (numargs < 1 || args[0].type != sl_str32) 614 { 615 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); 616 return 0; 617 } 618 619 if (!args[0].value_str32) 620 args[0].value_str32 = ""; 621 622 int ffi_ret; 685 686 687 int ffi_ret; 623 688 char* str = NULL; 624 689 int size = 0; … … 627 692 ffi_type* ffi_args[256]; 628 693 void* values[256]; 694 int i; 695 numargs = 0; 696 for(i = 0; args[i].type <= sl_void; i++) 697 { 698 //DDrConsole_PrintF("%i", args[i].type ); 699 numargs++; 700 701 } 702 703 if (numargs < 1 || args[0].type != sl_str32) 704 { 705 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); 706 return 0; 707 } 708 709 if (!args[0].value_str32) 710 args[0].value_str32 = ""; 711 712 629 713 630 714 ffi_args[0] = &ffi_type_pointer; … … 633 717 values[1] = &size; 634 718 635 int i; 719 636 720 for(i = 2; i < numargs + 2; i ++) 637 721 { … … 654 738 if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, i, &ffi_type_sint32, ffi_args) != FFI_OK) 655 739 return 1; 656 ffi_call(&cif, (void*) snprintf, (void*)&ffi_ret, values);740 ffi_call(&cif, (void*)_snprintf, (void*)&ffi_ret, values); 657 741 str = malloc(ffi_ret + 1); 658 742 size = ffi_ret + 1; 659 ffi_call(&cif, (void*) snprintf, (void*)&ffi_ret, values);743 ffi_call(&cif, (void*)_snprintf, (void*)&ffi_ret, values); 660 744 ret->value_str32 = str; 661 745 ret->type = sl_str32; … … 777 861 void* TSFFTahoma; 778 862 int returnval; 779 780 863 TMrInstance_GetDataPtr( 'TSFF', "Tahoma", &TSFFTahoma); 781 864 returnval = TSrContext_New( TSFFTahoma, 7, 1, 1, 0, &TSrTest); … … 785 868 void SLrDaodan_Initalize() 786 869 { 787 //Calculating the value of the needed offset is much more reliable when the compiler does it for you.788 789 //TODO: fix moonshadow.790 Character * Chr = 0;791 792 int NoPath = (int)&(Chr[0].RegenHax) & 0x000000FF;793 794 795 796 const char regen_patch[] =797 {0x90, 0x90, 0x90, 0x90, 0x90, // mov al, _WPgRegenerationCheat798 0x90, 0x90, // test al, al799 0x90, 0x90, // jz short loc_51BB98800 0x8B, 0x86, (char)NoPath, 0x01};801 DDrPatch_Const(OniExe + 0x0011BB64, regen_patch);802 803 870 SLrConfig(); 804 871 … … 824 891 SLrScript_Command_Register_ReturnType("d_location","Returns the X, Y or Z coord of a character", "ai_name:string | script_id:int xyz:string [newlocation:float]", sl_float, bsl_location); 825 892 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); 826 SLrScript_Command_Register_Void("d_waitforkey","Waits for a keypress from the player", "key s", bsl_waitforkey);893 SLrScript_Command_Register_Void("d_waitforkey","Waits for a keypress from the player", "key:string", bsl_waitforkey); 827 894 828 895 //broken, only works for one damage type. … … 832 899 // SLrDaodan_Register_ReturnType("d_active","Returns a hex offset. ;)", "[ai_name:string | script_id:int]", sl_int32, bsl_getactiveoffset); 833 900 834 //SLrDaodan_Register_ReturnType("sprintf", "C-style sprintf.", "format:string arg1 arg2 ...", sl_str32, bsl_sprintf); 835 901 SLrScript_Command_Register_Void("sprintf", "C-style sprintf.", "", bsl_sprintf); 836 902 SLrScript_Command_Register_ReturnType("st", "prints to console in color", "text:string color1:int color2:int", sl_void, bsl_dprintcolored); 837 903 -
Daodan/MSVC/Daodan_Cheater.c
r567 r569 95 95 float cheat_oldheight2 = 135; 96 96 bool inc_fallingframes = true; 97 97 extern bool patch_bsl; 98 98 uint8_t ONICALL DDrCheater(uint32_t cheat) 99 99 { … … 250 250 return 1; 251 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 252 273 case cheat_tellmetheversion: 253 274 return 1; -
Daodan/MSVC/Daodan_Win32.c
r567 r569 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_OVERLAPPED, 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/MSVC/Daodan_WindowHack.h
r567 r569 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/MSVC/Flatline.c
r568 r569 219 219 return NetUDPServer_Listen(27777, FLrServer_PacketCallback); 220 220 } 221 221 222 222 223 RGBA green = {0, 0xFF, 0, 0}; … … 511 512 { 512 513 uint16_t i; 513 /*DDrConsole_PrintF("Current: %x %x | Start: %x %x | Stop: %x %x | Stopped %x %x",514 /*DDrConsole_PrintF("Current: %x %x | Start: %x %x | Stop: %x %x | Stopped %x %x", 514 515 ONgGameState->Input.Current.Actions1, ONgGameState->Input.Current.Actions2, 515 516 ONgGameState->Input.Start.Actions1,ONgGameState->Input.Start.Actions2, … … 519 520 */ 520 521 ActiveCharacter * Active_Player = ONgGameState->ActiveCharacters; 521 522 Active_Player->PhyContext->Rotation; 523 Active_Player->PhyContext->Position; 524 ONgGameState->PlayerCharacter->Position; 525 526 527 528 /* 529 if( ONgGameState->Input.MouseDeltaX != 0 || ONgGameState->Input.MouseDeltaY != 0 || 530 ONgGameState->Input.field_8 != 0 || ONgGameState->Input.field_C != 0 ) 531 532 DDrConsole_PrintF("%f %f | %f %f", 533 ONgGameState->Input.MouseDeltaX , ONgGameState->Input.MouseDeltaY, 534 ONgGameState->Input.field_8, ONgGameState->Input.field_C); 535 536 */ 522 537 //if sprint timer is equal to 0, display 0 523 538 //else if sprint timer is equal to -1, display -1 … … 565 580 player_data * data; 566 581 flatline_packet data_out = {0}; 582 583 //if( PlayerList[i]->Chr->Health == 0) PlayerList[i]->Chr->Health = PlayerList[i]->Chr->MaxHealth; 584 567 585 data_out.id = PLAYER_DATA; 568 586 data = (void*)&(data_out.data); … … 576 594 data->DesiredFacing = PlayerList[i]->Chr->DesiredFacing; 577 595 data->CosmeticFacing = PlayerList[i]->Chr->CosmeticFacing; 596 597 578 598 data->Position = Active_Player->PhyContext->Position; 579 599 … … 614 634 data->Inputs.Actions1 = ((GameState*)(ONgGameState))->Input.Current.Actions1; 615 635 data->Inputs.Actions2 = ((GameState*)(ONgGameState))->Input.Current.Actions2; 636 data->Inputs.MouseDeltaX = ONgGameState->Input.MouseDeltaX; 637 data->Inputs.MouseDeltaY = ONgGameState->Input.MouseDeltaY; 616 638 } 617 639 else{ 618 640 data->Inputs.Actions1 = PlayerList[i]->Actions1; 619 641 data->Inputs.Actions2 = PlayerList[i]->Actions2; 642 data->Inputs.MouseDeltaX = PlayerList[i]->MouseDeltaX; 643 data->Inputs.MouseDeltaY = PlayerList[i]->MouseDeltaY; 620 644 } 621 645 memcpy( &(PlayerList[i]->player_data), data, sizeof(player_data) ); … … 626 650 if( (server_started && i !=0) || (!server_started/* && i != client_slot*/) ) 627 651 { 628 //this just made sync even worse....maybe keystrokes are actually _behind_ 629 // 630 // 652 //this just made sync even worse... 631 653 #ifdef JITTER_FIX 632 654 input_struct * New_Input = &PlayerList[i]->MouseDeltaX; … … 656 678 Active_Input->MouseDeltaX = PlayerList[i]->MouseDeltaX; 657 679 Active_Input->MouseDeltaY = PlayerList[i]->MouseDeltaY; 658 DDrConsole_PrintF("Timer: %i", (Active_Player->SprintTimer != 0) ? (Active_Player->SprintTimer == -1) ? -1 : (ONgGameState->GameTime - Active_Player->SprintTimer) : 0);680 //DDrConsole_PrintF("Timer: %i", (Active_Player->SprintTimer != 0) ? (Active_Player->SprintTimer == -1) ? -1 : (ONgGameState->GameTime - Active_Player->SprintTimer) : 0); 659 681 660 682 //DDrConsole_PrintF("1E8 %u", ONgGameState->PlayerCharacter->field_1E8); … … 693 715 } 694 716 695 //Make the current controls match the sent controls, now that we have sent them off and everything is synced.696 //No, don't do it to the direct input, it breaks stuff.697 //Need to disable the function that puts game input onto characters because we are doing it directly.698 /*699 if( !server_started )700 {701 ONgGameState->Input.MouseDeltaX = PlayerList[client_slot]->MouseDeltaX;702 ONgGameState->Input.MouseDeltaY = PlayerList[client_slot]->MouseDeltaY;703 ONgGameState->Input.Current.Actions1 = PlayerList[client_slot]->Actions1;704 ONgGameState->Input.Current.Actions2 = PlayerList[client_slot]->Actions2;705 }706 */707 708 717 return ONgGameState; 709 718 } -
Daodan/MSVC/Flatline_BSL.c
r568 r569 114 114 return 0; 115 115 } 116 116 117 uint16_t ONICALL addfake(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) 117 118 { … … 121 122 return 0; 122 123 } 124 125 uint16_t ONICALL list_players(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) 126 { 127 int i; 128 for(i = 0; i++; i < MAX_PLAYERS) 129 { 130 if(PlayerList[i]) 131 { 132 DDrConsole_PrintF("%i %i | %s", i, PlayerList[i]->spawnnumber, PlayerList[i]->name); 133 } 134 } 135 return 0; 136 } 137 138 123 139 void SLrFlatline_Initialize() { 124 140 -
Daodan/MSVC/Oni_Symbols.c
r568 r569 170 170 DefVar( onibool, ai2_deaf, 0x005ec0c1 ); 171 171 172 DefVar( HINSTANCE, g_Instance, 0x00 51f9e4 );172 DefVar( HINSTANCE, g_Instance, 0x0061F9E4 ); 173 173 174 174 DefVar( gl_api_t*, gl_api, 0x00560604 );
Note:
See TracChangeset
for help on using the changeset viewer.