Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "plugin.h"
- #include "plugin_vc.h"
- #include "vendors/imgui/imgui.h"
- #include "vendors/imgui/imgui_impl_dx9.h"
- #include "vendors/imgui/imgui_impl_win32.h"
- #include "rwd3d9.h"
- #include <d3d9.h>
- #include "CHud.h"
- #include <iostream>
- using namespace plugin;
- bool ImGUIWindow = 0;
- bool bInitalized = 0;
- bool first = 1;
- extern LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
- LRESULT WINAPI HookedWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
- {
- ImGuiIO& io = ImGui::GetIO();
- ShowCursor(1);
- io.MouseDrawCursor = 1;
- ImGui_ImplWin32_WndProcHandler(hWnd, msg, wParam, lParam);
- return DefWindowProc(hWnd, msg, wParam, lParam);
- }
- class gtcvc {
- public:
- gtcvc() {
- AllocConsole();
- freopen("CONOUT$", "w", stdout);
- Events::initGameEvent += [] {
- SetWindowLongPtr(RsGlobal.ps->window , GWLP_WNDPROC, (LONG_PTR)HookedWndProc);
- };
- Events::gameProcessEvent += [] {
- if (first) {
- std::cout << "gameEvent called" << std::endl;
- if (!bInitalized) {
- // Setup Dear ImGui binding
- IMGUI_CHECKVERSION();
- ImGui::CreateContext();
- //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
- ImGui_ImplWin32_Init(*(HWND*)0x7897A4);
- if (RwD3D9Supported()) {
- ImGui_ImplDX9_Init((IDirect3DDevice9*)RwD3D9GetCurrentD3DDevice());
- }
- // Setup style
- ImGui::StyleColorsDark();
- bInitalized = true;
- first = false;
- CHud::SetHelpMessage("Don't forget to press F9 to play co-op campagin!", 0, 0);
- }
- }
- };
- Events::drawingEvent += [] {
- if (bInitalized) {
- //SetWindowLongPtr(*(HWND*)0x7897A4, GWLP_WNDPROC, (LONG_PTR)WndProc);
- ImGui_ImplDX9_NewFrame();
- ImGui_ImplWin32_NewFrame();
- ImGui::NewFrame();
- //ImGui::SetNextWindowPosCenter();
- ImGui::Begin("Grand Theft CO-OP: Vice City");
- ImGui::Text("Text Test");
- ImGui::End();
- ImGui::EndFrame();
- ImGui::Render();
- ImGui_ImplDX9_RenderDrawData(ImGui::GetDrawData());
- }
- };
- }
- } _gtcvc;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement