Rename SDUtils_Init to SDUtils_InitLibrary and SDUtils_DeInit to SDUtils_DeInitLibrary

This commit is contained in:
Maschell 2022-09-03 19:08:41 +02:00
parent b8598214ff
commit 6ac5751bd7
2 changed files with 13 additions and 12 deletions

View File

@ -36,7 +36,13 @@ typedef void (*SDCleanUpHandlesHandlerFn)();
* SDUTILS_RESULT_MODULE_NOT_FOUND when the SDHotSwapModule is not loaded * SDUTILS_RESULT_MODULE_NOT_FOUND when the SDHotSwapModule is not loaded
* SDUTILS_RESULT_MODULE_MISSING_EXPORT when the SDHotSwapModule does not export the expected functions. * SDUTILS_RESULT_MODULE_MISSING_EXPORT when the SDHotSwapModule does not export the expected functions.
*/ */
SDUtilsStatus SDUtils_Init(); SDUtilsStatus SDUtils_InitLibrary();
/**
* Deinitializes the SDUtils library, must be called before exiting the application
* @return SDUTILS_RESULT_SUCCESS on success
*/
SDUtilsStatus SDUtils_DeInitLibrary();
/** /**
* Returns the API Version of the WUHBUtils Module. * Returns the API Version of the WUHBUtils Module.
@ -44,11 +50,6 @@ SDUtilsStatus SDUtils_Init();
*/ */
SDUtilsVersion SDUtils_GetVersion(); SDUtilsVersion SDUtils_GetVersion();
/**
* Deinitializes the SDUtils library, must be called before exiting the application
* @return SDUTILS_RESULT_SUCCESS on success
*/
SDUtilsStatus SDUtils_DeInit();
/** /**
* Registers a callback which will be called whenever a sd card will be inserted or ejected. * Registers a callback which will be called whenever a sd card will be inserted or ejected.

View File

@ -13,7 +13,7 @@ static bool (*sSDUtilsRemoveAttachHandler)(SDAttachHandlerFn) = nullptr;
static bool (*sSDUtilsAddCleanUpHandlesHandler)(SDCleanUpHandlesHandlerFn) = nullptr; static bool (*sSDUtilsAddCleanUpHandlesHandler)(SDCleanUpHandlesHandlerFn) = nullptr;
static bool (*sSDUtilsRemoveCleanUpHandlesHandler)(SDCleanUpHandlesHandlerFn) = nullptr; static bool (*sSDUtilsRemoveCleanUpHandlesHandler)(SDCleanUpHandlesHandlerFn) = nullptr;
SDUtilsStatus SDUtils_Init() { SDUtilsStatus SDUtils_InitLibrary() {
if (OSDynLoad_Acquire("homebrew_sdhotswap", &sModuleHandle) != OS_DYNLOAD_OK) { if (OSDynLoad_Acquire("homebrew_sdhotswap", &sModuleHandle) != OS_DYNLOAD_OK) {
OSReport("SDUtils_Init: OSDynLoad_Acquire failed.\n"); OSReport("SDUtils_Init: OSDynLoad_Acquire failed.\n");
return SDUTILS_RESULT_MODULE_NOT_FOUND; return SDUTILS_RESULT_MODULE_NOT_FOUND;
@ -51,6 +51,11 @@ SDUtilsStatus SDUtils_Init() {
return SDUTILS_RESULT_SUCCESS; return SDUTILS_RESULT_SUCCESS;
} }
SDUtilsStatus SDUtils_DeInitLibrary() {
// We don't need to release the OSDynLoad handle for modules.
return SDUTILS_RESULT_SUCCESS;
}
SDUtilsVersion GetVersion(); SDUtilsVersion GetVersion();
SDUtilsVersion SDUtils_GetVersion() { SDUtilsVersion SDUtils_GetVersion() {
if (sSDUtilsGetVersion == nullptr) { if (sSDUtilsGetVersion == nullptr) {
@ -60,11 +65,6 @@ SDUtilsVersion SDUtils_GetVersion() {
return reinterpret_cast<decltype(&GetVersion)>(sSDUtilsGetVersion)(); return reinterpret_cast<decltype(&GetVersion)>(sSDUtilsGetVersion)();
} }
SDUtilsStatus SDUtils_DeInit() {
// We don't need to release the OSDynLoad handle for modules.
return SDUTILS_RESULT_SUCCESS;
}
SDUtilsStatus SDUtils_IsSdCardMounted(bool *status) { SDUtilsStatus SDUtils_IsSdCardMounted(bool *status) {
if (status == nullptr) { if (status == nullptr) {
return SDUTILS_RESULT_INVALID_ARGUMENT; return SDUTILS_RESULT_INVALID_ARGUMENT;