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