Skip to content

Commit

Permalink
Add ContentRedirection_GetStatusStr
Browse files Browse the repository at this point in the history
  • Loading branch information
Maschell committed Sep 3, 2022
1 parent 60f7c6f commit 14576d2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/content_redirection/redirection.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ typedef enum ContentRedirectionApiErrorType {
CONTENT_REDIRECTION_API_ERROR_LAYER_NOT_FOUND = -4,
} ContentRedirectionApiErrorType;

const char *ContentRedirection_GetStatusStr(ContentRedirectionStatus status);

/**
* This function has to be called before any other function of this lib (except ContentRedirection_GetVersion) can be used.
*
Expand Down
26 changes: 26 additions & 0 deletions source/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,32 @@ static int (*sCRRemoveDevice)(const char *)

static ContentRedirectionVersion sContentRedirectionVersion = CONTENT_REDIRECTION_MODULE_VERSION_ERROR;

const char *ContentRedirection_GetStatusStr(ContentRedirectionStatus status) {
switch (status) {
case CONTENT_REDIRECTION_RESULT_SUCCESS:
return "CONTENT_REDIRECTION_RESULT_SUCCESS";
case CONTENT_REDIRECTION_RESULT_MODULE_NOT_FOUND:
return "CONTENT_REDIRECTION_RESULT_MODULE_NOT_FOUND";
case CONTENT_REDIRECTION_RESULT_MODULE_MISSING_EXPORT:
return "CONTENT_REDIRECTION_RESULT_MODULE_MISSING_EXPORT";
case CONTENT_REDIRECTION_RESULT_UNSUPPORTED_VERSION:
return "CONTENT_REDIRECTION_RESULT_UNSUPPORTED_VERSION";
case CONTENT_REDIRECTION_RESULT_INVALID_ARGUMENT:
return "CONTENT_REDIRECTION_RESULT_INVALID_ARGUMENT";
case CONTENT_REDIRECTION_RESULT_NO_MEMORY:
return "CONTENT_REDIRECTION_RESULT_NO_MEMORY";
case CONTENT_REDIRECTION_RESULT_UNKNOWN_FS_LAYER_TYPE:
return "CONTENT_REDIRECTION_RESULT_UNKNOWN_FS_LAYER_TYPE";
case CONTENT_REDIRECTION_RESULT_LAYER_NOT_FOUND:
return "CONTENT_REDIRECTION_RESULT_LAYER_NOT_FOUND";
case CONTENT_REDIRECTION_RESULT_LIB_UNINITIALIZED:
return "CONTENT_REDIRECTION_RESULT_LIB_UNINITIALIZED";
case CONTENT_REDIRECTION_RESULT_UNKNOWN_ERROR:
return "CONTENT_REDIRECTION_RESULT_UNKNOWN_ERROR";
}
return "CONTENT_REDIRECTION_RESULT_UNKNOWN_ERROR";
}

ContentRedirectionStatus ContentRedirection_InitLibrary() {
if (OSDynLoad_Acquire("homebrew_content_redirection", &sModuleHandle) != OS_DYNLOAD_OK) {
OSReport("ContentRedirection_Init: OSDynLoad_Acquire failed.\n");
Expand Down

0 comments on commit 14576d2

Please sign in to comment.