// ImGui panel that drives the input-forwarding pipeline: pick a target process, // inject coop_hook.dll, and stream pad state to it over shared memory. #pragma once #include #include #include #include #include "coop/protocol.hpp" #include "imgui.h" #include "inject/process_list.hpp" #include "ipc/ipc_server.hpp" namespace coop { class InjectionPanel { public: InjectionPanel(); void draw(); // Forward the latest pad snapshot to the injected hook (if connected). When // test-input mode is on, a synthetic pattern is sent instead of `pads`. void publish(const std::array& pads); // The injected game's main window, as reported by the hook (null if none). [[nodiscard]] HWND game_hwnd() const { return reinterpret_cast(server_.hook_status().game_hwnd); } // The hook's full diagnostics back-channel (other panels read the audio // render-stream counts from here). [[nodiscard]] HookStatusView hook_status() const { return server_.hook_status(); } private: void refresh_processes(); void inject_selected(); void draw_hook_status(); std::vector processes_; char filter_[128] = {}; unsigned long selected_pid_ = 0; std::wstring selected_name_; IpcServer server_; std::string status_; ImVec4 status_color_; bool test_input_ = false; // Sampled to turn the hook's cumulative per-slot counters into poll rates. unsigned long long last_state_count_[kMaxPads] = {}; double state_rate_[kMaxPads] = {}; double last_sample_time_ = 0.0; }; } // namespace coop