Init all related renderTypes

pull/430/head
FlightlessMango 4 years ago
parent 079f700241
commit 3bc0f32a3b

@ -634,41 +634,6 @@ kiero::Status::Enum kiero::init(RenderType::Enum _renderType)
return Status::NotSupportedError;
}
else
{
RenderType::Enum type = RenderType::None;
if (::GetModuleHandle(KIERO_TEXT("d3d9.dll")) != NULL)
{
type = RenderType::D3D9;
}
else if (::GetModuleHandle(KIERO_TEXT("d3d10.dll")) != NULL)
{
type = RenderType::D3D10;
}
else if (::GetModuleHandle(KIERO_TEXT("d3d11.dll")) != NULL)
{
type = RenderType::D3D11;
}
else if (::GetModuleHandle(KIERO_TEXT("d3d12.dll")) != NULL)
{
type = RenderType::D3D12;
}
else if (::GetModuleHandle(KIERO_TEXT("opengl32.dll")) != NULL)
{
type = RenderType::OpenGL;
}
else if (::GetModuleHandle(KIERO_TEXT("vulkan-1.dll")) != NULL)
{
type = RenderType::Vulkan;
}
else
{
return Status::NotSupportedError;
}
return init(type);
}
}
return Status::Success;

@ -1,6 +1,8 @@
#include "windows.h"
#include <cstdio>
#include "kiero.h"
#include <vector>
#if KIERO_INCLUDE_D3D11
# include "d3d11_hook.h"
#endif
@ -8,6 +10,14 @@
# include "d3d12_hook.h"
#endif
#ifdef _UNICODE
# define KIERO_TEXT(text) L##text
#else
# define KIERO_TEXT(text) text
#endif
std::vector<kiero::RenderType::Enum> render_types;
void ConsoleSetup()
{
// With this trick we'll be able to print content to the console, and if we have luck we could get information printed by the game.
@ -18,29 +28,47 @@ void ConsoleSetup()
freopen("CONIN$", "r", stdin);
}
void renderTypes() {
render_types.clear();
if (::GetModuleHandle(KIERO_TEXT("d3d9.dll")) != NULL)
{
render_types.push_back(kiero::RenderType::D3D9);
}
if (::GetModuleHandle(KIERO_TEXT("d3d10.dll")) != NULL)
{
render_types.push_back(kiero::RenderType::D3D10);
}
if (::GetModuleHandle(KIERO_TEXT("d3d11.dll")) != NULL)
{
render_types.push_back(kiero::RenderType::D3D11);
}
if (::GetModuleHandle(KIERO_TEXT("d3d12.dll")) != NULL)
{
render_types.push_back(kiero::RenderType::D3D12);
}
if (::GetModuleHandle(KIERO_TEXT("opengl32.dll")) != NULL)
{
render_types.push_back(kiero::RenderType::OpenGL);
}
if (::GetModuleHandle(KIERO_TEXT("vulkan-1.dll")) != NULL)
{
render_types.push_back(kiero::RenderType::Vulkan);
}
for (auto& _type : render_types)
kiero::init(_type);
}
int MainThread()
{
ConsoleSetup();
printf("MangoHud Attached!\n");
if (kiero::init(kiero::RenderType::Auto) == kiero::Status::Success)
{
switch (kiero::getRenderType())
{
#if KIERO_INCLUDE_D3D11
case kiero::RenderType::D3D11:
impl::d3d11::init();
break;
#endif
#if KIERO_INCLUDE_D3D12
case kiero::RenderType::D3D12:
impl::d3d12::init();
break;
#endif
}
renderTypes();
if (!render_types.empty()){
impl::d3d11::init();
impl::d3d12::init();
return 1;
}
return 0;
return 0;
}
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD fdwReason, LPVOID)

Loading…
Cancel
Save