From a4adde7d93f682c64771f1e80864672d59a785ea Mon Sep 17 00:00:00 2001 From: flightlessmango Date: Thu, 10 Jun 2021 16:17:37 +0200 Subject: [PATCH] wip ogl stuff --- mingw32.txt | 1058 +--------------------------------------- src/logging.cpp | 11 +- src/win/d3d11_hook.cpp | 6 +- src/win/d3d12_hook.cpp | 6 +- src/win/d3d_shared.cpp | 2 +- src/win/kiero.cpp | 6 +- src/win/main.cpp | 10 +- src/win/ogl_hook.cpp | 8 +- 8 files changed, 48 insertions(+), 1059 deletions(-) diff --git a/mingw32.txt b/mingw32.txt index b3dedbe1..d5ccbb9c 100644 --- a/mingw32.txt +++ b/mingw32.txt @@ -1,1041 +1,17 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MangoHud/mingw32.txt at d3d12 · flightlessmango/MangoHud · GitHub - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Skip to content - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - - -
-
-
- - - - - - - - - - - - - -
- -
- -
-

- - - / - - MangoHud - - -

- - -
- - - -
- - -
- -
-
- - - - - - - Permalink - - - - - -
- -
-
- - - d3d12 - - - - -
- - - -
-
-
- -
- - - - Go to file - - -
- - - - - - - -
- - - -
- -
-
-
 
-
- -
-
 
