| 17 | ~Win32ControlUnitLoader() { destroy(); } |
| 18 | |
| 19 | bool load() |
| 20 | { |
| 21 | #ifdef _WIN32 |
| 22 | if (!load_library(library_dir() / "MaaWin32ControlUnit")) { |
| 23 | LogError << "Failed to load MaaWin32ControlUnit library"; |
| 24 | return false; |
| 25 | } |
| 26 | |
| 27 | create_func_ = get_function<decltype(::MaaWin32ControlUnitCreate)>("MaaWin32ControlUnitCreate"); |
| 28 | destroy_func_ = get_function<decltype(::MaaWin32ControlUnitDestroy)>("MaaWin32ControlUnitDestroy"); |
| 29 | |
| 30 | if (!create_func_ || !destroy_func_) { |
| 31 | LogError << "Failed to get Win32ControlUnit API functions"; |
| 32 | unload(); |
| 33 | return false; |
| 34 | } |
| 35 | |
| 36 | return true; |
| 37 | #else |
| 38 | return false; |
| 39 | #endif |
| 40 | } |
| 41 | |
| 42 | void unload() |
| 43 | { |
no test coverage detected