MCPcopy Create free account
hub / github.com/MaaXYZ/MaaFramework / connect

Method connect

source/MaaGamepadControlUnit/Manager/GamepadControlUnitMgr.cpp:89–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89bool GamepadControlUnitMgr::connect()
90{
91 connected_ = false;
92
93 // Initialize gamepad input
94 gamepad_input_ = std::make_unique<ViGEmInput>(gamepad_type_);
95 if (!gamepad_input_->connect()) {
96 LogError << "Failed to connect gamepad";
97 return false;
98 }
99
100 // Initialize Win32 screencap if hwnd is provided
101 if (hwnd_ && screencap_method_ != MaaWin32ScreencapMethod_None) {
102 if (!init_win32_unit()) {
103 LogWarn << "Failed to initialize Win32 screencap, screencap will not be available";
104 // Don't fail the entire connection, gamepad input is still usable
105 }
106 }
107
108 connected_ = true;
109 LogInfo << "Gamepad controller connected, type:" << (gamepad_type_ == MaaGamepadType_Xbox360 ? "Xbox360" : "DualShock4");
110 return true;
111}
112
113bool GamepadControlUnitMgr::init_win32_unit()
114{

Callers

nothing calls this directly

Calls 1

connectMethod · 0.65

Tested by

no test coverage detected