Skip to content

Commit

Permalink
Code cleanup.
Browse files Browse the repository at this point in the history
Move files to subdirectories.
Rename patching functions and move all functions to header.
Renamed a few files to make more sense.
  • Loading branch information
num0005 committed Jul 14, 2018
1 parent c6e1465 commit f8e1416
Show file tree
Hide file tree
Showing 58 changed files with 4,519 additions and 4,750 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
Expand All @@ -26,7 +25,6 @@
*.a

# Executables
*.exe
*.out
*.app

Expand All @@ -36,7 +34,6 @@ H2Codez/build/*
*.VC.db
*.VC.VC.opendb
*.ipch
*.pdb
*.exp
*.ipdb
*.iobj
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "stdafx.h"
#include "../stdafx.h"
#include "DiscordInterface.h"
#include <process.h>

Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion H2Codez/FiloInterface.h → H2Codez/Common/FiloInterface.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once
#include "stdafx.h"
#include "../stdafx.h"

struct filo
{
Expand Down
15 changes: 8 additions & 7 deletions H2Codez/H2ToolsCommon.cpp → H2Codez/Common/H2EKCommon.cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
#include <cwchar>
#include "stdafx.h"
#include "Patches.h"
#include "H2ToolsCommon.h"
#include "H2EKCommon.h"
#include "../stdafx.h"
#include "../util/Patches.h"
#include "Psapi.h"
#include "DiscordInterface.h"
#include "Debug.h"
#include "../util/Debug.h"
#include "../HaloScript/hs_interface.h"
#include <cwchar>
#include <cassert>
#include <Shellapi.h>
#include <Shlwapi.h>
#include <Shlobj.h>
#include <CommDlg.h>

using namespace HaloScriptCommon;
using namespace H2CommonPatches;

typedef int (WINAPI *LoadStringW_Typedef)(HINSTANCE hInstance, UINT uID, LPWSTR lpBuffer, int cchBufferMax);
LoadStringW_Typedef LoadStringW_Orginal;
Expand Down Expand Up @@ -215,7 +216,7 @@ wchar_t* __stdcall get_wide_halo_2_documents_path()
// This fixes that by making sure the code gets the string type it was expecting
void fix_documents_path_string_type()
{
WriteJmpTo(SwitchAddessByMode(0x00589D10, 0x004BA7C0, 0x0048A050), get_narrow_halo_2_documents_path);
WriteJmp(SwitchAddessByMode(0x00589D10, 0x004BA7C0, 0x0048A050), get_narrow_halo_2_documents_path);

// The only two functions that weren't broken before
PatchCall(SwitchAddessByMode(0x006708E6, 0x005061A5, 0x005AEFF6), get_wide_halo_2_documents_path); // wrl export
Expand Down
2 changes: 1 addition & 1 deletion H2Codez/H2ToolsCommon.h → H2Codez/Common/H2EKCommon.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once
#include "HaloScriptInterface.h"
#include "..\HaloScript\hs_interface.h"

struct hs_convert_data_store
{
Expand Down
File renamed without changes.
Binary file removed H2Codez/H2Codez.aps
Binary file not shown.
87 changes: 43 additions & 44 deletions H2Codez/H2Codez.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>version.lib;Comdlg32.lib;Shlwapi.lib;Dbghelp.lib;discord-rpc-debug.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>version.lib;Comdlg32.lib;Shlwapi.lib;Dbghelp.lib;Precompiled\discord-rpc-debug.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
Expand All @@ -96,7 +96,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>version.lib;Comdlg32.lib;Shlwapi.lib;Dbghelp.lib;discord-rpc.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>version.lib;Comdlg32.lib;Shlwapi.lib;Dbghelp.lib;Precompiled\discord-rpc.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SetChecksum>true</SetChecksum>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link>
Expand All @@ -110,44 +110,44 @@
<None Include="H2Tool\ToolCommandDefinitions.inl" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="BlamBaseTypes.h" />
<ClInclude Include="hs_ai_behaviour.h" />
<ClInclude Include="BasicTagTypes.h" />
<ClInclude Include="Debug.h" />
<ClInclude Include="Detours\detours.h" />
<ClInclude Include="Detours\detver.h" />
<ClInclude Include="DiscordInterface.h" />
<ClInclude Include="FiloInterface.h" />
<ClInclude Include="Common\BlamBaseTypes.h" />
<ClInclude Include="HaloScript\hs_ai_behaviour.h" />
<ClInclude Include="Common\BasicTagTypes.h" />
<ClInclude Include="util\Debug.h" />
<ClInclude Include="util\Detours\detours.h" />
<ClInclude Include="util\Detours\detver.h" />
<ClInclude Include="Common\DiscordInterface.h" />
<ClInclude Include="Common\FiloInterface.h" />
<ClInclude Include="h2codez.h" />
<ClInclude Include="H2Guerilla.h" />
<ClInclude Include="H2Sapien.h" />
<ClInclude Include="H2ToolsCommon.h" />
<ClInclude Include="H2Guerilla\H2Guerilla.h" />
<ClInclude Include="H2Sapien\H2Sapien.h" />
<ClInclude Include="Common\H2EKCommon.h" />
<ClInclude Include="H2Tool\H2Tool_Commands.h" />
<ClInclude Include="H2Tool\H2Tool_Render_Model.h" />
<ClInclude Include="HaloScriptInterface.h" />
<ClInclude Include="hs_command.h" />
<ClInclude Include="hs_global_ids.h" />
<ClInclude Include="hs_global_variable.h" />
<ClInclude Include="hs_opcodes.h" />
<ClInclude Include="hs_types.h" />
<ClInclude Include="Logs.h" />
<ClInclude Include="Patches.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="RingBuffer.h" />
<ClInclude Include="ScenarioTag.h" />
<ClInclude Include="Settings.h" />
<ClInclude Include="HaloScript\hs_interface.h" />
<ClInclude Include="HaloScript\hs_command.h" />
<ClInclude Include="HaloScript\hs_global_ids.h" />
<ClInclude Include="HaloScript\hs_global_variable.h" />
<ClInclude Include="HaloScript\hs_opcodes.h" />
<ClInclude Include="HaloScript\hs_types.h" />
<ClInclude Include="util\Logs.h" />
<ClInclude Include="util\Patches.h" />
<ClInclude Include="Resources\resource.h" />
<ClInclude Include="util\RingBuffer.h" />
<ClInclude Include="Tags\ScenarioTag.h" />
<ClInclude Include="util\Settings.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="Version.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="Debug.cpp" />
<ClCompile Include="Detours\detours.cpp" />
<ClCompile Include="Detours\disasm.cpp" />
<ClCompile Include="Detours\disolx86.cpp" />
<ClCompile Include="Detours\image.cpp" />
<ClCompile Include="Detours\modules.cpp" />
<ClCompile Include="DiscordInterface.cpp" />
<ClCompile Include="util\Debug.cpp" />
<ClCompile Include="util\Detours\detours.cpp" />
<ClCompile Include="util\Detours\disasm.cpp" />
<ClCompile Include="util\Detours\disolx86.cpp" />
<ClCompile Include="util\Detours\image.cpp" />
<ClCompile Include="util\Detours\modules.cpp" />
<ClCompile Include="Common\DiscordInterface.cpp" />
<ClCompile Include="dllmain.cpp">
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
Expand All @@ -156,25 +156,24 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="FiloInterface.cpp" />
<ClCompile Include="Common\FiloInterface.cpp" />
<ClCompile Include="h2codez.cpp" />
<ClCompile Include="H2Guerilla.cpp" />
<ClCompile Include="H2Sapien.cpp" />
<ClCompile Include="H2ToolsCommon.cpp" />
<ClCompile Include="H2Guerilla\H2Guerilla.cpp" />
<ClCompile Include="H2Sapien\H2Sapien.cpp" />
<ClCompile Include="Common\H2EKCommon.cpp" />
<ClCompile Include="H2Tool\H2Tool_Render_Model.cpp" />
<ClCompile Include="H2Tool_Commands.cpp" />
<ClCompile Include="HaloScriptInterface.cpp" />
<ClCompile Include="Logs.cpp" />
<ClCompile Include="patches.cpp" />
<ClCompile Include="hs_ai_behaviour.cpp" />
<ClCompile Include="Settings.cpp" />
<ClCompile Include="H2Tool\H2Tool_Commands.cpp" />
<ClCompile Include="HaloScript\hs_interface.cpp" />
<ClCompile Include="util\Logs.cpp" />
<ClCompile Include="HaloScript\hs_ai_behaviour.cpp" />
<ClCompile Include="util\Settings.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="H2Guerilla.rc" />
<ResourceCompile Include="H2Sapien.rc" />
<ResourceCompile Include="Resources\H2Guerilla.rc" />
<ResourceCompile Include="Resources\H2Sapien.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
Expand Down
Loading

0 comments on commit f8e1416

Please sign in to comment.