- Cannot retrieve contributors at this time -
-
- - - - - - -
- -
-
- - 18 lines (16 sloc) - - 417 Bytes -
- -
- -
- Raw - Blame -
- - -
-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[binaries]
c = 'i686-w64-mingw32-gcc'
cpp = 'i686-w64-mingw32-g++'
ar = 'i686-w64-mingw32-ar'
strip = 'i686-w64-mingw32-strip'
-
[properties]
c_args=['-msse', '-msse2']
cpp_args=['-msse', '-msse2']
c_link_args = ['-static', '-static-libgcc']
cpp_link_args = ['-static', '-static-libgcc', '-static-libstdc++']
needs_exe_wrapper = true
-
[host_machine]
system = 'windows'
cpu_family = 'x86'
cpu = 'x86'
endian = 'little'
- - - -
- -
- - - - -
- - -
- - -
-
- - - - -
-
- -
-
- -
- - - - - - -
- - - You can’t perform that action at this time. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +[binaries] +c = 'i686-w64-mingw32-gcc' +cpp = 'i686-w64-mingw32-g++' +ar = 'i686-w64-mingw32-ar' +strip = 'i686-w64-mingw32-strip' +sh = '/usr/bin/sh' + +[properties] +c_link_args = ['-static', '-static-libgcc'] +cpp_link_args = ['-static', '-static-libgcc', '-static-libstdc++'] +needs_exe_wrapper = true + +[host_machine] +system = 'windows' +cpu_family = 'x86' +cpu = 'x86' +endian = 'little' \ No newline at end of file diff --git a/src/logging.cpp b/src/logging.cpp index 3cd96661..09371889 100644 --- a/src/logging.cpp +++ b/src/logging.cpp @@ -63,11 +63,12 @@ void writeFile(string filename){ #endif std::ofstream out(filename, ios::out | ios::app); if (out){ + printf("creating log file\n"); out << "v1" << endl; out << MANGOHUD_VERSION << endl; out << "---------------------SYSTEM INFO---------------------" << endl; out << "os," << "cpu," << "gpu," << "ram," << "kernel," << "driver," << "cpu_governor," << "Wine/Proton," << "sync," << "renderer," << "cpu_scheduler" << endl; - out << os << "," << cpu << "," << gpu << "," << ram << "," << kernel << "," << driver << "," << cpu_governor << "," << wineVersion << "," << HUDElements.sync << "," << HUDElements.sw_stats->engineName<< "," << HUDElements.cpu_sched << endl; + // out << os << "," << cpu << "," << gpu << "," << ram << "," << kernel << "," << driver << "," << cpu_governor << "," << wineVersion << "," << HUDElements.sync << "," << HUDElements.sw_stats->engineName << "," << HUDElements.cpu_sched << endl; out << "--------------------FRAME METRICS--------------------" << endl; out << "fps," << "frametime," << "cpu_load," << "gpu_load," << "cpu_temp," << "gpu_temp," << "gpu_core_clock," << "gpu_mem_clock," << "gpu_vram_used," << "gpu_power," << "ram_used," << "current_watt,"; for (auto &item : logArray.back().custom_data){ @@ -152,6 +153,7 @@ Logger::Logger(overlay_params* in_params) void Logger::start_logging() { if(m_logging_on) return; + printf("started logging\n"); m_values_valid = false; m_logging_on = true; m_log_start = Clock::now(); @@ -168,9 +170,9 @@ void Logger::start_logging() { currentLogFile << os << "," << cpu << "," << gpu << "," << ram << "," << kernel << "," << driver << "," << cpu_governor << "," << wineVersion << "," << HUDElements.sync << "," << HUDElements.sw_stats->engineName << HUDElements.cpu_sched << endl; currentLogFile << "--------------------FRAME METRICS--------------------" << endl; currentLogFile << "fps," << "frametime," << "cpu_load," << "gpu_load," << "cpu_temp," << "gpu_temp," << "gpu_core_clock," << "gpu_mem_clock," << "gpu_vram_used," << "gpu_power," << "ram_used," << "current_watt,"; - for (size_t i = 0; i < cpuStats.GetCPUData().size(); i++){ - currentLogFile << "cpu" + to_string(i) + ","; - } + // for (size_t i = 0; i < cpuStats.GetCPUData().size(); i++){ + // currentLogFile << "cpu" + to_string(i) + ","; + // } currentLogFile << "elapsed" << endl; } printf("Wrote info to log file\n"); @@ -184,6 +186,7 @@ void Logger::stop_logging() { if(!m_logging_on) return; m_logging_on = false; m_log_end = Clock::now(); + printf("stopped logging\n"); std::thread(calculate_benchmark_data, m_params).detach(); diff --git a/src/win/d3d11_hook.cpp b/src/win/d3d11_hook.cpp index c049b314..7e3ced60 100644 --- a/src/win/d3d11_hook.cpp +++ b/src/win/d3d11_hook.cpp @@ -31,8 +31,10 @@ void impl::d3d11::init() { printf("init d3d11\n"); auto ret = kiero::bind(8, (void**)&oPresent, reinterpret_cast(hkPresent11)); - assert(ret == kiero::Status::Success); - init_d3d_shared(); + if(ret != kiero::Status::Success) + printf("not dx11\n"); + else + init_d3d_shared(); } #endif // KIERO_INCLUDE_D3D11 \ No newline at end of file diff --git a/src/win/d3d12_hook.cpp b/src/win/d3d12_hook.cpp index 67856122..e2c1230e 100644 --- a/src/win/d3d12_hook.cpp +++ b/src/win/d3d12_hook.cpp @@ -18,6 +18,8 @@ void impl::d3d12::init() { printf("init d3d12\n"); auto ret = kiero::bind(140, (void**)&oPresentD3D12, reinterpret_cast(hkPresent12)); - assert(ret == kiero::Status::Success); - init_d3d_shared(); + if(ret != kiero::Status::Success) + printf("not dx12\n"); + else + init_d3d_shared(); } \ No newline at end of file diff --git a/src/win/d3d_shared.cpp b/src/win/d3d_shared.cpp index 4185a850..1035fa19 100644 --- a/src/win/d3d_shared.cpp +++ b/src/win/d3d_shared.cpp @@ -15,7 +15,7 @@ void init_d3d_shared(){ return; parse_overlay_config(¶ms, getenv("MANGOHUD_CONFIG")); cfg_inited = true; - // init_cpu_stats(params); + init_cpu_stats(params); } void d3d_run(){ diff --git a/src/win/kiero.cpp b/src/win/kiero.cpp index 40400020..162f8427 100644 --- a/src/win/kiero.cpp +++ b/src/win/kiero.cpp @@ -16,6 +16,7 @@ #if KIERO_INCLUDE_D3D11 # include # include +# include "d3d11_hook.h" #endif #if KIERO_INCLUDE_D3D12 @@ -25,6 +26,7 @@ #else #include "/usr/include/wine/windows/d3d12.h" #endif +# include "d3d12_hook.h" #endif #if KIERO_INCLUDE_OPENGL @@ -363,7 +365,8 @@ kiero::Status::Enum kiero::init(RenderType::Enum _renderType) ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance); g_renderType = RenderType::D3D11; - + + impl::d3d11::init(); return Status::Success; #endif } @@ -513,6 +516,7 @@ kiero::Status::Enum kiero::init(RenderType::Enum _renderType) ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance); g_renderType = RenderType::D3D12; + impl::d3d12::init(); return Status::Success; #endif } diff --git a/src/win/main.cpp b/src/win/main.cpp index 22deb591..3906e85c 100644 --- a/src/win/main.cpp +++ b/src/win/main.cpp @@ -42,13 +42,14 @@ void renderTypes() { { render_types.push_back(kiero::RenderType::D3D11); } - if (::GetModuleHandle(KIERO_TEXT("d3d12.dll")) != NULL) + 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); + } for (auto& _type : render_types) kiero::init(_type); @@ -59,12 +60,9 @@ int MainThread() ConsoleSetup(); printf("MangoHud Attached!\n"); renderTypes(); - init_ogl(); - if (!render_types.empty()){ - impl::d3d11::init(); - impl::d3d12::init(); + if (!render_types.empty()) return 1; - } + return 0; } diff --git a/src/win/ogl_hook.cpp b/src/win/ogl_hook.cpp index 24326f2a..527227f5 100644 --- a/src/win/ogl_hook.cpp +++ b/src/win/ogl_hook.cpp @@ -3,17 +3,21 @@ #include #include "windows.h" #include +#include "d3d_shared.h" BOOL __stdcall (*owglSwapBuffers)(HDC hDc); BOOL __stdcall hwglSwapBuffers(HDC hDc) { - printf("swapbuffer\n"); + d3d_run(); return owglSwapBuffers(hDc); } void init_ogl(){ printf("init ogl\n"); auto ret = kiero::bind(336, (void**)&owglSwapBuffers, reinterpret_cast(hwglSwapBuffers)); - assert(ret == kiero::Status::Success); + if(ret != kiero::Status::Success) + printf("not opengl\n"); + else + init_d3d_shared(); } \ No newline at end of file