mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2025-12-06 04:04:53 +01:00
Update Nemirtingas overlay to latest.
This commit is contained in:
parent
df94c38b0f
commit
c17fb0c931
82 changed files with 48737 additions and 59872 deletions
|
|
@ -1,104 +1,30 @@
|
|||
#ifndef __INCLUDED_RENDERER_DETECTOR_H__
|
||||
#define __INCLUDED_RENDERER_DETECTOR_H__
|
||||
/*
|
||||
* Copyright (C) Nemirtingas
|
||||
* This file is part of the ingame overlay project
|
||||
*
|
||||
* The ingame overlay project is free software; you can redistribute it
|
||||
* and/or modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* The ingame overlay project 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with the ingame overlay project; if not, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Base_Hook.h"
|
||||
#pragma once
|
||||
|
||||
#ifdef EMU_OVERLAY
|
||||
#ifdef __WINDOWS__
|
||||
#include "../dll/base.h"
|
||||
|
||||
struct IDXGISwapChain;
|
||||
struct IDirect3DDevice9;
|
||||
struct IDirect3DDevice9Ex;
|
||||
#include <future>
|
||||
#include <chrono>
|
||||
#include <memory>
|
||||
|
||||
class Renderer_Detector
|
||||
{
|
||||
private:
|
||||
// Variables
|
||||
std::thread* _hook_thread;
|
||||
std::mutex _found_mutex;
|
||||
unsigned int _hook_retries;
|
||||
bool _renderer_found; // Is the renderer hooked ?
|
||||
bool _dx9_hooked;
|
||||
bool _dx10_hooked;
|
||||
bool _dx11_hooked;
|
||||
bool _dx12_hooked;
|
||||
bool _dxgi_hooked;
|
||||
bool _ogl_hooked; // wglMakeCurrent is hooked ? (opengl)
|
||||
Base_Hook* rendererdetect_hook;
|
||||
Base_Hook* game_renderer;
|
||||
#include "Renderer_Hook.h"
|
||||
|
||||
ATOM atom;
|
||||
HWND dummy_hWnd;
|
||||
|
||||
// Functions
|
||||
Renderer_Detector();
|
||||
~Renderer_Detector();
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE MyIDXGISwapChain_Present(IDXGISwapChain* _this, UINT SyncInterval, UINT Flags);
|
||||
static HRESULT STDMETHODCALLTYPE MyPresent(IDirect3DDevice9* _this, CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride, CONST RGNDATA* pDirtyRegion);
|
||||
static HRESULT STDMETHODCALLTYPE MyPresentEx(IDirect3DDevice9Ex* _this, CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride, CONST RGNDATA* pDirtyRegion, DWORD dwFlags);
|
||||
static BOOL WINAPI MywglMakeCurrent(HDC hDC, HGLRC hGLRC);
|
||||
|
||||
void HookDXGIPresent(IDXGISwapChain* pSwapChain);
|
||||
void HookDX9Present(IDirect3DDevice9* pDevice, bool ex);
|
||||
void HookwglMakeCurrent(decltype(wglMakeCurrent)* wglMakeCurrent);
|
||||
|
||||
void hook_dx9();
|
||||
void hook_dx10();
|
||||
void hook_dx11();
|
||||
void hook_dx12();
|
||||
void hook_opengl();
|
||||
|
||||
void create_hwnd();
|
||||
void destroy_hwnd();
|
||||
void create_hook(const char* libname);
|
||||
bool stop_retry();
|
||||
|
||||
static void find_renderer_proc(Renderer_Detector* _this);
|
||||
|
||||
public:
|
||||
void find_renderer();
|
||||
void renderer_found(Base_Hook* hook);
|
||||
Base_Hook* get_renderer() const;
|
||||
static Renderer_Detector& Inst();
|
||||
};
|
||||
|
||||
#elif defined __LINUX__
|
||||
#include "linux/OpenGLX_Hook.h"
|
||||
|
||||
class Renderer_Detector
|
||||
{
|
||||
// Variables
|
||||
std::thread* _hook_thread;
|
||||
std::mutex _found_mutex;
|
||||
unsigned int _hook_retries;
|
||||
bool _oglx_hooked;
|
||||
bool _renderer_found; // Is the renderer hooked ?
|
||||
Base_Hook* rendererdetect_hook;
|
||||
Base_Hook* game_renderer;
|
||||
|
||||
// Functions
|
||||
Renderer_Detector();
|
||||
~Renderer_Detector();
|
||||
|
||||
static void MyglXSwapBuffers(Display *dpy, GLXDrawable drawable);
|
||||
|
||||
void HookglXSwapBuffers(decltype(glXSwapBuffers)* glXSwapBuffers);
|
||||
|
||||
void hook_openglx(const char* libname);
|
||||
|
||||
void create_hook(const char* libname);
|
||||
bool stop_retry();
|
||||
|
||||
static void find_renderer_proc(Renderer_Detector* _this);
|
||||
|
||||
public:
|
||||
void find_renderer();
|
||||
void renderer_found(Base_Hook* hook);
|
||||
Base_Hook* get_renderer() const;
|
||||
static Renderer_Detector& Inst();
|
||||
};
|
||||
|
||||
#endif//__WINDOWS__
|
||||
#endif//EMU_OVERLAY
|
||||
#endif//__INCLUDED_RENDERER_DETECTOR_H__
|
||||
std::future<Renderer_Hook*> detect_renderer(std::chrono::milliseconds timeout = std::chrono::milliseconds{-1});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue