diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..bdb0cab --- /dev/null +++ b/.gitattributes @@ -0,0 +1,17 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Custom for Visual Studio +*.cs diff=csharp + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..23ec6ec --- /dev/null +++ b/.gitignore @@ -0,0 +1,185 @@ +################# +## Eclipse +################# + +*.pydevproject +.project +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.classpath +.settings/ +.loadpath + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# PDT-specific +.buildpath + + +################# +## Visual Studio +################# + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results + +[Dd]ebug/ +[Rr]elease/ +x64/ +build/ +[Bb]in/ +[Oo]bj/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.log +*.scc + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +*.ncrunch* +.*crunch*.local.xml + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.Publish.xml +*.pubxml + +# NuGet Packages Directory +## TODO: If you have NuGet Package Restore enabled, uncomment the next line +#packages/ + +# Windows Azure Build Output +csx +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Others +sql/ +*.Cache +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.[Pp]ublish.xml +*.pfx +*.publishsettings + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +App_Data/*.mdf +App_Data/*.ldf + +############# +## Windows detritus +############# + +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Mac crap +.DS_Store \ No newline at end of file diff --git a/HDC/CMDParser.cpp b/HDC/CMDParser.cpp new file mode 100644 index 0000000..23f597c Binary files /dev/null and b/HDC/CMDParser.cpp differ diff --git a/HDC/FileVersion.rc b/HDC/FileVersion.rc new file mode 100644 index 0000000..43253ee --- /dev/null +++ b/HDC/FileVersion.rc @@ -0,0 +1,103 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 2,3,0,0 + PRODUCTVERSION 2,3,0,0 + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x3L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "Halo Dev Controls.exe needs to be in the same folder in order for the commands and keyboard shortcuts to work." + VALUE "CompanyName", "Jesus7Freak" + VALUE "FileDescription", "HDC" + VALUE "FileVersion", "2, 3, 0, 0" + VALUE "InternalName", "HDC" + VALUE "LegalCopyright", "Copyright (C) 2011" + VALUE "OriginalFilename", "HDC.drv" + VALUE "ProductName", "Halo Dev Controls" + VALUE "ProductVersion", "2, 3, 0, 0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/HDC/HDC.vcproj b/HDC/HDC.vcproj new file mode 100644 index 0000000..ce85710 --- /dev/null +++ b/HDC/HDC.vcproj @@ -0,0 +1,277 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/HDC/HDC.vcxproj b/HDC/HDC.vcxproj new file mode 100644 index 0000000..e523481 --- /dev/null +++ b/HDC/HDC.vcxproj @@ -0,0 +1,134 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {4C15AA53-B95C-4E9B-8860-FB9CC3ACA247} + HDC + Win32Proj + 8.1 + + + + DynamicLibrary + v140_xp + false + Dynamic + MultiByte + true + + + DynamicLibrary + v140_xp + Unicode + + + + + + + + + + + + + <_ProjectFileVersion>14.0.25431.1 + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + + + + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;HDC_EXPORTS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + Level3 + EditAndContinue + + + true + true + Windows + MachineX86 + $(OutDir)$(TargetName).drv + + + + + Full + true + Speed + true + C:\Users\Jesus7Freak\Desktop\Programs\Halo Apps\Halo Dev Controls;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;HDC_EXPORTS;%(PreprocessorDefinitions) + true + MultiThreaded + false + true + Precise + + Level3 + ProgramDatabase + FastCall + CompileAsCpp + + + kernel32.lib;user32.lib + $(OutDir)$(TargetName).drv + true + Windows + true + true + MachineX86 + + + + + + + + + + + + false + + + false + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/HDC/HDC.vcxproj.filters b/HDC/HDC.vcxproj.filters new file mode 100644 index 0000000..e8616b2 --- /dev/null +++ b/HDC/HDC.vcxproj.filters @@ -0,0 +1,65 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/HDC/Hooks.cpp b/HDC/Hooks.cpp new file mode 100644 index 0000000..06d90ed --- /dev/null +++ b/HDC/Hooks.cpp @@ -0,0 +1,611 @@ +/******************************************************************************** + -- Halo Dev Controls + Copyright © 2011 Jesus7Freak + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +********************************************************************************* + File: Hooks.cpp + Project: HDC + Author: Jesus7Freak + Date: 11/22/2011 + Game: Halo and Halo Custom Edition + Version: all +*********************************************************************************/ +#include "dllmain.h" + +void HaloDrawText(char *msg_str, BYTE alpha, BYTE red, BYTE green, BYTE blue) +{ + float ARGB[4]; + ARGB[0] = (float)alpha / 255.0f; + ARGB[1] = (float)red / 255.0f; + ARGB[2] = (float)green / 255.0f; + ARGB[3] = (float)blue / 255.0f; + + __asm + { + LEA EAX,[ARGB] + PUSH msg_str + CALL DWORD PTR [EngineDrawText_address] + ADD ESP,4 + } +} + +//halo's limit is about 130 characters on screen +wchar_t HaloSay_server_buffer[SV_NAME_SIZE+SV_BUFFER_SIZE] = + {'*','*',' ','S','E','R','V','E','R',' ','*','*',' ',' '}; +//switchs between console messages and server messages +//based on wether or not console is open and cmd +//came from player 0 +void HaloSay(wchar_t *message, short to_player_index, ...) +{ + va_list arglist; + va_start(arglist, message); + + _vswprintf_s_l(&HaloSay_server_buffer[SV_NAME_SIZE], SV_BUFFER_SIZE, message, NULL, arglist); + //va_end(arglist); its not used in swprintf.c, so why do i need to? + + if (*ServerType != HOST || //ServerSay only works for server/hosts + to_player_index != -1 && players[to_player_index].IsLocalPlayer != -1 && *Console_chck) + { + wchar_t *HDT_msgW = &HaloSay_server_buffer[SV_NAME_SIZE]; + char *HDT_msgA = (char*)HDT_msgW; + + //convert the HaloSay_buffer to ansi + do *++HDT_msgA = (char)*++HDT_msgW; while (*HDT_msgW); + + //send console message + HaloDrawText((char*)&HaloSay_server_buffer[SV_NAME_SIZE], 255, 255, 255, 255); + } + else + { + //haloce already adds the "** SERVER **" part + //if (running_gt == haloce) message += SV_NAME_SIZE; + + CHAT_INFO chat_info; + if (to_player_index != -1) + { + chat_info.ChatType = Vehicle; + chat_info.From_PlayerIndex = (char)to_player_index; + } + else + { + chat_info.ChatType = Server; + // -1 when used with chat type 3 (server) in halo results in ** SERVER ** + chat_info.From_PlayerIndex = 0;//-1; + } + + chat_info.msg_str = HaloSay_server_buffer; + + ServerSay(chat_info, (char)to_player_index); + } +} + +void ServerSay(CHAT_INFO chat_info, char to_player) +{ + if (PrepMsg_func_address && SendMsgToPlayer_func_address && + ServerInfo_ptr_address && MsgInfo_ptr_address && SendMsgToAll_func_address) + { + //__asm ;client msg side + // { + // MOV EAX,1;//64E7ACh chat type + // // MOV EAX,DWORD PTR [EAX] + // PUSH player_index + // MOV EDX, Local_Buffer_84 + // MOV ECX, 004ADF70h + // CALL ECX + // ADD ESP,4 + // } + + __asm ;server msg side + { + LEA ECX,chat_info + PUSH ECX + MOV ECX,ESP + + MOV EDI,DWORD PTR[MsgInfo_ptr_address] + //push 1 + //pop esi + //mov esi,dword ptr[esp] + XOR EDX,EDX + PUSH EDX + PUSH 1 + PUSH EDX + PUSH ECX + PUSH EDX + PUSH 0Fh + PUSH EDX + + MOV EDX,7FF8h + MOV EAX,EDI + CALL DWORD PTR [PrepMsg_func_address] ;//build network packet + POP EDX ;//restore EDX as 0 + ADD ESP,1Ch + + MOV ECX,DWORD PTR [ServerInfo_ptr_address] + MOV ECX,DWORD PTR [ECX] + + TEST ECX,ECX + JNZ SHORT msg_ready + PUSH 9 + CALL DWORD PTR [Sleep] + TEST ECX,ECX + JE SHORT sv_chat_exit + msg_ready: + //use different function to send to everyone at once + MOVSX EBX,to_player + CMP EBX,-1 + JE SHORT send_msg_to_all + + PUSH 3 + PUSH 1 + PUSH EDX + PUSH 1 + PUSH EAX + PUSH EDI + PUSH 1 + + MOV ESI,ECX + MOVSX EAX,EBX ;//chat to player index + CALL DWORD PTR [SendMsgToPlayer_func_address] + ADD ESP,1Ch + + JMP SHORT sv_chat_exit + + send_msg_to_all: + PUSH 3 + PUSH 1 + PUSH EDX + PUSH 1 + PUSH EDI + PUSH 1 + + CALL DWORD PTR [SendMsgToAll_func_address] + ADD ESP,18h + + sv_chat_exit: + } + } +} + +//functions from mainform, +__declspec(noinline) BOOL __fastcall ckbx_rapid_fire_CheckedChanged(BYTE Checked) +{ + if (Checked != (BYTE)-1) + { + if (Checked == TOGGLE) + Checked = *(BYTE*)rapid_fire_hook_address == 0xD9; + + DWORD dwOldProtect; + if (VirtualProtect( + (LPVOID)rapid_fire_hook_address, + sizeof(DWORD), + PAGE_EXECUTE_READWRITE, + &dwOldProtect)) + { + if (Checked) + *(DWORD*)rapid_fire_hook_address = 0xD9909090; + else + *(DWORD*)rapid_fire_hook_address = 0xD91047D9; + + VirtualProtect( + (LPVOID)rapid_fire_hook_address, + sizeof(DWORD), + dwOldProtect, + &dwOldProtect); + } + } + return *(BYTE*)rapid_fire_hook_address == 0x90; +} + +__declspec(noinline) BOOL __fastcall ckbx_time_freeze_CheckedChanged(BYTE Checked) +{ + if (Checked != (BYTE)-1) + { + if (Checked == TOGGLE) + Checked = *(BYTE*)time_freeze_hook_address == 0x74; + + DWORD dwOldProtect; + if (VirtualProtect( + (LPVOID)time_freeze_hook_address, + sizeof(WORD), + PAGE_EXECUTE_READWRITE, + &dwOldProtect)) + { + if (Checked) + *(WORD*)time_freeze_hook_address = 0x3975; + else + *(WORD*)time_freeze_hook_address = 0x2A74; + + VirtualProtect( + (LPVOID)time_freeze_hook_address, + sizeof(WORD), + dwOldProtect, + &dwOldProtect); + } + } + return *(BYTE*)time_freeze_hook_address == 0x75; +} + +__declspec(noinline) BOOL __fastcall ckbx_grav_boots_CheckedChanged(BYTE Checked) +{ + DWORD number_address = grav_boots_hook_address - 7; + DWORD jmp_to_address = grav_boots_hook_address - 0xD; + + if (Checked != (BYTE)-1) + { + if (Checked == TOGGLE) + Checked = *(DWORD*)number_address != 0x00000242; + + + //on find this -> 0x00560E70: eax,[eax+000002F4] + //mov [eax+000002F4],00000242 + //jmp 00560E76 + + //off + //mov [eax+000002F4],00000202 + //jmp 00560E76 + + DWORD dwOldProtect; + if (VirtualProtect((LPVOID)jmp_to_address, 19, PAGE_EXECUTE_READWRITE, &dwOldProtect)) + { + if (*(BYTE*)(grav_boots_hook_address - 3) != 0xEB) + { + BYTE *code_cave = (BYTE*)jmp_to_address; + + //mov [eax+000002F4],00000202 + code_cave[0] = 0xC7; + code_cave[1] = 0x80; + code_cave[2] = 0xF4; + code_cave[3] = 0x02; + code_cave[4] = 0x00; + code_cave[5] = 0x00; + code_cave[6] = 0x02; + code_cave[7] = 0x02; + code_cave[8] = 0x00; + code_cave[9] = 0x00; + //jmp + code_cave[10] = 0xEB; + code_cave[11] = 0x07; + + BYTE *jmp_to_code_cave = (BYTE*)grav_boots_hook_address; + jmp_to_code_cave[0] = 0xEB; + jmp_to_code_cave[1] = 0xF1; + jmp_to_code_cave[2] = 0x90; + jmp_to_code_cave[3] = 0x90; + jmp_to_code_cave[4] = 0x90; + jmp_to_code_cave[5] = 0x90; + } + + if (Checked) + *(DWORD*)number_address = 0x00000242; + else + *(DWORD*)number_address = 0x00000202; + + VirtualProtect((LPVOID)jmp_to_address, 19, dwOldProtect, &dwOldProtect); + } + } + return *(DWORD*)number_address == 0x00000242; +} + +__declspec(noinline) BOOL __fastcall ckbx_vehicle_ntr_CheckedChanged(BYTE Checked) +{ + if (Checked != (BYTE)-1) + { + if (Checked == TOGGLE) + Checked = *(BYTE*)vehicle_ntr_hook_address == 0x74; + + + DWORD dwOldProtect; + if (VirtualProtect( + (LPVOID)vehicle_ntr_hook_address, + sizeof(BYTE), + PAGE_EXECUTE_READWRITE, + &dwOldProtect)) + { + if (Checked) + *(BYTE*)vehicle_ntr_hook_address = 0xEB; + else + *(BYTE*)vehicle_ntr_hook_address = 0x74; + + VirtualProtect( + (LPVOID)vehicle_ntr_hook_address, + sizeof(BYTE), + dwOldProtect, + &dwOldProtect); + } + } + return *(BYTE*)vehicle_ntr_hook_address == 0xEB; +} + +__declspec(noinline) bool __stdcall MV_chkBx_CheckedChanged(int number) +{ + bool succeded = false; + + float fnum; + if (number == 2) fnum = 0; + else fnum = 2; + + __asm + { + MOV ECX,number + MOV EDX,DWORD PTR [cinematic_ptr] + MOV EDX,DWORD PTR [EDX] + TEST EDX,EDX + JE SHORT cin_failed + TEST ECX,ECX + JE SHORT cin_stop + CMP BYTE PTR [EDX+38h],0 + JNZ SHORT skip_cin_start + + MOV ECX,0Eh + XOR EAX,EAX + MOV EDI,EDX + REP STOS DWORD PTR [EDI] + MOV BYTE PTR DS:[EDX+39h],1 + MOV BYTE PTR [EDX+38h],1 + + skip_cin_start: + MOV EAX,fnum + PUSH EAX + PUSH 2 + CALL DWORD PTR [cse_set_video_func_address] + ADD ESP,8 + JMP SHORT cin_succeded + + cin_stop: + MOV BYTE PTR [EDX+38h],0 + + cin_succeded: + MOV succeded,1 + + cin_failed: + } + return succeded; +} + +void __declspec(naked) ConsoleHook() +{ //save ebx,edi,ebp + __asm//EDI has *console_str, EDX has console_str_length, but not for rcon + { + //if (*console_str == '/') + CMP BYTE PTR [EDI],2Fh + JNE SHORT jmp_to_console + + INC EDI + + MOV EBX,80h + SUB ESP,EBX ;//space to convert str to unicocde + + XOR EAX,EAX + SHR EBX,1 + + console_bufferw_loop: + MOVSX CX,BYTE PTR [EDI+EAX] + MOV WORD PTR [ESP+EAX*2],CX + INC EAX + ;//i < 40h * sizeof(whar_t) + CMP EAX,EBX + JGE SHORT console_bufferqw_limit_reached + ;//console_str[i] + TEST CX,CX + JNZ SHORT console_bufferw_loop + console_bufferqw_limit_reached: + DEC EDI + SHL EBX,1 + + MOV EDX,EBP ;//EBP contains player index + MOV ECX,ESP + //EDX + //ECX + CALL CMDParser + + ADD ESP,EBX + + TEST EAX,EAX + JNZ SHORT RememberConsoleCmd + + jmp_to_console: + JMP DWORD PTR [Console_func_address] + + RememberConsoleCmd: + //haloce1.09 console@004C9F92 to 004CA00C + MOV ESI,[C_BuffersIndex_address] + MOVSX EAX,WORD PTR DS:[ESI] + INC EAX + AND EAX,0x80000007 + JNS SHORT jmp_unused_code + + DEC EAX + OR EAX,0xFFFFFFF8 + INC EAX + jmp_unused_code: + + MOV WORD PTR [ESI],AX + MOVSX EAX,AX + IMUL EAX,EAX,0xFF + MOV EDX,EDI + + ADD EAX,DWORD PTR [C_Buffers_address] + LEA ESP,DWORD PTR [ESP] + XOR EBX,EBX + + copy_str_loop: + MOV CL,BYTE PTR [EDX] + INC EDX + MOV BYTE PTR [EAX],CL + INC EAX + CMP CL,BL ;//BL needs to be 0 + JNZ SHORT copy_str_loop + + MOVSX EAX,WORD PTR [ESI-02] + INC EAX + CMP EAX,8 + MOV WORD PTR [ESI-02],8 + JG SHORT jmp_c_limit_mov + MOV WORD PTR [ESI-02],AX + jmp_c_limit_mov: + + MOV WORD PTR [ESI+02],0xFFFF + MOV AL,1 + RETN + } +} + +void __declspec(naked) ChatHook() +{ + __asm + { + //WORD PTR [EAX+0Ch] = player index + //DWORD PTR [ESP+14h] = "Message" + //DWORD PTR [ESP+0Ch] = chat type (0=global 1=team 2=vehicle 3=server) + + MOV ECX,DWORD PTR [ESP+14h] + MOV EDX,DWORD PTR [ESP+0Ch] + + ;// test for cmd / + CMP WORD PTR [ECX],2Fh + JNE SHORT msg_cmb_func + + ;//one less character to test + INC ECX + INC ECX + + ;// global only cmds + TEST EDX,EDX ;//Global + JNZ SHORT msg_cmb_func + + //player index + MOVSX EDX,WORD PTR [EAX+0Ch] + + PUSH EAX;//save EAX for the jmp to func + + //edx + //ecx + CALL CMDParser + + MOV ECX,EAX + POP EAX + + ;//cmds have the option to silent the chat cmd message + TEST CH,CH ;//DO_NOT_SEND_MSG + JNZ SHORT ch_ret + + msg_cmb_func: + //returned address already pushed so instead of calling it, we'll jmp to it; + JMP DWORD PTR [PlayerCheck_Func_address] + + ch_ret: + RETN + } +} + +bool __cdecl hstr_cmp(char *str1, char *str2, int length) +{ + bool match = true; + if (length >= 0) + { + //specific length comparison + for (int i = 0; i < length; i++) + { + if (str1[i] != str2[i]) + { + match = false; + break; + } + } + } + return match; +} + +void __declspec(naked) ConsoleTablistHook() +{ + //available registers: + //EAX misc + //ECX console str + //EDX index so far | cmd str + //EBX console str size + //EBP array pointer + //ESI array index ptr + //EDI cmd str index + __asm + { + MOV ECX,DWORD PTR [ctl_filter_str_ptr_address] + MOV ECX,DWORD PTR [ECX] ;//should be console str + CMP BYTE PTR [ECX],2Fh ;//all the custom cmds have '/' + JNE SHORT exit_ctl_hook + + //custom cmds shouldn't go over 256 (array limit) + MOV ESI,DWORD PTR [ctl_array_size_address] + MOVSX ESI, WORD PTR [ESI] + CMP DX,SI ;//array size >= index? + JGE SHORT exit_ctl_hook + + MOV ESI,DWORD PTR [ctl_array_index_address] + + //copy and get length of console str + MOV EBX,ECX + LEA EDI,DWORD PTR [ECX+1] + loop_str_length: + MOV AL,BYTE PTR [EBX] + INC EBX + TEST AL,AL + JNZ SHORT loop_str_length + SUB EBX,EDI + + XOR EDI,EDI + PUSH EDI ;//finished looping when EPS points to 0 + + PUSH PLAYER_CMDS_SIZE*4 + PUSH OFFSET CMDsLib::player_cmd_strs + + PUSH RPGB_CMDS_SIZE*4 + PUSH OFFSET CMDsLib::rpg_beta6_2_cmd_strs + + PUSH HALO_CMDS_SIZE*4 + PUSH OFFSET CMDsLib::halo_cmd_strs + + cmd_strs_loop: + MOV EDX,DWORD PTR [ESP] + MOV EDX,DWORD PTR [EDX+EDI] + PUSH EBX//length + PUSH ECX//str + PUSH EDX//str + CALL hstr_cmp//__cdecl filter cmds + POP EDX;//restore EDX + POP ECX;//restore ECX + POP EBX ;//faster than ADD ESP,4 + TEST AL,AL + JE SHORT no_match + + MOVSX EAX,WORD PTR [ESI] ;//array index + MOV DWORD PTR [EBP+EAX*4],EDX ;//copy to array + INC EAX + MOV WORD PTR [ESI],AX ;//store index + + no_match: + ADD EDI,4 + CMP EDI,DWORD PTR [ESP+4] + JL SHORT cmd_strs_loop + + XOR EDI,EDI ;//reset counter + POP EAX ;//ADD ESP,8 + POP EAX + CMP DWORD PTR [ESP],EDI + JNZ SHORT cmd_strs_loop + POP EAX ;//ADD ESP,4 + + exit_ctl_hook: + JMP DWORD PTR [console_tablist_hookfunc_address] + } +} diff --git a/HDC/dllmain - old.cpp b/HDC/dllmain - old.cpp new file mode 100644 index 0000000..e4bab8b --- /dev/null +++ b/HDC/dllmain - old.cpp @@ -0,0 +1,1891 @@ +/******************************************************************************** + -- Halo Dev Controls + Copyright © 2011 Jesus7Freak + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +********************************************************************************* + File: dllmain - old.cpp + Project: HDC + Author: Jesus7Freak + Date: 11/22/2011 + Game: Halo and Halo Custom Edition + Version: all +*********************************************************************************/ +#include "targetver.h" +#include "HaloLib.h" +#include "cmds.h" +#include "tele_loc_resources.h" + +using namespace ReadWriteMemoryTools; + +#define LOCATIONS_FILE_NAME L"locations.bin" + +struct CMD_SK_ENABLED +{ + BOOL halo_Enable_Shrtcts; + BOOL rpgb62_Enable_Shrtcts; +}; + +struct DLL_ADDRESSES +{ + char find_me_str[12];//set to "dll_st_addrs" + CMD_SCKEYS **halo_cmd_keys; + CMD_SCKEYS **rpgb62_cmd_keys; + CMD_SK_ENABLED *cmd_sk_enabled; + wchar_t *CurrentDir; + bool locations_changed; +}; + +CMD_SK_ENABLED dll_sk_enabled = {0}; + +CMD_DATA halo_cmd_data[HALO_CMDS_SIZE] = +{ + { NULL, false, false },//0 + { NULL, true, false },//1 + { NULL, false, true },//2 + { NULL, false, true },//3 + { NULL, false, false },//4 + { NULL, false, false },//5 + { NULL, false, false },//6 + { NULL, false, true },//7 + { NULL, false, true },//8 + { NULL, false, true },//9 + { NULL, false, true },//10 + { NULL, false, false },//11 + { NULL, false, true },//12 + { NULL, false, true },//13 + { NULL, false, false },//14 + { NULL, false, false },//15 + { NULL, false, false },//16 + { NULL, false, false },//17 + { NULL, false, false },//18 + { NULL, false, true },//19 + { NULL, false, false },//20 + { NULL, false, false },//21 + { NULL, false, false },//22 + { NULL, false, false }//23 +}; +CMD_STRS halo_cmd_strs[HALO_CMDS_SIZE] = +{ + {L"", L"/console 1;", L"/console 0;"},//0 + {L"", L"/dev 1;", L"/dev 0;"},//1 + {L"", L"/deathless 1;", L"/deathless 0;"},//2 + {L"", L"/infammo 1;", L"/infammo 0;"},//3 + {L"", L"/bottomless 1;", L"/bottomless 0;"},//4 + {L"", L"/hud 1;", L"/hud 0;"},//5 + {L"", L"/letterbox 1;", L"/letterbox 0;"},//6 + {L"", L"/ejection 1;", L"/ejection 0;"},//7 + {L"", L"/one shot 1;", L"/one shot 0;"},//8 + {L"", L"/no fall damage 1;", L"/no fall damage 0;"},//9 + {L"", L"/possess 1;", L"/possess 0;"},//10 + {L"", L"/super jump 1;", L"/super jump 0;"},//11 + {L"", L"/reflex damage 1;", L"/reflex damage 0;",},//12 + {L"", L"/medusa 1;", L"/medusa 0;"},//13 + {L"", L"/controller 1;", L"/controller 0;"},//14 + {L"", L"/wireframe 1;", L"/wireframe 0;"},//15 + {L"", L"/fog 1;", L"/fog 0;"},//16 + {L"", L"/fogplane 1;", L"/fogplane 0;"},//17 + {L"", L"/fps 1;", L"/fps 0;"},//18 + {L"/game_speed #;", L"", L""},//19 + {L"", L"/rapid_fire 1;", L"/rapid_fire 0;"},//20 + {L"", L"/time_freeze 1;", L"/time_freeze 0;"},//21 + {L"", L"/grav_boots 1;", L"/grav_boots 0;"},//22 + {L"", L"/vehicle_str 1;", L"/vehicle_str 0;"}//23 +}; +//data that can be written to file +CMD_SCKEYS halo_cmd_keys[HALO_CMDS_SIZE] = +{ + {0, 0, 0},//0 + {0, 33, 34},//1 + {97, 0, 0},//2 + {98, 0, 0},//3 + {0, 0, 0},//4 + {99, 0, 0},//5 + {100, 0, 0},//6 + {101, 0, 0},//7 + {0, 0, 0},//8 + {0, 0, 0},//9 + {0, 0, 0},//10 + {0, 0, 0},//11 + {0, 0, 0},//12 + {0, 0, 0},//13 + {0, 0, 0},//14 + {0, 0, 0},//15 + {0, 0, 0},//16 + {0, 0, 0},//17 + {0, 0, 0},//18 + {-1, -1, -1},//19 + {111, 0, 0},//20 + {106, 0, 0},//21 + {109, 0, 0},//22 + {0, 0, 0}//23 +}; + +CMD_DATA rpg_beta6_2_cmd_data[RPGB_CMDS_SIZE] = +{ + { NULL, true, true },//0 + { NULL, true, true },//1 + { NULL, true, true },//2 + { NULL, true, true },//3 + { NULL, true, true },//4 + { NULL, true, true }//5 +}; +CMD_STRS rpg_beta6_2_cmd_strs[RPGB_CMDS_SIZE] = +{ + {L"/day;", L"/rain;", L"/night;"},//0 + {L"", L"/alarm 1;", L"/alarm 0;"},//1 + {L"/start lockdown;", L"", L""},//2 + {L"/fire halo;", L"", L""},//3 + {L"/lockdown timer #;", L"", L""},//4 + {L"/halo timer #;", L"", L""}//5 +}; +CMD_SCKEYS rpg_beta6_2_cmd_keys[RPGB_CMDS_SIZE] = +{ + {102, -1, -1},//0 + {103, 0, 0},//1 + {104, -1, -1},//2 + {105, -1, -1},//3 + {-1, -1, -1},//4 + {-1, -1, -1}//5 +}; + +HANDLE hHDC_thread = NULL; +bool exit_thread = false; + +#define MAIN_MENU 0 +#define CLIENT 1 +#define HOST 2 +WORD *ServerType = NULL; + +HaloCE_lib::DATA_HEADER *Players_Table_Header, + *Device_Groups_Header, + *Object_Table_Header, + *HS_Global_Header; + +HaloCE_lib::STATIC_PLAYER *players = NULL; +HaloCE_lib::OBJECT_TABLE_ARRAY *objects = NULL; + +DWORD Chat_address = NULL, + Current_Map_address = NULL, + Cheats_address = NULL, + Base_ptr_address = NULL, + chat_address_ptr = NULL, + Rasterizer_address = NULL, + EngineDrawText_address = NULL, + Console_func_address = NULL, + HaloLocal_Chat_Func_address = NULL, + sv_say_func_address = NULL, + dwTemp = NULL; + +bool *Console_chck = NULL; +char *Console_txt = NULL; + +std::vector maps_tele_sites; +DLL_ADDRESSES dll_addresses = {{'d','l','l','_','s','t','_','a','d','d','r','s'}}; + +bool IsKeyDown(int keyCode) +{ + short result = ::GetAsyncKeyState(keyCode); + return (result < 0); +} + +void PressKey(BYTE key, short times) +{ + for (short i = 0; i < times; i++) + { + ::Sleep(150); + ::keybd_event(key, 0x1C, 0, NULL); + ::Sleep(150); + ::keybd_event(key, 0x1C, KEYEVENTF_KEYUP, NULL); + } +} + +bool ParseCMDStrPlayers(wchar_t *cmd_str, short* player_index_array, int &pi_found) +{ + //c string length + int chat_length = 0; do chat_length++; while(cmd_str[chat_length]); + int max_players_to_find; + + if (pi_found != 0) + { + max_players_to_find = pi_found; + pi_found = 0; + } + else + max_players_to_find = Players_Table_Header->NumOfItems; + + if (cmd_str[0] == '\"') + { + int new_length = 0; while(cmd_str[new_length + 1] != '\"' && new_length < chat_length - 2) new_length++; + chat_length = new_length; + cmd_str = &cmd_str[1];// new_length); + } + + for (int pi = 0; pi < Players_Table_Header->NumOfItems && pi_found < max_players_to_find; pi++) + { + //static_player = Players_Table_Header->ItemArray_ptr + (pi * Players_Table_Header->ItemSize); + //Halo_Process->ReadMemArray((LPVOID)(static_player + 0x4), *player_name, HaloCE_lib::PlayerNameMaxSize); + + for (int i = 0; i < chat_length && i < HaloCE_lib::PlayerNameMaxSize; i++) + { + + if (cmd_str[i] != '*' && cmd_str[i] != '?' && cmd_str[i] != players[pi].PlayerName0[i]) + break; + + if (cmd_str[i] == '*' || !players[pi].PlayerName0[i + 1]) + { + player_index_array[pi_found++] = pi; + break; + } + } + } + + + return pi_found > 0; +} + +inline DWORD GetObj(short obj_index) +{ + DWORD obj_address = NULL; + if(obj_index != -1) + obj_address = objects[obj_index].Object_ptr; + + return obj_address; +} + +inline HaloCE_lib::SPARTAN* GetPlayerObj(short player_index) +{ + return (HaloCE_lib::SPARTAN*)GetObj(players[player_index].ObjectIndex); +} + +inline HaloCE_lib::VEHICLE_OBJECT* GetPlayerVehObj(HaloCE_lib::SPARTAN* player_obj) +{ + HaloCE_lib::VEHICLE_OBJECT *veh_obj_address = NULL; + if (player_obj->VehicleIndex != -1) + veh_obj_address = (HaloCE_lib::VEHICLE_OBJECT*)GetObj(player_obj->VehicleIndex); + + return veh_obj_address; +} +inline bool KillPlayer(short player_index) +{ + bool succeded = false; + HaloCE_lib::SPARTAN *player_object = GetPlayerObj(player_index); + + if(player_object) + { + player_object->KillPlayer = 0x20; + succeded = true; + } + + return succeded; +} + +void HaloDrawText(char *msg_str, BYTE alpha, BYTE red, BYTE green, BYTE blue) +{ + float *argb_ptr, ARGB[4] = {0}; + argb_ptr = (float*)&ARGB; + ARGB[0] = (float)alpha / (float)255; + ARGB[1] = (float)red / (float)255; + ARGB[2] = (float)green / (float)255; + ARGB[3] = (float)blue / (float)255; + + __asm + { + MOV EAX,argb_ptr + PUSH msg_str + CALL EngineDrawText_address + ADD ESP,4 + } +} + +void Console(char *func_str, int Unknown = 0) +{ + __asm + { + PUSH Unknown + MOV EDI,func_str + CALL Console_func_address + ADD ESP,4 + } +} +void consolejpmp() +{ + + __asm + { + + CALL Console_func_address + //JMP 0x004C9BE3 + } +} +void Local_Chat(wchar_t *message) +{ + __asm + { + PUSH message + CALL HaloLocal_Chat_Func_address + ADD ESP,4 + } +} +void sv_say(char *message) +{ + __asm + { + MOV ECX,message + CALL sv_say_func_address + } +} + +//functions from mainform, +#define TOGGLE 2 +void ckbx_rapid_fire_CheckedChanged(BYTE Checked) +{ + if (Checked == TOGGLE) + { + if (*(BYTE*)halo_cmd_data[20].cmd_address == 0xD9) + Checked = true; + else + Checked = false; + } + + DWORD dwOldProtect = NULL; + ::VirtualProtect((LPVOID)halo_cmd_data[20].cmd_address, sizeof(DWORD), PAGE_EXECUTE_READWRITE, &dwOldProtect); + + if (Checked) + *(DWORD*)halo_cmd_data[20].cmd_address = 0xD9909090; + else + *(DWORD*)halo_cmd_data[20].cmd_address = 0xD91047D9; + + ::VirtualProtect((LPVOID)halo_cmd_data[20].cmd_address, sizeof(DWORD), dwOldProtect, &dwOldProtect); +} +void ckbx_time_freeze_CheckedChanged(BYTE Checked) +{ + if (Checked == TOGGLE) + { + if (*(BYTE*)halo_cmd_data[21].cmd_address == 0x74) + Checked = true; + else + Checked = false; + } + + DWORD dwOldProtect = NULL; + ::VirtualProtect((LPVOID)halo_cmd_data[21].cmd_address, sizeof(WORD), PAGE_EXECUTE_READWRITE, &dwOldProtect); + + if (Checked) + *(WORD*)halo_cmd_data[21].cmd_address = 0x3975; + else + *(WORD*)halo_cmd_data[21].cmd_address = 0x2A74; + + ::VirtualProtect((LPVOID)halo_cmd_data[21].cmd_address, sizeof(WORD), dwOldProtect, &dwOldProtect); +} +void ckbx_grav_boots_CheckedChanged(BYTE Checked) +{ + DWORD number_address = halo_cmd_data[22].cmd_address - 7; + DWORD jmp_to_address = halo_cmd_data[22].cmd_address - 0xD; + + if (Checked == TOGGLE) + { + if (*(DWORD*)number_address == 0x00000242) + Checked = false; + else + Checked = true; + } + + //on find this -> 0x00560E70: eax,[eax+000002F4] + //mov [eax+000002F4],00000242 + //jmp 00560E76 + + //off + //mov [eax+000002F4],00000202 + //jmp 00560E76 + + DWORD dwOldProtect = NULL; + ::VirtualProtect((LPVOID)jmp_to_address, 19, PAGE_EXECUTE_READWRITE, &dwOldProtect); + + if (*(BYTE*)(halo_cmd_data[22].cmd_address - 3) != 0xEB) + { + BYTE *code_cave = (BYTE*)jmp_to_address; + + //mov [eax+000002F4],00000202 + code_cave[0] = 0xC7; + code_cave[1] = 0x80; + code_cave[2] = 0xF4; + code_cave[3] = 0x02; + code_cave[4] = 0x00; + code_cave[5] = 0x00; + code_cave[6] = 0x02; + code_cave[7] = 0x02; + code_cave[8] = 0x00; + code_cave[9] = 0x00; + //jmp + code_cave[10] = 0xEB; + code_cave[11] = 0x07; + + BYTE *jmp_to_code_cave = (BYTE*)halo_cmd_data[22].cmd_address; + jmp_to_code_cave[0] = 0xEB; + jmp_to_code_cave[1] = 0xF1; + jmp_to_code_cave[2] = 0x90; + jmp_to_code_cave[3] = 0x90; + jmp_to_code_cave[4] = 0x90; + jmp_to_code_cave[5] = 0x90; + } + + if (Checked) + *(DWORD*)number_address = 0x00000242; + else + *(DWORD*)number_address = 0x00000202; + + ::VirtualProtect((LPVOID)jmp_to_address, 19, dwOldProtect, &dwOldProtect); +} +void ckbx_vehicle_ntr_CheckedChanged(BYTE Checked) +{ + if (Checked == TOGGLE) + { + if (*(BYTE*)halo_cmd_data[23].cmd_address == 0x74) + Checked = true; + else + Checked = false; + } + + DWORD dwOldProtect = NULL; + ::VirtualProtect((LPVOID)halo_cmd_data[23].cmd_address, sizeof(BYTE), PAGE_EXECUTE_READWRITE, &dwOldProtect); + + if (Checked) + *(BYTE*)halo_cmd_data[23].cmd_address = 0xEB; + else + *(BYTE*)halo_cmd_data[23].cmd_address = 0x74; + + ::VirtualProtect((LPVOID)halo_cmd_data[23].cmd_address, sizeof(BYTE), dwOldProtect, &dwOldProtect); +} + +DWORD WINAPI HDC_thread(LPVOID hModule) +{ + dll_addresses.halo_cmd_keys = (CMD_SCKEYS**)&halo_cmd_keys; + dll_addresses.rpgb62_cmd_keys = (CMD_SCKEYS**)&rpg_beta6_2_cmd_keys; + dll_addresses.cmd_sk_enabled = &dll_sk_enabled; + dll_addresses.locations_changed = true; + + DWORD base_address = NULL, + scan_size = NULL; + + bool display_txt = true, + erase_chat = false, + erase_cmd_terminator = false; + + int chat_Length = 0; + + char *Current_Map_Str = NULL; + wchar_t chat[CMD_STR_SIZE] = {0}; + + enum HALO_TYPE { halo = 0, haloce = 1} running_gt; + if (ReadWriteMemoryTools::RWMemory::IsProcessOpenA("halo.exe")) + running_gt = halo; + else if (ReadWriteMemoryTools::RWMemory::IsProcessOpenA("haloce.exe")) + running_gt = haloce; + + DWORD hHalo = (DWORD)::GetModuleHandleA(NULL); + IMAGE_DOS_HEADER *IDH = (IMAGE_DOS_HEADER*)hHalo; + IMAGE_NT_HEADERS *INH = (IMAGE_NT_HEADERS*)(hHalo + IDH->e_lfanew); + base_address = (DWORD)hHalo + INH->OptionalHeader.BaseOfCode; + scan_size = INH->OptionalHeader.SizeOfCode; + + + //find patterns + //halo functions + EngineDrawText_address = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::EngineDrawText_func_addr_sig); + + Console_func_address = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Console_func_addr_sig); + + HaloLocal_Chat_Func_address = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Local_Chat_func_addr_sig); + + if (running_gt == haloce) + sv_say_func_address = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HCE_Lib::sv_say_func_addr_sig); + + //halo DATA_HEADER's + dwTemp = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Players_Table_Header_ptr_sig); + + if (dwTemp < 50) + HaloDrawText("Players_Table_Header_ptr_sig failed", 255, 255, 0, 0); + else + { + DWORD Players_Table_Header_ptr_address = *(DWORD*)dwTemp; + //wait for halo to load + while(*(DWORD*)Players_Table_Header_ptr_address == NULL) + Sleep(100); + + Players_Table_Header = (HaloCE_lib::DATA_HEADER*)*(DWORD*)Players_Table_Header_ptr_address; + players = (HaloCE_lib::STATIC_PLAYER*)Players_Table_Header->ItemArray_ptr; + } + + dwTemp = NULL; + dwTemp = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Device_Groups_Header_ptr_sig); + + if (dwTemp < 50) + HaloDrawText("Device_Groups_Header_ptr_sig failed", 255, 255, 0, 0); + else + Device_Groups_Header = (HaloCE_lib::DATA_HEADER*)**(DWORD**)dwTemp; + + dwTemp = NULL; + dwTemp = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Object_Table_Header_ptr_sig); + + if (dwTemp < 50) + HaloDrawText("Object_Table_Header_ptr_sig failed", 255, 255, 0, 0); + else + { + Object_Table_Header = (HaloCE_lib::DATA_HEADER*)**(DWORD**)dwTemp; + objects = (HaloCE_lib::OBJECT_TABLE_ARRAY*)Object_Table_Header->ItemArray_ptr; + } + + dwTemp = NULL; + dwTemp = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::HS_Global_Header_ptr_sig); + + if (dwTemp < 50) + HaloDrawText("HS_Global_Header_ptr_sig failed", 255, 255, 0, 0); + else + HS_Global_Header = (HaloCE_lib::DATA_HEADER*)**(DWORD**)dwTemp; + + + //global vars + if (running_gt == haloce) + { + dwTemp = NULL; + dwTemp = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HCE_Lib::Dev_addr_sig); + + if (dwTemp < 50) + HaloDrawText("Dev_addr_sig failed", 255, 255, 0, 0); + else + halo_cmd_data[1].cmd_address = *(DWORD*)dwTemp; + } + + dwTemp = NULL; + dwTemp = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Console_addr_sig); + + if (dwTemp < 50) + HaloDrawText("Console_addr_sig failed", 255, 255, 0, 0); + else + { + Console_chck = (bool*)*(DWORD*)dwTemp; + halo_cmd_data[0].cmd_address = (DWORD)Console_chck + HaloCE_lib::Console::Enabled_offset; + Console_txt = (char*)((DWORD)Console_chck + HaloCE_lib::Console::Text_offset); + } + + dwTemp = NULL; + dwTemp = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Current_map_addr_sig); + + if (dwTemp < 50) + HaloDrawText("Current_map_addr_sig failed", 255, 255, 0, 0); + else + Current_Map_Str = (char*)*(DWORD*)dwTemp; + + dwTemp = NULL; + dwTemp = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Cheats_addr_sig); + + if (dwTemp < 50) + HaloDrawText("Cheats_addr_sig failed", 255, 255, 0, 0); + else + { + Cheats_address = *(DWORD*)dwTemp; + + halo_cmd_data[2].cmd_address = Cheats_address + HaloCE_lib::Cheats::Deathless_offset; + halo_cmd_data[3].cmd_address = Cheats_address + HaloCE_lib::Cheats::Infinite_Ammo_offset; + halo_cmd_data[4].cmd_address = Cheats_address + HaloCE_lib::Cheats::Bottomless_Clip_offset; + halo_cmd_data[8].cmd_address = Cheats_address + HaloCE_lib::Cheats::Omnipotent_offset; + halo_cmd_data[9].cmd_address = Cheats_address + HaloCE_lib::Cheats::JetPack_offset; + halo_cmd_data[10].cmd_address = Cheats_address + HaloCE_lib::Cheats::Bmp_Possession_offset; + halo_cmd_data[11].cmd_address = Cheats_address + HaloCE_lib::Cheats::Super_jmp_offset; + halo_cmd_data[12].cmd_address = Cheats_address + HaloCE_lib::Cheats::Reflexive_damage_offset; + halo_cmd_data[13].cmd_address = Cheats_address + HaloCE_lib::Cheats::Medusa_offset; + halo_cmd_data[14].cmd_address = Cheats_address + HaloCE_lib::Cheats::Controller_offset; + } + + dwTemp = NULL; + dwTemp = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Base_ptr_addr_sig); + + if (dwTemp < 50) + HaloDrawText("Base_ptr_addr_sig failed", 255, 255, 0, 0); + else + Base_ptr_address = *(DWORD*)dwTemp; + + + dwTemp = NULL; + dwTemp = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Show_Hud_ptr_addr_sig); + + if (dwTemp < 50) + HaloDrawText("Show_Hud_ptr_addr_sig failed", 255, 255, 0, 0); + else + halo_cmd_data[5].cmd_address = **(DWORD**)dwTemp; + + + dwTemp = NULL; + dwTemp = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::letterbox_ptr_addr_sig); + + if (dwTemp < 50) + HaloDrawText("letterbox_ptr_addr_sig failed", 255, 255, 0, 0); + else + halo_cmd_data[6].cmd_address = **(DWORD**)dwTemp + 8; + + + dwTemp = NULL; + dwTemp = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Rider_Eject_addr_sig); + + if (dwTemp < 50) + HaloDrawText("Rider_Eject_addr_sig failed", 255, 255, 0, 0); + else + halo_cmd_data[7].cmd_address = *(DWORD*)dwTemp; + + + dwTemp = NULL; + dwTemp = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Rasterizer_addr_sig); + + if (dwTemp < 50) + HaloDrawText("Rasterizer_addr_sig failed", 255, 255, 0, 0); + else + { + Rasterizer_address = *(DWORD*)dwTemp; + + halo_cmd_data[15].cmd_address = Rasterizer_address + HaloCE_lib::Rasterizer::WireFrame_offset; + halo_cmd_data[16].cmd_address = Rasterizer_address + HaloCE_lib::Rasterizer::FogAtmosphere_offset; + halo_cmd_data[17].cmd_address = Rasterizer_address + HaloCE_lib::Rasterizer::FogPlane_offset; + halo_cmd_data[18].cmd_address = Rasterizer_address + HaloCE_lib::Rasterizer::FPS_offset; + } + + + dwTemp = NULL; + dwTemp = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Game_Speed_ptr_addr_sig); + + if (dwTemp < 50) + HaloDrawText("Game_Speed_ptr_addr_sig failed", 255, 255, 0, 0); + else + halo_cmd_data[19].cmd_address = **(DWORD**)dwTemp + 0x18; + + + dwTemp = NULL; + dwTemp = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Rapid_Fire_addr_sig); + + if (dwTemp < 50) + HaloDrawText("Rapid_Fire_addr_sig failed", 255, 255, 0, 0); + else + halo_cmd_data[20].cmd_address = dwTemp; + + + dwTemp = NULL; + dwTemp = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Time_Freeze_addr_sig); + + if (dwTemp < 50) + HaloDrawText("Time_Freeze_addr_sig failed", 255, 255, 0, 0); + else + halo_cmd_data[21].cmd_address = dwTemp; + + + dwTemp = NULL; + dwTemp = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Grav_Boots_addr_sig); + + if (dwTemp < 50) + HaloDrawText("Grav_Boots_addr_sig failed", 255, 255, 0, 0); + else + halo_cmd_data[22].cmd_address = dwTemp; + + + dwTemp = NULL; + dwTemp = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Vehicle_NTR_addr_sig); + + if (dwTemp < 50) + HaloDrawText("Vehicle_NTR_addr_sig failed", 255, 255, 0, 0); + else + halo_cmd_data[23].cmd_address = dwTemp; + + + dwTemp = NULL; + dwTemp = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::ServerType_ptr_addr_sig); + + if (dwTemp < 50) + HaloDrawText("ServerType_ptr_addr_sig failed", 255, 255, 0, 0); + else + ServerType = (WORD*)*(DWORD*)dwTemp; + + + //rpg_beta6_2 vars + if (running_gt == haloce) + { + rpg_beta6_2_cmd_data[0].cmd_address = HS_Global_Header->ItemArray_ptr + + HCE_Lib::rpg_beta6_2_hs_global::setting_offset; + + rpg_beta6_2_cmd_data[1].cmd_address = HS_Global_Header->ItemArray_ptr + + HCE_Lib::rpg_beta6_2_hs_global::alarmed_offset; + + rpg_beta6_2_cmd_data[2].cmd_address = HS_Global_Header->ItemArray_ptr + + HCE_Lib::rpg_beta6_2_hs_global::locked_offset; + + rpg_beta6_2_cmd_data[3].cmd_address = HS_Global_Header->ItemArray_ptr + + HCE_Lib::rpg_beta6_2_hs_global::nuked_offset; + + rpg_beta6_2_cmd_data[4].cmd_address = HS_Global_Header->ItemArray_ptr + + HCE_Lib::rpg_beta6_2_hs_global::lock_timer_offset; + + rpg_beta6_2_cmd_data[5].cmd_address = HS_Global_Header->ItemArray_ptr + + HCE_Lib::rpg_beta6_2_hs_global::boom_timer_offset; + } + + while (!dll_addresses.CurrentDir) + ::Sleep(50); + + //c string length + int length = 0; do length++; while(dll_addresses.CurrentDir[length]); + + wchar_t *loc_file_name = LOCATIONS_FILE_NAME; + int loc_name_length = 0; do loc_name_length++; while(loc_file_name[loc_name_length]); + + wchar_t *LocationsFilePath = new wchar_t[length + 14]; + for (int i = 0; i < length; i++) + LocationsFilePath[i] = dll_addresses.CurrentDir[i]; + + CurrentProcess::FreeMemory((LPVOID)dll_addresses.CurrentDir); + + LocationsFilePath[length] = L'\\'; + + for (int i = 0; i <= loc_name_length; i++) + LocationsFilePath[length + i + 1] = loc_file_name[i]; + + //main loop + while(!exit_thread) + { + ::Sleep(50);//so it doesn't slow halo down + if (exit_thread) + { + DWORD ExitCode = 0x006E6977; + ::ExitThread(ExitCode); + } + + if (dll_addresses.locations_changed) + { + //free memory + if (maps_tele_sites.size()) + { + for (unsigned int i = 0; i < maps_tele_sites.size(); i++) + maps_tele_sites[i].teleport_locations.clear(); + + maps_tele_sites.clear(); + } + + GetLocationsFromFile(LocationsFilePath, &maps_tele_sites); + dll_addresses.locations_changed = false; + } + + if (str_cmp("ui", Current_Map_Str) && display_txt) + { + HaloDrawText("Halo Dev Controls - Jesus7Freak", 255, 255, 255, 255); + display_txt = false; + } + else if (!str_cmp("ui", Current_Map_Str)) + display_txt = true; + + //keyboard shortcuts + if (dll_sk_enabled.halo_Enable_Shrtcts) + { + if (IsKeyDown(halo_cmd_keys[20].toggle_key)) + { + ckbx_rapid_fire_CheckedChanged(TOGGLE); + ::Sleep(200); + } + else if (IsKeyDown(halo_cmd_keys[20].on_key)) + { + ckbx_rapid_fire_CheckedChanged(true); + ::Sleep(200); + } + else if (IsKeyDown(halo_cmd_keys[20].off_key)) + { + ckbx_rapid_fire_CheckedChanged(false); + ::Sleep(200); + } + else if (IsKeyDown(halo_cmd_keys[21].toggle_key)) + { + ckbx_time_freeze_CheckedChanged(TOGGLE); + ::Sleep(200); + } + else if (IsKeyDown(halo_cmd_keys[21].on_key)) + { + ckbx_time_freeze_CheckedChanged(true); + ::Sleep(200); + } + else if (IsKeyDown(halo_cmd_keys[21].off_key)) + { + ckbx_time_freeze_CheckedChanged(false); + ::Sleep(200); + } + else if (IsKeyDown(halo_cmd_keys[22].toggle_key)) + { + ckbx_grav_boots_CheckedChanged(TOGGLE); + ::Sleep(200); + } + else if (IsKeyDown(halo_cmd_keys[22].on_key)) + { + ckbx_grav_boots_CheckedChanged(true); + ::Sleep(200); + } + else if (IsKeyDown(halo_cmd_keys[22].off_key)) + { + ckbx_grav_boots_CheckedChanged(false); + ::Sleep(200); + } + else if (IsKeyDown(halo_cmd_keys[23].toggle_key)) + { + ckbx_vehicle_ntr_CheckedChanged(TOGGLE); + ::Sleep(200); + } + else if (IsKeyDown(halo_cmd_keys[23].on_key)) + { + ckbx_vehicle_ntr_CheckedChanged(true); + ::Sleep(200); + } + else if (IsKeyDown(halo_cmd_keys[23].off_key)) + { + ckbx_vehicle_ntr_CheckedChanged(false); + ::Sleep(120000); + } + else + { + for (int i = 0; i < HALO_CMDS_SIZE - 4; i++) + { + //skip if not running the specified game type for game dependent cmds + if (halo_cmd_data[i].gametype_affect) + if (running_gt != haloce) + continue; + + //skip if not hosting for host dependent cmds + if (halo_cmd_data[i].host_affected) + if (*ServerType == CLIENT) + continue; + + //toggle cmd on/off + if (IsKeyDown(halo_cmd_keys[i].toggle_key)) + { + *(bool*)halo_cmd_data[i].cmd_address = !*(bool*)halo_cmd_data[i].cmd_address; + ::Sleep(200); + break; + } + //turn cmd on + else if (IsKeyDown(halo_cmd_keys[i].on_key)) + { + *(bool*)halo_cmd_data[i].cmd_address = true; + ::Sleep(200); + break; + } + //turn cmd off + else if (IsKeyDown(halo_cmd_keys[i].off_key)) + { + *(bool*)halo_cmd_data[i].cmd_address = false; + ::Sleep(200); + break; + } + } + } + } + + //if console isnt open, use chat for commands + if (!*Console_chck) + { + //check for in game chat commands/// + if (*ServerType != MAIN_MENU) + { + chat_address_ptr = *(DWORD*)( + *(DWORD*)( + *(DWORD*)( + *(DWORD*)( + *(DWORD*)Base_ptr_address + 0x94) + 0x4) + 0x8)) + 0x94; + + Chat_address = *(DWORD*)chat_address_ptr; + if (Chat_address) + { + wchar_t *chat_str = (wchar_t*)Chat_address; + for (chat_Length = 0; chat_Length < CMD_STR_SIZE && chat_str[chat_Length]; chat_Length++) + chat[chat_Length] = chat_str[chat_Length]; + + chat[chat_Length] = L'\0'; + } + } + } + else//check console + { + for (chat_Length = 0; chat_Length < CMD_STR_SIZE && Console_txt[chat_Length]; chat_Length++) + chat[chat_Length] = (wchar_t)Console_txt[chat_Length]; + + Chat_address = (DWORD)Console_txt; + chat[chat_Length] = '\0'; + } + + if (chat[0] == '/' && chat[chat_Length - 1] == ';') + { + for (int i = 0; i < HALO_CMDS_SIZE - 4; i++) + { + + //skip if not running the specified game type for game dependent cmds + if (halo_cmd_data[i].gametype_affect) + if (running_gt != haloce) + continue; + + //skip if not hosting for host dependent cmds + if (halo_cmd_data[i].host_affected) + if (*ServerType == CLIENT) + continue; + + //toggle cmd on/off + if (str_cmp(chat, halo_cmd_strs[i].cmd_on)) + { + *(bool*)halo_cmd_data[i].cmd_address = true; + erase_chat = true; + break; + } + //turn cmd off + else if (str_cmp(chat, halo_cmd_strs[i].cmd_off)) + { + *(bool*)halo_cmd_data[i].cmd_address = false; + erase_chat = true; + break; + } + } + + if (!erase_chat && *ServerType != CLIENT) + { + if (str_cmp(chat, L"/game_speed ", 12)) + { + float number = 0; + if (ParseCMDStrNumber(&chat[12], chat_Length - 12 - 1, &number)) + { + *(float*)halo_cmd_data[19].cmd_address = number; + erase_chat = true; + } + erase_cmd_terminator = !erase_chat; + } + else if (str_cmp(chat, L"/spd ", 5)) + { + float number = 0; + + int str_2arg_index = FindCMDArgIndex(chat, 2); + short *player_index = new short[Players_Table_Header->NumOfItems](); int pi_found = 0; + + if (ParseCMDStrPlayers(&chat[5], player_index, pi_found)) + { + if (ParseCMDStrNumber(&chat[str_2arg_index], chat_Length - str_2arg_index - 1, &number)) + { + for (int i = 0; i < pi_found; i++) + players[player_index[i]].SpeedModifier = number; + + erase_chat = true; + } + } + + erase_cmd_terminator = !erase_chat; + if (player_index) + delete[] player_index; + } + if (str_cmp(chat, L"/team ", 6)) + { + DWORD Team = 0; + short *player_index = new short[Players_Table_Header->NumOfItems](); int pi_found = 0; + if (ParseCMDStrPlayers(&chat[6], player_index, pi_found)) + { + for (int i = 0; i < pi_found; i++) + { + KillPlayer(player_index[i]); + + Team = players[player_index[i]].Team; + if (Team) + Team = 0; + else + Team = 1; + + players[player_index[i]].Team = Team; + + erase_chat = true; + } + } + + erase_cmd_terminator = !erase_chat; + if (player_index) + delete[] player_index; + } + else if (str_cmp(chat, L"/afk ", 5)) + { + DWORD number = 90; + short *player_index = new short[Players_Table_Header->NumOfItems](); int pi_found = 0; + if (ParseCMDStrPlayers(&chat[5], player_index, pi_found)) + { + for (int i = 0; i < pi_found; i++) + { + if (KillPlayer(player_index[i])) + { + number = 0x7FFFFFFF; + ::Sleep(50); + } + + players[player_index[i]].RespawnTimer = number; + erase_chat = true; + } + + erase_cmd_terminator = !erase_chat; + if (player_index) + delete[] player_index; + } + } + if (str_cmp(chat, L"/k ", 3)) + { + short *player_index = new short[Players_Table_Header->NumOfItems](); int pi_found = 0; + if (ParseCMDStrPlayers(&chat[3], player_index, pi_found)) + { + for (int i = 0; i < pi_found; i++) + { + char _str[11] = {'s','v','_','k','i','c','k',' '}; + + if (++player_index[i] > 9) + { + _str[8] = '1'; + _str[9] = (player_index[i] - 10) + 48; + } + else + { + _str[8] = '0'; + _str[9] = player_index[i] + 48; + } + + Console(_str); + erase_chat = true; + } + } + + erase_cmd_terminator = erase_chat; + if (player_index) + delete[] player_index; + } + else if (str_cmp(chat, L"/b ", 3)) + { + short *player_index = new short[Players_Table_Header->NumOfItems](); int pi_found = 0; + if (ParseCMDStrPlayers(&chat[3], player_index, pi_found)) + { + for (int i = 0; i < pi_found; i++) + { + char _str[10] = {'s','v','_','b','a','n',' '}; + + if (++player_index[i] > 9) + { + _str[7] = '1'; + _str[8] = (player_index[i] - 10) + 48; + } + else + { + _str[7] = '0'; + _str[8] = player_index[i] + 48; + } + + Console(_str); + erase_chat = true; + } + } + + erase_cmd_terminator = erase_chat; + if (player_index) + delete[] player_index; + } + else if (str_cmp(chat, L"/kill ", 6)) + { + short *player_index = new short[Players_Table_Header->NumOfItems](); int pi_found = 0; + if (ParseCMDStrPlayers(&chat[6], player_index, pi_found)) + { + for (int i = 0; i < pi_found; i++) + { + KillPlayer(player_index[i]); + erase_chat = true; + } + } + + erase_cmd_terminator = erase_chat; + if (player_index) + delete[] player_index; + } + if (str_cmp(chat, L"/health ", 8)) + { + float number = 0; + + int str_2arg_index = FindCMDArgIndex(chat, 2); + if (ParseCMDStrNumber(&chat[str_2arg_index], chat_Length - str_2arg_index - 1, &number)) + { + short *player_index = new short[Players_Table_Header->NumOfItems](); int pi_found = 0; + if (ParseCMDStrPlayers(&chat[8], player_index, pi_found)) + { + for (int i = 0; i < pi_found; i++) + { + HaloCE_lib::SPARTAN* player_object = GetPlayerObj(player_index[i]); + if(player_object) + { + player_object->Health = number; + erase_chat = true; + } + } + } + + erase_cmd_terminator = !erase_chat; + if (player_index) + delete[] player_index; + } + } + else if (str_cmp(chat, L"/shield ", 8)) + { + float number = 0; + + int str_2arg_index = FindCMDArgIndex(chat, 2); + if (ParseCMDStrNumber(&chat[str_2arg_index], chat_Length - str_2arg_index - 1, &number)) + { + short *player_index = new short[Players_Table_Header->NumOfItems](); int pi_found = 0; + if (ParseCMDStrPlayers(&chat[8], player_index, pi_found)) + { + for (int i = 0; i < pi_found; i++) + { + HaloCE_lib::SPARTAN* player_object = GetPlayerObj(player_index[i]); + if(player_object) + { + player_object->Shield_00 = number; + erase_chat = true; + } + } + } + + erase_cmd_terminator = !erase_chat; + if (player_index) + delete[] player_index; + } + } + if (str_cmp(chat, L"/t ", 3)) + { + float coordinates[3] = {0}; + short *player_index = new short[Players_Table_Header->NumOfItems](); int pi_found = 0; + bool teleport = false; + + if (ParseCMDStrPlayers(&chat[3], player_index, pi_found)) + { + //count the number of spaces + int num_of_chars = 0; + for (int i = 0; i < chat_Length; i++) + if (chat[i] == ' ') + num_of_chars++; + + if (num_of_chars == 4) + { + int str_2arg_index = FindCMDArgIndex(chat, 2); + int str_3arg_index = str_2arg_index + FindCMDArgIndex(&chat[str_2arg_index], 1); + int str_4arg_index = str_3arg_index + FindCMDArgIndex(&chat[str_3arg_index], 1); + if (ParseCMDStrNumber(&chat[str_2arg_index], str_3arg_index - str_2arg_index - 1, &coordinates[0])) + if (ParseCMDStrNumber(&chat[str_3arg_index], str_4arg_index - str_3arg_index - 1, &coordinates[1])) + if (ParseCMDStrNumber(&chat[str_4arg_index], chat_Length - str_4arg_index - 1, &coordinates[2])) + teleport = true; + } + else if (num_of_chars == 2) + { + wchar_t tele_loc_name[TELE_LOC_NAME_SIZE] = {0}; + int str_2arg_index = FindCMDArgIndex(chat, 2); + for (int i = 0; chat[str_2arg_index + i + 1] && i < TELE_LOC_NAME_SIZE; i++) + tele_loc_name[i] = chat[str_2arg_index + i]; + + unsigned int map_i = 0; + if (FindMapIndex(&maps_tele_sites, Current_Map_Str, map_i)) + { + unsigned int tele_loc_i = 0; + if (FindTeleLocNameIndex(&maps_tele_sites[map_i].teleport_locations, tele_loc_name, tele_loc_i)) + { + for (int i = 0; i < 3; i++) + coordinates[i] = maps_tele_sites[map_i].teleport_locations[tele_loc_i].coordinates[i]; + + teleport = true; + } + } + } + } + + if (teleport) + { + for (int i = 0; i < pi_found; i++) + { + HaloCE_lib::SPARTAN *player_object = GetPlayerObj(player_index[i]); + if (player_object) + { + //if player is in a vehicle, use vehicle's coordinates + HaloCE_lib::SPARTAN *vehicle_object = (HaloCE_lib::SPARTAN*)GetPlayerVehObj(player_object); + if (vehicle_object) + player_object = vehicle_object; + + for (int i = 0; i < 3; i++) + player_object->m_World[i] = coordinates[i]; + + erase_chat = true; + } + } + } + + erase_cmd_terminator = !erase_chat; + if (player_index) + delete[] player_index; + } + else if (str_cmp(chat, L"/tp ", 4)) + { + short *player_index = new short[Players_Table_Header->NumOfItems](); int pi_found = 0; + short player2_index = 0; int pi2_to_find = 1; + + if (ParseCMDStrPlayers(&chat[4], player_index, pi_found)) + { + int str_2p_index = FindCMDArgIndex(chat, 2); + if (ParseCMDStrPlayers(&chat[str_2p_index], &player2_index, pi2_to_find)) + { + HaloCE_lib::SPARTAN *player2_object = GetPlayerObj(player2_index); + if (player2_object) + { + //if player is in a vehicle, use vehicle's coordinates + HaloCE_lib::SPARTAN *vehicle_object = (HaloCE_lib::SPARTAN*)GetPlayerVehObj(player2_object); + if (vehicle_object) + player2_object = vehicle_object; + + for (int i = 0; i < pi_found; i++) + { + HaloCE_lib::SPARTAN *player_object = GetPlayerObj(player_index[i]); + if (player_object) + { + //if player is in a vehicle, use vehicle's coordinates + HaloCE_lib::SPARTAN *vehicle_object = (HaloCE_lib::SPARTAN*)GetPlayerVehObj(player_object); + if (vehicle_object) + player_object = vehicle_object; + + player_object->m_World[0] = player2_object->m_World[0]; + player_object->m_World[1] = player2_object->m_World[1]; + player_object->m_World[2] = player2_object->m_World[2] + 1 + i; + erase_chat = true; + } + } + } + } + } + + erase_cmd_terminator = !erase_chat; + if (player_index) + delete[] player_index; + } + else if (str_cmp(chat, L"/v ", 3)) + { + float velocity_direction[3] = {0}; + short *player_index = new short[Players_Table_Header->NumOfItems](); int pi_found = 0; + + int str_2arg_index = FindCMDArgIndex(chat, 2); + int str_3arg_index = str_2arg_index + FindCMDArgIndex(&chat[str_2arg_index], 1); + int str_4arg_index = str_3arg_index + FindCMDArgIndex(&chat[str_3arg_index], 1); + if (ParseCMDStrNumber(&chat[str_2arg_index], str_3arg_index - str_2arg_index - 1, &velocity_direction[0])) + if (ParseCMDStrNumber(&chat[str_3arg_index], str_4arg_index - str_3arg_index - 1, &velocity_direction[1])) + if (ParseCMDStrNumber(&chat[str_4arg_index], chat_Length - str_4arg_index - 1, &velocity_direction[2])) + { + if (ParseCMDStrPlayers(&chat[3], player_index, pi_found)) + { + for (int i = 0; i < pi_found; i++) + { + HaloCE_lib::SPARTAN *player_object = GetPlayerObj(player_index[i]); + if (player_object) + { + //if player is in a vehicle, use vehicle's coordinates + HaloCE_lib::SPARTAN *vehicle_object = (HaloCE_lib::SPARTAN*)GetPlayerVehObj(player_object); + if (vehicle_object) + player_object = vehicle_object; + + for (int i = 0; i < 3; i++) + player_object->m_Velocity[i] += velocity_direction[i]; + erase_chat = true; + } + } + } + } + + erase_cmd_terminator = !erase_chat; + if (player_index) + delete[] player_index; + } + else if (str_cmp(chat, L"/st ", 4)) + { + float coordinates[3] = {0}; + TELEPORT_LOCATION tele_site = {0}; + + //count the number of spaces + int num_of_chars = 0; + for (int i = 0; i < chat_Length; i++) + if (chat[i] == ' ') + num_of_chars++; + + if (num_of_chars == 2) + { + int str_2arg_index = FindCMDArgIndex(chat, 2); + for (int i = 0; chat[str_2arg_index + i + 1] && i < TELE_LOC_NAME_SIZE; i++) + tele_site.teleport_loc_name[i] = chat[str_2arg_index + i]; + + //add null at end if too long + tele_site.teleport_loc_name[TELE_LOC_NAME_SIZE - 1] = '\0'; + + + short *player_index = new short[Players_Table_Header->NumOfItems](); int pi_found = 1; + if (ParseCMDStrPlayers(&chat[4], player_index, pi_found)) + { + HaloCE_lib::SPARTAN *player_object = GetPlayerObj(player_index[0]); + if (player_object) + { + //if player is in a vehicle, use vehicle's coordinates + HaloCE_lib::SPARTAN *vehicle_object = (HaloCE_lib::SPARTAN*)GetPlayerVehObj(player_object); + if (vehicle_object) + player_object = vehicle_object; + + for (int i = 0; i < 3; i++) + tele_site.coordinates[i] = player_object->m_World[i]; + + unsigned int map_i = 0, tele_loc_i = 0; + if (!FindMapIndex(&maps_tele_sites, Current_Map_Str, map_i)) + { + MAPS map_loc; + + for (int i = 0; i < MAP_STR_SIZE; i++) + map_loc.map_name[i] = Current_Map_Str[i]; + + maps_tele_sites.push_back(map_loc); + map_i = maps_tele_sites.size() - 1; + } + + //if the tele site exists, overwrite it + if (FindTeleLocNameIndex(&maps_tele_sites[map_i].teleport_locations, tele_site.teleport_loc_name, tele_loc_i)) + maps_tele_sites[map_i].teleport_locations[tele_loc_i] = tele_site; + else + maps_tele_sites[map_i].teleport_locations.push_back(tele_site); + + WriteLocationsToFile(LocationsFilePath, &maps_tele_sites); + erase_chat = true; + } + } + + erase_cmd_terminator = !erase_chat; + if (player_index) + delete[] player_index; + } + } + else if (str_cmp(chat, L"/j ", 3)) + { + float coordinates[3] = {0}; + + int str_2arg_index = FindCMDArgIndex(chat, 2); + int str_3arg_index = str_2arg_index + FindCMDArgIndex(&chat[str_2arg_index], 1); + int str_4arg_index = str_3arg_index + FindCMDArgIndex(&chat[str_3arg_index], 1); + if (ParseCMDStrNumber(&chat[str_2arg_index], str_3arg_index - str_2arg_index - 1, &coordinates[0])) + if (ParseCMDStrNumber(&chat[str_3arg_index], str_4arg_index - str_3arg_index - 1, &coordinates[1])) + if (ParseCMDStrNumber(&chat[str_4arg_index], chat_Length - str_4arg_index - 1, &coordinates[2])) + { + short *player_index = new short[Players_Table_Header->NumOfItems](); int pi_found = 0; + if (ParseCMDStrPlayers(&chat[3], player_index, pi_found)) + { + for (int i = 0; i < pi_found; i++) + { + HaloCE_lib::SPARTAN *player_object = GetPlayerObj(player_index[i]); + if (player_object) + { + //if player is in a vehicle, use vehicle's coordinates + HaloCE_lib::SPARTAN *vehicle_object = (HaloCE_lib::SPARTAN*)GetPlayerVehObj(player_object); + if (vehicle_object) + player_object = vehicle_object; + //HaloDebugNum((DWORD)player_object, 16); + for (int i = 0; i < 3; i++) + player_object->m_World[i] += coordinates[i]; + + erase_chat = true; + } + } + } + + if (player_index) + delete[] player_index; + } + + erase_cmd_terminator = !erase_chat; + } + else if (str_cmp(chat, L"/ammo ", 6)) + { + float number = 0; + + int str_2arg_index = FindCMDArgIndex(chat, 2); + if (ParseCMDStrNumber(&chat[str_2arg_index], chat_Length - str_2arg_index - 1, &number)) + { + short *player_index = new short[Players_Table_Header->NumOfItems](); int pi_found = 0; + if (ParseCMDStrPlayers(&chat[6], player_index, pi_found)) + { + for (int i = 0; i < pi_found; i++) + { + HaloCE_lib::SPARTAN *player_object = GetPlayerObj(player_index[i]); + if (player_object) + { + HaloCE_lib::WEAPON_OBJECT *weapon_object = (HaloCE_lib::WEAPON_OBJECT*)GetObj(player_object->WeaponIndex); + if (weapon_object) + { + weapon_object->rounds_total = (WORD)number; + erase_chat = true; + } + } + } + } + if (player_index) + delete[] player_index; + } + + erase_cmd_terminator = !erase_chat; + } + else if (str_cmp(chat, L"/bat ", 5)) + { + float number = 0; + + int str_2arg_index = FindCMDArgIndex(chat, 2); + if (ParseCMDStrNumber(&chat[str_2arg_index], chat_Length - str_2arg_index - 1, &number)) + { + short *player_index = new short[Players_Table_Header->NumOfItems](); int pi_found = 0; + if (ParseCMDStrPlayers(&chat[5], player_index, pi_found)) + { + for (int i = 0; i < pi_found; i++) + { + HaloCE_lib::SPARTAN *player_object = GetPlayerObj(player_index[i]); + if (player_object) + { + HaloCE_lib::WEAPON_OBJECT *weapon_object = (HaloCE_lib::WEAPON_OBJECT*)GetObj(player_object->WeaponIndex); + if (weapon_object) + { + float battery_used = (100 - number)/ 100; + weapon_object->battery_used = battery_used; + erase_chat = true; + } + } + } + } + if (player_index) + delete[] player_index; + } + + erase_cmd_terminator = !erase_chat; + } + else if (str_cmp(chat, L"/eject ", 7)) + { + short *player_index = new short[Players_Table_Header->NumOfItems](); int pi_found = 0; + if (ParseCMDStrPlayers(&chat[7], player_index, pi_found)) + { + for (int i = 0; i < pi_found; i++) + { + HaloCE_lib::SPARTAN *player_object = GetPlayerObj(player_index[i]); + if (player_object) + { + if (player_object->VehicleIndex != -1) + { + //player_object->AntrMetaIndex = 0xEA3808C4; + //player_object->Animation = 0x22; //"W-gunner exit" + player_object->BitFlags_02[0] = 0; + player_object->BitFlags_01 &= 0xFFFFFFFE; + player_object->Action = 0x1B; + erase_chat = true; + } + } + } + } + if (player_index) + delete[] player_index; + + erase_cmd_terminator = !erase_chat; + } + } + if (!erase_chat) + { + if (str_cmp(chat, L"/camo ", 6)) + { + float buffer_num = 0; WORD bit_field = 0; + + int str_2arg_index = FindCMDArgIndex(chat, 2); + if (ParseCMDStrNumber(&chat[str_2arg_index], chat_Length - str_2arg_index - 1, &buffer_num)) + { + if (buffer_num == 1) + bit_field = 0x51; + else if (buffer_num == 0) + bit_field = 0x41; + + short *player_index = new short[Players_Table_Header->NumOfItems](); int pi_found = 0; + if (ParseCMDStrPlayers(&chat[6], player_index, pi_found)) + { + for (int i = 0; i < pi_found; i++) + { + HaloCE_lib::SPARTAN *player_object = GetPlayerObj(player_index[i]); + if (player_object) + { + player_object->IsInvisible = bit_field; + erase_chat = true; + } + } + } + + erase_cmd_terminator = !erase_chat; + if (player_index) + delete[] player_index; + } + } + else if (str_cmp(chat, L"/tc ", 4)) + { + DWORD Team = 0; + short *player_index = new short[Players_Table_Header->NumOfItems](); int pi_found = 0; + if (ParseCMDStrPlayers(&chat[4], player_index, pi_found)) + { + for (int i = 0; i < pi_found; i++) + { + Team = players[player_index[i]].Team; + if (Team) + Team = 0; + else + Team = 1; + + players[player_index[i]].Team = Team; + erase_chat = true; + } + } + + erase_cmd_terminator = !erase_chat; + if (player_index) + delete[] player_index; + } + else if (str_cmp(chat, L"/suspend ", 9)) + { + float number = 0; + + int str_2arg_index = FindCMDArgIndex(chat, 2); + if (ParseCMDStrNumber(&chat[str_2arg_index], chat_Length - str_2arg_index - 1, &number)) + { + short *player_index = new short[Players_Table_Header->NumOfItems](); int pi_found = 0; + if (ParseCMDStrPlayers(&chat[9], player_index, pi_found)) + { + for (int i = 0; i < pi_found; i++) + { + HaloCE_lib::SPARTAN *player_object = GetPlayerObj(player_index[i]); + if (player_object) + { + player_object->IsSuspended = (BYTE)number; + erase_chat = true; + } + } + } + + erase_cmd_terminator = !erase_chat; + if (player_index) + delete[] player_index; + } + } + else if (str_cmp(chat, L"/rapid_fire ", 12)) + { + float number = 0; + if (ParseCMDStrNumber(&chat[12], chat_Length - 12 - 1, &number)) + { + ckbx_rapid_fire_CheckedChanged((BYTE)number); + erase_chat = true; + } + } + else if (str_cmp(chat, L"/time_freeze ", 13)) + { + float number = 0; + if (ParseCMDStrNumber(&chat[13], chat_Length - 13 - 1, &number)) + { + ckbx_time_freeze_CheckedChanged((BYTE)number); + erase_chat = true; + } + + erase_cmd_terminator = !erase_chat; + } + else if (str_cmp(chat, L"/grav_boots ", 12)) + { + float number = 0; + if (ParseCMDStrNumber(&chat[12], chat_Length - 12 - 1, &number)) + { + ckbx_grav_boots_CheckedChanged((BYTE)number); + erase_chat = true; + } + + erase_cmd_terminator = !erase_chat; + } + else if (str_cmp(chat, L"/vehicle_ntr ", 13)) + { + float number = 0; + if (ParseCMDStrNumber(&chat[13], chat_Length - 13 - 1, &number)) + { + ckbx_vehicle_ntr_CheckedChanged((BYTE)number); + erase_chat = true; + } + + erase_cmd_terminator = !erase_chat; + } + } + } + if (str_cmp(Current_Map_Str, "rpg_beta6_2")) + { + //keyboard shortcuts + if (dll_sk_enabled.rpgb62_Enable_Shrtcts && *ServerType == HOST) + { + //setting + if (IsKeyDown(rpg_beta6_2_cmd_keys[0].toggle_key)) + { + if (*(WORD*)rpg_beta6_2_cmd_data[0].cmd_address != 2) + *(WORD*)rpg_beta6_2_cmd_data[0].cmd_address += 1; + else + *(WORD*)rpg_beta6_2_cmd_data[0].cmd_address -= 2; + + ::Sleep(200); + } + //alarm toggle + if (IsKeyDown(rpg_beta6_2_cmd_keys[1].toggle_key)) + { + *(bool*)(Device_Groups_Header->ItemArray_ptr + + HCE_Lib::rpg_beta6_2_device_groups::alarm_control_2_offset) = true; + + ::Sleep(200); + } + //alarm on + if (IsKeyDown(rpg_beta6_2_cmd_keys[1].on_key)) + { + if (!*(bool*)rpg_beta6_2_cmd_data[1].cmd_address) + *(bool*)(Device_Groups_Header->ItemArray_ptr + + HCE_Lib::rpg_beta6_2_device_groups::alarm_control_2_offset) = true; + + ::Sleep(200); + } + //alarm off + if (IsKeyDown(rpg_beta6_2_cmd_keys[1].off_key)) + { + if (*(bool*)rpg_beta6_2_cmd_data[1].cmd_address) + *(bool*)(Device_Groups_Header->ItemArray_ptr + + HCE_Lib::rpg_beta6_2_device_groups::alarm_control_2_offset) = true; + + ::Sleep(200); + } + //lockdown + if (IsKeyDown(rpg_beta6_2_cmd_keys[2].toggle_key)) + { + if (!*(bool*)rpg_beta6_2_cmd_data[2].cmd_address) + *(bool*)(Device_Groups_Header->ItemArray_ptr + + HCE_Lib::rpg_beta6_2_device_groups::lock_control_offset) = true; + else + { + //Halo_Process.WriteMemBool(HCE_Lib.Locked, false); + } + + ::Sleep(200); + } + + //fire halo + if (IsKeyDown(rpg_beta6_2_cmd_keys[3].toggle_key)) + { + if (!*(bool*)rpg_beta6_2_cmd_data[3].cmd_address) + *(bool*)(Device_Groups_Header->ItemArray_ptr + + HCE_Lib::rpg_beta6_2_device_groups::boom_control_offset) = true; + else + { + + } + + ::Sleep(200); + } + } + + //check for rpg_beta chat commands// + if (chat[0] == '/' && !erase_chat && *ServerType == HOST && chat[chat_Length - 1] == ';') + { + //change setting to day + if (str_cmp(chat, rpg_beta6_2_cmd_strs[0].cmd_activate)) + { + erase_chat = true; + *(WORD*)rpg_beta6_2_cmd_data[0].cmd_address = 0; + } + //change setting to rain + else if (str_cmp(chat, rpg_beta6_2_cmd_strs[0].cmd_on)) + { + erase_chat = true; + *(WORD*)rpg_beta6_2_cmd_data[0].cmd_address = 1; + } + //change setting to night + else if (str_cmp(chat, rpg_beta6_2_cmd_strs[0].cmd_off)) + { + erase_chat = true; + *(WORD*)rpg_beta6_2_cmd_data[0].cmd_address = 2; + } + //turn alarm on + else if (str_cmp(chat, rpg_beta6_2_cmd_strs[1].cmd_on)) + { + erase_chat = true; + if (!*(bool*)rpg_beta6_2_cmd_data[1].cmd_address) + *(bool*)(Device_Groups_Header->ItemArray_ptr + + HCE_Lib::rpg_beta6_2_device_groups::alarm_control_2_offset) = true; + } + //turn alarm off + else if (str_cmp(chat, rpg_beta6_2_cmd_strs[1].cmd_off)) + { + erase_chat = true; + if (*(bool*)rpg_beta6_2_cmd_data[1].cmd_address) + *(bool*)(Device_Groups_Header->ItemArray_ptr + + HCE_Lib::rpg_beta6_2_device_groups::alarm_control_2_offset) = true; + } + //trigger lockdown + else if (str_cmp(chat, rpg_beta6_2_cmd_strs[2].cmd_activate)) + { + erase_chat = true; + if (!*(bool*)rpg_beta6_2_cmd_data[2].cmd_address) + *(bool*)(Device_Groups_Header->ItemArray_ptr + + HCE_Lib::rpg_beta6_2_device_groups::lock_control_offset) = true; + } + //fire halo + else if (str_cmp(chat, rpg_beta6_2_cmd_strs[3].cmd_activate)) + { + erase_chat = true; + if (!*(bool*)rpg_beta6_2_cmd_data[3].cmd_address) + *(bool*)(Device_Groups_Header->ItemArray_ptr + + HCE_Lib::rpg_beta6_2_device_groups::boom_control_offset) = true; + } + ///lockdown timer + if (str_cmp(chat, L"/lockdown timer ", 16)) + { + float number = 0; + if (ParseCMDStrNumber(&chat[16], chat_Length - 16 - 1, &number)) + { + *(short*)rpg_beta6_2_cmd_data[4].cmd_address = (short)number * 30; + erase_chat = true; + } + + erase_cmd_terminator = !erase_chat; + } + ///halo timer + if (str_cmp(chat, L"/halo timer ", 12)) + { + float number = 0; + if (ParseCMDStrNumber(&chat[12], chat_Length - 12 - 1, &number)) + { + *(short*)rpg_beta6_2_cmd_data[5].cmd_address = (short)number * 30; + erase_chat = true; + } + + erase_cmd_terminator = !erase_chat; + } + + } + } + if (erase_chat) + { + if (!*Console_chck) + *(wchar_t*)(Chat_address + (chat_Length - 1) * sizeof(wchar_t)) = L'\0'; + else + *(char*)(Chat_address + (chat_Length - 1) * sizeof(char)) = '\0'; + + PressKey(VK_RETURN, 2); + *(wchar_t*)Chat_address = L'\0'; + chat[0] = '\0'; + erase_chat = false; + } + else if (erase_cmd_terminator) + { + PressKey(VK_BACK, 1); + erase_cmd_terminator = false; + } + } + + delete[] LocationsFilePath; + return 1; +} + +BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason, LPVOID lpReserved) +{ + switch (ul_reason) + { + case DLL_PROCESS_ATTACH: + hHDC_thread = ::CreateThread(0, 0, HDC_thread, hModule, 0, 0); + break; + case DLL_THREAD_ATTACH: + break; + case DLL_THREAD_DETACH: + break; + case DLL_PROCESS_DETACH: + exit_thread = true; + //wait for HDC_thread to exit + ::Sleep(50); + break; + } + return TRUE; +} \ No newline at end of file diff --git a/HDC/dllmain.cpp b/HDC/dllmain.cpp new file mode 100644 index 0000000..ea77e7e --- /dev/null +++ b/HDC/dllmain.cpp @@ -0,0 +1,1113 @@ +/******************************************************************************** + -- Halo Dev Controls + Copyright © 2011 Jesus7Freak + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +********************************************************************************* + File: dllmain.cpp + Project: HDC + Author: Jesus7Freak + Date: 11/22/2011 + Game: Halo and Halo Custom Edition + Version: all +*********************************************************************************/ +// dllmain.cpp : Defines the entry point for the DLL application. +#include "dllmain.h" + +bool exit_thread = false, + rpgb6_2_running = false, + *Console_chck = NULL; + +char *Current_Map_Str = NULL; + +wchar_t *LocationsFilePath = NULL, + *Locations_File_Name = L"locations.bin"; + +BYTE *Dev_enabled = NULL, + *Console_enabled = NULL, + *ShowHud = NULL, + *LetterBox = NULL, + *RiderEjection = NULL; + +short *ServerType = NULL, + *Player0_index = NULL; + +BOOL DestroyObjsEnabled = FALSE; + +DWORD Current_Map_address = NULL, + Rasterizer_address = NULL, + EngineDrawText_address = NULL, + Console_func_address = NULL, + MsgInfo_ptr_address = NULL, + ServerInfo_ptr_address = NULL, + PrepMsg_func_address = NULL, + SendMsgToPlayer_func_address = NULL, + SendMsgToAll_func_address = NULL, + Console_hook_address = NULL, + Rcon_hook_address = NULL, + C_Buffers_address = NULL, + C_BuffersIndex_address = NULL, + Server_chat_hook_address = NULL, + PlayerCheck_Func_address = NULL, + rapid_fire_hook_address = NULL, + time_freeze_hook_address = NULL, + grav_boots_hook_address = NULL, + vehicle_ntr_hook_address = NULL, + UnitExitVehicle_func_address = NULL, + SpawnHog_func_address = NULL, + ObjTagList_ptr_address = NULL, + SpawnObjAtPlayer0_func_address = NULL, + CreateObj_func_address = NULL, + DestroyObj_func_address = NULL, + ActiveCamo_func_address = NULL, + PlayerDeath_func_address = NULL, + sv_kick_func_address = NULL, + sv_ban_func_address = NULL, + cse_set_video_func_address = NULL, + cinematic_ptr = NULL, + console_tablist_hook_address = NULL, + console_tablist_hookfunc_address = NULL, + ctl_array_index_address = NULL, + ctl_array_size_address = NULL, + ctl_filter_str_ptr_address = NULL, + TempAdmin[16] = {0xFFFFFFFF}; + +float *game_speed = NULL; + +HALO_TYPE running_gt = (HALO_TYPE)0; + +HaloCE_lib::CHEATS *cheats = NULL; +HaloCE_lib::RASTERIZER *rasterizer = NULL; + +HaloCE_lib::DATA_HEADER **Players_ptr = NULL, + **Device_Groups_ptr = NULL, + **Object_ptr = NULL, + **HS_Globals_ptr = NULL; + +HaloCE_lib::STATIC_PLAYER *players = NULL; +HaloCE_lib::OBJECT_TABLE_ARRAY *objects = NULL; + +HANDLE hHDC_thread = NULL; + +DLL_ADDRESSES dll_addresses = +{ + {'d','l','l','_','s','t','_','a','d','d','r','s'}, + NULL, + (CMDsLib::CMD_SCKEYS**)&CMDsLib::halo_cmd_keys, + (CMDsLib::CMD_SCKEYS**)&CMDsLib::rpg_beta6_2_cmd_keys, + &CMDsLib::halo_commands.Enable_Shrtcts, + &CMDsLib::rpgbeta6_2_commands.Enable_Shrtcts, + MV_chkBx_CheckedChanged, + NULL, + (WORD*)&running_gt, + true +}; + +std::vector maps_tele_sites; + +bool IsKeyDown(int keyCode) +{ + short result = ::GetAsyncKeyState(keyCode); + return (result < 0); +} + +bool str_cmpAW(char *str1, wchar_t *wstr2, int length) +{ + bool match = true; + for (int i = 0; i < length; i++) + { + if (str1[i] != (char)wstr2[i]) + { + match = false; + break; + } + } + return match; +} + +BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason, LPVOID lpReserved) +{ + switch (ul_reason) + { + case DLL_PROCESS_ATTACH: + hHDC_thread = ::CreateThread(0, 0, HDC_thread, hModule, 0, 0); + break; + case DLL_THREAD_ATTACH: + break; + case DLL_THREAD_DETACH: + break; + case DLL_PROCESS_DETACH: + exit_thread = true; + + //wait for HDC_thread to exit if valid + if (hHDC_thread) + { + WaitForSingleObject(hHDC_thread, 50); + CloseHandle(hHDC_thread); + } + + //detach hooks + DWORD dwOldProtect = NULL; + if (Console_hook_address) + { + ::VirtualProtect((LPVOID)Console_hook_address, sizeof(DWORD), PAGE_EXECUTE_READWRITE, &dwOldProtect); + *(DWORD*)Console_hook_address = Console_func_address - (Console_hook_address + 4); + ::VirtualProtect((LPVOID)Console_hook_address, sizeof(DWORD), dwOldProtect, &dwOldProtect); + } + + if (Console_hook_address && Rcon_hook_address) + { + ::VirtualProtect((LPVOID)Rcon_hook_address, sizeof(DWORD), PAGE_EXECUTE_READWRITE, &dwOldProtect); + *(DWORD*)Rcon_hook_address = Console_func_address - (Rcon_hook_address + 4); + ::VirtualProtect((LPVOID)Rcon_hook_address, sizeof(DWORD), dwOldProtect, &dwOldProtect); + } + + if (Server_chat_hook_address && PlayerCheck_Func_address) + { + ::VirtualProtect((LPVOID)Server_chat_hook_address, sizeof(DWORD), PAGE_EXECUTE_READWRITE, &dwOldProtect); + *(DWORD*)Server_chat_hook_address = PlayerCheck_Func_address - (Server_chat_hook_address + 4); + ::VirtualProtect((LPVOID)Server_chat_hook_address, sizeof(DWORD), dwOldProtect, &dwOldProtect); + } + + if (console_tablist_hook_address && console_tablist_hookfunc_address) + { + ::VirtualProtect((LPVOID)console_tablist_hook_address, sizeof(DWORD), PAGE_EXECUTE_READWRITE, &dwOldProtect); + *(DWORD*)console_tablist_hook_address = console_tablist_hookfunc_address - (console_tablist_hook_address + 4); + ::VirtualProtect((LPVOID)console_tablist_hook_address, sizeof(DWORD), dwOldProtect, &dwOldProtect); + } + break; + } + return TRUE; +} + +DWORD WINAPI HDC_thread(LPVOID hModule) +{ + DWORD base_address = NULL, + scan_size = NULL; + + bool display_txt = true; + + DWORD hHalo = (DWORD)::GetModuleHandleA(NULL); + IMAGE_DOS_HEADER *IDH = (IMAGE_DOS_HEADER*)hHalo; + IMAGE_NT_HEADERS *INH = (IMAGE_NT_HEADERS*)(hHalo + IDH->e_lfanew); + base_address = (DWORD)hHalo + INH->OptionalHeader.BaseOfCode; + + IMAGE_SECTION_HEADER *text_section = (IMAGE_SECTION_HEADER*)((DWORD)hHalo + IDH->e_lfanew + sizeof(INH->Signature) + sizeof(INH->FileHeader) + INH->FileHeader.SizeOfOptionalHeader); + scan_size = text_section->Misc.VirtualSize; + + //scan_size = INH->OptionalHeader.SizeOfCode; + + //wait for app to get and write values to dll + while (!running_gt) + ::Sleep(10); + + //find patterns + //halo functions + EngineDrawText_address = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::EngineDrawText_func_addr_sig); + + DWORD ch_hook = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Console_hook_addr_sig); + + if (!ch_hook) + HaloDrawText("Console_hook_addr_sig failed", 255, 255, 0, 0); + else + { + Console_hook_address = ch_hook; + Console_func_address = (ch_hook + 4) + *(DWORD*)ch_hook; + } + + DWORD rh_hook = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Rcon_hook_addr_sig); + + if (!rh_hook) + HaloDrawText("Rcon_hook_addr_sig failed", 255, 255, 0, 0); + else + Rcon_hook_address = rh_hook; + + + DWORD sch_hook = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Server_Chat_hook_addr_sig); + + if (!sch_hook) + HaloDrawText("Server_Chat_hook_addr_sig failed", 255, 255, 0, 0); + else + { + Server_chat_hook_address = sch_hook; + PlayerCheck_Func_address = (sch_hook + 4) + *(DWORD*)sch_hook; + + sch_hook += 0x2E; + MsgInfo_ptr_address = *(DWORD*)sch_hook; + + sch_hook += 9; + PrepMsg_func_address = (sch_hook + 4) + *(DWORD*)sch_hook; + + sch_hook += 6; + ServerInfo_ptr_address = *(DWORD*)sch_hook; + } + + + DWORD scmta_faster_scan_address = sch_hook; + DWORD scmta_func = CurrentProcess::FindMemPattern( + scmta_faster_scan_address, + scan_size - (scmta_faster_scan_address - base_address), + HaloCE_lib::SendChatMsgToAll_func_addr_sig); + + if (!scmta_func) + HaloDrawText("SendChatMsgToAll_func_addr_sig failed", 255, 255, 0, 0); + else + SendMsgToAll_func_address = (scmta_func + 4) + *(DWORD*)scmta_func; + + + DWORD scmtp_func = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::SendChatMsgToPlayer_func_addr_sig); + + if (!scmtp_func) + HaloDrawText("SendChatMsgToPlayer_func_addr_sig failed", 255, 255, 0, 0); + else + SendMsgToPlayer_func_address = scmtp_func; + + + DWORD ctvh_hook = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::console_tablist_vars_hook_addr_sig); + + if (!ctvh_hook) + HaloDrawText("console_tablist_vars_hook_addr_sig failed", 255, 255, 0, 0); + else + { + ctl_array_index_address = *(DWORD*)ctvh_hook; + ctl_array_size_address = *(DWORD*)(ctvh_hook + 7); + ctl_filter_str_ptr_address = *(DWORD*)(ctvh_hook + 18); + } + + DWORD cth_faster_scan_address = ctvh_hook; + DWORD cth_hook = CurrentProcess::FindMemPattern( + cth_faster_scan_address, + scan_size - (cth_faster_scan_address - base_address), + HaloCE_lib::console_tablist_hook_addr_sig); + + if (!cth_hook) + HaloDrawText("console_tablist_hook_addr_sig failed", 255, 255, 0, 0); + else + { + console_tablist_hook_address = cth_hook; + console_tablist_hookfunc_address = (cth_hook + 4) + *(DWORD*)cth_hook; + } + + DWORD uev_func = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::UnitExitVehicle_func_addr_sig); + + if (!uev_func) + HaloDrawText("UnitExitVehicle_func_addr_sig failed", 255, 255, 0, 0); + else + UnitExitVehicle_func_address = uev_func; + + + DWORD sh_func = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::SpawnHog_func_addr_sig); + + if (!sh_func) + HaloDrawText("SpawnHog_func_addr_sig failed", 255, 255, 0, 0); + else + { + SpawnHog_func_address = sh_func; + sh_func += 1; + ObjTagList_ptr_address = *(DWORD*)sh_func; + } + + + DWORD soap0_func = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::SpawnObjAtPlayer0_func_addr_sig); + + if (!soap0_func) + HaloDrawText("SpawnObjAtPlayer0_func_addr_sig failed", 255, 255, 0, 0); + else + { + SpawnObjAtPlayer0_func_address = soap0_func; + soap0_func += 7; + soap0_func = ((soap0_func + 4) + *(int*)soap0_func);//get player 0 func + Players_ptr = *(HaloCE_lib::DATA_HEADER ***)(soap0_func + 4); + Player0_index = (short*)(soap0_func + 0x1F); + + bool *P_Initialized = &(*Players_ptr)->Initialized; + while(!*P_Initialized) + Sleep(10); + + players = (HaloCE_lib::STATIC_PLAYER*)(*Players_ptr)->FirstItem; + } + + + DWORD co_func = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::CreateObject_func_addr_sig); + + if (!co_func) + HaloDrawText("CreateObject_func_addr_sig failed", 255, 255, 0, 0); + else + CreateObj_func_address = co_func; + + + DWORD sk_func = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::sv_kick_func_addr_sig); + + if (!sk_func) + HaloDrawText("sv_kick_func_addr_sig failed", 255, 255, 0, 0); + else + { + sv_kick_func_address = sk_func; + sk_func += 3; + ServerType = *(short**)sk_func; + } + + + DWORD sb_func = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::sv_ban_func_addr_sig); + + if (!sb_func) + HaloDrawText("sv_ban_func_addr_sig failed", 255, 255, 0, 0); + else + sv_ban_func_address = sb_func; + + + //halo DATA_HEADER's + DWORD dg_ptr = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Device_Groups_ptr_sig); + + if (!dg_ptr) + HaloDrawText("Device_Groups_ptr_sig failed", 255, 255, 0, 0); + else + Device_Groups_ptr = *(HaloCE_lib::DATA_HEADER***)dg_ptr; + + + DWORD do_func = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::DestroyObj_func_addr_sig); + + if (!do_func) + HaloDrawText("DestroyObj_func_addr_sig failed", 255, 255, 0, 0); + else + { + DestroyObj_func_address = do_func; + do_func += 2; + Object_ptr = *(HaloCE_lib::DATA_HEADER***)do_func; + + bool *O_Initialized = &(*Object_ptr)->Initialized; + while(!*O_Initialized) + Sleep(10); + + objects = (HaloCE_lib::OBJECT_TABLE_ARRAY*)(*Object_ptr)->FirstItem; + } + + + DWORD ac_func = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::ActiveCamo_func_addr_sig); + + if (!ac_func) + HaloDrawText("ActiveCamo_func_addr_sig failed", 255, 255, 0, 0); + else + ActiveCamo_func_address = ac_func; + + + DWORD pd_func = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::PlayerDeath_func_addr_sig); + + if (!pd_func) + HaloDrawText("PlayerDeath_func_addr_sig failed", 255, 255, 0, 0); + else + PlayerDeath_func_address = pd_func; + + + DWORD csesv_func = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::cse_set_video_func_addr_sig); + + if (!csesv_func) + HaloDrawText("cse_set_video_func_addr_sig failed", 255, 255, 0, 0); + else + { + cse_set_video_func_address = csesv_func; + cinematic_ptr = *(DWORD*)(csesv_func + 2); + } + + + DWORD hsg_ptr = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::HS_Globals_ptr_sig); + + if (!hsg_ptr) + HaloDrawText("HS_Globals_ptr_sig failed", 255, 255, 0, 0); + else + HS_Globals_ptr = *(HaloCE_lib::DATA_HEADER***)hsg_ptr; + + + //global vars + if (running_gt == haloce) + { + DWORD dev_ptr = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HCE_Lib::Dev_addr_sig); + + if (!dev_ptr) + HaloDrawText("Dev_addr_sig failed", 255, 255, 0, 0); + else + Dev_enabled = *(BYTE**)dev_ptr; + } + + + DWORD console_ptr = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Console_addr_sig); + + if (!console_ptr) + HaloDrawText("Console_addr_sig failed", 255, 255, 0, 0); + else + { + console_ptr = *(DWORD*)console_ptr; + + Console_chck = (bool*)console_ptr; + Console_enabled = (BYTE*)(console_ptr + HaloCE_lib::Console::Enabled_offset); + C_Buffers_address = console_ptr + HaloCE_lib::Console::C_Buffers_offset; + C_BuffersIndex_address = console_ptr + HaloCE_lib::Console::C_Buffers_index_offset; + } + + + DWORD cma_ptr = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Current_map_addr_sig); + + if (!cma_ptr) + HaloDrawText("Current_map_addr_sig failed", 255, 255, 0, 0); + else + Current_Map_Str = (char*)*(DWORD*)cma_ptr; + + + DWORD cheats_ptr = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Cheats_addr_sig); + + if (!cheats_ptr) + HaloDrawText("Cheats_addr_sig failed", 255, 255, 0, 0); + else + cheats = *(HaloCE_lib::CHEATS**)cheats_ptr; + + + DWORD sh_ptr_ptr = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Show_Hud_ptr_addr_sig); + + if (!sh_ptr_ptr) + HaloDrawText("Show_Hud_ptr_addr_sig failed", 255, 255, 0, 0); + else + { + sh_ptr_ptr = *(DWORD*)sh_ptr_ptr; + do + { + Sleep(10);//wait for valid address + ShowHud = *(BYTE**)sh_ptr_ptr; + }while(!ShowHud); + } + + + DWORD lb_ptr_ptr = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::letterbox_ptr_addr_sig); + + if (!lb_ptr_ptr) + HaloDrawText("letterbox_ptr_addr_sig failed", 255, 255, 0, 0); + else + LetterBox = **(BYTE***)lb_ptr_ptr + 8; + + + DWORD re_ptr = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Rider_Eject_addr_sig); + + if (!re_ptr) + HaloDrawText("Rider_Eject_addr_sig failed", 255, 255, 0, 0); + else + RiderEjection = *(BYTE**)re_ptr; + + + DWORD rast_ptr = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Rasterizer_addr_sig); + + if (!rast_ptr) + HaloDrawText("Rasterizer_addr_sig failed", 255, 255, 0, 0); + else + rasterizer = *(HaloCE_lib::RASTERIZER**)rast_ptr; + + + DWORD gs_ptr_ptr = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Game_Speed_ptr_addr_sig); + + if (!gs_ptr_ptr) + HaloDrawText("Game_Speed_ptr_addr_sig failed", 255, 255, 0, 0); + else + game_speed = (float*)(**(DWORD**)gs_ptr_ptr + 0x18); + + + DWORD rf_ptr = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Rapid_Fire_addr_sig); + + if (!rf_ptr) + HaloDrawText("Rapid_Fire_addr_sig failed", 255, 255, 0, 0); + else + rapid_fire_hook_address = rf_ptr; + + + DWORD tf_ptr = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Time_Freeze_addr_sig); + + if (!tf_ptr) + HaloDrawText("Time_Freeze_addr_sig failed", 255, 255, 0, 0); + else + time_freeze_hook_address = tf_ptr; + + + DWORD gb_ptr = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Grav_Boots_addr_sig); + + if (!gb_ptr) + HaloDrawText("Grav_Boots_addr_sig failed", 255, 255, 0, 0); + else + grav_boots_hook_address = gb_ptr; + + + DWORD vntr_ptr = CurrentProcess::FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Vehicle_NTR_addr_sig); + + if (!vntr_ptr) + HaloDrawText("Vehicle_NTR_addr_sig failed", 255, 255, 0, 0); + else + vehicle_ntr_hook_address = vntr_ptr; + + + //c string length + wchar_t *CD = dll_addresses.CurrentDir; + if (CD) + { + int length = 0; while(CD[length]) length++; + + int loc_name_length = 0; while(Locations_File_Name[loc_name_length]) loc_name_length++; + + LocationsFilePath = new wchar_t[(length + loc_name_length + 1)]; + for (int i = 0; i < length; i++) + LocationsFilePath[i] = dll_addresses.CurrentDir[i]; + + CurrentProcess::FreeMemory((LPVOID)dll_addresses.CurrentDir); + dll_addresses.CurrentDir = NULL; + + LocationsFilePath[length] = L'\\'; + + wchar_t *copy_to_str = &LocationsFilePath[length + 1]; + for (int i = 0; i <= loc_name_length; i++) + copy_to_str[i] = Locations_File_Name[i]; + } + + //write hooks + DWORD dwOldProtect = NULL; + if (Console_hook_address) + { + ::VirtualProtect((LPVOID)Console_hook_address, sizeof(DWORD), PAGE_EXECUTE_READWRITE, &dwOldProtect); + *(DWORD*)Console_hook_address = (DWORD)&ConsoleHook - (Console_hook_address + 4); + ::VirtualProtect((LPVOID)Console_hook_address, sizeof(DWORD), dwOldProtect, &dwOldProtect); + } + + if (Rcon_hook_address) + { + ::VirtualProtect((LPVOID)Rcon_hook_address, sizeof(DWORD), PAGE_EXECUTE_READWRITE, &dwOldProtect); + *(DWORD*)Rcon_hook_address = (DWORD)&ConsoleHook - (Rcon_hook_address + 4); + ::VirtualProtect((LPVOID)Rcon_hook_address, sizeof(DWORD), dwOldProtect, &dwOldProtect); + } + + if (Server_chat_hook_address) + { + ::VirtualProtect((LPVOID)Server_chat_hook_address, sizeof(DWORD), PAGE_EXECUTE_READWRITE, &dwOldProtect); + *(DWORD*)Server_chat_hook_address = (DWORD)&ChatHook - (Server_chat_hook_address + 4); + ::VirtualProtect((LPVOID)Server_chat_hook_address, sizeof(DWORD), dwOldProtect, &dwOldProtect); + } + + if (console_tablist_hook_address) + { + ::VirtualProtect((LPVOID)console_tablist_hook_address, sizeof(DWORD), PAGE_EXECUTE_READWRITE, &dwOldProtect); + *(DWORD*)console_tablist_hook_address = (DWORD)&ConsoleTablistHook - (console_tablist_hook_address + 4); + ::VirtualProtect((LPVOID)console_tablist_hook_address, sizeof(DWORD), dwOldProtect, &dwOldProtect); + } + + //main loop + while(!exit_thread) + { + if (dll_addresses.locations_changed) + { + //free memory + if (maps_tele_sites.size()) + { + for (unsigned int i = 0; i < maps_tele_sites.size(); i++) + maps_tele_sites[i].teleport_locations.clear(); + + maps_tele_sites.clear(); + } + + GetLocationsFromFile(LocationsFilePath, &maps_tele_sites); + dll_addresses.locations_changed = false; + } + + if (Current_Map_Str) + { + if (str_cmpA("ui", Current_Map_Str) && display_txt) + { + HaloDrawText("Halo Dev Controls - Jesus7Freak", 255, 255, 255, 255); + display_txt = false; + } + else if (!str_cmpA("ui", Current_Map_Str)) + display_txt = true; + + if (str_cmpA(Current_Map_Str, "rpg_beta6_2")) + rpgb6_2_running = true; + else + rpgb6_2_running = false; + } + + //set admin to zero when player leaves + if (Players_ptr && *Players_ptr) + { + for (int i = 1; i < 16; i++) + { + if (!players[i].PlayerID) TempAdmin[i] = 0; + } + } + + CheckCmdScKeys(); + DestroyObjsCheck(); + + //so it doesn't slow halo down + //for (int i = 0; i < 10 && !exit_thread; i++) + // Sleep(5); + } + + delete[] LocationsFilePath; + return 1; +} + +void CheckCmdScKeys() +{ + //only check for shortcuts if halo is in focus + if (GetForegroundWindow() != dll_addresses.hHaloWin) return; + + //keyboard shortcuts + int cmd_id = -1; BYTE value; + for (int cmd_group_i = 1; cmd_id == -1 && cmd_group_i < CMD_SET_SIZE; cmd_group_i++) + { + CMDsLib::COMMANDS *cmd_group = CMDsLib::all_commands[cmd_group_i]; + if (!cmd_group->Enable_Shrtcts) continue; + + CMDsLib::CMD_SCKEYS *cmd_keys = cmd_group->cmd_keys; + int group_size = cmd_group->size; + + for (int i = 0; !exit_thread && i < group_size; i++) + { + //toggle cmd on/off + if (IsKeyDown(cmd_keys[i].toggle_key)) + { + cmd_id = i + (100 * cmd_group_i); + value = TOGGLE; + break; + } + //turn cmd on + else if (IsKeyDown(cmd_keys[i].on_key)) + { + cmd_id = i + (100 * cmd_group_i); + value = true; + break; + } + //turn cmd off + else if (IsKeyDown(cmd_keys[i].off_key)) + { + cmd_id = i + (100 * cmd_group_i); + value = false; + break; + } + } + } + + switch (cmd_id) + { + case 103://Console + { + if (value == TOGGLE) + *Console_enabled = !*Dev_enabled; + else + *Console_enabled = value; + break; + } + case 104://Dev Mode + { + if (running_gt != haloce) break; + + if (value == TOGGLE) + *Dev_enabled = !*Console_enabled; + else + *Dev_enabled = value; + break; + } + case 105://Deathless + { + if (value == TOGGLE) + cheats->Deathless = !cheats->Deathless; + else + cheats->Deathless = value; + break; + } + case 106://Infinite Ammo + { + if (value == TOGGLE) + cheats->Infinite_Ammo = !cheats->Infinite_Ammo; + else + cheats->Infinite_Ammo = value; + break; + } + case 107://Bottomless Clip + { + if (value == TOGGLE) + cheats->Bottomless_Clip = !cheats->Bottomless_Clip; + else + cheats->Bottomless_Clip = value; + break; + } + case 108://Show Hud + { + if (value == TOGGLE) + *ShowHud = !*ShowHud; + else + *ShowHud = value; + break; + } + case 109://LetterBox + { + if (value == TOGGLE) + *LetterBox = !*LetterBox; + else + *LetterBox = value; + break; + } + case 110://Rider Ejection + { + if (value == TOGGLE) + *RiderEjection = !*RiderEjection; + else + *RiderEjection = value; + break; + } + case 111://Omnipotent + { + if (value == TOGGLE) + cheats->Omnipotent = !cheats->Omnipotent; + else + cheats->Omnipotent = value; + break; + } + case 112://JetPack + { + if (value == TOGGLE) + cheats->JetPack = !cheats->JetPack; + else + cheats->JetPack = value; + break; + } + case 113://Bump Possession + { + if (value == TOGGLE) + cheats->Bmp_Possession = !cheats->Bmp_Possession; + else + cheats->Bmp_Possession = value; + break; + } + case 114://Super Jump + { + if (value == TOGGLE) + cheats->Super_jump = !cheats->Super_jump; + else + cheats->Super_jump = value; + break; + } + case 115://Medusa + { + if (value == TOGGLE) + cheats->Medusa = !cheats->Medusa; + else + cheats->Medusa = value; + break; + } + case 116://Reflexive Damage + { + if (value == TOGGLE) + cheats->Reflexive_damage = !cheats->Reflexive_damage; + else + cheats->Reflexive_damage = value; + break; + } + case 117://Xbox Controller + { + if (value == TOGGLE) + cheats->Controller = !cheats->Controller; + else + cheats->Controller = value; + break; + } + case 118://WireFrame + { + if (value == TOGGLE) + rasterizer->WireFrame = !rasterizer->WireFrame; + else + rasterizer->WireFrame = value; + break; + } + case 119://Fog + { + if (value == TOGGLE) + rasterizer->FogAtmosphere = !rasterizer->FogAtmosphere; + else + rasterizer->FogAtmosphere = value; + break; + } + case 120://FogPlane + { + if (value == TOGGLE) + rasterizer->FogPlane = !rasterizer->FogPlane; + else + rasterizer->FogPlane = value; + break; + } + case 121://FPS + { + if (value == TOGGLE) + rasterizer->FPS = !rasterizer->FPS; + else + rasterizer->FPS = value; + break; + } + case 123://Rapid Fire + ckbx_rapid_fire_CheckedChanged(value); + break; + case 124://Time Freeze + ckbx_time_freeze_CheckedChanged(value); + break; + case 125://Gravity Boots + ckbx_grav_boots_CheckedChanged(value); + break; + case 126://Vehicle NTR + ckbx_vehicle_ntr_CheckedChanged(value); + break; + case 127://Marines HUD + { + if (cinematic_ptr) + { + if (value == TOGGLE) + { + DWORD Cinematic = *(DWORD*)cinematic_ptr; + if (*(BYTE*)(Cinematic + 0x38)) + { + if (*(WORD*)(Cinematic + 0x24) == 2) + { + if (*(float*)(Cinematic + 0x2C) < 1.0f) + value = 0; + } + } + else + value = 1; + } + + MV_chkBx_CheckedChanged(value); + } + break; + } + + case 200://day Setting toggle + case 201://rain + case 202://night + { + if (!rpgb6_2_running) break; + + short *setting = (short*)((*HS_Globals_ptr)->FirstItem + + HCE_Lib::rpg_beta6_2_hs_global::setting_offset); + + if (value == TOGGLE) + { + if (*setting != 2) + *setting += 1; + else + *setting = 0; + } + break; + } + case 203://Air Base Alarm + { + if (!rpgb6_2_running) break; + + bool *alarmed = (bool*)((*HS_Globals_ptr)->FirstItem + + HCE_Lib::rpg_beta6_2_hs_global::alarmed_offset); + + bool *alarm_control_2 = (bool*)((*Device_Groups_ptr)->FirstItem + + HCE_Lib::rpg_beta6_2_device_groups::alarm_control_2_offset); + + if (value == TOGGLE) + *alarm_control_2 = true; + else if (value) + { + if (!*alarmed) + *alarm_control_2 = true; + } + else if (!value) + { + if (*alarmed) + *alarm_control_2 = true; + } + break; + } + case 204://Air Base LockDown + { + if (!rpgb6_2_running) break; + + bool *locked = (bool*)((*HS_Globals_ptr)->FirstItem + + HCE_Lib::rpg_beta6_2_hs_global::locked_offset); + + bool *lock_control = (bool*)((*Device_Groups_ptr)->FirstItem + + HCE_Lib::rpg_beta6_2_device_groups::lock_control_offset); + + if (value == TOGGLE) + { + if (!*locked) + *lock_control = true; + else + { + //Halo_Process.WriteMemBool(HCE_Lib.Locked, false); + } + } + break; + } + case 205://Fire Halo + { + if (!rpgb6_2_running) break; + + bool *nuked = (bool*)((*HS_Globals_ptr)->FirstItem + + HCE_Lib::rpg_beta6_2_hs_global::nuked_offset); + + bool *boom_control = (bool*)((*Device_Groups_ptr)->FirstItem + + HCE_Lib::rpg_beta6_2_device_groups::boom_control_offset); + + if (value == TOGGLE) + { + if (!*nuked) + *boom_control = true; + else + { + //Halo_Process.WriteMemBool(HCE_Lib.Nuked, false); + } + } + break; + } + } + + if (cmd_id != -1) Sleep(200); +} + +__declspec(noinline) void DestroyObjsCheck() +{ + if (!DestroyObjsEnabled) return; + + int NumOfObjs = (*Object_ptr)->NumOfItems; + int ObjTag; + //int valid_objs = 0; + for (int obj_index = 0; obj_index < NumOfObjs; obj_index++) + { + HaloCE_lib::OBJECT_TABLE_ARRAY *obj_header = &objects[obj_index]; + ObjTag = obj_header->ObjectID; + + if (!ObjTag) continue; + //else valid_objs++; + + //player object type is 0 + if (obj_header->ObjectType == 0) continue; + + if (DestroyObjsEnabled < 2) + if (obj_header->ObjectType > 3) continue; + + HaloCE_lib::SPARTAN *pObject = (HaloCE_lib::SPARTAN*)obj_header->Object_ptr; + if (!pObject) continue; + + int damage_player_index = pObject->DamageFromPlayer; + if (damage_player_index == -1) continue; + + //create full obj tag + ObjTag <<= 16; + ObjTag |= obj_index; + __asm + { + MOV EAX,ObjTag + CALL DWORD PTR [DestroyObj_func_address] + } + } + return; +} \ No newline at end of file diff --git a/HDC/dllmain.h b/HDC/dllmain.h new file mode 100644 index 0000000..d40feb4 --- /dev/null +++ b/HDC/dllmain.h @@ -0,0 +1,249 @@ +/******************************************************************************** + -- Halo Dev Controls + Copyright © 2011 Jesus7Freak + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +********************************************************************************* + File: dllmain.h + Project: HDC + Author: Jesus7Freak + Date: 11/22/2011 + Game: Halo and Halo Custom Edition + Version: all +*********************************************************************************/ +#pragma once +#pragma comment(lib, "kernel32.lib") +#pragma comment(lib, "user32.lib") +#pragma comment(lib, "libcpmt.lib") +#pragma comment(lib, "LIBCMT.lib") + +#include "HaloLib.h" +#include "cmds.h" +#include "tele_loc_resources.h" + +using namespace ReadWriteMemoryTools; + +#define SV_NAME_SIZE 14 +#define SV_BUFFER_SIZE 128 + +#define TOGGLE 2 + +#define MAIN_MENU 0 +#define CLIENT 1 +#define HOST 2 + +#define DO_NOT_SEND_MSG 0x100 + +enum HALO_TYPE : WORD { halo = 1, haloce = 2} extern running_gt; + +//Global = msg + players name, Team & Vehicle = msg + players name in brackets, Server = msg +enum CHAT_TYPE : int { Global = 0, Team = 1, Vehicle = 2, Server = 3 }; + +struct CHAT_INFO +{ + CHAT_TYPE ChatType; + char From_PlayerIndex; + wchar_t *msg_str; +}; + +struct DLL_ADDRESSES +{ + char find_me_str[12];//set to "dll_st_addrs" + HWND hHaloWin; + CMDsLib::CMD_SCKEYS **halo_cmd_keys; + CMDsLib::CMD_SCKEYS **rpgb62_cmd_keys; + BOOL *halo_sk_enabled; + BOOL *rpg_beta62_sk_enabled; + bool (__stdcall *pFunc)(int); + wchar_t *CurrentDir; + WORD *game; + bool locations_changed; +}extern dll_addresses; + +extern bool exit_thread, + rpgb6_2_running, + *Console_chck; + +extern char *Current_Map_Str; + +extern wchar_t *LocationsFilePath, + *Locations_File_Name, + HaloSay_server_buffer[SV_NAME_SIZE+SV_BUFFER_SIZE]; + +extern BYTE *Dev_enabled, + *Console_enabled, + *ShowHud, + *LetterBox, + *RiderEjection; + +extern short *ServerType, + *Player0_index; + +extern BOOL DestroyObjsEnabled; + +extern DWORD Current_Map_address, + Rasterizer_address, + EngineDrawText_address, + Console_func_address, + MsgInfo_ptr_address, + ServerInfo_ptr_address, + SendMsgToAll_func_address, + PrepMsg_func_address, + SendMsgToPlayer_func_address, + Console_hook_address, + Rcon_hook_address, + C_Buffers_address, + C_BuffersIndex_address, + Server_chat_hook_address, + PlayerCheck_Func_address, + rapid_fire_hook_address, + time_freeze_hook_address, + grav_boots_hook_address, + vehicle_ntr_hook_address, + UnitExitVehicle_func_address, + SpawnHog_func_address, + ObjTagList_ptr_address, + SpawnObjAtPlayer0_func_address, + CreateObj_func_address, + DestroyObj_func_address, + ActiveCamo_func_address, + PlayerDeath_func_address, + sv_kick_func_address, + sv_ban_func_address, + cse_set_video_func_address, + cinematic_ptr, + console_tablist_hook_address, + console_tablist_hookfunc_address, + ctl_array_index_address, + ctl_array_size_address, + ctl_filter_str_ptr_address, + TempAdmin[16]; + +extern float *game_speed; + +extern HaloCE_lib::CHEATS *cheats; +extern HaloCE_lib::RASTERIZER *rasterizer; + +extern HaloCE_lib::DATA_HEADER **Players_ptr, + **Device_Groups_ptr, + **Object_ptr, + **HS_Globals_ptr; + +extern HaloCE_lib::STATIC_PLAYER *players; +extern HaloCE_lib::OBJECT_TABLE_ARRAY *objects; + +extern HANDLE hHDC_thread; + +extern std::vector maps_tele_sites; + +bool str_cmpAW(char *str1, wchar_t *wstr2, int length); + +void HaloSay(wchar_t *message, short to_player_index, ...); +void HaloDrawText(char *msg_str, BYTE alpha, BYTE red, BYTE green, BYTE blue); +void ServerSay(CHAT_INFO chat_info, char to_player); + +BOOL __fastcall ckbx_rapid_fire_CheckedChanged(BYTE Checked); +BOOL __fastcall ckbx_time_freeze_CheckedChanged(BYTE Checked); +BOOL __fastcall ckbx_grav_boots_CheckedChanged(BYTE Checked); +BOOL __fastcall ckbx_vehicle_ntr_CheckedChanged(BYTE Checked); +bool __stdcall MV_chkBx_CheckedChanged(int number); + +void CheckCmdScKeys(); +void DestroyObjsCheck(); +DWORD WINAPI HDC_thread(LPVOID hModule); +//functions calling this need to test if first CMD_CALL_INFO::cmd[0] == '/' +DWORD __fastcall CMDParser(wchar_t *cmd_str, short exec_player_index); + +namespace Halo +{ + BOOL __fastcall CommandHelp(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall ListCommands(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall ListTeleportLocs(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall EnableConsole(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall EnableDevMode(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall CheatsDeathless(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall CheatsInfiniteAmmo(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall CheatsBottomlessClip(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall ShowHudFunc(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall LetterBoxFunc(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall RiderEjectionFunc(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall CheatsOmnipotent(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall CheatsJetPack(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall CheatsBumpPossession(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall CheatsSuperJump(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall CheatsReflexiveDamage(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall CheatsMedusa(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall CheatsXboxController(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall ShowWireFrame(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall ShowFog(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall ShowFogPlane(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall ShowFPS(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall Game_Speed(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall Rapid_Fire(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall Time_Freeze(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall Grav_Boots(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall Vehicle_NTR(wchar_t *cmd_args, short exec_player_index); + //BOOL __fastcall Execute_Console_Func(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall Marines_HUD(wchar_t *cmd_args, short exec_player_index); +}; + +namespace RPG +{ + BOOL __fastcall Environment_Day(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall Environment_Rain(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall Environment_Night(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall AirBase_Alarm(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall AirBase_LockDown(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall Fire_Halo(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall LockDown_Timer(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall Halo_Timer(wchar_t *cmd_args, short exec_player_index); +}; + +namespace Player +{ + BOOL __fastcall Speed(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall ActiveCamo(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall Suspend(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall Teleport(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall Jump_Teleport(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall Velocity(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall Ammo(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall Battery(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall Health(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall Shield(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall AFK(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall Team_Change(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall Kick(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall Ban(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall Kill(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall Eject(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall Flip_Vehicle(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall Admin(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall Set_Teleport_Loc(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall Spawn_Biped(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall Spawn_Hog(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall Spawn_All_Vehicles(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall Spawn_All_Weapons(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall Spawn_All_Powerups(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall Copy_Vehicle(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall Copy_Weapon(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall Destroy_Objects_Mode(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall Destroy_Weapon(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall Say(wchar_t *cmd_args, short exec_player_index); + BOOL __fastcall ObjectScale(wchar_t *cmd_args, short exec_player_index); +}; +//hooks +void ConsoleHook(); +void ChatHook(); +void ConsoleTablistHook(); diff --git a/HDC/resource.h b/HDC/resource.h new file mode 100644 index 0000000..2052ba6 --- /dev/null +++ b/HDC/resource.h @@ -0,0 +1,14 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by FileVersion.rc + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/Halo Dev Controls C#-old.zip b/Halo Dev Controls C#-old.zip new file mode 100644 index 0000000..ed20955 Binary files /dev/null and b/Halo Dev Controls C#-old.zip differ diff --git a/Halo Dev Controls.sln b/Halo Dev Controls.sln new file mode 100644 index 0000000..0b6838d --- /dev/null +++ b/Halo Dev Controls.sln @@ -0,0 +1,68 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Halo Dev Controls C.NET", "Halo Dev Controls C.NET\Halo Dev Controls C.NET.vcxproj", "{BB5D700F-7889-4213-AE2B-AF687793734A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HDC", "HDC\HDC.vcxproj", "{4C15AA53-B95C-4E9B-8860-FB9CC3ACA247}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Halo Dev Controls", "Halo Dev Controls\Halo Dev Controls.vcxproj", "{BEB36574-8603-4588-8B05-68ADECD65049}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Halo Dev Controls C-sharp", "Halo Dev Controls C#\Halo Dev Controls C-sharp.csproj", "{A5A6BAB9-E4BE-48E1-BE62-A86C4FB2EC03}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|Mixed Platforms = Debug|Mixed Platforms + Debug|Win32 = Debug|Win32 + Release|Any CPU = Release|Any CPU + Release|Mixed Platforms = Release|Mixed Platforms + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {BB5D700F-7889-4213-AE2B-AF687793734A}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {BB5D700F-7889-4213-AE2B-AF687793734A}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {BB5D700F-7889-4213-AE2B-AF687793734A}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {BB5D700F-7889-4213-AE2B-AF687793734A}.Debug|Win32.ActiveCfg = Debug|Win32 + {BB5D700F-7889-4213-AE2B-AF687793734A}.Debug|Win32.Build.0 = Debug|Win32 + {BB5D700F-7889-4213-AE2B-AF687793734A}.Release|Any CPU.ActiveCfg = Release|Win32 + {BB5D700F-7889-4213-AE2B-AF687793734A}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {BB5D700F-7889-4213-AE2B-AF687793734A}.Release|Mixed Platforms.Build.0 = Release|Win32 + {BB5D700F-7889-4213-AE2B-AF687793734A}.Release|Win32.ActiveCfg = Release|Win32 + {BB5D700F-7889-4213-AE2B-AF687793734A}.Release|Win32.Build.0 = Release|Win32 + {4C15AA53-B95C-4E9B-8860-FB9CC3ACA247}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {4C15AA53-B95C-4E9B-8860-FB9CC3ACA247}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {4C15AA53-B95C-4E9B-8860-FB9CC3ACA247}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {4C15AA53-B95C-4E9B-8860-FB9CC3ACA247}.Debug|Win32.ActiveCfg = Debug|Win32 + {4C15AA53-B95C-4E9B-8860-FB9CC3ACA247}.Debug|Win32.Build.0 = Debug|Win32 + {4C15AA53-B95C-4E9B-8860-FB9CC3ACA247}.Release|Any CPU.ActiveCfg = Release|Win32 + {4C15AA53-B95C-4E9B-8860-FB9CC3ACA247}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {4C15AA53-B95C-4E9B-8860-FB9CC3ACA247}.Release|Mixed Platforms.Build.0 = Release|Win32 + {4C15AA53-B95C-4E9B-8860-FB9CC3ACA247}.Release|Win32.ActiveCfg = Release|Win32 + {4C15AA53-B95C-4E9B-8860-FB9CC3ACA247}.Release|Win32.Build.0 = Release|Win32 + {BEB36574-8603-4588-8B05-68ADECD65049}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {BEB36574-8603-4588-8B05-68ADECD65049}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {BEB36574-8603-4588-8B05-68ADECD65049}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {BEB36574-8603-4588-8B05-68ADECD65049}.Debug|Win32.ActiveCfg = Debug|Win32 + {BEB36574-8603-4588-8B05-68ADECD65049}.Debug|Win32.Build.0 = Debug|Win32 + {BEB36574-8603-4588-8B05-68ADECD65049}.Release|Any CPU.ActiveCfg = Release|Win32 + {BEB36574-8603-4588-8B05-68ADECD65049}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {BEB36574-8603-4588-8B05-68ADECD65049}.Release|Mixed Platforms.Build.0 = Release|Win32 + {BEB36574-8603-4588-8B05-68ADECD65049}.Release|Win32.ActiveCfg = Release|Win32 + {BEB36574-8603-4588-8B05-68ADECD65049}.Release|Win32.Build.0 = Release|Win32 + {A5A6BAB9-E4BE-48E1-BE62-A86C4FB2EC03}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A5A6BAB9-E4BE-48E1-BE62-A86C4FB2EC03}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A5A6BAB9-E4BE-48E1-BE62-A86C4FB2EC03}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {A5A6BAB9-E4BE-48E1-BE62-A86C4FB2EC03}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {A5A6BAB9-E4BE-48E1-BE62-A86C4FB2EC03}.Debug|Win32.ActiveCfg = Debug|Any CPU + {A5A6BAB9-E4BE-48E1-BE62-A86C4FB2EC03}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A5A6BAB9-E4BE-48E1-BE62-A86C4FB2EC03}.Release|Any CPU.Build.0 = Release|Any CPU + {A5A6BAB9-E4BE-48E1-BE62-A86C4FB2EC03}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {A5A6BAB9-E4BE-48E1-BE62-A86C4FB2EC03}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {A5A6BAB9-E4BE-48E1-BE62-A86C4FB2EC03}.Release|Win32.ActiveCfg = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Halo Dev Controls/FileVersion.rc b/Halo Dev Controls/FileVersion.rc new file mode 100644 index 0000000..43253ee --- /dev/null +++ b/Halo Dev Controls/FileVersion.rc @@ -0,0 +1,103 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 2,3,0,0 + PRODUCTVERSION 2,3,0,0 + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x3L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "Halo Dev Controls.exe needs to be in the same folder in order for the commands and keyboard shortcuts to work." + VALUE "CompanyName", "Jesus7Freak" + VALUE "FileDescription", "HDC" + VALUE "FileVersion", "2, 3, 0, 0" + VALUE "InternalName", "HDC" + VALUE "LegalCopyright", "Copyright (C) 2011" + VALUE "OriginalFilename", "HDC.drv" + VALUE "ProductName", "Halo Dev Controls" + VALUE "ProductVersion", "2, 3, 0, 0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/Halo Dev Controls/HDCThread.cpp b/Halo Dev Controls/HDCThread.cpp new file mode 100644 index 0000000..d007a1c --- /dev/null +++ b/Halo Dev Controls/HDCThread.cpp @@ -0,0 +1,625 @@ +/******************************************************************************** + -- Halo Dev Controls + Copyright © 2011 Jesus7Freak + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +********************************************************************************* + File: HDCThread.cpp + Project: Halo Dev Controls + Author: Jesus7Freak + Date: 11/22/2011 + Game: Halo and Halo Custom Edition + Version: all +*********************************************************************************/ +#include "WinMain.h" + +char map_str[MAP_STR_SIZE] = {0}, + BufferA[32] = {0}; + +DLL_ADDRS dll_addresses = {0}; +tagPROCESSENTRY32W pHalo = {0}; + +DWORD WINAPI HDCThread(LPVOID lpMainWin) +{ + HWND hMainWin = (HWND)lpMainWin; + + //thread vars should be a little faster than static + bool control_enabled_change = false, + dll_injector_failed = false; + + BYTE C_Setting = 0; + + short Lock_sec = 0, + Halo_sec = 0; + + ULONG_PTR base_address = NULL; + + while (!exiting) + { + HWND hHaloWin = FindWindowW(L"Halo", L"Halo"); + if (hHaloWin) + { + DWORD dwProcessId; + GetWindowThreadProcessId(hHaloWin, &dwProcessId); + pHalo = RWMemory::GetProcessByID_W(dwProcessId); + + if (str_cmpW(pHalo.szExeFile, szHaloPC_exe)) + { + running_gt = Halo; + main_module_name = szHaloPC_exe; + SetTpWindowText(hMainWin, hControls[HHALO_TYPE], szHaloPC); + } + else if (str_cmpW(pHalo.szExeFile, szHaloCE_exe)) + { + running_gt = HCE; + main_module_name = szHaloCE_exe; + SetTpWindowText(hMainWin, hControls[HHALO_TYPE], szHaloCE); + } + } + else + { + if (Halo_Process) + { + running_gt = not_running; + rpgb6_2_running = false; + + SetTpWindowText(hMainWin, hControls[HHALO_TYPE], szHaloCE); + SetTpWindowText(hMainWin, hControls[HHALO_STATUS], szOff); + //status_lbl2->ForeColor = System::Drawing::Color::Red; + + main_module_name = empty_str; + SetTpWindowText(hMainWin, hControls[HMAP_LBL], empty_str); + SetTpWindowText(hMainWin, hControls[HMAP_STATUS], empty_str); + + dll_injector_failed = false; + base_address = NULL; + scan_size = 0; + + HS_Global_Header_ptr_address = NULL; + Device_Groups_Header_ptr_address = NULL; + + Current_Map_address = NULL; + Cheats_address = NULL; + ServerType_address = NULL; + + control_enabled_change = true; + + Dev_enabled_address = NULL; + Console_enabled_address = NULL; + ShowHud_ptr_address = NULL; + LetterBox_ptr_address = NULL; + //RiderEjection_address = NULL; + cse_set_video_func_address = NULL; + cinematic_ptr = NULL; + + hHDC = NULL; + + //force update + running_sv_t = host; + + delete Halo_Process; + Halo_Process = NULL; + } + } + + if (running_gt != not_running) + { + if (!Halo_Process) + { + Halo_Process = new RWMemory(pHalo); + + SetTpWindowText(hMainWin, hControls[HMAP_LBL], szMap); + SetTpWindowText(hMainWin, hControls[HHALO_STATUS], szOn); + //status_lbl2->ForeColor = System::Drawing::Color::Green; + + if (Halo_Process->LastWin32Error == ERROR_ACCESS_DENIED) + { + ::MessageBoxW( + hMainWin, + L"This App needs to be run as administrator", + L"Error", + MB_OK | MB_ICONWARNING | MB_TASKMODAL + ); + + SendMessage(hMainWin, WM_DESTROY, 0, 0); + } + + //find halo module info + Halo_Process->ModuleSectionAddr_Size( + Halo_Process->GetProcessModuleByNameW(main_module_name).hModule, + base_address, + scan_size, + (BYTE*)".text\0\0", + false); + + //find patterns + ULONG_PTR DGHptr_ptr = Halo_Process->FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Device_Groups_ptr_sig); + + Device_Groups_Header_ptr_address = Halo_Process->ReadMem((LPVOID)DGHptr_ptr); + + + ULONG_PTR HSGptr_ptr = Halo_Process->FindMemPattern( + base_address, + scan_size, + HaloCE_lib::HS_Globals_ptr_sig); + + HS_Global_Header_ptr_address = Halo_Process->ReadMem((LPVOID)HSGptr_ptr); + + if (running_gt == HCE) + { + ULONG_PTR Dev_ptr = Halo_Process->FindMemPattern( + base_address, + scan_size, + HCE_Lib::Dev_addr_sig); + + Dev_enabled_address = Halo_Process->ReadMem((LPVOID)Dev_ptr); + } + + ULONG_PTR console_ptr = Halo_Process->FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Console_addr_sig); + + Console_enabled_address = Halo_Process->ReadMem((LPVOID)console_ptr) + HaloCE_lib::Console::Enabled_offset; + + ULONG_PTR CMA_ptr = Halo_Process->FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Current_map_addr_sig); + + Current_Map_address = Halo_Process->ReadMem((LPVOID)CMA_ptr); + + + ULONG_PTR mem_region_ptr = Halo_Process->FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Cheats_addr_sig); + + Cheats_address = Halo_Process->ReadMem((LPVOID)mem_region_ptr); + + + ULONG_PTR SHp_ptr = Halo_Process->FindMemPattern( + base_address, + scan_size, + HaloCE_lib::Show_Hud_ptr_addr_sig); + + ShowHud_ptr_address = Halo_Process->ReadMem((LPVOID)SHp_ptr); + + + ULONG_PTR lb_ptr = Halo_Process->FindMemPattern( + base_address, + scan_size, + HaloCE_lib::letterbox_ptr_addr_sig); + + LetterBox_ptr_address = Halo_Process->ReadMem((LPVOID)lb_ptr); + + + //ULONG_PTR re_ptr = Halo_Process->FindMemPattern( + // base_address, + // scan_size, + // HaloCE_lib::Rider_Eject_addr_sig); + // + //RiderEjection_address = Halo_Process->ReadMem((LPVOID)re_ptr); + + ULONG_PTR svhc_ptr = Halo_Process->FindMemPattern( + base_address, + scan_size, + HaloCE_lib::sv_ban_func_addr_sig); + + ServerType_address = Halo_Process->ReadMem((LPVOID)(svhc_ptr + 3)); + + + ULONG_PTR cse_ptr = Halo_Process->FindMemPattern( + base_address, + scan_size, + HaloCE_lib::cse_set_video_func_addr_sig); + + cse_set_video_func_address = cse_ptr; + cinematic_ptr = Halo_Process->ReadMem((LPVOID)(cse_ptr + 2)); + + control_enabled_change = true; + } + + ////give game time to load then inject dll + if (!hHDC && !dll_injector_failed && Halo_Process->ReadMem((LPVOID)HS_Global_Header_ptr_address)) + { + wchar_t *current_directory = NULL; DWORD cd_size = 0; + cd_size = ::GetCurrentDirectoryW(cd_size, current_directory); + + int dll_name_length = 0; do dll_name_length++; while(Dll_Name[dll_name_length]); + + current_directory = new wchar_t[cd_size + 1 + dll_name_length]; + ::GetCurrentDirectoryW(cd_size, current_directory); + + //dll releases the memory + DWORD CurrentDir_address = (DWORD)Halo_Process->AllocateMemory(cd_size); + Halo_Process->WriteMemArray((LPVOID)CurrentDir_address, current_directory, cd_size); + + current_directory[cd_size - 1] = L'\\'; + + for (int i = 0; i <= dll_name_length; i++) + current_directory[cd_size + i] = Dll_Name[i]; + + hHDC = Halo_Process->InjectDLL(current_directory, true, false); + if (!hHDC) + { + dll_injector_failed = true; + } + else + { + Halo_Process->ModuleSectionAddr_Size((HMODULE)hHDC, base_address, scan_size, (BYTE*)".data\0\0", false); + + dll_addrs_ptr = Halo_Process->FindMemPattern( + base_address, + scan_size, + (BYTE*)"dll_st_addrs", + "xxxxxxxxxxxx") + 12; + + dll_addresses = Halo_Process->ReadMem((LPVOID)dll_addrs_ptr); + Halo_Process->WriteMem((LPVOID)(dll_addrs_ptr + FIELD_OFFSET(DLL_ADDRS, CurrentDir)), CurrentDir_address); + + //copy current settings to dll + Halo_Process->WriteMem((LPVOID)(dll_addrs_ptr + FIELD_OFFSET(DLL_ADDRS, hHaloWin)), hHaloWin); + + Halo_Process->WriteMemArray((LPVOID) + dll_addresses.halo_cmd_keys, + CMDsLib::halo_cmd_keys, + HALO_CMDS_SIZE); + + Halo_Process->WriteMemArray((LPVOID) + dll_addresses.rpgb62_cmd_keys, + CMDsLib::rpg_beta6_2_cmd_keys, + RPGB_CMDS_SIZE); + + Halo_Process->WriteMem((LPVOID)dll_addresses.halo_sk_enabled, CMDsLib::halo_commands.Enable_Shrtcts); + Halo_Process->WriteMem((LPVOID)dll_addresses.rpg_beta62_sk_enabled, CMDsLib::rpgbeta6_2_commands.Enable_Shrtcts); + + pMV_chkBx_CheckedChanged = dll_addresses.pFunc; + + Halo_Process->WriteMem((LPVOID)dll_addresses.game, (WORD)running_gt); + + base_address = NULL;//reset for below + } + delete[] current_directory; + } + + if (Device_Groups_Header_ptr_address) + Device_Groups_Header = Halo_Process->ReadMem( + (LPVOID)Halo_Process->ReadMem((LPVOID)Device_Groups_Header_ptr_address)); + + if (HS_Global_Header_ptr_address) + HS_Global_Header = Halo_Process->ReadMem( + (LPVOID)Halo_Process->ReadMem((LPVOID)HS_Global_Header_ptr_address)); + + if (Current_Map_address) + Halo_Process->ReadMemString((LPVOID)Current_Map_address, map_str); + + if (ServerType_address) + { + //update host/client lbl 0 - main menu, 1 - client, 2 - host + BYTE svtemp = (BYTE)running_sv_t; + running_sv_t = Halo_Process->ReadMem((LPVOID)ServerType_address); + + if ((BYTE)running_sv_t != svtemp) + { + switch (running_sv_t) + { + case main_menu: + //if (str_cmp(map_str, "ui")) + //{ + //----rcon_lbl->ForeColor = System::Drawing::Color::Red; + SetTpWindowText(hMainWin, hControls[HSERVER_STATUS], szMainMenu); + //} + //else + //{ + // rcon_lbl->ForeColor = System::Drawing::SystemColors::Highlight; + // rcon_lbl->Text = "Campaign"; + //} + break; + + case client: + SetTpWindowText(hMainWin, hControls[HSERVER_STATUS], szClient); + //rcon_lbl->ForeColor = System::Drawing::Color::Red; + break; + + case host: + SetTpWindowText(hMainWin, hControls[HSERVER_STATUS], szHost); + //rcon_lbl->ForeColor = System::Drawing::Color::Green; + break; + } + } + } + + if (Dev_enabled_address) + { + //update dev btn + bool devtemp = Halo_Process->ReadMem((LPVOID)Dev_enabled_address); + if (dev_enabled != devtemp) + { + dev_enabled = devtemp; + if (dev_enabled) + { + SetTpWindowText(hMainWin, hControls[HDEV], szDisableDev); + //btn_dev->ForeColor = System::Drawing::Color::Green;//Chartreuse; + } + else + { + SetTpWindowText(hMainWin, hControls[HDEV], szEnableDev); + //btn_dev->ForeColor = System::Drawing::Color::Red; + } + } + } + + if (Console_enabled_address) + { + //update console btn + bool consoletemp = Halo_Process->ReadMem((LPVOID)Console_enabled_address); + if (console_enabled != consoletemp) + { + console_enabled = consoletemp; + if (console_enabled) + { + SetTpWindowText(hMainWin, hControls[HCONSOLE], szDisableConsole); + //btn_console->ForeColor = System::Drawing::Color::Green;//Chartreuse; + } + else + { + SetTpWindowText(hMainWin, hControls[HCONSOLE], szEnableConsole); + //btn_console->ForeColor = System::Drawing::Color::Red; + } + } + } + + if (Cheats_address) + { + //update deathless value + int deathlesstemp = (int)Halo_Process->ReadMem((LPVOID)(Cheats_address + HaloCE_lib::CheatsEx::Deathless_offset)); + if (Button_GetCheck(hControls[HDEATHLESS]) != deathlesstemp) + Button_SetCheck(hControls[HDEATHLESS], deathlesstemp); + + //update infinite ammo value + int infammotemp = (int)Halo_Process->ReadMem((LPVOID)(Cheats_address + HaloCE_lib::CheatsEx::Infinite_Ammo_offset)); + if (Button_GetCheck(hControls[HINFAMMO]) != infammotemp) + Button_SetCheck(hControls[HINFAMMO], infammotemp); + } + + if (ShowHud_ptr_address) + { + //update show hud value + DWORD ShowHud_address = Halo_Process->ReadMem((LPVOID)ShowHud_ptr_address); + if (ShowHud_address) + { + int hudtemp = (int)Halo_Process->ReadMem((LPVOID)ShowHud_address); + if (Button_GetCheck(hControls[HSHOWHUD]) != hudtemp) + Button_SetCheck(hControls[HSHOWHUD], hudtemp); + } + } + + if (LetterBox_ptr_address) + { + //update letter box value + DWORD LetterBox_address = Halo_Process->ReadMem((LPVOID)LetterBox_ptr_address); + if (LetterBox_address) + { + LetterBox_address += 8; + int lettemp = (int)Halo_Process->ReadMem((LPVOID)LetterBox_address); + if (Button_GetCheck(hControls[HLETTERBOX]) != lettemp) + Button_SetCheck(hControls[HLETTERBOX], lettemp); + } + } + + //if (RiderEjection_address) + //{ + //update rider ejction value + // int retemp = (int)Halo_Process->ReadMem((LPVOID)RiderEjection_address); + // if (Button_GetCheck(hControls[HEJECTION]) != retemp) + // Button_SetCheck(hControls[HEJECTION], retemp); + + if (cinematic_ptr) + { + //update marines hud value + DWORD dwCinematic = Halo_Process->ReadMem((LPVOID)cinematic_ptr); + BYTE cintemp = Halo_Process->ReadMem((LPVOID)(dwCinematic + 0x38)); + if (cintemp) + { + cintemp = Halo_Process->ReadMem((LPVOID)(dwCinematic + 0x24)); + if (cintemp == 2) + { + float ftemp = Halo_Process->ReadMem((LPVOID)(dwCinematic + 0x2C)); + + if (ftemp < 1.0f) cintemp = BST_INDETERMINATE; + else cintemp = BST_CHECKED; + + if (Button_GetCheck(hControls[HMHUD]) != cintemp) + Button_SetCheck(hControls[HMHUD], cintemp); + } + } + else + { + if (Button_GetCheck(hControls[HMHUD]) != cintemp) + Button_SetCheck(hControls[HMHUD], cintemp); + } + } + + //test for rpg_beta6_2 map/////////////////////////////////////// + if (str_cmpA(map_str, "rpg_beta6_2")) + { + //get address for this map + if (!rpgb6_2_running) + { + control_enabled_change = true; + rpgb6_2_running = true; + } + + //status_lbl4->ForeColor = System::Drawing::Color::Green; + + if (HS_Global_Header_ptr_address) + { + //update alarm button + bool alarmtemp = Halo_Process->ReadMem((LPVOID)(HS_Global_Header.FirstItem + HCE_Lib::rpg_beta6_2_hs_global::alarmed_offset)); + if (alarm_on != alarmtemp) + { + alarm_on = alarmtemp; + if (alarm_on) + { + SetTpWindowText(hMainWin, hControls[HALARM], szAlarmOff); + //alarm_btn->ForeColor = System::Drawing::SystemColors::Highlight; + } + else + { + SetTpWindowText(hMainWin, hControls[HALARM], szAlarmOn); + //alarm_btn->ForeColor = System::Drawing::Color::Red; + } + } + + //update setting + BYTE settemp = Halo_Process->ReadMem((LPVOID)(HS_Global_Header.FirstItem + HCE_Lib::rpg_beta6_2_hs_global::setting_offset)); + if (C_Setting != settemp) + { + C_Setting = settemp; + if (C_Setting >= 0 && C_Setting <= 2) + SendMessage(hControls[HSETTING], CB_SETCURSEL, C_Setting, 0); + } + + //update lockdown timer + short locktimtemp = Halo_Process->ReadMem((LPVOID)(HS_Global_Header.FirstItem + HCE_Lib::rpg_beta6_2_hs_global::lock_timer_offset)); + if (Lock_sec != locktimtemp) + { + Lock_sec = locktimtemp; + swprintf_s((wchar_t*)szBuffer, SZ_BUFFER_SIZE, L"%lu",(Lock_sec / 30)); + SetWindowText(hControls[HBLD_TXTBX], (wchar_t*)szBuffer); + } + + //update lockdown button + bool locktemp = Halo_Process->ReadMem((LPVOID)(HS_Global_Header.FirstItem + HCE_Lib::rpg_beta6_2_hs_global::locked_offset)); + if (Locked != locktemp) + { + Locked = locktemp; + if (!Locked) + { + SetTpWindowText(hMainWin, hControls[HBLD_ACT_BTN], szBaseLockAct); + //BLD_activate->ForeColor = System::Drawing::SystemColors::Highlight; + } + else + { + SetTpWindowText(hMainWin, hControls[HBLD_ACT_BTN], szBaseLockLocked); + //BLD_activate->ForeColor = System::Drawing::Color::Red; + } + } + + //update fire halo button + bool halotemp = Halo_Process->ReadMem((LPVOID)(HS_Global_Header.FirstItem + HCE_Lib::rpg_beta6_2_hs_global::nuked_offset)); + if (Nuked != halotemp) + { + Nuked = halotemp; + if (!Nuked) + { + SetTpWindowText(hMainWin, hControls[HHALO_ACT_BTN], szHaloFire); + //halo_activate->ForeColor = System::Drawing::SystemColors::Highlight; + } + else + { + SetTpWindowText(hMainWin, hControls[HHALO_ACT_BTN], szHaloCoolDown); + //halo_activate->ForeColor = System::Drawing::Color::Red; + } + } + + //update halo timer + short halotimtemp = Halo_Process->ReadMem((LPVOID)(HS_Global_Header.FirstItem + HCE_Lib::rpg_beta6_2_hs_global::boom_timer_offset)); + if (Halo_sec != halotimtemp) + { + Halo_sec = halotimtemp; + swprintf_s((wchar_t*)szBuffer, SZ_BUFFER_SIZE, L"%lu",(Halo_sec / 30)); + SetWindowText(hControls[HHALO_TXTBX], (wchar_t*)szBuffer); + } + } + } + else + { + rpgb6_2_running = false; + //status_lbl4->ForeColor = System::Drawing::Color::Red; + } + + HWND hMap = hControls[HMAP_STATUS]; + GetWindowTextA(hMap, (LPSTR)BufferA, 32); + //only change if its different + if (!str_cmpA((char*)BufferA, (char*)map_str)) + { + SetWindowTextA(hMap, map_str); + RedrawTpWindow(hMainWin, hMap); + control_enabled_change = true; + } + } + + if (control_enabled_change) + { + //server status label + EnableTpWindow(hMainWin, hControls[HSERVER_STATUS], running_gt != not_running && ServerType_address); + //dev button + EnableTpWindow(hMainWin, hControls[HDEV], running_gt == HCE && Dev_enabled_address); + ShowTpWindow(hMainWin, hControls[HDEV], running_gt != Halo); + //console button + EnableTpWindow(hMainWin, hControls[HCONSOLE], running_gt == Halo && Console_enabled_address); + ShowTpWindow(hMainWin, hControls[HCONSOLE], running_gt == Halo); + //Deathless chkBx + EnableTpWindow(hMainWin, hControls[HDEATHLESS], running_sv_t != client && running_gt != not_running); + //infammo chkBx + EnableTpWindow(hMainWin, hControls[HINFAMMO], running_sv_t != client && running_gt != not_running); + //showhud chkBx + EnableTpWindow(hMainWin, hControls[HSHOWHUD], running_gt != not_running && ShowHud_ptr_address); + //letterbox chkBx + EnableTpWindow(hMainWin, hControls[HLETTERBOX], running_gt != not_running && LetterBox_ptr_address); + //ejection chkBx + //EnableTpWindow(hMainWin, hControls[HEJECTION], running_sv_t != client && running_gt != not_running && RiderEjection_address); + //marines hud + BOOL valid_address = FALSE; + if (pMV_chkBx_CheckedChanged) valid_address = true; + else if (cse_set_video_func_address) valid_address = true; + + EnableTpWindow(hMainWin, hControls[HMHUD], running_gt != not_running && valid_address); + + //rpg_beta6_2 functions + //setting combo box + EnableWindow(hControls[HSETTING], running_sv_t == host && rpgb6_2_running && HS_Global_Header_ptr_address); + //alarm button + EnableTpWindow(hMainWin, hControls[HALARM], running_sv_t == host && rpgb6_2_running && Device_Groups_Header_ptr_address); + //base lockdown label + EnableTpWindow(hMainWin, hControls[HBLD_LBL], running_sv_t == host && rpgb6_2_running); + //base lockdown timer textbox + EnableWindow(hControls[HBLD_TXTBX], running_sv_t == host && rpgb6_2_running && HS_Global_Header_ptr_address); + //base lockdown set button + EnableTpWindow(hMainWin, hControls[HBLD_SET_BTN], running_sv_t == host && rpgb6_2_running && HS_Global_Header_ptr_address); + //base lockdown activate button + EnableTpWindow(hMainWin, hControls[HBLD_ACT_BTN], running_sv_t == host && rpgb6_2_running && Device_Groups_Header_ptr_address); + //halo label + EnableTpWindow(hMainWin, hControls[HHALO_LBL], running_sv_t == host && rpgb6_2_running); + //halo timer textbox + EnableWindow(hControls[HHALO_TXTBX], running_sv_t == host && rpgb6_2_running && HS_Global_Header_ptr_address); + //halo set button + EnableTpWindow(hMainWin, hControls[HHALO_SET_BTN], running_sv_t == host && rpgb6_2_running && HS_Global_Header_ptr_address); + //halo activate button + EnableTpWindow(hMainWin, hControls[HHALO_ACT_BTN], running_sv_t == host && rpgb6_2_running && Device_Groups_Header_ptr_address); + + control_enabled_change = false; + } + + for (int i = 0; i < 14 && !exiting; i++) + Sleep(50); + } + + return TRUE; +} \ No newline at end of file diff --git a/Halo Dev Controls/Halo Dev Controls.vcproj b/Halo Dev Controls/Halo Dev Controls.vcproj new file mode 100644 index 0000000..1e0ad64 --- /dev/null +++ b/Halo Dev Controls/Halo Dev Controls.vcproj @@ -0,0 +1,288 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Halo Dev Controls/Halo Dev Controls.vcxproj b/Halo Dev Controls/Halo Dev Controls.vcxproj new file mode 100644 index 0000000..ba440a8 --- /dev/null +++ b/Halo Dev Controls/Halo Dev Controls.vcxproj @@ -0,0 +1,137 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {BEB36574-8603-4588-8B05-68ADECD65049} + HaloDevControls + Win32Proj + 8.1 + + + + Application + v140_xp + false + Unicode + true + + + Application + v140_xp + Unicode + + + + + + + + + + + + + <_ProjectFileVersion>14.0.25431.1 + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + + + + Disabled + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + Level3 + EditAndContinue + + + true + Windows + MachineX86 + + + + + Full + true + Speed + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + false + false + true + MultiThreaded + false + true + + Level3 + ProgramDatabase + StdCall + + + false + + + kernel32.lib;user32.lib;gdi32.lib;version.lib;comctl32.lib + false + true + Windows + true + true + MachineX86 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Halo Dev Controls/Halo Dev Controls.vcxproj.filters b/Halo Dev Controls/Halo Dev Controls.vcxproj.filters new file mode 100644 index 0000000..411cdec --- /dev/null +++ b/Halo Dev Controls/Halo Dev Controls.vcxproj.filters @@ -0,0 +1,91 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Resource Files + + + Resource Files + + + Resource Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/Halo Dev Controls/HaloLib.cpp b/Halo Dev Controls/HaloLib.cpp new file mode 100644 index 0000000..75fa17f --- /dev/null +++ b/Halo Dev Controls/HaloLib.cpp @@ -0,0 +1,620 @@ +/******************************************************************************** + -- Halo Dev Controls + Copyright © 2011 Jesus7Freak + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +********************************************************************************* + File: HaloLib.cpp + Project: Halo Dev Controls and HDC + Author: Jesus7Freak + Date: 11/22/2011 + Game: Halo and Halo Custom Edition + Version: all +*********************************************************************************/ +#include "HaloLib.h" + +/// +/// contains info that are the same in both games +/// +namespace HaloCE_lib +{ + ADDRESS_SIG Current_map_addr_sig = + { "\x7F\x1F\xB8\x00\x00\x00\x00\x8D\x50", "x?x????xx", 3 }; + + ADDRESS_SIG Rider_Eject_addr_sig = + { "\x04\xA0\xAC\x49\x62\x00\x84\xC0\x0F\x84\x00\x00\x00\x00\x8B\x4D\xEC", "xx????xxxx????xxx", 2 }; + + ADDRESS_SIG Console_addr_sig = + { "\x51\xA0\x70\x1F\x65\x00\x84\xC0\x0F\x85\x00\x00\x00\x00\x55\x8B", "xx????xxxx????xx", 2 }; + + ADDRESS_SIG Base_ptr_addr_sig = //ce1.08 = 0x006BD194 pc1.09 = 0x00721ea4 + { "\x8B\x0D\x00\x00\x00\x00\x50\x51\xC7\x05", "xx????xxxx", 2 }; + + ADDRESS_SIG Cheats_addr_sig = + { "\x74\x09\x80\x3D\x00\x00\x00\x00\x00", "xxxx????x", 4 }; + + ADDRESS_SIG Show_Hud_ptr_addr_sig = + { "\x8B\x0D\x00\x00\x00\x00\x85\xC9\x0F\x84\x00\x00\x00\x00\x80", "xx????xxxx????x", 2 }; + + //offset ptr by 8 + ADDRESS_SIG letterbox_ptr_addr_sig = + { "\x0F\x84\x00\x00\x00\x00\xA1\x00\x00\x00\x00\x8A\x48", "xx????x????xx", 7 }; + + ADDRESS_SIG Rasterizer_addr_sig = + { "\xA0\xC0\x49\x62\x00\x83\xEC\x0C\x84\xC0\x75\x0E", "x????xxxxxxx", 1 }; + + ADDRESS_SIG Cinematic_addr_sig = + { "\x01\x8B\x15\x00\x00\x00\x00\x3B\xD3", "xxx????xx", 3 }; + + //ADDRESS_SIG ServerType_ptr_addr_sig = + //{ "\x66\x83\x3D\xD0\x47\x6B\x00\x02\x89\x44\x24\x38", "xxx????xxxxx", 3 }; + + //offset ptr by 0x18 + ADDRESS_SIG Game_Speed_ptr_addr_sig = + { "\x8B\xFD\xF3\xAB\xA1\x00\x00\x00\x00\x8B", "xxxxx????x", 5 }; + + ADDRESS_SIG Grav_Boots_addr_sig = + { "\x83\xEC\x38\x56\x8B\xF1\xB1\x04", "xxxxxxxx", -6 }; + + ADDRESS_SIG Time_Freeze_addr_sig = + { "\xC1\xE0\x10\x0B\xC2\x84\xC9", "xxxxxxx", 7 }; + + ADDRESS_SIG Rapid_Fire_addr_sig = + { "\xD9\x81\x34\x02\x00\x00\xEB\x03", "xxxxxxxx", 8 }; + + ADDRESS_SIG Vehicle_NTR_addr_sig =// change from 0x74 to 0xEB + { "\x66\x8B\x8E\xB8\x00\x00\x00\x66\x8B\x90\xB8\x00\x00\x00", "xxxxxxxxxxxxxx", 0x15 }; + + /*Local Chat func + 004AE755 |. 50 PUSH EAX + 004AE756 |. 68 7CA46000 PUSH haloce.0060A47C ; UNICODE "SERVER" + 004AE75B |. 68 60A46000 PUSH haloce.0060A460 ; UNICODE "** %s ** %s" + 004AE760 |. 8D9424 2401000>LEA EDX,DWORD PTR SS:[ESP+124] + 004AE767 |. E8 94CC0A00 CALL haloce.0055B400 <-- conjugate strings + 004AE76C |. 8D8C24 2401000>LEA ECX,DWORD PTR SS:[ESP+124] + + 004AE773 |. 51 PUSH ECX + 004AE774 |. E8 57030000 CALL haloce.004AEAD0 + 004AE779 |. 83C4 10 ADD ESP,10 ;2 func's combined; should be 4 + */ + ADDRESS_SIG Local_Chat_func_addr_sig = + { "\xA1\x00\x00\x00\x00\x83\xEC\x08\x83\xF8\x08", "x????xxxxxx", 0 }; + + /* + **warning** objects created in main thread here does not sync + 004AE687 8D9424 18050000 LEA EDX,DWORD PTR SS:[ESP+518] + 004AE68E 52 PUSH EDX + 004AE68F 8D8424 1C010000 LEA EAX,DWORD PTR SS:[ESP+11C] ; load chat into EAX + 004AE696 50 PUSH EAX + 004AE697 E8 14C81100 CALL haloce.005CAEB0 ; hook here + 004AE69C 8D8C24 20010000 LEA ECX,DWORD PTR SS:[ESP+120] + 004AE6A3 51 PUSH ECX + 004AE6A4 E8 27040000 CALL haloce.004AEAD0 + 004AE6A9 83C4 0C ADD ESP,0C + */ + //MOVSX ECX,BYTE PTR [ESP+1Ch] to get player index for hooking func + ADDRESS_SIG Local_Chat_hook_addr_sig = + { "\x50\xE8\x00\x00\x00\x00\x8D\x8C\x24\x00\x00\x00\x00\x51\xE8", "xx????xxx????xx", 2 }; + + /*004AE06A E8 B1210400 CALL haloce.004F0220 + 004AE06F 84C0 TEST AL,AL + 004AE071 0F84 12010000 JE haloce.004AE189 + 004AE077 8B8424 2C020000 MOV EAX,DWORD PTR SS:[ESP+22C] + 004AE07E E8 FD630300 CALL haloce.004E4480 ;hook here + 004AE083 83F8 FF CMP EAX,-1 + 004AE086 0F84 FD000000 JE haloce.004AE189*/ + //add 1 more to the offset for dedicated server + //add 0x2E to offset for MsgInfo_ptr_address + //add 0x37 to offset for PrepMsg_func_address build network packet function + //add 0x3D to offset for ServerInfo_ptr_address + ADDRESS_SIG Server_Chat_hook_addr_sig = + { "\x8B\x08\x8B\x11\x81\xEC\x00\x00\x00\x00\x57", "xxxxxx????x", 0x3F }; + + /*004AE158 83F8 FF CMP EAX,-1 ;EAX =player index + 004AE15B 74 1A JE SHORT haloce.004AE177 + 004AE15D 6A 03 PUSH 3 + 004AE15F 6A 01 PUSH 1 + 004AE161 6A 00 PUSH 0 + 004AE163 6A 01 PUSH 1 + 004AE165 55 PUSH EBP ;ret val from PrepMsg func + 004AE166 68 20CE8000 PUSH haloce.0080CE20 ;MsgInfo_ptr_address + 004AE16B 6A 01 PUSH 1 + 004AE16D 8BF3 MOV ESI,EBX ;EBX= [6B7384] ServerInfo_ptr_address + 004AE16F E8 6C6F0300 CALL haloce.004E50E0 + 004AE174 83C4 1C ADD ESP,1C*/ + + ADDRESS_SIG SendChatMsgToPlayer_func_addr_sig = + { "\x51\x53\x57\x8B\xF8\x32\xC0\x33\xC9", "xxxxxxxxx", 0 }; + + /*004AE218 6A 03 PUSH 3 + 004AE21A 6A 01 PUSH 1 + 004AE21C 57 PUSH EDI ;0 + 004AE21D 6A 01 PUSH 1 + 004AE21F 68 20CE8000 PUSH haloce.0080CE20 ;MsgInfo_ptr_address + 004AE224 6A 01 PUSH 1 + 004AE226 8BC5 MOV EAX,EBP ;ret val from PrepMsg func + 004AE228 E8 03700300 CALL haloce.004E5230 + 004AE22D 83C4 18 ADD ESP,18*/ + //use (address + 4) - *address to get actually address + ADDRESS_SIG SendChatMsgToAll_func_addr_sig = + { "\x8B\xC5\xE8\x00\x00\x00\x00\x83\xC4\x18\x5D\x5B", "xxx????xxxxx", 3 }; + + /*console + 004C9BDD 53 PUSH EBX //0 + 004C9BDE BF 28206500 MOV EDI,haloce.00652028 //string + 004C9BE3 E8 58030000 CALL haloce.004C9F40 ;hook here + 004C9BE8 83C4 04 ADD ESP,4 + + returns bool (BYTE) succeded + */ + //used with the console buffer + ADDRESS_SIG Console_hook_addr_sig = + { "\x53\xBF\x00\x00\x00\x00\xE8\x00\x00\x00\x00\x83\xC4\x04", "xx????x????xxx", 7 }; + + ADDRESS_SIG Console_func_addr_sig = + { "\x8A\x07\x81\xEC\x00\x05\x00\x00\x3C\x3B", "xxxxxxxxxx", 0 }; + + /*rcon call to console + 004C9F20 6A 00 PUSH 0 + 004C9F22 A3 6CDE6400 MOV DWORD PTR DS:[64DE6C],EAX + 004C9F27 E8 14000000 CALL haloce.004C9F40 + 004C9F2C 83C4 04 ADD ESP,4*/ + ADDRESS_SIG Rcon_hook_addr_sig = + { "\x6A\x00\xA3\x00\x00\x00\x00\xE8\x00\x00\x00\x00\x83\xC4\x04", "xxx????x????xxx", 8 }; + + /*engine draw text + 004E7291 A1 D8076200 MOV EAX,DWORD PTR DS:[6207D8] ;ARGB color (float array) + 004E7296 68 E0D06000 PUSH haloce.0060D0E0 ; ASCII "sv_kick: Can't kick a local client!" + 004E729B E8 E029FBFF CALL haloce.00499C80 + 004E72A0 83C4 04 ADD ESP,4 + */ + //use (address + 4) - *address to get actually address + ADDRESS_SIG EngineDrawText_func_addr_sig = + { "\x83\xEC\x10\x57\x8B\xF8\xA0", "xxxxxxx", 0 }; + + /*0047ED8C 8B00 MOV EAX,DWORD PTR DS:[EAX] ;Player Obj Tag + 0047ED8E E8 9D050F00 CALL haloce.0056F330 + returns 01 if succeded and > 01 if not*/ + ADDRESS_SIG UnitExitVehicle_func_addr_sig = + { "\x55\x8B\xEC\x83\xE4\xF8\x81\xEC\x00\x00\x00\x00\x53\x56\x8B\xF0\x83\xC9", "xxxxxxxx????xxxxxx", 0 }; + + //no paramters + ADDRESS_SIG SpawnHog_func_addr_sig = + { "\xA1\x00\x00\x00\x00\x8B\x88\x64\x01\x00\x00\x85\xC9\x57", "x????xxxxxxxxx", 0 }; + + + /*[40848BF0+i*10]= vehicle biped tag ptr + [40848BE4+0C]->E3D40260 (1st one?) + [40848B44+24]->40848BE4 + [40848198+168]->40848B44 + [6E2280]->40848198 + + 0045B0D9 50 PUSH EAX;00000010 (how many objects to spawn) + 0045B0DA 51 PUSH ECX;408489F4 (ptr to BipdMetaTag) + 0045B0DB E8 A0020000 CALL haloce.0045B380 + 0045B0E0 83C4 08 ADD ESP,8 + returns how many objects spawned*/ + ADDRESS_SIG SpawnObjAtPlayer0_func_addr_sig = + { "\x81\xEC\x00\x00\x00\x00\xE8\x00\x00\x00\x00\x83\xF8\xFF\x0F\x84", "xx????x????xxxxx", 0}; + + /*0047D411 8BC6 MOV EAX,ESI ;obj tag + 0047D413 E8 48C40700 CALL haloce.004F9860*/ + //add 2 bytes to get address of ptr to object data header + ADDRESS_SIG DestroyObj_func_addr_sig = + { "\x8B\x0D\x00\x00\x00\x00\x8B\x51\x34\x57", "xx????xxxx", 0 }; + + /*0048592C 8B00 MOV EAX,DWORD PTR DS:[EAX] ;EAX char pointer to player index, 1 based + 0048592E E8 FD180600 CALL haloce.004E7230 + returns bool succeded*/ + //add 3 bytes to get address of ptr to ServerType + ADDRESS_SIG sv_kick_func_addr_sig = + { "\x66\x83\x3D\xD0\x47\x6B\x00\x02\x75\x6C\xE8\x61\x06\x00\x00\x85\xC0", "xxx????xx?x????xx", 0 }; + + /*0048597E 8B4C24 04 MOV ECX,DWORD PTR SS:[ESP+4] ;ECX is struct ptr to ban time "dhms"? + 00485982 8B4424 08 MOV EAX,DWORD PTR SS:[ESP+8] ;EAX is player index (1 based) + 00485986 E8 35190600 CALL haloce.004E72C0 + returns bool succeded*/ + //add 3 bytes to get address of ptr to ServerType + ADDRESS_SIG sv_ban_func_addr_sig = + { "\x66\x83\x3D\xD0\x47\x6B\x00\x02\x0F\x85\x00\x00\x00\x00\x85\xC0", "xxx????xxx????xx", 0 }; + + /*cinematic_screen_effect_set_video 2 2 + 004840DC 8B48 04 MOV ECX,DWORD PTR DS:[EAX+4] ;pc1.09 004814BC + 004840DF 33D2 XOR EDX,EDX + 004840E1 66:8B10 MOV DX,WORD PTR DS:[EAX] + 004840E4 51 PUSH ECX ;40000000 (2.0) + 004840E5 52 PUSH EDX ;0002 + 004840E6 E8 751E0900 CALL haloce.00515F60 + 004840EB 83C4 08 ADD ESP,8*/ + //add 2 bytes to get cinematic ptr + ADDRESS_SIG cse_set_video_func_addr_sig = + { "\x8B\x15\x00\x00\x00\x00\x56\x33\xF6\x3B\xD6", "xx????xxxxx", 0 }; + + /*00486A43 68 20634800 PUSH haloce.00486320 + 00486A48 6A 04 PUSH 4 + 00486A4A 52 PUSH EDX + 00486A4B 55 PUSH EBP;0018D840 array of strings + 00486A4C E8 0F1E1400 CALL haloce.005C8860;misc dev funtions?(huge function)(hook here) + 00486A51 66:A1 00C46400 MOV AX,WORD PTR DS:[64C400];index to the array of strings + 00486A57 83C4 10 ADD ESP,10 + 00486A5A 5F POP EDI + 00486A5B 5E POP ESI + 00486A5C 5D POP EBP + 00486A5D C705 04C46400 00000000 MOV DWORD PTR DS:[64C404],0;array of strings pointer*/ + //add 12 bytes to get index to the array of strings, add 24 bytes to get the array of strings on the stack + //array size address is -16 bytes from the array index, were the pointer to the array is +4 bytes from the index + ADDRESS_SIG console_tablist_hook_addr_sig = + { "\x6A\x04\x52\x55\xE8\x0F\x1E\x14\x00\x66\xA1", "xxxxx????xx", 5 }; + + /*004869EC 66:8935 00C46400 MOV WORD PTR DS:[64C400],SI;array of strings index + 004869F3 66:890D F0C36400 MOV WORD PTR DS:[64C3F0],CX;array size? + 004869FA 892D 04C46400 MOV DWORD PTR DS:[64C404],EBP;pointer to the array + 00486A00 A3 F4C36400 MOV DWORD PTR DS:[64C3F4],EAX;pointer to the filter string (ex: obj, search for functions that have obj in them) + 00486A05 75 0A JNZ SHORT haloce.00486A11 + ;00486A07 C705 F4C36400 3C365F00 MOV DWORD PTR DS:[64C3F4],haloce.005F363C + 00486A11 66:8915 FCC36400 MOV WORD PTR DS:[64C3FC],DX + 00486A18 BF 60496200 MOV EDI,haloce.00624960 ;pointer to array of functions*/ + ADDRESS_SIG console_tablist_vars_hook_addr_sig = + { "\x57\x66\x89\x35\x00\xC4\x64\x00\x66\x89\x0D", "xxxx????xxx", 4 }; + + //[[this address] + 204] = size of name list + //[[this address] + 208] = ptr to name list + //ADDRESS_SIG map_info_struct_ptr_addr_sig = + //{ "\xEB\x14\x8B\x0D\x00\x00\x00\x00\x6B\xD2\x5C", "xxxx????xxx", 4 }; + + /*0048AAC8 8BCE MOV ECX,ESI ;fast call, ecx = scripted obj index + 0048AACA 5E POP ESI + 0048AACB E9 30050700 JMP haloce.004FB000*/ + //add 1 to get map_info_struct_ptr address + ADDRESS_SIG CreateScriptedObj_func_addr_sig = + { "\xA1\x00\x00\x00\x00\x8B\x90\x08\x02\x00\x00", "x????xxxxxx", 0 }; + + //[this address] = ptr to scripted obj tags DWORD obj_tags[size] + ADDRESS_SIG scripted_objtags_ptr_addr_sig = + { "\x7D\x09\x8B\x35\x00\x00\x00\x00\x89\x0C\x86", "xxxx????xxx", 4 }; + + /*0045B4FB 33C0 XOR EAX,EAX + 0045B4FD 50 PUSH EAX ;unknown + 0045B4FE 8D5424 44 LEA EDX,DWORD PTR SS:[ESP+44] + 0045B502 52 PUSH EDX ;ptr to new obj data, size 88h, see cheat_spawn_hog.asm notes + 0045B503 E8 38DC0900 CALL haloce.004F9140 + 0045B508 66:8B8424 D8000000 MOV AX,WORD PTR SS:[ESP+D8] + 0045B510 83C4 08 ADD ESP,8 + returns new obj tag*/ + ADDRESS_SIG CreateObject_func_addr_sig = + { "\x81\xEC\x1C\x02\x00\x00\x8B\x0D\x00\x00\x00\x00\x53\x55", "xxxxxxxx????xx", 0 }; + + /*0047C7C4 8B6C24 14 MOV EBP,DWORD PTR SS:[ESP+14] + 0047C7C8 8B5C24 14 MOV EBX,DWORD PTR SS:[ESP+14] ;static player tag + 0047C7CC 50 PUSH EAX ;durration = 30 * secs + 0047C7CD 55 PUSH EBP ;unknown 0 for camo or 1 + 0047C7CE E8 6D010000 CALL haloce.0047C940 + 0047C7D3 83C4 08 ADD ESP,8*/ + ADDRESS_SIG ActiveCamo_func_addr_sig = + { "\x83\xFB\xFF\x55\x8B\x6C\x24\x08\x56\x57", "xxxxxxxxxx", 0 }; + + /*004646F1 8BD8 MOV EBX,EAX ;static player tag + 004646F3 A1 44CD6800 MOV EAX,DWORD PTR DS:[68CD44] + 004646F8 85C0 TEST EAX,EAX + 004646FA 74 24 JE SHORT haloce.00464720 + 004646FC 6A 00 PUSH 0 ;respawn time modifier + 004646FE E8 7D490100 CALL haloce.00479080 + 00464703 A1 44CD6800 MOV EAX,DWORD PTR DS:[68CD44] + 00464708 8B80 98000000 MOV EAX,DWORD PTR DS:[EAX+98] + 0046470E 83C4 04 ADD ESP,4*/ + ADDRESS_SIG PlayerDeath_func_addr_sig = + { "\x51\x83\xFB\xFF\x55\x8B\x6C\x24\x0C", "xxxxxxxxx", 0 }; + + namespace Console + { + const BYTE Check_offset = 0; + const BYTE Enabled_offset = 1; + const BYTE Text_offset = 0xB8; + const WORD C_Buffers_offset = 0x1C4; + const WORD C_Buffers_index_offset = 0x9BE; + } + + namespace RasterizerEx + { + const BYTE FPS_offset = 0; + const BYTE WireFrame_offset = 6; + const BYTE FogAtmosphere_offset = 0x27; + const BYTE FogPlane_offset = 0x28; + } + + namespace Cinematic + { + const BYTE Marine_View_f_offset = 0x23; + const BYTE screen_effect_start_offset = 0x38; + } + + //for external processes + namespace CheatsEx + { + const BYTE Deathless_offset = 0; + const BYTE JetPack_offset = 1; + const BYTE Infinite_Ammo_offset = 2; + const BYTE Bmp_Possession_offset = 3; + const BYTE Super_jmp_offset = 4; + const BYTE Reflexive_damage_offset = 5; + const BYTE Medusa_offset = 6; + const BYTE Omnipotent_offset = 7; + const BYTE Controller_offset = 8; + const BYTE Bottomless_Clip_offset = 9; + } + + const short PlayerNameMaxSize = 12; + + // [Animation Trigger] + ADDRESS_SIG AnimTriggers_ptr_sig = + { "\x8B\x0A\x8B\x15\x00\x00\x00\x00\x81\xE1", "xxxx????xx", 4 }; + + ADDRESS_SIG Camera_Data_ptr_addr_sig = + { "\x8D\x9B\x00\x00\x00\x00\xB9\x1A\x00\x00\x00", "xx????xxxxx", 2 }; + + ADDRESS_SIG Local_Player_ptr_addr_sig = + { "\x8B\x0D\x00\x00\x00\x00\x8D\x54\x24\x04", "xx????xxxx", 2 }; + + //use DestroyObj_func_addr_sig + 2 + //ADDRESS_SIG Object_ptr_sig = + //{ "\x8B\x45\x18\x8B\x0D\x00\x00\x00\x00\x8B\x51\x34", "xxxxx????xxx", 5 }; + + ADDRESS_SIG Device_Groups_ptr_sig = //ce 815DB0 pc 87A870 + { "\x66\x83\xF9\xFF\xA1\x00\x00\x00\x00\x74", "xxxxx????x", 5 }; + + ADDRESS_SIG Players_ptr_sig = + { "\xBA\x04\x8B\x15\x00\x00\x00\x00\x25", "xxxx????x", 4 }; + + ADDRESS_SIG HS_Globals_ptr_sig = + { "\x83\xC4\x10\x85\xC9\xA3\x00\x00\x00\x00\x5B", "xxxxxx????x", 6 }; + + ADDRESS_SIG Object_List_Header_ptr_sig = + { "\xA1\x00\x00\x00\x00\x8B\x70\x34\x8B\xD3", "x????xxxxx", 1 }; +} + +/// +/// Halo Combat Evolved specific info, v1.09 +/// +namespace Halo_Lib +{ + /* + const DWORD Deathless_address = 0x87A840;//byte + const DWORD Infinite_Ammo_address = 0x87A842;//byte + const DWORD Bottomless_address = 0x87A849;//byte + + const DWORD ObjectTableHeader_ptr_address = 0x00860030; + const DWORD StaticPlayerHeader_ptr_address = 0x0087A100; + */ +} + +/// +/// Halo Custom Edition specific info, v1.09 +//401000 to 5DF000 +/// +namespace HCE_Lib +{ + ADDRESS_SIG Dev_addr_sig = + { "\x8A\x0D\x00\x00\x00\x00\x80\xE2\x07\x84\xC9", "xx????xxxxx", 2 }; + + /*sv_say + 00485B0C 8B08 MOV ECX,DWORD PTR DS:[EAX] + 00485B0E E8 DD0B0600 CALL haloce.004E66F0 + */ + ADDRESS_SIG sv_say_func_addr_sig = + { "\x51\x66\x83\x3D\xD0\x47\x6B\x00\x02\x75\x2F", "xxxx????xxx", 0 }; + + namespace rpg_beta6_2_hs_global + { + const WORD alarmed_offset = 0xF8C; + const WORD locked_offset = 0xF84; + const WORD nuked_offset = 0xF94; + const WORD setting_offset = 0xF9C; + const WORD lock_timer_offset = 0xFAC; + const WORD boom_timer_offset = 0xFB4; + } + + namespace rpg_beta6_2_device_groups + { + const DWORD alarm_control_1_offset = 0x55C; + const DWORD boom_control_offset = 0x56C; + const DWORD alarm_control_2_offset = 0x57C; + const DWORD alarm_control_3_offset = 0x58C; + const DWORD alarm_control_4_offset = 0x59C; + const DWORD lock_control_offset = 0x5AC; + } + + /* + const DWORD Rider_Eject_address = 0x006249AC;//byte + const DWORD Rasterizer_FPS_address = 0x006249C0;//byte + const DWORD WireFrame_address = 0x006249C6;//byte + const DWORD FogAtmosphere_address = 0x006249E7;//byte + const DWORD FogPlane_address = 0x006249E8;//byte + + const DWORD Dev_address = 0x006BD17E;//byte + + + //halo ce 1.09, 0xE8 offset fro, 1.08 + const DWORD Console_Check_address = 0x00651F70;//byte + const DWORD Console_address = 0x00651F71;//byte + + 00651FF8 console color->alpha + 00651FFC console color->red + 00652000 console color->green + 00652004 console color->blue + 0x00652008 console title "halo( " + const DWORD Console_Buffer_address = 0x00652028;//string, size = 61 os 0xB8 + + //console can remember your last 8 commands//strings, size = 0xFF + //char c_buffers[8][0xFF] + const DWORD C_Buffer_address1 = 0x00652134; + const DWORD C_Buffer_address2 = 0x00652233; + const DWORD C_Buffer_address3 = 0x00652332; + const DWORD C_Buffer_address4 = 0x00652431; + const DWORD C_Buffer_address5 = 0x00652530; + const DWORD C_Buffer_address6 = 0x0065262F; + const DWORD C_Buffer_address7 = 0x0065272E; + const DWORD C_Buffer_address8 = 0x0065282D; + + const DWORD Current_Map_address = 0x00643084;//string + + //active camo offsets + //0x34, eax*4+08, 0x204 + + //game speed 0x40000300 + //0x400002E8 + 0x18 + //004856AE - 8B 15 90CD6800 - mov edx,[0068CD90] : [400002E8] + //004856B4 - 89 4A 18 - mov [edx+18],ecx + const DWORD Game_Speed_ptr_address = 0x0068CD90;//float + + const DWORD Deathless_address = 0x00815D80;//byte 64AC0 + const DWORD JetPack_address = 0x00815D81;//byte + const DWORD Infinite_Ammo_address = 0x00815D82;//byte + const DWORD Bmp_Possession_address = 0x00815D83;//byte + const DWORD Super_jmp_address = 0x00815D84;//byte + const DWORD Reflexive_damage_address = 0x00815D85;//byte + const DWORD Medusa_address = 0x00815D86;//byte + const DWORD Omnipotent_addrress = 0x00815D87;//byte + const DWORD Controller_address = 0x00815D88;//byte + const DWORD Bottomless_Clip_address = 0x00815D89;//byte + //0049753F + //006B44C8 + + //00714E7C //00712542 + const DWORD Rcon_Pass_address = 0x006B74C0;//string + const DWORD Edit_Name_Buffer = 0x006AFF2A;//11 character unicode string + + const DWORD Local_Player_ptr_address = 0x0064C3AC; + + @t@d header ptrs: + + terminal output 0064DE50 (aka console) + + pc texture + pc texture cache + pc sound + pc sound cache + sounds + looping sounds + update client queues + terminal output + weather particles + const DWORD Update_Server_Queues_ptr_address = 0x0068CDB0 + + cached object render states + widget + flag + antenna + glow + glow particles + light volumes + lightnings + const DWORD Device_Groups_ptr_address = 0x00815DB0; + lights + cluster light reference + light cluster reference 007FBB28 + const DWORD Object_ptr_address = 0x007FB3B0; //400506B4 + cluster collideable object refe + collideable object cluster refe + cluster noncollideable object r + noncollideable object r + decals + decal vertex cache + const DWORD Players_ptr_address = 0x008155C0;// points to 0x402AAF94 + teams + contrail + contrail point + particle + effect + effect locations + particle systems + particle system particles + object looping sounds + actor + swarm + swarm component + const DWORD Prop_ptr_address = 0x0081B4A0; + const DWORD Encounter_ptr_address = 0x0081B4A8; + const DWORD AI_Pursuit_ptr_address = 0x0081B4B0; + const DWORD AI_Conversation_ptr_address = 0x0081B4B4; + const DWORD Object_List_Header_ptr_address = 0x008155A4; + const DWORD List_Object_Reference_ptr_address = 0x008155A8; + const DWORD HS_Thread_ptr_address = 0x008155B0; + const DWORD HS_Globals_ptr_address = 0x008155AC; + const DWORD Recorded_Animations_ptr_address = 0x0064B960; + const DWORD Script_Node_ptr_address = 0x008155B4; + + const DWORD Server_chat_address = 0x404D2239; + + //marine view + const DWORD Marine_View_f_address = 0x4000017F;//byte + const DWORD MV_fparameter2_address = 0x40000188;//float + //005DC930 - 0FB6 06 - movzx eax,byte ptr [esi] + //005DC933 - 50 - push eax + //005DC934 - 53 - push ebx + //005DC935 - E8 D5D0FEFF - call 005C9A0F + + //pointer 006B827C + 0x38 + const DWORD Cinematic_address = 0x40000194;//byte + const DWORD Show_Hud_address = 0x400003BC;//byte + + const DWORD LetterBox_address = 0x403FD678;//byte + + //rpg_beta6_2 + const DWORD Alarm_Control_1_address = 0x40027164;//float + const DWORD Boom_Control_address = 0x40027174;//float + const DWORD Alarm_Control_2_address = 0x40027184;//float + const DWORD Alarm_Control_3_address = 0x40027194;//float + const DWORD Alarm_Control_4_address = 0x400271A4;//float + const DWORD Lock_Control_address = 0x400271B4;//float + + //lockdown positions from object table + const DWORD LD1_pos_address = 0x400967B0;//float + const DWORD LD2_pos_address = 0x40091A10;//float + const DWORD LD3_pos_address = 0x40096AF4;//float + const DWORD LD4_pos_address = 0x40090880;//float + const DWORD LD5_pos_address = 0x4008F6BC;//float + const DWORD LD6_pos_address = 0x4008F998;//float + const DWORD LD7_pos_address = 0x4008FC74;//float + const DWORD LD8_pos_address = 0x4008FF50;//float + const DWORD LD9_pos_address = 0x40090260;//float + const DWORD LD10_pos_address = 0x40090570;//float + //lockdown power + const DWORD LD1_pow_address = 0x4002712C;//float + const DWORD LD2_pow_address = 0x40026F6C;//float + const DWORD LD3_pow_address = 0x4002713C;//float + const DWORD LD4_pow_address = 0x40026F0C;//float + const DWORD LD5_pow_address = 0x40026EAC;//float + const DWORD LD6_pow_address = 0x40026EBC;//float + const DWORD LD7_pow_address = 0x4008FC68;//float + const DWORD LD8_pow_address = 0x4008FF44;//float + const DWORD LD9_pow_address = 0x40090254;//float + + const DWORD Locked_address = 0x403FACBC;//bool + const DWORD Alarmed_address = 0x403FACC4;//bool + const DWORD Nuked_address = 0x403FACCC;//bool + const DWORD Setting_address = 0x403FACD4;//short + const DWORD Lock_Timer_address = 0x403FACE4;//short + const DWORD Boom_Timer_address = 0x403FACEC;//short + */ +} + +//haloceded 1.09 +namespace HCED_Lib +{ + /* + const DWORD ObjectTableHeader_ptr_address = 0x006C69F0; + const DWORD StaticPlayerHeader_ptr_address = 0x006E1480; + //cheats 0x006E1C40; + */ +} \ No newline at end of file diff --git a/Halo Dev Controls/HaloLib.h b/Halo Dev Controls/HaloLib.h new file mode 100644 index 0000000..a5e5ed7 --- /dev/null +++ b/Halo Dev Controls/HaloLib.h @@ -0,0 +1,588 @@ +/******************************************************************************** + -- Halo Dev Controls + Copyright © 2011 Jesus7Freak + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +********************************************************************************* + File: HaloLib.h + Project: Halo Dev Controls and HDC + Authors: Steve(Del), Abyll, Rad!, and Jesus7Freak + Date: 11/22/2011 + Game: Halo and Halo Custom Edition + Version: all + + credit to Steve(Del)... for the player info structures + Abyll, and Rad! for further functionality of halo structures +*********************************************************************************/ +#pragma once +#include "RWMemory.h" + +using namespace ReadWriteMemoryTools; + +namespace HaloCE_lib +{ + extern ADDRESS_SIG Current_map_addr_sig; + extern ADDRESS_SIG Rider_Eject_addr_sig; + extern ADDRESS_SIG Console_addr_sig; + extern ADDRESS_SIG Base_ptr_addr_sig; + extern ADDRESS_SIG Cheats_addr_sig; + extern ADDRESS_SIG Show_Hud_ptr_addr_sig; + extern ADDRESS_SIG letterbox_ptr_addr_sig; + extern ADDRESS_SIG Rasterizer_addr_sig; + extern ADDRESS_SIG Cinematic_addr_sig; + + enum SERVER_TYPE { main_menu = 0, client = 1, host = 2 }; + //extern ADDRESS_SIG ServerType_ptr_addr_sig; use sv_kick sig + extern ADDRESS_SIG Game_Speed_ptr_addr_sig; + extern ADDRESS_SIG Grav_Boots_addr_sig; + extern ADDRESS_SIG Time_Freeze_addr_sig; + extern ADDRESS_SIG Rapid_Fire_addr_sig; + extern ADDRESS_SIG Vehicle_NTR_addr_sig; + extern ADDRESS_SIG Local_Chat_func_addr_sig; + extern ADDRESS_SIG Local_Chat_hook_addr_sig; + extern ADDRESS_SIG Server_Chat_hook_addr_sig; + extern ADDRESS_SIG SendChatMsgToPlayer_func_addr_sig; + extern ADDRESS_SIG SendChatMsgToAll_func_addr_sig; + extern ADDRESS_SIG Console_hook_addr_sig; + extern ADDRESS_SIG Console_func_addr_sig; + extern ADDRESS_SIG Rcon_hook_addr_sig; + extern ADDRESS_SIG EngineDrawText_func_addr_sig; + extern ADDRESS_SIG UnitExitVehicle_func_addr_sig; + extern ADDRESS_SIG SpawnHog_func_addr_sig; + //object tag list use [SpawnHog_func_addr_sig + 1] + extern ADDRESS_SIG SpawnObjAtPlayer0_func_addr_sig; + extern ADDRESS_SIG DestroyObj_func_addr_sig; + extern ADDRESS_SIG sv_kick_func_addr_sig; + extern ADDRESS_SIG sv_ban_func_addr_sig; + extern ADDRESS_SIG cse_set_video_func_addr_sig; + extern ADDRESS_SIG console_tablist_hook_addr_sig; + extern ADDRESS_SIG console_tablist_vars_hook_addr_sig; + extern ADDRESS_SIG data_header_bug_addr_sig; + //extern ADDRESS_SIG map_info_struct_ptr_addr_sig; + extern ADDRESS_SIG CreateScriptedObj_func_addr_sig; + extern ADDRESS_SIG scripted_objtags_ptr_addr_sig; + extern ADDRESS_SIG CreateObject_func_addr_sig; + extern ADDRESS_SIG ActiveCamo_func_addr_sig; + extern ADDRESS_SIG PlayerDeath_func_addr_sig; + + namespace Console + { + extern const BYTE Check_offset; + extern const BYTE Enabled_offset; + extern const BYTE Text_offset; + extern const WORD C_Buffers_offset; + extern const WORD C_Buffers_index_offset; + } + + //for internal processes + struct RASTERIZER + { + BYTE FPS; + BYTE Unknown1[5]; + BYTE WireFrame; + BYTE Unknown2[0x20]; + BYTE FogAtmosphere; + BYTE FogPlane; + }; + + //for external processes + namespace RasterizerEx + { + extern const BYTE FPS_offset; + extern const BYTE WireFrame_offset; + extern const BYTE FogAtmosphere_offset; + extern const BYTE FogPlane_offset; + } + + namespace Cinematic + { + extern const BYTE Marine_View_f_offset; + extern const BYTE screen_effect_start_offset; + } + + //for internal processes (rad!) + struct CHEATS + { + BYTE Deathless; + BYTE JetPack; + BYTE Infinite_Ammo; + BYTE Bmp_Possession; + BYTE Super_jump; + BYTE Reflexive_damage; + BYTE Medusa; + BYTE Omnipotent; + BYTE Controller; + BYTE Bottomless_Clip; + }; + + //for external processes + namespace CheatsEx + { + extern const BYTE Deathless_offset; + extern const BYTE JetPack_offset; + extern const BYTE Infinite_Ammo_offset; + extern const BYTE Bmp_Possession_offset; + extern const BYTE Super_jmp_offset; + extern const BYTE Reflexive_damage_offset; + extern const BYTE Medusa_offset; + extern const BYTE Omnipotent_offset; + extern const BYTE Controller_offset; + extern const BYTE Bottomless_Clip_offset; + } + + union OBJECT_TAG + { + int Tag; + struct + { + short Index; + short ID; + }; + }; + + struct OBJECT_TABLE_ARRAY + { + WORD ObjectID; // Matches up to Object ID in player table ( for players ) + BYTE Unknown0;//+0x2 + BYTE ObjectType;//+0x3 //player obj=0 veh=1 wep=2 scenery=6? + WORD Unknown1;//+0x4 + WORD Size;//+0x6 // Structure size + DWORD Object_ptr;//+0x8 // Pointer to the object data structure + }; + + extern const short PlayerNameMaxSize; + + extern ADDRESS_SIG Camera_Data_ptr_addr_sig; + + struct CAMERA_DATA + { + DWORD unknown; //always 1? + float m_fWorld[3]; + }; + + extern ADDRESS_SIG Local_Player_ptr_addr_sig; + + struct LOCAL_PLAYER + { + WORD Unknown00; + WORD Unknown01;//+0x2 + DWORD Unknown02[3];//+0x4 + WORD ObjectIndex;//+0x10 + WORD ObjectID;//+0x12 + BYTE Jumping;//+0x14 //jumping = 2, standing = 0 + BYTE Unknown03[7];//+0x15 + float m_fRot[3];//+0x1C + }; + + struct STATIC_PLAYER//512bytes 0x402AAFCC + { + short PlayerID; // Stats at 0x70EC + short IsLocalPlayer;//+0x2 // 0 = local -1 = not + wchar_t PlayerName0[12];//+0x4 // Unicode / Max - 11 Chars + EOS (12 total) + short UnknownIndex0;//+0x1C // Always -1 / 0xFFFFFFFF + short UnknownID0;//+0x1E + DWORD Team;//+0x20 // 0 = Red / 1 = Blue + long SwapID;//+0x24 // ObjectID + short SwapType;//+0x28 // 8 = Vehicle / 6 = Weapon + short SwapSeat;//+0x2A // Warthog - Driver = 0 / Passenger = 1 / Gunner = 2 / Weapon = -1 + DWORD RespawnTimer;//+0x2C // ?????? Counts down when dead, Alive = 0 + DWORD Unknown1;//+0x30 // Always 0 + OBJECT_TAG PlayerObjTag;//+0x34 + OBJECT_TAG PrevPlayerObjTag;//+0x38 // Some sort of ID + short LocationIndex;//+0x3E // This is very, very interesting. BG is split into 25 location ID's. 1 -19 + long Unknown2;//+0x40 // Always -1 / 0xFFFFFFFF + DWORD BulletCount;//+0x44 // Something to do with bullets increases - weird. + wchar_t PlayerName1[12];//+0x48 // Unicode / Max - 11 Chars + EOS (12 total) + OBJECT_TAG UnknownIndex;//0x60 //02 00 FF FF + char PlayerRespIndex;//+0x64 + char Uknown23;//+0x65 + BYTE Uknown3;//+0x66 + char PlayerChatIndex;//+0x67 same as player index, if changed to another players index, it will use their name + WORD ActiveCamoTimer;//+0x68 + WORD Unknown4;//+0x6A + float SpeedModifier;//+0x6C // Normal = 1 + DWORD UnknownIdent3[4];//+0x70 + long Unknown5;//+0x80 + long LastDeathTime;//+0x84 // since game start(0) + BYTE Unknown6[18];//+0x88 + short KillsCount;//+0x9A + BYTE Unknown7[6];//+0xA2 + short AssistsCount;//+0xA8 + BYTE Unknown8[8];//+0xAA + short BetrayedCount;//+0xB2 + short DeathsCount;//+0xB4 actually //+0xB0 + short SuicideCount;//+0xB6 + BYTE Unknown9[18]; + short FlagStealCount; + short FlagReturnCount; + short FlagCaptureCount; + BYTE Unknown10[6]; + DWORD UnknownIdent4; + BYTE Unknown11[8]; + short Ping;//+0xDC + BYTE Unknown12[14]; + DWORD Unknown13;//+0xDE + long Unknown14; + long SomeTime; + float m_World[3];//+0x; + DWORD UnknownIdent6; + BYTE Unknown111[20]; + BYTE Melee : 1; + BYTE Action : 1; + BYTE UnknownBit : 1; + BYTE Flashlight : 1; + BYTE UnknownBit1 : 4; + BYTE UnknownBit2 : 5; + BYTE Reload : 1; + BYTE UnknownBit3 : 2; + BYTE Unknown15[26]; + float m_LowerRot[3];//+0x; // Yaw, Pitch (again, in radians. + float ForwardVelocityMultiplier; + float HorizontalVelocityMultiplier; + float RateOfFireVelocityMultiplier; + short HeldWeaponIndex; + short GrenadeIndex; + BYTE Unknown16[4]; + float LookVect[3]; + BYTE Unknown17[16]; + float m_World_delay[3]; // Oddly enough... it matches the world vect, but seems to lag behind (Possibly what the client reports is _its_ world coord?) + BYTE Unknown18[128]; + }; + + //the STATIC_PLAYER_HEADER is pretty much the same as the OBJECT_TABLE_HEADER + struct DATA_HEADER + { + char TName[32]; // Item name + short MaxItems;//+0x20 // max number of items + short ItemSize;//+0x22 // size of each item + bool Initialized;//+0x24 // setup at the start of the game + BYTE Unknown;//+0x25 //maybe Initialized is a BOOL? + short Unknown2;//+0x26 //however halo accesses it as a byte + char Data[4];//+0x28 // '@t@d' - translated as 'data' + short NextValidItemIndex;//+0x2C //something about the items index + short NumOfItems;//+0x2E // # of items + short NextItemIndex;//+0x30 // Index number of the next Item to be created + short NextItemID;//+0x32 // ID number of the next Item to be created + DWORD FirstItem;//+0x34// Pointer to the first Item in the array + }; + + // [Animation Trigger] + extern ADDRESS_SIG AnimTriggers_ptr_sig; + + //DATA_HEADER pointer sigs + //extern ADDRESS_SIG Object_ptr_sig; use DestroyObj_func_addr_sig + 2 + extern ADDRESS_SIG Device_Groups_ptr_sig; + extern ADDRESS_SIG Players_ptr_sig; + extern ADDRESS_SIG HS_Globals_ptr_sig; + extern ADDRESS_SIG Object_List_Header_ptr_sig; + //list object reference ptr is + 4 from object list header ptr + + /*struct OBJECT_TABLE_HEADER + { + char TName[32]; // 'object' + WORD MaxObjects;//+0x20 // Maximum number of objects - 0x800(2048 objects) + WORD Size;//+0x22 // Size of each object array - 0x0C(12 bytes) + DWORD Unknown0;//+0x24 // always 1? + char Data[4];//+0x28 // '@t@d' - translates to 'data'? + WORD Max; // Max number of objects the game has reached (slots maybe?) + WORD Num; // Number of objects in the current game + WORD NextObjectIndex; // Index number of the next object to spawn + WORD NextObjectID; // ID number of the next object to spawn + DWORD FirstObject; // Pointer to the first object in the table + }; + + struct STATIC_PLAYER_HEADER + { + char TName[32]; // 'players' + WORD MaxSlots;//+0x20 // Max number of slots/players possible + WORD SlotSize;//+0x22 // Size of each Static_Player struct + DWORD Unknown;//+0x24 // always 1? + char Data[4];//+0x28 // '@t@d' - translated as 'data'? + WORD InMainMenu;//+0x2C // 0 = in game 1 = in main menu / not in game + WORD SlotsTaken;//+0x2E // or # of players + WORD NextPlayerIndex;//+0x30 // Index # of the next player to join + WORD NextPlayerID;//+0x32 // ID # of the next player to join + DWORD Static_Player_ptr;//+0x34 // Pointer to the first static player + };*/ + + struct WEAPON_OBJECT//size 0x66C 0x584 different for each one + { + BYTE unknown[0x240]; + float battery_used;//+0x240 + BYTE unknown1[0x72];//+0x72 + //rapid fire, NOP bytes (1.08 pc) 004C3379: D9 47 10 + //(1.09 ce) 004C6769 + //float fire rate 0x260 or 0x270? + short rounds_total;//+0x2B6 + short rounds_loaded;//+0x2B8 + float battery_gauge;//+0x438 + }; + + struct VEHICLE_OBJECT// + { + OBJECT_TAG BipdMetaTag; // [Biped] + DWORD Zeros_00;//+0x4 + BYTE BitFlags_00[4];//+0x8 + DWORD Timer_00;//+0xC + BYTE BitFlags_01[4];//+0x10 + DWORD Timer_01;//+0x14 + BYTE Zeros_01[68];//+0x18 + float m_World[3];//+0x5C + float m_Velocity[3];//+0x68 + float m_LowerRot[3];//+0x74 + float m_Scale[3];//+0x80 + BYTE unknown[0x40];//+0x8C + OBJECT_TAG AntrMetaTag;//+0xCC // [Animation Trigger]characters\cyborg\cyborg + short Animation_Trigger;//+0xD0 + short Flag1;//+0xD2 + short Flag2;//+0xD4 + short Flag3;//+0xD6 + BYTE Unknown1[274];//+0xD8 + short ptr_index1;//+0x1EA + BYTE Uknown2[2];//+0x1EC + short ptr_index2;//+0x1EE + BYTE Unkown3[176];//+0x1F0 + BYTE standflag;//+0x2A0 + BYTE fixedflag;//+0x2A1 + BYTE Unknown4;//+0x2A2 + BYTE Action;//+0x2A3 + BYTE Unknown5[128];//+2A4 + OBJECT_TAG DriverObjTag;//+0x324 + }; + + struct SPARTAN//size 0x91C - 2332 + { + OBJECT_TAG BipdMetaTag; // [Biped]characters\cyborg_mp\cyborg_mp + DWORD Zeros_00;//+0x4 + BYTE BitFlags_00[4];//+0x8 + DWORD Timer_00;//+0xC + DWORD BitFlags_01;//+0x10 + DWORD Timer_01;//+0x14 + BYTE Zeros_01[68];//+0x18 + float m_World[3];//+0x5C + float m_Velocity[3];//+0x68 + float m_LowerRot[3];//+0x74 + float m_Scale[3];//+0x80 + float m_SpinVelocity[3];//+0x8C + DWORD LocationID;//+0x98 + DWORD Pointer_00;//+0x9C + float xUnknown;//+0xA0 + float yUnknown;//+0xA4 + float zUnknown;//+0xA8 + float Unknownf0;//+0xAC + float obj_scale;//+0xB0 object_set_scale 1st param + float Unknownf1;//+0xB4 + float Unknownf2;//+0xB8 + float Unknownf3;//+0xBC + OBJECT_TAG PlayerTag;//+0xC0 + DWORD Unknown00;//+0xC4 + BYTE Zeros_04[4];//+0xC8 + OBJECT_TAG AntrMetaTag;//+0xCC // [Animation Trigger]characters\cyborg\cyborg + short Animation_Trigger;//0xD0 + short BitFlags_02;//+0xD2 + short obj_scale_2nd_param; //+0xD4 object_set_scale 2nd param + short unknownflag; //+0xD6 + float Max_vitality_param1;//+0xD8 + float Max_vitality_param2;//+0xDC + float Health;//+0xE0 + float Shield_00;//+0xE4 + DWORD Zeros_05;//+0xE8 + float Unknown02;//+0xEC + DWORD Unknown03;//+0xF0 + float Unknown04;//+0xF4 + float Unknown05;//+0xF8 -- + DWORD Unknown06a;//+0xFC + int DamageFromPlayer;//+0x100 + BYTE Unknown06b[2];//+0x104 + BYTE KillPlayer;//+0x106 write 0x20 = unit_kill, 0x40 unit_kill_silent, 0xC = death, 0x10=overshield + BYTE Unknown06c[13];//+0x107 + OBJECT_TAG VehicleWeaponTag;//+0x114 + OBJECT_TAG WeaponTag;//+0x118 + OBJECT_TAG VehicleTag;//+0x11C // Ex: Turret on Warthog + short SeatType;//+0x120 + BYTE BitFlags_03[2];//+0x122 + DWORD Zeros_06;//+0x124 + float Shield_01;//+0x128 + float Flashlight_00;//+0x12C + float Zeros_07;//+0x130 + float Flashlight_01;//+0x134 + BYTE Unknown10[204];//+0x138 + WORD IsInvisible;//+0x204 // normal = 0x41 invis = 0x51 (bitfield?) + BYTE Unknown11;//+0x206 + BYTE IsSuspended;//+0x207 + BYTE IsCrouching;//+0x208 // crouch = 1, jump = 2 + BYTE Unknown12[3];//+0x209 + BYTE Unknown13[148];//+0x20C + BYTE AnimationType;//+0x2A0 + BYTE Unknown135[2];//+0x2A1 + BYTE Action;//+0x2A3 enter vehicle = 0x1A, exit vehicle = 0x1B + BYTE Unknown14[76];//+0x2A4 + BYTE VehSeatType;//+0x2F0 + BYTE Unknown145[655];//+0x2F1 + float LeftThigh[13];//+0x580 + float RightThigh[13];//+0x5B4 + float Pelvis[13];//+0x5E8 + float LeftCalf[13];//+0x61C + float RightCalf[13];//+0x650 + float Spine[13];//+0x684 + float LeftClavicle[13];//+0x6B8 + float LeftFoot[13];//+0x6E7 + float Neck[13];//+0x720 + float RightClavicle[13];//+0x754 + float RightFoot[13];//+0x788 + float Head[13];//+0x7BC + float LeftUpperArm[13];//+0x7F0 + float RightUpperArm[13];//+0x824 + float LeftLowerArm[13];//+0x858 + float RightLowerArm[13];//+0x88C + float LeftHand[13];//+0x8C0 + float RightHand[13];//+0x8F4 + }; +} + +namespace Halo_Lib +{ + extern const DWORD Deathless_address; + extern const DWORD Infinite_Ammo_address; + extern const DWORD Bottomless_address; +} + +namespace HCE_Lib +{ + extern ADDRESS_SIG Dev_addr_sig; + extern ADDRESS_SIG sv_say_func_addr_sig; + + namespace rpg_beta6_2_device_groups + { + extern const DWORD alarm_control_1_offset; + extern const DWORD boom_control_offset; + extern const DWORD alarm_control_2_offset; + extern const DWORD alarm_control_3_offset; + extern const DWORD alarm_control_4_offset; + extern const DWORD lock_control_offset; + } + + namespace rpg_beta6_2_hs_global + { + extern const WORD alarmed_offset; + extern const WORD locked_offset; + extern const WORD nuked_offset; + extern const WORD setting_offset; + extern const WORD lock_timer_offset; + extern const WORD boom_timer_offset; + } + + /* + extern const DWORD Rider_Eject_address; + extern const DWORD Rasterizer_FPS_address; + extern const DWORD WireFrame_address; + extern const DWORD FogAtmosphere_address; + extern const DWORD FogPlane_address; + + extern const DWORD Dev_address; + + + extern const DWORD Console_Check_address; + extern const DWORD Console_address; + + extern const DWORD Console_Buffer_address; + extern const DWORD C_Buffer_address1; + extern const DWORD C_Buffer_address2; + extern const DWORD C_Buffer_address3; + extern const DWORD C_Buffer_address4; + extern const DWORD C_Buffer_address5; + extern const DWORD C_Buffer_address6; + extern const DWORD C_Buffer_address7; + extern const DWORD C_Buffer_address8; + + extern const DWORD Current_Map_address; + + extern const DWORD Game_Speed_ptr_address; + + extern const DWORD Deathless_address; + extern const DWORD JetPack_address; + extern const DWORD Infinite_Ammo_address; + extern const DWORD Bmp_Possession_address; + extern const DWORD Super_jmp_address; + extern const DWORD Reflexive_damage_address; + extern const DWORD Medusa_address; + extern const DWORD Omnipotent_addrress; + extern const DWORD Controller_address; + extern const DWORD Bottomless_Clip_address; + + extern const DWORD Rcon_Pass_address; + extern const DWORD Edit_Name_Buffer; + + extern const DWORD Local_Player_ptr_address; + extern const DWORD ObjectTableHeader_ptr_address; + extern const DWORD StaticPlayerHeader_ptr_address; + extern const DWORD Server_chat_address; + + extern const DWORD Marine_View_f_address; + extern const DWORD MV_fparameter2_address; + + extern const DWORD Cinematic_address; + extern const DWORD Show_Hud_address; + + extern const DWORD LetterBox_address; + + //rpg_beta6_2 + extern const DWORD Alarm_Control_1_address; + extern const DWORD Boom_Control_address; + extern const DWORD Alarm_Control_2_address; + extern const DWORD Alarm_Control_3_address; + extern const DWORD Alarm_Control_4_address; + extern const DWORD Lock_Control_address; + + //lockdown positions from object table + extern const DWORD LD1_pos_address; + extern const DWORD LD2_pos_address; + extern const DWORD LD3_pos_address; + extern const DWORD LD4_pos_address; + extern const DWORD LD5_pos_address; + extern const DWORD LD6_pos_address; + extern const DWORD LD7_pos_address; + extern const DWORD LD8_pos_address; + extern const DWORD LD9_pos_address; + extern const DWORD LD10_pos_address; + //lockdown power + extern const DWORD LD1_pow_address; + extern const DWORD LD2_pow_address; + extern const DWORD LD3_pow_address; + extern const DWORD LD4_pow_address; + extern const DWORD LD5_pow_address; + extern const DWORD LD6_pow_address; + extern const DWORD LD7_pow_address; + extern const DWORD LD8_pow_address; + extern const DWORD LD9_pow_address; + + + + extern const DWORD Locked_address; + extern const DWORD Alarmed_address; + extern const DWORD Nuked_address; + extern const DWORD Setting_address; + extern const DWORD Lock_Timer_address; + extern const DWORD Boom_Timer_address; + */ +} + +//haloceded 1.09 +namespace HCED_Lib +{ + /* + extern const DWORD ObjectTableHeader_ptr_address; + extern const DWORD StaticPlayerHeader_ptr_address; + */ +} \ No newline at end of file diff --git a/Halo Dev Controls/KeyLib.cpp b/Halo Dev Controls/KeyLib.cpp new file mode 100644 index 0000000..9fa3d2c --- /dev/null +++ b/Halo Dev Controls/KeyLib.cpp @@ -0,0 +1,170 @@ +/******************************************************************************** + -- Halo Dev Controls + Copyright © 2011 Jesus7Freak + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +********************************************************************************* + File: KeyLib.cpp + Project: Halo Dev Controls + Author: Jesus7Freak + Date: 11/22/2011 + Game: Halo and Halo Custom Edition + Version: all +*********************************************************************************/ +#include "KeyLib.h" + +#define KEY_INFO_LIST_SIZE 223 + +namespace KeyLib +{ + wchar_t *szUknownKey = L"Uknown"; + + KEY_INFO key_info_list[NUM_OF_KEYS] = + { + {0,L"none"}, + {1,L"Left Mouse Button"}, + {2,L"Right Mouse Button"}, + {3,L"Cancel"}, + {4,L"Middle Mouse Button"}, + {5,L"X1 Mouse Button"}, + {6,L"X2 Mouse Button"}, + {8,L"BackSpace"}, + {9,L"Tab"}, + {12,L"Clear"}, + {13,L"Enter"}, + {16,L"Shift"}, + {17,L"Control"}, + {18,L"Alt"}, + {19,L"Pause"}, + {20,L"Caps Lock"}, + {27,L"Escape"}, + {32,L"Space Bar"}, + {33,L"Page Up"}, + {34,L"Page Down"}, + {35,L"End"}, + {36,L"Home"}, + {37,L"Left Arrow"}, + {38,L"Up Arrow"}, + {39,L"Right Arrow"}, + {40,L"Down Arrow"}, + {42,L"Print"}, + {44,L"Print Screen"}, + {45,L"Insert"}, + {46,L"Delete"}, + {47,L"Help"}, + {48,L"0"}, + {49,L"1"}, + {50,L"2"}, + {51,L"3"}, + {52,L"4"}, + {53,L"5"}, + {54,L"6"}, + {55,L"7"}, + {56,L"8"}, + {57,L"9"}, + {65,L"A"}, + {66,L"B"}, + {67,L"C"}, + {68,L"D"}, + {69,L"E"}, + {70,L"F"}, + {71,L"G"}, + {72,L"H"}, + {73,L"I"}, + {74,L"J"}, + {75,L"K"}, + {76,L"L"}, + {77,L"M"}, + {78,L"N"}, + {79,L"O"}, + {80,L"P"}, + {81,L"Q"}, + {82,L"R"}, + {83,L"S"}, + {84,L"T"}, + {85,L"U"}, + {86,L"V"}, + {87,L"W"}, + {88,L"X"}, + {89,L"Y"}, + {90,L"Z"}, + {96,L"NumPad 0"}, + {97,L"NumPad 1"}, + {98,L"NumPad 2"}, + {99,L"NumPad 3"}, + {100,L"NumPad 4"}, + {101,L"NumPad 5"}, + {102,L"NumPad 6"}, + {103,L"NumPad 7"}, + {104,L"NumPad 8"}, + {105,L"NumPad 9"}, + {106,L"NumPad *"}, + {107,L"NumPad +"}, + {109,L"NumPad -"}, + {110,L"NumPad ."}, + {111,L"NumPad /"}, + {112,L"F1"}, + {113,L"F2"}, + {114,L"F3"}, + {115,L"F4"}, + {116,L"F5"}, + {117,L"F6"}, + {118,L"F7"}, + {119,L"F8"}, + {120,L"F9"}, + {121,L"F10"}, + {122,L"F11"}, + {123,L"F12"}, + {124,L"F13"}, + {125,L"F14"}, + {126,L"F15"}, + {127,L"F16"}, + {128,L"F17"}, + {129,L"F18"}, + {130,L"F19"}, + {131,L"F20"}, + {132,L"F21"}, + {133,L"F22"}, + {134,L"F23"}, + {135,L"F24"}, + {144,L"Num Lock"}, + {145,L"Scroll Lock"}, + {186,L"OEM ;"}, + {187,L"OEM ="}, + {188,L"OEM ,"}, + {189,L"OEM -"}, + {190,L"OEM ."}, + {191,L"OEM /"}, + {192,L"OEM `"}, + {219,L"OEM ["}, + {220,L"OEM \\"}, + {221,L"OEM ]"}, + {222,L"OEM '"} + //{-1,L"none"} + }; + + wchar_t* Get_Key_Name(unsigned int keycode) + { + wchar_t *name = szUknownKey; + for (int i = 0; i < KEY_INFO_LIST_SIZE; i++) + { + if (key_info_list[i].key_code == keycode) + { + name = key_info_list[i].key_name; + break; + } + } + return name; + } +} \ No newline at end of file diff --git a/Halo Dev Controls/KeyLib.h b/Halo Dev Controls/KeyLib.h new file mode 100644 index 0000000..46c80c7 --- /dev/null +++ b/Halo Dev Controls/KeyLib.h @@ -0,0 +1,41 @@ +/******************************************************************************** + -- Halo Dev Controls + Copyright © 2011 Jesus7Freak + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +********************************************************************************* + File: KeyLib.h + Project: Halo Dev Controls + Author: Jesus7Freak + Date: 11/22/2011 + Game: Halo and Halo Custom Edition + Version: all +*********************************************************************************/ +#pragma once + +#define NUM_OF_KEYS 119 + +namespace KeyLib +{ + struct KEY_INFO + { + short key_code; + wchar_t* key_name; + }; + + extern wchar_t *szUknownKey; + extern KEY_INFO key_info_list[NUM_OF_KEYS]; + + wchar_t* Get_Key_Name(unsigned int keycode); +} \ No newline at end of file diff --git a/Halo Dev Controls/RWMemory.cpp b/Halo Dev Controls/RWMemory.cpp new file mode 100644 index 0000000..de10184 --- /dev/null +++ b/Halo Dev Controls/RWMemory.cpp @@ -0,0 +1,1212 @@ +/******************************************************************************** + -- Read Write Memory Tools + Copyright © 2011 Jesus7Freak + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +********************************************************************************* + File: RWMemory.cpp + Project: Read Write Memory Tools + Author: Jesus7Freak + Date: 10/29/2011 + Version: 2.30 +*********************************************************************************/ +//uses both ASCII and UNICODE functions +#ifdef UNICODE +#undef UNICODE +#endif + +#include "RWMemory.h" + +namespace ReadWriteMemoryTools +{ + bool str_cmpA(char *str1, char *str2, int length) + { + bool match = true; + if (length >= 0) + { + //specific length comparison + for (int i = 0; i < length; i++) + { + if (str1[i] != str2[i]) + { + match = false; + break; + } + } + } + else + { + //compare until null terminator + int i = 0; + char _char1; char _char2; + do//compare the null terminator as well + { + _char1 = str1[i]; + _char2 = str2[i]; + if (_char1 != _char2) + { + match = false; + break; + } + + i++; + }while(_char1 && _char2); + } + return match; + } + + bool str_cmpW(wchar_t *str1, wchar_t *str2, int length) + { + bool match = true; + if (length >= 0) + { + //specific length comparison + for (int i = 0; i < length; i++) + { + if (str1[i] != str2[i]) + { + match = false; + break; + } + } + } + else + { + //compare until null terminator + int i = 0; + wchar_t _wchar1; wchar_t _wchar2; + do//compare the null terminator as well + { + _wchar1 = str1[i]; + _wchar2 = str2[i]; + if (_wchar1 != _wchar2) + { + match = false; + break; + } + + i++; + }while(_wchar1 && _wchar2); + } + return match; + } + + #pragma region Constructors / Deconstructor + RWMemory::RWMemory(wchar_t* process_name, DWORD process_to_use) + { + P = NULL; + P = new tagPROCESSENTRY32W; LastWin32Error = 0; + std::vector process = + GetProcessesByNameW(process_name); + + //to prevent array out of bounds error when the process is killed + if (!process.empty()) + *P = process[process_to_use]; + + hProcess = ::OpenProcess( + PROCESS_CREATE_THREAD | + PROCESS_QUERY_INFORMATION | + PROCESS_VM_OPERATION | + PROCESS_VM_WRITE | + PROCESS_VM_READ, + false, + P->th32ProcessID + ); + + if (!hProcess) + { + LastWin32Error = ::GetLastError(); + //if this is spamming messageboxes, disable timer first + //then re-enable after messagebox returns + wchar_t Message[27 + HEXNUM_LENGTH] = + { + 'O','p','e','n','P','r','o','c','e','s','s',':',' ', + 'E','r','r','o','r',' ','C','o','d','e',':',' ','0','x' + }; + ::swprintf_s(&Message[27], HEXNUM_LENGTH, L"%lX", LastWin32Error); + + ::MessageBoxW( + NULL, + Message, + L"Error", + MB_OK | MB_ICONWARNING | MB_TASKMODAL + ); + } + } + + RWMemory::RWMemory(DWORD process_id) + { + P = NULL; + P = new tagPROCESSENTRY32W(GetProcessByID_W(process_id)); + LastWin32Error = 0; + + hProcess = ::OpenProcess( + PROCESS_CREATE_THREAD | + PROCESS_QUERY_INFORMATION | + PROCESS_VM_OPERATION | + PROCESS_VM_WRITE | + PROCESS_VM_READ, + false, + P->th32ProcessID + ); + + if (!hProcess) + { + LastWin32Error = ::GetLastError(); + wchar_t Message[27 + HEXNUM_LENGTH] = + { + 'O','p','e','n','P','r','o','c','e','s','s',':',' ', + 'E','r','r','o','r',' ','C','o','d','e',':',' ','0','x' + }; + ::swprintf_s(&Message[27], HEXNUM_LENGTH, L"%lX", LastWin32Error); + + ::MessageBoxW( + NULL, + Message, + L"Error", + MB_OK | MB_ICONWARNING | MB_TASKMODAL + ); + } + } + + RWMemory::RWMemory(tagPROCESSENTRY32W process) + { + P = NULL; + P = new tagPROCESSENTRY32W(process); + LastWin32Error = 0; + + hProcess = ::OpenProcess( + PROCESS_CREATE_THREAD | + PROCESS_QUERY_INFORMATION | + PROCESS_VM_OPERATION | + PROCESS_VM_WRITE | + PROCESS_VM_READ, + false, + P->th32ProcessID + ); + + if (!hProcess) + { + LastWin32Error = ::GetLastError(); + wchar_t Message[27 + HEXNUM_LENGTH] = + { + 'O','p','e','n','P','r','o','c','e','s','s',':',' ', + 'E','r','r','o','r',' ','C','o','d','e',':',' ','0','x' + }; + ::swprintf_s(&Message[27], HEXNUM_LENGTH, L"%lX", LastWin32Error); + + ::MessageBoxW( + NULL, + Message, + L"Error", + MB_OK | MB_ICONWARNING | MB_TASKMODAL + ); + } + } + + RWMemory::~RWMemory() + { + if (P) + { + delete P; + P = NULL; + } + + if (hProcess) + { + if (! ::CloseHandle(hProcess)) + LastWin32Error = ::GetLastError(); + hProcess = NULL; + } + } + #pragma endregion + + std::vector RWMemory::GetProcessesA() + { + tagPROCESSENTRY32 pe32; + std::vector pe32_list; + //DWORD lpBinaryType = 0; + + try + { + // Take a snapshot of all processes in the system. + HANDLE hProcessSnap = + ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); + if (hProcessSnap != INVALID_HANDLE_VALUE) + { + // Set the size of the structure before using it. + pe32.dwSize = sizeof(tagPROCESSENTRY32); + + if (::Process32First(hProcessSnap, &pe32)) + { + do + { + //::GetBinaryType(pe32.szExeFile, lpBinaryType); + //if (sizeof(ULONG_PTR) == + pe32_list.push_back(pe32); + } + while (::Process32Next(hProcessSnap, &pe32)); + } + } + + ::CloseHandle(hProcessSnap); + } + catch(...) {} + + + return pe32_list; + } + + std::vector RWMemory::GetProcessesW() + { + tagPROCESSENTRY32W pe32; + std::vector pe32_list; + //DWORD lpBinaryType = 0; + + try + { + // Take a snapshot of all processes in the system. + HANDLE hProcessSnap = + ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); + if (hProcessSnap != INVALID_HANDLE_VALUE) + { + // Set the size of the structure before using it. + pe32.dwSize = sizeof(tagPROCESSENTRY32W); + + if (::Process32FirstW(hProcessSnap, &pe32)) + { + do + { + //::GetBinaryType(pe32.szExeFile, lpBinaryType); + //if (sizeof(ULONG_PTR) == + pe32_list.push_back(pe32); + } + while (::Process32NextW(hProcessSnap, &pe32)); + } + } + + ::CloseHandle(hProcessSnap); + } + catch(...) {} + + + return pe32_list; + } + + std::vector RWMemory::GetProcessesByNameA( + char* process_name) + { + std::vector pe32_list = GetProcessesA(), processes; + + DWORD pe32_list_size = pe32_list.size(); + for (DWORD pe32_i = 0; pe32_i < pe32_list_size; pe32_i++) + { + if (str_cmpA(process_name, pe32_list[pe32_i].szExeFile)) + processes.push_back(pe32_list[pe32_i]); + } + + return processes; + } + + std::vector RWMemory::GetProcessesByNameW( + wchar_t* process_name) + { + std::vector pe32_list = GetProcessesW(), processes; + + DWORD pe32_list_size = pe32_list.size(); + for (DWORD pe32_i = 0; pe32_i < pe32_list_size; pe32_i++) + { + if (str_cmpW(process_name, pe32_list[pe32_i].szExeFile)) + processes.push_back(pe32_list[pe32_i]); + } + + return processes; + } + + tagPROCESSENTRY32 RWMemory::GetProcessByID_A(DWORD process_ID) + { + std::vector pe32_list = GetProcessesA(); + tagPROCESSENTRY32 process; + + process.dwSize = 0;//test if this is still zero before using + DWORD pe32_list_size = pe32_list.size(); + for (unsigned int pe32_i = 0; pe32_i < pe32_list_size; pe32_i++) + { + if (process_ID == pe32_list[pe32_i].th32ProcessID) + { + process = pe32_list[pe32_i]; + break; + } + } + + return process; + } + + tagPROCESSENTRY32W RWMemory::GetProcessByID_W(DWORD process_ID) + { + std::vector pe32_list = GetProcessesW(); + tagPROCESSENTRY32W process; + + process.dwSize = 0;//test if this is still zero before using + DWORD pe32_list_size = pe32_list.size(); + for (unsigned int pe32_i = 0; pe32_i < pe32_list_size; pe32_i++) + { + if (process_ID == pe32_list[pe32_i].th32ProcessID) + { + process = pe32_list[pe32_i]; + break; + } + } + + return process; + } + + std::vector RWMemory::GetProcessModulesA() + { + tagMODULEENTRY32 me32; + std::vector me32_list; + + try + { + // Take a snapshot of all modules in the process. + HANDLE hModuleSnap = ::CreateToolhelp32Snapshot( + TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, + P->th32ProcessID + ); + if (hModuleSnap != INVALID_HANDLE_VALUE) + { + // Set the size of the structure before using it. + me32.dwSize = sizeof(tagMODULEENTRY32); + + if (::Module32First(hModuleSnap, &me32)) + { + do + { + me32_list.push_back(me32); + } + while (::Module32Next(hModuleSnap, &me32)); + } + } + else + LastWin32Error = ::GetLastError(); + + if (!::CloseHandle(hModuleSnap)) + LastWin32Error = ::GetLastError(); + } + catch(...) {} + + return me32_list; + } + + std::vector RWMemory::GetProcessModulesW() + { + tagMODULEENTRY32W me32; + std::vector me32_list; + + try + { + // Take a snapshot of all modules in the process. + HANDLE hModuleSnap = ::CreateToolhelp32Snapshot( + TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, + P->th32ProcessID + ); + if (hModuleSnap != INVALID_HANDLE_VALUE) + { + // Set the size of the structure before using it. + me32.dwSize = sizeof(tagMODULEENTRY32W); + + if (::Module32FirstW(hModuleSnap, &me32)) + { + do + { + me32_list.push_back(me32); + } + while (::Module32NextW(hModuleSnap, &me32)); + } + } + else + LastWin32Error = ::GetLastError(); + + if (!::CloseHandle(hModuleSnap)) + LastWin32Error = ::GetLastError(); + } + catch(...) {} + + return me32_list; + } + + tagMODULEENTRY32 RWMemory::GetProcessModuleByNameA( + char* module_name) + { + std::vector me32_list = GetProcessModulesA(); + tagMODULEENTRY32 module; + + module.dwSize = 0;//test if this is still zero before using + DWORD me32_list_size = me32_list.size(); + for (unsigned int me32_i = 0; me32_i < me32_list_size; me32_i++) + { + if (str_cmpA(module_name, me32_list[me32_i].szModule)) + { + module = me32_list[me32_i]; + break; + } + } + + return module; + } + + tagMODULEENTRY32W RWMemory::GetProcessModuleByNameW( + wchar_t* module_name) + { + std::vector me32_list = GetProcessModulesW(); + tagMODULEENTRY32W module; + + module.dwSize = 0;//test if this is still zero before using + DWORD me32_list_size = me32_list.size(); + for (unsigned int me32_i = 0; me32_i < me32_list_size; me32_i++) + { + if (str_cmpW(module_name, me32_list[me32_i].szModule)) + { + module = me32_list[me32_i]; + break; + } + } + + return module; + } + + void RWMemory::ModuleSectionAddr_Size( + HMODULE hModule, + ULONG_PTR &Section_Address, + SIZE_T &Section_Size, + BYTE SectionName[IMAGE_SIZEOF_SHORT_NAME], + bool x64_module) + { + //Offset to PE sig + DWORD PE_sig_offset = ReadMem((LPVOID)( + (ULONG_PTR)hModule + FIELD_OFFSET(IMAGE_DOS_HEADER, e_lfanew))); + + WORD num_of_sections = ReadMem((LPVOID)( + //offset to NumberOfSections + (ULONG_PTR)hModule + PE_sig_offset + + FIELD_OFFSET(IMAGE_NT_HEADERS32, FileHeader) + + FIELD_OFFSET(IMAGE_FILE_HEADER, NumberOfSections))); + + //add the rest of the PE header size and base of module + ULONG_PTR sections = (ULONG_PTR)hModule + PE_sig_offset ; + + if (x64_module) + sections += sizeof(IMAGE_NT_HEADERS64); + else + sections += sizeof(IMAGE_NT_HEADERS32); + + for (int i = 0; i < num_of_sections; i++) + { + int sect_index = i * sizeof(IMAGE_SECTION_HEADER); + + BYTE buffer[IMAGE_SIZEOF_SHORT_NAME] = {0}; + ReadMemArray( + (LPVOID)(sections + sect_index), + buffer, + IMAGE_SIZEOF_SHORT_NAME); + + if (str_cmpA((char*)SectionName,(char*)buffer, IMAGE_SIZEOF_SHORT_NAME)) + { + Section_Address = (ULONG_PTR)hModule + ReadMem((LPVOID)( + sections + sect_index + + FIELD_OFFSET(IMAGE_SECTION_HEADER, VirtualAddress))); + + Section_Size = ReadMem((LPVOID)( + sections + sect_index + + RTL_FIELD_SIZE(IMAGE_SECTION_HEADER, Name))); + break; + } + } + } + + LPVOID RWMemory::GetRemoteProcAddress(HMODULE hModule, LPCSTR lpProcName, bool x64_module) + { + char func_name[64]; WORD func_index = 0; ULONG_PTR func_address = NULL; + + /*using defined data structs method to get Export Table address offset + IMAGE_DOS_HEADER *IDH = (IMAGE_DOS_HEADER*)hModule; + IMAGE_NT_HEADERS *INH = (IMAGE_NT_HEADERS*)(hModule + IDH->e_lfanew); + IMAGE_EXPORT_DIRECTORY *IED = (IMAGE_EXPORT_DIRECTORY*)( + hModule + INH->OptionalHeader.DataDirectory[0].VirtualAddress); + */ + + DWORD PE_sig_offset = ReadMem(//IMAGE_DOS_HEADER->e_lfanew + (LPVOID)((ULONG_PTR)hModule + FIELD_OFFSET(IMAGE_DOS_HEADER, e_lfanew)) + ); + + //IMAGE_NT_HEADERS->OptionalHeader.DataDirectory[0].VirtualAddress + DWORD offset_to_ET = RTL_FIELD_SIZE(IMAGE_NT_HEADERS, Signature) + + RTL_FIELD_SIZE(IMAGE_NT_HEADERS, FileHeader); + + if (x64_module) + offset_to_ET += FIELD_OFFSET(IMAGE_OPTIONAL_HEADER64, DataDirectory); + else + offset_to_ET += FIELD_OFFSET(IMAGE_OPTIONAL_HEADER32, DataDirectory); + + DWORD Export_Table_offset = ReadMem( + (LPVOID)((ULONG_PTR)hModule + (ULONG_PTR)PE_sig_offset + offset_to_ET) + ); + + ::IMAGE_EXPORT_DIRECTORY IED = ReadMem< ::IMAGE_EXPORT_DIRECTORY>( + (LPVOID)((ULONG_PTR)hModule + Export_Table_offset) + ); + + bool found = false; + if ((DWORD)lpProcName >> 16 != 0) + { + for (DWORD name_i = 0; name_i < IED.NumberOfNames && !found; name_i++) + { + DWORD str_offset = ReadMem( + (LPVOID)((ULONG_PTR)hModule + IED.AddressOfNames + + (name_i * sizeof(DWORD))) + ); + + ReadMemString((LPVOID)((ULONG_PTR)hModule + str_offset), func_name); + + if (str_cmpA((char*)lpProcName, (char*)func_name)) + { + func_index = ReadMem((LPVOID)((ULONG_PTR)hModule + + IED.AddressOfNameOrdinals + (name_i * sizeof(WORD)))); + found = true; + } + } + } + else + { + func_index = (WORD)(lpProcName - IED.Base); + found = true; + } + + if (found) + func_address = (ULONG_PTR)hModule + ReadMem((LPVOID)( + (ULONG_PTR)hModule + IED.AddressOfFunctions + + (func_index * sizeof(DWORD)))); + + return (LPVOID)func_address; + } + + ULONG_PTR RWMemory::FindMemPattern( + ULONG_PTR MemoryAddress, + SIZE_T Len, + BYTE *Pattern, + const char* Mask) + { + ULONG_PTR PatterAddress = 0; + BYTE* buffer = new BYTE[Len](); + ReadMemArray((LPVOID)MemoryAddress, buffer, Len); + + for(ULONG_PTR i = 0; i < Len && !PatterAddress; i++) + { + //while Mask[i2] isnt the null terminator + for(ULONG_PTR i2 = 0; Mask[i2]; i2++) + { + //make sure its not at the end of the mask before continuing + if (Mask[i2] == '?' && Mask[i2 + 1]) + continue; + //if the bytes don't match exit loop + if (Mask[i2] == 'x' && buffer[i + i2] != Pattern[i2]) + break; + //when it reaches the end, it must be the address we're looking for + if (!Mask[i2 + 1]) + PatterAddress = MemoryAddress + i; + } + } + + delete[] buffer; + return PatterAddress; + } + + bool RWMemory::ReadMemString(LPVOID MemoryAddress, char str[]) + { + bool succeded = true; SIZE_T BytesRead; + long i = 0; + + do + { + if (!::ReadProcessMemory( + hProcess, + (LPVOID)((ULONG_PTR)MemoryAddress + (i * sizeof(char))), + &str[i], + sizeof(char), + &BytesRead)) + { + LastWin32Error = ::GetLastError(); + succeded = false; + } + + }while(str[i++] != 0); + + return succeded; + } + + bool RWMemory::ReadMemString(LPVOID MemoryAddress, wchar_t str[]) + { + bool succeded = true; SIZE_T BytesRead; + long i = 0; + + do + { + if (!::ReadProcessMemory( + hProcess, + (LPVOID)((ULONG_PTR)MemoryAddress + (i * sizeof(wchar_t))), + &str[i], sizeof(wchar_t), + &BytesRead)) + { + LastWin32Error = ::GetLastError(); + succeded = false; + } + + }while(str[i++] != 0); + + return succeded; + } + + bool RWMemory::WriteMemString(LPVOID MemoryAddress, const char* str) + { + bool succeeded = true; SIZE_T BytesWritten; + + //c string length + int length = 0; while(str[length++]); + + if (!::WriteProcessMemory( + hProcess, + MemoryAddress, + (void*)str, length * sizeof(char), + &BytesWritten)) + { + LastWin32Error = ::GetLastError(); + succeeded = false; + } + + return succeeded; + } + + bool RWMemory::WriteMemString(LPVOID MemoryAddress, const wchar_t* str) + { + bool succeeded = true; SIZE_T BytesWritten; + + //c string length + int length = 0; while(str[length++]); + + if (!::WriteProcessMemory( + hProcess, + MemoryAddress, + (void*)str, length * sizeof(wchar_t), + &BytesWritten)) + { + LastWin32Error = ::GetLastError(); + succeeded = false; + } + + return succeeded; + } + + bool RWMemory::WriteMemJMP( + LPVOID JMPLocMemAddress, + LPVOID JMPToMemAddress, + BYTE size) + { + bool succeeded = false; + BYTE* bytes = new BYTE[size](); + ULONG_PTR JMP_to_code = (ULONG_PTR)JMPToMemAddress + - ((ULONG_PTR)JMPLocMemAddress + 5); + + bytes[0] = 0xE9;//JMP + TO_BYTES(UINT_PTR, &bytes[1], JMP_to_code); + + for (BYTE i = 5; i < size; i++) + bytes[i] = 0x90;//NOP + + if (WriteMemArray(JMPLocMemAddress, bytes, size)) + succeeded = true; + + delete[] bytes; + return succeeded; + } + + LPVOID RWMemory::AllocateMemory(SIZE_T size) + { + LPVOID address_of_alloc = ::VirtualAllocEx( + hProcess, + NULL, + size, + MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE + ); + + if (!address_of_alloc) + LastWin32Error = ::GetLastError(); + + return address_of_alloc; + } + + bool RWMemory::FreeMemory(LPVOID MemoryAddress) + { + bool succeded = false; + if (!::VirtualFreeEx(hProcess, MemoryAddress, NULL, MEM_RELEASE)) + LastWin32Error = GetLastError(); + else + succeded = true; + + return succeded; + } + + ULONG_PTR RWMemory::CallRemoteFunction( + LPTHREAD_START_ROUTINE lpStartAddress, + DWORD call_type, + ULONG_PTR *lpParameters, + DWORD num_of_params + ) + { + int size; BYTE *asmfunc; ULONG_PTR asmfunc_loc = NULL; + + //x86 calls + if (call_type != __X64FASTCALL) + { + size = 11 + (5 * num_of_params); + if (call_type == __CDECL) + size += 3; + + //allocate memory for the calling function and a DWORD var + asmfunc_loc = (ULONG_PTR)AllocateMemory(size + sizeof(DWORD)); + //try once more + if (!asmfunc_loc) + { + Sleep(100); + asmfunc_loc = (ULONG_PTR)AllocateMemory(size + sizeof(DWORD)); + //failed again + if (!asmfunc_loc) return NULL; + } + + asmfunc = new BYTE[size](); + + /* asmfunc x86 template + ?68 xxxxxxxx //push xxxxxxxx parameters? + ... + ?BA xxxxxxxx //mov edx,xxxxxxxx fastcall param2 + ?B9 xxxxxxxx //mov ecx,xxxxxxxx fastcall param1 or thiscall ptr + E8 xxxxxxxx //call xxxxxxxx + ?83 C4 xx //add esp,xx cdecl stack clean up + A3 xxxxxxxx //mov [xxxxxxxx],eax + C3 //ret + */ + + int byte_loc = 0; + int pushed_params = num_of_params; + if (call_type == __FASTCALL) + pushed_params -= 2; + else if (call_type == __THISCALL) + pushed_params--; + + //write the parameters in the function + for (int param_i = 0; param_i < pushed_params; param_i++) + { + asmfunc[byte_loc++] = 0x68; //push param@i + TO_BYTES( + DWORD, + &asmfunc[byte_loc], + lpParameters[num_of_params - 1 - param_i]); + + byte_loc += sizeof(DWORD); + } + + if (call_type == __FASTCALL && num_of_params > 1) + { + asmfunc[byte_loc++] = 0xBA; //mov edx,xxxxxxxx + TO_BYTES(DWORD, &asmfunc[byte_loc], lpParameters[1]); + + byte_loc += sizeof(DWORD); + } + + if (call_type == __FASTCALL && num_of_params > 0 + || call_type == __THISCALL) + { + asmfunc[byte_loc++] = 0xB9; //mov ecx,xxxxxxxx + TO_BYTES(DWORD, &asmfunc[byte_loc], lpParameters[0]); + byte_loc += sizeof(DWORD); + } + + //calculate destination function offset + asmfunc[byte_loc++] = 0xE8; //call + TO_BYTES( + DWORD, + &asmfunc[byte_loc], + (DWORD)lpStartAddress - ((DWORD)asmfunc_loc + byte_loc + 4)); + + byte_loc += sizeof(DWORD); + + if (call_type == __CDECL) + { + asmfunc[byte_loc++] = 0x83; //add esp,num_of_params * sizeof(DWORD) + asmfunc[byte_loc++] = 0xC4; + asmfunc[byte_loc++] = (BYTE)(num_of_params * sizeof(DWORD)); + } + + //store the return val at the end the the func + //could also use 0x89 0x05 ? + asmfunc[byte_loc++] = 0xA3; //mov [ret_val_address],eax + TO_BYTES(DWORD, &asmfunc[byte_loc], (DWORD)asmfunc_loc + size); + byte_loc += sizeof(DWORD); + + asmfunc[byte_loc++] = 0xC3; //ret + } + //x64 call + else + { + size = 22 + sizeof(ULONG_PTR); + for (DWORD i = 0; i < num_of_params; i++) + { + if (i < 4) + size += 10; + else + size += 15; + } + + //allocate memory for the calling function and a QWORD var + asmfunc_loc = (ULONG_PTR)AllocateMemory(size + sizeof(QWORD)); + //try once more + if (!asmfunc_loc) + { + Sleep(100); + asmfunc_loc = (ULONG_PTR)AllocateMemory(size + sizeof(QWORD)); + //failed again + if (!asmfunc_loc) return NULL; + } + + asmfunc = new BYTE[size](); + + /* asmfunc x64 template + 48 83 EC xx //sub rsp,xx + ... + 48 B8 xxxxxxxxxxxxxxxx //mov rax,xxxxxxxxxxxxxxxx + 48 89 44 24 xx //mov [rsp+xx],rax + 49 B9 xxxxxxxxxxxxxxxx //mov r9,xxxxxxxxxxxxxxxx + 49 B8 xxxxxxxxxxxxxxxx //mov r8,xxxxxxxxxxxxxxxx + 48 BA xxxxxxxxxxxxxxxx //mov rdx,xxxxxxxxxxxxxxxx + 48 89 xxxxxxxxxxxxxxxx //mov rcx,xxxxxxxxxxxxxxxx + FF 15 xxxxxxxx //call qword ptr [xxxxxxxx] + 48 89 05 xxxxxxxx //mov [xxxxxxxx],rax + 48 83 C4 xx //add rsp,xx + C3 //ret + */ + + int byte_loc = 0; + BYTE stack_alloc_size = 0; + //8(the return address) + 32(reserved space for 4 arguments) + if (num_of_params > 4) + stack_alloc_size += ((BYTE)num_of_params - 4) * 8; + stack_alloc_size += 8 + 32; + //stack pointer RSP must be aligned on a 16-byte boundary + //before a next function call. + stack_alloc_size += stack_alloc_size % 16; + + asmfunc[byte_loc++] = 0x48; //sub rsp,xx + asmfunc[byte_loc++] = 0x83; + asmfunc[byte_loc++] = 0xEC; + asmfunc[byte_loc++] = stack_alloc_size; + + //write the parameters in the function + for (int i = 0; num_of_params - i > 4; i++) + { + asmfunc[byte_loc++] = 0x48; ////mov rax,xxxxxxxxxxxxxxxx + asmfunc[byte_loc++] = 0xB8; + TO_BYTES(QWORD, &asmfunc[byte_loc], lpParameters[num_of_params - 1 - i]); + byte_loc += sizeof(QWORD); + + asmfunc[byte_loc++] = 0x48; + asmfunc[byte_loc++] = 0x89; + asmfunc[byte_loc++] = 0x44; + asmfunc[byte_loc++] = 0x24; + asmfunc[byte_loc++] = (BYTE)(((num_of_params - 1) * sizeof(QWORD)) - + (i * sizeof(QWORD))); + } + + if (num_of_params >= 4) + { + asmfunc[byte_loc++] = 0x49; //mov r9,param4 + asmfunc[byte_loc++] = 0xB9; + TO_BYTES(QWORD, &asmfunc[byte_loc], lpParameters[3]); + byte_loc += sizeof(QWORD); + } + if (num_of_params >= 3) + { + asmfunc[byte_loc++] = 0x49; //mov r8,param3 + asmfunc[byte_loc++] = 0xB8; + TO_BYTES(QWORD, &asmfunc[byte_loc], lpParameters[2]); + byte_loc += sizeof(QWORD); + } + if (num_of_params >= 2) + { + asmfunc[byte_loc++] = 0x48; //mov rdx,param2 + asmfunc[byte_loc++] = 0xBA; + TO_BYTES(QWORD, &asmfunc[byte_loc], lpParameters[1]); + byte_loc += sizeof(QWORD); + } + if (num_of_params >= 1) + { + asmfunc[byte_loc++] = 0x48; //mov rcx,param1 + asmfunc[byte_loc++] = 0xB9; + TO_BYTES(QWORD, &asmfunc[byte_loc], lpParameters[0]); + byte_loc += sizeof(QWORD); + } + + //calculate destination function offset + asmfunc[byte_loc++] = 0xFF; //call qword ptr [xxxxxxxx] + asmfunc[byte_loc++] = 0x15; + asmfunc[byte_loc++] = 0x0C; + byte_loc += 3; + //next 3 are already zero + + //store the return val at the end the the func + asmfunc[byte_loc++] = 0x48; //mov [ret_val_address],rax + asmfunc[byte_loc++] = 0x89; + asmfunc[byte_loc++] = 0x05; + asmfunc[byte_loc++] = 0x0D; + byte_loc += 3; + //next 3 are already zero + + asmfunc[byte_loc++] = 0x48; //add rsp,xx + asmfunc[byte_loc++] = 0x83; + asmfunc[byte_loc++] = 0xC4; + asmfunc[byte_loc++] = stack_alloc_size; + + asmfunc[byte_loc++] = 0xC3; //ret + + TO_BYTES(QWORD, &asmfunc[byte_loc], lpStartAddress); + } + + //write the calling function to allocated space + WriteMemArray((LPVOID)asmfunc_loc, asmfunc, size); + + //call the injected function + HANDLE NewThreadhnd = ::CreateRemoteThread( + hProcess, + NULL, + 0, + (LPTHREAD_START_ROUTINE)asmfunc_loc, + NULL, + 0, + NULL + ); + + if (NewThreadhnd) + { + ::WaitForSingleObject(NewThreadhnd, 1000); + ::CloseHandle(NewThreadhnd); + } + else + LastWin32Error = ::GetLastError(); + + //get the return val + ULONG_PTR return_val = ReadMem((LPVOID)(asmfunc_loc + size)); + + //DWORD pointer return, doesn't work with x64 values + //::GetExitCodeThread(NewThreadhnd, &return_val); + + //free allocated memory for the calling function and a UINT_PTR var + FreeMemory((LPVOID)asmfunc_loc); + delete[] asmfunc; + + return return_val; + } + + //code help from http://www.codeproject.com/KB/threads/winspy.aspx + HMODULE RWMemory::InjectDLL(const void* DLLPath, bool bUnicode, bool is_x64_dll) + { + HMODULE hLibModule = NULL; + int mem_size; + char *tLoadLibrary; + + if (!bUnicode) + { + //c string length + char *DLLPathA = (char*)DLLPath; + while(*DLLPathA++); + + mem_size = (DWORD)DLLPathA - (DWORD)DLLPath; + tLoadLibrary = "LoadLibraryA"; + } + else + { + //c string length + wchar_t *DLLPathW = (wchar_t*)DLLPath; + while(*DLLPathW++); + + mem_size = (DWORD)DLLPathW - (DWORD)DLLPath; + tLoadLibrary = "LoadLibraryW"; + } + + tagMODULEENTRY32 hKernel32 = GetProcessModuleByNameA("kernel32.dll"); + + if (hKernel32.dwSize) + { + LPTHREAD_START_ROUTINE LoadLibrary_address = + (LPTHREAD_START_ROUTINE)GetRemoteProcAddress( + hKernel32.hModule, + tLoadLibrary, + is_x64_dll + ); + + if (LoadLibrary_address) + { + //Allocate then write DLLPath to memory + LPVOID pLibRemote = AllocateMemory(mem_size); + + SIZE_T BytesWritten; + if (!::WriteProcessMemory( + hProcess, + pLibRemote, + DLLPath, + mem_size, + &BytesWritten) + ) + LastWin32Error = ::GetLastError(); + + DWORD call_type; + if (is_x64_dll) + call_type = __X64FASTCALL; + else + call_type = __STDCALL; + + //Load DLL into remote process, return base of loaded module + ULONG_PTR parameters[] = { (ULONG_PTR)pLibRemote }; + hLibModule = (HMODULE)CallRemoteFunction( + LoadLibrary_address, + call_type, + parameters, + 1 + ); + + FreeMemory(pLibRemote); + } + } + return hLibModule; + } + + /*concept based off of Joachim Bauch's MemoryModule + HMODULE RWMemory::InjectMemoryModule(const LPVOID DLLData) + { + PIMAGE_DOS_HEADER dos_header; + PIMAGE_NT_HEADERS nt_header; + BYTE *code, *headers; + SIZE_T locationDelta; + DllEntryProc DllEntry; + BOOL successfull; + + still working on... + return hLibModule; + }*/ + + bool RWMemory::UnloadDLL(HMODULE hLibModule, bool is_x64_dll) + { + bool succeded = false; + tagMODULEENTRY32 hKernel32 = GetProcessModuleByNameA("kernel32.dll"); + + LPTHREAD_START_ROUTINE FreeLibrary_address = + (LPTHREAD_START_ROUTINE)GetRemoteProcAddress( + hKernel32.hModule, + "FreeLibrary", + is_x64_dll + ); + + DWORD call_type; + if (is_x64_dll) + call_type = __X64FASTCALL; + else + call_type = __STDCALL; + + //Unload DLL from remote process + ULONG_PTR parameters[] = { (ULONG_PTR)hLibModule }; + succeded = CallRemoteFunction( + FreeLibrary_address, + call_type, + parameters, + 1 + ) != 0; + + return succeded; + } + + namespace CurrentProcess + { + ULONG_PTR FindMemPattern( + ULONG_PTR MemoryAddress, + SIZE_T Len, + BYTE *Pattern, + char* Mask) + { + ULONG_PTR PatterAddress = 0; + BYTE* data = (BYTE*)MemoryAddress; + + for(ULONG_PTR i = 0; i < Len && !PatterAddress; i++) + { + //while Mask[i2] isnt the null terminator + for(ULONG_PTR i2 = 0; Mask[i2]; i2++) + { + //make sure its not at the end of the mask before continuing + if (Mask[i2] == '?' && Mask[i2 + 1]) + continue; + //if the bytes don't match exit loop + if (Mask[i2] == 'x' && data[i + i2] != Pattern[i2]) + break; + //if it reaches the end, it must be the address your looking for + if (!Mask[i2 + 1]) + PatterAddress = MemoryAddress + i; + } + } + + return PatterAddress; + } + + ULONG_PTR FindMemPattern( + ULONG_PTR MemoryAddress, + SIZE_T Len, + ADDRESS_SIG addr_sig) + { + return FindMemPattern( + MemoryAddress, + Len, + addr_sig.pattern, + addr_sig.mask) + addr_sig.offset; + } + + LPVOID AllocateMemory(SIZE_T size) + { + int LastWin32Error = 0; + LPVOID address_of_alloc = ::VirtualAlloc(NULL, size, + MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); + + if (!address_of_alloc) + LastWin32Error = ::GetLastError(); + + return address_of_alloc; + } + + bool FreeMemory(LPVOID MemoryAddress) + { + int LastWin32Error = 0; + bool succeded = false; + if (!::VirtualFree(MemoryAddress, NULL, MEM_RELEASE)) + LastWin32Error = GetLastError(); + else + succeded = true; + + return succeded; + } + } +} \ No newline at end of file diff --git a/Halo Dev Controls/RWMemory.h b/Halo Dev Controls/RWMemory.h new file mode 100644 index 0000000..ad71f46 --- /dev/null +++ b/Halo Dev Controls/RWMemory.h @@ -0,0 +1,268 @@ +/******************************************************************************** + -- Read Write Memory Tools + Copyright © 2011 Jesus7Freak + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +********************************************************************************* + File: RWMemory.h + Project: Read Write Memory Tools + Author: Jesus7Freak + Date: 10/29/2011 + Version: 2.30 +*********************************************************************************/ +#pragma once +// Exclude rarely-used stuff from Windows headers +#define WIN32_LEAN_AND_MEAN +#define NOCOMM +#include +#include +#include + +//#if defined(_WIN64) +typedef unsigned __int64 QWORD; +//#endif + +//call types for CallRemoteFunction: +#define __CDECL 0 +#define __STDCALL 1 +#define __FASTCALL 2 +#define __THISCALL 3 +#define __X64FASTCALL 4 + +#define HEXNUM_LENGTH ((sizeof(ULONG_PTR) * 2) + 1) + +//saves space from type casting +#define TO_BYTES(type, byte_array, value) (*(type*)byte_array = (type)value) + + +namespace ReadWriteMemoryTools +{ + static const int version = 230; + + struct ADDRESS_SIG + { + BYTE pattern[25]; + char mask[25]; + char offset; + }; + + bool str_cmpA(char *str1, char *str2, int length = -1); + bool str_cmpW(wchar_t *str1, wchar_t *str2, int length = -1); + + class RWMemory + { + private: + tagPROCESSENTRY32W* P; + HANDLE hProcess; + + + public: + int LastWin32Error; + + RWMemory() { P = NULL; hProcess = NULL; LastWin32Error = 0; } + RWMemory(wchar_t* process_name, DWORD process_to_use = 0); + RWMemory(DWORD process_id); + RWMemory(tagPROCESSENTRY32W process); + ~RWMemory(); + + static std::vector GetProcessesA(); + static std::vector GetProcessesW(); + + static std::vector GetProcessesByNameA( + char* process_name + ); + + static std::vector GetProcessesByNameW( + wchar_t* process_name + ); + + static tagPROCESSENTRY32 GetProcessByID_A(DWORD process_ID); + static tagPROCESSENTRY32W GetProcessByID_W(DWORD process_ID); + + HANDLE GetProcessHandle() + { return hProcess; } + + tagPROCESSENTRY32W GetProcessEntry() + { return *P; } + + std::vector GetProcessModulesA(); + std::vector GetProcessModulesW(); + + tagMODULEENTRY32 GetProcessModuleByNameA(char* module_name); + tagMODULEENTRY32W GetProcessModuleByNameW(wchar_t* module_name); + + void ModuleSectionAddr_Size( + HMODULE hModule, + ULONG_PTR &Section_Address, + SIZE_T &Section_Size, + BYTE SectionName[IMAGE_SIZEOF_SHORT_NAME], + bool x64_module + ); + + LPVOID GetRemoteProcAddress( + HMODULE hModule, + LPCSTR lpProcName, + bool x64_module + ); + + ULONG_PTR FindMemPattern( + ULONG_PTR MemoryAddress, + SIZE_T Len, + BYTE *Pattern, + const char* Mask + ); + + ULONG_PTR FindMemPattern( + ULONG_PTR MemoryAddress, + SIZE_T Len, + ADDRESS_SIG addr_sig) + { + ULONG_PTR address = FindMemPattern( + MemoryAddress, + Len, + addr_sig.pattern, + addr_sig.mask); + + //so that other non-zero checks will work + if (address) address += addr_sig.offset; + + return address; + } + + + template inline + T ReadMem(LPVOID MemoryAddress) + { + T buffer; SIZE_T BytesRead; + + if (!::ReadProcessMemory( + hProcess, + MemoryAddress, + &buffer, + sizeof(T), + &BytesRead)) + LastWin32Error = ::GetLastError(); + + return buffer; + } + + template inline + bool ReadMemArray(LPVOID MemoryAddress, LPVOID obj, SIZE_T read_length) + { + bool succeded = true; SIZE_T BytesRead; + + if (!::ReadProcessMemory( + hProcess, + MemoryAddress, + obj, + sizeof(T) * read_length, + &BytesRead)) + { + LastWin32Error = ::GetLastError(); + succeded = false; + } + + return succeded; + } + + //use this will keep reading until it hits the null terminator + //use ReadMemArray to read a certain length + bool ReadMemString(LPVOID MemoryAddress, char str[]); + bool ReadMemString(LPVOID MemoryAddress, wchar_t str[]); + + template inline + bool WriteMem(LPVOID MemoryAddress, T obj) + { + + bool succeeded = true; SIZE_T BytesWritten; T buffer = obj; + + if (!::WriteProcessMemory( + hProcess, + MemoryAddress, + &buffer, + sizeof(T), + &BytesWritten)) + { + LastWin32Error = ::GetLastError(); + succeeded = false; + } + + return succeeded; + } + + template inline + bool WriteMemArray(LPVOID MemoryAddress, LPVOID obj, SIZE_T write_length = 1) + { + bool succeeded = true; SIZE_T BytesWritten; + + if (!::WriteProcessMemory( + hProcess, + MemoryAddress, + obj, + sizeof(T) * write_length, + &BytesWritten)) + { + LastWin32Error = ::GetLastError(); + succeeded = false; + } + + return succeeded; + } + + //for null terminated strings, use WriteMemArray if no null terminator + bool WriteMemString(LPVOID MemoryAddress, const char* str); + bool WriteMemString(LPVOID MemoryAddress, const wchar_t* str); + + bool WriteMemJMP( + LPVOID JMPLocMemAddress, + LPVOID JMPToMemAddress, + BYTE size = 5 + ); + + LPVOID AllocateMemory(SIZE_T size); + bool FreeMemory(LPVOID MemoryAddress); + + //can call functions with multiple parameter, x86 and x64 + //call types, based off of visual studio 2008 compiler + ULONG_PTR CallRemoteFunction( + LPTHREAD_START_ROUTINE lpStartAddress, + DWORD call_type, + ULONG_PTR *lpParameters = NULL, + DWORD num_of_params = 0 + ); + + //x86 apps cant inject into x64, instead make it x64 + //can return a 64-bit value + HMODULE InjectDLL(const void* DLLPath, bool bUnicode, bool is_x64_dll); + bool UnloadDLL(HMODULE hLibModule, bool is_x64_dll); + }; + + namespace CurrentProcess + { + ULONG_PTR FindMemPattern( + ULONG_PTR MemoryAddress, + SIZE_T Len, + BYTE *Pattern, + char* Mask + ); + + ULONG_PTR FindMemPattern( + ULONG_PTR MemoryAddress, + SIZE_T Len, + ADDRESS_SIG addr_sig); + + LPVOID AllocateMemory(SIZE_T size); + bool FreeMemory(LPVOID MemoryAddress); + } +} \ No newline at end of file diff --git a/Halo Dev Controls/Resource.h b/Halo Dev Controls/Resource.h new file mode 100644 index 0000000..66ade7b --- /dev/null +++ b/Halo Dev Controls/Resource.h @@ -0,0 +1,98 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by WinDialog.rc +// +#define IDI_WINMAIN 101 +#define IDB_MW_BG 105 +#define IDD_ABOUT 106 +#define IDB_EYE 107 +#define IDD_CMDS 108 +#define IDD_CHANGE_KEY 109 +#define IDD_TELE_LOC 110 +#define IDM_EXTRAS 210 +#define IDM_DEV_COMMANDS 211 +#define IDM_RPGBETA_COMMANDS 212 +#define IDM_PLAYER_COMMANDS 213 +#define IDM_TELEPORT_LOCATIONS 214 +#define IDM_ABOUT 215 +#define IDC_HALO_TYPE 220 +#define IDC_HALO_STATUS 221 +#define IDC_MAP_LBL 222 +#define IDC_MAP_STATUS 223 +#define IDC_MENU_BUTTON 224 +#define IDC_SERVER_STATUS 225 +#define IDC_DEV 226 +#define IDC_CONSOLE 227 +#define IDC_DEATHLESS 228 +#define IDC_INFAMMO 229 +#define IDC_SHOWHUD 230 +#define IDC_LETTERBOX 231 +#define IDC_MHUD 232 +#define IDC_SETTING 233 +#define IDC_ALARM 234 +#define IDC_BLD_LBL 235 +#define IDC_BLD_TXTBX 236 +#define IDC_BLD_SET_BTN 237 +#define IDC_BLD_ACT_BTN 238 +#define IDC_HALO_LBL 239 +#define IDC_HALO_TXTBX 240 +#define IDC_HALO_SET_BTN 241 +#define IDC_HALO_ACT_BTN 242 +#define IDS_EDIT_MASK 310 +#define IDS_MOUSEOVER 311 +#define IDC_VERSION 1001 +#define IDC_ABOUT_NAME 1002 +#define IDC_ABOUT_CREDITS 1003 +#define IDC_ABOUT_THANKS 1004 +#define IDC_ABOUT_PLAYER_CMDS 1005 +#define IDC_ABOUT_AUTHOR 1006 +#define IDC_ABOUT_VERSION 1007 +#define IDC_LISTBOX 1008 +#define IDC_BACKGROUND 1009 +#define IDC_CMD_TXTBX 1010 +#define IDC_CC_SET_BTN 1011 +#define IDC_ENABLE 1012 +#define IDC_ACT_BTN 1013 +#define IDC_ON_BTN 1014 +#define IDC_OFF_BTN 1015 +#define IDC_USAGE_LBL 1016 +#define IDC_ACT_LBL 1017 +#define IDC_SEC_DESCRIPT 1018 +#define IDC_TITLE 1019 +#define IDC_GT_LBL 1019 +#define IDC_ON_LBL 1020 +#define IDC_OFF_LBL 1021 +#define IDC_CK_CODE 1022 +#define IDC_DESCRIPT_LBL 1022 +#define IDC_CK_I_LBL 1023 +#define IDC_CK_LBL 1024 +#define IDC_CK_NAME_LBL 1025 +#define IDC_CK_HCODE 1026 +#define IDC_TL_MAPLIST 1026 +#define IDC_CK_BTN_NONE 1027 +#define IDC_TL_LOCLIST 1027 +#define IDC_TL_MAP_LBL 1028 +#define IDC_TL_LOC_LBL 1029 +#define IDC_TL_REMOVE_BTN 1030 +#define IDC_TL_ADD_BTN 1031 +#define IDC_TL_SET_BTN 1032 +#define IDC_TL_X_TXTBX 1033 +#define IDC_TL_Y_TXTBX 1034 +#define IDC_TL_Z_TXTBX 1035 +#define IDC_TL_X_LBL 1036 +#define IDC_TL_Y_LBL 1037 +#define IDC_SV_TYPE_LBL 1037 +#define IDC_TL_Z_LBL 1038 +#define IDC_TL_LOCNAME_LBL 1039 +#define IDC_TL_LOCNAME_TXTBX 1040 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 111 +#define _APS_NEXT_COMMAND_VALUE 40003 +#define _APS_NEXT_CONTROL_VALUE 1038 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/Halo Dev Controls/Symbol 2+4 trans.ico b/Halo Dev Controls/Symbol 2+4 trans.ico new file mode 100644 index 0000000..bcdea06 Binary files /dev/null and b/Halo Dev Controls/Symbol 2+4 trans.ico differ diff --git a/Halo Dev Controls/WinAbout.cpp b/Halo Dev Controls/WinAbout.cpp new file mode 100644 index 0000000..6ee87da --- /dev/null +++ b/Halo Dev Controls/WinAbout.cpp @@ -0,0 +1,221 @@ +/******************************************************************************** + -- Halo Dev Controls + Copyright © 2011 Jesus7Freak + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +********************************************************************************* + File: WinAbout.cpp + Project: Halo Dev Controls + Author: Jesus7Freak + Date: 11/22/2011 + Game: Halo and Halo Custom Edition + Version: all +*********************************************************************************/ +#include "WinMain.h" + +void AboutOnDrawItem(HWND hwnd, const DRAWITEMSTRUCT *lpDrawItem); +BOOL AboutOnInitDialog(HWND hDlg, HWND hCtrl, LPARAM init_data); +HBRUSH AboutOnCtlColorStatic(HWND hwnd, HDC hdc, HWND hwndChild, int type); + +HFONT h12Font, h13Font; + +BOOL CALLBACK AboutDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + BOOL ret_val; + switch (message) + { + case WM_DRAWITEM: + ret_val = HANDLE_WM_DRAWITEM(hDlg, wParam, lParam, AboutOnDrawItem); + break; + + case WM_INITDIALOG: + HANDLE_WM_INITDIALOG(hDlg, wParam, lParam, AboutOnInitDialog); + ret_val = TRUE; + break; + + case WM_COMMAND: + if (LOWORD(wParam) == IDOK) + { + DeleteObject(h12Font); + DeleteObject(h13Font); + EndDialog(hDlg, IDOK); + } + ret_val = TRUE; + break; + + case WM_CTLCOLORBTN: + ret_val = (LRESULT)GetStockBrush(NULL_BRUSH); + break; + + case WM_CTLCOLORSTATIC: + ret_val = HANDLE_WM_CTLCOLORSTATIC(hDlg, wParam, lParam, AboutOnCtlColorStatic); + break; + + default: + ret_val = FALSE; + } + + return ret_val; +} + +void AboutOnDrawItem(HWND hwnd, const DRAWITEMSTRUCT *lpDrawItem) +{ + if (lpDrawItem->CtlID == IDOK) + { + UINT iState = lpDrawItem->itemState; + BOOL bIsFocused = (iState & ODS_FOCUS); + BOOL bIsDisabled = (iState & ODS_DISABLED); + + bool highlight = (iState & ODS_SELECTED) || MouseOverControlID == lpDrawItem->CtlID; + HBRUSH brBackground; + + if (highlight) brBackground = CreateSolidBrush(RGB(229,229,229)); + else brBackground = GetStockBrush(NULL_BRUSH); + + HDC hdc = lpDrawItem->hDC;//optimizer does this + FillRect(hdc, &(lpDrawItem->rcItem), brBackground); + DeleteObject(brBackground); + + int pnWidthEx = 0; + if (bIsFocused) pnWidthEx++; + + HPEN pnForeColor = CreatePen(PS_SOLID, 1 + pnWidthEx, 0); + SelectObject(hdc, pnForeColor); + Rectangle(hdc, lpDrawItem->rcItem.left + pnWidthEx, lpDrawItem->rcItem.top + pnWidthEx, lpDrawItem->rcItem.right, lpDrawItem->rcItem.bottom); + DeleteObject(pnForeColor); + + int str_len = GetWindowTextW(lpDrawItem->hwndItem, szBuffer, SZ_BUFFER_SIZE); + + SIZE dimensions = {0}; + GetTextExtentPoint32W(hdc, szBuffer, str_len, &dimensions); + int xPos = (lpDrawItem->rcItem.right - dimensions.cx) / 2; + int yPos = ((lpDrawItem->rcItem.bottom - dimensions.cy) / 2) + 1; + + SetBkMode(hdc, TRANSPARENT); + SetTextColor(hdc, bIsDisabled ? GetSysColor(COLOR_GRAYTEXT) : 0); + TextOut(hdc, xPos, yPos, szBuffer, str_len); + } +} + +BOOL AboutOnInitDialog(HWND hDlg, HWND hCtrl, LPARAM init_data) +{ + HBITMAP BmpBkg = LoadBitmapW(hInst, MAKEINTRESOURCE(IDB_EYE)); + SendDlgItemMessage(hDlg, IDC_BACKGROUND, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)BmpBkg); + + SetWindowSubclass(GetDlgItem(hDlg, IDOK), MouseOverProc, IDS_MOUSEOVER, IDOK); + + h12Font = CreateFontW( + 20, 0, + 0, + 0, + FW_NORMAL, + FALSE, + FALSE, + FALSE, + ANSI_CHARSET,//DEFAULT_CHARSET, + OUT_DEFAULT_PRECIS, + CLIP_DEFAULT_PRECIS, + DEFAULT_QUALITY, + DEFAULT_PITCH, + L"Microsoft Sans Serif" + ); + + h13Font = CreateFontW( + 23, 0, + 0, + 0, + FW_NORMAL, + FALSE, + FALSE, + FALSE, + DEFAULT_CHARSET, + OUT_DEFAULT_PRECIS, + CLIP_DEFAULT_PRECIS, + DEFAULT_QUALITY, + DEFAULT_PITCH, + L"Microsoft Sans Serif" + ); + + SetWindowFont(GetDlgItem(hDlg, IDC_ABOUT_NAME), h12Font, TRUE); + SetWindowFont(GetDlgItem(hDlg, IDC_ABOUT_CREDITS), h12Font, TRUE); + SetWindowFont(GetDlgItem(hDlg, IDC_ABOUT_THANKS), h12Font, TRUE); + SetWindowFont(GetDlgItem(hDlg, IDC_ABOUT_PLAYER_CMDS), h12Font, TRUE); + SetWindowFont(GetDlgItem(hDlg, IDC_ABOUT_VERSION), h12Font, TRUE); + SetWindowFont(GetDlgItem(hDlg, IDC_ABOUT_AUTHOR), h13Font, TRUE); + + HRSRC hVersion = FindResourceW( + (HMODULE)init_data, + MAKEINTRESOURCEW(VS_VERSION_INFO), + MAKEINTRESOURCEW(RT_VERSION)); + + if (hVersion) + { + HGLOBAL hGlobal = LoadResource((HMODULE)init_data, hVersion); + if (hGlobal) + { + LPVOID versionInfo = LockResource(hGlobal); + if (versionInfo) + { + LPVOID retbuf; UINT vLen; + if (VerQueryValueW( + versionInfo, + L"\\StringFileInfo\\040904b0\\FileVersion", + &retbuf, + &vLen)) + { + static wchar_t text_buffer[20] = {L'V',L'e',L'r',L's',L'i',L'o',L'n',L':',L' ',L' '}; + + wchar_t *version_str = &text_buffer[10]; + for (UINT i = 0; i < vLen; i++) + { + wchar_t retbuf_wchar = ((wchar_t*)retbuf)[i]; + version_str[i] = retbuf_wchar; + } + + SetWindowTextW(GetDlgItem(hDlg, IDC_ABOUT_VERSION), text_buffer); + } + } + } + } + return TRUE; +} + +HBRUSH AboutOnCtlColorStatic(HWND hwnd, HDC hdc, HWND hwndChild, int type) +{ + COLORREF textcolor; + + switch (GetDlgCtrlID(hwndChild)) + { + case IDC_ABOUT_NAME: + case IDC_ABOUT_CREDITS: + case IDC_ABOUT_THANKS: + case IDC_ABOUT_PLAYER_CMDS: + case IDC_ABOUT_VERSION: + textcolor = RGB(255,255,255); + break; + + case IDC_ABOUT_AUTHOR: + textcolor = RGB(0,255,0); + break; + + case IDOK: + textcolor = RGB(0,0,0); + break; + } + + SetTextColor(hdc, textcolor); + //transparent background for all static controls + SetBkMode(hdc, TRANSPARENT); + return GetStockBrush(NULL_BRUSH); +} \ No newline at end of file diff --git a/Halo Dev Controls/WinCMDS.cpp b/Halo Dev Controls/WinCMDS.cpp new file mode 100644 index 0000000..f70b267 --- /dev/null +++ b/Halo Dev Controls/WinCMDS.cpp @@ -0,0 +1,216 @@ +/******************************************************************************** + -- Halo Dev Controls + Copyright © 2011 Jesus7Freak + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +********************************************************************************* + File: WinCMDS.cpp + Project: Halo Dev Controls + Author: Jesus7Freak + Date: 11/22/2011 + Game: Halo and Halo Custom Edition + Version: all +*********************************************************************************/ +#include "WinMain.h" +#include "KeyLib.h" + +BOOL CMDSOnInitDialog(HWND hDlg, HWND hCtrl, LPARAM init_data); +void CMDSOnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify); + +void UpdateCMDWindow(HWND hwnd, int SelectedIndex); + +wchar_t szCMD_Title[88] = {L'<',L't',L'y',L'p',L'e',L'>',L' ',L' ',L' ',L' ', + L' ',L' ',L'C',L'o',L'm',L'm',L'a',L'n',L'd',L's',L' ',L'a',L'n',L'd',L' ', + L'K',L'e',L'y',L'b',L'o',L'a',L'd',L' ',L'S',L'h',L'o',L'r',L't',L'c',L'u', + L't',L's',L' ',L' ',L' ',L' ',L' ',L'c',L'o',L'm',L'm',L'a',L'n',L'd',L's', + L' ',L'w',L'o',L'r',L'k',L' ',L'i',L'n',L' ',L'c',L'o',L'n',L's',L'o',L'l', + L'e',L',',L' ',L'r',L'c',L'o',L'n',L',',L' ',L'a',L'n',L'd',L' ',L'c',L'h', + L'a',L't',L'\0'},//wont work as regular * + *szPlayer2ndDescript = L"See readme for [pExpression] example"; + +CMDsLib::COMMANDS *Commands = NULL; +BOOL cmd_val_changed = FALSE; + +BOOL CALLBACK CMDSDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + BOOL ret_val; + switch (message) + { + case WM_CLOSE: + ret_val = EndDialog(hDlg, 0); + break; + + case WM_INITDIALOG: + HANDLE_WM_INITDIALOG(hDlg, wParam, lParam, CMDSOnInitDialog); + ret_val = TRUE; + break; + + case WM_COMMAND: + HANDLE_WM_COMMAND(hDlg, wParam, lParam, CMDSOnCommand); + ret_val = TRUE; + break; + + default: + ret_val = FALSE; + } + + return ret_val; +} + +BOOL CMDSOnInitDialog(HWND hDlg, HWND hCtrl, LPARAM init_data) +{ + Commands = (CMDsLib::COMMANDS*)init_data; + cmd_val_changed = FALSE; + + wchar_t *type_name = Commands->cmds_group_name; + for (int i = 0; type_name[i]; i++) + szCMD_Title[i] = type_name[i]; + + SetWindowText(hDlg, szCMD_Title); + + HWND hlistbox = GetDlgItem(hDlg, IDC_LISTBOX); + for (int i = 0; i < Commands->size; i++) + ListBox_AddString(hlistbox, Commands->cmd_descripts[i].cmd_title); + + HWND hEnableCkBx = GetDlgItem(hDlg, IDC_ENABLE); + switch (Commands->Enable_Shrtcts) + { + case 0: + Button_SetCheck(hEnableCkBx, FALSE); + break; + case 1: + Button_SetCheck(hEnableCkBx, TRUE); + break; + case -1: + Button_SetCheck(hEnableCkBx, FALSE); + EnableWindow(hEnableCkBx, FALSE); + ShowWindow(hEnableCkBx, 0); + + HWND h2nd_descript = GetDlgItem(hDlg, IDC_SEC_DESCRIPT); + SetWindowTextW(h2nd_descript, szPlayer2ndDescript); + ShowWindow(h2nd_descript, 1); + break; + } + + ListBox_SetCurSel(hlistbox, 0); + UpdateCMDWindow(hDlg, 0); + return TRUE; +} + +void CMDSOnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) +{ + switch (codeNotify) + { + case BN_CLICKED: + switch(id) + { + case IDOK: + EndDialog(hwnd, cmd_val_changed); + break; + + case IDC_CC_SET_BTN: + //change cmd name code here + break; + + case IDC_ENABLE: + { + cmd_val_changed = TRUE; + Commands->Enable_Shrtcts = Button_GetCheck(hwndCtl); + //trigger lstBx_SelectedIndexChanged + ListBox_SetCurSel(GetDlgItem(hwnd, IDC_LISTBOX), 0); + UpdateCMDWindow(hwnd, 0); + break; + } + case IDC_ACT_BTN: + { + int SelectedIndex = ListBox_GetCurSel(GetDlgItem(hwnd, IDC_LISTBOX)); + short *pOld_key = &Commands->cmd_keys[SelectedIndex].toggle_key; + short old_key = *pOld_key; + short new_key = DialogBoxParamW(hInst, MAKEINTRESOURCE(IDD_CHANGE_KEY), hwnd, ChangeKeyDlgProc, (LPARAM)old_key); + if (old_key != new_key) + { + *pOld_key = new_key; + SetWindowTextW(hwndCtl, KeyLib::Get_Key_Name(new_key)); + cmd_val_changed = TRUE; + } + break; + } + case IDC_ON_BTN: + { + int SelectedIndex = ListBox_GetCurSel(GetDlgItem(hwnd, IDC_LISTBOX)); + short *pOld_key = &Commands->cmd_keys[SelectedIndex].on_key; + short old_key = *pOld_key; + short new_key = DialogBoxParamW(hInst, MAKEINTRESOURCE(IDD_CHANGE_KEY), hwnd, ChangeKeyDlgProc, (LPARAM)old_key); + if (old_key != new_key) + { + *pOld_key = new_key; + SetWindowTextW(hwndCtl, KeyLib::Get_Key_Name(new_key)); + cmd_val_changed = TRUE; + } + break; + } + case IDC_OFF_BTN: + { + int SelectedIndex = ListBox_GetCurSel(GetDlgItem(hwnd, IDC_LISTBOX)); + short *pOld_key = &Commands->cmd_keys[SelectedIndex].off_key; + short old_key = *pOld_key; + short new_key = DialogBoxParamW(hInst, MAKEINTRESOURCE(IDD_CHANGE_KEY), hwnd, ChangeKeyDlgProc, (LPARAM)old_key); + if (old_key != new_key) + { + *pOld_key = new_key; + SetWindowTextW(hwndCtl, KeyLib::Get_Key_Name(new_key)); + cmd_val_changed = TRUE; + } + break; + } + } + break; + + case LBN_SELCHANGE: + if (id == IDC_LISTBOX) + UpdateCMDWindow(hwnd, ListBox_GetCurSel(hwndCtl)); + + break; + } +} + +void UpdateCMDWindow(HWND hwnd, int SelectedIndex) +{ + if (SelectedIndex != LB_ERR) + { + CMDsLib::CMD_DESCRIPT *pCD = &Commands->cmd_descripts[SelectedIndex]; + SetWindowTextW(GetDlgItem(hwnd, IDC_CMD_TXTBX), pCD->cmd_header); + SetWindowTextW(GetDlgItem(hwnd, IDC_USAGE_LBL), pCD->cmd_usage); + SetWindowTextW(GetDlgItem(hwnd, IDC_DESCRIPT_LBL), pCD->cmd_descript); + + if (Commands->cmd_keys) + { + BOOL enable_checked = Button_GetCheck(GetDlgItem(hwnd, IDC_ENABLE)); + + CMDsLib::CMD_SCKEYS *pCS = &Commands->cmd_keys[SelectedIndex]; + + HWND hActBtn = GetDlgItem(hwnd, IDC_ACT_BTN); + SetWindowTextW(hActBtn, KeyLib::Get_Key_Name(pCS->toggle_key)); + EnableWindow(hActBtn, pCS->toggle_key != -1 && enable_checked); + + HWND hOnBtn = GetDlgItem(hwnd, IDC_ON_BTN); + SetWindowTextW(hOnBtn, KeyLib::Get_Key_Name(pCS->on_key)); + EnableWindow(hOnBtn, pCS->on_key != -1 && enable_checked); + + HWND hOffBtn = GetDlgItem(hwnd, IDC_OFF_BTN); + SetWindowTextW(hOffBtn, KeyLib::Get_Key_Name(pCS->off_key)); + EnableWindow(hOffBtn, pCS->off_key != -1 && enable_checked); + } + } +} \ No newline at end of file diff --git a/Halo Dev Controls/WinChangeKey.cpp b/Halo Dev Controls/WinChangeKey.cpp new file mode 100644 index 0000000..077fea6 --- /dev/null +++ b/Halo Dev Controls/WinChangeKey.cpp @@ -0,0 +1,88 @@ +#include "WinMain.h" +#include "KeyLib.h" + +void UpdateEditKey(UINT vkey); +BOOL ChangeKeyOnInitDialog(HWND hDlg, HWND hCtrl, LPARAM init_data); +void ChangeKeyOnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify); + +bool EditNoCharMask(UINT vKey, bool Control); + +HWND WinChangeKey = NULL; +UINT Orig_Key = 0, Displayed_vKey = 0; + +BOOL CALLBACK ChangeKeyDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + BOOL ret_val; + switch (message) + { + case WM_CLOSE: + ret_val = EndDialog(hDlg, Orig_Key); + break; + + case WM_INITDIALOG: + ret_val = HANDLE_WM_INITDIALOG(hDlg, wParam, lParam, ChangeKeyOnInitDialog); + break; + + case WM_COMMAND: + HANDLE_WM_COMMAND(hDlg, wParam, lParam, ChangeKeyOnCommand); + ret_val = TRUE; + break; + + default: + ret_val = FALSE; //DefDlgProc + } + + return ret_val; +} + +BOOL ChangeKeyOnInitDialog(HWND hDlg, HWND hCtrl, LPARAM init_data) +{ + WinChangeKey = hDlg; + + Orig_Key = (UINT)init_data; + UpdateEditKey((UINT)init_data); + + SetWindowSubclass(GetDlgItem(hDlg, IDC_CK_CODE), EditMaskProc, IDS_EDIT_MASK, (DWORD_PTR)EditNoCharMask); + SetWindowSubclass(GetDlgItem(hDlg, IDC_CK_HCODE), EditMaskProc, IDS_EDIT_MASK, (DWORD_PTR)EditNoCharMask); + return TRUE; +} + +void ChangeKeyOnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) +{ + switch (codeNotify) + { + case BN_CLICKED: + switch(id) + { + case IDOK: + { + EndDialog(hwnd, Displayed_vKey); + break; + } + case IDC_CK_BTN_NONE: + UpdateEditKey(0); + break; + } + break; + } +} + +bool EditNoCharMask(UINT vKey, bool Control) +{ + UpdateEditKey(vKey); + return true; +} + +void UpdateEditKey(UINT vkey) +{ + Displayed_vKey = vkey; + SetWindowTextW(GetDlgItem(WinChangeKey, IDC_CK_NAME_LBL), KeyLib::Get_Key_Name(vkey)); + + swprintf_s(szBuffer, 6, L"%li", vkey); + SetWindowTextW(GetDlgItem(WinChangeKey, IDC_CK_CODE), szBuffer); + + szBuffer[0] = L'0'; + szBuffer[1] = L'x'; + swprintf_s(&szBuffer[2], 4, L"%lX", vkey); + SetWindowTextW(GetDlgItem(WinChangeKey, IDC_CK_HCODE), szBuffer); +} \ No newline at end of file diff --git a/Halo Dev Controls/WinDialog.rc b/Halo Dev Controls/WinDialog.rc new file mode 100644 index 0000000..71b36ca --- /dev/null +++ b/Halo Dev Controls/WinDialog.rc @@ -0,0 +1,229 @@ +// Microsoft Visual C++ generated resource script. +// +#include "Resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "Resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_WINMAIN ICON "Symbol 2+4 trans.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_MW_BG BITMAP "hdc_rpg_logo_bg.bmp" +IDB_EYE BITMAP "green-eye.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 2,3,0,0 + PRODUCTVERSION 2,3,0,0 + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "May need to be run as admin. HDC.drv needs to be in the same folder in order for the commands and keyboard shortcuts to work. " + VALUE "CompanyName", "Jesus7Freak" + VALUE "FileDescription", "Halo App" + VALUE "FileVersion", "2, 3, 0, 0" + VALUE "InternalName", "HDC" + VALUE "LegalCopyright", "Copyright (C) 2011" + VALUE "LegalTrademarks", "Thanks to Jesus for salvation, Believe in Him and be saved!" + VALUE "OriginalFilename", "Halo Dev Controls.exe" + VALUE "ProductName", "Halo Dev Controls" + VALUE "ProductVersion", "2, 3, 0, 0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUT DIALOGEX 0, 0, 250, 175 +STYLE DS_SETFONT | DS_CENTER | WS_POPUP +FONT 10, "Microsoft Sans Serif", 400, 0, 0x0 +BEGIN + CONTROL "",IDC_BACKGROUND,"Static",SS_BITMAP,0,0,15,13 + CONTROL "OK",IDOK,"Button",BS_OWNERDRAW | BS_FLAT | WS_TABSTOP,108,151,36,17,WS_EX_TRANSPARENT + LTEXT "Halo Dev Controls",IDC_ABOUT_NAME,90,5,86,9,NOT WS_GROUP,WS_EX_TRANSPARENT + LTEXT "Version: ",IDC_ABOUT_VERSION,90,20,80,9,NOT WS_GROUP,WS_EX_TRANSPARENT + CTEXT "Beta Testers:\r\nShadow\r\nAoO Aurora\r\nN®Þ»Jedi\r\nÇAG»Dark_Špyrø\r\nMarko Ramius\r\nRad! ",IDC_ABOUT_CREDITS,8,49,75,79,NOT WS_GROUP,WS_EX_TRANSPARENT + CTEXT "Thanks to:\r\nJesus for salvation,\r\nBelieve in Him and\r\nhave eternal Life!\r\nPatrícia <3\r\nBungie\r\nPatrickssj6\r\nOxide\r\nOpsY",IDC_ABOUT_THANKS,161,26,84,111,NOT WS_GROUP,WS_EX_TRANSPARENT + LTEXT "Player Commands based on Devicator",IDC_ABOUT_PLAYER_CMDS,9,135,150,15,NOT WS_GROUP,WS_EX_TRANSPARENT + CTEXT "Created By:\r\nJesus7Freak",IDC_ABOUT_AUTHOR,98,70,59,38,NOT WS_GROUP,WS_EX_TRANSPARENT +END + +IDD_CMDS DIALOGEX 0, 0, 280, 92 +STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_TOOLWINDOW +CAPTION "Dialog" +FONT 10, "Microsoft Sans Serif", 400, 0, 0x0 +BEGIN + DEFPUSHBUTTON "&OK",IDOK,242,78,35,12 + LISTBOX IDC_LISTBOX,2,3,80,88,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + EDITTEXT IDC_CMD_TXTBX,86,3,126,12,ES_AUTOHSCROLL | ES_READONLY,WS_EX_CLIENTEDGE + LTEXT "Cmd Usage",IDC_USAGE_LBL,86,21,131,24 + CONTROL "Enable Shortcuts",IDC_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,171,79,60,10 + PUSHBUTTON "none",IDC_ACT_BTN,232,25,45,14,BS_FLAT | WS_DISABLED + PUSHBUTTON "none",IDC_ON_BTN,232,42,45,14,BS_FLAT | WS_DISABLED + PUSHBUTTON "none",IDC_OFF_BTN,232,59,45,14,BS_FLAT | WS_DISABLED + LTEXT "Toggle | Activate",IDC_ACT_LBL,228,16,52,8 + LTEXT "",IDC_SEC_DESCRIPT,86,80,124,8,NOT WS_VISIBLE | NOT WS_GROUP + LTEXT "On",IDC_ON_LBL,220,45,12,8 + LTEXT "Off",IDC_OFF_LBL,219,62,11,8 + LTEXT "Cmd Description",IDC_DESCRIPT_LBL,86,49,131,24 +END + +IDD_CHANGE_KEY DIALOGEX 0, 0, 126, 30 +STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_TOOLWINDOW +CAPTION "Change Key" +FONT 10, "Microsoft Sans Serif", 400, 0, 0x0 +BEGIN + EDITTEXT IDC_CK_CODE,73,16,20,12,ES_AUTOHSCROLL | WS_GROUP + PUSHBUTTON "OK",IDOK,3,15,26,12 + LTEXT "Press a key",IDC_CK_I_LBL,3,3,37,8,NOT WS_GROUP + LTEXT "KeyCode",IDC_CK_LBL,39,17,29,8,NOT WS_GROUP + LTEXT "none",IDC_CK_NAME_LBL,50,3,50,8,NOT WS_GROUP + EDITTEXT IDC_CK_HCODE,98,16,26,12,ES_AUTOHSCROLL + PUSHBUTTON "none",IDC_CK_BTN_NONE,103,3,21,11 +END + +IDD_TELE_LOC DIALOGEX 0, 0, 336, 84 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_TOOLWINDOW +CAPTION "Teleport Locations" +FONT 10, "Microsoft Sans Serif", 400, 0, 0x0 +BEGIN + DEFPUSHBUTTON "OK",IDOK,283,68,50,14 + LISTBOX IDC_TL_MAPLIST,2,12,70,70,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + LISTBOX IDC_TL_LOCLIST,76,12,47,70,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + LTEXT "Maps",IDC_TL_MAP_LBL,29,2,18,8 + LTEXT "Locations",IDC_TL_LOC_LBL,84,3,32,8 + PUSHBUTTON "Remove",IDC_TL_REMOVE_BTN,275,10,50,14 + PUSHBUTTON "Add",IDC_TL_ADD_BTN,135,10,50,14 + PUSHBUTTON "Set (Change Location)",IDC_TL_SET_BTN,135,68,136,14 + EDITTEXT IDC_TL_X_TXTBX,126,50,65,14,0,WS_EX_CLIENTEDGE + EDITTEXT IDC_TL_Y_TXTBX,197,50,65,14,0,WS_EX_CLIENTEDGE + EDITTEXT IDC_TL_Z_TXTBX,268,50,65,14,0,WS_EX_CLIENTEDGE + LTEXT "x coordinate",IDC_TL_X_LBL,138,38,38,8 + LTEXT "y coordinate",IDC_TL_Y_LBL,210,38,38,8 + LTEXT "z coordinate",IDC_TL_Z_LBL,280,38,38,8 + LTEXT "Location Name",IDC_TL_LOCNAME_LBL,206,8,47,8 + EDITTEXT IDC_TL_LOCNAME_TXTBX,204,20,50,14,0,WS_EX_CLIENTEDGE +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_CMDS, DIALOG + BEGIN + BOTTOMMARGIN, 91 + END + + IDD_CHANGE_KEY, DIALOG + BEGIN + RIGHTMARGIN, 124 + BOTTOMMARGIN, 28 + END + + IDD_TELE_LOC, DIALOG + BEGIN + RIGHTMARGIN, 333 + BOTTOMMARGIN, 82 + END +END +#endif // APSTUDIO_INVOKED + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/Halo Dev Controls/WinDialog.rc cmpt b/Halo Dev Controls/WinDialog.rc cmpt new file mode 100644 index 0000000..029eb0c --- /dev/null +++ b/Halo Dev Controls/WinDialog.rc cmpt @@ -0,0 +1,224 @@ +/******************************************************************************** + -- Halo Dev Controls + Copyright © 2011 Jesus7Freak + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +********************************************************************************* + File: WinDialog.rc + Project: Halo Dev Controls + Author: Jesus7Freak + Date: 11/22/2011 + Game: Halo and Halo Custom Edition + Version: all +*********************************************************************************/ +// Microsoft Visual C++ generated resource script. +// +#include +#include +#include +#include "resource.h" + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_WINMAIN ICON "Symbol 2+4 trans.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_MW_BG BITMAP "hdc_rpg_logo_bg.bmp" +IDB_EYE BITMAP "green-eye.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 2,3,0,0 + PRODUCTVERSION 2,3,0,0 + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "May need to be run as admin. HDC.drv needs to be in the same folder in order for the commands and keyboard shortcuts to work. " + VALUE "CompanyName", "Jesus7Freak" + VALUE "FileDescription", "Halo App" + VALUE "FileVersion", "2,3,0,0" + VALUE "InternalName", "HDC" + VALUE "LegalCopyright", "Copyright (C) 2011" + VALUE "LegalTrademarks", "Thanks to Jesus for salvation, Believe in Him and be saved!" + VALUE "OriginalFilename", "Halo Dev Controls.exe" + VALUE "ProductName", "Halo Dev Controls" + VALUE "ProductVersion", "2,3,0,0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUT DIALOGEX 0, 0, 250, 175 +STYLE DS_SETFONT | DS_CENTER | WS_POPUP +FONT 10, "Microsoft Sans Serif", 400, 0, 0x0 +BEGIN + CONTROL "",IDC_BACKGROUND,"Static",SS_BITMAP,0,0,15,13 + CONTROL "OK",IDOK,"Button",BS_OWNERDRAW | BS_FLAT | WS_TABSTOP,108,151,36,17,WS_EX_TRANSPARENT + LTEXT "Halo Dev Controls",IDC_ABOUT_NAME,90,5,86,9,NOT WS_GROUP,WS_EX_TRANSPARENT + LTEXT "Version: ",IDC_ABOUT_VERSION,90,20,80,9,NOT WS_GROUP,WS_EX_TRANSPARENT + CTEXT "Beta Testers:\r\nShadow\r\nAoO Aurora\r\nN®Þ»Jedi\r\nÇAG»Dark_Špyrø\r\nMarko Ramius\r\nRad! ",IDC_ABOUT_CREDITS,8,49,75,79,NOT WS_GROUP,WS_EX_TRANSPARENT + CTEXT "Thanks to:\r\nJesus for salvation,\r\nBelieve in Him and\r\nhave eternal Life!\r\nPatrícia <3\r\nBungie\r\nPatrickssj6\r\nOxide\r\nOpsY",IDC_ABOUT_THANKS,161,26,84,111,NOT WS_GROUP,WS_EX_TRANSPARENT + LTEXT "Player Commands based on Devicator",IDC_ABOUT_PLAYER_CMDS,9,135,150,15,NOT WS_GROUP,WS_EX_TRANSPARENT + CTEXT "Created By:\r\nJesus7Freak",IDC_ABOUT_AUTHOR,98,70,59,38,NOT WS_GROUP,WS_EX_TRANSPARENT +END + +IDD_CMDS DIALOGEX 0, 0, 280, 92 +STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_TOOLWINDOW +CAPTION "Dialog" +FONT 10, "Microsoft Sans Serif", 400, 0, 0x0 +BEGIN + DEFPUSHBUTTON "&OK",IDOK,242,78,35,12 + LISTBOX IDC_LISTBOX,2,3,80,88,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + EDITTEXT IDC_CMD_TXTBX,86,3,126,12,ES_AUTOHSCROLL | ES_READONLY,WS_EX_CLIENTEDGE + LTEXT "Cmd Usage",IDC_USAGE_LBL,86,21,131,24 + CONTROL "Enable Shortcuts",IDC_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,171,79,60,10 + PUSHBUTTON "none",IDC_ACT_BTN,232,25,45,14,BS_FLAT | WS_DISABLED + PUSHBUTTON "none",IDC_ON_BTN,232,42,45,14,BS_FLAT | WS_DISABLED + PUSHBUTTON "none",IDC_OFF_BTN,232,59,45,14,BS_FLAT | WS_DISABLED + LTEXT "Toggle | Activate",IDC_ACT_LBL,228,16,52,8 + LTEXT "",IDC_SEC_DESCRIPT,86,80,124,8,NOT WS_VISIBLE | NOT WS_GROUP + LTEXT "On",IDC_ON_LBL,220,45,12,8 + LTEXT "Off",IDC_OFF_LBL,219,62,11,8 + LTEXT "Cmd Description",IDC_DESCRIPT_LBL,86,49,131,24 +END + +IDD_CHANGE_KEY DIALOGEX 0, 0, 126, 30 +STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_TOOLWINDOW +CAPTION "Change Key" +FONT 10, "Microsoft Sans Serif", 400, 0, 0x0 +BEGIN + EDITTEXT IDC_CK_CODE,73,16,20,12,ES_AUTOHSCROLL | WS_GROUP + PUSHBUTTON "OK",IDOK,3,15,26,12 + LTEXT "Press a key",IDC_CK_I_LBL,3,3,37,8,NOT WS_GROUP + LTEXT "KeyCode",IDC_CK_LBL,39,17,29,8,NOT WS_GROUP + LTEXT "none",IDC_CK_NAME_LBL,50,3,50,8,NOT WS_GROUP + EDITTEXT IDC_CK_HCODE,98,16,26,12,ES_AUTOHSCROLL + PUSHBUTTON "none",IDC_CK_BTN_NONE,103,3,21,11 +END + +IDD_TELE_LOC DIALOGEX 0, 0, 336, 84 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_TOOLWINDOW +CAPTION "Teleport Locations" +FONT 10, "Microsoft Sans Serif", 400, 0, 0x0 +BEGIN + DEFPUSHBUTTON "OK",IDOK,283,68,50,14 + LISTBOX IDC_TL_MAPLIST,2,12,70,70,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + LISTBOX IDC_TL_LOCLIST,76,12,47,70,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + LTEXT "Maps",IDC_TL_MAP_LBL,29,2,18,8 + LTEXT "Locations",IDC_TL_LOC_LBL,84,3,32,8 + PUSHBUTTON "Remove",IDC_TL_REMOVE_BTN,275,10,50,14 + PUSHBUTTON "Add",IDC_TL_ADD_BTN,135,10,50,14 + PUSHBUTTON "Set (Change Location)",IDC_TL_SET_BTN,135,68,136,14 + EDITTEXT IDC_TL_X_TXTBX,126,50,65,14,0,WS_EX_CLIENTEDGE + EDITTEXT IDC_TL_Y_TXTBX,197,50,65,14,0,WS_EX_CLIENTEDGE + EDITTEXT IDC_TL_Z_TXTBX,268,50,65,14,0,WS_EX_CLIENTEDGE + LTEXT "x coordinate",IDC_TL_X_LBL,138,38,38,8 + LTEXT "y coordinate",IDC_TL_Y_LBL,210,38,38,8 + LTEXT "z coordinate",IDC_TL_Z_LBL,280,38,38,8 + LTEXT "Location Name",IDC_TL_LOCNAME_LBL,206,8,47,8 + EDITTEXT IDC_TL_LOCNAME_TXTBX,204,20,50,14,0,WS_EX_CLIENTEDGE +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_CMDS, DIALOG + BEGIN + BOTTOMMARGIN, 91 + END + + IDD_CHANGE_KEY, DIALOG + BEGIN + RIGHTMARGIN, 124 + BOTTOMMARGIN, 28 + END + + IDD_TELE_LOC, DIALOG + BEGIN + RIGHTMARGIN, 333 + BOTTOMMARGIN, 82 + END +END +#endif // APSTUDIO_INVOKED + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/Halo Dev Controls/WinMain.cpp b/Halo Dev Controls/WinMain.cpp new file mode 100644 index 0000000..b5019ef --- /dev/null +++ b/Halo Dev Controls/WinMain.cpp @@ -0,0 +1,1615 @@ +/******************************************************************************** + -- Halo Dev Controls + Copyright © 2011 Jesus7Freak + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +********************************************************************************* + File: WinMain.cpp + Project: Halo Dev Controls + Author: Jesus7Freak + Date: 11/22/2011 + Game: Halo and Halo Custom Edition + Version: all +*********************************************************************************/ +#include "WinMain.h" + +HWND hControls[NUM_OF_CONTROLS] = { NULL }; +HMODULE hUxTheme = NULL; + +RWMemory *Halo_Process = NULL; +HMODULE hHDC = NULL; +bool exiting = false, + dev_enabled = false, + console_enabled = false, + alarm_on = false, + rpgb6_2_running = false, + Locked = false, + Nuked = false; + +BOOL theme_active = FALSE; + +wchar_t *szWindowClass = L"WinMain", + *szTitle = L"Halo Dev Controls - Jesus7Freak", + *szHaloCE = L"Halo CE:", + *szHaloPC = L"Halo PC:", + *szHaloCE_exe = L"haloce.exe", + *szHaloPC_exe = L"halo.exe", + *szOn = L"On", + *szOff = L"Off", + *szMap = L"Map:", + *szMainMenu = L"Main Menu", + *szClient = L"Client", + *szHost = L"Hosting", + *szDisableDev = L"Disable Dev", + *szEnableDev = L"Enable Dev", + *szDisableConsole = L"Disable Console", + *szEnableConsole = L"Enable Console", + *Locations_File_Name = L"locations.bin", + *Settings_File_Name = L"shortcuts.bin", + *Dll_Name = L"HDC.drv", + *main_module_name = NULL, + *empty_str = L"", + *setting_names[3] = { {L"Day"}, {L"Rain"}, {L"Night"} }, + *szAlarmOn = L"Alarm On", + *szAlarmOff = L"Alarm Off", + *szSet = L"Set", + *szBaseLockAct = L"Activate", + *szBaseLockLocked = L"Locked", + *szSeconds = L"seconds", + *szHaloFire = L"Fire", + *szHaloCoolDown = L"Cool Down", + szBuffer[SZ_BUFFER_SIZE] = { 0 }; + +int MouseOverControlID = 0; + +DWORD scan_size = 0, + Current_Map_address = NULL, + Cheats_address = NULL, + ServerType_address = NULL, + Device_Groups_Header_ptr_address = NULL, + HS_Global_Header_ptr_address = NULL, + dll_addrs_ptr = NULL, + Dev_enabled_address = NULL, + Console_enabled_address = NULL, + ShowHud_ptr_address = NULL, + LetterBox_ptr_address = NULL, + //RiderEjection_address = NULL; + cse_set_video_func_address = NULL, + cinematic_ptr = NULL; + +game_types running_gt = not_running; +server_type running_sv_t = main_menu; + +HaloCE_lib::DATA_HEADER Device_Groups_Header = {0}, + HS_Global_Header = {0}; + +bool (__stdcall *pMV_chkBx_CheckedChanged)(int number) = NULL; + +HINSTANCE hInst; +bool MenuActive = false; +HMENU ExtrasMenu; +HFONT hFont = NULL; + +BOOL (__stdcall *pIsAppThemed)(); +HRESULT (__stdcall *pDrawThemeParentBackground)(HWND hwnd, HDC hdc, RECT *prc); + +BOOL InitApp(); +LRESULT CALLBACK WndMnProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); + +//WndMnProc handlers +int OnCreate(HWND hwnd, LPCREATESTRUCT WinData); +void OnPaint(HWND hwnd); +void OnDrawItem(HWND hwnd, const DRAWITEMSTRUCT *lpDrawItem); +BOOL OnNotify(HWND hwnd, int idCtrl, LPNMHDR pnmh); +void OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify); +HBRUSH OnCtlColorStatic(HWND hwnd, HDC hdc, HWND hwndChild, int type); + +int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) +{ + //only run 1 instance + //HANDLE lhMutex = CreateMutex(NULL, FALSE, L"Local\\Halo Dev Controls"); + //if (lhMutex && GetLastError () != ERROR_ALREADY_EXISTS) return 0; + HWND hWin = FindWindowW(szWindowClass, szTitle); + if (hWin) + { + SetForegroundWindow(hWin); + return 0; + } + + + hInst = hInstance; + if (!InitApp()) return 0; + + //Main Window + HWND hMainWin = CreateWindowEx( + WS_EX_TOOLWINDOW | + WS_EX_CONTROLPARENT | + WS_EX_APPWINDOW, + szWindowClass, + szTitle, + WS_CAPTION | + WS_SYSMENU, + CW_USEDEFAULT, CW_USEDEFAULT, + 335, 175, + NULL, + NULL, + hInstance, + NULL + ); + + if (!hMainWin) + return 2; + + hUxTheme = GetModuleHandle(L"uxtheme.dll"); + if (hUxTheme) + { + pIsAppThemed = (BOOL (__stdcall *)())GetProcAddress(hUxTheme, "IsAppThemed"); + pDrawThemeParentBackground = (HRESULT (__stdcall *)(HWND hwnd, HDC hdc, RECT *prc))GetProcAddress(hUxTheme, "DrawThemeParentBackground"); + } + + ShowWindow(hMainWin, nCmdShow); + UpdateWindow(hMainWin); + + HANDLE hHDCThread = CreateThread(NULL, 0, HDCThread, (LPVOID)hMainWin, 0, NULL); + + // Main message loop: + MSG msg; + while (GetMessage(&msg, NULL, 0, 0)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + //tell hHDCThread to exit loop + exiting = true; + + if (Halo_Process) + { + if (hHDC) Halo_Process->UnloadDLL(hHDC, false); + + delete Halo_Process; + Halo_Process = NULL; + } + + if (hHDCThread) + { + WaitForSingleObject(hHDCThread, 1000); + CloseHandle(hHDCThread); + } + + return 7;//because I can +} + +BOOL InitApp() +{ + HBITMAP BmpBrush = LoadBitmapW(hInst, MAKEINTRESOURCE(IDB_MW_BG)); + HBRUSH brPattern = CreatePatternBrush(BmpBrush); + DeleteObject(BmpBrush); + + WNDCLASSEX wcex; + wcex.cbSize = sizeof(WNDCLASSEX); + + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = WndMnProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + + wcex.hInstance = hInst; + wcex.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_WINMAIN)); + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hbrBackground = brPattern; + wcex.lpszMenuName = NULL; + wcex.lpszClassName = szWindowClass; + wcex.hIconSm = NULL; + + if (!RegisterClassEx(&wcex)) return FALSE; + + INITCOMMONCONTROLSEX InitCtrlEx; + InitCtrlEx.dwSize = sizeof(INITCOMMONCONTROLSEX); + InitCtrlEx.dwICC = ICC_STANDARD_CLASSES; + InitCommonControlsEx(&InitCtrlEx); /* In case we use a common control */ + + CMDsLib::GetSKeysFromFile(Settings_File_Name); + + //see if dll is in same folder + HANDLE hFile; + if ((hFile = CreateFileW( + Dll_Name, + GENERIC_READ, + FILE_SHARE_READ, + NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + NULL)) == INVALID_HANDLE_VALUE) + { + int dll_name_length = 0; do dll_name_length++; while(Dll_Name[dll_name_length]); + wchar_t *caption = new wchar_t[0xB + dll_name_length](); + + for (int i = 0; i < dll_name_length; i++) + caption[i] = Dll_Name[i]; + + caption[dll_name_length + 0] = L' '; + caption[dll_name_length + 1] = L'n'; + caption[dll_name_length + 2] = L'o'; + caption[dll_name_length + 3] = L't'; + caption[dll_name_length + 4] = L' '; + caption[dll_name_length + 5] = L'f'; + caption[dll_name_length + 6] = L'o'; + caption[dll_name_length + 7] = L'u'; + caption[dll_name_length + 8] = L'n'; + caption[dll_name_length + 9] = L'd'; + + ::MessageBoxW( + NULL, + L"Commands and key-shortcuts will not work\nNeeds to be in the same folder\nas Halo Dev Controls", + caption, + MB_OK | MB_ICONWARNING | MB_TASKMODAL + ); + + delete[] caption; + } + else + CloseHandle(hFile); + + return TRUE; +} + +LRESULT CALLBACK WndMnProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + LRESULT ret_val = 0; + + switch (message) + { + case WM_CREATE: + ret_val = HANDLE_WM_CREATE(hwnd, wParam, lParam, OnCreate); + break; + + case WM_DESTROY: + if (ExtrasMenu) DestroyMenu(ExtrasMenu); + if (hFont) DeleteObject(hFont); + PostQuitMessage(0); + break; + + case WM_PAINT: + ret_val = HANDLE_WM_PAINT(hwnd, wParam, lParam, OnPaint); + break; + + case WM_DRAWITEM: + ret_val = HANDLE_WM_DRAWITEM(hwnd, wParam, lParam, OnDrawItem); + break; + + case WM_NOTIFY: + ret_val = HANDLE_WM_NOTIFY(hwnd, wParam, lParam, OnNotify); + break; + + case WM_COMMAND: + ret_val = HANDLE_WM_COMMAND(hwnd, wParam, lParam, OnCommand); + break; + + case WM_CTLCOLORBTN: + ret_val = (LRESULT)GetStockBrush(NULL_BRUSH); + break; + + case WM_CTLCOLORSTATIC: + ret_val = HANDLE_WM_CTLCOLORSTATIC(hwnd, wParam, lParam, OnCtlColorStatic); + break; + + default: + ret_val = DefWindowProc(hwnd, message, wParam, lParam); + break; + } + + return ret_val; +} + +int OnCreate(HWND hwnd, LPCREATESTRUCT WinData) +{ + //halo type label + hControls[HHALO_TYPE] = CreateWindowEx( + NULL, + L"STATIC", + szHaloCE, + WS_CHILD | + WS_VISIBLE | + WS_CLIPSIBLINGS | + WS_CLIPCHILDREN | + SS_LEFT, + 2, 1, + 55, 16, + hwnd, + (HMENU)IDC_HALO_TYPE, + WinData->hInstance, + NULL + ); + + //halo status label + hControls[HHALO_STATUS] = CreateWindowEx( + NULL, + L"STATIC", + szOff, + WS_CHILD | + WS_VISIBLE | + WS_CLIPSIBLINGS | + WS_CLIPCHILDREN | + SS_LEFT, + 57, 1, + 25, 16, + hwnd, + (HMENU)IDC_HALO_STATUS, + WinData->hInstance, + NULL + ); + + //map label + hControls[HMAP_LBL] = CreateWindowEx( + NULL, + L"STATIC", + empty_str, + WS_CHILD | + WS_VISIBLE | + WS_CLIPSIBLINGS | + WS_CLIPCHILDREN | + SS_LEFT, + 81, 1, + 30, 16, + hwnd, + (HMENU)IDC_MAP_LBL, + WinData->hInstance, + NULL + ); + + //map status label + hControls[HMAP_STATUS] = CreateWindowEx( + NULL, + L"STATIC", + empty_str, + WS_CHILD | + WS_VISIBLE | + WS_CLIPSIBLINGS | + WS_CLIPCHILDREN | + SS_LEFT, + 114, 1, + 140, 16, + hwnd, + (HMENU)IDC_MAP_STATUS, + WinData->hInstance, + NULL + ); + + ExtrasMenu = CreatePopupMenu(); + + /*MENUITEMINFO extras; + extras.cbSize = sizeof(MENUITEMINFO); + extras.fMask = MIIM_FTYPE | MIIM_ID | MIIM_STRING;// | MIIM_SUBMENU; + extras.fType = MFT_STRING | MFT_RIGHTJUSTIFY; + //extras.fState = MFS_ENABLED; + extras.wID = IDM_EXTRAS; + //extras.hSubMenu = ExtrasMenu; + //extras.hbmpChecked = NULL; + //extras.hbmpUnchecked = NULL; + //extras.dwItemData = 0; + extras.dwTypeData = L"Extras"; + extras.cch = 7; + //extras.hbmpItem = NULL; + + //InsertMenuItem(hMenu, 0, TRUE, &extras);*/ + AppendMenu(ExtrasMenu, MF_STRING, IDM_DEV_COMMANDS ,L"Dev Commands"); + AppendMenu(ExtrasMenu, MF_STRING, IDM_RPGBETA_COMMANDS ,L"RPG_Beta6_2 Commands"); + AppendMenu(ExtrasMenu, MF_STRING, IDM_PLAYER_COMMANDS ,L"Player Commands"); + AppendMenu(ExtrasMenu, MF_STRING, IDM_TELEPORT_LOCATIONS, L"Teleport Locations"); + AppendMenu(ExtrasMenu, MF_SEPARATOR ,0 , L""); + AppendMenu(ExtrasMenu, MF_STRING, IDM_ABOUT, L"About Halo Dev Controls"); + + HWND hMenuBtn = CreateWindowEx( + NULL, + L"BUTTON", + L"Extras", + WS_CHILD | + WS_VISIBLE | + WS_CLIPSIBLINGS | + WS_CLIPCHILDREN | + BS_OWNERDRAW, + 255, 0, + 74, 19, + hwnd, + (HMENU)IDC_MENU_BUTTON, + WinData->hInstance, + NULL + ); + hControls[HMENU_BUTTON] = hMenuBtn; + SetWindowSubclass(hMenuBtn, MouseOverProc, IDS_MOUSEOVER, IDC_MENU_BUTTON); + + //server status label + hControls[HSERVER_STATUS] = CreateWindowEx( + NULL, + L"STATIC", + szMainMenu, + WS_CHILD | + WS_VISIBLE | + WS_DISABLED | + WS_CLIPSIBLINGS | + WS_CLIPCHILDREN | + SS_OWNERDRAW, + 119, 26, + 70, 17, + hwnd, + (HMENU)IDC_SERVER_STATUS, + WinData->hInstance, + NULL + ); + + //Dev Button + HWND hDev = CreateWindowEx( + NULL, + L"BUTTON", + szEnableDev, + WS_CHILD | + WS_VISIBLE | + WS_DISABLED | + WS_CLIPSIBLINGS | + WS_CLIPCHILDREN | + BS_OWNERDRAW, + 16, 26, + 89, 25, + hwnd, + (HMENU)IDC_DEV, + WinData->hInstance, + NULL + ); + hControls[HDEV] = hDev; + SetWindowSubclass(hDev, MouseOverProc, IDS_MOUSEOVER, IDC_DEV); + + //Console Button + HWND hConsole = CreateWindowEx( + NULL, + L"BUTTON", + szEnableConsole, + WS_CHILD | + WS_DISABLED | + WS_CLIPSIBLINGS | + WS_CLIPCHILDREN | + BS_OWNERDRAW, + 3, 26, + 115, 25, + hwnd, + (HMENU)IDC_CONSOLE, + WinData->hInstance, + NULL + ); + hControls[HCONSOLE] = hConsole; + SetWindowSubclass(hConsole, MouseOverProc, IDS_MOUSEOVER, IDC_CONSOLE); + + //Deathless Checkbox + hControls[HDEATHLESS] = CreateWindowEx( + NULL, + L"BUTTON", + L"Deathless", + WS_CHILD | + WS_VISIBLE | + WS_DISABLED | + WS_CLIPSIBLINGS | + WS_CLIPCHILDREN | + BS_AUTOCHECKBOX, + 3, 55, + 81, 19, + hwnd, + (HMENU)IDC_DEATHLESS, + WinData->hInstance, + NULL + ); + + //Infinite Ammo Checkbox + hControls[HINFAMMO] = CreateWindowEx( + NULL, + L"BUTTON", + L"Infinite Ammo", + WS_CHILD | + WS_VISIBLE | + WS_DISABLED | + WS_CLIPSIBLINGS | + WS_CLIPCHILDREN | + BS_AUTOCHECKBOX, + 3, 74, + 101, 19, + hwnd, + (HMENU)IDC_INFAMMO, + WinData->hInstance, + NULL + ); + + //Show HUD Checkbox + hControls[HSHOWHUD] = CreateWindowEx( + NULL, + L"BUTTON", + L"Show HUD", + WS_CHILD | + WS_VISIBLE | + WS_DISABLED | + WS_CLIPSIBLINGS | + WS_CLIPCHILDREN | + BS_AUTOCHECKBOX, + 3, 93, + 87, 19, + hwnd, + (HMENU)IDC_SHOWHUD, + WinData->hInstance, + NULL + ); + + //Letter Box Checkbox + hControls[HLETTERBOX] = CreateWindowEx( + NULL, + L"BUTTON", + L"Letter Box", + WS_CHILD | + WS_VISIBLE | + WS_DISABLED | + WS_CLIPSIBLINGS | + WS_CLIPCHILDREN | + BS_AUTOCHECKBOX, + 3, 112, + 81, 19, + hwnd, + (HMENU)IDC_LETTERBOX, + WinData->hInstance, + NULL + ); + + //Rider Ejection Checkbox + hControls[HMHUD] = CreateWindowEx( + NULL, + L"BUTTON", + L"Marines HUD",//L"Rider Ejection", + WS_CHILD | + WS_VISIBLE | + WS_DISABLED | + WS_CLIPSIBLINGS | + WS_CLIPCHILDREN | + BS_AUTO3STATE, + 3, 131, + 103, 19, + hwnd, + (HMENU)IDC_MHUD,//IDC_EJECTION, + WinData->hInstance, + NULL + ); + + //RPG_Beta6_2 controls + //Setting Combo Box + hControls[HSETTING] = CreateWindowEx( + NULL, + L"COMBOBOX", + NULL, + WS_CHILD | + WS_VISIBLE | + WS_DISABLED | + WS_OVERLAPPED | + WS_CLIPCHILDREN | + CBS_DROPDOWN | + CBS_HASSTRINGS, + 193, 23, + 56, 23, + hwnd, + (HMENU)IDC_SETTING, + WinData->hInstance, + NULL + ); + + for (int i = 0; i < 3; i++) + SendMessage(hControls[HSETTING], CB_ADDSTRING, 0, (LPARAM)setting_names[i]); + + //Alarm Button + HWND hAlarm = CreateWindowEx( + NULL, + L"BUTTON", + szAlarmOn, + WS_CHILD | + WS_VISIBLE | + WS_DISABLED | + WS_CLIPSIBLINGS | + WS_CLIPCHILDREN | + BS_OWNERDRAW, + 251, 23, + 75, 23, + hwnd, + (HMENU)IDC_ALARM, + WinData->hInstance, + NULL + ); + hControls[HALARM] = hAlarm; + SetWindowSubclass(hAlarm, MouseOverProc, IDS_MOUSEOVER, IDC_ALARM); + + //base lockdown label + hControls[HBLD_LBL] = CreateWindowEx( + NULL, + L"STATIC", + L"Base Lock Down", + WS_CHILD | + WS_VISIBLE | + WS_DISABLED | + WS_CLIPSIBLINGS | + WS_CLIPCHILDREN | + SS_OWNERDRAW, + 162, 48, + 102, 15, + hwnd, + (HMENU)IDC_BLD_LBL, + WinData->hInstance, + NULL + ); + + //base lockdown textbox + hControls[HBLD_TXTBX] = CreateWindowEx( + WS_EX_CLIENTEDGE, + L"EDIT", + szSeconds, + WS_CHILD | + WS_VISIBLE | + WS_DISABLED | + WS_CLIPSIBLINGS | + WS_CLIPCHILDREN | + ES_LEFT | + //ES_AUTOVSCROLL | + //ES_AUTOHSCROLL | + ES_NUMBER, + 116, 66, + 57, 21, + hwnd, + (HMENU)IDC_BLD_TXTBX, + WinData->hInstance, + NULL + ); + Edit_LimitText(hControls[HBLD_TXTBX], 3); + + //base lockdown set Button + HWND hBld_set = CreateWindowEx( + NULL, + L"BUTTON", + szSet, + WS_CHILD | + WS_VISIBLE | + WS_DISABLED | + WS_CLIPSIBLINGS | + WS_CLIPCHILDREN | + BS_OWNERDRAW, + 178, 64, + 62, 25, + hwnd, + (HMENU)IDC_BLD_SET_BTN, + WinData->hInstance, + NULL + ); + hControls[HBLD_SET_BTN] = hBld_set; + SetWindowSubclass(hBld_set, MouseOverProc, IDS_MOUSEOVER, IDC_BLD_SET_BTN); + + //base lockdown activate Button + HWND hBld_act = CreateWindowEx( + NULL, + L"BUTTON", + szBaseLockAct, + WS_CHILD | + WS_VISIBLE | + WS_DISABLED | + WS_CLIPSIBLINGS | + WS_CLIPCHILDREN | + BS_OWNERDRAW, + 246, 64, + 80, 25, + hwnd, + (HMENU)IDC_BLD_ACT_BTN, + WinData->hInstance, + NULL + ); + hControls[HBLD_ACT_BTN] = hBld_act; + SetWindowSubclass(hBld_act, MouseOverProc, IDS_MOUSEOVER, IDC_BLD_ACT_BTN); + + //halo label + hControls[HHALO_LBL] = CreateWindowEx( + NULL, + L"STATIC", + L"Halo", + WS_CHILD | + WS_VISIBLE | + WS_DISABLED | + WS_CLIPSIBLINGS | + WS_CLIPCHILDREN | + SS_OWNERDRAW, + 197, 89, + 33, 15, + hwnd, + (HMENU)IDC_HALO_LBL, + WinData->hInstance, + NULL + ); + + //halo textbox + hControls[HHALO_TXTBX] = CreateWindowEx( + WS_EX_CLIENTEDGE, + L"EDIT", + szSeconds, + WS_CHILD | + WS_VISIBLE | + WS_DISABLED | + WS_CLIPSIBLINGS | + WS_CLIPCHILDREN | + ES_LEFT | + //ES_AUTOVSCROLL | + //ES_AUTOHSCROLL | + ES_NUMBER, + 116, 107, + 57, 21, + hwnd, + (HMENU)IDC_HALO_TXTBX, + WinData->hInstance, + NULL + ); + Edit_LimitText(hControls[HHALO_TXTBX], 3); + + //halo set Button + HWND hHalo_set = CreateWindowEx( + NULL, + L"BUTTON", + szSet, + WS_CHILD | + WS_VISIBLE | + WS_DISABLED | + WS_CLIPSIBLINGS | + WS_CLIPCHILDREN | + BS_OWNERDRAW, + 178, 105, + 62, 25, + hwnd, + (HMENU)IDC_HALO_SET_BTN, + WinData->hInstance, + NULL + ); + hControls[HHALO_SET_BTN] = hHalo_set; + SetWindowSubclass(hHalo_set, MouseOverProc, IDS_MOUSEOVER, IDC_HALO_SET_BTN); + + //halo activate Button + HWND hHalo_act = CreateWindowEx( + NULL, + L"BUTTON", + szHaloFire, + WS_CHILD | + WS_VISIBLE | + WS_DISABLED | + WS_CLIPSIBLINGS | + WS_CLIPCHILDREN | + BS_OWNERDRAW, + 246, 105, + 80, 25, + hwnd, + (HMENU)IDC_HALO_ACT_BTN, + WinData->hInstance, + NULL + ); + hControls[HHALO_ACT_BTN] = hHalo_act; + SetWindowSubclass(hHalo_act, MouseOverProc, IDS_MOUSEOVER, IDC_HALO_ACT_BTN); + + //(HFONT)::GetStockObject(DEFAULT_GUI_FONT); + hFont = CreateFontW( + 16, 0, + 0, + 0, + FW_NORMAL, + FALSE, + FALSE, + FALSE, + DEFAULT_CHARSET, + OUT_DEFAULT_PRECIS, + CLIP_DEFAULT_PRECIS, + DEFAULT_QUALITY, + DEFAULT_PITCH, + L"Microsoft Sans Serif" + ); + + for (int i = 0; i < NUM_OF_CONTROLS; i++) + SetWindowFont(hControls[i], hFont, TRUE); + + //display first item in checkbox + SendMessage(hControls[HSETTING], CB_SETCURSEL, 0, 0); + + return TRUE; +} + +void OnPaint(HWND hwnd) +{ + PAINTSTRUCT Ps; + HDC hdc = BeginPaint(hwnd, &Ps); + HPEN hWhitePen = GetStockPen(WHITE_PEN); + HGDIOBJ hOldObj = SelectObject(hdc, hWhitePen); + + MoveToEx(hdc, 0, 19, NULL); + LineTo(hdc, 335, 19); + + SelectObject(hdc, hOldObj); + EndPaint(hwnd, &Ps); +} + +void OnDrawItem(HWND hwnd, const DRAWITEMSTRUCT *lpDrawItem) +{ + UINT iState = lpDrawItem->itemState; + BOOL bIsPressed = (iState & ODS_SELECTED); + BOOL bIsFocused = (iState & ODS_FOCUS); + BOOL bIsDisabled = (iState & ODS_DISABLED); + //BOOL bIsMouseOver = (lpDrawItem->itemState & ODS_HOTLIGHT); + BOOL bDrawOutLine = (lpDrawItem->CtlType == ODT_BUTTON); + + HBRUSH brBackground; + COLORREF forecolor = 0; + + int Ctrl_ID = lpDrawItem->CtlID; + bool highlight = bIsPressed || MouseOverControlID == Ctrl_ID; + switch (Ctrl_ID) + { + case IDC_MENU_BUTTON: + if (highlight || MenuActive) brBackground = CreateSolidBrush(RGB(51,153,255)); + else brBackground = GetStockBrush(NULL_BRUSH); + + forecolor = RGB(255,255,255); + bDrawOutLine = FALSE; + break; + + case IDC_SERVER_STATUS: + brBackground = GetStockBrush(NULL_BRUSH); + bIsDisabled = running_gt == not_running; + forecolor = running_sv_t == host ? RGB(0,128,0) : RGB(255,0,0); + break; + + case IDC_DEV: + if (highlight) brBackground = CreateSolidBrush(RGB(229,229,229)); + else brBackground = GetStockBrush(NULL_BRUSH); + + forecolor = dev_enabled ? RGB(0,128,0) : RGB(255,0,0); + break; + + case IDC_CONSOLE: + if (highlight) brBackground = CreateSolidBrush(RGB(229,229,229)); + else brBackground = GetStockBrush(NULL_BRUSH); + + forecolor = console_enabled ? RGB(0,128,0) : RGB(255,0,0); + break; + + case IDC_ALARM: + if (highlight) brBackground = CreateSolidBrush(RGB(229,229,229)); + else brBackground = GetStockBrush(NULL_BRUSH); + + forecolor = alarm_on ? RGB(51,153,255) : RGB(255,0,0); + break; + + case IDC_BLD_LBL: + case IDC_HALO_LBL: + brBackground = GetStockBrush(NULL_BRUSH); + bIsDisabled = running_sv_t != host || !rpgb6_2_running; + forecolor = 0x00FFFFFF;//RGB(255,255,255); + break; + + case IDC_BLD_SET_BTN: + case IDC_HALO_SET_BTN: + if (highlight) brBackground = CreateSolidBrush(RGB(229,229,229)); + else brBackground = GetStockBrush(NULL_BRUSH); + + forecolor = RGB(51,153,255); + break; + + case IDC_BLD_ACT_BTN: + if (highlight) brBackground = CreateSolidBrush(RGB(229,229,229)); + else brBackground = GetStockBrush(NULL_BRUSH); + + forecolor = Locked ? RGB(255,0,0) : RGB(51,153,255); + break; + + case IDC_HALO_ACT_BTN: + if (highlight) brBackground = CreateSolidBrush(RGB(229,229,229)); + else brBackground = GetStockBrush(NULL_BRUSH); + + forecolor = Nuked ? RGB(255,0,0) : RGB(51,153,255); + break; + } + + HDC hdc = lpDrawItem->hDC;//optimizer does this + FillRect(hdc, &(lpDrawItem->rcItem), brBackground); + DeleteObject(brBackground); + + int pnWidthEx = 0; + if (bIsFocused) pnWidthEx++; + + if (bDrawOutLine) + { + HPEN pnForeColor = CreatePen(PS_SOLID, 1 + pnWidthEx, forecolor); + SelectObject(hdc, pnForeColor); + Rectangle(hdc, lpDrawItem->rcItem.left + pnWidthEx, lpDrawItem->rcItem.top + pnWidthEx, lpDrawItem->rcItem.right, lpDrawItem->rcItem.bottom); + DeleteObject(pnForeColor); + } + + int str_len = GetWindowTextW(lpDrawItem->hwndItem, szBuffer, SZ_BUFFER_SIZE); + + SIZE dimensions = {0}; + GetTextExtentPoint32W(hdc, szBuffer, str_len, &dimensions); + int xPos = (lpDrawItem->rcItem.right - dimensions.cx) / 2; + int yPos = ((lpDrawItem->rcItem.bottom - dimensions.cy) / 2) + 1; + + SetBkMode(hdc, TRANSPARENT); + SetTextColor(hdc, bIsDisabled ? GetSysColor(COLOR_GRAYTEXT) : forecolor); + TextOut(hdc, xPos, yPos, szBuffer, str_len); +} + +int OnNotify(HWND hwnd, int idCtrl, LPNMHDR pnmh) +{ + int ret_val = 0; + + if (pnmh->code == NM_CUSTOMDRAW) + { + LPNMCUSTOMDRAW lpcd = (LPNMCUSTOMDRAW)pnmh; + if (lpcd->dwDrawStage == CDDS_PREPAINT) + { + switch (idCtrl) + { + case IDC_DEATHLESS: + case IDC_INFAMMO: + case IDC_SHOWHUD: + case IDC_LETTERBOX: + case IDC_MHUD://IDC_EJECTION: + { + int str_len = GetWindowTextW(lpcd->hdr.hwndFrom, szBuffer, SZ_BUFFER_SIZE); + + HDC hdc = lpcd->hdc;//optimizer does this + SetBkMode(hdc, TRANSPARENT); + SetTextColor(hdc, (lpcd->uItemState ^ CDIS_DISABLED) ? RGB(51,153,255) : GetSysColor(COLOR_GRAYTEXT)); + TextOut(hdc, 18, 2, szBuffer, str_len); + + ret_val = CDRF_SKIPDEFAULT; + break; + } + } + } + } + + return ret_val; +} + +void OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) +{ + switch (codeNotify) + { + case BN_CLICKED: + switch(id) + { + case IDM_DEV_COMMANDS: + if (DialogBoxParamA(hInst, MAKEINTRESOURCEA(IDD_CMDS), hwnd, CMDSDlgProc, (LPARAM)&CMDsLib::halo_commands)) + { + if (hHDC) + { + //update keys in dll too + Halo_Process->WriteMemArray((LPVOID) + dll_addresses.halo_cmd_keys, + CMDsLib::halo_cmd_keys, + HALO_CMDS_SIZE); + + Halo_Process->WriteMem((LPVOID)dll_addresses.halo_sk_enabled, CMDsLib::halo_commands.Enable_Shrtcts); + } + CMDsLib::WriteSKeysToFile(Settings_File_Name); + } + break; + + case IDM_RPGBETA_COMMANDS: + if (DialogBoxParamA(hInst, MAKEINTRESOURCEA(IDD_CMDS), hwnd, CMDSDlgProc, (LPARAM)&CMDsLib::rpgbeta6_2_commands)) + { + if (hHDC) + { + //update keys in dll too + Halo_Process->WriteMemArray((LPVOID) + dll_addresses.rpgb62_cmd_keys, + CMDsLib::rpg_beta6_2_cmd_keys, + RPGB_CMDS_SIZE); + + Halo_Process->WriteMem((LPVOID)dll_addresses.rpg_beta62_sk_enabled, CMDsLib::rpgbeta6_2_commands.Enable_Shrtcts); + } + CMDsLib::WriteSKeysToFile(Settings_File_Name); + } + break; + + case IDM_PLAYER_COMMANDS: + DialogBoxParamA(hInst, MAKEINTRESOURCEA(IDD_CMDS), hwnd, CMDSDlgProc, (LPARAM)&CMDsLib::player_commands); + break; + + case IDM_TELEPORT_LOCATIONS: + { + std::vector maps_tele_sites; + GetLocationsFromFile(Locations_File_Name, &maps_tele_sites); + + if (DialogBoxParamA(hInst, MAKEINTRESOURCEA(IDD_TELE_LOC), hwnd, TeleLocDlgProc, (LPARAM)&maps_tele_sites)) + { + WriteLocationsToFile(Locations_File_Name, &maps_tele_sites); + if (hHDC) + Halo_Process->WriteMem((LPVOID)(dll_addrs_ptr + sizeof(DLL_ADDRS)), true); + } + break; + } + case IDM_ABOUT: + DialogBoxParamA(hInst, MAKEINTRESOURCEA(IDD_ABOUT), hwnd, AboutDlgProc, (LPARAM)hInst); + break; + + case IDC_MENU_BUTTON: + { + MenuActive = true; + RECT rControl; + GetWindowRect(hwndCtl, &rControl); + TrackPopupMenu(ExtrasMenu, TPM_LEFTBUTTON, rControl.left, rControl.top + 19, 0, hwnd, NULL); + + MenuActive = false; + //needed for a transparent background + MapWindowRect(HWND_DESKTOP, hwnd, &rControl); + InvalidateRect(hwnd, &rControl, TRUE); + break; + } + case IDC_DEV: + { + bool Dev_enabled = Halo_Process->ReadMem((LPVOID)Dev_enabled_address); + + if (!Dev_enabled) + //enable console + Halo_Process->WriteMem((LPVOID)Console_enabled_address, true); + + Halo_Process->WriteMem((LPVOID)Dev_enabled_address, !Dev_enabled); + break; + } + case IDC_CONSOLE: + + Halo_Process->WriteMem((LPVOID)Console_enabled_address, !Halo_Process->ReadMem((LPVOID)Console_enabled_address)); + break; + + case IDC_DEATHLESS: + Halo_Process->WriteMem( + (LPVOID)(Cheats_address + HaloCE_lib::CheatsEx::Deathless_offset), + (BYTE)Button_GetCheck(hControls[HDEATHLESS])); + break; + + case IDC_INFAMMO: + Halo_Process->WriteMem( + (LPVOID)(Cheats_address + HaloCE_lib::CheatsEx::Infinite_Ammo_offset), + (BYTE)Button_GetCheck(hControls[HINFAMMO])); + break; + + case IDC_SHOWHUD: + { + DWORD ShowHud_address = Halo_Process->ReadMem((LPVOID)ShowHud_ptr_address); + if (ShowHud_address) + { + Halo_Process->WriteMem( + (LPVOID)ShowHud_address, + (BYTE)Button_GetCheck(hControls[HSHOWHUD])); + } + break; + } + case IDC_LETTERBOX: + { + DWORD LetterBox_address = Halo_Process->ReadMem((LPVOID)LetterBox_ptr_address); + if (LetterBox_address) + { + LetterBox_address += 8; + Halo_Process->WriteMem( + (LPVOID)LetterBox_address, + (BYTE)Button_GetCheck(hControls[HLETTERBOX])); + } + break; + } + case IDC_MHUD://IDC_EJECTION: + { + //Halo_Process->WriteMem( + // (LPVOID)RiderEjection_address, + // (BYTE)Button_GetCheck(hControls[HEJECTION])); + + MV_chkBx_CheckedChanged(Button_GetCheck(hControls[HMHUD])); + break; + } + case IDC_ALARM: + Halo_Process->WriteMem((LPVOID)(Device_Groups_Header.FirstItem + + HCE_Lib::rpg_beta6_2_device_groups::alarm_control_2_offset), true); + break; + + case IDC_BLD_SET_BTN: + { + int seconds = 0; + GetWindowTextW(hControls[HBLD_TXTBX], szBuffer, SZ_BUFFER_SIZE); + + + if (CMDsLib::ParseStrInt((wchar_t*)szBuffer, &seconds)) + Halo_Process->WriteMem((LPVOID)(HS_Global_Header.FirstItem + HCE_Lib::rpg_beta6_2_hs_global::lock_timer_offset), seconds * 30); + break; + } + case IDC_BLD_ACT_BTN: + { + if (!Halo_Process->ReadMem((LPVOID)(HS_Global_Header.FirstItem + HCE_Lib::rpg_beta6_2_hs_global::locked_offset))) + Halo_Process->WriteMem((LPVOID)(Device_Groups_Header.FirstItem + + HCE_Lib::rpg_beta6_2_device_groups::lock_control_offset), 1); + else + { + //Halo_Process->WriteMemBool(HCE_Lib.Locked, false); + } + break; + } + case IDC_HALO_SET_BTN: + { + int seconds = 0; + GetWindowTextW(hControls[HHALO_TXTBX], szBuffer, SZ_BUFFER_SIZE); + + if (CMDsLib::ParseStrInt((wchar_t*)szBuffer, &seconds)) + Halo_Process->WriteMem((LPVOID)(HS_Global_Header.FirstItem + HCE_Lib::rpg_beta6_2_hs_global::boom_timer_offset), seconds * 30); + break; + } + case IDC_HALO_ACT_BTN: + { + if (!Halo_Process->ReadMem((LPVOID)(HS_Global_Header.FirstItem + HCE_Lib::rpg_beta6_2_hs_global::nuked_offset))) + Halo_Process->WriteMem((LPVOID)(Device_Groups_Header.FirstItem + + HCE_Lib::rpg_beta6_2_device_groups::boom_control_offset), 1); + else + { + + } + break; + } + } + break; + + case CBN_SELCHANGE: + if (id == IDC_SETTING) + { + int ItemIndex = SendMessage(hwndCtl, CB_GETCURSEL, 0, 0); + Halo_Process->WriteMem((LPVOID)(HS_Global_Header.FirstItem + + HCE_Lib::rpg_beta6_2_hs_global::setting_offset), (BYTE)ItemIndex); + } + break; + } +} + +HBRUSH OnCtlColorStatic(HWND hwnd, HDC hdc, HWND hwndChild, int type) +{ + COLORREF textcolor; + int stock_brush_type = WHITE_BRUSH; + + if (pIsAppThemed) theme_active = pIsAppThemed(); + + switch (GetDlgCtrlID(hwndChild)) + { + case IDC_HALO_TYPE: + textcolor = RGB(240,240,240); + break; + + case IDC_HALO_STATUS: + textcolor = running_gt != not_running ? RGB(0,128,0) : RGB(255,0,0); + break; + + case IDC_MAP_LBL: + textcolor = RGB(240,240,240); + break; + + case IDC_MAP_STATUS: + textcolor = rpgb6_2_running ? RGB(0,128,0) : RGB(255,0,0); + break; + + case IDC_DEATHLESS: + if (theme_active) + { + if (pDrawThemeParentBackground) pDrawThemeParentBackground(hwndChild, hdc, NULL); + } + textcolor = RGB(51,153,255); + break; + + case IDC_INFAMMO: + if (theme_active) + { + if (pDrawThemeParentBackground) pDrawThemeParentBackground(hwndChild, hdc, NULL); + } + textcolor = RGB(51,153,255); + break; + + case IDC_SHOWHUD: + if (theme_active) + { + if (pDrawThemeParentBackground) pDrawThemeParentBackground(hwndChild, hdc, NULL); + } + textcolor = RGB(51,153,255); + break; + + case IDC_LETTERBOX: + if (theme_active) + { + if (pDrawThemeParentBackground) pDrawThemeParentBackground(hwndChild, hdc, NULL); + } + textcolor = RGB(51,153,255); + break; + + case IDC_MHUD://IDC_EJECTION: + if (theme_active) + { + if (pDrawThemeParentBackground) pDrawThemeParentBackground(hwndChild, hdc, NULL); + } + textcolor = RGB(51,153,255); + break; + + default: + return GetStockBrush(WHITE_BRUSH); + } + + SetTextColor(hdc, textcolor); + //transparent background for all static controls + SetBkMode(hdc, TRANSPARENT); + return GetStockBrush(NULL_BRUSH); +} + +BOOL SetTpWindowText(HWND hMainWin, HWND hControl, LPCWSTR lpwString) +{ + BOOL succeded; + GetWindowText(hControl, (LPWSTR)szBuffer, SZ_BUFFER_SIZE); + //only change if its different + if (!str_cmpW((wchar_t*)szBuffer, (wchar_t*)lpwString)) + { + succeded = SetWindowTextW(hControl, lpwString); + RedrawTpWindow(hMainWin, hControl); + } + else + { + succeded = TRUE; + } + return succeded; +} + +BOOL EnableTpWindow(HWND hMainWin, HWND hControl, BOOL bEnable) +{ + BOOL succeded; + if (IsWindowEnabled(hControl) == bEnable) + { + succeded = TRUE; + } + else + { + succeded = EnableWindow(hControl, bEnable); + RedrawTpWindow(hMainWin, hControl); + } + return succeded; +} + +BOOL ShowTpWindow(HWND hMainWin, HWND hControl, BOOL bShow) +{ + BOOL succeded; + if (IsWindowVisible(hControl) == bShow) + { + succeded = TRUE; + } + else + { + succeded = ShowWindow(hControl, bShow); + RedrawTpWindow(hMainWin, hControl); + } + return succeded; +} + +BOOL RedrawTpWindow(HWND hMainWin, HWND hControl) +{ + RECT rectControl; + GetWindowRect(hControl, &rectControl); + MapWindowRect(HWND_DESKTOP, hMainWin, &rectControl); + + return InvalidateRect(hMainWin, &rectControl, TRUE); +} + +LRESULT CALLBACK MouseOverProc( + HWND hCtrl, + UINT message, + WPARAM wParam, + LPARAM lParam, + UINT_PTR uIdSubclass, + DWORD_PTR dwRefData) +{ + switch (message) + { + case WM_MOUSEMOVE: + { + TRACKMOUSEEVENT tme; + tme.cbSize = sizeof(TRACKMOUSEEVENT); + tme.dwFlags = TME_LEAVE; + tme.hwndTrack = hCtrl; + _TrackMouseEvent(&tme); + + if (!MouseOverControlID) + { + MouseOverControlID = dwRefData; + InvalidateRect(hCtrl, NULL, FALSE); + } + break; + } + case WM_MOUSELEAVE: + { + MouseOverControlID = 0; + RedrawTpWindow(GetParent(hCtrl), hCtrl); + break; + } + case WM_NCDESTROY: + RemoveWindowSubclass(hCtrl, MouseOverProc, IDS_MOUSEOVER); + } + return DefSubclassProc(hCtrl, message, wParam, lParam); +} + +void __stdcall MV_chkBx_CheckedChanged(int number) +{ + LPTHREAD_START_ROUTINE func_address; + BYTE *asm_func; + DWORD asm_func_loc; + + //use function in dll if dll is loaded + if (pMV_chkBx_CheckedChanged) + { + func_address = (LPTHREAD_START_ROUTINE)pMV_chkBx_CheckedChanged; + } + //if not do it the hard way + else if (cinematic_ptr && cse_set_video_func_address) + { + int asm_func_size = 0x6C; + asm_func = new BYTE[asm_func_size]; + asm_func_loc = (DWORD)Halo_Process->AllocateMemory(asm_func_size); + + int byte_loc = 0; + asm_func[byte_loc++] = 0x55; //push ebp + + asm_func[byte_loc++] = 0x8B; //mov ebp,esp + asm_func[byte_loc++] = 0xEC; + + asm_func[byte_loc++] = 0x83; //cmp dword ptr [ebp+8],2 + asm_func[byte_loc++] = 0x7D; + asm_func[byte_loc++] = 0x08; + asm_func[byte_loc++] = 0x02; + + asm_func[byte_loc++] = 0x57; //push edi + + asm_func[byte_loc++] = 0xC6; //mov byte ptr [ebp-1],0 + asm_func[byte_loc++] = 0x45; + asm_func[byte_loc++] = 0xFF; + asm_func[byte_loc++] = 0x00; + + asm_func[byte_loc++] = 0x75; //jne short 4 + asm_func[byte_loc++] = 0x04; + + asm_func[byte_loc++] = 0xD9; //fldz + asm_func[byte_loc++] = 0xEE; + + asm_func[byte_loc++] = 0xEB; //jmp short 6 + asm_func[byte_loc++] = 0x06; + + asm_func[byte_loc++] = 0xD9; //fld [__real@40000000] + asm_func[byte_loc++] = 0x05; + TO_BYTES(DWORD, &asm_func[byte_loc], asm_func_loc + 0x68); + byte_loc += sizeof(DWORD); + + asm_func[byte_loc++] = 0xD9; //fstp + asm_func[byte_loc++] = 0x5D; + asm_func[byte_loc++] = 0xF8; + + asm_func[byte_loc++] = 0x8B; //mov ecx,dword ptr [ebp+8] + asm_func[byte_loc++] = 0x4D; + asm_func[byte_loc++] = 0x08; + + asm_func[byte_loc++] = 0x8B; //mov edx,dword ptr [cinematic_ptr] + asm_func[byte_loc++] = 0x15; + TO_BYTES(DWORD, &asm_func[byte_loc], cinematic_ptr); + byte_loc += sizeof(DWORD); + + asm_func[byte_loc++] = 0x85; //test edx,edx + asm_func[byte_loc++] = 0xD2; + + asm_func[byte_loc++] = 0x74; //je short 36h + asm_func[byte_loc++] = 0x36; + + asm_func[byte_loc++] = 0x85; //test ecx,ecx + asm_func[byte_loc++] = 0xC9; + + asm_func[byte_loc++] = 0x74; //je short 2Ah + asm_func[byte_loc++] = 0x2A; + + asm_func[byte_loc++] = 0x80; //cmp byte ptr[edx+38h],0 + asm_func[byte_loc++] = 0x7A; + asm_func[byte_loc++] = 0x38; + asm_func[byte_loc++] = 0x00; + + asm_func[byte_loc++] = 0x75; //jnz short 14h + asm_func[byte_loc++] = 0x14; + + asm_func[byte_loc++] = 0xB9; //mov ecx,0Eh + asm_func[byte_loc++] = 0x0E; + asm_func[byte_loc++] = 0x00; + asm_func[byte_loc++] = 0x00; + asm_func[byte_loc++] = 0x00; + + asm_func[byte_loc++] = 0x33; //xor eax,eax + asm_func[byte_loc++] = 0xC0; + + asm_func[byte_loc++] = 0x8B; //mov edi,eax + asm_func[byte_loc++] = 0xFA; + + asm_func[byte_loc++] = 0xF3; //rep stos dword ptr[edi] + asm_func[byte_loc++] = 0xAB; + + asm_func[byte_loc++] = 0x3E; //mov byte ptr[edx+39h],1 + asm_func[byte_loc++] = 0xC6; + asm_func[byte_loc++] = 0x42; + asm_func[byte_loc++] = 0x39; + asm_func[byte_loc++] = 0x01; + + asm_func[byte_loc++] = 0xC6; //mov byte ptr[edx+38h],1 + asm_func[byte_loc++] = 0x42; + asm_func[byte_loc++] = 0x38; + asm_func[byte_loc++] = 0x01; + + asm_func[byte_loc++] = 0x8B; //mov eax,dword ptr[ebp-8] + asm_func[byte_loc++] = 0x45; + asm_func[byte_loc++] = 0xF8; + + asm_func[byte_loc++] = 0x50; //push eax + + asm_func[byte_loc++] = 0x6A; //push 2 + asm_func[byte_loc++] = 0x02; + + asm_func[byte_loc++] = 0xE8; //call cse_set_video_func_address + TO_BYTES(DWORD, &asm_func[byte_loc], cse_set_video_func_address - (asm_func_loc + byte_loc + 4)); + byte_loc += sizeof(DWORD); + + asm_func[byte_loc++] = 0x83; //add esp,8 + asm_func[byte_loc++] = 0xC4; + asm_func[byte_loc++] = 0x08; + + asm_func[byte_loc++] = 0xEB; //jmp short 4 + asm_func[byte_loc++] = 0x04; + + asm_func[byte_loc++] = 0xC6; //mov byte ptr[edx+38h],0 + asm_func[byte_loc++] = 0x42; + asm_func[byte_loc++] = 0x38; + asm_func[byte_loc++] = 0x00; + + asm_func[byte_loc++] = 0xC6; //mov byte ptr[ebp-1],1 + asm_func[byte_loc++] = 0x45; + asm_func[byte_loc++] = 0xFF; + asm_func[byte_loc++] = 0x01; + + asm_func[byte_loc++] = 0x8A; //mov al,byte ptr[ebp-1] + asm_func[byte_loc++] = 0x45; + asm_func[byte_loc++] = 0xFF; + + asm_func[byte_loc++] = 0x5F; //pop edi + + asm_func[byte_loc++] = 0x8B; //mov esp,ebp + asm_func[byte_loc++] = 0xE5; + + asm_func[byte_loc++] = 0x5D; //pop ebp + + asm_func[byte_loc++] = 0xC2; //retn 4 + asm_func[byte_loc++] = 0x04; + asm_func[byte_loc++] = 0x00; + + TO_BYTES(DWORD, &asm_func[byte_loc], 0x40000000);//2.0 + + //write the function to allocated space + Halo_Process->WriteMemArray((LPVOID)asm_func_loc, asm_func, asm_func_size); + + //set the address to the injected function + func_address = (LPTHREAD_START_ROUTINE)asm_func_loc; + } + + HANDLE NewThreadhnd = CreateRemoteThread( + Halo_Process->GetProcessHandle(), + NULL, + 0, + func_address, + (LPVOID)number, + 0, + NULL + ); + + if (NewThreadhnd) + { + WaitForSingleObject(NewThreadhnd, 1000); + CloseHandle(NewThreadhnd); + } + else + DWORD doslasterror = GetLastError(); + + if (!pMV_chkBx_CheckedChanged) + { + Halo_Process->FreeMemory((LPVOID)asm_func_loc); + delete[] asm_func; + } +} +/* +6E265E00 55 push ebp +6E265E01 8B EC mov ebp,esp +6E265E03 83 EC 08 sub esp,8 + 291: bool succeded = false; + 292: + 293: float fnum; + 294: if (number == 2) fnum = 0; +6E265E06 83 7D 08 02 cmp dword ptr [ebp+8],2 +6E265E0A 57 push edi +6E265E0B C6 45 FF 00 mov byte ptr [succeded],0 +6E265E0F 75 04 jne MV_chkBx_CheckedChanged+15h (6E265E15h) +6E265E11 D9 EE fldz +6E265E13 EB 06 jmp MV_chkBx_CheckedChanged+1Bh (6E265E1Bh) + 295: else fnum = 2; +6E265E15 D9 05 90 9E 27 6E fld dword ptr [__real@40000000 (6E279E90h)] +6E265E1B D9 5D F8 fstp dword ptr [fnum] + 296: + 297: __asm + 298: { + 299: MOV ECX,number +6E265E1E 8B 4D 08 mov ecx,dword ptr [number] + 300: MOV EDX,DWORD PTR [cinematic_ptr] +6E265E21 8B 15 7C EA 27 6E mov edx,dword ptr [cinematic_ptr (6E27EA7Ch)] + 301: MOV EDX,DWORD PTR [EDX] +6E265E27 8B 12 mov edx,dword ptr [edx] + 302: TEST EDX,EDX +6E265E29 85 D2 test edx,edx + 303: JE SHORT cin_failed +6E265E2B 74 37 je cin_failed (6E265E64h) + 304: TEST ECX,ECX +6E265E2D 85 C9 test ecx,ecx + 305: JE SHORT cin_stop +6E265E2F 74 2B je cin_stop (6E265E5Ch) + 306: CMP BYTE PTR [EDX+38h],0 +6E265E31 80 7A 38 00 cmp byte ptr [edx+38h],0 + 307: JNZ SHORT skip_cin_start +6E265E35 75 14 jne skip_cin_start (6E265E4Bh) + 308: + 309: MOV ECX,0Eh +6E265E37 B9 0E 00 00 00 mov ecx,0Eh + 310: XOR EAX,EAX +6E265E3C 33 C0 xor eax,eax + 311: MOV EDI,EDX +6E265E3E 8B FA mov edi,edx + 312: REP STOS DWORD PTR [EDI] +6E265E40 F3 AB rep stos dword ptr es:[edi] + 313: MOV BYTE PTR DS:[EDX+39h],1 +6E265E42 3E C6 42 39 01 mov byte ptr ds:[edx+39h],1 + 314: MOV BYTE PTR [EDX+38h],1 +6E265E47 C6 42 38 01 mov byte ptr [edx+38h],1 + 315: + 316: skip_cin_start: + 317: MOV EAX,fnum +6E265E4B 8B 45 F8 mov eax,dword ptr [fnum] + 318: PUSH EAX +6E265E4E 50 push eax + 319: PUSH 2 +6E265E4F 6A 02 push 2 + 320: CALL DWORD PTR cse_set_video_func_address +6E265E51 FF 15 78 EA 27 6E call dword ptr [cse_set_video_func_address (6E27EA78h)] + 321: ADD ESP,8 +6E265E57 83 C4 08 add esp,8 + 322: JMP SHORT cin_succeded +6E265E5A EB 04 jmp cin_succeded (6E265E60h) + 323: + 324: cin_stop: + 325: MOV BYTE PTR [EDX+38h],0 +6E265E5C C6 42 38 00 mov byte ptr [edx+38h],0 + 326: + 327: cin_succeded: + 328: MOV succeded,1 +6E265E60 C6 45 FF 01 mov byte ptr [succeded],1 + 329: + 330: cin_failed: + 331: } + 332: return succeded; +6E265E64 8A 45 FF mov al,byte ptr [succeded] + 333: } +6E265E67 5F pop edi +6E265E68 8B E5 mov esp,ebp +6E265E6A 5D pop ebp +6E265E6B C2 04 00 ret 4*/ \ No newline at end of file diff --git a/Halo Dev Controls/WinMain.h b/Halo Dev Controls/WinMain.h new file mode 100644 index 0000000..b7b068d --- /dev/null +++ b/Halo Dev Controls/WinMain.h @@ -0,0 +1,212 @@ +/******************************************************************************** + -- Halo Dev Controls + Copyright © 2011 Jesus7Freak + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +********************************************************************************* + File: WinMain.cpp + Project: Halo Dev Controls + Author: Jesus7Freak + Date: 11/22/2011 + Game: Halo and Halo Custom Edition + Version: all +*********************************************************************************/ +#pragma once +#pragma comment(lib, "kernel32.lib") +#pragma comment(lib, "user32.lib") +#pragma comment(lib, "gdi32.lib") +#pragma comment(lib, "version.lib") +#pragma comment(lib, "comctl32.lib") +#pragma comment(lib, "libcpmt.lib") +#pragma comment(lib, "LIBCMT.lib") + + +// Enabling Windows XP visual effects (aka themes) +#ifdef _UNICODE +#if defined _M_IX86 +#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") +#elif defined _M_IA64 +#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"") +#elif defined _M_X64 +#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") +#else +#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") +#endif +#endif + +#include "Resource.h" +#include "HaloLib.h" +#include "tele_loc_resources.h" +#include "cmds.h" + +#include +#include "Commctrl.h" + +typedef bool (__stdcall *EditMaskFnType)(UINT, bool); + +struct DLL_ADDRS +{ + HWND hHaloWin; + CMDsLib::CMD_SCKEYS **halo_cmd_keys; + CMDsLib::CMD_SCKEYS **rpgb62_cmd_keys; + BOOL *halo_sk_enabled; + BOOL *rpg_beta62_sk_enabled; + bool (__stdcall *pFunc)(int); + wchar_t *CurrentDir; + WORD *game; +}extern dll_addresses; + +BOOL CALLBACK CMDSDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) ; +BOOL CALLBACK ChangeKeyDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); +BOOL CALLBACK TeleLocDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); +BOOL CALLBACK AboutDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); + +LRESULT CALLBACK EditMaskProc( + HWND hCtrl, + UINT message, + WPARAM wParam, + LPARAM lParam, + UINT_PTR uIdSubclass, + DWORD_PTR dwRefData + ); + +LRESULT CALLBACK MouseOverProc( + HWND hCtrl, + UINT message, + WPARAM wParam, + LPARAM lParam, + UINT_PTR uIdSubclass, + DWORD_PTR dwRefData + ); + +DWORD WINAPI HDCThread(LPVOID lpMainWin); + +//for transparent controls +BOOL RedrawTpWindow(HWND hMainWin, HWND hControl); +BOOL EnableTpWindow(HWND hMainWin, HWND hControl, BOOL bEnable); +BOOL SetTpWindowText(HWND hMainWin, HWND hControl, LPCWSTR lpwString); +BOOL ShowTpWindow(HWND hMainWin, HWND hControl, BOOL bShow); + +void __stdcall MV_chkBx_CheckedChanged(int number); +//from dll +extern bool (__stdcall *pMV_chkBx_CheckedChanged)(int number); + +//need to make sure wstr is big enough for str +inline void str_to_wstr(char *str, wchar_t *wstr); + +#define NUM_OF_CONTROLS 23 +#define SZ_BUFFER_SIZE 32 + +#define HHALO_TYPE 0 +#define HHALO_STATUS 1 +#define HMAP_LBL 2 +#define HMAP_STATUS 3 +#define HMENU_BUTTON 4 +#define HSERVER_STATUS 5 + +#define HDEV 6 +#define HCONSOLE 7 +#define HDEATHLESS 8 +#define HINFAMMO 9 +#define HSHOWHUD 10 +#define HLETTERBOX 11 +//#define HEJECTION 12 +#define HMHUD 12 + +#define HSETTING 13 +#define HALARM 14 +#define HBLD_LBL 15 +#define HBLD_TXTBX 16 +#define HBLD_SET_BTN 17 +#define HBLD_ACT_BTN 18 +#define HHALO_LBL 19 +#define HHALO_TXTBX 20 +#define HHALO_SET_BTN 21 +#define HHALO_ACT_BTN 22 + + +extern HWND hControls[NUM_OF_CONTROLS]; +extern HMODULE hUxTheme; + +extern RWMemory *Halo_Process; +extern HMODULE hHDC; +extern bool exiting, + dev_enabled, + console_enabled, + alarm_on, + rpgb6_2_running, + Locked, + Nuked; + +extern BOOL theme_active; + +extern wchar_t *szWindowClass, + *szTitle, + *szHaloCE, + *szHaloPC, + *szHaloCE_exe, + *szHaloPC_exe, + *szOn, + *szOff, + *szMap, + *szMainMenu, + *szClient, + *szHost, + *szDisableDev, + *szEnableDev, + *szDisableConsole, + *szEnableConsole, + *Locations_File_Name, + *Settings_File_Name, + *Dll_Name, + *main_module_name, + *empty_str, + *setting_names[3], + *szAlarmOn, + *szAlarmOff, + *szSet, + *szBaseLockAct, + *szBaseLockLocked, + *szSeconds, + *szHaloFire, + *szHaloCoolDown, + szBuffer[SZ_BUFFER_SIZE]; + +extern int MouseOverControlID; + +extern DWORD scan_size, + Current_Map_address, + Cheats_address, + ServerType_address, + Device_Groups_Header_ptr_address, + HS_Global_Header_ptr_address, + dll_addrs_ptr, + Dev_enabled_address, + Console_enabled_address, + ShowHud_ptr_address, + LetterBox_ptr_address, + //RiderEjection_address; + cse_set_video_func_address, + cinematic_ptr; + +enum game_types : WORD + { not_running = 0, Halo = 1, HCE = 2 } extern running_gt; + +enum server_type : WORD + { main_menu = 0, client = 1, host = 2 } extern running_sv_t; + +extern HaloCE_lib::DATA_HEADER Device_Groups_Header, + HS_Global_Header; + +extern HINSTANCE hInst; \ No newline at end of file diff --git a/Halo Dev Controls/WinTeleLoc.cpp b/Halo Dev Controls/WinTeleLoc.cpp new file mode 100644 index 0000000..430469a --- /dev/null +++ b/Halo Dev Controls/WinTeleLoc.cpp @@ -0,0 +1,401 @@ +/******************************************************************************** + -- Halo Dev Controls + Copyright © 2011 Jesus7Freak + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +********************************************************************************* + File: WinTeleLoc.cpp + Project: Halo Dev Controls + Author: Jesus7Freak + Date: 11/22/2011 + Game: Halo and Halo Custom Edition + Version: all +*********************************************************************************/ +#include "WinMain.h" + +BOOL TLOnInitDialog(HWND hDlg, HWND hCtrl, LPARAM init_data); +void TLOnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify); + +void UpdateMapList(HWND hwnd, int SelectedIndex); +void UpdateLocList(HWND hwnd, int MapsSelectedIndex, int LocsSelectedIndex); + +bool EditNoSpaceMask(UINT vKey, bool Control); +bool EditFloatMask(UINT vKey, bool Control); + +bool SuppressKeyPress = false, + locations_changed = false; + +std::vector *Locations; + +BOOL CALLBACK TeleLocDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + BOOL ret_val; + switch (message) + { + case WM_CLOSE: + ret_val = EndDialog(hDlg, 0); + break; + + case WM_INITDIALOG: + HANDLE_WM_INITDIALOG(hDlg, wParam, lParam, TLOnInitDialog); + ret_val = TRUE; + break; + + case WM_COMMAND: + HANDLE_WM_COMMAND(hDlg, wParam, lParam, TLOnCommand); + ret_val = TRUE; + break; + + default: + ret_val = FALSE; + } + + return ret_val; +} + +BOOL TLOnInitDialog(HWND hDlg, HWND hCtrl, LPARAM init_data) +{ + HWND hLocName_txtbx = GetDlgItem(hDlg, IDC_TL_LOCNAME_TXTBX); + Edit_LimitText(hLocName_txtbx, 11); + SetWindowSubclass(hLocName_txtbx, EditMaskProc, IDS_EDIT_MASK, (DWORD_PTR)EditNoSpaceMask); + + HWND hX_txtbx = GetDlgItem(hDlg, IDC_TL_X_TXTBX); + Edit_LimitText(hX_txtbx, 16); + SetWindowSubclass(hX_txtbx, EditMaskProc, IDS_EDIT_MASK, (DWORD_PTR)EditFloatMask); + + HWND hY_txtbx = GetDlgItem(hDlg, IDC_TL_Y_TXTBX); + Edit_LimitText(hY_txtbx, 16); + SetWindowSubclass(hY_txtbx, EditMaskProc, IDS_EDIT_MASK, (DWORD_PTR)EditFloatMask); + + HWND hZ_txtbx = GetDlgItem(hDlg, IDC_TL_Z_TXTBX); + Edit_LimitText(hZ_txtbx, 16); + SetWindowSubclass(hZ_txtbx, EditMaskProc, IDS_EDIT_MASK, (DWORD_PTR)EditFloatMask); + + Locations = (std::vector*)init_data; + + //trigger lstBx_SelectedIndexChanged + //lstbx_maps->SelectedIndex = -1; + HWND hMapList = GetDlgItem(hDlg, IDC_TL_MAPLIST); + HWND hAddBtn = GetDlgItem(hDlg, IDC_TL_ADD_BTN); + HWND hRemoveBtn = GetDlgItem(hDlg, IDC_TL_REMOVE_BTN); + HWND hSetBtn = GetDlgItem(hDlg, IDC_TL_SET_BTN); + if (Locations->size()) + { + for (unsigned int i = 0; i < Locations->size(); i++) + ListBox_AddString(hMapList, (*Locations)[i].map_name); + + ListBox_SetCurSel(hMapList, 0); + + EnableWindow(hAddBtn, TRUE); + EnableWindow(hRemoveBtn, TRUE); + EnableWindow(hSetBtn, TRUE); + UpdateMapList(hDlg, 0); + } + else + { + EnableWindow(hAddBtn, FALSE); + EnableWindow(hRemoveBtn, FALSE); + EnableWindow(hSetBtn, FALSE); + } + + return TRUE; +} + +void TLOnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) +{ + int MapSelectedIndex, LocSelectedIndex; + + switch (codeNotify) + { + case BN_CLICKED: + switch(id) + { + case IDOK: + EndDialog(hwnd, locations_changed); + break; + + case IDC_TL_REMOVE_BTN: + { + HWND hLocList = GetDlgItem(hwnd, IDC_TL_LOCLIST); + LocSelectedIndex = ListBox_GetCurSel(hLocList); + + HWND hMapList = GetDlgItem(hwnd, IDC_TL_MAPLIST); + MapSelectedIndex = ListBox_GetCurSel(hMapList); + if (MapSelectedIndex != LB_ERR) + { + std::vector *tl = &(*Locations)[MapSelectedIndex].teleport_locations; + + tl->erase(tl->begin() + LocSelectedIndex); + ListBox_DeleteString(hLocList, LocSelectedIndex); + + if (!tl->size()) + { + //remove map since theres no more loc's defined + Locations->erase(Locations->begin() + MapSelectedIndex); + ListBox_DeleteString(hMapList, MapSelectedIndex); + + if (Locations->size()) + { + ListBox_SetCurSel(hMapList, 0); + ListBox_SetCurSel(hLocList, 0); + UpdateMapList(hwnd, 0); + } + } + else + { + int index = tl->size() - 1; + ListBox_SetCurSel(hLocList, index); + UpdateLocList(hwnd, MapSelectedIndex, index); + } + + locations_changed = true; + } + break; + } + case IDC_TL_ADD_BTN: + { + MapSelectedIndex = ListBox_GetCurSel(GetDlgItem(hwnd, IDC_TL_MAPLIST)); + if (MapSelectedIndex != LB_ERR) + { + TELEPORT_LOCATION new_loc = { {L'n',L'e',L'w',L'_',L'l',L'o',L'c',L'\0'}, {0,0,0}}; + (*Locations)[MapSelectedIndex].teleport_locations.push_back(new_loc); + + UpdateMapList(hwnd, MapSelectedIndex); + + int selectindex = (*Locations)[MapSelectedIndex].teleport_locations.size() - 1; + + ListBox_SetCurSel(GetDlgItem(hwnd, IDC_TL_LOCLIST), selectindex); + UpdateLocList(hwnd, MapSelectedIndex, selectindex); + + HWND hLocName_txtbx = GetDlgItem(hwnd, IDC_TL_LOCNAME_TXTBX); + SetFocus(hLocName_txtbx); + Edit_SetSel(hLocName_txtbx, 0, Edit_GetTextLength(hLocName_txtbx)); + + locations_changed = true; + } + break; + } + case IDC_TL_SET_BTN: + { + HWND hLocList = GetDlgItem(hwnd, IDC_TL_LOCLIST); + LocSelectedIndex = ListBox_GetCurSel(hLocList); + + MapSelectedIndex = ListBox_GetCurSel(GetDlgItem(hwnd, IDC_TL_MAPLIST)); + if (MapSelectedIndex != LB_ERR && LocSelectedIndex != LB_ERR) + { + HWND hLocName_txtbx = GetDlgItem(hwnd, IDC_TL_LOCNAME_TXTBX); + int locname_txtbx_length = GetWindowTextLengthW(hLocName_txtbx); + GetWindowTextW(hLocName_txtbx, szBuffer, SZ_BUFFER_SIZE); + + wchar_t *locname_text = (wchar_t*)(*Locations)[MapSelectedIndex].teleport_locations[LocSelectedIndex].teleport_loc_name; + + for (int i = 0; i < TELE_LOC_NAME_SIZE; i++) + { + if (i < locname_txtbx_length) + if (szBuffer[i] != L' ') + locname_text[i] = szBuffer[i]; + else + locname_text[i] = L'_'; + else + locname_text[i] = '\0'; + } + + //would be ListBox_EditString + ListBox_DeleteString(hLocList, LocSelectedIndex); + ListBox_InsertString(hLocList, LocSelectedIndex, szBuffer); + ListBox_SetCurSel(hLocList, LocSelectedIndex); + + HWND hX_txtbx = GetDlgItem(hwnd, IDC_TL_X_TXTBX); + GetWindowTextW(hX_txtbx, szBuffer, SZ_BUFFER_SIZE); + + float *LocCoord = (float*)(*Locations)[MapSelectedIndex].teleport_locations[LocSelectedIndex].coordinates; + + float coordinate = 0; + CMDsLib::ParseStrFloat(szBuffer, &coordinate); + LocCoord[0] = coordinate; + + HWND hY_txtbx = GetDlgItem(hwnd, IDC_TL_Y_TXTBX); + GetWindowTextW(hY_txtbx, szBuffer, SZ_BUFFER_SIZE); + + coordinate = 0; + CMDsLib::ParseStrFloat(szBuffer, &coordinate); + LocCoord[1] = coordinate; + + HWND hZ_txtbx = GetDlgItem(hwnd, IDC_TL_Z_TXTBX); + GetWindowTextW(hZ_txtbx, szBuffer, SZ_BUFFER_SIZE); + + coordinate = 0; + CMDsLib::ParseStrFloat(szBuffer, &coordinate); + LocCoord[2] = coordinate; + + locations_changed = true; + } + break; + } + } + break; + + case LBN_SELCHANGE: + switch (id) + { + case IDC_TL_MAPLIST: + UpdateMapList(hwnd, ListBox_GetCurSel(hwndCtl)); + break; + + case IDC_TL_LOCLIST: + UpdateLocList(hwnd, ListBox_GetCurSel(GetDlgItem(hwnd, IDC_TL_MAPLIST)), ListBox_GetCurSel(hwndCtl)); + break; + } + break; + } +} + +void UpdateMapList(HWND hwnd, int SelectedIndex) +{ + if (SelectedIndex != LB_ERR) + { + HWND hLocList = GetDlgItem(hwnd, IDC_TL_LOCLIST); + + ListBox_ResetContent(hLocList); + UINT tl_size = (*Locations)[SelectedIndex].teleport_locations.size(); + std::vector *tl = &(*Locations)[SelectedIndex].teleport_locations; + + for (UINT i = 0; i < tl_size; i++) + ListBox_AddString(hLocList, (*tl)[i].teleport_loc_name); + + //trigger lstBx_SelectedIndexChanged + ListBox_SetCurSel(hLocList, 0); + UpdateLocList(hwnd, SelectedIndex, 0); + } +} + +void UpdateLocList(HWND hwnd, int MapsSelectedIndex, int LocsSelectedIndex) +{ + if (MapsSelectedIndex != LB_ERR && LocsSelectedIndex != LB_ERR) + { + //pointer is faster + TELEPORT_LOCATION *tl = &(*Locations)[MapsSelectedIndex].teleport_locations[LocsSelectedIndex]; + + SetDlgItemText(hwnd, IDC_TL_LOCNAME_TXTBX, tl->teleport_loc_name); + + swprintf_s(szBuffer, SZ_BUFFER_SIZE, L"%f", tl->coordinates[0]); + SetDlgItemText(hwnd, IDC_TL_X_TXTBX, szBuffer); + + swprintf_s(szBuffer, SZ_BUFFER_SIZE, L"%f", tl->coordinates[1]); + SetDlgItemText(hwnd, IDC_TL_Y_TXTBX, szBuffer); + + swprintf_s(szBuffer, SZ_BUFFER_SIZE, L"%f", tl->coordinates[2]); + SetDlgItemText(hwnd, IDC_TL_Z_TXTBX, szBuffer); + } +} + +bool EditNoSpaceMask(UINT vKey, bool Control) +{ + return vKey == VK_SPACE; +} + +bool EditFloatMask(UINT vKey, bool Control) +{ + bool SuppressKey = true; + /* checking the 24th bit + ((vkFlags & 0x1000000) >> == 0x1000000) + 01021AD0 8B 4C 24 08 mov ecx,dword ptr [esp+8] + 011F1AD4 81 E1 00 00 00 01 and ecx,1000000h + 011F1ADA 81 F9 00 00 00 01 cmp ecx,1000000h + 011F1AE0 0F 94 C2 sete dl + + (((BYTE)(vkFlags >> 24)) & 1) //faster by 8 bytes + 01021AD0 8B 4C 24 08 mov ecx,dword ptr [esp+8] + 01021AD4 B0 01 mov al,1 + 01021AD6 C1 E9 18 shr ecx,18h + 01021AD9 22 C8 and cl,al + + .net e->Control KeyEventArgs::KeyData + 00000000 8B 41 04 mov eax,dword ptr [ecx+4] + 00000003 25 00 00 02 00 and eax,20000h + 00000008 3D 00 00 02 00 cmp eax,20000h + 0000000d 0F 94 C0 sete al + 00000010 0F B6 C0 movzx eax,al + 00000013 C3 ret + */ + //bool Control = (((BYTE)(vkFlags >> 17)) & 1); + + if (vKey >= '0' && vKey <= '9' || + vKey >= VK_NUMPAD0 && vKey <= VK_NUMPAD9 || + vKey == VK_OEM_MINUS || + vKey == VK_OEM_PERIOD || + vKey == VK_SUBTRACT || + vKey == VK_DECIMAL || + vKey == VK_BACK || + vKey == VK_DELETE || + Control)//GetAsyncKeyState(VK_CONTROL)) + { + SuppressKey = false; + } + + return SuppressKey; +} + +LRESULT CALLBACK EditMaskProc( + HWND hCtrl, + UINT message, + WPARAM wParam, + LPARAM lParam, + UINT_PTR uIdSubclass, + DWORD_PTR dwRefData) +{ + static bool control_key_down; + + switch (message) + { + case WM_GETDLGCODE: + if (SuppressKeyPress) + { + lParam = NULL; + return 0; + } + break; + + case WM_KEYDOWN: + if (wParam == VK_CONTROL) control_key_down = true; + //if (wParam == VK_SHIFT) ModifierKeys.Control = true; + + if (dwRefData) + { + EditMaskFnType EditMaskFn = (EditMaskFnType)dwRefData; + + if (EditMaskFn((UINT)wParam, control_key_down)) SuppressKeyPress = true; + } + break; + + case WM_KEYUP: + if (wParam == VK_CONTROL) control_key_down = false; + //if (wParam == VK_SHIFT) ModifierKeys.Control = false; + + SuppressKeyPress = false; + break; + + //case WM_SYSKEYDOWN: + // if (wParam == VK_MENU) ModifierKeys.Alt = true; + // break; + + //case WM_SYSKEYUP: + // if (wParam == VK_MENU) ModifierKeys.Alt = false; + // break; + + case WM_NCDESTROY: + RemoveWindowSubclass(hCtrl, EditMaskProc, IDS_EDIT_MASK); + } + return DefSubclassProc(hCtrl, message, wParam, lParam); +} \ No newline at end of file diff --git a/Halo Dev Controls/cmds.cpp b/Halo Dev Controls/cmds.cpp new file mode 100644 index 0000000..38e8c4a --- /dev/null +++ b/Halo Dev Controls/cmds.cpp @@ -0,0 +1,879 @@ +/******************************************************************************** + -- Halo Dev Controls + Copyright © 2011 Jesus7Freak + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +********************************************************************************* + File: cmds.cpp + Project: Halo Dev Controls and HDC + Author: Jesus7Freak + Date: 11/22/2011 + Game: Halo and Halo Custom Edition + Version: all +*********************************************************************************/ +#include "cmds.h" +// Exclude rarely-used stuff from Windows headers +#define WIN32_LEAN_AND_MEAN +#define NOCOMM +#include + +namespace CMDsLib +{ + void WriteSKeysToFile(wchar_t *FileName) + { + HANDLE hFile; + if ((hFile = CreateFileW( + FileName, + GENERIC_WRITE, + FILE_SHARE_WRITE, + NULL, + CREATE_ALWAYS, + FILE_ATTRIBUTE_NORMAL, + NULL)) != INVALID_HANDLE_VALUE) + { + DWORD size_in_bytes = (sizeof(CMD_SCKEYS) * (HALO_CMDS_SIZE + RPGB_CMDS_SIZE)) + + (sizeof(bool) * 2); + + char *buffer = new char[size_in_bytes]; + + char *byte_p_hck = (char*)&halo_cmd_keys; + int hcs = sizeof(CMD_SCKEYS) * HALO_CMDS_SIZE; + DWORD buffer_loc = hcs; + for (int bi = 0; bi < hcs; bi++) + buffer[bi] = byte_p_hck[bi]; + + + char *byte_p_rbck = (char*)&rpg_beta6_2_cmd_keys; + char *byte_p_buffer = &buffer[buffer_loc]; + int rbcs = sizeof(CMD_SCKEYS) * RPGB_CMDS_SIZE; + buffer_loc += rbcs; + for (int bi = 0; bi < rbcs; bi++) + byte_p_buffer[bi] = byte_p_rbck[bi]; + + buffer[buffer_loc++] = (char)halo_commands.Enable_Shrtcts; + buffer[buffer_loc] = (char)rpgbeta6_2_commands.Enable_Shrtcts; + + DWORD written; + if(!WriteFile(hFile, buffer, size_in_bytes, &written, NULL)) + DWORD dosretval = GetLastError(); + + delete[] buffer; + CloseHandle(hFile); + } + } + + void GetSKeysFromFile(wchar_t *FileName) + { + HANDLE hFile; + if ((hFile = CreateFileW( + FileName, + GENERIC_READ, + FILE_SHARE_READ, + NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + NULL)) != INVALID_HANDLE_VALUE) + { + DWORD size_in_bytes = (sizeof(CMD_SCKEYS) * (HALO_CMDS_SIZE + RPGB_CMDS_SIZE)) + + (sizeof(bool) * 2); + + char *buffer = new char[size_in_bytes]; + + DWORD bytes_read; + if (!ReadFile(hFile, buffer, size_in_bytes, &bytes_read, NULL)) + DWORD dosretval = GetLastError(); + + char *byte_p_hck = (char*)&halo_cmd_keys; + int hcs = sizeof(CMD_SCKEYS) * HALO_CMDS_SIZE; + DWORD buffer_loc = hcs; + for (int bi = 0; bi < hcs; bi++) + byte_p_hck[bi] = buffer[bi]; + + char *byte_p_rbck = (char*)&rpg_beta6_2_cmd_keys; + char *byte_p_buffer = &buffer[buffer_loc]; + int rbcs = sizeof(CMD_SCKEYS) * RPGB_CMDS_SIZE; + buffer_loc += rbcs; + for (int bi = 0; bi < rbcs; bi++) + byte_p_rbck[bi] = byte_p_buffer[bi]; + + halo_commands.Enable_Shrtcts = (int)buffer[buffer_loc++]; + rpgbeta6_2_commands.Enable_Shrtcts = (int)buffer[buffer_loc]; + + delete[] buffer; + CloseHandle(hFile); + } + } + + /*requires #include + void WriteSKeysToFile(wchar_t *FileName) + { + std::fstream File; + File.open(FileName, std::ios::out | std::ios::binary); + //save settings changes to file + File.write( + reinterpret_cast(&halo_cmd_keys), + sizeof(CMD_SCKEYS) * HALO_CMDS_SIZE + ); + File.write( + reinterpret_cast(&rpg_beta6_2_cmd_keys), + sizeof(CMD_SCKEYS) * RPGB_CMDS_SIZE + ); + File.write( + reinterpret_cast(&halo_commands.Enable_Shrtcts), + sizeof(bool) + ); + File.write( + reinterpret_cast(&rpgbeta6_2_commands.Enable_Shrtcts), + sizeof(bool) + ); + File.close(); + } + + void GetSKeysFromFile(wchar_t *FileName) + { + std::fstream File; + File.open(FileName, std::ios::in | std::ios::binary); + if (!File.fail()) + { + File.read( + reinterpret_cast(&halo_cmd_keys), + sizeof(CMD_SCKEYS) * HALO_CMDS_SIZE + ); + File.read( + reinterpret_cast(&rpg_beta6_2_cmd_keys), + sizeof(CMD_SCKEYS) * RPGB_CMDS_SIZE + ); + File.read( + reinterpret_cast(&halo_commands.Enable_Shrtcts), + sizeof(bool) + ); + File.read( + reinterpret_cast(&rpgbeta6_2_commands.Enable_Shrtcts), + sizeof(bool) + ); + File.close(); + } + }*/ + + int GetCMDArgCount(wchar_t *cmd_str) + { + //count the number of spaces + int arg_count = 0; bool is_in_parenth = false; + wchar_t wchar; + + do + { + wchar = *cmd_str++; + + if (wchar == L'\"') + is_in_parenth = !is_in_parenth; + + if (wchar == ' ' && !is_in_parenth) + ++arg_count; + + }while (wchar); + + return arg_count; + } + + int FindCMDArgIndex(wchar_t *cmd_str, int num_of_spaces) + { + //count the number of spaces + int str_2arg_index = 0; bool is_in_parenth = false; + for (int spaces_cnt = 0; cmd_str[str_2arg_index] && spaces_cnt < num_of_spaces; str_2arg_index++) + { + if (cmd_str[str_2arg_index] == '\"') + is_in_parenth = !is_in_parenth; + + if (cmd_str[str_2arg_index] == ' ' && !is_in_parenth) + spaces_cnt++; + } + return str_2arg_index; + } + + int ParseStrFloat(wchar_t *str_num, float *num) + { + bool succeded = true, negative = false; int wchar_i = 0; + float _num = 0; int num_of_digits = 0, fp_index = 0; + + //check if its a negative number + if (*str_num == '-') + { + negative = true; + wchar_i++; + fp_index--; + } + + for (;str_num[wchar_i] && str_num[wchar_i] != L' '; wchar_i++) + { + //check if its not a number + if (str_num[wchar_i] < '.' || str_num[wchar_i] > '9') + { + succeded = false; + break; + } + + //check if its a floating point number + if (str_num[wchar_i] == '.') + { + fp_index += wchar_i; + continue; + } + + _num *= 10; + _num += str_num[wchar_i] - 48; + + num_of_digits++; + } + + for (int i = 0; fp_index > 0 && i < num_of_digits - fp_index; i++) + _num /= 10.0f; + + if (negative) + _num = 0 - _num; + + *num = _num; + + if (!succeded) wchar_i = 0; + + return wchar_i; + } + + //returns the characters parsed count + int ParseStrInt(wchar_t *str_num, int *num) + { + bool succeded = true; + bool negative = false; int wchar_i = 0; + int _num = 0; int num_of_digits = 0; + + //check if its a negative number + if (*str_num == '-') + { + negative = true; + wchar_i++; + } + + for (;str_num[wchar_i] && str_num[wchar_i] != L' '; wchar_i++) + { + //check if its not a number + if (str_num[wchar_i] < '0' || str_num[wchar_i] > '9') + { + succeded = false; + break; + } + + _num *= 10; + _num += str_num[wchar_i] - 48; + + num_of_digits++; + } + + if (negative) + _num = 0 - _num; + + *num = _num; + + if (!succeded) wchar_i = 0; + + return wchar_i; + } + + int ParseStrBool(wchar_t *str_bool, int *boolean) + { + int succeded = true; int wchar_i = 0; + + if (!str_bool[1] || str_bool[1] == L' ') + { + wchar_i = ParseStrInt(str_bool, boolean); + } + else + { + char *strue = "true"; + + for (wchar_i = 0; wchar_i <= 4; wchar_i++) + { + if (strue[wchar_i] != (char)str_bool[wchar_i]) + { + succeded = false; + break; + } + } + + if (succeded) *boolean = TRUE; + else + { + succeded = true; + char *sfalse = "false"; + + for (wchar_i = 0; wchar_i <= 5; wchar_i++) + { + if (sfalse[wchar_i] != (char)str_bool[wchar_i]) + { + succeded = false; + break; + } + } + + if (succeded) *boolean = FALSE; + else wchar_i = 0; + } + } + return wchar_i; + } + + CMD_DESCRIPT halo_cmd_descripts[HALO_CMDS_SIZE] = + { + {//0 + L"Command Help", + L"/help ", + L": Displays info on the command specified" + }, //2346578911234567892123456789312345678941234567895123456789612345678971234567898123456789912234 + {//1 + L"List Commands", + L"/list_cmds", + L"Lists all the server commands, to list all of the commands, use / in console, and press tab." + }, + {//2 + L"List Teleport Locs", + L"/list_locs", + L"Lists all the teleport locations for that map." + }, + {//3 + L"Console", + L"/console ", + L": 1 or true = on, 0 or false = off", + L"Enable Console" + }, + {//4 + L"Dev Mode", + L"/dev ", + L": 1 or true = on, 0 or false = off", + L"Enable Developers Mode" + }, + {//5 + L"Deathless",//cheat_deathless_player + L"/deathless ", + L": 1 or true = on, 0 or false = off", + L"Makes the players invulnerable to almost all damage." + }, + {//6 + L"Infinite Ammo",//cheat_infinite_ammo + L"/infammo ", + L": 1 or true = on, 0 or false = off", + L"Gives the players unlimited ammunition." + }, + {//7 + L"Bottomless Clip",//cheat_bottomless_clip + L"/bottomless ", + L": 1 or true = on, 0 or false = off", + L"Players never have to reload, and weapons never overheat." + }, + {//8 + L"Show Hud",//show_hud + L"/hud ", + L": 1 or true = on, 0 or false = off", + L"Turns HUD off/on" + }, + {//9 + L"LetterBox",//cinematic_show_letterbox + L"/letterbox ", + L": 1 or true = on, 0 or false = off", + L"Sets or removes the letterbox bars." + }, + {//10 + L"Rider Ejection",//rider_ejection + L"/ejection ", + L": 1 or true = on, 0 or false = off", + L"Toggles wether the passenger(s) will fall out of vehicle if fliped." + }, + {//11 + L"Omnipotent",//cheat_omnipotent + L"/one_shot ", + L": 1 or true = on, 0 or false = off", + L"Player's shots kills anything they hit." + }, + {//12 + L"Fall Damage",//cheat_jetpack + L"/fall_damage ", + L": 1 or true = on, 0 or false = off", + L"Toggles fall damage." + }, + {//13 + L"Bump Possession",//cheat_bump_possession + L"/possess ", + L": 1 or true = on, 0 or false = off", + L"Allows the player to control any character by bumping into them." + }, + {//14 + L"Super Jump",//cheat_super_jump + L"/super_jump ", + L": 1 or true = on, 0 or false = off", + L"Allows the players to jump very high." + }, + {//16 + L"Medusa",//cheat_medusa + L"/medusa ", + L": 1 or true = on, 0 or false = off", + L"Any enemy unit that sees the player will be instantly killed." + }, + {//15 + L"Reflexive Damage",//cheat_reflexive_damage_effects + L"/reflex_damage ", + L": 1 or true = on, 0 or false = off", + L"Your Direction of Fire Indicator displays when you attack the enemy too." + }, + {//17 + L"Xbox Controller",//cheat_controller + L"/controller ", + L": 1 or true = on, 0 or false = off", + L"Enables Xbox controller to change cheats ingame." + }, + {//18 + L"WireFrame",//rasterizer_wireframe + L"/wireframe ", + L": 1 or true = on, 0 or false = off", + L"Shows the map in wireframe." + }, + {//19 + L"Fog",//rasterizer_fog_atmosphere + L"/fog ", + L": 1 or true = on, 0 or false = off", + L"Turns atmospheric fog on/off." + }, + {//20 + L"FogPlane",//rasterizer_fog_plane + L"/fogplane ", + L": 1 or true = on, 0 or false = off", + L"Turns fog plane on/off." + }, + {//21 + L"FPS",//rasterizer_fps + L"/fps ", + L": 1 or true = on, 0 or false = off", + L"Displays FPS for halo." + }, + {//22 + L"Game Speed", + L"/game_speed ", + L": 0 to 20" + L"game_speed only works in single player.", + }, + {//23 + L"Rapid Fire", + L"/rapid_fire ", + L": 1 or true = on, 0 or false = off", + L"Increases rate of fire." + }, + {//24 + L"Time Freeze", + L"/time_freeze ", + L": 1 or true = on, 0 or false = off" + L"Freezes all objects, except players." + }, + {//25 + L"Gravity Boots", + L"/grav_boots ", + L": 1 or true = on, 0 or false = off", + L"Walking anywere." + }, + {//26 + L"Vehicle No Team", + L"/veh_no_team ", + L": 1 or true = on, 0 or false = off", + L"Vehicle no team restriction \nplayers from different teams can enter \nthe same vehicle." + }, + /*{//27 + L"Exec Console Func", + L"/e ", + L"Executes any console function." + },*/ + {//28 + L"Marines HUD", + L"/mhud ", + L": 0 = off, 1 = on, 2 = on with no static", + L"Sets Marines Recording Vision." + } + }; + + char *halo_cmd_strs[HALO_CMDS_SIZE] = + { + "/help ",//0 + "/list_cmds ",//1 + "/list_locs ",//2 + "/console ",//3 + "/dev ",//4 + "/deathless ",//5 + "/infammo ",//6 + "/bottomless ",//7 + "/hud ",//8 + "/letterbox ",//9 + "/ejection ",//10 + "/one_shot ",//11 + "/fall_damage ",//12 + "/possess ",//13 + "/super_jump ",//14 + "/medusa ",//16 + "/reflex_damage ",//15 + "/controller ",//17 + "/wireframe ",//18 + "/fog ",//19 + "/fogplane ",//20 + "/fps ",//21 + "/game_speed ",//22 + "/rapid_fire ",//23 + "/time_freeze ",//24 + "/grav_boots ",//25 + "/veh_no_team ",//26 + //"/e ",//27 + "/mhud "//28 + }; + + //data that can be written to file + CMD_SCKEYS halo_cmd_keys[HALO_CMDS_SIZE] = + { + {-1, -1, -1},//0 + {-1, -1, -1},//1 + {-1, -1, -1},//2 + {0, 0, 0},//3 + {0, 33, 34},//4 + {97, 0, 0},//5 + {98, 0, 0},//6 + {0, 0, 0},//7 + {99, 0, 0},//8 + {100, 0, 0},//9 + {0, 0, 0},//10 + {0, 0, 0},//11 + {0, 0, 0},//12 + {0, 0, 0},//13 + {0, 0, 0},//14 + {0, 0, 0},//15 + {0, 0, 0},//16 + {0, 0, 0},//17 + {0, 0, 0},//18 + {0, 0, 0},//19 + {0, 0, 0},//20 + {0, 0, 0},//21 + {-1, -1, -1},//22 + {111, 0, 0},//23 + {106, 0, 0},//24 + {109, 0, 0},//25 + {0, 0, 0},//26 + //{-1, -1, -1},//27 + {101, 0, 0}//28 + }; + + + CMD_DESCRIPT rpg_beta6_2_cmd_descripts[RPGB_CMDS_SIZE] = + { + {//0 + L"Setting - Day",//set setting 0 + L"/day", + L"This will change the environment of the map." + }, + {//1 + L"Setting - Rain",//set setting 1 + L"/rain", + L"This will change the environment of the map." + }, + {//2 + L"Setting - Night",//set setting 2 + L"/night", + L"This will change the environment of the map." + }, + {//3 + L"Air Base Alarm",//device_set_position alarm_control_1 1 + L"/alarm ", + L": 1 or true = on, 0 or false = off", + L"This will toggle Red Alert on or off." + }, + {//4 + L"Air Base LockDown",//device_set_position lock_control 1 + L"/lockdown", + L"This will activate Lockdown mode." + }, + {//5 + L"Fire Halo",//device_set_position boom_control 1 + L"/fire_halo", + L"This will initiate Halo's activation." + }, + {//6 + L"LockDown Timer",//lock_timer (* 30 [# of seconds]) + L"/lockdown_timer ", + L": 0 to 999 seconds", + L"This will change the amount of time that the doors stay closed while Lockdown is activated." + }, + {//7 + L"Fire Halo Timer",//boom_timer (* 30 [# of seconds]) + L"/halo_timer ", + L": 0 to 999 seconds", + L"This will change the minimum delay between firings of Halo." + } + }; + + char *rpg_beta6_2_cmd_strs[RPGB_CMDS_SIZE] = + { + "/day ",//0 + "/rain ",//1 + "/night ",//2 + "/alarm ",//3 + "/lockdown ",//4 + "/fire_halo ",//5 + "/lockdown_timer ",//6 + "/halo_timer "//7 + }; + + CMD_SCKEYS rpg_beta6_2_cmd_keys[RPGB_CMDS_SIZE] = + { + {102, -1, -1},//0 + {-1, -1, -1},//1 + {-1, -1, -1},//2 + {103, 0, 0},//3 + {104, -1, -1},//4 + {105, -1, -1},//5 + {-1, -1, -1},//6 + {-1, -1, -1}//7 + }; + + CMD_DESCRIPT player_cmd_descripts[PLAYER_CMDS_SIZE] = + { + {//0 + L"Speed", + L"/spd [pExpression] ", + L": 0 to 999", + L"Adjusts players speed." + }, + {//1 + L"Active Camo",//cheat_active_camouflage + L"/camo [pExpression] ", + L": camo duration in seconds", + L"Gives player active camo." + }, + {//2 + L"Suspend",//unit_suspended + L"/suspend [pExpression] ", + L": 1 or true = on, 0 or false = off", + L"Suspends player." + }, + {//3 + L"Teleport", + L"/t [pExpression] [Coordinates]", + L"[Coordinates]: x, y, z or player or location_name", + L"Teleport player to x y z coordinates \nor to a defined location." + }, + {//5 + L"Jump Teleport", + L"/j [pExpression] ", + L"x, y, z", + L"Teleport player to current position, \ncoordinates with offset." + }, + {//6 + L"Velocity", + L"/v [pExpression] ", + L"x, y, z", + L"Changes the players velocity." + }, + {//7 + L"Ammo", + L"/ammo [pExpression] ", + L": 0 to 999", + L"Adjusts player ammo." + }, + {//8 + L"Battery", + L"/bat [pExpression] ", + L": 0 to 999", + L"Adjusts player battery." + }, + {//9 + L"Health",//unit_set_maximum_vitality unit_set_current_vitality + L"/health [pExpression] ", + L": % non-negative", + L"Adjusts player health, percent of health." + }, + {//10 + L"Shield",//unit_set_maximum_vitality unit_set_current_vitality + L"/shield [pExpression] ", + L": % non-negative", + L"Adjusts player shieldws, percent of shields." + }, + {//11 + L"AFK", + L"/afk [pExpression]", + L"Player doesn't respawn in afk mode, \nwhen used while dead, disables afk mode." + }, + {//12 + L"Team Change",//change_team + L"/team [pExpression]", + L"Changes player to other team." + }, + {//13 + L"Kick",//sv_kick + L"/k [pExpression]", + L"Kicks player from server." + }, + {//14 + L"Ban",//sv_ban + L"/b [pExpression]", + L"Bans player from server." + }, + {//15 + L"Kill",//unit_kill + L"/kill [pExpression]", + L"Kills a player." + }, + {//16 + L"Eject",//unit_exit_vehicle + L"/eject [pExpression]", + L"Ejects a player from a vehicle" + }, + {//17 + L"Flip Vehicle", + L"/flip [pExpression]", + L"Flips a vehicle 180°, up-right or down" + }, + {//18 + L"Admin", + L"/a [pExpression] ", + L": non-negative, \ndefault clients admin level = 0", + L"Gives player temporary admin level." + }, + {//19 + L"Set Teleport Loc", + L"/st [pExpression] ", + L": no spaces in location name", + L"Defines a teleport location at player's coordinates." + }, + { + L"Spawn Biped", + L"/biped [pExpression] ", + L": amount of bipeds to spawn" + L"Spawns bipeds near a player." + }, + {//20 + L"Spawn Hog",//cheat_spawn_warthog + L"/hog [pExpression]", + L"Spawn a hog near a player." + }, + {//21 + L"Spawn All Vehicles",//cheat_all_vehicles + L"/vehs [pExpression]", + L"Spawns all vehicles near a player." + }, + {//22 + L"Spawn All Weapons",//cheat_all_weapons + L"/weps [pExpression]", + L"Spawns all weapons near a player." + }, + {//23 + L"Spawn All PowerUps",//cheat_all_powerups + L"/powerups [pExpression]", + L"Spawns all powerups near a player." + }, + {//24 + L"Copy Vehicle",//object_create + L"/copy_veh [from pExpression] [to pExpression]", + L"Copys the player's vehicle and spawns it near a player." + }, + {//25 + L"Copy Weapon",//object_create + L"/copy_wep [from pExpression] [to pExpression]", + L"Copys the player's weapon and spawns it near a player." + }, + {//26 + L"Destroy Objects Mode",//object_destroy + L"/dest_objs_mode ", + L"Destroys any object the player shoots at." + }, + {//27 + L"Destroy Weapon",//object_destroy + L"/dest_wep [pExpression]", + L"Destroys the player's weapon, including vehicle weapons." + }, + {//28 + L"Say",//sv_say + L"/say [pExpression] ", + L"Sends a meesage to a specific player." + }, + {//29 + L"Object Scale",//object_set_scale + L"/scale [pExpression] ", + L"Changes a player's object scale." + } + }; + + char *player_cmd_strs[PLAYER_CMDS_SIZE] = + { + "/spd ",//0 + "/camo ",//1 + "/suspend ",//2 + "/t ",//3 + "/j ",//5 + "/v ",//6 + "/ammo ",//7 + "/bat ",//8 + "/health ",//9 + "/shield ",//10 + "/afk ",//11 + "/team ",//12 + "/k ",//13 + "/b ",//14 + "/kill ",//15 + "/eject ",//16 + "/flip ",//17 + "/a ",//18 + "/st ",//19 + "/biped ", + "/hog ",//20 + "/vehs ",//21 + "/weps ",//22 + "/powerups ",//23 + "/copy_veh ",//24 + "/copy_wep ",//25 + "/dest_objs_mode ",//26 + "/dest_wep ",//27 + "/say ",//28 + "/scale "//29 + }; + + COMMANDS halo_commands = + { + L"Dev ", HALO_CMDS_SIZE, 1, + reinterpret_cast(&halo_cmd_descripts), + reinterpret_cast(&halo_cmd_strs), + reinterpret_cast(&halo_cmd_keys) + }; + + COMMANDS rpgbeta6_2_commands = + { + L"RPG_Beta6_2", RPGB_CMDS_SIZE, 1, + reinterpret_cast(&rpg_beta6_2_cmd_descripts), + reinterpret_cast(&rpg_beta6_2_cmd_strs), + reinterpret_cast(&rpg_beta6_2_cmd_keys) + }; + + COMMANDS player_commands = + { + L"Player ", PLAYER_CMDS_SIZE, -1, + reinterpret_cast(&player_cmd_descripts), + reinterpret_cast(&player_cmd_strs), + NULL + }; + + COMMANDS *all_commands[CMD_SET_SIZE] = + { + &player_commands,//these are used most + &halo_commands, + &rpgbeta6_2_commands + }; +} \ No newline at end of file diff --git a/Halo Dev Controls/cmds.h b/Halo Dev Controls/cmds.h new file mode 100644 index 0000000..31957d5 --- /dev/null +++ b/Halo Dev Controls/cmds.h @@ -0,0 +1,89 @@ +/******************************************************************************** + -- Halo Dev Controls + Copyright © 2011 Jesus7Freak + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +********************************************************************************* + File: cmds.h + Project: Halo Dev Controls and HDC + Author: Jesus7Freak + Date: 11/22/2011 + Game: Halo and Halo Custom Edition + Version: all +*********************************************************************************/ +#pragma once + +#define CMD_STR_SIZE 36 + +#define CMD_SET_SIZE 3 + +#define HALO_CMDS_SIZE 28 +#define RPGB_CMDS_SIZE 8 +#define PLAYER_CMDS_SIZE 30 + +namespace CMDsLib +{ + //for chat commands window + struct CMD_DESCRIPT + { + wchar_t *cmd_title;//[20]; + wchar_t *cmd_header; + wchar_t *cmd_usage;//[60]; //max 94 + wchar_t *cmd_descript;//[60]; //max 94 + }; + + //written/read from file and to dll + struct CMD_SCKEYS + { + short toggle_key; + short on_key; + short off_key; + }; + + struct COMMANDS + { + wchar_t *cmds_group_name; + int size; + int Enable_Shrtcts; + CMD_DESCRIPT *cmd_descripts; + char **cmd_strs; + CMD_SCKEYS *cmd_keys; + }; + + void GetSKeysFromFile(wchar_t *FileName); + void WriteSKeysToFile(wchar_t *FileName); + + int GetCMDArgCount(wchar_t *cmd_str); + int FindCMDArgIndex(wchar_t *cmd_str, int num_of_spaces); + int ParseStrFloat(wchar_t *str_num, float *num); + int ParseStrInt(wchar_t *str_num, int *num); + int ParseStrBool(wchar_t *str_bool, int *boolean); + + extern CMD_DESCRIPT halo_cmd_descripts[HALO_CMDS_SIZE]; + extern char *halo_cmd_strs[HALO_CMDS_SIZE]; + extern CMD_SCKEYS halo_cmd_keys[HALO_CMDS_SIZE]; + + extern CMD_DESCRIPT rpg_beta6_2_cmd_descripts[RPGB_CMDS_SIZE]; + extern char *rpg_beta6_2_cmd_strs[RPGB_CMDS_SIZE]; + extern CMD_SCKEYS rpg_beta6_2_cmd_keys[RPGB_CMDS_SIZE]; + + extern CMD_DESCRIPT player_cmd_descripts[PLAYER_CMDS_SIZE]; + extern char *player_cmd_strs[PLAYER_CMDS_SIZE]; + + extern COMMANDS halo_commands; + extern COMMANDS rpgbeta6_2_commands; + extern COMMANDS player_commands; + + extern COMMANDS *all_commands[CMD_SET_SIZE]; +} \ No newline at end of file diff --git a/Halo Dev Controls/green-eye.bmp b/Halo Dev Controls/green-eye.bmp new file mode 100644 index 0000000..d6d60fc Binary files /dev/null and b/Halo Dev Controls/green-eye.bmp differ diff --git a/Halo Dev Controls/hdc_rpg_logo_bg.bmp b/Halo Dev Controls/hdc_rpg_logo_bg.bmp new file mode 100644 index 0000000..db3cffc Binary files /dev/null and b/Halo Dev Controls/hdc_rpg_logo_bg.bmp differ diff --git a/Halo Dev Controls/tele_loc_resources.cpp b/Halo Dev Controls/tele_loc_resources.cpp new file mode 100644 index 0000000..c843659 --- /dev/null +++ b/Halo Dev Controls/tele_loc_resources.cpp @@ -0,0 +1,274 @@ +/******************************************************************************** + -- Halo Dev Controls + Copyright © 2011 Jesus7Freak + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +********************************************************************************* + File: win_tele_resources.cpp + Project: Halo Dev Controls and HDC + Author: Jesus7Freak + Date: 11/22/2011 + Game: Halo and Halo Custom Edition + Version: all +*********************************************************************************/ +#include "tele_loc_resources.h" +// Exclude rarely-used stuff from Windows headers +#define WIN32_LEAN_AND_MEAN +#define NOCOMM +#include + +/* + locations.bin layout: + + DWORD num_of_maps + wchar_t 1stmap_name[MAP_STR_SIZE] + DWORD num_of_locations + TELEPORT_LOCATION loc_site; + wchar_t 2ndmap_name[MAP_STR_SIZE] + DWORD num_of_locations + TELEPORT_LOCATION loc_site; + . + . + . +*/ +void WriteLocationsToFile(wchar_t *FileName, std::vector* locations) +{ + DWORD size_in_bytes = locations->size(); + if (size_in_bytes) + { + HANDLE hFile; + if ((hFile = CreateFileW( + FileName, + GENERIC_WRITE, + FILE_SHARE_WRITE, + NULL, + CREATE_ALWAYS, + FILE_ATTRIBUTE_NORMAL, + NULL)) != INVALID_HANDLE_VALUE) + { + DWORD num_of_maps = size_in_bytes; + size_in_bytes *= (MAP_STR_SIZE * sizeof(wchar_t)); + size_in_bytes += sizeof(DWORD);//num of maps + + for (DWORD i = 0; i < num_of_maps; i++) + size_in_bytes += ((*locations)[i].teleport_locations.size() * + sizeof(TELEPORT_LOCATION)) + sizeof(DWORD); + + char *buffer = new char[size_in_bytes]; + + *(DWORD*)buffer = num_of_maps; + DWORD buffer_loc = sizeof(DWORD); + + for (DWORD i = 0; i < num_of_maps; i++) + { + wchar_t *buffer_map_wstr = (wchar_t*)&buffer[buffer_loc]; + wchar_t *mn_str = (*locations)[i].map_name; + for (wchar_t wc_i = 0; wc_i < MAP_STR_SIZE; wc_i++) + buffer_map_wstr[wc_i] = mn_str[wc_i]; + + buffer_loc += sizeof(wchar_t) * MAP_STR_SIZE; + + DWORD num_of_locations = (*locations)[i].teleport_locations.size(); + *(DWORD*)&buffer[buffer_loc] = num_of_locations; + buffer_loc += sizeof(DWORD); + + for (DWORD j = 0; j < num_of_locations; j++) + { + char *byte_p_ts = (char*)&(*locations)[i].teleport_locations[j]; + char *byte_p_buffer = (char*)&buffer[buffer_loc]; + for (int bi = 0; bi < sizeof(TELEPORT_LOCATION); bi++) + byte_p_buffer[bi] = byte_p_ts[bi]; + + buffer_loc += sizeof(TELEPORT_LOCATION); + } + } + + DWORD written; + if(!WriteFile(hFile, buffer, size_in_bytes, &written, NULL)) + DWORD dosretval = GetLastError(); + + delete[] buffer; + CloseHandle(hFile); + } + } +} + +void GetLocationsFromFile(wchar_t *FileName, std::vector* locations) +{ + HANDLE hFile; + if ((hFile = CreateFileW( + FileName, + GENERIC_READ, + FILE_SHARE_READ, + NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + NULL)) != INVALID_HANDLE_VALUE) + { + LARGE_INTEGER size = {0}; + GetFileSizeEx(hFile, &size); + char *buffer = new char[size.LowPart]; + + DWORD bytes_read; + if (!ReadFile(hFile, buffer, size.LowPart, &bytes_read, NULL)) + DWORD dosretval = GetLastError(); + + DWORD num_of_maps = *(DWORD*)buffer; + DWORD buffer_loc = sizeof(DWORD); + + MAPS map_site; TELEPORT_LOCATION tele_site; + for (DWORD i = 0; i < num_of_maps; i++) + { + wchar_t *buffer_map_wstr = (wchar_t*)&buffer[buffer_loc]; + wchar_t *mn_str = map_site.map_name; + for (wchar_t wc_i = 0; wc_i < MAP_STR_SIZE; wc_i++) + mn_str[wc_i] = buffer_map_wstr[wc_i]; + + buffer_loc += sizeof(wchar_t) * MAP_STR_SIZE; + + DWORD num_of_locations = (DWORD)buffer[buffer_loc]; + buffer_loc += sizeof(DWORD); + + for (DWORD j = 0; j < num_of_locations; j++) + { + char *byte_p_ts = (char*)&tele_site; + char *byte_p_buffer = (char*)&buffer[buffer_loc]; + for (int bi = 0; bi < sizeof(TELEPORT_LOCATION); bi++) + byte_p_ts[bi] = byte_p_buffer[bi]; + + buffer_loc += sizeof(TELEPORT_LOCATION); + + map_site.teleport_locations.push_back(tele_site); + } + + locations->push_back(map_site); + map_site.teleport_locations.clear(); + } + + delete[] buffer; + CloseHandle(hFile); + } +} + +//requires #include +/*void WriteLocationsToFile(wchar_t *FileName, std::vector* locations) +{ + if (locations->size()) + { + //System::String^ sFileName = gcnew System::String(LocationsFileName); + unsigned int num_of_maps = locations->size(), num_of_locations = 0; + + //unhide file to make changes + //if (System::IO::File::Exists(sFileName)) + // System::IO::File::SetAttributes(sFileName, System::IO::File::GetAttributes(sFileName) & ~System::IO::FileAttributes::Hidden); + + std::fstream File;//(FileName, std::ios::out | std::ios::binary); + File.open(FileName, std::ios::out | std::ios::binary); + //save settings changes to file + File.write(reinterpret_cast(&num_of_maps), sizeof(unsigned int)); + + for (unsigned int i = 0; i < num_of_maps; i++) + { + File.write(reinterpret_cast(&(*locations)[i].map_name), sizeof(wchar_t) * MAP_STR_SIZE); + + num_of_locations = (*locations)[i].teleport_locations.size(); + File.write(reinterpret_cast(&num_of_locations), sizeof(unsigned int)); + for (unsigned int j = 0; j < num_of_locations; j++) + File.write(reinterpret_cast(&(*locations)[i].teleport_locations[j]), sizeof(TELEPORT_LOCATION)); + } + + File.close(); + + //hide file + //System::IO::File::SetAttributes(sFileName, System::IO::File::GetAttributes(sFileName) | System::IO::FileAttributes::Hidden); + //delete sFileName; + } +} + +void GetLocationsFromFile(wchar_t *FileName, std::vector* locations) +{ + MAPS map_site; TELEPORT_LOCATION tele_site = {0}; + unsigned int num_of_maps = 0, num_of_locations = 0; + + std::fstream File;//(FileName, std::ios::in | std::ios::binary); + File.open(FileName, std::ios::in | std::ios::binary); + if (!File.fail()) + { + File.read(reinterpret_cast(&num_of_maps), sizeof(unsigned int)); + + for (unsigned int i = 0; i < num_of_maps; i++) + { + File.read(reinterpret_cast(&map_site.map_name), sizeof(wchar_t) * MAP_STR_SIZE); + + File.read(reinterpret_cast(&num_of_locations), sizeof(unsigned int)); + for (unsigned int j = 0; j < num_of_locations; j++) + { + File.read(reinterpret_cast(&tele_site), sizeof(TELEPORT_LOCATION)); + map_site.teleport_locations.push_back(tele_site); + } + + locations->push_back(map_site); + map_site.teleport_locations.clear(); + } + File.close(); + } +}*/ + +bool FindMapIndex(std::vector* map_sites, char* map_name, unsigned int &map_index) +{ + bool map_found = false; + + unsigned int size = map_sites->size(); + for (unsigned int map_i = 0; map_i < size && !map_found; map_i++) + { + wchar_t *str = (wchar_t*)((*map_sites)[map_i].map_name); + for (int j = 0; j <= 22; j++) + { + if (map_name[j] != (char)(str[j]))//there shouldn't be any unicode characters anyways + break; + + if (j == 22 || map_name[j] == 0 && (*map_sites)[map_i].map_name[j] == 0) + { + map_found = true; + map_index = map_i; + break; + } + } + } + return map_found; +} + +bool FindTeleLocNameIndex(std::vector* tele_sites, wchar_t* TeleLocName_name, unsigned int &TeleLocName_index) +{ + bool tele_loc_found = false; + + unsigned int size = tele_sites->size(); + for (unsigned int tele_i = 0; tele_i < size && !tele_loc_found; tele_i++) + { + wchar_t *str = (wchar_t*)((*tele_sites)[tele_i].teleport_loc_name); + for (int j = 0; j <= 22; j++) + { + if (TeleLocName_name[j] != str[j]) + break; + + if (j == 22 || TeleLocName_name[j] == 0 && (*tele_sites)[tele_i].teleport_loc_name[j] == 0) + { + tele_loc_found = true; + TeleLocName_index = tele_i; + break; + } + } + } + return tele_loc_found; +} \ No newline at end of file diff --git a/Halo Dev Controls/tele_loc_resources.h b/Halo Dev Controls/tele_loc_resources.h new file mode 100644 index 0000000..c141357 --- /dev/null +++ b/Halo Dev Controls/tele_loc_resources.h @@ -0,0 +1,46 @@ +/******************************************************************************** + -- Halo Dev Controls + Copyright © 2011 Jesus7Freak + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +********************************************************************************* + File: tele_loc_resources.h + Project: Halo Dev Controls and HDC + Author: Jesus7Freak + Date: 11/22/2011 + Game: Halo and Halo Custom Edition + Version: all +*********************************************************************************/ +#pragma once +#include + +#define MAP_STR_SIZE 24 +#define TELE_LOC_NAME_SIZE 12 + +struct TELEPORT_LOCATION +{ + wchar_t teleport_loc_name[TELE_LOC_NAME_SIZE]; + float coordinates[3]; +}; + +struct MAPS +{ + wchar_t map_name[MAP_STR_SIZE]; + std::vector teleport_locations; +}; + +void WriteLocationsToFile(wchar_t *FileName, std::vector* locations); +void GetLocationsFromFile(wchar_t *FileName, std::vector* locations); +bool FindMapIndex(std::vector* map_sites, char* map_name, unsigned int &map_index); +bool FindTeleLocNameIndex(std::vector* tele_sites, wchar_t* TeleLocName_name, unsigned int &TeleLocName_index); \ No newline at end of file diff --git a/halo notes/active_camo.asm b/halo notes/active_camo.asm new file mode 100644 index 0000000..1823f3e --- /dev/null +++ b/halo notes/active_camo.asm @@ -0,0 +1,237 @@ +;notes by Jesus7Freak +;haloce.1.09 player 0 +;camo on +0047CB62 - 83 88 04020000 10 - or dword ptr [eax+00000204],10 + +;camo off +0047CB0D - 83 A0 04020000 EF - and dword ptr [eax+00000204],EF + +0047C7C4 8B6C24 14 MOV EBP,DWORD PTR SS:[ESP+14] +0047C7C8 8B5C24 14 MOV EBX,DWORD PTR SS:[ESP+14] ;->EC700000 +0047C7CC 50 PUSH EAX ;00000546 short +0047C7CD 55 PUSH EBP ;00000000 short +0047C7CE E8 6D010000 CALL haloce.0047C940 +-> +0047C940 83FB FF CMP EBX,-1 +0047C943 55 PUSH EBP +0047C944 8B6C24 08 MOV EBP,DWORD PTR SS:[ESP+8] ;EBP=0 (1st param) +0047C948 56 PUSH ESI +0047C949 57 PUSH EDI +0047C94A 0F84 E9000000 JE haloce.0047CA39 +0047C950 8BCB MOV ECX,EBX ;->EC700000 +0047C952 C1F9 10 SAR ECX,10 ;->ECX=FFFFEC70 +0047C955 66:85DB TEST BX,BX ;0000 > -1 +0047C958 0F8C DB000000 JL haloce.0047CA39 +0047C95E A1 C0558100 MOV EAX,DWORD PTR DS:[8155C0] ;"players" +0047C963 66:3B58 20 CMP BX,WORD PTR DS:[EAX+20] ;max players =16 0000 < 16 +0047C967 0F8D CC000000 JGE haloce.0047CA39 +0047C96D 0FBF70 22 MOVSX ESI,WORD PTR DS:[EAX+22] ;->ESI=00000200 static player size +0047C971 8B78 34 MOV EDI,DWORD PTR DS:[EAX+34] ;->EDI=402AAFCC ptr to first static player +0047C974 0FBFD3 MOVSX EDX,BX ;static player index ->EDX=00000000 +0047C977 0FAFF2 IMUL ESI,EDX ;static player offset->ESI=00000000 +0047C97A 66:8B043E MOV AX,WORD PTR DS:[ESI+EDI] ;player ID->AX=EC70 +0047C97E 03F7 ADD ESI,EDI ;static player->ESI=402AAFCC +0047C980 66:85C0 TEST AX,AX ;valid ID? +0047C983 0F84 B0000000 JE haloce.0047CA39 +0047C989 66:85C9 TEST CX,CX ;valid ID? +0047C98C 74 09 JE SHORT haloce.0047C997 +0047C98E 66:3BC1 CMP AX,CX ;ID match? +0047C991 0F85 A2000000 JNZ haloce.0047CA39 +0047C997 66:85ED TEST BP,BP ;first param 0 check +0047C99A 0F8C 99000000 JL haloce.0047CA39 +0047C9A0 66:83FD 02 CMP BP,2 +0047C9A4 0F8D 8F000000 JGE haloce.0047CA39 +0047C9AA 66:85ED TEST BP,BP +0047C9AD 75 1A JNZ SHORT haloce.0047C9C9 +0047C9AF 8B4E 34 MOV ECX,DWORD PTR DS:[ESI+34] ;player biped obj tag->ECX=E2CD005E +;get valid player biped obj +0047C9B2 6A 03 PUSH 3 +0047C9B4 E8 97E10700 CALL haloce.004FAB50 +-> + 004FAB50 57 PUSH EDI + 004FAB51 33FF XOR EDI,EDI + 004FAB53 83F9 FF CMP ECX,-1 ;valid obj tag? + 004FAB56 74 39 JE SHORT haloce.004FAB91 + 004FAB58 56 PUSH ESI + 004FAB59 8BF1 MOV ESI,ECX ;->ESI=E2CD005E + 004FAB5B C1FE 10 SAR ESI,10 ;->ESI=FFFFE2CD + 004FAB5E 66:85C9 TEST CX,CX ;valid index? + 004FAB61 7C 2D JL SHORT haloce.004FAB90 + 004FAB63 8B15 B0B37F00 MOV EDX,DWORD PTR DS:[7FB3B0] ;"object" ->EDX=400506B4 + 004FAB69 66:3B4A 20 CMP CX,WORD PTR DS:[EDX+20] ;index within range? 005E < 0800 + 004FAB6D 7D 21 JGE SHORT haloce.004FAB90 + 004FAB6F 0FBF42 22 MOVSX EAX,WORD PTR DS:[EDX+22] ;obj table size->EAX=0000000C + 004FAB73 0FBFC9 MOVSX ECX,CX + 004FAB76 0FAFC1 IMUL EAX,ECX ;obj table offset->EAX=00000468 + 004FAB79 0342 34 ADD EAX,DWORD PTR DS:[EDX+34] ;obj table->EAX=40050B54 + 004FAB7C 66:8B08 MOV CX,WORD PTR DS:[EAX] ;obj ID->CX=E2CD + 004FAB7F 66:85C9 TEST CX,CX ;valid id? + 004FAB82 74 0C JE SHORT haloce.004FAB90 + 004FAB84 66:85F6 TEST SI,SI ;valid id? + 004FAB87 74 05 JE SHORT haloce.004FAB8E + 004FAB89 66:3BCE CMP CX,SI ;id match? + 004FAB8C 75 02 JNZ SHORT haloce.004FAB90 + 004FAB8E 8BF8 MOV EDI,EAX ;->EDI=40050B54 + 004FAB90 5E POP ESI + 004FAB91 33C0 XOR EAX,EAX + 004FAB93 85FF TEST EDI,EDI ;valid address != NULL + 004FAB95 74 13 JE SHORT haloce.004FABAA + 004FAB97 8A4F 03 MOV CL,BYTE PTR DS:[EDI+3] ;ObjectType? ->CL=00 + 004FAB9A BA 01000000 MOV EDX,1 + 004FAB9F D3E2 SHL EDX,CL ;->EDX=00000001 + 004FABA1 855424 08 TEST DWORD PTR SS:[ESP+8],EDX ;test against first param, 3 == 1? + 004FABA5 74 03 JE SHORT haloce.004FABAA + 004FABA7 8B47 08 MOV EAX,DWORD PTR DS:[EDI+8] ;object address->EAX=4006B45C + 004FABAA 5F POP EDI + 004FABAB C3 RETN +<- +0047C9B9 83C4 04 ADD ESP,4 +0047C9BC 85C0 TEST EAX,EAX ;valid address? +0047C9BE 74 79 JE SHORT haloce.0047CA39 +0047C9C0 F680 04020000 10 TEST BYTE PTR DS:[EAX+204],10 ; 41h == 10? +0047C9C7 75 70 JNZ SHORT haloce.0047CA39 +0047C9C9 0FBFC5 MOVSX EAX,BP ;first param->EAX=0 +0047C9CC 66:837C46 68 00 CMP WORD PTR DS:[ESI+EAX*2+68],0 ;static player.unknown DS:[402AB034]=0000 +0047C9D2 8D7C46 68 LEA EDI,DWORD PTR DS:[ESI+EAX*2+68] ;->EDI=402AB034 +0047C9D6 75 0A JNZ SHORT haloce.0047C9E2 +0047C9D8 55 PUSH EBP +0047C9D9 8BC3 MOV EAX,EBX ;static player tag->EAX=EC700000 +0047C9DB E8 50010000 CALL haloce.0047CB30 ;give players biped camo +-> + 0047CB30 8B0D C0558100 MOV ECX,DWORD PTR DS:[8155C0] + 0047CB36 8B51 34 MOV EDX,DWORD PTR DS:[ECX+34] + 0047CB39 8B0D B0B37F00 MOV ECX,DWORD PTR DS:[7FB3B0] + 0047CB3F 25 FFFF0000 AND EAX,0FFFF + 0047CB44 C1E0 09 SHL EAX,9 + 0047CB47 8B4410 34 MOV EAX,DWORD PTR DS:[EAX+EDX+34] + 0047CB4B 8B51 34 MOV EDX,DWORD PTR DS:[ECX+34] + 0047CB4E 25 FFFF0000 AND EAX,0FFFF + 0047CB53 66:837C24 04 00 CMP WORD PTR SS:[ESP+4],0 + 0047CB59 8D0440 LEA EAX,DWORD PTR DS:[EAX+EAX*2] + 0047CB5C 8B4482 08 MOV EAX,DWORD PTR DS:[EDX+EAX*4+8] + 0047CB60 75 10 JNZ SHORT haloce.0047CB72 + 0047CB62 8388 04020000 10 OR DWORD PTR DS:[EAX+204],10 ;Biped::IsInvisible + 0047CB69 66:C780 22040000 0000 MOV WORD PTR DS:[EAX+422],0 + 0047CB72 C3 RETN +<- +0047C9E0 EB 11 JMP SHORT haloce.0047C9F3 +;0047C9E2 A1 44CD6800 MOV EAX,DWORD PTR DS:[68CD44] +;0047C9E7 85C0 TEST EAX,EAX +;0047C9E9 75 0B JNZ SHORT haloce.0047C9F6 +;0047C9EB 55 PUSH EBP +;0047C9EC 8BC3 MOV EAX,EBX +;0047C9EE E8 8D010000 CALL haloce.0047CB80 +0047C9F3 83C4 04 ADD ESP,4 +0047C9F6 8B4424 14 MOV EAX,DWORD PTR SS:[ESP+14] ;2nd param time->EAX=00000546 +0047C9FA 66:0107 ADD WORD PTR DS:[EDI],AX ;store time in static player +0047C9FD 66:833D D0476B00 0200 CMP WORD PTR DS:[6B47D0],2 ;checks something 2 == 2? +0047CA05 75 2C JNZ SHORT haloce.0047CA33 +0047CA07 8B76 34 MOV ESI,DWORD PTR DS:[ESI+34] ;player biped obj tag->ESI=E2CD005E +0047CA0A 8B15 B0B37F00 MOV EDX,DWORD PTR DS:[7FB3B0] ;"object" +0047CA10 8B52 34 MOV EDX,DWORD PTR DS:[EDX+34] +0047CA13 81E6 FFFF0000 AND ESI,0FFFF +0047CA19 8D0C76 LEA ECX,DWORD PTR DS:[ESI+ESI*2] +0047CA1C 8B4C8A 08 MOV ECX,DWORD PTR DS:[EDX+ECX*4+8] ;player biped obj->4006B45C +0047CA20 8B51 04 MOV EDX,DWORD PTR DS:[ECX+4] ;biped obj.unknown->EDX=00000000 +0047CA23 85D2 TEST EDX,EDX +0047CA25 75 0C JNZ SHORT haloce.0047CA33 +;server sync +0047CA27 50 PUSH EAX ;on: 00000546 +0047CA28 55 PUSH EBP ;00000000 +0047CA29 8BCB MOV ECX,EBX ;EC700000 +0047CA2B E8 10FEFFFF CALL haloce.0047C840 +-> + 0047C840 83EC 08 SUB ESP,8 + 0047C843 33C0 XOR EAX,EAX + 0047C845 83F9 FF CMP ECX,-1 + 0047C848 74 17 JE SHORT haloce.0047C861 + 0047C84A 56 PUSH ESI + 0047C84B 8B35 182B6200 MOV ESI,DWORD PTR DS:[622B18] ; ->ESI=haloce.00622A90 + 0047C851 83C6 0C ADD ESI,0C ;->ESI=00622A9C + 0047C854 E8 177A0700 CALL haloce.004F4270 + -> + 004F4270 8A06 MOV AL,BYTE PTR DS:[ESI] ;AL=01 + 004F4272 57 PUSH EDI + 004F4273 83CF FF OR EDI,FFFFFFFF ;->EDI=FFFFFFFF + 004F4276 3C 01 CMP AL,1 + 004F4278 75 27 JNZ SHORT haloce.004F42A1 + 004F427A 83F9 FF CMP ECX,-1 ;==-1? + 004F427D 74 22 JE SHORT haloce.004F42A1 + 004F427F 85C9 TEST ECX,ECX ;==0? + 004F4281 8BC1 MOV EAX,ECX ;->EAX=EC700000 + 004F4283 7D 02 JGE SHORT haloce.004F4287 + 004F4285 F7D8 NEG EAX ;->EAX=13900000 + 004F4287 99 CDQ + 004F4288 F77E 04 IDIV DWORD PTR DS:[ESI+4] ;DS:[00622AA0]=00000011->EAX=01269696 + 004F428B 8B46 08 MOV EAX,DWORD PTR DS:[ESI+8] ;->EAX=0EB4EB20 + 004F428E 8B54D0 04 MOV EDX,DWORD PTR DS:[EAX+EDX*8+4] ;EDX=A ->EDX=1141EB70 + 004F4292 85D2 TEST EDX,EDX + 004F4294 74 0B JE SHORT haloce.004F42A1 + 004F4296 390A CMP DWORD PTR DS:[EDX],ECX ;match? + 004F4298 74 0B JE SHORT haloce.004F42A5 + ;004F429A 8B52 08 MOV EDX,DWORD PTR DS:[EDX+8] + ;004F429D 85D2 TEST EDX,EDX + ;004F429F ^75 F5 JNZ SHORT haloce.004F4296 + ;004F42A1 8BC7 MOV EAX,EDI + ;004F42A3 5F POP EDI + ;004F42A4 C3 RETN + 004F42A5 8B42 04 MOV EAX,DWORD PTR DS:[EDX+4] ;->EAX=00000001 + 004F42A8 5F POP EDI + 004F42A9 C3 RETN + <- + 0047C859 83F8 FF CMP EAX,-1 + 0047C85C 5E POP ESI + 0047C85D 75 02 JNZ SHORT haloce.0047C861 + ;0047C85F 33C0 XOR EAX,EAX + 0047C861 66:8B4C24 10 MOV CX,WORD PTR SS:[ESP+10] ;2nd param timer->CX=0546 + 0047C866 6A 00 PUSH 0 + 0047C868 894424 04 MOV DWORD PTR SS:[ESP+4],EAX ;Stack SS:[0018DB30] + 0047C86C 66:8B4424 10 MOV AX,WORD PTR SS:[ESP+10] ;->AX=0000 + 0047C871 6A 01 PUSH 1 + 0047C873 66:894424 0C MOV WORD PTR SS:[ESP+C],AX ;Stack SS:[0018DB34] + 0047C878 6A 00 PUSH 0 + 0047C87A 8D4424 18 LEA EAX,DWORD PTR SS:[ESP+18] ;->EAX=0018DB3C + 0047C87E 50 PUSH EAX ;pointer (ptr ptr?) to data + 0047C87F 6A 00 PUSH 0 + 0047C881 8D5424 14 LEA EDX,DWORD PTR SS:[ESP+14] ;->EDX=0018DB30 + 0047C885 895424 20 MOV DWORD PTR SS:[ESP+20],EDX ;Stack SS:[0018DB3C] + 0047C889 6A 0E PUSH 0E + 0047C88B 6A 00 PUSH 0 + 0047C88D BA F87F0000 MOV EDX,7FF8 + 0047C892 B8 20CE8000 MOV EAX,haloce.0080CE20 + 0047C897 66:894C24 22 MOV WORD PTR SS:[ESP+22],CX ;Stack SS:[0018DB36] + 0047C89C C74424 2C 00000000 MOV DWORD PTR SS:[ESP+2C],0;Stack SS:[0018DB40] + 0047C8A4 E8 273D0700 CALL haloce.004F05D0 ;build network packet + 0047C8A9 83C4 1C ADD ESP,1C + 0047C8AC 85C0 TEST EAX,EAX ;0000002C + 0047C8AE 7E 1D JLE SHORT haloce.0047C8CD + 0047C8B0 8B0D 84736B00 MOV ECX,DWORD PTR DS:[6B7384] ;007FC340 + 0047C8B6 6A 03 PUSH 3 + 0047C8B8 6A 00 PUSH 0 + 0047C8BA 6A 00 PUSH 0 + 0047C8BC 6A 01 PUSH 1 + 0047C8BE 68 20CE8000 PUSH haloce.0080CE20 + 0047C8C3 6A 01 PUSH 1 + 0047C8C5 E8 66890600 CALL haloce.004E5230 + 0047C8CA 83C4 18 ADD ESP,18 + 0047C8CD 83C4 08 ADD ESP,8 + 0047C8D0 C3 RETN +<- +0047CA30 83C4 08 ADD ESP,8 + +0047CA33 5F POP EDI +0047CA34 5E POP ESI +0047CA35 B0 01 MOV AL,1 +0047CA37 5D POP EBP +0047CA38 C3 RETN +;0047CA39 5F POP EDI +;0047CA3A 5E POP ESI +;0047CA3B 32C0 XOR AL,AL +;0047CA3D 5D POP EBP +;0047CA3E C3 RETN +<- +0047C7D3 83C4 08 ADD ESP,8 + + + + diff --git a/halo notes/cheat_all_powerups.asm b/halo notes/cheat_all_powerups.asm new file mode 100644 index 0000000..0329322 --- /dev/null +++ b/halo notes/cheat_all_powerups.asm @@ -0,0 +1,56 @@ +;notes by Jesus7Freak +;haloce1.09 p0 bloodgulch +;console 004C9BE3 +...1 ;inspect +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F5DD8 haloce.0048C8D0 +...2 ;cheat_all_powerups +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F6DA4 haloce.0047FC30 +...3 ;inspect +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F5DD8 haloce.0048C8D0 + + + + +...2 +0048D1E0 51 PUSH ECX;ECX=403D8501 +0048D1E1 57 PUSH EDI;EDI=F3690000 +0048D1E2 50 PUSH EAX;EAX=00000095 +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F6DA4 haloce.0047FC30 +-> +0047FC30 A1 80226E00 MOV EAX,DWORD PTR DS:[6E2280];object list->EAX=40848198 +0047FC35 8B88 58010000 MOV ECX,DWORD PTR DS:[EAX+158];->ECX=00000005 (5 powers ups avaiable) +0047FC3B 85C9 TEST ECX,ECX +0047FC3D 74 08 JE SHORT haloce.0047FC47 +0047FC3F 8B88 5C010000 MOV ECX,DWORD PTR DS:[EAX+15C];->ECX=40848AF4 +0047FC45 EB 02 JMP SHORT haloce.0047FC49 +... +0047FC49 0FBF80 58010000 MOVSX EAX,WORD PTR DS:[EAX+158] + +0047FC50 50 PUSH EAX;EAX=00000005 +0047FC51 51 PUSH ECX;ECX=40848AF4 +0047FC52 E8 29B7FDFF CALL haloce.0045B380;returns (WORD) how many objects spawned +0047FC57 8B4C24 10 MOV ECX,DWORD PTR SS:[ESP+10];restore ECX=F3690000 +0047FC5B 83C4 08 ADD ESP,8 + +0047FC5E 33C0 XOR EAX,EAX;EAX=00000000 +0047FC60 E9 2BD70000 JMP haloce.0048D390 +...;scripting part +0048D390 81E1 FFFF0000 AND ECX,0FFFF +0048D396 56 PUSH ESI +0048D397 8BF1 MOV ESI,ECX +0048D399 8B0D B0558100 MOV ECX,DWORD PTR DS:[8155B0];hs thread +0048D39F 69F6 18020000 IMUL ESI,ESI,218 +0048D3A5 57 PUSH EDI +0048D3A6 8B79 34 MOV EDI,DWORD PTR DS:[ECX+34] +0048D3A9 8B5437 10 MOV EDX,DWORD PTR DS:[EDI+ESI+10] +0048D3AD 8B4A 04 MOV ECX,DWORD PTR DS:[EDX+4] +0048D3B0 8B15 B4558100 MOV EDX,DWORD PTR DS:[8155B4];script node +0048D3B6 8B52 34 MOV EDX,DWORD PTR DS:[EDX+34] +0048D3B9 03FE ADD EDI,ESI +0048D3BB 81E1 FFFF0000 AND ECX,0FFFF +0048D3C1 8D0C89 LEA ECX,DWORD PTR DS:[ECX+ECX*4] +0048D3C4 8D0C8A LEA ECX,DWORD PTR DS:[EDX+ECX*4] +0048D3C7 F641 06 02 TEST BYTE PTR DS:[ECX+6],2 +0048D3CB 0FBF51 02 MOVSX EDX,WORD PTR DS:[ECX+2] +0048D3CF 75 0C JNZ SHORT haloce.0048D3DD + diff --git a/halo notes/cheat_all_vehicles.asm b/halo notes/cheat_all_vehicles.asm new file mode 100644 index 0000000..0db8767 --- /dev/null +++ b/halo notes/cheat_all_vehicles.asm @@ -0,0 +1,80 @@ +;notes by Jesus7Freak +;haloce1.09 p0 bloodgulch +...1 ;inspect +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F5DD8 haloce.0048C8D0 +...2 ;cheat_all_vehicles +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F97C8 haloce.00485600 +...3 ;inspect +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F5DD8 haloce.0048C8D0 + + + + +...2 +0048D1E0 51 PUSH ECX;ECX=403D8501 +0048D1E1 57 PUSH EDI;EDI=F3690000 +0048D1E2 50 PUSH EAX;EAX=00000098 +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F97C8 haloce.00485600 +-> + 00485600 A1 80226E00 MOV EAX,DWORD PTR DS:[6E2280];->EAX=40848198 + 00485605 8B88 64010000 MOV ECX,DWORD PTR DS:[EAX+164];->ECX=00000001 + 0048560B 85C9 TEST ECX,ECX + 0048560D 74 19 JE SHORT haloce.00485628 + 0048560F 8B80 68010000 MOV EAX,DWORD PTR DS:[EAX+168];->EAX=40848B44 "paew?OF@" + 00485615 8B50 24 MOV EDX,DWORD PTR DS:[EAX+24];->EDX=40848BE4 + 00485618 33C9 XOR ECX,ECX;->ECX=00000000 + 0048561A 66:8B48 20 MOV CX,WORD PTR DS:[EAX+20];->CX=0006 + + 0048561E 51 PUSH ECX;ECX=00000006 + 0048561F 52 PUSH EDX;EDX=40848BE4 + 00485620 E8 5B5DFDFF CALL haloce.0045B380 + -> + 0045B386 E8 95FFFFFF CALL haloce.0045B320 + ->;get static player 0 tag + <- + 0045B38B 83F8 FF CMP EAX,-1;EAX=EC700000 (static player tag) + 0045B394 8B0D C0558100 MOV ECX,DWORD PTR DS:[8155C0] + 0045B39A 25 FFFF0000 AND EAX,0FFFF + 0045B39F 53 PUSH EBX + 0045B3A0 8B59 34 MOV EBX,DWORD PTR DS:[ECX+34] + 0045B3A3 C1E0 09 SHL EAX,9 + 0045B3A6 03C3 ADD EAX,EBX + 0045B3A8 56 PUSH ESI + 0045B3A9 8BF0 MOV ESI,EAX + + 0045B3AB 8B4E 34 MOV ECX,DWORD PTR DS:[ESI+34];player obj tag ECX=E2A80039 + 0045B3AE 8D4424 20 LEA EAX,DWORD PTR SS:[ESP+20];ptr to hold xyz coordinates + 0045B3B2 E8 D9F10900 CALL haloce.004FA590 + ->;fastcall like parameters get players xyz coordinates + <- + 0045B3B7 8B4E 34 MOV ECX,DWORD PTR DS:[ESI+34];player obj tag ECX=E2A80039 + 0045B3BA 8D5424 2C LEA EDX,DWORD PTR SS:[ESP+2C];ptr to hold scale xyz + 0045B3BE 52 PUSH EDX;EDX=0018CE28 + 0045B3BF 8D4424 18 LEA EAX,DWORD PTR SS:[ESP+18];ptr to hold rot xyz + 0045B3C3 E8 38F20900 CALL haloce.004FA600 + ->;get players m_LowerRot and scale xyz + <- + 0045B3C8 66:8B8424 CC000000 MOV AX,WORD PTR SS:[ESP+CC];->AX=0006 6 vehicles to spawn? + 0045B3D0 83C4 04 ADD ESP,4 + 0045B3D3 66:85C0 TEST AX,AX + 0045B3D6 0F8E 54010000 JLE haloce.0045B530 + 0045B3DC 8B8C24 C4000000 MOV ECX,DWORD PTR SS:[ESP+C4] + 0045B3E3 8B5C24 30 MOV EBX,DWORD PTR SS:[ESP+30] + 0045B3E7 55 PUSH EBP + 0045B3E8 8B6C24 30 MOV EBP,DWORD PTR SS:[ESP+30] + 0045B3EC 0FB7D0 MOVZX EDX,AX + 0045B3EF 33F6 XOR ESI,ESI + 0045B3F1 83C1 0C ADD ECX,0C + 0045B3F4 57 PUSH EDI + 0045B3F5 8B7C24 3C MOV EDI,DWORD PTR SS:[ESP+3C] + 0045B3F9 894C24 14 MOV DWORD PTR SS:[ESP+14],ECX + 0045B3FD 895424 18 MOV DWORD PTR SS:[ESP+18],EDX + 0045B401 8B4C24 14 /MOV ECX,DWORD PTR SS:[ESP+14] + 0045B405 8B09 |MOV ECX,DWORD PTR DS:[ECX] + 0045B407 83F9 FF |CMP ECX,-1 + 0045B40A 0F84 03010000 |JE haloce.0045B513 + + + + + diff --git a/halo notes/cheat_all_weapons.asm b/halo notes/cheat_all_weapons.asm new file mode 100644 index 0000000..4a7bf82 --- /dev/null +++ b/halo notes/cheat_all_weapons.asm @@ -0,0 +1,45 @@ +;notes by Jesus7Freak +;haloce1.09 p0 bloodgulch +;console 004C9BE3 +...1 ;inspect +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F5DD8 haloce.0048C8D0 +...2 ;cheat_all_weapons +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F97AC haloce.004855F0 +...3 ;inspect +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F5DD8 haloce.0048C8D0 + + + + +...2 +0048D1E0 51 PUSH ECX;ECX=403D8501 +0048D1E1 57 PUSH EDI;EDI=F3690000 +0048D1E2 50 PUSH EAX;EAX=00000096 +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F97AC haloce.004855F0 +-> +004855F0 E8 BB5AFDFF CALL haloce.0045B0B0 +-> + 0045B0B0 A1 80226E00 MOV EAX,DWORD PTR DS:[6E2280];object list->EAX=40848198 + 0045B0B5 8B88 4C010000 MOV ECX,DWORD PTR DS:[EAX+14C];->ECX=00000010 (16 available weapons?) + 0045B0BB 81EC 14010000 SUB ESP,114 + 0045B0C1 57 PUSH EDI + 0045B0C2 33FF XOR EDI,EDI + 0045B0C4 3BCF CMP ECX,EDI;ECX=00000010 == EDI=00000000 ? + 0045B0C6 74 23 JE SHORT haloce.0045B0EB + 0045B0C8 8B88 50010000 MOV ECX,DWORD PTR DS:[EAX+150];->ECX=408489F4 + 0045B0CE 3BCF CMP ECX,EDI;ECX=408489F4 == EDI=00000000 ? + 0045B0D0 74 19 JE SHORT haloce.0045B0EB + 0045B0D2 0FBF80 4C010000 MOVSX EAX,WORD PTR DS:[EAX+14C];->EAX=00000010 + + 0045B0D9 50 PUSH EAX;00000010 (how many objects to spawn) + 0045B0DA 51 PUSH ECX;408489F4 (object type list) + 0045B0DB E8 A0020000 CALL haloce.0045B380 + 0045B0E0 83C4 08 ADD ESP,8 + + 0045B0E3 5F POP EDI + 0045B0E4 81C4 14010000 ADD ESP,114 + 0045B0EA C3 RETN +<- +004855F5 8B4C24 08 MOV ECX,DWORD PTR SS:[ESP+8] +004855F9 33C0 XOR EAX,EAX +004855FB E9 907D0000 JMP haloce.0048D390 \ No newline at end of file diff --git a/halo notes/cheat_spawn_hog.asm b/halo notes/cheat_spawn_hog.asm new file mode 100644 index 0000000..8855d52 --- /dev/null +++ b/halo notes/cheat_spawn_hog.asm @@ -0,0 +1,496 @@ +;notes by Jesus7Freak +;haloce1.09 p0 bloodgulch +;console 004C9BE3 +...1 ;inspect +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F5DD8 haloce.0048C8D0 +...2 ;cheat_spawn_warthog +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F6DC0 haloce.0047FC70 +...3 ;inspect +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F5DD8 haloce.0048C8D0 + +CMP BYTE PTR DS:[EDI+1],2F +JNZ SHORT 004C9F63 + +...2 +0048D1E0 51 PUSH ECX;ECX=403D8501 +0048D1E1 57 PUSH EDI;EDI=F3690000 +0048D1E2 50 PUSH EAX;EAX=00000097 +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F6DC0 haloce.0047FC70 +-> + +;spawn warthog next to player func halopc1.09=0045A730 +;\xA1\x00\x00\x00\x00\x8B\x88\x64\x01\x00\x00\x85\xC9\x57 +;x????xxxxxxxxx +0047FC70 E8 CBB4FDFF CALL haloce.0045B140 +-> +0045B140 A1 80226E00 MOV EAX,DWORD PTR DS:[6E2280];->EAX=40848198 +0045B145 8B88 64010000 MOV ECX,DWORD PTR DS:[EAX+164];->ECX=00000001 +0045B14B 85C9 TEST ECX,ECX +0045B14D 57 PUSH EDI;EDI=F3690000 +0045B14E 8BB8 68010000 MOV EDI,DWORD PTR DS:[EAX+168];->EDI=40848B44 "paew?OF@" +0045B154 74 49 JE SHORT haloce.0045B19F +0045B156 8B47 20 MOV EAX,DWORD PTR DS:[EDI+20];->EAX=00000006 +0045B159 55 PUSH EBP;EBP=00000000 +0045B15A 8B6F 24 MOV EBP,DWORD PTR DS:[EDI+24];->EBP=40848BE4 +0045B15D 56 PUSH ESI;->ESI=403D8500 +0045B15E 33F6 XOR ESI,ESI;->ESI=00000000 +0045B160 85C0 TEST EAX,EAX;EAX=00000006 +0045B162 7E 39 JLE SHORT haloce.0045B19D +0045B164 53 PUSH EBX;EBX=00000000 +0045B165 8D5D 04 LEA EBX,DWORD PTR SS:[EBP+4];->EBX=40848BE8 +0045B168 8B03 /MOV EAX,DWORD PTR DS:[EBX];->EAX=40459A9D "vehicles\warthog\mp_warthog" + +;object check? +0045B16A 68 D8EB5F00 |PUSH haloce.005FEBD8 ; ASCII "warthog" +0045B16F 50 |PUSH EAX +0045B170 E8 DBF51600 |CALL haloce.005CA750 +-> +<-;->ECX=005FEBDC "hog" +0045B175 83C4 08 |ADD ESP,8 +0045B178 85C0 |TEST EAX,EAX;EAX=40459AA6 "warthog\mp_warthog" +0045B17A 75 10 |JNZ SHORT haloce.0045B18C +... + +;spawn next to player 0 +0045B18C C1E6 04 SHL ESI,4;->ESI=00000000 +0045B18F 6A 01 PUSH 1;->0018CEB0=00000001 +0045B191 03F5 ADD ESI,EBP;->ESI=40848BE4 +0045B193 56 PUSH ESI;->0018CEAC=40848BE4 +0045B194 E8 E7010000 CALL haloce.0045B380 +-> + 0045B380 81EC B8000000 SUB ESP,0B8 + 0045B386 E8 95FFFFFF CALL haloce.0045B320 + -> + 0045B320 83EC 10 SUB ESP,10 + 0045B323 A1 C0558100 MOV EAX,DWORD PTR DS:[8155C0];players + 0045B328 56 PUSH ESI + 0045B329 894424 04 MOV DWORD PTR SS:[ESP+4],EAX;->0018CDDC=402AAF94 ASCII "players" + 0045B32D 57 PUSH EDI + 0045B32E 35 72657469 XOR EAX,69746572;->EAX=295ECAE6 + 0045B333 83CE FF OR ESI,FFFFFFFF;->ESI=FFFFFFFF + 0045B336 8D7C24 08 LEA EDI,DWORD PTR SS:[ESP+8];->EDI=0018CDDC + 0045B33A 66:C74424 0C 0000 MOV WORD PTR SS:[ESP+C],0;hard coded player 0 + 0045B341 897424 10 MOV DWORD PTR SS:[ESP+10],ESI;ESI=FFFFFFFF + 0045B345 894424 14 MOV DWORD PTR SS:[ESP+14],EAX;EAX=295ECAE6 + 0045B349 E8 C2870700 CALL haloce.004D3B10 + -> + 004D3B10 66:8B4F 04 MOV CX,WORD PTR DS:[EDI+4];CX=0000 + 004D3B14 53 PUSH EBX;save 40848BE8 + 004D3B15 55 PUSH EBP;save 40848BE4 + 004D3B16 56 PUSH ESI;save FFFFFFFF + 004D3B17 8B37 MOV ESI,DWORD PTR DS:[EDI];->ESI=402AAF94 "players" + 004D3B19 0FBF6E 22 MOVSX EBP,WORD PTR DS:[ESI+22];->EBP=00000200 (size of static player) + 004D3B1D 8B5E 34 MOV EBX,DWORD PTR DS:[ESI+34];->EBX=402AAFCC (ptr to first static player in array) + 004D3B20 0FBFD1 MOVSX EDX,CX;->EDX=00000000 index + 004D3B23 0FAFD5 IMUL EDX,EBP;0*200 = 0 + 004D3B26 33C0 XOR EAX,EAX;->EAX=00000000 + 004D3B28 03D3 ADD EDX,EBX;->EDX=402AAFCC (static player) + 004D3B2A 66:3B4E 2E CMP CX,WORD PTR DS:[ESI+2E];check if in range of NumOfItems + 004D3B2E 7D 2D JGE SHORT haloce.004D3B5D + 004D3B30 66:8B1A /MOV BX,WORD PTR DS:[EDX];->BX=EC70 (static player ID) + 004D3B33 0FBFF3 |MOVSX ESI,BX;->ESI=FFFFEC70 + 004D3B36 0FBFC1 |MOVSX EAX,CX;->EAX=00000000 + 004D3B39 C1E6 10 |SHL ESI,10;shift bits ->ESI=EC700000 + 004D3B3C 0BF0 |OR ESI,EAX;add player index (its now a player tag (ID + index))->ESI=EC700000 + 004D3B3E 41 |INC ECX;->ECX=005F0001 + 004D3B3F 66:85DB |TEST BX,BX;valid ID test BX=EC70 (invalid = 0000) + 004D3B42 75 14 |JNZ SHORT haloce.004D3B58 + ;004D3B44 8B07 MOV EAX,DWORD PTR DS:[EDI] + ;004D3B46 03D5 ADD EDX,EBP + ;004D3B48 66:3B48 2E CMP CX,WORD PTR DS:[EAX+2E] + ;004D3B4C ^7C E2 JL SHORT haloce.004D3B30 + ;004D3B4E 5E POP ESI + ;004D3B4F 5D POP EBP + ;004D3B50 33C0 XOR EAX,EAX + ;004D3B52 66:894F 04 MOV WORD PTR DS:[EDI+4],CX + ;004D3B56 5B POP EBX + ;004D3B57 C3 RETN + 004D3B58 8977 08 MOV DWORD PTR DS:[EDI+8],ESI;ptr to player tag (invalid tag = -1)->0018CDE4=EC700000 + 004D3B5B 8BC2 MOV EAX,EDX;return ptr to static player->EAX=402AAFCC + 004D3B5D 5E POP ESI + 004D3B5E 5D POP EBP + 004D3B5F 66:894F 04 MOV WORD PTR DS:[EDI+4],CX;CX=0001 ptr ->0018CDE0=655F0001 + 004D3B63 5B POP EBX + 004D3B64 C3 RETN + <- + 0045B34E 85C0 TEST EAX,EAX;test static player tag + 0045B350 74 12 JE SHORT haloce.0045B364 + 0045B352 3970 34 /CMP DWORD PTR DS:[EAX+34],ESI;test player obj tag ESI=FFFFFFFF == E2BD004E? + 0045B355 75 15 |JNZ SHORT haloce.0045B36C + ;0045B357 8D7C24 08 LEA EDI,DWORD PTR SS:[ESP+8] + ;0045B35B E8 B0870700 CALL haloce.004D3B10 + ;0045B360 85C0 TEST EAX,EAX + ;0045B362 ^75 EE JNZ SHORT haloce.0045B352 + ;0045B364 5F POP EDI + ;0045B365 8BC6 MOV EAX,ESI + ;0045B367 5E POP ESI + ;0045B368 83C4 10 ADD ESP,10 + ;0045B36B C3 RETN + 0045B36C 8B4424 10 MOV EAX,DWORD PTR SS:[ESP+10];return static player tag->EAX=EC700000 + 0045B370 5F POP EDI;restore->EDI=40848B44 + 0045B371 5E POP ESI;restore->ESI=40848BE4 + 0045B372 83C4 10 ADD ESP,10 + 0045B375 C3 RETN + <- + 0045B38B 83F8 FF CMP EAX,-1;valid tag test EAX=EC700000 == FFFFFFFF? + 0045B38E 0F84 9E010000 JE haloce.0045B532 ;rets -1 + 0045B394 8B0D C0558100 MOV ECX,DWORD PTR DS:[8155C0];players->ECX=402AAF94 + 0045B39A 25 FFFF0000 AND EAX,0FFFF;get index from tag->EAX=00000000 + 0045B39F 53 PUSH EBX;save 40848BE8 + 0045B3A0 8B59 34 MOV EBX,DWORD PTR DS:[ECX+34];ptr to static player array->EBX=402AAFCC + 0045B3A3 C1E0 09 SHL EAX,9 ;same as 0*2^9 or 0*200->EAX=00000000 + 0045B3A6 03C3 ADD EAX,EBX;add offset to ptr to get static player at index->EAX=402AAFCC + 0045B3A8 56 PUSH ESI;save 40848BE4 + 0045B3A9 8BF0 MOV ESI,EAX ;->ESI=402AAFCC + 0045B3AB 8B4E 34 MOV ECX,DWORD PTR DS:[ESI+34];player obj tag->ECX=E2BD004E + 0045B3AE 8D4424 20 LEA EAX,DWORD PTR SS:[ESP+20];load players ptr to EAX->EAX=0018CE08 + 0045B3B2 E8 D9F10900 CALL haloce.004FA590 + ->;get players xyz coordinates + 004FA590 8B15 B0B37F00 MOV EDX,DWORD PTR DS:[7FB3B0];object + 004FA596 8B52 34 MOV EDX,DWORD PTR DS:[EDX+34] + 004FA599 81E1 FFFF0000 AND ECX,0FFFF + 004FA59F 8D0C49 LEA ECX,DWORD PTR DS:[ECX+ECX*2] + 004FA5A2 56 PUSH ESI + 004FA5A3 8B748A 08 MOV ESI,DWORD PTR DS:[EDX+ECX*4+8];player obj->ESI=4006825C + 004FA5A7 8B8E 1C010000 MOV ECX,DWORD PTR DS:[ESI+11C];player in veh,veh tag->ECX=FFFFFFFF + 004FA5AD 83F9 FF CMP ECX,-1 ;test if valid tag,tag->ECX=FFFFFFFF not valid + 004FA5B0 75 17 JNZ SHORT haloce.004FA5C9 + 004FA5B2 83C6 5C ADD ESI,5C;player obj's xyz coordinates (floats)->ESI=400682B8 + 004FA5B5 8B0E MOV ECX,DWORD PTR DS:[ESI];x coord->ECX=421395E8 + 004FA5B7 8BD0 MOV EDX,EAX;->EDX=0018CE08 + 004FA5B9 890A MOV DWORD PTR DS:[EDX],ECX;save x coordiante->0018CE08=421395E8 + 004FA5BB 8B4E 04 MOV ECX,DWORD PTR DS:[ESI+4];y coord->ECX=C2B46901 + 004FA5BE 894A 04 MOV DWORD PTR DS:[EDX+4],ECX;save y coord->0018CE08+4=C2B46901 + 004FA5C1 8B4E 08 MOV ECX,DWORD PTR DS:[ESI+8];z coordinate->ECX=3D8E4636 + 004FA5C4 894A 08 MOV DWORD PTR DS:[EDX+8],ECX;save z coord->0018CE08+8=3D8E4636 + 004FA5C7 5E POP ESI;restore->ESI=402AAFCC + 004FA5C8 C3 RETN + ;004FA5C9 81E1 FFFF0000 AND ECX,0FFFF + ;004FA5CF 8D0C49 LEA ECX,DWORD PTR DS:[ECX+ECX*2] + ;004FA5D2 8B4C8A 08 MOV ECX,DWORD PTR DS:[EDX+ECX*4+8] + ;004FA5D6 8D56 5C LEA EDX,DWORD PTR DS:[ESI+5C] + ;004FA5D9 0FBEB6 20010000 MOVSX ESI,BYTE PTR DS:[ESI+120] + ;004FA5E0 6BF6 34 IMUL ESI,ESI,34 + ;004FA5E3 57 PUSH EDI + ;004FA5E4 0FBFB9 F2010000 MOVSX EDI,WORD PTR DS:[ECX+1F2] + ;004FA5EB 03F1 ADD ESI,ECX + ;004FA5ED 03FE ADD EDI,ESI + ;004FA5EF 57 PUSH EDI + ;004FA5F0 E8 2B4DFDFF CALL haloce.004CF320 + ;004FA5F5 83C4 04 ADD ESP,4 + ;004FA5F8 5F POP EDI + ;004FA5F9 5E POP ESI + ;004FA5FA C3 RETN + <- + 0045B3B7 8B4E 34 MOV ECX,DWORD PTR DS:[ESI+34];player obj tag->ECX=E2BD004E + 0045B3BA 8D5424 2C LEA EDX,DWORD PTR SS:[ESP+2C];load ptr to -1->EDX=0018CE14 + 0045B3BE 52 PUSH EDX;save 0018CE14 + 0045B3BF 8D4424 18 LEA EAX,DWORD PTR SS:[ESP+18];load ptr to 0->EAX=0018CDFC + 0045B3C3 E8 38F20900 CALL haloce.004FA600 + ->;get players m_LowerRot and scale xyz + 004FA600 8B15 B0B37F00 MOV EDX,DWORD PTR DS:[7FB3B0];object + 004FA606 8B52 34 MOV EDX,DWORD PTR DS:[EDX+34] + 004FA609 81E1 FFFF0000 AND ECX,0FFFF + 004FA60F 53 PUSH EBX + 004FA610 8B5C24 08 MOV EBX,DWORD PTR SS:[ESP+8];->EBX=0018CE14 + 004FA614 8D0C49 LEA ECX,DWORD PTR DS:[ECX+ECX*2] + 004FA617 57 PUSH EDI + 004FA618 8B7C8A 08 MOV EDI,DWORD PTR DS:[EDX+ECX*4+8];player obj->EDI=4006825C + 004FA61C 8B8F 1C010000 MOV ECX,DWORD PTR DS:[EDI+11C];player in veh, veh obj tag->ECX=FFFFFFFF + 004FA622 83F9 FF CMP ECX,-1;test if player is in veh + 004FA625 75 34 JNZ SHORT haloce.004FA65B + 004FA627 85C0 TEST EAX,EAX;EAX=0018CDFC + 004FA629 74 13 JE SHORT haloce.004FA63E + 004FA62B 8D57 74 LEA EDX,DWORD PTR DS:[EDI+74];m_LowerRot xyz->EDX=400682D0 + 004FA62E 8B0A MOV ECX,DWORD PTR DS:[EDX];rot z->ECX=3F77C14F + 004FA630 8908 MOV DWORD PTR DS:[EAX],ECX;save rot z->0018CDFC+0=3F77C14F + 004FA632 8B4A 04 MOV ECX,DWORD PTR DS:[EDX+4];rot y->ECX=BE80E4D4 + 004FA635 8948 04 MOV DWORD PTR DS:[EAX+4],ECX;save rot y->0018CDFC+4=BE80E4D4 + 004FA638 8B52 08 MOV EDX,DWORD PTR DS:[EDX+8];rot z->ECX=00000000 + 004FA63B 8950 08 MOV DWORD PTR DS:[EAX+8],EDX;save rot z->0018CDFC+8=00000000 + 004FA63E 85DB TEST EBX,EBX;test valid ptr EBX=0018CE14 + 004FA640 74 62 JE SHORT haloce.004FA6A4 + 004FA642 81C7 80000000 ADD EDI,80;player obj + 0x80 =m_Scale->EDI=400682DC + 004FA648 8B07 MOV EAX,DWORD PTR DS:[EDI];scale x->EAX=00000000 + 004FA64A 8903 MOV DWORD PTR DS:[EBX],EAX;save scale x->0018CE14+0=00000000 + 004FA64C 8B4F 04 MOV ECX,DWORD PTR DS:[EDI+4];scale y->ECX=00000000 + 004FA64F 894B 04 MOV DWORD PTR DS:[EBX+4],ECX;save scale x->0018CE14+4=00000000 + 004FA652 8B57 08 MOV EDX,DWORD PTR DS:[EDI+8];scale z->EDX=3F800000 (1.0) + 004FA655 5F POP EDI;->EDI=40848B44 + 004FA656 8953 08 MOV DWORD PTR DS:[EBX+8],EDX;save scale x->0018CE14+8=3F800000 (1.0) + 004FA659 5B POP EBX;->EBX=402AAFCC + 004FA65A C3 RETN + ;004FA65B 81E1 FFFF0000 AND ECX,0FFFF + ;004FA661 8D0C49 LEA ECX,DWORD PTR DS:[ECX+ECX*2] + ;004FA664 8B4C8A 08 MOV ECX,DWORD PTR DS:[EDX+ECX*4+8] + ;004FA668 0FBE97 20010000 MOVSX EDX,BYTE PTR DS:[EDI+120] + ;004FA66F 6BD2 34 IMUL EDX,EDX,34 + ;004FA672 56 PUSH ESI + ;004FA673 0FBFB1 F2010000 MOVSX ESI,WORD PTR DS:[ECX+1F2] + ;004FA67A 03D1 ADD EDX,ECX + ;004FA67C 03F2 ADD ESI,EDX + ;004FA67E 85C0 TEST EAX,EAX + ;004FA680 74 0C JE SHORT haloce.004FA68E + ;004FA682 8D57 74 LEA EDX,DWORD PTR DS:[EDI+74] + ;004FA685 56 PUSH ESI + ;004FA686 E8 754DFDFF CALL haloce.004CF400 + ;004FA68B 83C4 04 ADD ESP,4 + ;004FA68E 85DB TEST EBX,EBX + ;004FA690 74 11 JE SHORT haloce.004FA6A3 + ;004FA692 8D97 80000000 LEA EDX,DWORD PTR DS:[EDI+80] + ;004FA698 56 PUSH ESI + ;004FA699 8BC3 MOV EAX,EBX + ;004FA69B E8 604DFDFF CALL haloce.004CF400 + ;004FA6A0 83C4 04 ADD ESP,4 + ;004FA6A3 5E POP ESI + ;004FA6A4 5F POP EDI + ;004FA6A5 5B POP EBX + ;004FA6A6 C3 RETN + <- + 0045B3C8 66:8B8424 CC000000 MOV AX,WORD PTR SS:[ESP+CC];->AX=0001 param2 + 0045B3D0 83C4 04 ADD ESP,4 + 0045B3D3 66:85C0 TEST AX,AX + 0045B3D6 0F8E 54010000 JLE haloce.0045B530 + 0045B3DC 8B8C24 C4000000 MOV ECX,DWORD PTR SS:[ESP+C4];->ECX=40848BE4 + 0045B3E3 8B5C24 30 MOV EBX,DWORD PTR SS:[ESP+30];->EBX=00000000 + 0045B3E7 55 PUSH EBP + 0045B3E8 8B6C24 30 MOV EBP,DWORD PTR SS:[ESP+30];->EBP=00000000 + 0045B3EC 0FB7D0 MOVZX EDX,AX;->EDX=00000001 + 0045B3EF 33F6 XOR ESI,ESI;->ESI=00000000 + 0045B3F1 83C1 0C ADD ECX,0C;->ECX=40848BF0 (function + 0x73 = 0x0C) + 0045B3F4 57 PUSH EDI + 0045B3F5 8B7C24 3C MOV EDI,DWORD PTR SS:[ESP+3C];->EDI=3F800000 (1.0) + 0045B3F9 894C24 14 MOV DWORD PTR SS:[ESP+14],ECX + 0045B3FD 895424 18 MOV DWORD PTR SS:[ESP+18],EDX;->EDX=00000001 + 0045B401 8B4C24 14 /MOV ECX,DWORD PTR SS:[ESP+14];->ECX=40848BF0 + 0045B405 8B09 |MOV ECX,DWORD PTR DS:[ECX];->E3D40260 + 0045B407 83F9 FF |CMP ECX,-1;test + 0045B40A 0F84 03010000 |JE haloce.0045B513 + 0045B410 0FBFD0 |MOVSX EDX,AX + 0045B413 895424 10 |MOV DWORD PTR SS:[ESP+10],EDX + 0045B417 DB4424 10 |FILD DWORD PTR SS:[ESP+10];convert to float?->ST0=1.0 + 0045B41B D83D 60236100 |FDIVR DWORD PTR DS:[612360];ST=1.0 DS:[00612360]=6.283185->ST0=6.2831854820251464840 + 0045B421 D815 98286100 |FCOM DWORD PTR DS:[612898];ST=6.2831854820251464840 == DS:[00612898]=0.3926991? + 0045B427 DFE0 |FSTSW AX;->AX=3822 + 0045B429 F6C4 41 |TEST AH,41;AH=38 + 0045B42C 75 08 |JNZ SHORT haloce.0045B436 + 0045B42E DDD8 |FSTP ST + 0045B430 D905 98286100 |FLD DWORD PTR DS:[612898];ST0=0.3926990926265716553 + 0045B436 D94424 1C |FLD DWORD PTR SS:[ESP+1C];ST0=0.9677934050559997559 ST1=0.3926990926265716553 + 0045B43A 8BC2 |MOV EAX,EDX;->EDX=00000001 + 0045B43C D94424 20 |FLD DWORD PTR SS:[ESP+20];ST0=-0.2517458200454711914 ST1=0.9677934050559997559 ST2=0.3926990926265716553 + 0045B440 99 |CDQ;->EDX=00000000 + 0045B441 D9F3 |FPATAN;->ST0=1.8252800737494432540 ST1=0.3926990926265716553 + 0045B443 2BC2 |SUB EAX,EDX;1-0->EAX=00000001 + 0045B445 D1F8 |SAR EAX,1;->EAX=00000000 + 0045B447 8BD6 |MOV EDX,ESI;->EDX=00000000 + 0045B449 2BD0 |SUB EDX,EAX;0-0=0 + 0045B44B 895424 10 |MOV DWORD PTR SS:[ESP+10],EDX;->0018CDF0=00000000 + 0045B44F 6A FF |PUSH -1 + 0045B451 51 |PUSH ECX;ECX=E3D40260 + 0045B452 8D4424 48 |LEA EAX,DWORD PTR SS:[ESP+48];->EAX=0018CE20 (ptr to 00000001) + 0045B456 DB4424 18 |FILD DWORD PTR SS:[ESP+18];ST0=0.0 ST1=1.8252800737494432540 ST0=0.3926990926265716553 + 0045B45A D8CA |FMUL ST,ST(2) + 0045B45C DEC1 |FADDP ST(1),ST;->ST0=1.8252800737494432540 ST1=0.3926990926265716553 + 0045B45E DDD9 |FSTP ST(1);->ST0=1.8252800737494432330 + 0045B460 E8 CBDB0900 |CALL haloce.004F9030 + -> + 004F9030 8B15 081D6300 MOV EDX,DWORD PTR DS:[631D08] ; haloce.005FA80C + 004F9036 53 PUSH EBX + 004F9037 8B5C24 0C MOV EBX,DWORD PTR SS:[ESP+C] + 004F903B 56 PUSH ESI + 004F903C 8BF0 MOV ESI,EAX + 004F903E 33C0 XOR EAX,EAX + 004F9040 57 PUSH EDI + 004F9041 B9 22000000 MOV ECX,22 + 004F9046 8BFE MOV EDI,ESI + 004F9048 F3:AB REP STOS DWORD PTR ES:[EDI];EAX=00000000 + 004F904A 8B4424 10 MOV EAX,DWORD PTR SS:[ESP+10];->EAX=E3D40260 + 004F904E 8906 MOV DWORD PTR DS:[ESI],EAX + 004F9050 33FF XOR EDI,EDI + 004F9052 897E 04 MOV DWORD PTR DS:[ESI+4],EDI + 004F9055 8B02 MOV EAX,DWORD PTR DS:[EDX] + 004F9057 8D4E 34 LEA ECX,DWORD PTR DS:[ESI+34] + 004F905A 8901 MOV DWORD PTR DS:[ECX],EAX + 004F905C 8B42 04 MOV EAX,DWORD PTR DS:[EDX+4] + 004F905F 8941 04 MOV DWORD PTR DS:[ECX+4],EAX + 004F9062 8B52 08 MOV EDX,DWORD PTR DS:[EDX+8] + 004F9065 8951 08 MOV DWORD PTR DS:[ECX+8],EDX + 004F9068 8B0D 101D6300 MOV ECX,DWORD PTR DS:[631D10] ; haloce.005FA824 + 004F906E 8B11 MOV EDX,DWORD PTR DS:[ECX] + 004F9070 8D46 40 LEA EAX,DWORD PTR DS:[ESI+40] + 004F9073 8910 MOV DWORD PTR DS:[EAX],EDX + 004F9075 8B51 04 MOV EDX,DWORD PTR DS:[ECX+4] + 004F9078 8950 04 MOV DWORD PTR DS:[EAX+4],EDX + 004F907B 8B49 08 MOV ECX,DWORD PTR DS:[ECX+8] + 004F907E 8948 08 MOV DWORD PTR DS:[EAX+8],ECX + 004F9081 6A FF PUSH -1 + 004F9083 8BCB MOV ECX,EBX + 004F9085 66:897E 16 MOV WORD PTR DS:[ESI+16],DI + 004F9089 E8 C21A0000 CALL haloce.004FAB50 + -> + 004FAB50 57 PUSH EDI + 004FAB51 33FF XOR EDI,EDI + 004FAB53 83F9 FF CMP ECX,-1 + 004FAB56 74 39 JE SHORT haloce.004FAB91 + ... + 004FAB91 33C0 XOR EAX,EAX + 004FAB93 85FF TEST EDI,EDI + 004FAB95 74 13 JE SHORT haloce.004FABAA + ... + 004FABAA 5F POP EDI + 004FABAB C3 RETN + <- + 004F908E 83C4 04 ADD ESP,4 + 004F9091 3BC7 CMP EAX,EDI + 004F9093 74 19 JE SHORT haloce.004F90AE + ... + 004F90AE C746 0C FFFFFFFF MOV DWORD PTR DS:[ESI+C],-1 + 004F90B5 C746 08 FFFFFFFF MOV DWORD PTR DS:[ESI+8],-1 + 004F90BC 66:C746 14 FFFF MOV WORD PTR DS:[ESI+14],0FFFF + 004F90C2 8B15 C4206200 MOV EDX,DWORD PTR DS:[6220C4] ; haloce.005F364C + 004F90C8 8D46 58 LEA EAX,DWORD PTR DS:[ESI+58] + 004F90CB B9 04000000 MOV ECX,4 + 004F90D0 8BF2 MOV ESI,EDX + 004F90D2 8B1E MOV EBX,DWORD PTR DS:[ESI] + 004F90D4 8BF8 MOV EDI,EAX + 004F90D6 891F MOV DWORD PTR DS:[EDI],EBX + 004F90D8 8B5E 04 MOV EBX,DWORD PTR DS:[ESI+4] + 004F90DB 895F 04 MOV DWORD PTR DS:[EDI+4],EBX + 004F90DE 8B76 08 MOV ESI,DWORD PTR DS:[ESI+8] + 004F90E1 83C0 0C ADD EAX,0C + 004F90E4 49 DEC ECX + 004F90E5 8977 08 MOV DWORD PTR DS:[EDI+8],ESI + 004F90E8 ^75 E6 JNZ SHORT haloce.004F90D0 + ...*3^ + 004F90EA 5F POP EDI + 004F90EB 5E POP ESI + 004F90EC 5B POP EBX + 004F90ED C3 RETN + <- + 0045B465 D9C0 |FLD ST + 0045B467 8B4424 24 |MOV EAX,DWORD PTR SS:[ESP+24] + 0045B46B D9FF |FCOS + 0045B46D 8B4C24 28 |MOV ECX,DWORD PTR SS:[ESP+28] + 0045B471 8B5424 2C |MOV EDX,DWORD PTR SS:[ESP+2C] + 0045B475 83C4 08 |ADD ESP,8 + 0045B478 66:833D D0476B00 02 |CMP WORD PTR DS:[6B47D0],2 + 0045B480 894424 74 |MOV DWORD PTR SS:[ESP+74],EAX + 0045B484 894C24 78 |MOV DWORD PTR SS:[ESP+78],ECX + 0045B488 895424 7C |MOV DWORD PTR SS:[ESP+7C],EDX + 0045B48C 89AC24 80000000 |MOV DWORD PTR SS:[ESP+80],EBP + 0045B493 899C24 84000000 |MOV DWORD PTR SS:[ESP+84],EBX + 0045B49A 89BC24 88000000 |MOV DWORD PTR SS:[ESP+88],EDI + 0045B4A1 B8 03000000 |MOV EAX,3 + 0045B4A6 D80D E4236100 |FMUL DWORD PTR DS:[6123E4] + 0045B4AC D84424 28 |FADD DWORD PTR SS:[ESP+28] + 0045B4B0 D95C24 58 |FSTP DWORD PTR SS:[ESP+58] + 0045B4B4 D9FE |FSIN + 0045B4B6 D80D E4236100 |FMUL DWORD PTR DS:[6123E4] + 0045B4BC D84424 2C |FADD DWORD PTR SS:[ESP+2C] + 0045B4C0 D95C24 5C |FSTP DWORD PTR SS:[ESP+5C] + 0045B4C4 D94424 30 |FLD DWORD PTR SS:[ESP+30] + 0045B4C8 D805 D8236100 |FADD DWORD PTR DS:[6123D8] + 0045B4CE D95C24 60 |FSTP DWORD PTR SS:[ESP+60] + 0045B4D2 75 29 |JNZ SHORT haloce.0045B4FD + 0045B4D4 8B4C24 40 |MOV ECX,DWORD PTR SS:[ESP+40] + 0045B4D8 8B15 E46D8100 |MOV EDX,DWORD PTR DS:[816DE4] + 0045B4DE 81E1 FFFF0000 |AND ECX,0FFFF + 0045B4E4 C1E1 05 |SHL ECX,5 + 0045B4E7 8B4C11 14 |MOV ECX,DWORD PTR DS:[ECX+EDX+14] + 0045B4EB 0FBF11 |MOVSX EDX,WORD PTR DS:[ECX] + 0045B4EE 8B0C95 A4766300 |MOV ECX,DWORD PTR DS:[EDX*4+6376A4] + 0045B4F5 8379 10 FF |CMP DWORD PTR DS:[ECX+10],-1 + 0045B4F9 74 02 |JE SHORT haloce.0045B4FD + + 0045B4FB 33C0 |XOR EAX,EAX + 0045B4FD 50 |PUSH EAX;EAX=00000000 + 0045B4FE 8D5424 44 |LEA EDX,DWORD PTR SS:[ESP+44] + ;struct create_obj_data + ;{ + ; int obj_type_tag; + ; 0 + ; -1 + ; -1 + ; 0 + ; 0000FFFF + ; C38D246E (-282.28460693359375) x coord m_World + ; 441D0C44 (628.191650390625) y coord + ; 42DF3BE8 (111.61700439453125) z coord + ; 0 x vect m_Velocity + ; 0 y vect + ; 0 z vect + ; 0 (0.0) + ; 3F62B8A6 (0.8856300115585327) x rot m_LowerRot (create script obj (1.0)) + ; BEEDC4BB (-0.4643915593624115) y rot (create script obj (0.0)) + ; 0 z rot + ; 0 x scale m_Scale (create script obj 80000000(0.0)) + ; 0 y (create script obj 80000000(0.0)) + ; 3F800000 (1.0) z + + ; 0 x vect spin + ; 0 y vect + ; 0 z vect + + ; 3F800000 (1.0) + ; 3F800000 (1.0) + ; 3F800000 (1.0) + + ; 3F800000 (1.0) + ; 3F800000 (1.0) + ; 3F800000 (1.0) + + ; 3F800000 (1.0) + ; 3F800000 (1.0) + ; 3F800000 (1.0) + + ; 3F800000 (1.0) + ; 3F800000 (1.0) + ; 3F800000 (1.0) + ;}; + 0045B502 52 |PUSH EDX;EDX=0018CE20 (ptr to E3D40260) + 0045B503 E8 38DC0900 |CALL haloce.004F9140 + ->;huge function,2 parameters __cdecl create object(int, struct?vehicle tag?) ? + <-;return obj tag + 0045B508 66:8B8424 D8000000 |MOV AX,WORD PTR SS:[ESP+D8] + 0045B510 83C4 08 |ADD ESP,8 + 0045B513 8B5424 14 |MOV EDX,DWORD PTR SS:[ESP+14] + 0045B517 8B4C24 18 |MOV ECX,DWORD PTR SS:[ESP+18] + 0045B51B 83C2 10 |ADD EDX,10 + 0045B51E 46 |INC ESI + 0045B51F 49 |DEC ECX + 0045B520 895424 14 |MOV DWORD PTR SS:[ESP+14],EDX + 0045B524 894C24 18 |MOV DWORD PTR SS:[ESP+18],ECX + 0045B528 ^0F85 D3FEFFFF \JNZ haloce.0045B401 + 0045B52E 5F POP EDI + 0045B52F 5D POP EBP + 0045B530 5E POP ESI + 0045B531 5B POP EBX + 0045B532 81C4 B8000000 ADD ESP,0B8 + 0045B538 C3 RETN +<- + + ;player coordinates: x=85.24 y=-157.77 z=-0.02 + ;vehicle coordinates: x=84.72 y=-156.36 z=0.78 + ;difference: x=-0.52 y=1.41 z=0.80 + + + + + + + + + + + + + + +0045B199 83C4 08 ADD ESP,8 +0045B19C 5B POP EBX +0045B19D 5E POP ESI +0045B19E 5D POP EBP +0045B19F 5F POP EDI +0045B1A0 C3 RETN + diff --git a/halo notes/cinematic_screen_effect_set_video.asm b/halo notes/cinematic_screen_effect_set_video.asm new file mode 100644 index 0000000..4c5a842 --- /dev/null +++ b/halo notes/cinematic_screen_effect_set_video.asm @@ -0,0 +1,175 @@ +;notes by Jesus7Freak +;haloce1.09 p0 rpg_beta6_2 +;console 004C9BE3 + +...1 ;inspect +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F5DD8 haloce.0048C8D0 +...2 ;cinematic_screen_effect_set_video +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F8E68 haloce.004840B0 +...3 ;cinematic_screen_effect_set_video +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F8E68 haloce.004840B0 +...4 ;cinematic_screen_effect_set_video +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F8E68 haloce.004840B0 +...5 ;inspect +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F5DD8 haloce.0048C8D0 + + +...2 +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F8E68 haloce.004840B0 + +004840B0 0FBF4424 04 MOVSX EAX,WORD PTR SS:[ESP+4] +004840B5 8B0485 18416200 MOV EAX,DWORD PTR DS:[EAX*4+624118] +004840BC 8B4C24 0C MOV ECX,DWORD PTR SS:[ESP+C] +004840C0 56 PUSH ESI +004840C1 8B7424 0C MOV ESI,DWORD PTR SS:[ESP+C] +004840C5 51 PUSH ECX +004840C6 8D50 1C LEA EDX,DWORD PTR DS:[EAX+1C] +004840C9 0FBF40 1A MOVSX EAX,WORD PTR DS:[EAX+1A] +004840CD 52 PUSH EDX +004840CE 50 PUSH EAX +004840CF 56 PUSH ESI +004840D0 E8 CB940000 CALL haloce.0048D5A0 +004840D5 83C4 10 ADD ESP,10 +004840D8 85C0 TEST EAX,EAX ;EAX=00000000 +004840DA 74 1C JE SHORT haloce.004840F8 +;004840DC 8B48 04 MOV ECX,DWORD PTR DS:[EAX+4] +;004840DF 33D2 XOR EDX,EDX +;004840E1 66:8B10 MOV DX,WORD PTR DS:[EAX] +;004840E4 51 PUSH ECX +;004840E5 52 PUSH EDX +;004840E6 E8 751E0900 CALL haloce.00515F60 +;004840EB 83C4 08 ADD ESP,8 +;004840EE 8BCE MOV ECX,ESI +;004840F0 33C0 XOR EAX,EAX +;004840F2 5E POP ESI +;004840F3 E9 98920000 JMP haloce.0048D390 +004840F8 5E POP ESI +004840F9 C3 RETN + +...3 +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F8E68 haloce.004840B0 + +004840B0 0FBF4424 04 MOVSX EAX,WORD PTR SS:[ESP+4] +004840B5 8B0485 18416200 MOV EAX,DWORD PTR DS:[EAX*4+624118] +004840BC 8B4C24 0C MOV ECX,DWORD PTR SS:[ESP+C] +004840C0 56 PUSH ESI +004840C1 8B7424 0C MOV ESI,DWORD PTR SS:[ESP+C] +004840C5 51 PUSH ECX +004840C6 8D50 1C LEA EDX,DWORD PTR DS:[EAX+1C] +004840C9 0FBF40 1A MOVSX EAX,WORD PTR DS:[EAX+1A] +004840CD 52 PUSH EDX +004840CE 50 PUSH EAX +004840CF 56 PUSH ESI +004840D0 E8 CB940000 CALL haloce.0048D5A0 +004840D5 83C4 10 ADD ESP,10 +004840D8 85C0 TEST EAX,EAX ;EAX=00000000 +004840DA 74 1C JE SHORT haloce.004840F8 +;004840DC 8B48 04 MOV ECX,DWORD PTR DS:[EAX+4] +;004840DF 33D2 XOR EDX,EDX +;004840E1 66:8B10 MOV DX,WORD PTR DS:[EAX] +;004840E4 51 PUSH ECX +;004840E5 52 PUSH EDX +;004840E6 E8 751E0900 CALL haloce.00515F60 +;004840EB 83C4 08 ADD ESP,8 +;004840EE 8BCE MOV ECX,ESI +;004840F0 33C0 XOR EAX,EAX +;004840F2 5E POP ESI +;004840F3 E9 98920000 JMP haloce.0048D390 +004840F8 5E POP ESI +004840F9 C3 RETN + +...4 +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F8E68 haloce.004840B0 + +004840B0 0FBF4424 04 MOVSX EAX,WORD PTR SS:[ESP+4] ;->EAX=000001AA +004840B5 8B0485 18416200 MOV EAX,DWORD PTR DS:[EAX*4+624118] ;->EAX=005F8E68 +004840BC 8B4C24 0C MOV ECX,DWORD PTR SS:[ESP+C] ;->ECX=403D9900 +004840C0 56 PUSH ESI +004840C1 8B7424 0C MOV ESI,DWORD PTR SS:[ESP+C] ;->ESI=F374000A +004840C5 51 PUSH ECX +004840C6 8D50 1C LEA EDX,DWORD PTR DS:[EAX+1C] ;->EDX=005F8E84 +004840C9 0FBF40 1A MOVSX EAX,WORD PTR DS:[EAX+1A] ;->EAX=00000002 + +;parse parameters? +004840CD 52 PUSH EDX ;005F8E84 +004840CE 50 PUSH EAX ;00000002 +004840CF 56 PUSH ESI ;F374000A +004840D0 E8 CB940000 CALL haloce.0048D5A0 +004840D5 83C4 10 ADD ESP,10 + +004840D8 85C0 TEST EAX,EAX ;EAX=403D9A3A +004840DA 74 1C JE SHORT haloce.004840F8 +004840DC 8B48 04 MOV ECX,DWORD PTR DS:[EAX+4] ;->ECX=3F800000 +004840DF 33D2 XOR EDX,EDX +004840E1 66:8B10 MOV DX,WORD PTR DS:[EAX] ;->DX=0000 + +;cinematic_screen_effect_set_video 2 2 +004840E4 51 PUSH ECX ;40000000 (2.0) +004840E5 52 PUSH EDX ;0002 +004840E6 E8 751E0900 CALL haloce.00515F60 +-> + 00515F60 8B15 7C826B00 MOV EDX,DWORD PTR DS:[6B827C] + 00515F66 56 PUSH ESI + 00515F67 33F6 XOR ESI,ESI + 00515F69 3BD6 CMP EDX,ESI + 00515F6B 0F84 9E000000 JE haloce.0051600F + 00515F71 53 PUSH EBX + 00515F72 8B1D 1C846B00 MOV EBX,DWORD PTR DS:[6B841C] + 00515F78 8B8B 28010000 MOV ECX,DWORD PTR DS:[EBX+128] + 00515F7E 83C8 FF OR EAX,FFFFFFFF + 00515F81 3BC8 CMP ECX,EAX + 00515F83 0F84 85000000 JE haloce.0051600E + 00515F89 3983 38010000 CMP DWORD PTR DS:[EBX+138],EAX + 00515F8F 74 7D JE SHORT haloce.0051600E + 00515F91 33C0 XOR EAX,EAX + 00515F93 57 PUSH EDI + 00515F94 B9 0E000000 MOV ECX,0E + 00515F99 8BFA MOV EDI,EDX + 00515F9B F3:AB REP STOS DWORD PTR ES:[EDI] + 00515F9D 66:8B4424 10 MOV AX,WORD PTR SS:[ESP+10];1st parameter + 00515FA2 66:8942 24 MOV WORD PTR DS:[EDX+24],AX + 00515FA6 A1 E46D8100 MOV EAX,DWORD PTR DS:[816DE4] + 00515FAB 8972 3C MOV DWORD PTR DS:[EDX+3C],ESI + 00515FAE 8972 40 MOV DWORD PTR DS:[EDX+40],ESI + 00515FB1 8972 44 MOV DWORD PTR DS:[EDX+44],ESI + 00515FB4 8972 48 MOV DWORD PTR DS:[EDX+48],ESI + 00515FB7 8972 4C MOV DWORD PTR DS:[EDX+4C],ESI + 00515FBA 8972 50 MOV DWORD PTR DS:[EDX+50],ESI + 00515FBD 8972 54 MOV DWORD PTR DS:[EDX+54],ESI + 00515FC0 8972 58 MOV DWORD PTR DS:[EDX+58],ESI + 00515FC3 8972 5C MOV DWORD PTR DS:[EDX+5C],ESI + 00515FC6 8972 60 MOV DWORD PTR DS:[EDX+60],ESI + 00515FC9 C642 23 01 MOV BYTE PTR DS:[EDX+23],1 + 00515FCD 8B8B 28010000 MOV ECX,DWORD PTR DS:[EBX+128] + 00515FD3 81E1 FFFF0000 AND ECX,0FFFF + 00515FD9 C1E1 05 SHL ECX,5 + 00515FDC 8B4C01 14 MOV ECX,DWORD PTR DS:[ECX+EAX+14] + 00515FE0 8B49 64 MOV ECX,DWORD PTR DS:[ECX+64] + 00515FE3 894A 28 MOV DWORD PTR DS:[EDX+28],ECX + 00515FE6 8B4C24 14 MOV ECX,DWORD PTR SS:[ESP+14];2nd parameter + 00515FEA 894A 2C MOV DWORD PTR DS:[EDX+2C],ECX + 00515FED C742 30 0000803F MOV DWORD PTR DS:[EDX+30],3F800000 + 00515FF4 8B8B 38010000 MOV ECX,DWORD PTR DS:[EBX+138] + 00515FFA 81E1 FFFF0000 AND ECX,0FFFF + 00516000 C1E1 05 SHL ECX,5 + 00516003 8B4401 14 MOV EAX,DWORD PTR DS:[ECX+EAX+14] + 00516007 8B48 64 MOV ECX,DWORD PTR DS:[EAX+64] + 0051600A 894A 34 MOV DWORD PTR DS:[EDX+34],ECX + 0051600D 5F POP EDI + 0051600E 5B POP EBX + 0051600F 5E POP ESI + 00516010 C3 RETN +<- +004840EB 83C4 08 ADD ESP,8 + +004840EE 8BCE MOV ECX,ESI +004840F0 33C0 XOR EAX,EAX +004840F2 5E POP ESI +004840F3 E9 98920000 JMP haloce.0048D390 +004840F8 5E POP ESI +004840F9 C3 RETN + +;halo campaign map: c10 +; cinematic_screen_effect_set_video(2, 2.0) +; cinematic_screen_effect_set_video(1, 2.0) +; cinematic_screen_effect_set_video(1, 2.0) \ No newline at end of file diff --git a/halo notes/cinematic_screen_effect_start.asm b/halo notes/cinematic_screen_effect_start.asm new file mode 100644 index 0000000..fdfb851 --- /dev/null +++ b/halo notes/cinematic_screen_effect_start.asm @@ -0,0 +1,223 @@ +;notes by Jesus7Freak +;haloce1.09 p0 rpg_beta6_2 +;console 004C9BE3 + +...1 ;inspect +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F5DD8 haloce.0048C8D0 +...2 ;cinematic_screen_effect_start +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F8DD4 haloce.00483F10 +...3 ;cinematic_screen_effect_start +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F8DD4 haloce.00483F10 +...4 ;inspect +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F5DD8 haloce.0048C8D0 + + +...2 +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F8DD4 haloce.00483F10 + +00483F10 0FBF4424 04 MOVSX EAX,WORD PTR SS:[ESP+4] +00483F15 8B0485 18416200 MOV EAX,DWORD PTR DS:[EAX*4+624118] +00483F1C 8B4C24 0C MOV ECX,DWORD PTR SS:[ESP+C] +00483F20 56 PUSH ESI +00483F21 8B7424 0C MOV ESI,DWORD PTR SS:[ESP+C] +00483F25 51 PUSH ECX +00483F26 8D50 1C LEA EDX,DWORD PTR DS:[EAX+1C] +00483F29 0FBF40 1A MOVSX EAX,WORD PTR DS:[EAX+1A] +00483F2D 52 PUSH EDX +00483F2E 50 PUSH EAX +00483F2F 56 PUSH ESI +00483F30 E8 6B960000 CALL haloce.0048D5A0 +00483F35 83C4 10 ADD ESP,10 +00483F38 85C0 TEST EAX,EAX ;EAX=00000000 +00483F3A 74 35 JE SHORT haloce.00483F71 +;00483F3C 8B15 7C826B00 MOV EDX,DWORD PTR DS:[6B827C] +;00483F42 85D2 TEST EDX,EDX +;00483F44 74 21 JE SHORT haloce.00483F67 +;00483F46 8038 00 CMP BYTE PTR DS:[EAX],0 +;00483F49 75 07 JNZ SHORT haloce.00483F52 +;00483F4B 8A42 39 MOV AL,BYTE PTR DS:[EDX+39] +;00483F4E 84C0 TEST AL,AL +;00483F50 75 11 JNZ SHORT haloce.00483F63 +;00483F52 57 PUSH EDI +;00483F53 B9 0E000000 MOV ECX,0E +;00483F58 33C0 XOR EAX,EAX +;00483F5A 8BFA MOV EDI,EDX +;00483F5C F3:AB REP STOS DWORD PTR ES:[EDI] +;00483F5E C642 39 01 MOV BYTE PTR DS:[EDX+39],1 +;00483F62 5F POP EDI +;00483F63 C642 38 01 MOV BYTE PTR DS:[EDX+38],1 +;00483F67 8BCE MOV ECX,ESI +;00483F69 33C0 XOR EAX,EAX +;00483F6B 5E POP ESI +;00483F6C E9 1F940000 JMP haloce.0048D390 +00483F71 5E POP ESI +00483F72 C3 RETN + +...3 +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F8DD4 haloce.00483F10 + +00483F10 0FBF4424 04 MOVSX EAX,WORD PTR SS:[ESP+4] ;->EAX=000001A6 +00483F15 8B0485 18416200 MOV EAX,DWORD PTR DS:[EAX*4+624118] ;->EAX=005F8DD4 +00483F1C 8B4C24 0C MOV ECX,DWORD PTR SS:[ESP+C] ;->ECX=403D9900 +00483F20 56 PUSH ESI +00483F21 8B7424 0C MOV ESI,DWORD PTR SS:[ESP+C] ;->ESI=F373000A +00483F25 51 PUSH ECX +00483F26 8D50 1C LEA EDX,DWORD PTR DS:[EAX+1C] ;->EDX=005F8DF0 +00483F29 0FBF40 1A MOVSX EAX,WORD PTR DS:[EAX+1A] ;->EAX=00000001 + +00483F2D 52 PUSH EDX ;005F8DF0 +00483F2E 50 PUSH EAX ;00000001 +00483F2F 56 PUSH ESI ;F373000A +00483F30 E8 6B960000 CALL haloce.0048D5A0 +00483F35 83C4 10 ADD ESP,10 + +00483F38 85C0 TEST EAX,EAX ;->EAX=403D9A3A +00483F3A 74 35 JE SHORT haloce.00483F71 +00483F3C 8B15 7C826B00 MOV EDX,DWORD PTR DS:[6B827C] ;->EDX=4000015C +00483F42 85D2 TEST EDX,EDX +00483F44 74 21 JE SHORT haloce.00483F67 +00483F46 8038 00 CMP BYTE PTR DS:[EAX],0 ;[EAX]=01 +00483F49 75 07 JNZ SHORT haloce.00483F52 +;00483F4B 8A42 39 MOV AL,BYTE PTR DS:[EDX+39] +;00483F4E 84C0 TEST AL,AL +;00483F50 75 11 JNZ SHORT haloce.00483F63 +00483F52 57 PUSH EDI +00483F53 B9 0E000000 MOV ECX,0E ;(14) +00483F58 33C0 XOR EAX,EAX +00483F5A 8BFA MOV EDI,EDX ;->EDI=4000015C +00483F5C F3:AB REP STOS DWORD PTR ES:[EDI] + ;ECX=0000000E (decimal 14.) + ;EAX=00000000 + ;ES:[EDI]=[4000015C]=00000000 + + ;ECX=0000000D (decimal 13.) + ;EAX=00000000 + ;ES:[EDI]=[40000160]=00000000 + + ;ECX=0000000C (decimal 12.) + ;EAX=00000000 + ;ES:[EDI]=[40000164]=00000000 + + ;ECX=0000000B (decimal 11.) + ;EAX=00000000 + ;ES:[EDI]=[40000168]=00000000 + + ;ECX=0000000A (decimal 10.) + ;EAX=00000000 + ;ES:[EDI]=[4000016C]=00000000 + + ;ECX=00000009 (decimal 9.) + ;EAX=00000000 + ;ES:[EDI]=[40000170]=00000000 + + ;ECX=00000008 (decimal 8.) + ;EAX=00000000 + ;ES:[EDI]=[40000174]=00000000 + + ;ECX=00000007 (decimal 7.) + ;EAX=00000000 + ;ES:[EDI]=[40000178]=00000000 + + ;ECX=00000006 (decimal 6.) + ;EAX=00000000 + ;ES:[EDI]=[4000017C]=00000000 + + ;ECX=00000005 (decimal 5.) + ;EAX=00000000 + ;ES:[EDI]=[40000180]=00000000 + + ;ECX=00000004 (decimal 4.) + ;EAX=00000000 + ;ES:[EDI]=[40000184]=00000000 + + ;ECX=00000003 (decimal 3.) + ;EAX=00000000 + ;ES:[EDI]=[40000188]=00000000 + + ;ECX=00000002 (decimal 2.) + ;EAX=00000000 + ;ES:[EDI]=[4000018C]=00000000 + + ;ECX=00000001 (decimal 1.) + ;EAX=00000000 + ;ES:[EDI]=[40000190]=00000000 + + +00483F5E C642 39 01 MOV BYTE PTR DS:[EDX+39],1 ;DS:[40000195]=00 -> 01 +00483F62 5F POP EDI +00483F63 C642 38 01 MOV BYTE PTR DS:[EDX+38],1 ;DS:[40000194]=00 -> 01 +00483F67 8BCE MOV ECX,ESI +00483F69 33C0 XOR EAX,EAX +00483F6B 5E POP ESI +00483F6C E9 1F940000 JMP haloce.0048D390 +;00483F71 5E POP ESI +;00483F72 C3 RETN +... +0048D390 81E1 FFFF0000 AND ECX,0FFFF +0048D396 56 PUSH ESI +0048D397 8BF1 MOV ESI,ECX +0048D399 8B0D B0558100 MOV ECX,DWORD PTR DS:[8155B0] +0048D39F 69F6 18020000 IMUL ESI,ESI,218 +0048D3A5 57 PUSH EDI +0048D3A6 8B79 34 MOV EDI,DWORD PTR DS:[ECX+34] +0048D3A9 8B5437 10 MOV EDX,DWORD PTR DS:[EDI+ESI+10] +0048D3AD 8B4A 04 MOV ECX,DWORD PTR DS:[EDX+4] +0048D3B0 8B15 B4558100 MOV EDX,DWORD PTR DS:[8155B4] +0048D3B6 8B52 34 MOV EDX,DWORD PTR DS:[EDX+34] +0048D3B9 03FE ADD EDI,ESI +0048D3BB 81E1 FFFF0000 AND ECX,0FFFF +0048D3C1 8D0C89 LEA ECX,DWORD PTR DS:[ECX+ECX*4] +0048D3C4 8D0C8A LEA ECX,DWORD PTR DS:[EDX+ECX*4] +0048D3C7 F641 06 02 TEST BYTE PTR DS:[ECX+6],2 +0048D3CB 0FBF51 02 MOVSX EDX,WORD PTR DS:[ECX+2] +0048D3CF 75 0C JNZ SHORT haloce.0048D3DD +0048D3D1 8B1495 18416200 MOV EDX,DWORD PTR DS:[EDX*4+624118] +0048D3D8 66:8B12 MOV DX,WORD PTR DS:[EDX] +0048D3DB EB 16 JMP SHORT haloce.0048D3F3 +0048D3DD 6BD2 5C IMUL EDX,EDX,5C +0048D3E0 53 PUSH EBX +0048D3E1 8B1D 6C226E00 MOV EBX,DWORD PTR DS:[6E226C] +0048D3E7 8B9B A0040000 MOV EBX,DWORD PTR DS:[EBX+4A0] +0048D3ED 66:8B541A 22 MOV DX,WORD PTR DS:[EDX+EBX+22] +0048D3F2 5B POP EBX +0048D3F3 66:8B49 04 MOV CX,WORD PTR DS:[ECX+4] +0048D3F7 66:3BD1 CMP DX,CX +0048D3FA 74 47 JE SHORT haloce.0048D443 +0048D3FC 66:83FA 03 CMP DX,3 +0048D400 74 41 JE SHORT haloce.0048D443 +0048D402 66:83F9 2B CMP CX,2B +0048D406 7C 06 JL SHORT haloce.0048D40E +0048D408 66:83F9 30 CMP CX,30 +0048D40C 7E 35 JLE SHORT haloce.0048D443 +0048D40E 66:83F9 25 CMP CX,25 +0048D412 7C 19 JL SHORT haloce.0048D42D +0048D414 66:83F9 2A CMP CX,2A +0048D418 7F 13 JG SHORT haloce.0048D42D +0048D41A 66:83FA 2B CMP DX,2B +0048D41E 7C 23 JL SHORT haloce.0048D443 +0048D420 66:83FA 30 CMP DX,30 +0048D424 7F 1D JG SHORT haloce.0048D443 +0048D426 E8 25DC0600 CALL haloce.004FB050 +0048D42B EB 16 JMP SHORT haloce.0048D443 +0048D42D 0FBFC9 MOVSX ECX,CX +0048D430 6BC9 31 IMUL ECX,ECX,31 +0048D433 0FBFD2 MOVSX EDX,DX +0048D436 03CA ADD ECX,EDX +0048D438 50 PUSH EAX +0048D439 FF148D 00726200 CALL DWORD PTR DS:[ECX*4+627200] +0048D440 83C4 04 ADD ESP,4 +0048D443 8B4F 10 MOV ECX,DWORD PTR DS:[EDI+10] +0048D446 8B11 MOV EDX,DWORD PTR DS:[ECX] +0048D448 8B4A 08 MOV ECX,DWORD PTR DS:[EDX+8] +0048D44B 8B15 B0558100 MOV EDX,DWORD PTR DS:[8155B0] +0048D451 8901 MOV DWORD PTR DS:[ECX],EAX +0048D453 8B42 34 MOV EAX,DWORD PTR DS:[EDX+34] +0048D456 8B4C30 10 MOV ECX,DWORD PTR DS:[EAX+ESI+10] +0048D45A 8B11 MOV EDX,DWORD PTR DS:[ECX] +0048D45C 03C6 ADD EAX,ESI +0048D45E 5F POP EDI +0048D45F 8950 10 MOV DWORD PTR DS:[EAX+10],EDX +0048D462 5E POP ESI +0048D463 C3 RETN + + diff --git a/halo notes/cinematic_screen_effect_stop.asm b/halo notes/cinematic_screen_effect_stop.asm new file mode 100644 index 0000000..c2efd77 --- /dev/null +++ b/halo notes/cinematic_screen_effect_stop.asm @@ -0,0 +1,23 @@ +;notes by Jesus7Freak +;haloce1.09 p0 rpg_beta6_2 +;console 004C9BE3 + +...1 ;inspect +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F5DD8 haloce.0048C8D0 +...2 ;cinematic_screen_effect_stop +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F8E88 haloce.00484100 +...3 ;inspect +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F5DD8 haloce.0048C8D0 + +...2 +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F8E88 haloce.00484100 + +00484100 A1 7C826B00 MOV EAX,DWORD PTR DS:[6B827C] ;->EAX=4000015C +00484105 85C0 TEST EAX,EAX +00484107 74 04 JE SHORT haloce.0048410D +00484109 C640 38 00 MOV BYTE PTR DS:[EAX+38],0 ;DS:[40000194]=00 -> 00 + +0048410D 8B4C24 08 MOV ECX,DWORD PTR SS:[ESP+8] ;-> ECX=F373000A +00484111 33C0 XOR EAX,EAX +00484113 E9 78920000 JMP haloce.0048D390 + diff --git a/halo notes/cls.asm b/halo notes/cls.asm new file mode 100644 index 0000000..b625ffa --- /dev/null +++ b/halo notes/cls.asm @@ -0,0 +1,288 @@ +;notes by Jesus7Freak +;haloce1.09 ui +;console 004C9BE3 + +...1 ;inspect +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F5DD8 haloce.0048C8D0 +...2 ;cls +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F969C haloce.004853A0 +...3 ;inspect +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F5DD8 haloce.0048C8D0 + + + +...2 ;cls +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F969C haloce.004853A0 +-> +004853A0 A0 4CDE6400 MOV AL,BYTE PTR DS:[64DE4C] ;AL=01 +004853A5 84C0 TEST AL,AL +004853A7 74 21 JE SHORT haloce.004853CA +004853A9 B8 FFFFFFFF MOV EAX,-1 +004853AE 56 PUSH ESI +004853AF 8B35 50DE6400 MOV ESI,DWORD PTR DS:[64DE50] ;"terminal output"->ESI=0C076918 +004853B5 A3 54DE6400 MOV DWORD PTR DS:[64DE54],EAX ;EAX=FFFFFFFF DS:[0064DE54]=E5760002 +004853BA A3 58DE6400 MOV DWORD PTR DS:[64DE58],EAX ;EAX=FFFFFFFF DS:[0064DE58]=E5740000 +;clears terminal output (invalidates items as well) +004853BF E8 FCE60400 CALL haloce.004D3AC0 +-> + 004D3AC0 57 PUSH EDI + 004D3AC1 6A 02 PUSH 2 + 004D3AC3 8D7E 32 LEA EDI,DWORD PTR DS:[ESI+32] ;->EDI=0C07694A + 004D3AC6 56 PUSH ESI + 004D3AC7 57 PUSH EDI + 004D3AC8 66:C746 2E 0000 MOV WORD PTR DS:[ESI+2E],0 + 004D3ACE 66:C746 30 0000 MOV WORD PTR DS:[ESI+30],0 + 004D3AD4 66:C746 2C 0000 MOV WORD PTR DS:[ESI+2C],0 + 004D3ADA E8 01540F00 CALL haloce.005C8EE0 + -> + 005C8EE0 8B4C24 0C MOV ECX,DWORD PTR SS:[ESP+C] ;->ECX=00000002 + 005C8EE4 57 PUSH EDI + 005C8EE5 85C9 TEST ECX,ECX + 005C8EE7 0F84 92000000 JE haloce.005C8F7F + 005C8EED 56 PUSH ESI + 005C8EEE 53 PUSH EBX + 005C8EEF 8BD9 MOV EBX,ECX ;->EBX=00000002 + 005C8EF1 8B7424 14 MOV ESI,DWORD PTR SS:[ESP+14] ;->ESI=0CFD64E8 "terminal output" + 005C8EF5 F7C6 03000000 TEST ESI,3 + 005C8EFB 8B7C24 10 MOV EDI,DWORD PTR SS:[ESP+10] ;->EDI=0CFD651A + 005C8EFF 75 0B JNZ SHORT haloce.005C8F0C + 005C8F01 C1E9 02 SHR ECX,2 ;->ECX=00000000 + 005C8F04 0F85 85000000 JNZ haloce.005C8F8F + 005C8F0A EB 27 JMP SHORT haloce.005C8F33 + ;005C8F0C 8A06 MOV AL,BYTE PTR DS:[ESI] + ;005C8F0E 83C6 01 ADD ESI,1 + ;005C8F11 8807 MOV BYTE PTR DS:[EDI],AL + ;005C8F13 83C7 01 ADD EDI,1 + ;005C8F16 83E9 01 SUB ECX,1 + ;005C8F19 74 2B JE SHORT haloce.005C8F46 + ;005C8F1B 84C0 TEST AL,AL + ;005C8F1D 74 2F JE SHORT haloce.005C8F4E + ;005C8F1F F7C6 03000000 TEST ESI,3 + ;005C8F25 ^75 E5 JNZ SHORT haloce.005C8F0C + ;005C8F27 8BD9 MOV EBX,ECX + ;005C8F29 C1E9 02 SHR ECX,2 + ;005C8F2C 75 61 JNZ SHORT haloce.005C8F8F + ;005C8F2E 83E3 03 AND EBX,3 + ;005C8F31 74 13 JE SHORT haloce.005C8F46 + 005C8F33 8A06 MOV AL,BYTE PTR DS:[ESI] ;->AL=74 't' + 005C8F35 83C6 01 ADD ESI,1 ;"erminal output" ->ESI=0CFD64E9 + 005C8F38 8807 MOV BYTE PTR DS:[EDI],AL + 005C8F3A 83C7 01 ADD EDI,1 + 005C8F3D 84C0 TEST AL,AL + 005C8F3F 74 37 JE SHORT haloce.005C8F78 + 005C8F41 83EB 01 SUB EBX,1 ;->EBX=00000001 + 005C8F44 ^75 ED JNZ SHORT haloce.005C8F33 + 005C8F46 8B4424 10 MOV EAX,DWORD PTR SS:[ESP+10] ; 'te'->EAX=0CFD651A + 005C8F4A 5B POP EBX + 005C8F4B 5E POP ESI + 005C8F4C 5F POP EDI + 005C8F4D C3 RETN + ;005C8F4E F7C7 03000000 TEST EDI,3 + ;005C8F54 74 16 JE SHORT haloce.005C8F6C + ;005C8F56 8807 MOV BYTE PTR DS:[EDI],AL + ;005C8F58 83C7 01 ADD EDI,1 + ;005C8F5B 83E9 01 SUB ECX,1 + ;005C8F5E 0F84 98000000 JE haloce.005C8FFC + ;005C8F64 F7C7 03000000 TEST EDI,3 + ;005C8F6A ^75 EA JNZ SHORT haloce.005C8F56 + ;005C8F6C 8BD9 MOV EBX,ECX + ;005C8F6E C1E9 02 SHR ECX,2 + ;005C8F71 75 74 JNZ SHORT haloce.005C8FE7 + ;005C8F73 8807 MOV BYTE PTR DS:[EDI],AL + ;005C8F75 83C7 01 ADD EDI,1 + ;005C8F78 83EB 01 SUB EBX,1 + ;005C8F7B ^75 F6 JNZ SHORT haloce.005C8F73 + ;005C8F7D 5B POP EBX + ;005C8F7E 5E POP ESI + ;005C8F7F 8B4424 08 MOV EAX,DWORD PTR SS:[ESP+8] + ;005C8F83 5F POP EDI + ;005C8F84 C3 RETN + ;005C8F85 8917 MOV DWORD PTR DS:[EDI],EDX + ;005C8F87 83C7 04 ADD EDI,4 + ;005C8F8A 83E9 01 SUB ECX,1 + ;005C8F8D ^74 9F JE SHORT haloce.005C8F2E + ;005C8F8F BA FFFEFE7E MOV EDX,7EFEFEFF + ;005C8F94 8B06 MOV EAX,DWORD PTR DS:[ESI] + ;005C8F96 03D0 ADD EDX,EAX + ;005C8F98 83F0 FF XOR EAX,FFFFFFFF + ;005C8F9B 33C2 XOR EAX,EDX + ;005C8F9D 8B16 MOV EDX,DWORD PTR DS:[ESI] + ;005C8F9F 83C6 04 ADD ESI,4 + ;005C8FA2 A9 00010181 TEST EAX,81010100 + ;005C8FA7 ^74 DC JE SHORT haloce.005C8F85 + ;005C8FA9 84D2 TEST DL,DL + ;005C8FAB 74 2C JE SHORT haloce.005C8FD9 + ;005C8FAD 84F6 TEST DH,DH + ;005C8FAF 74 1E JE SHORT haloce.005C8FCF + ;005C8FB1 F7C2 0000FF00 TEST EDX,0FF0000 + ;005C8FB7 74 0C JE SHORT haloce.005C8FC5 + ;005C8FB9 F7C2 000000FF TEST EDX,FF000000 + ;005C8FBF ^75 C4 JNZ SHORT haloce.005C8F85 + ;005C8FC1 8917 MOV DWORD PTR DS:[EDI],EDX + ;005C8FC3 EB 18 JMP SHORT haloce.005C8FDD + ;005C8FC5 81E2 FFFF0000 AND EDX,0FFFF + ;005C8FCB 8917 MOV DWORD PTR DS:[EDI],EDX + ;005C8FCD EB 0E JMP SHORT haloce.005C8FDD + ;005C8FCF 81E2 FF000000 AND EDX,0FF + ;005C8FD5 8917 MOV DWORD PTR DS:[EDI],EDX + ;005C8FD7 EB 04 JMP SHORT haloce.005C8FDD + ;005C8FD9 33D2 XOR EDX,EDX + ;005C8FDB 8917 MOV DWORD PTR DS:[EDI],EDX + ;005C8FDD 83C7 04 ADD EDI,4 + ;005C8FE0 33C0 XOR EAX,EAX + ;005C8FE2 83E9 01 SUB ECX,1 + ;005C8FE5 74 0C JE SHORT haloce.005C8FF3 + ;005C8FE7 33C0 XOR EAX,EAX + ;005C8FE9 8907 MOV DWORD PTR DS:[EDI],EAX + ;005C8FEB 83C7 04 ADD EDI,4 + ;005C8FEE 83E9 01 SUB ECX,1 + ;005C8FF1 ^75 F6 JNZ SHORT haloce.005C8FE9 + ;005C8FF3 83E3 03 AND EBX,3 + ;005C8FF6 ^0F85 77FFFFFF JNZ haloce.005C8F73 + ;005C8FFC 8B4424 10 MOV EAX,DWORD PTR SS:[ESP+10] + ;005C9000 5B POP EBX + ;005C9001 5E POP ESI + ;005C9002 5F POP EDI + ;005C9003 C3 RETN + <- + 004D3ADF 66:810F 0080 OR WORD PTR DS:[EDI],8000 + 004D3AE4 83C4 0C ADD ESP,0C + 004D3AE7 33C0 XOR EAX,EAX + 004D3AE9 66:3946 20 CMP WORD PTR DS:[ESI+20],AX + 004D3AED 5F POP EDI + 004D3AEE 7E 1A JLE SHORT haloce.004D3B0A + 004D3AF0 0FBF4E 22 MOVSX ECX,WORD PTR DS:[ESI+22] + 004D3AF4 0FBFD0 MOVSX EDX,AX + 004D3AF7 0FAFCA IMUL ECX,EDX + 004D3AFA 8B56 34 MOV EDX,DWORD PTR DS:[ESI+34] + 004D3AFD 40 INC EAX + 004D3AFE 66:C70411 0000 MOV WORD PTR DS:[ECX+EDX],0 + 004D3B04 66:3B46 20 CMP AX,WORD PTR DS:[ESI+20] + 004D3B08 ^7C E6 JL SHORT haloce.004D3AF0 + 004D3B0A C3 RETN +<- +;only for dedicated server that runs in console? +004853C4 E8 F74C0100 CALL haloce.0049A0C0 +-> + 0049A0C0 A0 68DE6400 MOV AL,BYTE PTR DS:[64DE68] ;140 + 0049A0C5 83EC 20 SUB ESP,20 ;120 + 0049A0C8 84C0 TEST AL,AL + 0049A0CA 74 6C JE SHORT haloce.0049A138 + 0049A0CC 8B0D 20DD6400 MOV ECX,DWORD PTR DS:[64DD20] ;hConsoleOutput + 0049A0D2 8D4424 08 LEA EAX,DWORD PTR SS:[ESP+8] ;128 + 0049A0D6 50 PUSH EAX ;lpConsoleScreenBufferInfo + 0049A0D7 51 PUSH ECX ;hConsoleOutput + 0049A0D8 66:C74424 08 0000 MOV WORD PTR SS:[ESP+8],0 ;120 + 0049A0DF 66:C74424 0A 0000 MOV WORD PTR SS:[ESP+A],0 ;122 + ;Retrieves information about the specified console screen buffer. + 0049A0E6 FF15 00F15D00 CALL DWORD PTR DS:[<&KERNEL32.GetConsole>; kernel32.GetConsoleScreenBufferInfo + + 0049A0EC 85C0 TEST EAX,EAX + 0049A0EE 74 48 JE SHORT haloce.0049A138 + 0049A0F0 0FBF5424 08 MOVSX EDX,WORD PTR SS:[ESP+8] ;128 + 0049A0F5 8B0D 20DD6400 MOV ECX,DWORD PTR DS:[64DD20] + 0049A0FB 56 PUSH ESI ;11C + 0049A0FC 0FBF7424 0E MOVSX ESI,WORD PTR SS:[ESP+E] ;12A + 0049A101 57 PUSH EDI ;118 + 0049A102 0FAFF2 IMUL ESI,EDX + 0049A105 8B7C24 08 MOV EDI,DWORD PTR SS:[ESP+8] ;120 + 0049A109 8D4424 0C LEA EAX,DWORD PTR SS:[ESP+C] ;124 + 0049A10D 50 PUSH EAX ;lpNumberOfCharsWritten + 0049A10E 57 PUSH EDI ;dwWriteCoord + 0049A10F 56 PUSH ESI ;nLength + 0049A110 6A 20 PUSH 20 ;cCharacter 20h=' ' + 0049A112 51 PUSH ECX ;hConsoleOutput + ;Writes a character to the console screen buffer a specified number of times, beginning at the specified coordinates. + 0049A113 FF15 E4F05D00 CALL DWORD PTR DS:[<&KERNEL32.FillConsol>; kernel32.FillConsoleOutputCharacterA + 0049A119 85C0 TEST EAX,EAX + 0049A11B 74 19 JE SHORT haloce.0049A136 + 0049A11D 8B4424 18 MOV EAX,DWORD PTR SS:[ESP+18] ;130 + 0049A121 8B0D 20DD6400 MOV ECX,DWORD PTR DS:[64DD20] + 0049A127 8D5424 0C LEA EDX,DWORD PTR SS:[ESP+C] ;124 + 0049A12B 52 PUSH EDX ;lpNumberOfCharsWritten + 0049A12C 57 PUSH EDI ;dwWriteCoord + 0049A12D 56 PUSH ESI ;nLength + 0049A12E 50 PUSH EAX ;wAttribute + 0049A12F 51 PUSH ECX ;hConsoleOutput + ;Sets the character attributes for a specified number of character cells, beginning at the specified coordinates in a screen buffer. + 0049A130 FF15 08F15D00 CALL DWORD PTR DS:[<&KERNEL32.FillConsol>; kernel32.FillConsoleOutputAttribute + 0049A136 5F POP EDI ;11C + 0049A137 5E POP ESI ;120 + 0049A138 83C4 20 ADD ESP,20 ;140 + 0049A13B C3 RETN +<- +004853C9 5E POP ESI +004853CA 8B4C24 08 MOV ECX,DWORD PTR SS:[ESP+8] +004853CE 33C0 XOR EAX,EAX +004853D0 E9 BB7F0000 JMP haloce.0048D390 +... + +0048D390 81E1 FFFF0000 AND ECX,0FFFF +0048D396 56 PUSH ESI +0048D397 8BF1 MOV ESI,ECX +0048D399 8B0D B0558100 MOV ECX,DWORD PTR DS:[8155B0] +0048D39F 69F6 18020000 IMUL ESI,ESI,218 +0048D3A5 57 PUSH EDI +0048D3A6 8B79 34 MOV EDI,DWORD PTR DS:[ECX+34] +0048D3A9 8B5437 10 MOV EDX,DWORD PTR DS:[EDI+ESI+10] +0048D3AD 8B4A 04 MOV ECX,DWORD PTR DS:[EDX+4] +0048D3B0 8B15 B4558100 MOV EDX,DWORD PTR DS:[8155B4] +0048D3B6 8B52 34 MOV EDX,DWORD PTR DS:[EDX+34] +0048D3B9 03FE ADD EDI,ESI +0048D3BB 81E1 FFFF0000 AND ECX,0FFFF +0048D3C1 8D0C89 LEA ECX,DWORD PTR DS:[ECX+ECX*4] +0048D3C4 8D0C8A LEA ECX,DWORD PTR DS:[EDX+ECX*4] +0048D3C7 F641 06 02 TEST BYTE PTR DS:[ECX+6],2 +0048D3CB 0FBF51 02 MOVSX EDX,WORD PTR DS:[ECX+2] +0048D3CF 75 0C JNZ SHORT haloce.0048D3DD +0048D3D1 8B1495 18416200 MOV EDX,DWORD PTR DS:[EDX*4+624118] +0048D3D8 66:8B12 MOV DX,WORD PTR DS:[EDX] +0048D3DB EB 16 JMP SHORT haloce.0048D3F3 +0048D3DD 6BD2 5C IMUL EDX,EDX,5C +0048D3E0 53 PUSH EBX +0048D3E1 8B1D 6C226E00 MOV EBX,DWORD PTR DS:[6E226C] +0048D3E7 8B9B A0040000 MOV EBX,DWORD PTR DS:[EBX+4A0] +0048D3ED 66:8B541A 22 MOV DX,WORD PTR DS:[EDX+EBX+22] +0048D3F2 5B POP EBX +0048D3F3 66:8B49 04 MOV CX,WORD PTR DS:[ECX+4] +0048D3F7 66:3BD1 CMP DX,CX +0048D3FA 74 47 JE SHORT haloce.0048D443 +0048D3FC 66:83FA 03 CMP DX,3 +0048D400 74 41 JE SHORT haloce.0048D443 +0048D402 66:83F9 2B CMP CX,2B +0048D406 7C 06 JL SHORT haloce.0048D40E +0048D408 66:83F9 30 CMP CX,30 +0048D40C 7E 35 JLE SHORT haloce.0048D443 +0048D40E 66:83F9 25 CMP CX,25 +0048D412 7C 19 JL SHORT haloce.0048D42D +0048D414 66:83F9 2A CMP CX,2A +0048D418 7F 13 JG SHORT haloce.0048D42D +0048D41A 66:83FA 2B CMP DX,2B +0048D41E 7C 23 JL SHORT haloce.0048D443 +0048D420 66:83FA 30 CMP DX,30 +0048D424 7F 1D JG SHORT haloce.0048D443 +0048D426 E8 25DC0600 CALL haloce.004FB050 +0048D42B EB 16 JMP SHORT haloce.0048D443 +0048D42D 0FBFC9 MOVSX ECX,CX +0048D430 6BC9 31 IMUL ECX,ECX,31 +0048D433 0FBFD2 MOVSX EDX,DX +0048D436 03CA ADD ECX,EDX +0048D438 50 PUSH EAX +0048D439 FF148D 00726200 CALL DWORD PTR DS:[ECX*4+627200] +0048D440 83C4 04 ADD ESP,4 +0048D443 8B4F 10 MOV ECX,DWORD PTR DS:[EDI+10] +0048D446 8B11 MOV EDX,DWORD PTR DS:[ECX] +0048D448 8B4A 08 MOV ECX,DWORD PTR DS:[EDX+8] +0048D44B 8B15 B0558100 MOV EDX,DWORD PTR DS:[8155B0] +0048D451 8901 MOV DWORD PTR DS:[ECX],EAX +0048D453 8B42 34 MOV EAX,DWORD PTR DS:[EDX+34] +0048D456 8B4C30 10 MOV ECX,DWORD PTR DS:[EAX+ESI+10] +0048D45A 8B11 MOV EDX,DWORD PTR DS:[ECX] +0048D45C 03C6 ADD EAX,ESI +0048D45E 5F POP EDI +0048D45F 8950 10 MOV DWORD PTR DS:[EAX+10],EDX +0048D462 5E POP ESI +0048D463 C3 RETN + + + diff --git a/halo notes/console tab.asm b/halo notes/console tab.asm new file mode 100644 index 0000000..745a54c --- /dev/null +++ b/halo notes/console tab.asm @@ -0,0 +1,413 @@ +;notes by Jesus7Freak +;haloce1.09 map=ui dev=enabled console buffer="obj" + +haloce.00624118;dev fucntion info struct array pointer +struct ;size 0x1C or 0x20 +{ + DWORD Unknown_num; 3 + char *function_name; + DWORD Unknown_function_address; + void (__cdecl *script_function_address)(int)(int script_tag)(int); //0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] + DWORD *Unknown; + BYTE *dev_relative; + WORD Unknown; + WORD num_of_parameters; + DWORD extra; +}; + + + +;displays cmds in console when tab is pressed +004C9C10 E8 9B040000 CALL haloce.004CA0B0 +-> +... + +;console buffer = "obj" +004CA103 8B0D 44CD6800 MOV ECX,DWORD PTR DS:[68CD44] +004CA109 0FBF05 D0476B00 MOVSX EAX,WORD PTR DS:[6B47D0] +004CA110 33D2 XOR EDX,EDX +004CA112 85C9 TEST ECX,ECX +004CA114 74 14 JE SHORT haloce.004CA12A +;004CA116 83F8 01 CMP EAX,1 +;004CA119 0F85 EF000000 JNZ haloce.004CA20E +;004CA11F BA 11000000 MOV EDX,11 +;004CA124 81E2 FDFF0000 AND EDX,0FFFD +004CA12A 8D8424 28040000 LEA EAX,DWORD PTR SS:[ESP+428] ;->EAX=0018D840 pointer to stack to store the string pointers +004CA131 50 PUSH EAX +004CA132 83CA 20 OR EDX,20 ;->EDX=00000020 +004CA135 6A 28 PUSH 28 ;limit? (40) string pointers, no its used for functions calling +004CA137 B9 00010000 MOV ECX,100;this may be the limit 256 strings +004CA13C 8BC3 MOV EAX,EBX;->EAX=00652028 "obj" console buffer pointer (filter string?) +004CA13E E8 9DC8FBFF CALL haloce.004869E0;copies string pointers to stack +-> + 004869E0 53 PUSH EBX ; haloce.00652028 + 004869E1 55 PUSH EBP + 004869E2 8B6C24 10 MOV EBP,DWORD PTR SS:[ESP+10];->EBX=0018D840 pointer to stack space to store string pointers + 004869E6 56 PUSH ESI + 004869E7 33F6 XOR ESI,ESI + 004869E9 3BC6 CMP EAX,ESI;valid string pointer + ;hook vars sig + ;\x57\x66\x89\x35\x00\xC4\x64\x00\x66\x89\x0D + ;xxxx????xxx + 004869EB 57 PUSH EDI + 004869EC 66:8935 00C46400 MOV WORD PTR DS:[64C400],SI;array of strings index + 004869F3 66:890D F0C36400 MOV WORD PTR DS:[64C3F0],CX;array size? + 004869FA 892D 04C46400 MOV DWORD PTR DS:[64C404],EBP;pointer to the array + 00486A00 A3 F4C36400 MOV DWORD PTR DS:[64C3F4],EAX;pointer to the filter string (ex: obj, search for functions that have obj in them) + 00486A05 75 0A JNZ SHORT haloce.00486A11 + ;00486A07 C705 F4C36400 3C365F00 MOV DWORD PTR DS:[64C3F4],haloce.005F363C + 00486A11 66:8915 FCC36400 MOV WORD PTR DS:[64C3FC],DX + 00486A18 BF 60496200 MOV EDI,haloce.00624960 ;pointer to array of functions + 00486A1D BB 12000000 MOV EBX,12 + 00486A22 8BCE /MOV ECX,ESI;->ECX=00000000 + 00486A24 B8 01000000 |MOV EAX,1 + 00486A29 D3E0 |SHL EAX,CL + 00486A2B 8B4C24 14 |MOV ECX,DWORD PTR SS:[ESP+14];->ECX=00000028 + 00486A2F 85C1 |TEST ECX,EAX + 00486A31 74 02 |JE SHORT haloce.00486A35 + 00486A33 FF17 |CALL DWORD PTR DS:[EDI];when EBX=0F, or EBX=0D + 1->;when EBX=0F + 00486611 55 PUSH EBP + 00486612 56 PUSH ESI + 00486613 57 PUSH EDI ; haloce.0062496C + 00486614 BB 18416200 MOV EBX,haloce.00624118;dev fucntion info struct array pointer + 00486619 BD 11020000 MOV EBP,211;number of console functions + 0048661E 8BFF MOV EDI,EDI + 00486620 8B33 MOV ESI,DWORD PTR DS:[EBX];->ESI=005F5B70 + 00486622 8A4E 18 MOV CL,BYTE PTR DS:[ESI+18] + 00486625 E8 16FDFFFF CALL haloce.00486340;dev check function? + -> + 00486340 8AD1 MOV DL,CL + 00486342 C0E9 03 SHR CL,3 + 00486345 56 PUSH ESI + 00486346 66:0FB6F1 MOVZX SI,CL + 0048634A 8A0D 7ED16B00 MOV CL,BYTE PTR DS:[6BD17E];dev check address + 00486350 80E2 07 AND DL,7 + 00486353 84C9 TEST CL,CL + 00486355 B0 01 MOV AL,1 + 00486357 66:0FB6D2 MOVZX DX,DL + 0048635B 0F85 87000000 JNZ haloce.004863E8 + ;00486361 8A0D FCC36400 MOV CL,BYTE PTR DS:[64C3FC] + ;00486367 F6C1 20 TEST CL,20 + ;0048636A 0FB7C2 MOVZX EAX,DX + ;0048636D 74 18 JE SHORT haloce.00486387 + ;0048636F 85C0 TEST EAX,EAX + ;00486371 7E 39 JLE SHORT haloce.004863AC + ;00486373 83F8 06 CMP EAX,6 + ;00486376 7E 6E JLE SHORT haloce.004863E6 + ;00486378 83F8 07 CMP EAX,7 + ;0048637B 75 2F JNZ SHORT haloce.004863AC + ;0048637D C0E9 03 SHR CL,3 + ;00486380 80E1 01 AND CL,1 + ;00486383 8AC1 MOV AL,CL + ;00486385 5E POP ESI + ;00486386 C3 RETN + ;00486387 48 DEC EAX ; Switch (cases 1..7) + ;00486388 83F8 06 CMP EAX,6 + ;0048638B 77 1F JA SHORT haloce.004863AC + ;0048638D FF2485 EC634800 JMP DWORD PTR DS:[EAX*4+4863EC] + ;00486394 F6C1 07 TEST CL,7 ; Case 2 of switch 00486387 + ;00486397 75 29 JNZ SHORT haloce.004863C2 + ;00486399 32C0 XOR AL,AL + ;0048639B 5E POP ESI + ;0048639C C3 RETN + ;0048639D 8AC1 MOV AL,CL ; Case 3 of switch 00486387 + ;0048639F EB 1B JMP SHORT haloce.004863BC + ;004863A1 8AC1 MOV AL,CL ; Case 4 of switch 00486387 + ;004863A3 F6D0 NOT AL + ;004863A5 EB 15 JMP SHORT haloce.004863BC + ;004863A7 F6C1 06 TEST CL,6 ; Case 5 of switch 00486387 + ;004863AA 75 16 JNZ SHORT haloce.004863C2 + ;004863AC 32C0 XOR AL,AL ; Default case of switch 004863C5 + ;004863AE 5E POP ESI + ;004863AF C3 RETN + ;004863B0 8AC1 MOV AL,CL ; Case 6 of switch 00486387 + ;004863B2 C0E8 02 SHR AL,2 + ;004863B5 EB 05 JMP SHORT haloce.004863BC + ;004863B7 8AC1 MOV AL,CL ; Case 7 of switch 00486387 + ;004863B9 C0E8 03 SHR AL,3 + ;004863BC 24 01 AND AL,1 + ;004863BE 84C0 TEST AL,AL + ;004863C0 74 26 JE SHORT haloce.004863E8 + ;004863C2 0FB7C6 MOVZX EAX,SI ; Case 1 of switch 00486387 + ;004863C5 83E8 00 SUB EAX,0 ; Switch (cases 0..2) + ;004863C8 74 1C JE SHORT haloce.004863E6 + ;004863CA 48 DEC EAX + ;004863CB 74 0D JE SHORT haloce.004863DA + ;004863CD 48 DEC EAX + ;004863CE ^75 DC JNZ SHORT haloce.004863AC + ;004863D0 C0E9 04 SHR CL,4 ; Case 2 of switch 004863C5 + ;004863D3 80E1 01 AND CL,1 + ;004863D6 8AC1 MOV AL,CL + ;004863D8 5E POP ESI + ;004863D9 C3 RETN + ;004863DA C0E9 04 SHR CL,4 ; Case 1 of switch 004863C5 + ;004863DD F6D1 NOT CL + ;004863DF 80E1 01 AND CL,1 + ;004863E2 8AC1 MOV AL,CL + ;004863E4 5E POP ESI + ;004863E5 C3 RETN + ;004863E6 B0 01 MOV AL,1 ; Case 0 of switch 004863C5 + 004863E8 5E POP ESI + 004863E9 C3 RETN + <- + 0048662A 84C0 TEST AL,AL;AL=01 + 0048662C 74 54 JE SHORT haloce.00486682 + 0048662E 66:A1 00C46400 MOV AX,WORD PTR DS:[64C400];->AX=0000 + 00486634 66:3B05 F0C36400 CMP AX,WORD PTR DS:[64C3F0];[64C3F0]=0100 ;index within array bounds? + 0048663B 8B76 04 MOV ESI,DWORD PTR DS:[ESI+4];->ESI=006048EC "begin" + 0048663E 7D 42 JGE SHORT haloce.00486682 + 00486640 8B15 F4C36400 MOV EDX,DWORD PTR DS:[64C3F4]; haloce.00652028 (console buffer) "obj" + 00486646 8BC2 MOV EAX,EDX ;->EAX=00652028 "obj" + 00486648 8D78 01 LEA EDI,DWORD PTR DS:[EAX+1];EDI=00652029 "bj" + 0048664B EB 03 JMP SHORT haloce.00486650 + ;0048664D 8D49 00 LEA ECX,DWORD PTR DS:[ECX] + + 00486650 8A08 MOV CL,BYTE PTR DS:[EAX];->CL=6F + 00486652 40 INC EAX + 00486653 84C9 TEST CL,CL;test format string + 00486655 ^75 F9 JNZ SHORT haloce.00486650 + + 00486657 2BC7 SUB EAX,EDI;EAX=00000003 + + 00486659 50 PUSH EAX;format str length + 0048665A 52 PUSH EDX;format str + 0048665B 56 PUSH ESI;cmd str + 0048665C E8 8C621500 CALL haloce.005DC8ED + 00486661 83C4 0C ADD ESP,0C + + 00486664 85C0 TEST EAX,EAX;FFFFFFF3 (-13) + 00486666 75 1A JNZ SHORT haloce.00486682 + ;when match is found + 00486668 66:A1 00C46400 MOV AX,WORD PTR DS:[64C400];index to the string array + 0048666E 8B15 04C46400 MOV EDX,DWORD PTR DS:[64C404];pointer to the stack, were the matching strings are stored + 00486674 0FBFC8 MOVSX ECX,AX + 00486677 66:40 INC AX + 00486679 89348A MOV DWORD PTR DS:[EDX+ECX*4],ESI + 0048667C 66:A3 00C46400 MOV WORD PTR DS:[64C400],AX + + 00486682 83C3 04 ADD EBX,4 ;next cmd struct in array + 00486685 4D DEC EBP ;cmds left + 00486686 ^75 98 JNZ SHORT haloce.00486620 + + 00486688 5F POP EDI + 00486689 5E POP ESI + 0048668A 5D POP EBP + 0048668B 5B POP EBX + 0048668C C3 RETN + <- + 2->;when EBX=0D + 004866C0 53 PUSH EBX + 004866C1 55 PUSH EBP + 004866C2 56 PUSH ESI + 004866C3 57 PUSH EDI + 004866C4 BB 88696200 MOV EBX,haloce.00626988;rasterizer functions + 004866C9 BD EC010000 MOV EBP,1EC ;num of rasterizer functions? + 004866CE 8BFF MOV EDI,EDI + 004866D0 8B33 MOV ESI,DWORD PTR DS:[EBX];->ESI=00624C28 + + 004866D2 8A4E 0C MOV CL,BYTE PTR DS:[ESI+C];->CL=00 + 004866D5 E8 66FCFFFF CALL haloce.00486340;dev check function? (dev is enabled) + + 004866DA 84C0 TEST AL,AL;AL=01 + 004866DC 74 54 JE SHORT haloce.00486732 + 004866DE 66:A1 00C46400 MOV AX,WORD PTR DS:[64C400];index ->AX=001E + 004866E4 66:3B05 F0C36400 CMP AX,WORD PTR DS:[64C3F0];[64C3F0]=0100 max num of strings? + 004866EB 8B36 MOV ESI,DWORD PTR DS:[ESI] + 004866ED 7D 43 JGE SHORT haloce.00486732 + 004866EF 8B15 F4C36400 MOV EDX,DWORD PTR DS:[64C3F4] ; haloce.00652028 console buffer + 004866F5 8BC2 MOV EAX,EDX + 004866F7 8D78 01 LEA EDI,DWORD PTR DS:[EAX+1] + 004866FA 8D9B 00000000 LEA EBX,DWORD PTR DS:[EBX];filler????????? EBX=EBX + 00486700 8A08 MOV CL,BYTE PTR DS:[EAX] + 00486702 40 INC EAX + 00486703 84C9 TEST CL,CL + 00486705 ^75 F9 JNZ SHORT haloce.00486700 + 00486707 2BC7 SUB EAX,EDI + 00486709 50 PUSH EAX + 0048670A 52 PUSH EDX + 0048670B 56 PUSH ESI + 0048670C E8 DC611500 CALL haloce.005DC8ED;string compare function + 00486711 83C4 0C ADD ESP,0C + 00486714 85C0 TEST EAX,EAX + 00486716 75 1A JNZ SHORT haloce.00486732 + 00486718 66:A1 00C46400 MOV AX,WORD PTR DS:[64C400] + 0048671E 8B15 04C46400 MOV EDX,DWORD PTR DS:[64C404] + 00486724 0FBFC8 MOVSX ECX,AX + 00486727 66:40 INC AX + 00486729 89348A MOV DWORD PTR DS:[EDX+ECX*4],ESI + 0048672C 66:A3 00C46400 MOV WORD PTR DS:[64C400],AX + 00486732 83C3 04 ADD EBX,4 + 00486735 4D DEC EBP + 00486736 ^75 98 JNZ SHORT haloce.004866D0 + 00486738 833D DC976300 FF CMP DWORD PTR DS:[6397DC],-1;DS:[006397DC]=E1740000 (unknown tag) + 0048673F 74 18 JE SHORT haloce.00486759 + + 00486741 8B3D 6C226E00 MOV EDI,DWORD PTR DS:[6E226C] ;->EDI=40464578 "psbs" + 00486747 6A 5C PUSH 5C + 00486749 6A 00 PUSH 0 + 0048674B 81C7 A8040000 ADD EDI,4A8 + 00486751 E8 9AFDFFFF CALL haloce.004864F0 + -> + 004864F0 51 PUSH ECX + 004864F1 8B0F MOV ECX,DWORD PTR DS:[EDI];->ECX=00000001 + 004864F3 33C0 XOR EAX,EAX + 004864F5 3BC8 CMP ECX,EAX;1=0? + 004864F7 890424 MOV DWORD PTR SS:[ESP],EAX + 004864FA 0F8E AB000000 JLE haloce.004865AB + 00486500 53 PUSH EBX + 00486501 55 PUSH EBP + 00486502 0FBF6C24 10 MOVSX EBP,WORD PTR SS:[ESP+10] + 00486507 56 PUSH ESI + 00486508 EB 06 JMP SHORT haloce.00486510 + 0048650A 8D9B 00000000 LEA EBX,DWORD PTR DS:[EBX] + 00486510 0FAF4424 18 /IMUL EAX,DWORD PTR SS:[ESP+18] + 00486515 0347 04 |ADD EAX,DWORD PTR DS:[EDI+4];1st->EAX=404C2FB0 "startloop" + 00486518 8D1C28 |LEA EBX,DWORD PTR DS:[EAX+EBP];1st->EBX=404C2FB0 "startloop" + 0048651B E8 D0FCFFFF |CALL haloce.004861F0 + 00486520 66:3D FFFF |CMP AX,0FFFF + 00486524 74 1E |JE SHORT haloce.00486544 + 00486526 84E4 |TEST AH,AH + 00486528 79 68 |JNS SHORT haloce.00486592 + 0048652A 0FBFC0 |MOVSX EAX,AX + 0048652D 8B0485 88696200 |MOV EAX,DWORD PTR DS:[EAX*4+626988] + 00486534 85C0 |TEST EAX,EAX + 00486536 74 5A |JE SHORT haloce.00486592 + 00486538 8A48 0C |MOV CL,BYTE PTR DS:[EAX+C] + 0048653B E8 00FEFFFF |CALL haloce.00486340 + 00486540 84C0 |TEST AL,AL + 00486542 74 4E |JE SHORT haloce.00486592 + 00486544 66:8B0D 00C46400 |MOV CX,WORD PTR DS:[64C400] + 0048654B 66:3B0D F0C36400 |CMP CX,WORD PTR DS:[64C3F0] + 00486552 7D 3E |JGE SHORT haloce.00486592 + 00486554 8B15 F4C36400 |MOV EDX,DWORD PTR DS:[64C3F4] ; haloce.00652028 + 0048655A 8BC2 |MOV EAX,EDX + 0048655C 8D70 01 |LEA ESI,DWORD PTR DS:[EAX+1] + 0048655F 90 |NOP + 00486560 8A08 |/MOV CL,BYTE PTR DS:[EAX] + 00486562 40 ||INC EAX + 00486563 84C9 ||TEST CL,CL + 00486565 ^75 F9 |\JNZ SHORT haloce.00486560 + 00486567 2BC6 |SUB EAX,ESI + 00486569 50 |PUSH EAX + 0048656A 52 |PUSH EDX + 0048656B 53 |PUSH EBX + 0048656C E8 7C631500 |CALL haloce.005DC8ED + 00486571 83C4 0C |ADD ESP,0C + 00486574 85C0 |TEST EAX,EAX + 00486576 75 1A |JNZ SHORT haloce.00486592 + 00486578 66:A1 00C46400 |MOV AX,WORD PTR DS:[64C400] + 0048657E 8B0D 04C46400 |MOV ECX,DWORD PTR DS:[64C404] + 00486584 0FBFD0 |MOVSX EDX,AX + 00486587 66:40 |INC AX + 00486589 891C91 |MOV DWORD PTR DS:[ECX+EDX*4],EBX + 0048658C 66:A3 00C46400 |MOV WORD PTR DS:[64C400],AX + 00486592 8B4424 0C |MOV EAX,DWORD PTR SS:[ESP+C] + 00486596 8B0F |MOV ECX,DWORD PTR DS:[EDI] + 00486598 40 |INC EAX + 00486599 894424 0C |MOV DWORD PTR SS:[ESP+C],EAX + 0048659D 0FBFC0 |MOVSX EAX,AX + 004865A0 3BC1 |CMP EAX,ECX + 004865A2 ^0F8C 68FFFFFF \JL haloce.00486510 + 004865A8 5E POP ESI + 004865A9 5D POP EBP + 004865AA 5B POP EBX + 004865AB 59 POP ECX + 004865AC C3 RETN;AL=01 + <- + 00486756 83C4 08 ADD ESP,8 + + 00486759 5F POP EDI + 0048675A 5E POP ESI + 0048675B 5D POP EBP + 0048675C 5B POP EBX + 0048675D C3 RETN + <- + 00486A35 46 |INC ESI + 00486A36 83C7 04 |ADD EDI,4 ;next function in array of functions + 00486A39 4B |DEC EBX + 00486A3A ^75 E6 \JNZ SHORT haloce.00486A22 + 00486A3C 0FBF15 00C46400 MOVSX EDX,WORD PTR DS:[64C400];index to the string array->EDX=0023 + 00486A43 68 20634800 PUSH haloce.00486320 + ;hook sig + ;\x6A\x04\x52\x55\xE8\x0F\x1E\x14\x00\x66\xA1 + ;xxxxx????xx + 00486A48 6A 04 PUSH 4 + 00486A4A 52 PUSH EDX + 00486A4B 55 PUSH EBP;0018D840 array of strings + ;registers when paused: + ;EAX=00020000 (loop var) + ;ECX=00000028 (loop var) + ;EDX=00000023 (index so far at this point) + ;EBX=00000000 (loop down counter and check) + ;ESP=0018D3EC (stack pointing to array of strings ptr) + ;EBP=0018D840 (array of strings ptr) + ;ESI=00000012 (loop up counter) + ;EDI=006249A8 haloce.006249A8 (array of functions) + ;EIP=00486A4C haloce.00486A4C + 00486A4C E8 0F1E1400 CALL haloce.005C8860;misc dev funtions?(huge function)(hook here) + 00486A51 66:A1 00C46400 MOV AX,WORD PTR DS:[64C400];EAX=-1->AX=0023 + 00486A57 83C4 10 ADD ESP,10 + 00486A5A 5F POP EDI + 00486A5B 5E POP ESI + 00486A5C 5D POP EBP + 00486A5D C705 04C46400 00000000 MOV DWORD PTR DS:[64C404],0;set array of strings pointer to 0 + + 00486A67 5B POP EBX + 00486A68 C3 RETN;ret the num of matching cmds found +<- +004CA143 83C4 08 ADD ESP,8 + +0018D840 00601860 ;"cls" pointer to array of string pointers + +004C9DE0 A0 701F6500 MOV AL,BYTE PTR DS:[651F70] ;1 +004C9DE5 81EC 00040000 SUB ESP,400 +004C9DEB 84C0 TEST AL,AL +004C9DED 0F84 97000000 JE haloce.004C9E8A +004C9DF3 8A8424 04040000 MOV AL,BYTE PTR SS:[ESP+404] ;->AL=00 +004C9DFA 84C0 TEST AL,AL +004C9DFC 74 2A JE SHORT haloce.004C9E28 +;004C9DFE A0 4CDE6400 MOV AL,BYTE PTR DS:[64DE4C] +;004C9E03 84C0 TEST AL,AL +;004C9E05 74 21 JE SHORT haloce.004C9E28 +;004C9E07 B8 FFFFFFFF MOV EAX,-1 +;004C9E0C 56 PUSH ESI +;004C9E0D 8B35 50DE6400 MOV ESI,DWORD PTR DS:[64DE50] +;004C9E13 A3 54DE6400 MOV DWORD PTR DS:[64DE54],EAX +;004C9E18 A3 58DE6400 MOV DWORD PTR DS:[64DE58],EAX +;004C9E1D E8 9E9C0000 CALL haloce.004D3AC0 +;004C9E22 E8 9902FDFF CALL haloce.0049A0C0 +;004C9E27 5E POP ESI +004C9E28 8B8C24 08040000 MOV ECX,DWORD PTR SS:[ESP+408];->ECX=005F363C +004C9E2F 8D8424 0C040000 LEA EAX,DWORD PTR SS:[ESP+40C];->EAX=0018D418 +004C9E36 50 PUSH EAX +004C9E37 51 PUSH ECX +004C9E38 8D5424 08 LEA EDX,DWORD PTR SS:[ESP+8];->EDX=0018D00C +004C9E3C 52 PUSH EDX +004C9E3D E8 410E1000 CALL haloce.005CAC83 + +004C9E42 8D4424 0C LEA EAX,DWORD PTR SS:[ESP+C];->EAX=0018D00C +004C9E46 50 PUSH EAX +004C9E47 68 F4D55F00 PUSH haloce.005FD5F4 ; ASCII "%s" +004C9E4C 33C0 XOR EAX,EAX +004C9E4E C68424 13010000 00 MOV BYTE PTR SS:[ESP+113],0 +004C9E56 E8 25FEFCFF CALL haloce.00499C80 +-> + +<- +004C9E5B A0 83476B00 MOV AL,BYTE PTR DS:[6B4783] +004C9E60 83C4 14 ADD ESP,14 +004C9E63 84C0 TEST AL,AL +004C9E65 74 23 JE SHORT haloce.004C9E8A +004C9E67 68 00040000 PUSH 400 +004C9E6C 8D4C24 04 LEA ECX,DWORD PTR SS:[ESP+4] +004C9E70 68 18D65F00 PUSH haloce.005FD618 ; ASCII "" +004C9E75 51 PUSH ECX +004C9E76 E8 F5101000 CALL haloce.005CAF70 +004C9E7B 8D5424 0C LEA EDX,DWORD PTR SS:[ESP+C] +004C9E7F 6A 01 PUSH 1 +004C9E81 52 PUSH EDX +004C9E82 E8 5901F8FF CALL haloce.00449FE0 +004C9E87 83C4 14 ADD ESP,14 +004C9E8A 81C4 00040000 ADD ESP,400 +004C9E90 C3 RETN \ No newline at end of file diff --git a/halo notes/consolecheck_function.asm b/halo notes/consolecheck_function.asm new file mode 100644 index 0000000..7e5d00f --- /dev/null +++ b/halo notes/consolecheck_function.asm @@ -0,0 +1,377 @@ +;notes by Jesus7Freak +;console enabled but not open + +004C9B40 A0 711F6500 MOV AL,BYTE PTR DS:[651F71] ;console enabled? +004C9B45 53 PUSH EBX +004C9B46 33DB XOR EBX,EBX +004C9B48 3AC3 CMP AL,BL +004C9B4A 0F84 6C010000 JE haloce.004C9CBC +004C9B50 381D A8E76400 CMP BYTE PTR DS:[64E7A8],BL +004C9B56 0F85 60010000 JNZ haloce.004C9CBC +004C9B5C 803D 20D86A00 01 CMP BYTE PTR DS:[6AD820],1 +004C9B63 75 0C JNZ SHORT haloce.004C9B71 +;004C9B65 E8 46FFFFFF CALL haloce.004C9AB0 +;004C9B6A A0 701F6500 MOV AL,BYTE PTR DS:[651F70] ;console open? +;004C9B6F 5B POP EBX +;004C9B70 C3 RETN +004C9B71 A0 701F6500 MOV AL,BYTE PTR DS:[651F70] +004C9B76 3AC3 CMP AL,BL +004C9B78 0F84 43010000 JE haloce.004C9CC1 +;004C9B7E 6A 02 PUSH 2 +;004C9B80 E8 FBA1FCFF CALL haloce.00493D80 +;004C9B85 83C4 04 ADD ESP,4 +;004C9B88 3C 01 CMP AL,1 +;004C9B8A 75 05 JNZ SHORT haloce.004C9B91 +;004C9B8C E8 5FFFFFFF CALL haloce.004C9AF0 +;004C9B91 55 PUSH EBP +;004C9B92 33ED XOR EBP,EBP +;004C9B94 66:391D 741F6500 CMP WORD PTR DS:[651F74],BX +;004C9B9B 0F8E 1A010000 JLE haloce.004C9CBB +;004C9BA1 56 PUSH ESI +;004C9BA2 57 PUSH EDI +;004C9BA3 EB 0B JMP SHORT haloce.004C9BB0 +;004C9BA5 8DA424 00000000 LEA ESP,DWORD PTR SS:[ESP] +;004C9BAC 8D6424 00 LEA ESP,DWORD PTR SS:[ESP] +;004C9BB0 0FBFC5 MOVSX EAX,BP +;004C9BB3 0FBF0485 781F650>MOVSX EAX,WORD PTR DS:[EAX*4+651F78] +;004C9BBB 83C0 FA ADD EAX,-6 ; Switch (cases 6..66) +;004C9BBE 83F8 60 CMP EAX,60 +;004C9BC1 0F87 E4000000 JA haloce.004C9CAB +;004C9BC7 0FB688 DC9C4C00 MOVZX ECX,BYTE PTR DS:[EAX+4C9CDC] +;004C9BCE FF248D C49C4C00 JMP DWORD PTR DS:[ECX*4+4C9CC4] +;004C9BD5 381D 28206500 CMP BYTE PTR DS:[652028],BL ; Cases 38,66 of switch 004C9BBB +;004C9BDB 74 29 JE SHORT haloce.004C9C06 +;004C9BDD 53 PUSH EBX +;004C9BDE BF 28206500 MOV EDI,haloce.00652028 +;004C9BE3 E8 58030000 CALL haloce.004C9F40 +;004C9BE8 83C4 04 ADD ESP,4 +;004C9BEB 881D 28206500 MOV BYTE PTR DS:[652028],BL +;004C9BF1 66:891D 2E216500 MOV WORD PTR DS:[65212E],BX +;004C9BF8 66:C705 30216500>MOV WORD PTR DS:[652130],0FFFF +;004C9C01 E9 A5000000 JMP haloce.004C9CAB +;004C9C06 E8 25FEFFFF CALL haloce.004C9A30 +;004C9C0B E9 9B000000 JMP haloce.004C9CAB +;004C9C10 E8 9B040000 CALL haloce.004CA0B0 +;004C9C15 E9 91000000 JMP haloce.004C9CAB +;004C9C1A 66:8305 30296500>ADD WORD PTR DS:[652930],2 ; Case 4D of switch 004C9BBB +;004C9C22 66:A1 30296500 MOV AX,WORD PTR DS:[652930] ; Case 4E of switch 004C9BBB +;004C9C28 66:48 DEC AX +;004C9C2A 33C9 XOR ECX,ECX +;004C9C2C 66:3BC3 CMP AX,BX +;004C9C2F 0F9EC1 SETLE CL +;004C9C32 66:A3 30296500 MOV WORD PTR DS:[652930],AX +;004C9C38 8B35 30296500 MOV ESI,DWORD PTR DS:[652930] +;004C9C3E 0FBF05 2C296500 MOVSX EAX,WORD PTR DS:[65292C] +;004C9C45 49 DEC ECX +;004C9C46 23CE AND ECX,ESI +;004C9C48 0FBFC9 MOVSX ECX,CX +;004C9C4B 48 DEC EAX +;004C9C4C 3BC8 CMP ECX,EAX +;004C9C4E 7F 03 JG SHORT haloce.004C9C53 +;004C9C50 66:8BC1 MOV AX,CX +;004C9C53 66:3D FFFF CMP AX,0FFFF +;004C9C57 66:A3 30296500 MOV WORD PTR DS:[652930],AX +;004C9C5D 74 4C JE SHORT haloce.004C9CAB +;004C9C5F 0FBF15 2E296500 MOVSX EDX,WORD PTR DS:[65292E] +;004C9C66 0FBFC0 MOVSX EAX,AX +;004C9C69 2BD0 SUB EDX,EAX +;004C9C6B 83C2 08 ADD EDX,8 +;004C9C6E 8BC2 MOV EAX,EDX +;004C9C70 25 07000080 AND EAX,80000007 +;004C9C75 79 05 JNS SHORT haloce.004C9C7C +;004C9C77 48 DEC EAX +;004C9C78 83C8 F8 OR EAX,FFFFFFF8 +;004C9C7B 40 INC EAX +;004C9C7C 69C0 FF000000 IMUL EAX,EAX,0FF +;004C9C82 05 34216500 ADD EAX,haloce.00652134 +;004C9C87 BA 28206500 MOV EDX,haloce.00652028 +;004C9C8C 8D6424 00 LEA ESP,DWORD PTR SS:[ESP] +;004C9C90 8A08 MOV CL,BYTE PTR DS:[EAX] +;004C9C92 40 INC EAX +;004C9C93 880A MOV BYTE PTR DS:[EDX],CL +;004C9C95 42 INC EDX +;004C9C96 3ACB CMP CL,BL +;004C9C98 ^75 F6 JNZ SHORT haloce.004C9C90 +;004C9C9A BE 28216500 MOV ESI,haloce.00652128 +;004C9C9F E8 8C34F8FF CALL haloce.0044D130 +;004C9CA4 EB 05 JMP SHORT haloce.004C9CAB +;004C9CA6 E8 45FEFFFF CALL haloce.004C9AF0 ; Case 6 of switch 004C9BBB +;004C9CAB 45 INC EBP ; Default case of switch 004C9BBB +;004C9CAC 66:3B2D 741F6500 CMP BP,WORD PTR DS:[651F74] +;004C9CB3 ^0F8C F7FEFFFF JL haloce.004C9BB0 +;004C9CB9 5F POP EDI +;004C9CBA 5E POP ESI +;004C9CBB 5D POP EBP +;004C9CBC A0 701F6500 MOV AL,BYTE PTR DS:[651F70] +004C9CC1 5B POP EBX +004C9CC2 C3 RETN + + +;console enabled. and open, but empty + +004C9B40 A0 711F6500 MOV AL,BYTE PTR DS:[651F71] +004C9B45 53 PUSH EBX +004C9B46 33DB XOR EBX,EBX +004C9B48 3AC3 CMP AL,BL +004C9B4A 0F84 6C010000 JE haloce.004C9CBC +004C9B50 381D A8E76400 CMP BYTE PTR DS:[64E7A8],BL +004C9B56 0F85 60010000 JNZ haloce.004C9CBC +004C9B5C 803D 20D86A00 01 CMP BYTE PTR DS:[6AD820],1 +004C9B63 75 0C JNZ SHORT haloce.004C9B71 +;004C9B65 E8 46FFFFFF CALL haloce.004C9AB0 +;004C9B6A A0 701F6500 MOV AL,BYTE PTR DS:[651F70] +;004C9B6F 5B POP EBX +;004C9B70 C3 RETN +004C9B71 A0 701F6500 MOV AL,BYTE PTR DS:[651F70] +004C9B76 3AC3 CMP AL,BL +004C9B78 0F84 43010000 JE haloce.004C9CC1 +004C9B7E 6A 02 PUSH 2 +004C9B80 E8 FBA1FCFF CALL haloce.00493D80 +004C9B85 83C4 04 ADD ESP,4 +004C9B88 3C 01 CMP AL,1 +004C9B8A 75 05 JNZ SHORT haloce.004C9B91 +;004C9B8C E8 5FFFFFFF CALL haloce.004C9AF0 +004C9B91 55 PUSH EBP +004C9B92 33ED XOR EBP,EBP +004C9B94 66:391D 741F6500 CMP WORD PTR DS:[651F74],BX +004C9B9B 0F8E 1A010000 JLE haloce.004C9CBB +;004C9BA1 56 PUSH ESI +;004C9BA2 57 PUSH EDI +;004C9BA3 EB 0B JMP SHORT haloce.004C9BB0 +;004C9BA5 8DA424 00000000 LEA ESP,DWORD PTR SS:[ESP] +;004C9BAC 8D6424 00 LEA ESP,DWORD PTR SS:[ESP] +;004C9BB0 0FBFC5 MOVSX EAX,BP +;004C9BB3 0FBF0485 781F650>MOVSX EAX,WORD PTR DS:[EAX*4+651F78] +;004C9BBB 83C0 FA ADD EAX,-6 ; Switch (cases 6..66) +;004C9BBE 83F8 60 CMP EAX,60 +;004C9BC1 0F87 E4000000 JA haloce.004C9CAB +;004C9BC7 0FB688 DC9C4C00 MOVZX ECX,BYTE PTR DS:[EAX+4C9CDC] +;004C9BCE FF248D C49C4C00 JMP DWORD PTR DS:[ECX*4+4C9CC4] +;004C9BD5 381D 28206500 CMP BYTE PTR DS:[652028],BL ; Cases 38,66 of switch 004C9BBB +;004C9BDB 74 29 JE SHORT haloce.004C9C06 +;004C9BDD 53 PUSH EBX +;004C9BDE BF 28206500 MOV EDI,haloce.00652028 +;004C9BE3 E8 58030000 CALL haloce.004C9F40 +;004C9BE8 83C4 04 ADD ESP,4 +;004C9BEB 881D 28206500 MOV BYTE PTR DS:[652028],BL +;004C9BF1 66:891D 2E216500 MOV WORD PTR DS:[65212E],BX +;004C9BF8 66:C705 30216500>MOV WORD PTR DS:[652130],0FFFF +;004C9C01 E9 A5000000 JMP haloce.004C9CAB +;004C9C06 E8 25FEFFFF CALL haloce.004C9A30 +;004C9C0B E9 9B000000 JMP haloce.004C9CAB +;004C9C10 E8 9B040000 CALL haloce.004CA0B0 +;004C9C15 E9 91000000 JMP haloce.004C9CAB +;004C9C1A 66:8305 30296500>ADD WORD PTR DS:[652930],2 ; Case 4D of switch 004C9BBB +;004C9C22 66:A1 30296500 MOV AX,WORD PTR DS:[652930] ; Case 4E of switch 004C9BBB +;004C9C28 66:48 DEC AX +;004C9C2A 33C9 XOR ECX,ECX +;004C9C2C 66:3BC3 CMP AX,BX +;004C9C2F 0F9EC1 SETLE CL +;004C9C32 66:A3 30296500 MOV WORD PTR DS:[652930],AX +;004C9C38 8B35 30296500 MOV ESI,DWORD PTR DS:[652930] +;004C9C3E 0FBF05 2C296500 MOVSX EAX,WORD PTR DS:[65292C] +;004C9C45 49 DEC ECX +;004C9C46 23CE AND ECX,ESI +;004C9C48 0FBFC9 MOVSX ECX,CX +;004C9C4B 48 DEC EAX +;004C9C4C 3BC8 CMP ECX,EAX +;004C9C4E 7F 03 JG SHORT haloce.004C9C53 +;004C9C50 66:8BC1 MOV AX,CX +;004C9C53 66:3D FFFF CMP AX,0FFFF +;004C9C57 66:A3 30296500 MOV WORD PTR DS:[652930],AX +;004C9C5D 74 4C JE SHORT haloce.004C9CAB +;004C9C5F 0FBF15 2E296500 MOVSX EDX,WORD PTR DS:[65292E] +;004C9C66 0FBFC0 MOVSX EAX,AX +;004C9C69 2BD0 SUB EDX,EAX +;004C9C6B 83C2 08 ADD EDX,8 +;004C9C6E 8BC2 MOV EAX,EDX +;004C9C70 25 07000080 AND EAX,80000007 +;004C9C75 79 05 JNS SHORT haloce.004C9C7C +;004C9C77 48 DEC EAX +;004C9C78 83C8 F8 OR EAX,FFFFFFF8 +;004C9C7B 40 INC EAX +;004C9C7C 69C0 FF000000 IMUL EAX,EAX,0FF +;004C9C82 05 34216500 ADD EAX,haloce.00652134 +;004C9C87 BA 28206500 MOV EDX,haloce.00652028 +;004C9C8C 8D6424 00 LEA ESP,DWORD PTR SS:[ESP] +;004C9C90 8A08 MOV CL,BYTE PTR DS:[EAX] +;004C9C92 40 INC EAX +;004C9C93 880A MOV BYTE PTR DS:[EDX],CL +;004C9C95 42 INC EDX +;004C9C96 3ACB CMP CL,BL +;004C9C98 ^75 F6 JNZ SHORT haloce.004C9C90 +;004C9C9A BE 28216500 MOV ESI,haloce.00652128 +;004C9C9F E8 8C34F8FF CALL haloce.0044D130 +;004C9CA4 EB 05 JMP SHORT haloce.004C9CAB +;004C9CA6 E8 45FEFFFF CALL haloce.004C9AF0 ; Case 6 of switch 004C9BBB +;004C9CAB 45 INC EBP ; Default case of switch 004C9BBB +;004C9CAC 66:3B2D 741F6500 CMP BP,WORD PTR DS:[651F74] +;004C9CB3 ^0F8C F7FEFFFF JL haloce.004C9BB0 +;004C9CB9 5F POP EDI +;004C9CBA 5E POP ESI +004C9CBB 5D POP EBP +004C9CBC A0 701F6500 MOV AL,BYTE PTR DS:[651F70] +004C9CC1 5B POP EBX +004C9CC2 C3 RETN + + + + +;console enabled. and open, "/hog *" and enter pressed +004C9B40 A0 711F6500 MOV AL,BYTE PTR DS:[651F71] +004C9B45 53 PUSH EBX +004C9B46 33DB XOR EBX,EBX +004C9B48 3AC3 CMP AL,BL +004C9B4A 0F84 6C010000 JE haloce.004C9CBC +004C9B50 381D A8E76400 CMP BYTE PTR DS:[64E7A8],BL +004C9B56 0F85 60010000 JNZ haloce.004C9CBC +004C9B5C 803D 20D86A00 01 CMP BYTE PTR DS:[6AD820],1 +004C9B63 75 0C JNZ SHORT haloce.004C9B71 +;004C9B65 E8 46FFFFFF CALL haloce.004C9AB0 +;004C9B6A A0 701F6500 MOV AL,BYTE PTR DS:[651F70] +;004C9B6F 5B POP EBX +;004C9B70 C3 RETN +004C9B71 A0 701F6500 MOV AL,BYTE PTR DS:[651F70] +004C9B76 3AC3 CMP AL,BL +004C9B78 0F84 43010000 JE haloce.004C9CC1 +004C9B7E 6A 02 PUSH 2 +004C9B80 E8 FBA1FCFF CALL haloce.00493D80 +-> + 00493D80 8B0D 54C76400 MOV ECX,DWORD PTR DS:[64C754] + 00493D86 32C0 XOR AL,AL + 00493D88 85C9 TEST ECX,ECX + 00493D8A 74 15 JE SHORT haloce.00493DA1 + 00493D8C 8A0D 49C56400 MOV CL,BYTE PTR DS:[64C549] + 00493D92 84C9 TEST CL,CL + 00493D94 75 0B JNZ SHORT haloce.00493DA1 + 00493D96 0FBF4424 04 MOVSX EAX,WORD PTR SS:[ESP+4] + 00493D9B 8A80 68C76400 MOV AL,BYTE PTR DS:[EAX+64C768] +<- +004C9B85 83C4 04 ADD ESP,4 +004C9B88 3C 01 CMP AL,1 +004C9B8A 75 05 JNZ SHORT haloce.004C9B91 +;004C9B8C E8 5FFFFFFF CALL haloce.004C9AF0 +004C9B91 55 PUSH EBP +004C9B92 33ED XOR EBP,EBP +004C9B94 66:391D 741F6500 CMP WORD PTR DS:[651F74],BX +004C9B9B 0F8E 1A010000 JLE haloce.004C9CBB +004C9BA1 56 PUSH ESI +004C9BA2 57 PUSH EDI +004C9BA3 EB 0B JMP SHORT haloce.004C9BB0 +;004C9BA5 8DA424 00000000 LEA ESP,DWORD PTR SS:[ESP] +;004C9BAC 8D6424 00 LEA ESP,DWORD PTR SS:[ESP] +004C9BB0 0FBFC5 MOVSX EAX,BP +004C9BB3 0FBF0485 781F6500 MOVSX EAX,WORD PTR DS:[EAX*4+651F78] +004C9BBB 83C0 FA ADD EAX,-6 ; Switch (cases 6..66) +004C9BBE 83F8 60 CMP EAX,60 +004C9BC1 0F87 E4000000 JA haloce.004C9CAB +004C9BC7 0FB688 DC9C4C00 MOVZX ECX,BYTE PTR DS:[EAX+4C9CDC] +004C9BCE FF248D C49C4C00 JMP DWORD PTR DS:[ECX*4+4C9CC4] + +;when enter key is pressed :case 38h: enter key +004C9BD5 381D 28206500 CMP BYTE PTR DS:[652028],BL ; Cases 38,66 of switch 004C9BBB +004C9BDB 74 29 JE SHORT haloce.004C9C06 +004C9BDD 53 PUSH EBX +;console parser +004C9BDE BF 28206500 MOV EDI,haloce.00652028 ; ASCII "/hog *" +004C9BE3 E8 28DED65D CALL haloce.004C9F40 +004C9BE8 83C4 04 ADD ESP,4 + +004C9BEB 881D 28206500 MOV BYTE PTR DS:[652028],BL +004C9BF1 66:891D 2E216500 MOV WORD PTR DS:[65212E],BX +004C9BF8 66:C705 30216500 FFFF MOV WORD PTR DS:[652130],0FFFF +004C9C01 E9 A5000000 JMP haloce.004C9CAB + +;004C9C06 E8 25FEFFFF CALL haloce.004C9A30 +;004C9C0B E9 9B000000 JMP haloce.004C9CAB + +;when tab is pressed ;case 1E: tab key +;004C9C10 E8 9B040000 CALL haloce.004CA0B0 +;004C9C15 E9 91000000 JMP haloce.004C9CAB + +;when up arror or down arrow is pressed ;case 4D: up arrow key ;case 4E: down arrow key +;004C9C1A 66:8305 30296500>ADD WORD PTR DS:[652930],2 ; Case 4D of switch 004C9BBB +;004C9C22 66:A1 30296500 MOV AX,WORD PTR DS:[652930] ; Case 4E of switch 004C9BBB +;004C9C28 66:48 DEC AX +;004C9C2A 33C9 XOR ECX,ECX +;004C9C2C 66:3BC3 CMP AX,BX +;004C9C2F 0F9EC1 SETLE CL +;004C9C32 66:A3 30296500 MOV WORD PTR DS:[652930],AX +;004C9C38 8B35 30296500 MOV ESI,DWORD PTR DS:[652930] +;004C9C3E 0FBF05 2C296500 MOVSX EAX,WORD PTR DS:[65292C] +;004C9C45 49 DEC ECX +;004C9C46 23CE AND ECX,ESI +;004C9C48 0FBFC9 MOVSX ECX,CX +;004C9C4B 48 DEC EAX +;004C9C4C 3BC8 CMP ECX,EAX +;004C9C4E 7F 03 JG SHORT haloce.004C9C53 +;004C9C50 66:8BC1 MOV AX,CX +;004C9C53 66:3D FFFF CMP AX,0FFFF +;004C9C57 66:A3 30296500 MOV WORD PTR DS:[652930],AX +;004C9C5D 74 4C JE SHORT haloce.004C9CAB +;004C9C5F 0FBF15 2E296500 MOVSX EDX,WORD PTR DS:[65292E] +;004C9C66 0FBFC0 MOVSX EAX,AX +;004C9C69 2BD0 SUB EDX,EAX +;004C9C6B 83C2 08 ADD EDX,8 +;004C9C6E 8BC2 MOV EAX,EDX +;004C9C70 25 07000080 AND EAX,80000007 +;004C9C75 79 05 JNS SHORT haloce.004C9C7C +;004C9C77 48 DEC EAX +;004C9C78 83C8 F8 OR EAX,FFFFFFF8 +;004C9C7B 40 INC EAX +;004C9C7C 69C0 FF000000 IMUL EAX,EAX,0FF +;004C9C82 05 34216500 ADD EAX,haloce.00652134 ; ASCII "/console 2" +;004C9C87 BA 28206500 MOV EDX,haloce.00652028 ; ASCII "/hog *" +;004C9C8C 8D6424 00 LEA ESP,DWORD PTR SS:[ESP] +;004C9C90 8A08 MOV CL,BYTE PTR DS:[EAX] +;004C9C92 40 INC EAX +;004C9C93 880A MOV BYTE PTR DS:[EDX],CL +;004C9C95 42 INC EDX +;004C9C96 3ACB CMP CL,BL +;004C9C98 ^75 F6 JNZ SHORT haloce.004C9C90 +;004C9C9A BE 28216500 MOV ESI,haloce.00652128 +;004C9C9F E8 8C34F8FF CALL haloce.0044D130 +;004C9CA4 EB 05 JMP SHORT haloce.004C9CAB + +;004C9CA6 E8 45FEFFFF CALL haloce.004C9AF0 ; Case 6 of switch 004C9BBB + +004C9CAB 45 INC EBP ; Default case of switch 004C9BBB +004C9CAC 66:3B2D 741F6500 CMP BP,WORD PTR DS:[651F74] +004C9CB3 ^0F8C F7FEFFFF JL haloce.004C9BB0 +004C9CB9 5F POP EDI +004C9CBA 5E POP ESI +004C9CBB 5D POP EBP +004C9CBC A0 701F6500 MOV AL,BYTE PTR DS:[651F70] +004C9CC1 5B POP EBX +004C9CC2 C3 RETN + + + + +;forcing the main thread to use console: + +char *buffer = (char*)0x00652028; +buffer[0] = 's'; +buffer[1] = 'v'; +buffer[2] = '_'; +buffer[3] = 'p'; +buffer[4] = 'l'; +buffer[5] = 'a'; +buffer[6] = 'y'; +buffer[7] = 'e'; +buffer[8] = 'r'; +buffer[9] = 's'; +buffer[10] = 0; + +__asm +{ + MOV EBX,0x651F74 + MOV WORD PTR[EBX],2 + + MOV EDI,0x651F70 + MOV BYTE PTR[EDI],1 + + MOV ESI,0x651F78 + MOV WORD PTR[ESI],0x38 + +} \ No newline at end of file diff --git a/halo notes/data_struct_func.asm b/halo notes/data_struct_func.asm new file mode 100644 index 0000000..5713cea --- /dev/null +++ b/halo notes/data_struct_func.asm @@ -0,0 +1,183 @@ +;notes by Jesus7Freak + +004D39BB CC INT3 +004D39BC CC INT3 +004D39BD CC INT3 +004D39BE CC INT3 +004D39BF CC INT3 +;EDX=DATA_HEADER ptr +; +004D39C0 0FBF4A 22 MOVSX ECX,WORD PTR DS:[EDX+22] +004D39C4 53 PUSH EBX +004D39C5 66:8B5A 2C MOV BX,WORD PTR DS:[EDX+2C] +004D39C9 55 PUSH EBP +004D39CA 8B6A 34 MOV EBP,DWORD PTR DS:[EDX+34] +004D39CD 56 PUSH ESI +004D39CE 0FBFF3 MOVSX ESI,BX +004D39D1 0FAFF1 IMUL ESI,ECX +004D39D4 83C8 FF OR EAX,FFFFFFFF +004D39D7 03F5 ADD ESI,EBP +004D39D9 66:3B5A 20 CMP BX,WORD PTR DS:[EDX+20] +004D39DD 7D 60 JGE SHORT haloce.004D3A3F +004D39DF 90 NOP +004D39E0 66:833E 00 /CMP WORD PTR DS:[ESI],0 +004D39E4 74 0D |JE SHORT haloce.004D39F3 +004D39E6 43 |INC EBX +004D39E7 03F1 |ADD ESI,ECX +004D39E9 66:3B5A 20 |CMP BX,WORD PTR DS:[EDX+20] +004D39ED ^7C F1 \JL SHORT haloce.004D39E0 +004D39EF 5E POP ESI +004D39F0 5D POP EBP +004D39F1 5B POP EBX +004D39F2 C3 RETN +004D39F3 8BE9 MOV EBP,ECX +004D39F5 C1E9 02 SHR ECX,2 +004D39F8 57 PUSH EDI +004D39F9 33C0 XOR EAX,EAX +004D39FB 8BFE MOV EDI,ESI +004D39FD F3:AB REP STOS DWORD PTR ES:[EDI] +004D39FF 8BCD MOV ECX,EBP +004D3A01 83E1 03 AND ECX,3 +004D3A04 F3:AA REP STOS BYTE PTR ES:[EDI] +004D3A06 66:8B42 32 MOV AX,WORD PTR DS:[EDX+32] +004D3A0A 66:8906 MOV WORD PTR DS:[ESI],AX +004D3A0D 66:FF42 32 INC WORD PTR DS:[EDX+32] +004D3A11 66:837A 32 00 CMP WORD PTR DS:[EDX+32],0 +004D3A16 5F POP EDI +004D3A17 75 06 JNZ SHORT haloce.004D3A1F +004D3A19 66:C742 32 0080 MOV WORD PTR DS:[EDX+32],8000 +004D3A1F 66:FF42 30 INC WORD PTR DS:[EDX+30] +004D3A23 66:395A 2E CMP WORD PTR DS:[EDX+2E],BX +004D3A27 8D43 01 LEA EAX,DWORD PTR DS:[EBX+1] +004D3A2A 66:8942 2C MOV WORD PTR DS:[EDX+2C],AX +004D3A2E 7F 04 JG SHORT haloce.004D3A34 +004D3A30 66:8942 2E MOV WORD PTR DS:[EDX+2E],AX +004D3A34 0FBF06 MOVSX EAX,WORD PTR DS:[ESI] +004D3A37 0FBFCB MOVSX ECX,BX +004D3A3A C1E0 10 SHL EAX,10 +004D3A3D 0BC1 OR EAX,ECX +004D3A3F 5E POP ESI +004D3A40 5D POP EBP +004D3A41 5B POP EBX +004D3A42 C3 RETN +004D3A43 CC INT3 +004D3A44 CC INT3 +004D3A45 CC INT3 +004D3A46 CC INT3 +004D3A47 CC INT3 +004D3A48 CC INT3 +004D3A49 CC INT3 +004D3A4A CC INT3 +004D3A4B CC INT3 +004D3A4C CC INT3 +004D3A4D CC INT3 +004D3A4E CC INT3 +004D3A4F CC INT3 + + + + + + + + +004D3A43 CC int 3 +004D3A44 CC int 3 +004D3A45 CC int 3 +004D3A46 CC int 3 +004D3A47 CC int 3 +004D3A48 CC int 3 +004D3A49 CC int 3 +004D3A4A CC int 3 +004D3A4B CC int 3 +004D3A4C CC int 3 +004D3A4D CC int 3 +004D3A4E CC int 3 +004D3A4F CC int 3 +;EDX=item tag +;EAX=DATA_HEADER ptr +;invalidate item from data header (all items with the same ID are invalidated) +004D3A50 56 push esi +004D3A51 8B F2 mov esi,edx +004D3A53 C1 FE 10 sar esi,10h ;SI= item ID +004D3A56 66 85 D2 test dx,dx ;DX= item index +004D3A59 57 push edi +004D3A5A 7C 25 jl 004D3A81 +004D3A5C 66 3B 50 2E cmp dx,word ptr [eax+2Eh] ;DATA_HEADER.NumOfItems +004D3A60 7D 1F jge 004D3A81 +004D3A62 0F BF 48 22 movsx ecx,word ptr [eax+22h] ;DATA_HEADER.ItemSize +004D3A66 0F BF FA movsx edi,dx +004D3A69 0F AF CF imul ecx,edi +004D3A6C 03 48 34 add ecx,dword ptr [eax+34h] ;ECX=DATA_HEADER.ItemArray_ptrv[i] (ptr to item) +004D3A6F 66 8B 39 mov di,word ptr [ecx] +004D3A72 66 85 FF test di,di ;is ID valid? +004D3A75 74 0A je 004D3A81 +004D3A77 66 85 F6 test si,si ;is ID from param valid? +004D3A7A 74 07 je 004D3A83 +004D3A7C 66 3B F7 cmp si,di +004D3A7F 74 02 je 004D3A83 +004D3A81 33 C9 xor ecx,ecx;crashes game +004D3A83 66 C7 01 00 00 mov word ptr [ecx],0 ;invalidate item (change items ID to 0) +004D3A88 66 3B 50 2C cmp dx,word ptr [eax+2Ch] ;DATA_HEADER.LastItemIndexInvalidated? +004D3A8C 7D 04 jge 004D3A92 +004D3A8E 66 89 50 2C mov word ptr [eax+2Ch],dx +004D3A92 0F BF 70 2E movsx esi,word ptr [eax+2Eh] +004D3A96 0F BF D2 movsx edx,dx +004D3A99 42 inc edx +004D3A9A 5F pop edi +004D3A9B 3B D6 cmp edx,esi +004D3A9D 5E pop esi +004D3A9E 75 17 jne 004D3AB7 +004D3AA0 0F BF 50 22 movsx edx,word ptr [eax+22h] +004D3AA4 2B CA sub ecx,edx ;ECX=DATA_HEADER.ItemArray_ptrv[i - 1] (ptr to item) (moves down an index) +004D3AA6 66 FF 48 2E dec word ptr [eax+2Eh] ;decrease the num of items +004D3AAA 66 83 78 2E 00 cmp word ptr [eax+2Eh],0 ;check if theres any more items +004D3AAF 7E 06 jle 004D3AB7 +004D3AB1 66 83 39 00 cmp word ptr [ecx],0 ;test if that item is valid +004D3AB5 74 ED je 004D3AA4 +004D3AB7 66 FF 48 30 dec word ptr [eax+30h] ; decrease the DATA_HEADER.NextItemIndex +004D3ABB C3 ret +004D3ABC CC int 3 +004D3ABD CC int 3 +004D3ABE CC int 3 +004D3ABF CC int 3 + + + + +004D3ABC CC INT3 +004D3ABD CC INT3 +004D3ABE CC INT3 +004D3ABF CC INT3 +;ESI=DATA_HEADER ptr +;reset DATA_HEADER +004D3AC0 57 PUSH EDI +004D3AC1 6A 02 PUSH 2 +004D3AC3 8D7E 32 LEA EDI,DWORD PTR DS:[ESI+32] +004D3AC6 56 PUSH ESI +004D3AC7 57 PUSH EDI +004D3AC8 66:C746 2E 0000 MOV WORD PTR DS:[ESI+2E],0 +004D3ACE 66:C746 30 0000 MOV WORD PTR DS:[ESI+30],0 +004D3AD4 66:C746 2C 0000 MOV WORD PTR DS:[ESI+2C],0 +004D3ADA E8 01540F00 CALL haloce.005C8EE0 +004D3ADF 66:810F 0080 OR WORD PTR DS:[EDI],8000 +004D3AE4 83C4 0C ADD ESP,0C +004D3AE7 33C0 XOR EAX,EAX +004D3AE9 66:3946 20 CMP WORD PTR DS:[ESI+20],AX +004D3AED 5F POP EDI +004D3AEE 7E 1A JLE SHORT haloce.004D3B0A +004D3AF0 0FBF4E 22 /MOVSX ECX,WORD PTR DS:[ESI+22] +004D3AF4 0FBFD0 |MOVSX EDX,AX +004D3AF7 0FAFCA |IMUL ECX,EDX +004D3AFA 8B56 34 |MOV EDX,DWORD PTR DS:[ESI+34] +004D3AFD 40 |INC EAX +004D3AFE 66:C70411 0000 |MOV WORD PTR DS:[ECX+EDX],0 +004D3B04 66:3B46 20 |CMP AX,WORD PTR DS:[ESI+20] +004D3B08 ^7C E6 \JL SHORT haloce.004D3AF0 +004D3B0A C3 RETN +004D3B0B CC INT3 +004D3B0C CC INT3 +004D3B0D CC INT3 +004D3B0E CC INT3 +004D3B0F CC INT3 + diff --git a/halo notes/gravity.asm b/halo notes/gravity.asm new file mode 100644 index 0000000..01b98b0 --- /dev/null +++ b/halo notes/gravity.asm @@ -0,0 +1,76 @@ +;notes by Jesus7Freak +;gravity 00561806: mov [eax+08],edx (ss: 0018D548 edx=2E1A3174 (3.505946921666947e-11) + +;inside this function +0055D712 52 PUSH EDX +0055D713 56 PUSH ESI +0055D714 E8 B7330000 CALL haloce.00560AD0 +0055D719 8A83 06010000 MOV AL,BYTE PTR DS:[EBX+106] +0055D71F 83C4 08 ADD ESP,8 + + +;memory on access +0055D712 52 PUSH EDX +0055D713 56 PUSH ESI +0055D714 E8 B7330000 CALL haloce.00560AD0 +-> +...;0018D548=0018DAA8 +1 005631B4 - D9 9D C0000000 - fstp dword ptr [ebp+000000C0] ;ebp=0018D488 +...;0018D548=BBFF45E9 +2 00563226 8B49 08 MOV ECX,DWORD PTR DS:[ECX+8] ;ECX=0018D540 +...;0018D548=BBFF45E9 +3 005638D6 D88D C0000000 |FMUL DWORD PTR SS:[EBP+C0] ;EBP=0018D488 +...;0018D548=BBFF45E9 +4 00563D88 - 89 8D C0000000 - mov [ebp+000000C0],ecx ;ebp=0018D488 +...;0018D548=2E23FF10 +5 00563DA2 D985 C0000000 FLD DWORD PTR SS:[EBP+C0] ;EBP=0018D488 +...;0018D548=2E23FF10 +5 00563DAB D99D C0000000 FSTP DWORD PTR SS:[EBP+C0] ;stores +...;0018D548=2E23FF10 +005617FC 8B9424 00010000 MOV EDX,DWORD PTR SS:[ESP+100] +00561803 8948 04 MOV DWORD PTR DS:[EAX+4],ECX +00561806 8950 08 MOV DWORD PTR DS:[EAX+8],EDX ;stores in obj's z velocity +... +<- +0055D719 8A83 06010000 MOV AL,BYTE PTR DS:[EBX+106] +0055D71F 83C4 08 ADD ESP,8 + +1 ;writes +005631AD D94424 38 FLD DWORD PTR SS:[ESP+38] ;Stack SS:[001824D0]= -0.007790316 +005631B1 D845 34 FADD DWORD PTR SS:[EBP+34] ;ST=-0.0077903163619339466 Stack SS:[0018D4BC] = 3.728845e-11 +005631B4 D99D C0000000 FSTP DWORD PTR SS:[EBP+C0] ;ST=-0.0077903163246454965 Stack SS:[0018D548]=2.282491e-39 + +2 ;reads +00563217 8D8D B8000000 LEA ECX,DWORD PTR SS:[EBP+B8] ;Stack address=0018D540 ECX=3E450228 +... +00563226 8B49 08 MOV ECX,DWORD PTR DS:[ECX+8] ;Stack DS:[0018D548]=BBFF45E9 ECX=0018D540 + +3 ;reads +005638C0 D985 B8000000 |FLD DWORD PTR SS:[EBP+B8] +005638C6 D84A FC |FMUL DWORD PTR DS:[EDX-4] +005638C9 D902 |FLD DWORD PTR DS:[EDX] +005638CB D88D BC000000 |FMUL DWORD PTR SS:[EBP+BC] +005638D1 DEC1 |FADDP ST(1),ST +005638D3 D942 04 |FLD DWORD PTR DS:[EDX+4] +005638D6 D88D C0000000 |FMUL DWORD PTR SS:[EBP+C0] ;ST=0.9971604943275451660 Stack SS:[0018D548]=-0.007790316 +005638DC DEC1 |FADDP ST(1),ST +005638DE D9E0 |FCHS +005638E0 D95C24 6C |FSTP DWORD PTR SS:[ESP+6C] + +4 ;writes +00563D79 8B8C24 9C000000 MOV ECX,DWORD PTR SS:[ESP+9C] ;Stack SS:[00182534]=2E23FF10 ECX=3E450228 +... +00563D88 898D C0000000 MOV DWORD PTR SS:[EBP+C0],ECX ;ECX=2E23FF10 Stack SS:[0018D548]=BBFF45E9 + +5 ;writes +00563DA2 D985 C0000000 FLD DWORD PTR SS:[EBP+C0] ;Stack SS:[0018D548]=3.728845e-11 +00563DA8 D865 38 FSUB DWORD PTR SS:[EBP+38] ;ST=3.7288450105421588880e-11 Stack SS:[0018D4C0]=0.0 +00563DAB D99D C0000000 FSTP DWORD PTR SS:[EBP+C0] ;ST=3.7288450105421588880e-11 Stack SS:[0018D548]=3.728845e-11 + + + + + +;2E23FF10 +0050A9AA D958 08 FSTP DWORD PTR DS:[EAX+8] ;ST=3.7288448370698112910e-11 Stack DS:[00182534]=0.9971605 + diff --git a/halo notes/help_func.asm b/halo notes/help_func.asm new file mode 100644 index 0000000..42c633a --- /dev/null +++ b/halo notes/help_func.asm @@ -0,0 +1,161 @@ +;notes by Jesus7Freak +;haloce1.09 console=help sv_map +;console 004C9BE3 +...1 ;inspect +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F5DD8 haloce.0048C8D0 +...2 ;help +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F9714 haloce.004854A0 +...3 ;help +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F9714 haloce.004854A0 +...4 ;inspect +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F5DD8 haloce.0048C8D0 + + + +...2 +0048D1E0 51 PUSH ECX ;403D8901 +0048D1E1 57 PUSH EDI ;F36F0002 +0048D1E2 50 PUSH EAX ;0000003A +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F9714 haloce.004854A0 +-> +004854A0 0FBF4424 04 MOVSX EAX,WORD PTR SS:[ESP+4] +004854A5 8B0485 18416200 MOV EAX,DWORD PTR DS:[EAX*4+624118] ;->EAX=005F9714 +004854AC 8B4C24 0C MOV ECX,DWORD PTR SS:[ESP+C] ;->ECX=403D8901 +004854B0 56 PUSH ESI +004854B1 8B7424 0C MOV ESI,DWORD PTR SS:[ESP+C] ;->ESI=F36F0002 +004854B5 51 PUSH ECX +004854B6 8D50 1C LEA EDX,DWORD PTR DS:[EAX+1C] ;->EDX=005F9730 +004854B9 0FBF40 1A MOVSX EAX,WORD PTR DS:[EAX+1A] ;->EAX=00000001 + +004854BD 52 PUSH EDX +004854BE 50 PUSH EAX +004854BF 56 PUSH ESI +004854C0 E8 DB800000 CALL haloce.0048D5A0 +004854C5 83C4 10 ADD ESP,10 + +004854C8 85C0 TEST EAX,EAX ;EAX=00000000 +004854CA 74 11 JE SHORT haloce.004854DD +;004854CC 8B10 MOV EDX,DWORD PTR DS:[EAX] +;004854CE E8 2D1A0000 CALL haloce.00486F00 +;004854D3 8BCE MOV ECX,ESI +;004854D5 33C0 XOR EAX,EAX +;004854D7 5E POP ESI +;004854D8 E9 B37E0000 JMP haloce.0048D390 +004854DD 5E POP ESI +004854DE C3 RETN +<- + + +...3 +0048D1E0 51 PUSH ECX ;403D8900 +0048D1E1 57 PUSH EDI ;F36F0002 +0048D1E2 50 PUSH EAX ;0000003A ;index to console functions structs +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F9714 haloce.004854A0 +-> +004854A0 0FBF4424 04 MOVSX EAX,WORD PTR SS:[ESP+4] ;->EAX=0000003A +004854A5 8B0485 18416200 MOV EAX,DWORD PTR DS:[EAX*4+624118] ;->EAX=005F9714 +004854AC 8B4C24 0C MOV ECX,DWORD PTR SS:[ESP+C] ;->ECX=403D8900 +004854B0 56 PUSH ESI +004854B1 8B7424 0C MOV ESI,DWORD PTR SS:[ESP+C] ;->ESI=F36F0002 +004854B5 51 PUSH ECX +004854B6 8D50 1C LEA EDX,DWORD PTR DS:[EAX+1C] ;->EDX=005F9730 +004854B9 0FBF40 1A MOVSX EAX,WORD PTR DS:[EAX+1A] ;->EAX=00000001 + +004854BD 52 PUSH EDX +004854BE 50 PUSH EAX +004854BF 56 PUSH ESI +004854C0 E8 DB800000 CALL haloce.0048D5A0 +004854C5 83C4 10 ADD ESP,10 + +004854C8 85C0 TEST EAX,EAX ;EAX=403D897A ptr to console function data +004854CA 74 11 JE SHORT haloce.004854DD +;help function +004854CC 8B10 MOV EDX,DWORD PTR DS:[EAX] ;->EDX=404C2AFB "sv_map" +004854CE E8 2D1A0000 CALL haloce.00486F00 + +004854D3 8BCE MOV ECX,ESI +004854D5 33C0 XOR EAX,EAX +004854D7 5E POP ESI +004854D8 E9 B37E0000 JMP haloce.0048D390 +...^ +;004854DD 5E POP ESI +;004854DE C3 RETN + + + + + + + + +;help function +004854CC 8B10 MOV EDX,DWORD PTR DS:[EAX] ;->EDX=404C2AFB "sv_map" +004854CE E8 2D1A0000 CALL haloce.00486F00 +-> + 00486F00 81EC 00080000 SUB ESP,800 + 00486F06 56 PUSH ESI + 00486F07 E8 84F3FFFF CALL haloce.00486290 ;find dev fucntion info struct index + 00486F0C 8BF0 MOV ESI,EAX ;->ESI=000001EC + 00486F0E 66:83FE FF CMP SI,0FFFF + 00486F12 74 73 JE SHORT haloce.00486F87 + 00486F14 8D4C24 04 LEA ECX,DWORD PTR SS:[ESP+4] + 00486F18 E8 33010000 CALL haloce.00487050 + 00486F1D 8D4424 04 LEA EAX,DWORD PTR SS:[ESP+4] + 00486F21 50 PUSH EAX + 00486F22 33C0 XOR EAX,EAX + 00486F24 E8 572D0100 CALL haloce.00499C80 + 00486F29 0FBFCE MOVSX ECX,SI + 00486F2C 8B148D 18416200 MOV EDX,DWORD PTR DS:[ECX*4+624118] + 00486F33 8B4A 10 MOV ECX,DWORD PTR DS:[EDX+10] + 00486F36 83C4 04 ADD ESP,4 + 00486F39 8D5424 04 LEA EDX,DWORD PTR SS:[ESP+4] + 00486F3D 8D49 00 LEA ECX,DWORD PTR DS:[ECX] + 00486F40 8A01 /MOV AL,BYTE PTR DS:[ECX] + 00486F42 41 |INC ECX + 00486F43 8802 |MOV BYTE PTR DS:[EDX],AL + 00486F45 42 |INC EDX + 00486F46 84C0 |TEST AL,AL + 00486F48 ^75 F6 \JNZ SHORT haloce.00486F40 + 00486F4A 8D4424 04 LEA EAX,DWORD PTR SS:[ESP+4] + 00486F4E 6A 0A PUSH 0A + 00486F50 50 PUSH EAX + 00486F51 E8 AA3B1400 CALL haloce.005CAB00 + 00486F56 8BF0 MOV ESI,EAX + 00486F58 83C4 08 ADD ESP,8 + 00486F5B 85F6 TEST ESI,ESI + 00486F5D 74 41 JE SHORT haloce.00486FA0 + 00486F5F 57 PUSH EDI + 00486F60 8D7C24 08 LEA EDI,DWORD PTR SS:[ESP+8] + 00486F64 33C0 /XOR EAX,EAX + 00486F66 85F6 |TEST ESI,ESI + 00486F68 57 |PUSH EDI + 00486F69 74 24 |JE SHORT haloce.00486F8F + 00486F6B 8806 |MOV BYTE PTR DS:[ESI],AL + 00486F6D E8 0E2D0100 |CALL haloce.00499C80 + 00486F72 8D7E 01 |LEA EDI,DWORD PTR DS:[ESI+1] + 00486F75 6A 0A |PUSH 0A + 00486F77 57 |PUSH EDI + 00486F78 E8 833B1400 |CALL haloce.005CAB00 + 00486F7D 83C4 0C |ADD ESP,0C + 00486F80 85FF |TEST EDI,EDI + 00486F82 8BF0 |MOV ESI,EAX + 00486F84 ^75 DE \JNZ SHORT haloce.00486F64 + 00486F86 5F POP EDI + 00486F87 5E POP ESI + 00486F88 81C4 00080000 ADD ESP,800 + 00486F8E C3 RETN + 00486F8F E8 EC2C0100 CALL haloce.00499C80 + 00486F94 83C4 04 ADD ESP,4 + 00486F97 5F POP EDI + 00486F98 5E POP ESI + 00486F99 81C4 00080000 ADD ESP,800 + 00486F9F C3 RETN + 00486FA0 8D4C24 04 LEA ECX,DWORD PTR SS:[ESP+4] + 00486FA4 51 PUSH ECX + 00486FA5 33C0 XOR EAX,EAX + 00486FA7 E8 D42C0100 CALL haloce.00499C80 + 00486FAC 83C4 04 ADD ESP,4 + 00486FAF 5E POP ESI + 00486FB0 81C4 00080000 ADD ESP,800 + 00486FB6 C3 RETN +<- \ No newline at end of file diff --git a/halo notes/local_chat.asm b/halo notes/local_chat.asm new file mode 100644 index 0000000..e4e885c --- /dev/null +++ b/halo notes/local_chat.asm @@ -0,0 +1,981 @@ +;notes by Jesus7Freak + +;found chat sender function + +;0018D8D4 L"test str" +00545E0F 83FD 0D CMP EBP,0D +00545E12 74 43 JE SHORT haloce.00545E57 +;00545E14 83FD 1B CMP EBP,1B +;00545E17 75 21 JNZ SHORT haloce.00545E3A +;00545E19 A0 A8E76400 MOV AL,BYTE PTR DS:[64E7A8] +;00545E1E 84C0 TEST AL,AL +;00545E20 74 13 JE SHORT haloce.00545E35 +;00545E22 68 FA000000 PUSH 0FA +;00545E27 33FF XOR EDI,EDI +;00545E29 E8 42DDF4FF CALL haloce.00493B70 +;00545E2E 8B7C24 44 MOV EDI,DWORD PTR SS:[ESP+44] +;00545E32 83C4 04 ADD ESP,4 +;00545E35 E8 367FF6FF CALL haloce.004ADD70 +;00545E3A 8B4424 44 MOV EAX,DWORD PTR SS:[ESP+44] +;00545E3E 85C0 TEST EAX,EAX +;00545E40 8BCF MOV ECX,EDI +;00545E42 8BC5 MOV EAX,EBP +;00545E44 75 50 JNZ SHORT haloce.00545E96 +;00545E46 E8 45DEF4FF CALL haloce.00493C90 +;00545E4B 5F POP EDI ; Case F100 of switch 00545B1E +;00545E4C 5E POP ESI +;00545E4D 5D POP EBP +;00545E4E 33C0 XOR EAX,EAX +;00545E50 5B POP EBX +;00545E51 83C4 28 ADD ESP,28 +;00545E54 C2 1000 RETN 10 +00545E57 A0 A8E76400 MOV AL,BYTE PTR DS:[64E7A8] +00545E5C 84C0 TEST AL,AL +00545E5E ^74 DA JE SHORT haloce.00545E3A +00545E60 E8 BB7FF6FF CALL haloce.004ADE20 +-> +004ADE20 A0 A8E76400 MOV AL,BYTE PTR DS:[64E7A8] ;->AL=01 +004ADE25 81EC 00020000 SUB ESP,200 +004ADE2B 84C0 TEST AL,AL +004ADE2D 0F84 B8000000 JE haloce.004ADEEB +004ADE33 53 PUSH EBX +004ADE34 E8 C7090000 CALL haloce.004AE800;test if chat is from local player +-> + 004AE800 83EC 10 SUB ESP,10 + 004AE803 A1 C0558100 MOV EAX,DWORD PTR DS:[8155C0] ;"players" -> EAX=402AAF94 + 004AE808 56 PUSH ESI + 004AE809 894424 04 MOV DWORD PTR SS:[ESP+4],EAX + 004AE80D 57 PUSH EDI + 004AE80E 35 72657469 XOR EAX,69746572 + 004AE813 83CE FF OR ESI,FFFFFFFF + 004AE816 8D7C24 08 LEA EDI,DWORD PTR SS:[ESP+8] + 004AE81A 66:C74424 0C 0000 MOV WORD PTR SS:[ESP+C],0 + 004AE821 897424 10 MOV DWORD PTR SS:[ESP+10],ESI + 004AE825 894424 14 MOV DWORD PTR SS:[ESP+14],EAX + 004AE829 E8 E2520200 CALL haloce.004D3B10 ;get valid staic player ptr and tag + 004AE82E 85C0 TEST EAX,EAX ;EAX=402AAFCC player 0 + 004AE830 74 13 JE SHORT haloce.004AE845 + 004AE832 66:3970 02 /CMP WORD PTR DS:[EAX+2],SI ;test player_0->IsLocalPlayer = 0 (0 = local player) + 004AE836 75 15 |JNZ SHORT haloce.004AE84D + ;004AE838 8D7C24 08 |LEA EDI,DWORD PTR SS:[ESP+8] + ;004AE83C E8 CF520200 |CALL haloce.004D3B10 + ;004AE841 85C0 |TEST EAX,EAX + ;004AE843 ^75 ED \JNZ SHORT haloce.004AE832 + ;004AE845 5F POP EDI + ;004AE846 8BC6 MOV EAX,ESI + ;004AE848 5E POP ESI + ;004AE849 83C4 10 ADD ESP,10 + ;004AE84C C3 RETN + 004AE84D 0FBE40 67 MOVSX EAX,BYTE PTR DS:[EAX+67] + 004AE851 5F POP EDI + 004AE852 5E POP ESI + 004AE853 83C4 10 ADD ESP,10 + 004AE856 C3 RETN +<- +004ADE39 8BD8 MOV EBX,EAX;->EBX=00000000 +004ADE3B 83FB FF CMP EBX,-1 +004ADE3E 0F84 A1000000 JE haloce.004ADEE5 +004ADE44 A1 607D6300 MOV EAX,DWORD PTR DS:[637D60] ;->EAX=0060E770 "KeystoneEditbox" +004ADE49 8B0D 94D16B00 MOV ECX,DWORD PTR DS:[6BD194] ;->ECX=084F1BC8 +004ADE4F 56 PUSH ESI +004ADE50 57 PUSH EDI +004ADE51 50 PUSH EAX +004ADE52 51 PUSH ECX +004ADE53 33F6 XOR ESI,ESI +004ADE55 FF15 A8D16B00 CALL DWORD PTR DS:[6BD1A8] ; keystone.Call_KsGetWindow +-> + 102127A0 > 8B4C24 04 MOV ECX,DWORD PTR SS:[ESP+4] + 102127A4 85C9 TEST ECX,ECX + 102127A6 74 0B JE SHORT keystone.102127B3 + 102127A8 8B5424 08 MOV EDX,DWORD PTR SS:[ESP+8] + 102127AC 8B01 MOV EAX,DWORD PTR DS:[ECX] ;EAX=102F2C58 keystone.102F2C58 + 102127AE 52 PUSH EDX + 102127AF FF50 14 CALL DWORD PTR DS:[EAX+14] + 102127B2 C3 RETN + ;102127B3 33C0 XOR EAX,EAX + ;102127B5 C3 RETN +<- +004ADE5B 8BF8 MOV EDI,EAX ;->EDI=084EB800 +004ADE5D 83C4 08 ADD ESP,8 +004ADE60 85FF TEST EDI,EDI +004ADE62 74 7F JE SHORT haloce.004ADEE3 + +004ADE64 68 8CA46000 PUSH haloce.0060A48C ; UNICODE "oEditbox" +004ADE69 57 PUSH EDI +004ADE6A FF15 BCD16B00 CALL DWORD PTR DS:[6BD1BC] ; keystone.Call_KW_GetControlByID +-> + 10212870 > 8B4C24 04 MOV ECX,DWORD PTR SS:[ESP+4] ;->ECX=084EB800 + 10212874 85C9 TEST ECX,ECX + 10212876 74 0E JE SHORT keystone.10212886 + 10212878 8B5424 08 MOV EDX,DWORD PTR SS:[ESP+8] ;->EDX=0060A48C L"oEditbox" + 1021287C 8B01 MOV EAX,DWORD PTR DS:[ECX] + 1021287E 52 PUSH EDX + 1021287F FF90 84000000 CALL DWORD PTR DS:[EAX+84] + 10212885 C3 RETN + ;10212886 33C0 XOR EAX,EAX + ;10212888 C3 RETN +<- +004ADE70 83C4 08 ADD ESP,8 + +004ADE73 85C0 TEST EAX,EAX ;EAX=09539500 +004ADE75 74 11 JE SHORT haloce.004ADE88 + +004ADE77 68 A0A46000 PUSH haloce.0060A4A0 ; UNICODE "text" +004ADE7C 50 PUSH EAX +004ADE7D FF15 D0D16B00 CALL DWORD PTR DS:[6BD1D0] ; keystone.Call_KC_GetAttribute +-> + 10212910 > 8B4C24 04 MOV ECX,DWORD PTR SS:[ESP+4] ;->ECX=09539500 + 10212914 85C9 TEST ECX,ECX + 10212916 74 0B JE SHORT keystone.10212923 + 10212918 8B5424 08 MOV EDX,DWORD PTR SS:[ESP+8] ;->EDX=haloce.0060A4A0 ; UNICODE "text" + 1021291C 8B01 MOV EAX,DWORD PTR DS:[ECX] ;->EAX=02464790 + 1021291E 52 PUSH EDX + 1021291F FF50 60 CALL DWORD PTR DS:[EAX+60] ;DS:[024647F0]=0241AAC0 + 10212922 C3 RETN + ;10212923 33C0 XOR EAX,EAX + ;10212925 C3 RETN +<- +004ADE83 83C4 08 ADD ESP,8 + +004ADE86 8BF0 MOV ESI,EAX ;->ESI=09401588 L"test str" <------------------ from chat +004ADE88 57 PUSH EDI +004ADE89 FF15 B8D16B00 CALL DWORD PTR DS:[6BD1B8] ; keystone.Call_KW_Release +004ADE8F 83C4 04 ADD ESP,4 +004ADE92 85F6 TEST ESI,ESI +004ADE94 74 4D JE SHORT haloce.004ADEE3 +004ADE96 66:833E 00 CMP WORD PTR DS:[ESI],0 ;[ESI]=0074 L't' +004ADE9A 74 47 JE SHORT haloce.004ADEE3 + +004ADE9C 56 PUSH ESI ;wchar_t* string +004ADE9D E8 F8CF1100 CALL haloce.005CAE9A ;get string length +-> + 005CAE9A 8B4424 04 MOV EAX,DWORD PTR SS:[ESP+4] + 005CAE9E 66:8B08 MOV CX,WORD PTR DS:[EAX] ;<------------1: + 005CAEA1 40 INC EAX + 005CAEA2 40 INC EAX + 005CAEA3 66:85C9 TEST CX,CX + 005CAEA6 ^75 F6 JNZ SHORT haloce.005CAE9E + 005CAEA8 2B4424 04 SUB EAX,DWORD PTR SS:[ESP+4] + 005CAEAC D1F8 SAR EAX,1 + 005CAEAE 48 DEC EAX + 005CAEAF C3 RETN +<- +004ADEA2 83C4 04 ADD ESP,4 + +004ADEA5 3D FE000000 CMP EAX,0FE +004ADEAA 76 07 JBE SHORT haloce.004ADEB3 +;004ADEAC BF FE000000 MOV EDI,0FE +;004ADEB1 EB 0B JMP SHORT haloce.004ADEBE + +004ADEB3 56 PUSH ESI ;string +004ADEB4 E8 E1CF1100 CALL haloce.005CAE9A ;get string length (it gets called again?) +004ADEB9 83C4 04 ADD ESP,4 + +004ADEBC 8BF8 MOV EDI,EAX;->EDX=00000008 +004ADEBE 57 PUSH EDI ;string length param3 +004ADEBF 8D5424 10 LEA EDX,DWORD PTR SS:[ESP+10] ;buffer to copy to ->EDX=0018D8D4 (00000000) +004ADEC3 56 PUSH ESI ;string param2 +004ADEC4 52 PUSH EDX ;ptr to player index param1 +004ADEC5 E8 59EF1100 CALL haloce.005CCE23 +-> + 005CCE23 8B4C24 0C MOV ECX,DWORD PTR SS:[ESP+C] ;->ECX=00000008 str len + 005CCE27 85C9 TEST ECX,ECX + 005CCE29 56 PUSH ESI + 005CCE2A 57 PUSH EDI + 005CCE2B 8B7C24 0C MOV EDI,DWORD PTR SS:[ESP+C] ;->EDI=0018D8D4 + 005CCE2F 8BF7 MOV ESI,EDI + 005CCE31 74 28 JE SHORT haloce.005CCE5B + 005CCE33 8B5424 10 MOV EDX,DWORD PTR SS:[ESP+10] ;->EDX=09401588 "test str" (chat) + 005CCE37 66:8B02 /MOV AX,WORD PTR DS:[EDX] ;->AX=0074 + 005CCE3A 66:8907 |MOV WORD PTR DS:[EDI],AX ;copy to buffer + 005CCE3D 47 |INC EDI + 005CCE3E 47 |INC EDI + 005CCE3F 42 |INC EDX + 005CCE40 42 |INC EDX + 005CCE41 66:85C0 |TEST AX,AX + 005CCE44 74 03 |JE SHORT haloce.005CCE49 + 005CCE46 49 |DEC ECX + 005CCE47 ^75 EE \JNZ SHORT haloce.005CCE37 + 005CCE49 85C9 TEST ECX,ECX + 005CCE4B 74 0E JE SHORT haloce.005CCE5B + ;005CCE4D 49 DEC ECX + ;005CCE4E 74 0B JE SHORT haloce.005CCE5B + ;005CCE50 33C0 XOR EAX,EAX + ;005CCE52 D1E9 SHR ECX,1 + ;005CCE54 F3:AB REP STOS DWORD PTR ES:[EDI] + ;005CCE56 13C9 ADC ECX,ECX + ;005CCE58 66:F3:AB REP STOS WORD PTR ES:[EDI] + 005CCE5B 5F POP EDI + 005CCE5C 8BC6 MOV EAX,ESI + 005CCE5E 5E POP ESI + 005CCE5F C3 RETN +<- +004ADECA A1 ACE76400 MOV EAX,DWORD PTR DS:[64E7AC] ;->EAX=00000000 +004ADECF 53 PUSH EBX ;EBX=00000000 param2 ptr? +004ADED0 8D5424 1C LEA EDX,DWORD PTR SS:[ESP+1C] ;->EDX=0018D8D4 L"test str" fastcall param1 +004ADED4 66:C7447C 1C 0000 MOV WORD PTR SS:[ESP+EDI*2+1C],0 ;add null terminator +004ADEDB E8 90000000 CALL haloce.004ADF70 +-> + 004ADF70 83EC 10 SUB ESP,10 + 004ADF73 8A4C24 14 MOV CL,BYTE PTR SS:[ESP+14] ;->CL=00 param2 + 004ADF77 55 PUSH EBP + 004ADF78 6A 00 PUSH 0 + 004ADF7A 6A 01 PUSH 1 + 004ADF7C 6A 00 PUSH 0 + 004ADF7E 884C24 18 MOV BYTE PTR SS:[ESP+18],CL + 004ADF82 8D4C24 24 LEA ECX,DWORD PTR SS:[ESP+24] ;address of param2->ECX=0018D8B8 + 004ADF86 51 PUSH ECX + 004ADF87 894424 18 MOV DWORD PTR SS:[ESP+18],EAX + 004ADF8B 6A 00 PUSH 0 + 004ADF8D 8D4424 1C LEA EAX,DWORD PTR SS:[ESP+1C] + 004ADF91 895424 24 MOV DWORD PTR SS:[ESP+24],EDX + 004ADF95 894424 2C MOV DWORD PTR SS:[ESP+2C],EAX + 004ADF99 6A 0F PUSH 0F + 004ADF9B 6A 00 PUSH 0 + 004ADF9D BA F87F0000 MOV EDX,7FF8 ;param2 + 004ADFA2 B8 20CE8000 MOV EAX,haloce.0080CE20 ;param1 + 004ADFA7 C74424 20 00000000 MOV DWORD PTR SS:[ESP+20],0 + 004ADFAF E8 1C260400 CALL haloce.004F05D0 + -> + 004F05D0 81EC A4000000 SUB ESP,0A4 + 004F05D6 53 PUSH EBX + 004F05D7 55 PUSH EBP + 004F05D8 8BAC24 BC000000 MOV EBP,DWORD PTR SS:[ESP+BC] ;struc ptr? ->EBP=0018D8B8 + 004F05DF 33DB XOR EBX,EBX + 004F05E1 56 PUSH ESI + 004F05E2 8BF0 MOV ESI,EAX ;->ESI=0080CE20 + 004F05E4 57 PUSH EDI + 004F05E5 33C0 XOR EAX,EAX + 004F05E7 885C24 20 MOV BYTE PTR SS:[ESP+20],BL ;BL=00 Stack SS:[0018D7EC]=28 ('(') + 004F05EB B9 24000000 MOV ECX,24 + 004F05F0 8D7C24 24 LEA EDI,DWORD PTR SS:[ESP+24] ;->EDI=0018D7F0 + 004F05F4 F3:AB REP STOS DWORD PTR ES:[EDI] ;set stack from 0018D7F0 to 0018D880 to zero + 004F05F6 8B8C24 BC000000 MOV ECX,DWORD PTR SS:[ESP+BC] ;->ECX=0000000F + 004F05FD 8B048D 40BA5F00 MOV EAX,DWORD PTR DS:[ECX*4+5FBA40] ;->EAX=0062E460 + 004F0604 8B40 0C MOV EAX,DWORD PTR DS:[EAX+C] ;->EAX=00000007 + 004F0607 895424 30 MOV DWORD PTR SS:[ESP+30],EDX ;EDX=00007FF8 Stack SS:[0018D7FC]=00000000 store param2 + 004F060B 2BD0 SUB EDX,EAX ;->EDX=00007FF1 + 004F060D 894C24 24 MOV DWORD PTR SS:[ESP+24],ECX + 004F0611 8B8C24 B8000000 MOV ECX,DWORD PTR SS:[ESP+B8] ;->ECX=00000000 + 004F0618 895424 38 MOV DWORD PTR SS:[ESP+38],EDX + 004F061C 897424 2C MOV DWORD PTR SS:[ESP+2C],ESI + 004F0620 897424 40 MOV DWORD PTR SS:[ESP+40],ESI + 004F0624 8D50 FF LEA EDX,DWORD PTR DS:[EAX-1] ;->EDX=00000006 + 004F0627 8D7424 20 LEA ESI,DWORD PTR SS:[ESP+20] ;->ESI=0018D7EC + 004F062B 894C24 28 MOV DWORD PTR SS:[ESP+28],ECX + 004F062F 895C24 34 MOV DWORD PTR SS:[ESP+34],EBX + 004F0633 895C24 58 MOV DWORD PTR SS:[ESP+58],EBX + 004F0637 894424 5C MOV DWORD PTR SS:[ESP+5C],EAX + 004F063B 895C24 4C MOV DWORD PTR SS:[ESP+4C],EBX + 004F063F 895C24 48 MOV DWORD PTR SS:[ESP+48],EBX + 004F0643 895C24 3C MOV DWORD PTR SS:[ESP+3C],EBX + 004F0647 895C24 44 MOV DWORD PTR SS:[ESP+44],EBX + 004F064B 895424 50 MOV DWORD PTR SS:[ESP+50],EDX + 004F064F 894424 54 MOV DWORD PTR SS:[ESP+54],EAX + 004F0653 C64424 20 01 MOV BYTE PTR SS:[ESP+20],1 + 004F0658 E8 33030000 CALL haloce.004F0990 + -> + 004F0990 51 PUSH ECX + 004F0991 A1 64826B00 MOV EAX,DWORD PTR DS:[6B8264] ;->EAX=00000000 + 004F0996 53 PUSH EBX + 004F0997 57 PUSH EDI + 004F0998 894424 08 MOV DWORD PTR SS:[ESP+8],EAX + 004F099C 8B46 08 MOV EAX,DWORD PTR DS:[ESI+8] ;->EAX=00000000 + 004F099F 8D7E 1C LEA EDI,DWORD PTR DS:[ESI+1C] ;->EDI=0018D808 + 004F09A2 50 PUSH EAX + 004F09A3 8BD7 MOV EDX,EDI ;->EDX=0018D808 + 004F09A5 E8 3625FEFF CALL haloce.004D2EE0 + -> + 004D2EE0 53 PUSH EBX + 004D2EE1 8B5A 08 MOV EBX,DWORD PTR DS:[EDX+8] ;->EBX=00000000 + 004D2EE4 56 PUSH ESI + 004D2EE5 8B72 0C MOV ESI,DWORD PTR DS:[EDX+C] ;->ESI=00000000 + 004D2EE8 57 PUSH EDI + 004D2EE9 8B7A 10 MOV EDI,DWORD PTR DS:[EDX+10] ;->EDI=00000000 + 004D2EEC 8D0CF7 LEA ECX,DWORD PTR DS:[EDI+ESI*8] ;->ECX=00000000 + 004D2EEF 32C0 XOR AL,AL + 004D2EF1 3BCB CMP ECX,EBX + 004D2EF3 72 5C JB SHORT haloce.004D2F51 + 004D2EF5 3B4A 14 CMP ECX,DWORD PTR DS:[EDX+14] ;Stack DS:[0018D81C]=00000006 + 004D2EF8 77 57 JA SHORT haloce.004D2F51 + 004D2EFA 837C24 10 01 CMP DWORD PTR SS:[ESP+10],1 ;Stack SS:[0018D7B8]=00000000 + 004D2EFF 75 11 JNZ SHORT haloce.004D2F12 + ;004D2F01 8B42 04 MOV EAX,DWORD PTR DS:[EDX+4] + ;004D2F04 03F0 ADD ESI,EAX + ;004D2F06 8BCF MOV ECX,EDI + ;004D2F08 B0 01 MOV AL,1 + ;004D2F0A D2E0 SHL AL,CL + ;004D2F0C 8A0E MOV CL,BYTE PTR DS:[ESI] + ;004D2F0E 0AC8 OR CL,AL + ;004D2F10 EB 11 JMP SHORT haloce.004D2F23 + 004D2F12 8B4A 04 MOV ECX,DWORD PTR DS:[EDX+4] ;->ECX=0080CE20 + 004D2F15 03F1 ADD ESI,ECX ;->ESI=0080CE20 + 004D2F17 8BCF MOV ECX,EDI ;->ECX=00000000 + 004D2F19 B0 01 MOV AL,1 + 004D2F1B D2E0 SHL AL,CL ;->AL=01 + 004D2F1D 8A0E MOV CL,BYTE PTR DS:[ESI] ;->CL=4D 'M' + 004D2F1F F6D0 NOT AL ;->AL=FE + 004D2F21 22C8 AND CL,AL ;->CL=4C 'L' + 004D2F23 880E MOV BYTE PTR DS:[ESI],CL + 004D2F25 8B4A 0C MOV ECX,DWORD PTR DS:[EDX+C] ;->ECX=00000000 + 004D2F28 8B42 10 MOV EAX,DWORD PTR DS:[EDX+10] ;->EAX=00000000 + 004D2F2B 8D44C8 01 LEA EAX,DWORD PTR DS:[EAX+ECX*8+1] ;->EAX=00000001 + 004D2F2F 3B42 08 CMP EAX,DWORD PTR DS:[EDX+8] ;Stack DS:[0018D810]=00000000 + 004D2F32 72 05 JB SHORT haloce.004D2F39 + 004D2F34 3B42 14 CMP EAX,DWORD PTR DS:[EDX+14] ;Stack DS:[0018D81C]=00000006 + 004D2F37 76 08 JBE SHORT haloce.004D2F41 + ;004D2F39 8B4A 14 MOV ECX,DWORD PTR DS:[EDX+14] + ;004D2F3C 41 INC ECX + ;004D2F3D 3BC1 CMP EAX,ECX + ;004D2F3F 75 0E JNZ SHORT haloce.004D2F4F + 004D2F41 8BC8 MOV ECX,EAX ;->ECX=00000001 + 004D2F43 83E1 07 AND ECX,7 ;->ECX=00000001 + 004D2F46 C1E8 03 SHR EAX,3 ;->EAX=00000000 + 004D2F49 894A 10 MOV DWORD PTR DS:[EDX+10],ECX + 004D2F4C 8942 0C MOV DWORD PTR DS:[EDX+C],EAX + 004D2F4F B0 01 MOV AL,1 + 004D2F51 5F POP EDI + 004D2F52 5E POP ESI + 004D2F53 5B POP EBX + 004D2F54 C3 RETN + <- + 004F09AA 8B96 84000000 MOV EDX,DWORD PTR DS:[ESI+84] ;->EDX=00000000 + 004F09B0 84C0 TEST AL,AL + 004F09B2 0F95C3 SETNE BL ;->BL=01 + 004F09B5 83C2 06 ADD EDX,6 ;->EDX=00000006 + 004F09B8 8BC2 MOV EAX,EDX ;->EAX=00000006 + 004F09BA 50 PUSH EAX + 004F09BB 8D4E 04 LEA ECX,DWORD PTR DS:[ESI+4] ;->ECX=0018D7F0 + 004F09BE 8BC7 MOV EAX,EDI ;->EAX=0018D808 + 004F09C0 C786 80000000 01000000 MOV DWORD PTR DS:[ESI+80],1 + 004F09CA 8996 84000000 MOV DWORD PTR DS:[ESI+84],EDX + 004F09D0 E8 5B24FEFF CALL haloce.004D2E30 + 004F09D5 83C4 08 ADD ESP,8 + 004F09D8 85C0 TEST EAX,EAX ;00000006 + 004F09DA 74 08 JE SHORT haloce.004F09E4 + 004F09DC 84DB TEST BL,BL ;01 + 004F09DE 74 04 JE SHORT haloce.004F09E4 + 004F09E0 B3 01 MOV BL,1 + 004F09E2 EB 02 JMP SHORT haloce.004F09E6 + ;004F09E4 32DB XOR BL,BL + 004F09E6 803D 60826B00 01 CMP BYTE PTR DS:[6B8260],1 ;00 + 004F09ED 75 6D JNZ SHORT haloce.004F0A5C + ;004F09EF 0FB60D 6C826B00 MOVZX ECX,BYTE PTR DS:[6B826C] + ;004F09F6 51 PUSH ECX + ;004F09F7 8BD7 MOV EDX,EDI + ;004F09F9 C786 88000000 02000000 MOV DWORD PTR DS:[ESI+88],2 + ;004F0A03 E8 D824FEFF CALL haloce.004D2EE0 + ;004F0A08 83C4 04 ADD ESP,4 + ;004F0A0B 84C0 TEST AL,AL + ;004F0A0D 74 08 JE SHORT haloce.004F0A17 + ;004F0A0F 84DB TEST BL,BL + ;004F0A11 74 04 JE SHORT haloce.004F0A17 + ;004F0A13 B3 01 MOV BL,1 + ;004F0A15 EB 02 JMP SHORT haloce.004F0A19 + ;004F0A17 32DB XOR BL,BL + ;004F0A19 8B96 88000000 MOV EDX,DWORD PTR DS:[ESI+88] + ;004F0A1F 52 PUSH EDX + ;004F0A20 8D4C24 0C LEA ECX,DWORD PTR SS:[ESP+C] + ;004F0A24 8BC7 MOV EAX,EDI + ;004F0A26 E8 0524FEFF CALL haloce.004D2E30 + ;004F0A2B 83C4 04 ADD ESP,4 + ;004F0A2E 85C0 TEST EAX,EAX + ;004F0A30 74 17 JE SHORT haloce.004F0A49 + ;004F0A32 84DB TEST BL,BL + ;004F0A34 74 13 JE SHORT haloce.004F0A49 + ;004F0A36 8B8E 88000000 MOV ECX,DWORD PTR DS:[ESI+88] + ;004F0A3C 41 INC ECX + ;004F0A3D 5F POP EDI + ;004F0A3E B0 01 MOV AL,1 + ;004F0A40 898E 88000000 MOV DWORD PTR DS:[ESI+88],ECX + ;004F0A46 5B POP EBX + ;004F0A47 59 POP ECX + ;004F0A48 C3 RETN + ;004F0A49 8B8E 88000000 MOV ECX,DWORD PTR DS:[ESI+88] + ;004F0A4F 32C0 XOR AL,AL + ;004F0A51 41 INC ECX + ;004F0A52 5F POP EDI + ;004F0A53 898E 88000000 MOV DWORD PTR DS:[ESI+88],ECX + ;004F0A59 5B POP EBX + ;004F0A5A 59 POP ECX + ;004F0A5B C3 RETN + 004F0A5C 5F POP EDI + 004F0A5D 8AC3 MOV AL,BL ;->AL=01 + 004F0A5F 5B POP EBX + 004F0A60 59 POP ECX + 004F0A61 C3 RETN + <- + 004F065D 8B8424 CC000000 MOV EAX,DWORD PTR SS:[ESP+CC] ;->EAX=00000001 + 004F0664 3BC3 CMP EAX,EBX ;EBX=00000000 + 004F0666 0F8E 25010000 JLE haloce.004F0791 + 004F066C 8B9424 C0000000 MOV EDX,DWORD PTR SS:[ESP+C0] ;->EDX=00000000 + 004F0673 8BB424 C8000000 MOV ESI,DWORD PTR SS:[ESP+C8] ;->ESI=00000000 + 004F067A 2BD5 SUB EDX,EBP ;->EDX=FFE72748 + 004F067C 8BCD MOV ECX,EBP ;->ECX=0018D8B8 + 004F067E 2BF5 SUB ESI,EBP ;->ESI=FFE72748 + 004F0680 894C24 10 MOV DWORD PTR SS:[ESP+10],ECX + 004F0684 895424 14 MOV DWORD PTR SS:[ESP+14],EDX + 004F0688 897424 1C MOV DWORD PTR SS:[ESP+1C],ESI + 004F068C 894424 18 MOV DWORD PTR SS:[ESP+18],EAX + 004F0690 EB 0E JMP SHORT haloce.004F06A0 + ;004F0692 8B7424 1C /MOV ESI,DWORD PTR SS:[ESP+1C] + ;004F0696 8B5424 14 |MOV EDX,DWORD PTR SS:[ESP+14] + ;004F069A 8B4C24 10 |MOV ECX,DWORD PTR SS:[ESP+10] + ;004F069E 8BFF |MOV EDI,EDI + 004F06A0 399C24 C0000000 CMP DWORD PTR SS:[ESP+C0],EBX ;Stack SS:[0018D88C]=00000000 + 004F06A7 75 04 |JNZ SHORT haloce.004F06AD + 004F06A9 33FF |XOR EDI,EDI + 004F06AB EB 03 |JMP SHORT haloce.004F06B0 + ;004F06AD 8B3C0A |MOV EDI,DWORD PTR DS:[EDX+ECX] + 004F06B0 399C24 B8000000 |CMP DWORD PTR SS:[ESP+B8],EBX ;Stack SS:[0018D884]=00000000 + 004F06B7 8B29 |MOV EBP,DWORD PTR DS:[ECX] ;->EBP=0018D8A8 + 004F06B9 75 04 |JNZ SHORT haloce.004F06BF + 004F06BB 33F6 |XOR ESI,ESI + 004F06BD EB 03 |JMP SHORT haloce.004F06C2 + ;004F06BF 8B340E |MOV ESI,DWORD PTR DS:[ESI+ECX] + 004F06C2 8D4424 20 |LEA EAX,DWORD PTR SS:[ESP+20] ;->EAX=0018D7EC + 004F06C6 E8 25010000 |CALL haloce.004F07F0 + -> + 004F07F0 8B48 08 MOV ECX,DWORD PTR DS:[EAX+8] ;->ECX=00000000 + 004F07F3 53 PUSH EBX + 004F07F4 56 PUSH ESI + 004F07F5 57 PUSH EDI + 004F07F6 33FF XOR EDI,EDI + 004F07F8 83F9 01 CMP ECX,1 + 004F07FB 8978 40 MOV DWORD PTR DS:[EAX+40],EDI + 004F07FE 8978 44 MOV DWORD PTR DS:[EAX+44],EDI + 004F0801 75 3B JNZ SHORT haloce.004F083E + ;004F0803 8B48 04 MOV ECX,DWORD PTR DS:[EAX+4] + ;004F0806 8B148D 40BA5F00 MOV EDX,DWORD PTR DS:[ECX*4+5FBA40] + ;004F080D 8B48 3C MOV ECX,DWORD PTR DS:[EAX+3C] + ;004F0810 8B52 20 MOV EDX,DWORD PTR DS:[EDX+20] + ;004F0813 8B70 0C MOV ESI,DWORD PTR DS:[EAX+C] + ;004F0816 8BD9 MOV EBX,ECX + ;004F0818 83E3 07 AND EBX,7 + ;004F081B 8958 58 MOV DWORD PTR DS:[EAX+58],EBX + ;004F081E 8BD9 MOV EBX,ECX + ;004F0820 8948 50 MOV DWORD PTR DS:[EAX+50],ECX + ;004F0823 8D4C11 FF LEA ECX,DWORD PTR DS:[ECX+EDX-1] + ;004F0827 C1EB 03 SHR EBX,3 + ;004F082A 8948 5C MOV DWORD PTR DS:[EAX+5C],ECX + ;004F082D 8958 54 MOV DWORD PTR DS:[EAX+54],EBX + ;004F0830 8978 48 MOV DWORD PTR DS:[EAX+48],EDI + ;004F0833 8970 4C MOV DWORD PTR DS:[EAX+4C],ESI + ;004F0836 8950 60 MOV DWORD PTR DS:[EAX+60],EDX + ;004F0839 0150 40 ADD DWORD PTR DS:[EAX+40],EDX + ;004F083C EB 19 JMP SHORT haloce.004F0857 + 004F083E 33D2 XOR EDX,EDX + 004F0840 8D48 48 LEA ECX,DWORD PTR DS:[EAX+48] ;->ECX=0018D834 + 004F0843 8911 MOV DWORD PTR DS:[ECX],EDX + 004F0845 8951 04 MOV DWORD PTR DS:[ECX+4],EDX + 004F0848 8951 08 MOV DWORD PTR DS:[ECX+8],EDX + 004F084B 8951 0C MOV DWORD PTR DS:[ECX+C],EDX + 004F084E 8951 10 MOV DWORD PTR DS:[ECX+10],EDX + 004F0851 8951 14 MOV DWORD PTR DS:[ECX+14],EDX + 004F0854 8951 18 MOV DWORD PTR DS:[ECX+18],EDX + 004F0857 8B70 40 MOV ESI,DWORD PTR DS:[EAX+40] + 004F085A 8B48 3C MOV ECX,DWORD PTR DS:[EAX+3C] ;->ECX=00000007 + 004F085D 8B50 18 MOV EDX,DWORD PTR DS:[EAX+18] ;->EDX=00007FF1 + 004F0860 03CE ADD ECX,ESI + 004F0862 2BD6 SUB EDX,ESI + 004F0864 8B70 0C MOV ESI,DWORD PTR DS:[EAX+C] ;->ESI=0080CE20 + 004F0867 8BD9 MOV EBX,ECX ;->EBX=00000007 + 004F0869 83E3 07 AND EBX,7 + 004F086C 8958 74 MOV DWORD PTR DS:[EAX+74],EBX + 004F086F 8BD9 MOV EBX,ECX + 004F0871 8978 64 MOV DWORD PTR DS:[EAX+64],EDI + 004F0874 8948 6C MOV DWORD PTR DS:[EAX+6C],ECX + 004F0877 5F POP EDI + 004F0878 C1EB 03 SHR EBX,3 ;->EBX=00000000 + 004F087B 8970 68 MOV DWORD PTR DS:[EAX+68],ESI + 004F087E 8D4C0A FF LEA ECX,DWORD PTR DS:[EDX+ECX-1] ;->ECX=00007FF7 + 004F0882 8958 70 MOV DWORD PTR DS:[EAX+70],EBX + 004F0885 5E POP ESI + 004F0886 8948 78 MOV DWORD PTR DS:[EAX+78],ECX + 004F0889 8950 7C MOV DWORD PTR DS:[EAX+7C],EDX + 004F088C B0 01 MOV AL,1 + 004F088E 5B POP EBX + 004F088F C3 RETN + <- + 004F06CB 56 |PUSH ESI ;00000000 + 004F06CC 55 |PUSH EBP ;0018D8A8=0 + 004F06CD 57 |PUSH EDI ;00000000 + 004F06CE 8D4424 2C |LEA EAX,DWORD PTR SS:[ESP+2C] ;->EAX=0018D7EC + 004F06D2 E8 B9010000 |CALL haloce.004F0890 + -> + 004F0890 83EC 08 SUB ESP,8 + 004F0893 53 PUSH EBX + 004F0894 55 PUSH EBP + 004F0895 56 PUSH ESI + 004F0896 8BF0 MOV ESI,EAX + 004F0898 8B46 04 MOV EAX,DWORD PTR DS:[ESI+4] + 004F089B 8B0C85 40BA5F00 MOV ECX,DWORD PTR DS:[EAX*4+5FBA40] + 004F08A2 8B51 1C MOV EDX,DWORD PTR DS:[ECX+1C] + 004F08A5 833A 00 CMP DWORD PTR DS:[EDX],0 + 004F08A8 57 PUSH EDI + 004F08A9 894C24 14 MOV DWORD PTR SS:[ESP+14],ECX + 004F08AD 7E 68 JLE SHORT haloce.004F0917 + 004F08AF 8BC2 MOV EAX,EDX + 004F08B1 8B00 MOV EAX,DWORD PTR DS:[EAX] + 004F08B3 85C0 TEST EAX,EAX + 004F08B5 B3 01 MOV BL,1 + 004F08B7 7E 5E JLE SHORT haloce.004F0917 + ;004F08B9 8D6E 64 LEA EBP,DWORD PTR DS:[ESI+64] + ;004F08BC 33FF XOR EDI,EDI + ;004F08BE 894424 10 MOV DWORD PTR SS:[ESP+10],EAX + ;004F08C2 8B4E 04 /MOV ECX,DWORD PTR DS:[ESI+4] + ;004F08C5 8B148D 40BA5F00 |MOV EDX,DWORD PTR DS:[ECX*4+5FBA40] + ;004F08CC 8B42 1C |MOV EAX,DWORD PTR DS:[EDX+1C] + ;004F08CF 8B4C38 08 |MOV ECX,DWORD PTR DS:[EAX+EDI+8] + ;004F08D3 8B5424 1C |MOV EDX,DWORD PTR SS:[ESP+1C] + ;004F08D7 8D4438 08 |LEA EAX,DWORD PTR DS:[EAX+EDI+8] + ;004F08DB 8B40 04 |MOV EAX,DWORD PTR DS:[EAX+4] + ;004F08DE 55 |PUSH EBP + ;004F08DF 03C2 |ADD EAX,EDX + ;004F08E1 50 |PUSH EAX + ;004F08E2 6A 00 |PUSH 0 + ;004F08E4 51 |PUSH ECX + ;004F08E5 FF51 50 |CALL DWORD PTR DS:[ECX+50] + ;004F08E8 83C4 10 |ADD ESP,10 + ;004F08EB 85C0 |TEST EAX,EAX + ;004F08ED 7E 10 |JLE SHORT haloce.004F08FF + ;004F08EF 8B4E 40 |MOV ECX,DWORD PTR DS:[ESI+40] + ;004F08F2 03C8 |ADD ECX,EAX + ;004F08F4 84DB |TEST BL,BL + ;004F08F6 894E 40 |MOV DWORD PTR DS:[ESI+40],ECX + ;004F08F9 74 04 |JE SHORT haloce.004F08FF + ;004F08FB B3 01 |MOV BL,1 + ;004F08FD EB 02 |JMP SHORT haloce.004F0901 + ;004F08FF 32DB |XOR BL,BL + ;004F0901 8B4424 10 |MOV EAX,DWORD PTR SS:[ESP+10] + ;004F0905 83C7 10 |ADD EDI,10 + ;004F0908 48 |DEC EAX + ;004F0909 894424 10 |MOV DWORD PTR SS:[ESP+10],EAX + ;004F090D ^75 B3 \JNZ SHORT haloce.004F08C2 + ;004F090F 84DB TEST BL,BL + ;004F0911 74 69 JE SHORT haloce.004F097C + ;004F0913 8B4C24 14 MOV ECX,DWORD PTR SS:[ESP+14] + 004F0917 8B51 20 MOV EDX,DWORD PTR DS:[ECX+20] + 004F091A 33C0 XOR EAX,EAX + 004F091C B9 10000000 MOV ECX,10 + 004F0921 BF 10396500 MOV EDI,haloce.00653910 + 004F0926 F3:AB REP STOS DWORD PTR ES:[EDI] ;set stack to zero + 004F0928 8B4E 08 MOV ECX,DWORD PTR DS:[ESI+8] + 004F092B BD 01000000 MOV EBP,1 + 004F0930 3BCD CMP ECX,EBP + 004F0932 0F95C3 SETNE BL + 004F0935 33FF XOR EDI,EDI + 004F0937 85D2 TEST EDX,EDX + 004F0939 895424 14 MOV DWORD PTR SS:[ESP+14],EDX + 004F093D 7E 3D JLE SHORT haloce.004F097C + 004F093F 90 NOP + 004F0940 8B4C24 20 /MOV ECX,DWORD PTR SS:[ESP+20] + 004F0944 8B4424 24 |MOV EAX,DWORD PTR SS:[ESP+24] + 004F0948 51 |PUSH ECX + 004F0949 57 |PUSH EDI + 004F094A E8 21010000 |CALL haloce.004F0A70 + 004F094F 8B4E 08 |MOV ECX,DWORD PTR DS:[ESI+8] + 004F0952 83C4 08 |ADD ESP,8 + 004F0955 3BCD |CMP ECX,EBP + 004F0957 75 0C |JNZ SHORT haloce.004F0965 + 004F0959 84DB |TEST BL,BL + 004F095B 75 04 |JNZ SHORT haloce.004F0961 + 004F095D 84C0 |TEST AL,AL + 004F095F 74 10 |JE SHORT haloce.004F0971 + 004F0961 B3 01 |MOV BL,1 + 004F0963 EB 0E |JMP SHORT haloce.004F0973 + 004F0965 84DB |TEST BL,BL + 004F0967 74 08 |JE SHORT haloce.004F0971 + 004F0969 84C0 |TEST AL,AL + 004F096B 74 04 |JE SHORT haloce.004F0971 + 004F096D B3 01 |MOV BL,1 + 004F096F EB 02 |JMP SHORT haloce.004F0973 + 004F0971 32DB |XOR BL,BL + 004F0973 8B4424 14 |MOV EAX,DWORD PTR SS:[ESP+14] + 004F0977 47 |INC EDI + 004F0978 3BF8 |CMP EDI,EAX + 004F097A ^7C C4 \JL SHORT haloce.004F0940 + 004F097C 5F POP EDI + 004F097D 5E POP ESI + 004F097E 5D POP EBP + 004F097F 8AC3 MOV AL,BL + 004F0981 5B POP EBX + 004F0982 83C4 08 ADD ESP,8 + 004F0985 C3 RETN + <- + 004F06D7 8B4424 70 |MOV EAX,DWORD PTR SS:[ESP+70] + 004F06DB 83C4 0C |ADD ESP,0C + 004F06DE 3BC3 |CMP EAX,EBX + 004F06E0 7F 09 |JG SHORT haloce.004F06EB + 004F06E2 389C24 D0000000 |CMP BYTE PTR SS:[ESP+D0],BL + 004F06E9 74 2D |JE SHORT haloce.004F0718 + 004F06EB 8B4C24 60 |MOV ECX,DWORD PTR SS:[ESP+60] + 004F06EF 8B7C24 34 |MOV EDI,DWORD PTR SS:[ESP+34] + 004F06F3 8B7424 38 |MOV ESI,DWORD PTR SS:[ESP+38] + 004F06F7 8B5424 5C |MOV EDX,DWORD PTR SS:[ESP+5C] + 004F06FB 03C1 |ADD EAX,ECX + 004F06FD 8B4C24 58 |MOV ECX,DWORD PTR SS:[ESP+58] + 004F0701 03F8 |ADD EDI,EAX + 004F0703 2BF0 |SUB ESI,EAX + 004F0705 03D0 |ADD EDX,EAX + 004F0707 41 |INC ECX + 004F0708 897C24 34 |MOV DWORD PTR SS:[ESP+34],EDI + 004F070C 897424 38 |MOV DWORD PTR SS:[ESP+38],ESI + 004F0710 895424 5C |MOV DWORD PTR SS:[ESP+5C],EDX + 004F0714 894C24 58 |MOV DWORD PTR SS:[ESP+58],ECX + 004F0718 837C24 28 01 |CMP DWORD PTR SS:[ESP+28],1 + 004F071D 75 23 |JNZ SHORT haloce.004F0742 + 004F071F C74424 68 FFFFFF>|MOV DWORD PTR SS:[ESP+68],-1 + 004F0727 895C24 6C |MOV DWORD PTR SS:[ESP+6C],EBX + 004F072B 895C24 70 |MOV DWORD PTR SS:[ESP+70],EBX + 004F072F 895C24 74 |MOV DWORD PTR SS:[ESP+74],EBX + 004F0733 895C24 78 |MOV DWORD PTR SS:[ESP+78],EBX + 004F0737 895C24 7C |MOV DWORD PTR SS:[ESP+7C],EBX + 004F073B 899C24 80000000 |MOV DWORD PTR SS:[ESP+80],EBX + 004F0742 8B4C24 10 |MOV ECX,DWORD PTR SS:[ESP+10] + 004F0746 8B4424 18 |MOV EAX,DWORD PTR SS:[ESP+18] + 004F074A 83C1 04 |ADD ECX,4 + 004F074D 48 |DEC EAX + 004F074E C78424 84000000 >|MOV DWORD PTR SS:[ESP+84],-1 + 004F0759 899C24 88000000 |MOV DWORD PTR SS:[ESP+88],EBX + 004F0760 899C24 8C000000 |MOV DWORD PTR SS:[ESP+8C],EBX + 004F0767 899C24 90000000 |MOV DWORD PTR SS:[ESP+90],EBX + 004F076E 899C24 94000000 |MOV DWORD PTR SS:[ESP+94],EBX + 004F0775 899C24 98000000 |MOV DWORD PTR SS:[ESP+98],EBX + 004F077C 899C24 9C000000 |MOV DWORD PTR SS:[ESP+9C],EBX + 004F0783 894C24 10 |MOV DWORD PTR SS:[ESP+10],ECX + 004F0787 894424 18 |MOV DWORD PTR SS:[ESP+18],EAX + 004F078B ^0F85 01FFFFFF \JNZ haloce.004F0692 + 004F0791 8B4C24 34 MOV ECX,DWORD PTR SS:[ESP+34] + 004F0795 8B5424 24 MOV EDX,DWORD PTR SS:[ESP+24] + 004F0799 8B3C95 40BA5F00 MOV EDI,DWORD PTR DS:[EDX*4+5FBA40] + 004F07A0 33C0 XOR EAX,EAX + 004F07A2 3BCB CMP ECX,EBX + 004F07A4 7E 37 JLE SHORT haloce.004F07DD + 004F07A6 8B47 14 MOV EAX,DWORD PTR DS:[EDI+14] + 004F07A9 83F8 01 CMP EAX,1 + 004F07AC 7E 28 JLE SHORT haloce.004F07D6 + 004F07AE 0FB6B0 27BB5F00 MOVZX ESI,BYTE PTR DS:[EAX+5FBB27] + 004F07B5 8B4424 58 MOV EAX,DWORD PTR SS:[ESP+58] + 004F07B9 48 DEC EAX + 004F07BA 894424 14 MOV DWORD PTR SS:[ESP+14],EAX + 004F07BE 56 PUSH ESI + 004F07BF 8D4C24 18 LEA ECX,DWORD PTR SS:[ESP+18] + 004F07C3 8D4424 40 LEA EAX,DWORD PTR SS:[ESP+40] + 004F07C7 E8 6426FEFF CALL haloce.004D2E30 + 004F07CC 83C4 04 ADD ESP,4 + 004F07CF 89B424 AC000000 MOV DWORD PTR SS:[ESP+AC],ESI + 004F07D6 8B47 0C MOV EAX,DWORD PTR DS:[EDI+C] + 004F07D9 034424 34 ADD EAX,DWORD PTR SS:[ESP+34] + 004F07DD 5F POP EDI + 004F07DE 5E POP ESI + 004F07DF 5D POP EBP + 004F07E0 5B POP EBX + 004F07E1 81C4 A4000000 ADD ESP,0A4 + 004F07E7 C3 RETN + <- + 004ADFB4 8BE8 MOV EBP,EAX ;->EBP=0000009F + 004ADFB6 83C4 1C ADD ESP,1C + 004ADFB9 85ED TEST EBP,EBP + 004ADFBB 7E 73 JLE SHORT haloce.004AE030 + 004ADFBD 8B15 88736B00 MOV EDX,DWORD PTR DS:[6B7388] ;->EDX=haloce.0080DE20 + 004ADFC3 53 PUSH EBX + 004ADFC4 57 PUSH EDI + 004ADFC5 8BBA DC0A0000 MOV EDI,DWORD PTR DS:[EDX+ADC] ;->EDI=11084288 + 004ADFCB F687 8C0A0000 01 TEST BYTE PTR DS:[EDI+A8C],1 ;[]=2 + 004ADFD2 C64424 20 01 MOV BYTE PTR SS:[ESP+20],1 + 004ADFD7 8D5D 01 LEA EBX,DWORD PTR SS:[EBP+1] ;->EBX=000000A0 + 004ADFDA 75 52 JNZ SHORT haloce.004AE02E + 004ADFDC 8B47 1C MOV EAX,DWORD PTR DS:[EDI+1C] ;->EAX=00000001 + 004ADFDF 8B4F 24 MOV ECX,DWORD PTR DS:[EDI+24] ;->ECX=0000287F + 004ADFE2 56 PUSH ESI + 004ADFE3 8D77 10 LEA ESI,DWORD PTR DS:[EDI+10] ;->ESI=11084298 + 004ADFE6 C1E0 03 SHL EAX,3 ;->EAX=00000008 + 004ADFE9 2BC8 SUB ECX,EAX ;->ECX=00002877 + 004ADFEB 2B4E 10 SUB ECX,DWORD PTR DS:[ESI+10] ;->ECX=00002874 + 004ADFEE 41 INC ECX ;->ECX=00002875 + 004ADFEF 3BD9 CMP EBX,ECX ;EBX=000000A0 + 004ADFF1 7E 0F JLE SHORT haloce.004AE002 + ;004ADFF3 6A 01 PUSH 1 + ;004ADFF5 57 PUSH EDI + ;004ADFF6 E8 65310300 CALL haloce.004E1160 + ;004ADFFB 83C4 08 ADD ESP,8 + ;004ADFFE 84C0 TEST AL,AL + ;004AE000 74 2B JE SHORT haloce.004AE02D + 004AE002 019F 800A0000 ADD DWORD PTR DS:[EDI+A80],EBX ;DS:[11084D08]=000000E0 += EBX=000000A0 + 004AE008 6A 01 PUSH 1 ;param1 (1st pushed param) + 004AE00A 8D4C24 28 LEA ECX,DWORD PTR SS:[ESP+28];address of param2 ->ECX=0018D8B8 + 004AE00E 8BC6 MOV EAX,ESI ;->EAX=11084298 + 004AE010 E8 1B4E0200 CALL haloce.004D2E30 + -> + 004D2E30 53 PUSH EBX + 004D2E31 55 PUSH EBP + 004D2E32 8B6C24 0C MOV EBP,DWORD PTR SS:[ESP+C];->EBP=00000001 param1 + 004D2E36 85ED TEST EBP,EBP + 004D2E38 56 PUSH ESI + 004D2E39 57 PUSH EDI + 004D2E3A 8BF0 MOV ESI,EAX ;->ESI=11084298 + 004D2E3C 8BD9 MOV EBX,ECX ;->EBX=0018D8B8 + 004D2E3E 8BFD MOV EDI,EBP ;->EDI=00000001 + 004D2E40 7E 37 JLE SHORT haloce.004D2E79 + 004D2E42 83FF 20 /CMP EDI,20 + 004D2E45 8B13 |MOV EDX,DWORD PTR DS:[EBX] ;->EDX=0018D801 + 004D2E47 7C 21 |JL SHORT haloce.004D2E6A + ;004D2E49 6A 20 |PUSH 20 + ;004D2E4B E8 10010000 |CALL haloce.004D2F60 + ;004D2E50 83C4 04 |ADD ESP,4 + ;004D2E53 84C0 |TEST AL,AL + ;004D2E55 74 22 |JE SHORT haloce.004D2E79 + ;004D2E57 83EF 20 |SUB EDI,20 + ;004D2E5A 83C3 04 |ADD EBX,4 + ;004D2E5D 85FF |TEST EDI,EDI + ;004D2E5F ^7F E1 \JG SHORT haloce.004D2E42 + ;004D2E61 8BC5 MOV EAX,EBP + ;004D2E63 2BC7 SUB EAX,EDI + ;004D2E65 5F POP EDI + ;004D2E66 5E POP ESI + ;004D2E67 5D POP EBP + ;004D2E68 5B POP EBX + ;004D2E69 C3 RETN + 004D2E6A 57 PUSH EDI ;00000001 + 004D2E6B E8 F0000000 CALL haloce.004D2F60 + -> + 004D2F60 8B4E 0C MOV ECX,DWORD PTR DS:[ESI+C] + 004D2F63 83EC 08 SUB ESP,8 + 004D2F66 53 PUSH EBX + 004D2F67 55 PUSH EBP + 004D2F68 8B6C24 14 MOV EBP,DWORD PTR SS:[ESP+14] + 004D2F6C 57 PUSH EDI + 004D2F6D 8B7E 10 MOV EDI,DWORD PTR DS:[ESI+10] + 004D2F70 8D1CCF LEA EBX,DWORD PTR DS:[EDI+ECX*8] + 004D2F73 8D5C2B FF LEA EBX,DWORD PTR DS:[EBX+EBP-1] + 004D2F77 32C0 XOR AL,AL + 004D2F79 3B5E 08 CMP EBX,DWORD PTR DS:[ESI+8] + 004D2F7C 0F82 33010000 JB haloce.004D30B5 + 004D2F82 3B5E 14 CMP EBX,DWORD PTR DS:[ESI+14] + 004D2F85 0F87 2A010000 JA haloce.004D30B5 + 004D2F8B 33DB XOR EBX,EBX + 004D2F8D 85FF TEST EDI,EDI + 004D2F8F 74 7C JE SHORT haloce.004D300D + 004D2F91 BB 08000000 MOV EBX,8 + 004D2F96 2BDF SUB EBX,EDI + 004D2F98 3BEB CMP EBP,EBX + 004D2F9A 73 08 JNB SHORT haloce.004D2FA4 + 004D2F9C 8A85 C0A85F00 MOV AL,BYTE PTR SS:[EBP+5FA8C0] + 004D2FA2 EB 08 JMP SHORT haloce.004D2FAC + 004D2FA4 8A83 C0A85F00 MOV AL,BYTE PTR DS:[EBX+5FA8C0] + 004D2FAA 8BEB MOV EBP,EBX + 004D2FAC 8B5E 04 MOV EBX,DWORD PTR DS:[ESI+4] + 004D2FAF 03D9 ADD EBX,ECX + 004D2FB1 895C24 10 MOV DWORD PTR SS:[ESP+10],EBX + 004D2FB5 8AD8 MOV BL,AL + 004D2FB7 8BCF MOV ECX,EDI + 004D2FB9 D2E3 SHL BL,CL + 004D2FBB 8B4C24 10 MOV ECX,DWORD PTR SS:[ESP+10] + 004D2FBF F6D3 NOT BL + 004D2FC1 2219 AND BL,BYTE PTR DS:[ECX] + 004D2FC3 8ACA MOV CL,DL + 004D2FC5 22C8 AND CL,AL + 004D2FC7 8AC1 MOV AL,CL + 004D2FC9 8BCF MOV ECX,EDI + 004D2FCB D2E0 SHL AL,CL + 004D2FCD 8BCD MOV ECX,EBP + 004D2FCF D3EA SHR EDX,CL + 004D2FD1 0AD8 OR BL,AL + 004D2FD3 8B4424 10 MOV EAX,DWORD PTR SS:[ESP+10] + 004D2FD7 8818 MOV BYTE PTR DS:[EAX],BL + 004D2FD9 8B4E 0C MOV ECX,DWORD PTR DS:[ESI+C] + 004D2FDC 8B7E 10 MOV EDI,DWORD PTR DS:[ESI+10] + 004D2FDF 8D44CD 00 LEA EAX,DWORD PTR SS:[EBP+ECX*8] + 004D2FE3 8B4E 08 MOV ECX,DWORD PTR DS:[ESI+8] + 004D2FE6 03C7 ADD EAX,EDI + 004D2FE8 3BC1 CMP EAX,ECX + 004D2FEA 8BDD MOV EBX,EBP + 004D2FEC 72 05 JB SHORT haloce.004D2FF3 + 004D2FEE 3B46 14 CMP EAX,DWORD PTR DS:[ESI+14] + 004D2FF1 76 08 JBE SHORT haloce.004D2FFB + 004D2FF3 8B4E 14 MOV ECX,DWORD PTR DS:[ESI+14] + 004D2FF6 41 INC ECX + 004D2FF7 3BC1 CMP EAX,ECX + 004D2FF9 75 0E JNZ SHORT haloce.004D3009 + 004D2FFB 8BC8 MOV ECX,EAX + 004D2FFD 83E1 07 AND ECX,7 + 004D3000 C1E8 03 SHR EAX,3 + 004D3003 894E 10 MOV DWORD PTR DS:[ESI+10],ECX + 004D3006 8946 0C MOV DWORD PTR DS:[ESI+C],EAX + 004D3009 8B6C24 18 MOV EBP,DWORD PTR SS:[ESP+18] + 004D300D 3BDD CMP EBX,EBP + 004D300F 0F83 9E000000 JNB haloce.004D30B3 + 004D3015 8B4E 04 /MOV ECX,DWORD PTR DS:[ESI+4] + 004D3018 8B46 0C |MOV EAX,DWORD PTR DS:[ESI+C] + 004D301B 8BFD |MOV EDI,EBP + 004D301D 2BFB |SUB EDI,EBX + 004D301F 83FF 08 |CMP EDI,8 + 004D3022 72 37 |JB SHORT haloce.004D305B + 004D3024 881408 |MOV BYTE PTR DS:[EAX+ECX],DL + 004D3027 8B4E 10 |MOV ECX,DWORD PTR DS:[ESI+10] + 004D302A 8B46 0C |MOV EAX,DWORD PTR DS:[ESI+C] + 004D302D 8D44C1 08 |LEA EAX,DWORD PTR DS:[ECX+EAX*8+8] + 004D3031 8B4E 08 |MOV ECX,DWORD PTR DS:[ESI+8] + 004D3034 C1EA 08 |SHR EDX,8 + 004D3037 83C3 08 |ADD EBX,8 + 004D303A 3BC1 |CMP EAX,ECX + 004D303C 72 05 |JB SHORT haloce.004D3043 + 004D303E 3B46 14 |CMP EAX,DWORD PTR DS:[ESI+14] + 004D3041 76 08 |JBE SHORT haloce.004D304B + 004D3043 8B4E 14 |MOV ECX,DWORD PTR DS:[ESI+14] + 004D3046 41 |INC ECX + 004D3047 3BC1 |CMP EAX,ECX + 004D3049 75 60 |JNZ SHORT haloce.004D30AB + 004D304B 8BC8 |MOV ECX,EAX + 004D304D 83E1 07 |AND ECX,7 + 004D3050 C1E8 03 |SHR EAX,3 + 004D3053 894E 10 |MOV DWORD PTR DS:[ESI+10],ECX + 004D3056 8946 0C |MOV DWORD PTR DS:[ESI+C],EAX + 004D3059 EB 50 |JMP SHORT haloce.004D30AB + 004D305B 8D2C08 |LEA EBP,DWORD PTR DS:[EAX+ECX] + 004D305E 8A87 B4A85F00 |MOV AL,BYTE PTR DS:[EDI+5FA8B4] + 004D3064 2245 00 |AND AL,BYTE PTR SS:[EBP] + 004D3067 8A8F C0A85F00 |MOV CL,BYTE PTR DS:[EDI+5FA8C0] + 004D306D 22CA |AND CL,DL + 004D306F 0AC1 |OR AL,CL + 004D3071 8845 00 |MOV BYTE PTR SS:[EBP],AL + 004D3074 8B46 0C |MOV EAX,DWORD PTR DS:[ESI+C] + 004D3077 8BCF |MOV ECX,EDI + 004D3079 03DF |ADD EBX,EDI + 004D307B 8D04C7 |LEA EAX,DWORD PTR DS:[EDI+EAX*8] + 004D307E 8B7E 10 |MOV EDI,DWORD PTR DS:[ESI+10] + 004D3081 D3EA |SHR EDX,CL + 004D3083 8B4E 08 |MOV ECX,DWORD PTR DS:[ESI+8] + 004D3086 03C7 |ADD EAX,EDI + 004D3088 3BC1 |CMP EAX,ECX + 004D308A 72 05 |JB SHORT haloce.004D3091 + 004D308C 3B46 14 |CMP EAX,DWORD PTR DS:[ESI+14] + 004D308F 76 08 |JBE SHORT haloce.004D3099 + 004D3091 8B4E 14 |MOV ECX,DWORD PTR DS:[ESI+14] + 004D3094 41 |INC ECX + 004D3095 3BC1 |CMP EAX,ECX + 004D3097 75 0E |JNZ SHORT haloce.004D30A7 + 004D3099 8BC8 |MOV ECX,EAX + 004D309B 83E1 07 |AND ECX,7 + 004D309E C1E8 03 |SHR EAX,3 + 004D30A1 894E 10 |MOV DWORD PTR DS:[ESI+10],ECX + 004D30A4 8946 0C |MOV DWORD PTR DS:[ESI+C],EAX + 004D30A7 8B6C24 18 |MOV EBP,DWORD PTR SS:[ESP+18] + 004D30AB 3BDD |CMP EBX,EBP + 004D30AD ^0F82 62FFFFFF \JB haloce.004D3015 + 004D30B3 B0 01 MOV AL,1 + 004D30B5 5F POP EDI + 004D30B6 5D POP EBP + 004D30B7 5B POP EBX + 004D30B8 83C4 08 ADD ESP,8 + 004D30BB C3 RETN + <- + 004D2E70 83C4 04 ADD ESP,4 + 004D2E73 84C0 TEST AL,AL ;01 + 004D2E75 74 02 JE SHORT haloce.004D2E79 + 004D2E77 33FF XOR EDI,EDI + 004D2E79 8BC5 MOV EAX,EBP + 004D2E7B 2BC7 SUB EAX,EDI + 004D2E7D 5F POP EDI + 004D2E7E 5E POP ESI + 004D2E7F 5D POP EBP + 004D2E80 5B POP EBX + 004D2E81 C3 RETN + <- + 004AE015 55 PUSH EBP + 004AE016 B9 20CE8000 MOV ECX,haloce.0080CE20 ;->ECX=0080CE20 + 004AE01B 8BC6 MOV EAX,ESI ;->EAX=11084298 + 004AE01D C646 1C 00 MOV BYTE PTR DS:[ESI+1C],0 + 004AE021 E8 0A4E0200 CALL haloce.004D2E30 ;called twice? + -> + <-;ret EAX=0000009F + 004AE026 83C4 08 ADD ESP,8 + 004AE029 C646 1C 00 MOV BYTE PTR DS:[ESI+1C],0 ;DS:[110842B4]=00 + 004AE02D 5E POP ESI + 004AE02E 5F POP EDI + 004AE02F 5B POP EBX + 004AE030 5D POP EBP + 004AE031 83C4 10 ADD ESP,10 + 004AE034 C3 RETN +<- +004ADEE0 83C4 10 ADD ESP,10 +004ADEE3 5F POP EDI +004ADEE4 5E POP ESI +004ADEE5 E8 86FEFFFF CALL haloce.004ADD70 ;close the chat window +-> + 004ADD70 51 PUSH ECX + 004ADD71 A0 A8E76400 MOV AL,BYTE PTR DS:[64E7A8] + 004ADD76 84C0 TEST AL,AL + 004ADD78 0F84 99000000 JE haloce.004ADE17 + 004ADD7E 8025 92D56A00 FB AND BYTE PTR DS:[6AD592],0FB + 004ADD85 A1 50C76400 MOV EAX,DWORD PTR DS:[64C750] + 004ADD8A 83C9 FF OR ECX,FFFFFFFF + 004ADD8D 85C0 TEST EAX,EAX + 004ADD8F 890D ACE76400 MOV DWORD PTR DS:[64E7AC],ECX + 004ADD95 C605 A8E76400 00 MOV BYTE PTR DS:[64E7A8],0 + 004ADD9C 74 35 JE SHORT haloce.004ADDD3 + 004ADD9E 57 PUSH EDI + 004ADD9F 6A 00 PUSH 0 + 004ADDA1 8D5424 08 LEA EDX,DWORD PTR SS:[ESP+8] + 004ADDA5 52 PUSH EDX + 004ADDA6 6A 00 PUSH 0 + 004ADDA8 6A 14 PUSH 14 + 004ADDAA 894C24 14 MOV DWORD PTR SS:[ESP+14],ECX + 004ADDAE 8B08 MOV ECX,DWORD PTR DS:[EAX] + 004ADDB0 50 PUSH EAX + 004ADDB1 FF51 28 CALL DWORD PTR DS:[ECX+28] + 004ADDB4 33C0 XOR EAX,EAX + 004ADDB6 B9 1B000000 MOV ECX,1B + 004ADDBB BF DDC56400 MOV EDI,haloce.0064C5DD + 004ADDC0 F3:AB REP STOS DWORD PTR ES:[EDI] + 004ADDC2 AA STOS BYTE PTR ES:[EDI] + 004ADDC3 B9 1B000000 MOV ECX,1B + 004ADDC8 33C0 XOR EAX,EAX + 004ADDCA BF 70C56400 MOV EDI,haloce.0064C570 + 004ADDCF F3:AB REP STOS DWORD PTR ES:[EDI] + 004ADDD1 AA STOS BYTE PTR ES:[EDI] + 004ADDD2 5F POP EDI + 004ADDD3 A1 607D6300 MOV EAX,DWORD PTR DS:[637D60] + 004ADDD8 8B0D 94D16B00 MOV ECX,DWORD PTR DS:[6BD194] + 004ADDDE 56 PUSH ESI + 004ADDDF 50 PUSH EAX + 004ADDE0 51 PUSH ECX + 004ADDE1 C705 DCD16B00 00000>MOV DWORD PTR DS:[6BD1DC],0 + 004ADDEB FF15 A8D16B00 CALL DWORD PTR DS:[6BD1A8] ; keystone.Call_KsGetWindow + 004ADDF1 8BF0 MOV ESI,EAX + 004ADDF3 83C4 08 ADD ESP,8 + 004ADDF6 85F6 TEST ESI,ESI + 004ADDF8 74 1C JE SHORT haloce.004ADE16 + 004ADDFA 6A 00 PUSH 0 + 004ADDFC 56 PUSH ESI + 004ADDFD FF15 C4D16B00 CALL DWORD PTR DS:[6BD1C4] ; keystone.Call_KW_SetFocusControl + 004ADE03 6A 00 PUSH 0 + 004ADE05 56 PUSH ESI + 004ADE06 FF15 CCD16B00 CALL DWORD PTR DS:[6BD1CC] ; keystone.Call_KW_ShowWindow + 004ADE0C 56 PUSH ESI + 004ADE0D FF15 B8D16B00 CALL DWORD PTR DS:[6BD1B8] ; keystone.Call_KW_Release + 004ADE13 83C4 14 ADD ESP,14 + 004ADE16 5E POP ESI + 004ADE17 59 POP ECX + 004ADE18 C3 RETN +<- +004ADEEA 5B POP EBX +004ADEEB 81C4 00020000 ADD ESP,200 +004ADEF1 C3 RETN +<- +00545E65 68 C8000000 PUSH 0C8 +00545E6A BF 38000000 MOV EDI,38 +00545E6F E8 FCDCF4FF CALL haloce.00493B70 +00545E74 68 C8000000 PUSH 0C8 +00545E79 BF 66000000 MOV EDI,66 +00545E7E E8 EDDCF4FF CALL haloce.00493B70 +00545E83 83C4 08 ADD ESP,8 +00545E86 5F POP EDI +00545E87 5E POP ESI +00545E88 5D POP EBP +00545E89 33C0 XOR EAX,EAX +00545E8B 5B POP EBX +00545E8C 83C4 28 ADD ESP,28 +00545E8F C2 1000 RETN 10 + diff --git a/halo notes/object_create_anew.asm b/halo notes/object_create_anew.asm new file mode 100644 index 0000000..a6c4ca5 --- /dev/null +++ b/halo notes/object_create_anew.asm @@ -0,0 +1,323 @@ +;notes by Jesus7Freak +;haloce1.09 p0 rpg_beta6_2 rp_h1 +;console 004C9BE3 + +...1 ;inspect +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F5DD8 haloce.0048C8D0 +...2 ;object_create_anew +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F5F80 haloce.0047D430 +...3 ;object_create_anew +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F5F80 haloce.0047D430 +...4 ;inspect +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F5DD8 haloce.0048C8D0 + + +...2 +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F5F80 haloce.0047D430 +-> +0047D430 0FBF4424 04 MOVSX EAX,WORD PTR SS:[ESP+4] ;->EAX=00000028 +0047D435 8B0485 18416200 MOV EAX,DWORD PTR DS:[EAX*4+624118] ;dev list->EAX=005F5F80 +0047D43C 8B4C24 0C MOV ECX,DWORD PTR SS:[ESP+C] ;->ECX=403D9901 +0047D440 56 PUSH ESI +0047D441 8B7424 0C MOV ESI,DWORD PTR SS:[ESP+C] ;->ESI=F374000A +0047D445 51 PUSH ECX +0047D446 8D50 1C LEA EDX,DWORD PTR DS:[EAX+1C] ;->EDX=005F5F9C +0047D449 0FBF40 1A MOVSX EAX,WORD PTR DS:[EAX+1A] ;->EAX=00000001 +0047D44D 52 PUSH EDX +0047D44E 50 PUSH EAX +0047D44F 56 PUSH ESI +0047D450 E8 4B010100 CALL haloce.0048D5A0 +0047D455 83C4 10 ADD ESP,10 +0047D458 85C0 TEST EAX,EAX ;EAX=00000000 +0047D45A 74 18 JE SHORT haloce.0047D474 +;0047D45C 33C9 XOR ECX,ECX +;0047D45E 66:8B08 MOV CX,WORD PTR DS:[EAX] +;0047D461 51 PUSH ECX +;0047D462 E8 09D60000 CALL haloce.0048AA70 +;0047D467 83C4 04 ADD ESP,4 +;0047D46A 8BCE MOV ECX,ESI +;0047D46C 33C0 XOR EAX,EAX +;0047D46E 5E POP ESI +;0047D46F E9 1CFF0000 JMP haloce.0048D390 +0047D474 5E POP ESI +0047D475 C3 RETN + + + +...3 +0048D1E3 FF52 0C CALL DWORD PTR DS:[EDX+C] ;EDX=005F5F80 haloce.0047D430 +-> +0047D430 0FBF4424 04 MOVSX EAX,WORD PTR SS:[ESP+4] ;->EAX=00000028 +0047D435 8B0485 18416200 MOV EAX,DWORD PTR DS:[EAX*4+624118] ;->EAX=005F5F80 +0047D43C 8B4C24 0C MOV ECX,DWORD PTR SS:[ESP+C] ;->ECX=403D9900 +0047D440 56 PUSH ESI +0047D441 8B7424 0C MOV ESI,DWORD PTR SS:[ESP+C] ;->ESI=F374000A +0047D445 51 PUSH ECX +0047D446 8D50 1C LEA EDX,DWORD PTR DS:[EAX+1C] ;->EDX=005F5F9C +0047D449 0FBF40 1A MOVSX EAX,WORD PTR DS:[EAX+1A] ;->EAX=00000001 +;get ptr to param info +0047D44D 52 PUSH EDX +0047D44E 50 PUSH EAX +0047D44F 56 PUSH ESI +0047D450 E8 4B010100 CALL haloce.0048D5A0 +0047D455 83C4 10 ADD ESP,10 + +0047D458 85C0 TEST EAX,EAX ;EAX=403D9A3A +0047D45A 74 18 JE SHORT haloce.0047D474 +0047D45C 33C9 XOR ECX,ECX +0047D45E 66:8B08 MOV CX,WORD PTR DS:[EAX] ;->CX=0009 (index of rp_h1 in scripted objs list) +0047D461 51 PUSH ECX +0047D462 E8 09D60000 CALL haloce.0048AA70 +-> + 0048AA70 56 PUSH ESI + 0048AA71 8B7424 08 MOV ESI,DWORD PTR SS:[ESP+8] ;->ESI=00000009 + 0048AA75 66:83FE FF CMP SI,0FFFF ;== -1? + 0048AA79 74 55 JE SHORT haloce.0048AAD0 + 0048AA7B 66:85F6 TEST SI,SI ; == 0? + 0048AA7E 7C 48 JL SHORT haloce.0048AAC8 + 0048AA80 66:81FE 0002 CMP SI,200 ; >= size? + 0048AA85 7D 27 JGE SHORT haloce.0048AAAE + 0048AA87 8B0D 083C6500 MOV ECX,DWORD PTR DS:[653C08] ;->ECX=402567BC + 0048AA8D 0FBFC6 MOVSX EAX,SI ;->EAX=00000009 + 0048AA90 57 PUSH EDI + 0048AA91 8B3C81 MOV EDI,DWORD PTR DS:[ECX+EAX*4] ;->EDI=FFFFFFFF (obj tag) + 0048AA94 83FF FF CMP EDI,-1 + 0048AA97 74 14 JE SHORT haloce.0048AAAD + ;test if players are in veh + 0048AA99 57 PUSH EDI + 0048AA9A E8 C1FEFFFF CALL haloce.0048A960 + 0048AA9F 83C4 04 ADD ESP,4 + 0048AAA2 84C0 TEST AL,AL + 0048AAA4 75 07 JNZ SHORT haloce.0048AAAD + ;destroy obj func + 0048AAA6 8BC7 MOV EAX,EDI + 0048AAA8 E8 B3ED0600 CALL haloce.004F9860 + + 0048AAAD 5F POP EDI + 0048AAAE 66:85F6 TEST SI,SI + 0048AAB1 7C 15 JL SHORT haloce.0048AAC8 + 0048AAB3 66:81FE 0002 CMP SI,200 + 0048AAB8 7D 0E JGE SHORT haloce.0048AAC8 + 0048AABA A1 083C6500 MOV EAX,DWORD PTR DS:[653C08] ;->EAX=402567BC + 0048AABF 0FBFD6 MOVSX EDX,SI ;->EDX=00000009 + 0048AAC2 833C90 FF CMP DWORD PTR DS:[EAX+EDX*4],-1 ;DS:[402567E0]=FFFFFFFF (funny, it already tested this...) + 0048AAC6 75 08 JNZ SHORT haloce.0048AAD0 + 0048AAC8 8BCE MOV ECX,ESI ;->ECX=00000009 + 0048AACA 5E POP ESI + 0048AACB E9 30050700 JMP haloce.004FB000 ;instead of calling obj create jmp to it + ;0048AAD0 5E POP ESI + ;0048AAD1 C3 RETN + ... + 004FB000 A1 6C226E00 MOV EAX,DWORD PTR DS:[6E226C] ;->EAX=40479E80 "psbs" + 004FB005 8B90 08020000 MOV EDX,DWORD PTR DS:[EAX+208] ;->EDX=4047AA80 "p2_x" (sptr to names and data) + 004FB00B 0FBFC9 MOVSX ECX,CX ;->ECX=00000009 + 004FB00E 8D0CC9 LEA ECX,DWORD PTR DS:[ECX+ECX*8] ;->ECX=00000051 + 004FB011 56 PUSH ESI + 004FB012 8D348A LEA ESI,DWORD PTR DS:[EDX+ECX*4] ;->ESI=4047ABC4 "rp_h1" + + 004FB015 0FBF4E 20 MOVSX ECX,WORD PTR DS:[ESI+20] ;->ECX=00000001 (data?) + 004FB019 8B0C8D A4766300 MOV ECX,DWORD PTR DS:[ECX*4+6376A4] ;->ECX=00636C80 + + 004FB020 0FBF76 22 MOVSX ESI,WORD PTR DS:[ESI+22] ;->ESI=00000002 (more data?) + 004FB024 0FBF51 0C MOVSX EDX,WORD PTR DS:[ECX+C] ;->EDX=0000024C + 004FB028 57 PUSH EDI + 004FB029 0FBF79 0E MOVSX EDI,WORD PTR DS:[ECX+E] ;->EDI=00000078 + 004FB02D 0FBF49 0A MOVSX ECX,WORD PTR DS:[ECX+A] ;->ECX=00000240 + 004FB031 0FAFFE IMUL EDI,ESI ;->EDI=000000F0 + 004FB034 8B7401 04 MOV ESI,DWORD PTR DS:[ECX+EAX+4] ;->ESI=4047F484 + 004FB038 03D0 ADD EDX,EAX ;->EDX=4047A0CC + + ; (struct size 120 or 78h) + ;4047F574->0009 0000 (scripted obj index) + ; 00000000 + ; C1DF3FFD x -27.9062442779541 (spawn coordinates) + ; 4470AFA1 y 962.7442016601562 + ; BE5A1F1E z -0.2130093276500702 + ; 00000000 * 17 (all zeros) + ; 0F0F 0000 + ; 00000000 * 7 (all zeros) + + ; (struct size 72 or 48h) + ;4047A0CC->0000 0009 (scripted obj index) + ; 40481374->69 68 65 76 "ihev" (struct size 48 or 30h) + ; 4045A5C8->00000000 * 21 (all zeros) + ; 76000000 + ; ansi string "vehicles\warthog\bitmaps\warthog chaingun multipurpose" + ; 00000000 + ; E2A40130 obj type tag"biped tag" + ; 00000000 * 8 (all zeros) + ; 00000000 * 16 (all zeros) + 004FB03A 03FE ADD EDI,ESI ;->EDI=4047F574 + 004FB03C 52 PUSH EDX ;4047A0CC + 004FB03D E8 BE270000 CALL haloce.004FD800 + -> + 004FD800 66:8B17 MOV DX,WORD PTR DS:[EDI] ;->DX=0000 + 004FD803 81EC 88000000 SUB ESP,88 + 004FD809 53 PUSH EBX + 004FD80A 83C8 FF OR EAX,FFFFFFFF + 004FD80D 66:83FA FF CMP DX,0FFFF ;== -1? + 004FD811 56 PUSH ESI + 004FD812 0F84 C9000000 JE haloce.004FD8E1 + 004FD818 8B0D 0C3C6500 MOV ECX,DWORD PTR DS:[653C0C] ;->ECX=40256724 + 004FD81E 8039 00 CMP BYTE PTR DS:[ECX],0 + 004FD821 74 0A JE SHORT haloce.004FD82D + ;004FD823 F647 04 01 TEST BYTE PTR DS:[EDI+4],1 + ;004FD827 0F85 B4000000 JNZ haloce.004FD8E1 + 004FD82D 66:8B4F 02 MOV CX,WORD PTR DS:[EDI+2] ;->CX=0009 (scripted obj index) + 004FD831 66:83F9 FF CMP CX,0FFFF ;== -1? + 004FD835 74 1F JE SHORT haloce.004FD856 + 004FD837 66:85C9 TEST CX,CX ;== 0? + 004FD83A 7C 1A JL SHORT haloce.004FD856 + 004FD83C 66:81F9 0002 CMP CX,200 ; >= size? + 004FD841 7D 13 JGE SHORT haloce.004FD856 + 004FD843 8B35 083C6500 MOV ESI,DWORD PTR DS:[653C08] ;->ESI=402567BC + 004FD849 0FBFC9 MOVSX ECX,CX ;->ECX=00000009 + 004FD84C 833C8E FF CMP DWORD PTR DS:[ESI+ECX*4],-1 ;DS:[402567E0]=FFFFFFFF (scripted obj tag) + 004FD850 0F85 8B000000 JNZ haloce.004FD8E1 + 004FD856 0FBFCA MOVSX ECX,DX ;->ECX=00000000 + 004FD859 8B9424 94000000 MOV EDX,DWORD PTR SS:[ESP+94] ;->EDX=4047A0CC + 004FD860 8B72 04 MOV ESI,DWORD PTR DS:[EDX+4] ;->ESI=40481374 + 004FD863 8D0C49 LEA ECX,DWORD PTR DS:[ECX+ECX*2] ;->ECX=00000000 + 004FD866 C1E1 04 SHL ECX,4 ;->ECX=00000000 + 004FD869 03CE ADD ECX,ESI ;->ECX=40481374 + 004FD86B 8B49 0C MOV ECX,DWORD PTR DS:[ECX+C] ;->ECX=E2A40130 "biped tag" + 004FD86E 83F9 FF CMP ECX,-1 + 004FD871 74 6E JE SHORT haloce.004FD8E1 + 004FD873 6A FF PUSH -1 + 004FD875 51 PUSH ECX + 004FD876 8D4424 10 LEA EAX,DWORD PTR SS:[ESP+10] ;->EAX=0018CE24->005F5F80 + 004FD87A E8 B1B7FFFF CALL haloce.004F9030 + 004FD87F 8D47 08 LEA EAX,DWORD PTR DS:[EDI+8] ;->EAX=4047F57C + 004FD882 8B08 MOV ECX,DWORD PTR DS:[EAX] ;->ECX=C1DF3FFD x coord -27.9062442779541 + 004FD884 8B50 04 MOV EDX,DWORD PTR DS:[EAX+4] ;->EDX=4470AFA1 y coord 962.7442016601562 + 004FD887 8B40 08 MOV EAX,DWORD PTR DS:[EAX+8] ;->EAX=BE5A1F1E z coord -0.2130093276500702 + 004FD88A 895424 2C MOV DWORD PTR SS:[ESP+2C],EDX + 004FD88E 894424 30 MOV DWORD PTR SS:[ESP+30],EAX + 004FD892 83C4 08 ADD ESP,8 + 004FD895 8D47 14 LEA EAX,DWORD PTR DS:[EDI+14] ;->EAX=4047F588 + 004FD898 8D5424 48 LEA EDX,DWORD PTR SS:[ESP+48] ;->EDX=0018CE64 + 004FD89C 8D7424 3C LEA ESI,DWORD PTR SS:[ESP+3C] ;->ESI=0018CE58 + 004FD8A0 894C24 20 MOV DWORD PTR SS:[ESP+20],ECX + 004FD8A4 E8 773AFDFF CALL haloce.004D1320 + 004FD8A9 66:8B4F 06 MOV CX,WORD PTR DS:[EDI+6] ;->CX=0000 + 004FD8AD 66:894C24 1E MOV WORD PTR SS:[ESP+1E],CX + 004FD8B2 8D4C24 08 LEA ECX,DWORD PTR SS:[ESP+8] ;->ECX=0018CE24 + 004FD8B6 E8 35B8FFFF CALL haloce.004F90F0 + -> + 004F90F0 66:833D D0476B00 02 CMP WORD PTR DS:[6B47D0],2 ;DS:[006B47D0]=0002 server check? + 004F90F8 56 PUSH ESI + 004F90F9 B8 03000000 MOV EAX,3 + 004F90FE 75 27 JNZ SHORT haloce.004F9127 + 004F9100 8B11 MOV EDX,DWORD PTR DS:[ECX] ;->EDX=E2A40130 "biped tag" + 004F9102 8B35 E46D8100 MOV ESI,DWORD PTR DS:[816DE4] ;->ESI=40440028 + 004F9108 81E2 FFFF0000 AND EDX,0FFFF ;->EDX=0000130 + 004F910E C1E2 05 SHL EDX,5 ;->EDX=00002600 + 004F9111 8B5432 14 MOV EDX,DWORD PTR DS:[EDX+ESI+14] ;->EDX=4061F898 + 004F9115 0FBF12 MOVSX EDX,WORD PTR DS:[EDX] ;->EDX=00000001 + 004F9118 8B1495 A4766300 MOV EDX,DWORD PTR DS:[EDX*4+6376A4] ;->EDX=00636C80 + 004F911F 837A 10 FF CMP DWORD PTR DS:[EDX+10],-1 ;DS:[00636C90]=00000005 + 004F9123 74 02 JE SHORT haloce.004F9127 + 004F9125 33C0 XOR EAX,EAX + ;create object + 004F9127 50 PUSH EAX ;00000000 + 004F9128 51 PUSH ECX ;0018CE24 ptr to "biped tag and other data" + 004F9129 E8 12000000 CALL haloce.004F9140 + 004F912E 83C4 08 ADD ESP,8 + 004F9131 5E POP ESI + 004F9132 C3 RETN + <- + 004FD8BB 8BF0 MOV ESI,EAX ;->EAX=E431000D new obj tag + 004FD8BD 83FE FF CMP ESI,-1 + 004FD8C0 74 1D JE SHORT haloce.004FD8DF + 004FD8C2 57 PUSH EDI + 004FD8C3 56 PUSH ESI + 004FD8C4 E8 E7A2FFFF CALL haloce.004F7BB0 + -> + 004F7BB0 8B0D B0B37F00 MOV ECX,DWORD PTR DS:[7FB3B0] ;"object" + 004F7BB6 8B51 34 MOV EDX,DWORD PTR DS:[ECX+34] + 004F7BB9 53 PUSH EBX + 004F7BBA 8B5C24 08 MOV EBX,DWORD PTR SS:[ESP+8] + 004F7BBE 8BC3 MOV EAX,EBX + 004F7BC0 25 FFFF0000 AND EAX,0FFFF + 004F7BC5 8D0440 LEA EAX,DWORD PTR DS:[EAX+EAX*2] + 004F7BC8 8B4482 08 MOV EAX,DWORD PTR DS:[EDX+EAX*4+8] ;object + 004F7BCC 0FBF88 B4000000 MOVSX ECX,WORD PTR DS:[EAX+B4] ;object.B4 -> ECX=00000001 + 004F7BD3 55 PUSH EBP + 004F7BD4 8B6C24 10 MOV EBP,DWORD PTR SS:[ESP+10] + 004F7BD8 56 PUSH ESI + 004F7BD9 57 PUSH EDI + 004F7BDA 8B3C8D A4766300 MOV EDI,DWORD PTR DS:[ECX*4+6376A4] ;->EDI=00636C80 + 004F7BE1 8B8F 80000000 MOV ECX,DWORD PTR DS:[EDI+80] ;->ECX=00636A28 + 004F7BE7 8D87 80000000 LEA EAX,DWORD PTR DS:[EDI+80] ;->EAX=00636D00 + 004F7BED 33F6 XOR ESI,ESI + 004F7BEF 85C9 TEST ECX,ECX + 004F7BF1 74 26 JE SHORT haloce.004F7C19 + 004F7BF3 8B00 /MOV EAX,DWORD PTR DS:[EAX] ;->EAX=00636A28 + 004F7BF5 8B40 2C |MOV EAX,DWORD PTR DS:[EAX+2C] ;->EAX=00000000 + 004F7BF8 85C0 |TEST EAX,EAX + 004F7BFA 74 07 |JE SHORT haloce.004F7C03 + ;004F7BFC 55 |PUSH EBP + ;004F7BFD 53 |PUSH EBX + ;004F7BFE FFD0 |CALL EAX + ;004F7C00 83C4 08 |ADD ESP,8 + 004F7C03 46 |INC ESI + 004F7C04 0FBFD6 |MOVSX EDX,SI ;->EDX=00000001 + 004F7C07 8B8C97 80000000 |MOV ECX,DWORD PTR DS:[EDI+EDX*4+80] ;->ECX=00636AF0 + 004F7C0E 85C9 |TEST ECX,ECX ;loop until zero + 004F7C10 8D8497 80000000 |LEA EAX,DWORD PTR DS:[EDI+EDX*4+80] ;->EAX=00636D04 + 004F7C17 ^75 DA \JNZ SHORT haloce.004F7BF3 + 004F7C19 5F POP EDI + 004F7C1A 5E POP ESI + 004F7C1B 5D POP EBP + 004F7C1C 5B POP EBX + 004F7C1D C3 RETN + <- + 004FD8C9 33C9 XOR ECX,ECX + 004FD8CB 66:8B4F 02 MOV CX,WORD PTR DS:[EDI+2] ; scripted obj index->CX=0009 + 004FD8CF 83C4 08 ADD ESP,8 + 004FD8D2 66:83F9 FF CMP CX,0FFFF + 004FD8D6 74 07 JE SHORT haloce.004FD8DF + 004FD8D8 8BD6 MOV EDX,ESI ;->EDX=E431000D new obj tag + ;update the scripted obj tag array + 004FD8DA E8 71FEFFFF CALL haloce.004FD750 + -> + 004FD750 56 PUSH ESI + 004FD751 8B35 B0B37F00 MOV ESI,DWORD PTR DS:[7FB3B0] ;"object" + 004FD757 8B76 34 MOV ESI,DWORD PTR DS:[ESI+34] + 004FD75A 8BC2 MOV EAX,EDX + 004FD75C 25 FFFF0000 AND EAX,0FFFF + 004FD761 8D0440 LEA EAX,DWORD PTR DS:[EAX+EAX*2] + 004FD764 8B7486 08 MOV ESI,DWORD PTR DS:[ESI+EAX*4+8] ;->ESI=400E4954 obj + 004FD768 57 PUSH EDI + 004FD769 8B3D 083C6500 MOV EDI,DWORD PTR DS:[653C08] ;scripted obj tag array ptr;->EDI=402567BC + 004FD76F 0FBFC1 MOVSX EAX,CX ;->EAX=00000009 ;index + 004FD772 8D0487 LEA EAX,DWORD PTR DS:[EDI+EAX*4] ;->EAX=402567E0 + 004FD775 8338 FF CMP DWORD PTR DS:[EAX],-1 + 004FD778 75 09 JNZ SHORT haloce.004FD783 + 004FD77A 8910 MOV DWORD PTR DS:[EAX],EDX ;change to new obj tag + 004FD77C 66:898E BA000000 MOV WORD PTR DS:[ESI+BA],CX ;obj.BA = scripted obj index + 004FD783 5F POP EDI + 004FD784 5E POP ESI + 004FD785 C3 RETN + <- + 004FD8DF 8BC6 MOV EAX,ESI ;ret new obj tag->EAX=E431000D + 004FD8E1 5E POP ESI + 004FD8E2 5B POP EBX + 004FD8E3 81C4 88000000 ADD ESP,88 + 004FD8E9 C3 RETN + <- + 004FB042 83C4 04 ADD ESP,4 + + 004FB045 5F POP EDI + 004FB046 5E POP ESI + 004FB047 C3 RETN +<- +0047D467 83C4 04 ADD ESP,4 + +0047D46A 8BCE MOV ECX,ESI +0047D46C 33C0 XOR EAX,EAX +0047D46E 5E POP ESI +0047D46F E9 1CFF0000 JMP haloce.0048D390 +0047D474 5E POP ESI +0047D475 C3 RETN + diff --git a/halo notes/object_destroy.asm b/halo notes/object_destroy.asm new file mode 100644 index 0000000..3a8a7c7 --- /dev/null +++ b/halo notes/object_destroy.asm @@ -0,0 +1,627 @@ +;notes by Jesus7Freak +;haloce1.09 p0 rpg_beta6_2 rp_h1 +;console 004C9BE3 + +Call to haloce.00487150 + + 00487283 51 PUSH ECX + 00487284 55 PUSH EBP + 00487285 E8 96100000 CALL haloce.00488320 + 0048728A 83C4 0C ADD ESP,0C + 0048728D 83F8 FF CMP EAX,-1 + + +004890BC 56 |PUSH ESI ;ESI=0018CEC0 ptr to "rp_h1)" +004890BD E8 3EFEFFFF |CALL haloce.00488F00 +-> + 00488F00 55 PUSH EBP + 00488F01 8B2D B4558100 MOV EBP,DWORD PTR DS:[8155B4];script node->EBP=40488908 + 00488F07 56 PUSH ESI ;ESI=0018CEC0 ptr to "rp_h1)" + 00488F08 57 PUSH EDI ;EDI=4048895C (from script node?) + + 00488F09 8BD5 MOV EDX,EBP ;script node + 00488F0B E8 B0AA0400 CALL haloce.004D39C0 + -> + ;add data header obj