本文整理汇总了C++中R_SUCCEEDED函数的典型用法代码示例。如果您正苦于以下问题:C++ R_SUCCEEDED函数的具体用法?C++ R_SUCCEEDED怎么用?C++ R_SUCCEEDED使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了R_SUCCEEDED函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: audinGetAudioInState
Result audinGetAudioInState(AudioInState *State) {
IpcCommand c;
ipcInitialize(&c);
struct {
u64 magic;
u64 cmd_id;
} *raw;
raw = ipcPrepareHeader(&c, sizeof(*raw));
raw->magic = SFCI_MAGIC;
raw->cmd_id = 0;
Result rc = serviceIpcDispatch(&g_audinIAudioIn);
if (R_SUCCEEDED(rc)) {
IpcParsedCommand r;
ipcParse(&r);
struct {
u64 magic;
u64 result;
u32 state;
} *resp = r.Raw;
rc = resp->result;
if (R_SUCCEEDED(rc) && State)
*State = resp->state;
}
return rc;
}
示例2: action_paste_files_make_dst_directory
static Result action_paste_files_make_dst_directory(void* data, u32 index) {
paste_files_data* pasteData = (paste_files_data*) data;
Result res = 0;
char dstPath[FILE_PATH_MAX];
action_paste_files_get_dst_path(pasteData, index, dstPath);
if(R_SUCCEEDED(res = util_ensure_dir(pasteData->target->archive, dstPath))) {
char parentPath[FILE_PATH_MAX];
util_get_parent_path(parentPath, dstPath, FILE_PATH_MAX);
char baseDstPath[FILE_PATH_MAX];
if(pasteData->target->attributes & FS_ATTRIBUTE_DIRECTORY) {
strncpy(baseDstPath, pasteData->target->path, FILE_PATH_MAX);
} else {
util_get_parent_path(baseDstPath, pasteData->target->path, FILE_PATH_MAX);
}
if(strncmp(parentPath, baseDstPath, FILE_PATH_MAX) == 0) {
list_item* dstItem = NULL;
if(R_SUCCEEDED(res) && R_SUCCEEDED(task_create_file_item(&dstItem, pasteData->target->archive, dstPath))) {
linked_list_add(pasteData->items, dstItem);
}
}
}
return res;
}
示例3: FSCIA_Init
Result FSCIA_Init(u64 titleid, FS_MediaType mediatype)
{
Result ret = 1;
debug_print("FSCIA_Init:\n");
if (!saveInitialized)
{
lowPath[0] = mediatype;
lowPath[1] = titleid; /// titleid & 0xFFFFFFFF
lowPath[2] = titleid >> 32; // (titleid >> 32) & 0xFFFFFFFF
debug_print(" > [0]: 0x%016lx\n", lowPath[0]);
debug_print(" > [1]: 0x%016lx\n", lowPath[1]);
debug_print(" > [2]: 0x%016lx\n", lowPath[2]);
ret = FSUSER_OpenArchive(&saveArchive, ARCHIVE_USER_SAVEDATA, (FS_Path) { PATH_BINARY, 12, lowPath });
r(" > FSUSER_OpenArchive: %lx\n", ret);
saveInitialized = R_SUCCEEDED(ret); // true
if (!saveInitialized)
{
ret = FSUSER_OpenArchive(&saveArchive, ARCHIVE_SDMC, fsMakePath(PATH_EMPTY, NULL));
r(" > FSUSER_OpenArchive: %lx\n", ret);
saveInitialized = R_SUCCEEDED(ret); // true
}
}
示例4: task_data_op_check_running
static Result task_data_op_check_running(data_op_data* data, u32 index, u32* srcHandle, u32* dstHandle) {
Result res = 0;
if(task_is_quit_all() || svcWaitSynchronization(data->cancelEvent, 0) == 0) {
res = R_APP_CANCELLED;
} else {
bool suspended = svcWaitSynchronization(task_get_suspend_event(), 0) != 0;
if(suspended) {
if(data->op == DATAOP_COPY && srcHandle != NULL && dstHandle != NULL && data->suspendTransfer != NULL && R_SUCCEEDED(res)) {
res = data->suspendTransfer(data->data, index, srcHandle, dstHandle);
}
if(data->suspend != NULL && R_SUCCEEDED(res)) {
res = data->suspend(data->data, index);
}
}
svcWaitSynchronization(task_get_pause_event(), U64_MAX);
if(suspended) {
if(data->restore != NULL && R_SUCCEEDED(res)) {
res = data->restore(data->data, index);
}
if(data->op == DATAOP_COPY && srcHandle != NULL && dstHandle != NULL && data->restoreTransfer != NULL && R_SUCCEEDED(res)) {
res = data->restoreTransfer(data->data, index, srcHandle, dstHandle);
}
}
}
return res;
}
示例5: task_capture_cam
Result task_capture_cam(capture_cam_data* data) {
if(data == NULL || data->buffer == NULL || data->width <= 0 || data->width > 640 || data->height <= 0 || data->height > 480) {
return R_APP_INVALID_ARGUMENT;
}
data->mutex = 0;
data->finished = false;
data->result = 0;
data->cancelEvent = 0;
Result res = 0;
if(R_SUCCEEDED(res = svcCreateEvent(&data->cancelEvent, RESET_STICKY)) && R_SUCCEEDED(res = svcCreateMutex(&data->mutex, false))) {
if(threadCreate(task_capture_cam_thread, data, 0x10000, 0x1A, 0, true) == NULL) {
res = R_APP_THREAD_CREATE_FAILED;
}
}
if(R_FAILED(res)) {
data->finished = true;
if(data->cancelEvent != 0) {
svcCloseHandle(data->cancelEvent);
data->cancelEvent = 0;
}
if(data->mutex != 0) {
svcCloseHandle(data->mutex);
data->mutex = 0;
}
}
return res;
}
示例6: audinInitialize
Result audinInitialize(void)
{
atomicIncrement64(&g_refCnt);
if (serviceIsActive(&g_audinSrv))
return 0;
Result rc = 0;
rc = smGetService(&g_audinSrv, "audin:u");
// Setup the default device
if (R_SUCCEEDED(rc))
{
// Passing an empty device name will open the default "BuiltInHeadset"
char DeviceNameIn[DEVICE_NAME_LENGTH] = {0};
char DeviceNameOut[DEVICE_NAME_LENGTH] = {0};
// Open audio input device
rc = audinOpenAudioIn(DeviceNameIn, DeviceNameOut, DEFAULT_SAMPLE_RATE, DEFAULT_CHANNEL_COUNT, &g_sampleRate, &g_channelCount, &g_pcmFormat, &g_deviceState);
}
// Register global handle for buffer events
if (R_SUCCEEDED(rc))
rc = _audinRegisterBufferEvent(&g_audinBufferEventHandle);
if (R_FAILED(rc))
audinExit();
return rc;
}
示例7: loadTitleCodeSection
static int loadTitleCodeSection(u64 progId, u8 *code, u32 size)
{
/* Here we look for "/luma/code_sections/[u64 titleID in hex, uppercase].bin"
If it exists it should be a decompressed binary code file */
char path[] = "/luma/code_sections/0000000000000000.bin";
progIdToStr(path + 35, progId);
IFile file;
Result ret = fileOpen(&file, ARCHIVE_SDMC, path, FS_OPEN_READ);
if(R_SUCCEEDED(ret))
{
u64 fileSize, total;
ret = IFile_GetSize(&file, &fileSize);
if(!R_SUCCEEDED(ret) || fileSize > size) return -1;
ret = IFile_Read(&file, &total, code, fileSize);
IFile_Close(&file);
if(!R_SUCCEEDED(ret)) return -1;
else if(total < fileSize) return -2; //Shouldn't happen
}
return ret;
}
示例8: _audinRegisterBufferEvent
static Result _audinRegisterBufferEvent(Handle *BufferEvent) {
IpcCommand c;
ipcInitialize(&c);
struct {
u64 magic;
u64 cmd_id;
} *raw;
raw = ipcPrepareHeader(&c, sizeof(*raw));
raw->magic = SFCI_MAGIC;
raw->cmd_id = 4;
Result rc = serviceIpcDispatch(&g_audinIAudioIn);
if (R_SUCCEEDED(rc)) {
IpcParsedCommand r;
ipcParse(&r);
struct {
u64 magic;
u64 result;
} *resp = r.Raw;
rc = resp->result;
if (R_SUCCEEDED(rc) && BufferEvent)
*BufferEvent = r.Handles[0];
}
return rc;
}
示例9: fsDirGetEntryCount
Result fsDirGetEntryCount(FsDir* d, u64* count) {
IpcCommand c;
ipcInitialize(&c);
struct {
u64 magic;
u64 cmd_id;
} *raw;
raw = ipcPrepareHeader(&c, sizeof(*raw));
raw->magic = SFCI_MAGIC;
raw->cmd_id = 1;
Result rc = serviceIpcDispatch(&d->s);
if (R_SUCCEEDED(rc)) {
IpcParsedCommand r;
ipcParse(&r);
struct {
u64 magic;
u64 result;
u64 count;
} *resp = r.Raw;
rc = resp->result;
if (R_SUCCEEDED(rc) && count) *count = resp->count;
}
return rc;
}
示例10: action_paste_files_open_dst
static Result action_paste_files_open_dst(void* data, u32 index, void* initialReadBlock, u64 size, u32* handle) {
paste_files_data* pasteData = (paste_files_data*) data;
Result res = 0;
char dstPath[FILE_PATH_MAX];
action_paste_files_get_dst_path(pasteData, index, dstPath);
FS_Path* fsPath = util_make_path_utf8(dstPath);
if(fsPath != NULL) {
Handle currHandle;
pasteData->currExists = R_SUCCEEDED(FSUSER_OpenFile(&currHandle, pasteData->target->archive, *fsPath, FS_OPEN_READ, 0));
if(pasteData->currExists) {
FSFILE_Close(currHandle);
} else {
res = FSUSER_CreateFile(pasteData->target->archive, *fsPath, 0, size);
}
if(R_SUCCEEDED(res)) {
res = FSUSER_OpenFile(handle, pasteData->target->archive, *fsPath, FS_OPEN_WRITE, 0);
}
util_free_path_utf8(fsPath);
} else {
res = R_FBI_OUT_OF_MEMORY;
}
return res;
}
示例11: fsFileGetSize
Result fsFileGetSize(FsFile* f, u64* out) {
IpcCommand c;
ipcInitialize(&c);
struct {
u64 magic;
u64 cmd_id;
} *raw;
raw = ipcPrepareHeader(&c, sizeof(*raw));
raw->magic = SFCI_MAGIC;
raw->cmd_id = 4;
Result rc = serviceIpcDispatch(&f->s);
if (R_SUCCEEDED(rc)) {
IpcParsedCommand r;
ipcParse(&r);
struct {
u64 magic;
u64 result;
u64 size;
} *resp = r.Raw;
rc = resp->result;
if (R_SUCCEEDED(rc) && out) *out = resp->size;
}
return rc;
}
示例12: fsMountSdcard
Result fsMountSdcard(FsFileSystem* out) {
IpcCommand c;
ipcInitialize(&c);
struct {
u64 magic;
u64 cmd_id;
} *raw;
raw = ipcPrepareHeader(&c, sizeof(*raw));
raw->magic = SFCI_MAGIC;
raw->cmd_id = 18;
Result rc = serviceIpcDispatch(&g_fsSrv);
if (R_SUCCEEDED(rc)) {
IpcParsedCommand r;
ipcParse(&r);
struct {
u64 magic;
u64 result;
} *resp = r.Raw;
rc = resp->result;
if (R_SUCCEEDED(rc)) {
serviceCreate(&out->s, r.Handles[0]);
}
}
return rc;
}
示例13: fsOpenDataStorageByCurrentProcess
Result fsOpenDataStorageByCurrentProcess(FsStorage* out) {
IpcCommand c;
ipcInitialize(&c);
struct {
u64 magic;
u64 cmd_id;
} *raw;
raw = ipcPrepareHeader(&c, sizeof(*raw));
raw->magic = SFCI_MAGIC;
raw->cmd_id = 200;
Result rc = serviceIpcDispatch(&g_fsSrv);
if (R_SUCCEEDED(rc)) {
IpcParsedCommand r;
ipcParse(&r);
struct {
u64 magic;
u64 result;
} *resp = r.Raw;
rc = resp->result;
if (R_SUCCEEDED(rc)) {
serviceCreate(&out->s, r.Handles[0]);
}
}
return rc;
}
示例14: action_paste_files_close_dst
static Result action_paste_files_close_dst(void* data, u32 index, bool succeeded, u32 handle) {
paste_files_data* pasteData = (paste_files_data*) data;
Result res = 0;
if(R_SUCCEEDED(res = FSFILE_Close(handle))) {
char dstPath[FILE_PATH_MAX];
action_paste_files_get_dst_path(pasteData, index, dstPath);
char parentPath[FILE_PATH_MAX];
util_get_parent_path(parentPath, dstPath, FILE_PATH_MAX);
char baseDstPath[FILE_PATH_MAX];
if(pasteData->target->attributes & FS_ATTRIBUTE_DIRECTORY) {
strncpy(baseDstPath, pasteData->target->path, FILE_PATH_MAX);
} else {
util_get_parent_path(baseDstPath, pasteData->target->path, FILE_PATH_MAX);
}
if(strncmp(parentPath, baseDstPath, FILE_PATH_MAX) == 0) {
list_item* dstItem = NULL;
if(R_SUCCEEDED(task_create_file_item(&dstItem, pasteData->target->archive, dstPath, ((file_info*) ((list_item*) linked_list_get(&pasteData->contents, index))->data)->attributes & ~FS_ATTRIBUTE_READ_ONLY))) {
linked_list_add(pasteData->items, dstItem);
}
}
}
return res;
}
示例15: openLumaFile
static u32 openLumaFile(IFile *file, const char *path)
{
Result res = fileOpen(file, ARCHIVE_SDMC, path, FS_OPEN_READ);
if(R_SUCCEEDED(res)) return ARCHIVE_SDMC;
//Returned if SD is not mounted
return (u32)res == 0xC88044AB && R_SUCCEEDED(fileOpen(file, ARCHIVE_NAND_RW, path, FS_OPEN_READ)) ? ARCHIVE_NAND_RW : 0;
}