mirror of
https://github.com/wiiu-env/WiiUPluginSystem.git
synced 2025-01-10 16:49:22 +01:00
Add WUPSConfigAPI_GetMenuOpen()
to detect if the config menu is open. (#76)
* Add `WUPSConfigAPI_IsMenuOpen()` to detect if the config menu is open. * Changed function signature and name to match other functions. * - Renamed function from `WUPSConfigAPI_GetMenuOpen()` to `WUPSConfigAPI_GetMenuOpen()`. - Changed result type from `BOOL` to `WUPSConfigAPIMenuStatus` enum. --------- Co-authored-by: Daniel K. O. (dkosmari) <none@none>
This commit is contained in:
parent
74205ee081
commit
1ac579aebb
@ -294,3 +294,8 @@ typedef struct wups_loader_init_config_args_t {
|
||||
uint32_t arg_version;
|
||||
uint32_t plugin_identifier;
|
||||
} wups_loader_init_config_args_t;
|
||||
|
||||
typedef enum WUPSConfigAPIMenuStatus {
|
||||
WUPSCONFIG_API_MENU_STATUS_CLOSED = 0,
|
||||
WUPSCONFIG_API_MENU_STATUS_OPENED = 1,
|
||||
} WUPSConfigAPIMenuStatus;
|
||||
|
@ -208,6 +208,23 @@ WUPSConfigAPIStatus WUPSConfigAPI_Item_Destroy(WUPSConfigItemHandle handle);
|
||||
*/
|
||||
const char *WUPSConfigAPI_GetStatusStr(WUPSConfigAPIStatus status);
|
||||
|
||||
/**
|
||||
* @brief Checks if the WUPS config menu is open.
|
||||
*
|
||||
* Use this function if you want to change the behavior of a function replacement while
|
||||
* the user is interacting with the WUPS config menu.
|
||||
*
|
||||
* @param[out] status Pointer to a variable to write the menu status:
|
||||
* - `WUPSCONFIG_API_MENU_STATUS_CLOSED`
|
||||
* - `WUPSCONFIG_API_MENU_STATUS_OPENED`
|
||||
* @return WUPSConfigAPIStatus The status code indicating the result of the operation:
|
||||
* - WUPSCONFIG_API_RESULT_SUCCESS: The result was written successfully to the `status` argument.
|
||||
* - WUPSCONFIG_API_RESULT_INVALID_ARGUMENT: The `status` argument is a null pointer.
|
||||
* - WUPSCONFIG_API_RESULT_LIB_UNINITIALIZED: The WUPSConfig API is not initialized.
|
||||
* - WUPSCONFIG_API_RESULT_MODULE_MISSING_EXPORT: The function WUPSConfigAPI_GetMenuOpen was not found in the module.
|
||||
*/
|
||||
WUPSConfigAPIStatus WUPSConfigAPI_Menu_GetStatus(WUPSConfigAPIMenuStatus *status);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@ -13,6 +13,7 @@ static WUPSConfigAPIStatus (*sAPICategoryAddCategory)(WUPSConfigCategoryHandle p
|
||||
static WUPSConfigAPIStatus (*sAPICategoryAddItem)(WUPSConfigCategoryHandle parentHandle, WUPSConfigItemHandle itemHandle) = nullptr;
|
||||
static WUPSConfigAPIStatus (*sAPIItemCreateEx)(WUPSConfigAPICreateItemOptions options, WUPSConfigItemHandle *out) = nullptr;
|
||||
static WUPSConfigAPIStatus (*sAPIItemDestroy)(WUPSConfigItemHandle handle) = nullptr;
|
||||
static WUPSConfigAPIStatus (*sAPIMenuGetStatus)(WUPSConfigAPIMenuStatus *status) = nullptr;
|
||||
|
||||
static WUPSConfigAPIVersion sConfigAPIVersion = WUPS_CONFIG_API_VERSION_ERROR;
|
||||
|
||||
@ -101,6 +102,8 @@ extern "C" WUPSConfigAPIStatus WUPSConfigAPI_InitLibrary_Internal(wups_loader_in
|
||||
WUPS_DEBUG_REPORT("libwups: FindExport WUPSConfigAPI_Item_Destroy failed.\n");
|
||||
return WUPSCONFIG_API_RESULT_MODULE_MISSING_EXPORT;
|
||||
}
|
||||
// This one is allowed to fail.
|
||||
OSDynLoad_FindExport(sModuleHandle, OS_DYNLOAD_EXPORT_FUNC, "WUPSConfigAPI_Menu_GetStatus", (void **) &sAPIMenuGetStatus);
|
||||
|
||||
sConfigLibInitDone = true;
|
||||
sConfigPluginIdentifier = args.plugin_identifier;
|
||||
@ -242,4 +245,14 @@ WUPSConfigAPIStatus WUPSConfigAPI_Item_Destroy(WUPSConfigItemHandle handle) {
|
||||
}
|
||||
|
||||
return sAPIItemDestroy(handle);
|
||||
}
|
||||
}
|
||||
|
||||
WUPSConfigAPIStatus WUPSConfigAPI_Menu_GetStatus(WUPSConfigAPIMenuStatus *out) {
|
||||
if (sConfigAPIVersion == WUPS_CONFIG_API_VERSION_ERROR) {
|
||||
return WUPSCONFIG_API_RESULT_LIB_UNINITIALIZED;
|
||||
}
|
||||
if (sAPIMenuGetStatus == nullptr) {
|
||||
return WUPSCONFIG_API_RESULT_MODULE_MISSING_EXPORT;
|
||||
}
|
||||
return sAPIMenuGetStatus(out);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user