예제 #1
0
파일: error.c 프로젝트: dankzegriefer/FBI
static const char* summary_to_string(Result res) {
    switch(R_SUMMARY(res)) {
        case RS_SUCCESS:
            return "Success";
        case RS_NOP:
            return "Nop";
        case RS_WOULDBLOCK:
            return "Would block";
        case RS_OUTOFRESOURCE:
            return "Out of resource";
        case RS_NOTFOUND:
            return "Not found";
        case RS_INVALIDSTATE:
            return "Invalid state";
        case RS_NOTSUPPORTED:
            return "Not supported";
        case RS_INVALIDARG:
            return "Invalid argument";
        case RS_WRONGARG:
            return "Wrong argument";
        case RS_CANCELED:
            return "Canceled";
        case RS_STATUSCHANGED:
            return "Status changed";
        case RS_INTERNAL:
            return "Internal";
        default:
            return "<unknown>";
    }
}
예제 #2
0
파일: srvsys.c 프로젝트: 3xkrazy/corbenik
Result
srvSysInit()
{
    Result rc = 0;

    if (!initLockinit) {
        RecursiveLock_Init(&initLock);
    }

    RecursiveLock_Lock(&initLock);

    if (srvRefCount > 0) {
        RecursiveLock_Unlock(&initLock);
        return MAKERESULT(RL_INFO, RS_NOP, 25, RD_ALREADY_INITIALIZED);
    }

    while (1) {
        rc = svcConnectToPort(&srvHandle, "srv:");
        if (R_LEVEL(rc) != RL_PERMANENT || R_SUMMARY(rc) != RS_NOTFOUND || R_DESCRIPTION(rc) != RD_NOT_FOUND)
            break;
        svcSleepThread(500000);
    }
    if (R_SUCCEEDED(rc)) {
        rc = srvSysRegisterClient();
        srvRefCount++;
    }

    RecursiveLock_Unlock(&initLock);
    return rc;
}
예제 #3
0
파일: error.c 프로젝트: dankzegriefer/FBI
void error_display_res(void* data, void (*drawTop)(ui_view* view, void* data, float x1, float y1, float x2, float y2), Result result, const char* text, ...) {
    error_data* errorData = (error_data*) calloc(1, sizeof(error_data));
    errorData->data = data;
    errorData->drawTop = drawTop;

    char textBuf[1024];
    va_list list;
    va_start(list, text);
    vsnprintf(textBuf, 1024, text, list);
    va_end(list);

    int level = R_LEVEL(result);
    int summary = R_SUMMARY(result);
    int module = R_MODULE(result);
    int description = R_DESCRIPTION(result);
    snprintf(errorData->fullText, 4096, "%s\nResult code: 0x%08lX\nLevel: %s (%d)\nSummary: %s (%d)\nModule: %s (%d)\nDesc: %s (%d)", textBuf, result, level_to_string(result), level, summary_to_string(result), summary, module_to_string(result), module, description_to_string(result), description);

    ui_push(prompt_create("Error", errorData->fullText, COLOR_TEXT, false, errorData, NULL, error_draw_top, error_onresponse));
}