Skip to content

Commit

Permalink
SDK small tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
nomnomab committed May 14, 2019
1 parent aaa03b6 commit df9bdcf
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
7 changes: 6 additions & 1 deletion SatisfactoryModLoader.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
<PreprocessorDefinitions>NDEBUG;SATISFACTORYMODLOADER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<WholeProgramOptimization>false</WholeProgramOptimization>
<AdditionalIncludeDirectories>$(MSBuildProjectDirectory)\Detours\src;%(AdditionalIncludeDirectories);$(MSBuildProjectDirectory)\SatisfactoryModLoader</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(MSBuildProjectDirectory)\Detours\src;%(AdditionalIncludeDirectories);$(MSBuildProjectDirectory)\SatisfactoryModLoader;$(MSBuildProjectDirectory)\Sdk\SDK</AdditionalIncludeDirectories>
<LanguageStandard>stdcpplatest</LanguageStandard>
</ClCompile>
<Link>
Expand Down Expand Up @@ -175,6 +175,7 @@
<ClInclude Include="SatisfactoryModLoader\util\JsonConfig.h" />
<ClInclude Include="SatisfactoryModLoader\util\Reflection.h" />
<ClInclude Include="SatisfactoryModLoader\util\Utility.h" />
<ClInclude Include="Sdk\SDK.hpp" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="SatisfactoryModLoader\game\API.cpp" />
Expand All @@ -188,6 +189,10 @@
<ClCompile Include="SatisfactoryModLoader\util\FString.cpp" />
<ClCompile Include="SatisfactoryModLoader\util\Reflection.cpp" />
<ClCompile Include="SatisfactoryModLoader\util\Utility.cpp" />
<ClCompile Include="Sdk\SDK\SF_Basic.cpp" />
<ClCompile Include="Sdk\SDK\SF_CoreUObject_functions.cpp" />
<ClCompile Include="Sdk\SDK\SF_Engine_functions.cpp" />
<ClCompile Include="Sdk\SDK\SF_FactoryGame_functions.cpp" />
<ClCompile Include="xinput1_3\xinput1_3.cpp" />
</ItemGroup>
<ItemGroup>
Expand Down
13 changes: 13 additions & 0 deletions SatisfactoryModLoader/HookLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,17 @@ namespace SML {
return HookInvoker<decltype(HookableFunction), HookableFunction>::get_original()(args...);
}
}
}

namespace SDK {
template <auto HookableFunction>
void subscribe(typename HookInvoker<decltype(HookableFunction), HookableFunction>::Handler handler) {
::subscribe(handler);
}

template <auto HookableFunction, typename... A>
typename HookInvoker<decltype(HookableFunction), HookableFunction>::ReturnType
call(A... args) {
return HookInvoker<decltype(HookableFunction), HookableFunction>::get_original()(args...);
}
}
5 changes: 5 additions & 0 deletions SatisfactoryModLoader/SatisfactoryModLoader.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// dllmain.cpp : Defines the entry point for the DLL application.
#define WIN32_LEAN_AND_MEAN
#include "../Sdk/SDK.hpp"
#include <stdafx.h>
#include <SatisfactoryModLoader.h>
#include <string>
Expand Down Expand Up @@ -45,6 +46,10 @@ namespace SML {
ShowWindow(GetConsoleWindow(), SW_SHOW);
}

// load sdk
SDK::InitSDK();
Utility::info("Loaded the Satisfactory SDK");

// get path
char p[MAX_PATH];
GetModuleFileNameA(NULL, p, MAX_PATH);
Expand Down
1 change: 1 addition & 0 deletions SatisfactoryModLoader/mod/Mod.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include "../Lib.h"
#include "../Sdk/SDK.hpp"
#include <string>
#include <vector>
#include <util/Utility.h>
Expand Down

0 comments on commit df9bdcf

Please sign in to comment.