mirror of
https://gitlab.com/Theopse/fbi-i18n-zh.git
synced 2025-09-01 17:29:47 +08:00
Add support for updating FBI as a 3DSX.
This commit is contained in:
parent
31e9362f34
commit
b85389c43c
@ -357,3 +357,13 @@ bool util_filter_tickets(void* data, const char* name, u32 attributes) {
|
|||||||
size_t len = strlen(name);
|
size_t len = strlen(name);
|
||||||
return len >= 4 && strncasecmp(name + len - 4, ".tik", 4) == 0;
|
return len >= 4 && strncasecmp(name + len - 4, ".tik", 4) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char* path3dsx = NULL;
|
||||||
|
|
||||||
|
const char* util_get_3dsx_path() {
|
||||||
|
return path3dsx;
|
||||||
|
}
|
||||||
|
|
||||||
|
void util_set_3dsx_path(const char* path) {
|
||||||
|
path3dsx = path;
|
||||||
|
}
|
@ -61,3 +61,6 @@ u8* util_get_tmd_content_chunk(u8* tmd, u32 index);
|
|||||||
|
|
||||||
bool util_filter_cias(void* data, const char* name, u32 attributes);
|
bool util_filter_cias(void* data, const char* name, u32 attributes);
|
||||||
bool util_filter_tickets(void* data, const char* name, u32 attributes);
|
bool util_filter_tickets(void* data, const char* name, u32 attributes);
|
||||||
|
|
||||||
|
const char* util_get_3dsx_path();
|
||||||
|
void util_set_3dsx_path(const char* path);
|
@ -43,6 +43,8 @@ int main(int argc, const char* argv[]) {
|
|||||||
util_panic("Failed to acquire kernel access.");
|
util_panic("Failed to acquire kernel access.");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
util_set_3dsx_path(argv[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
aptOpenSession();
|
aptOpenSession();
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include "../prompt.h"
|
#include "../prompt.h"
|
||||||
#include "../ui.h"
|
#include "../ui.h"
|
||||||
#include "../../core/screen.h"
|
#include "../../core/screen.h"
|
||||||
|
#include "../../core/util.h"
|
||||||
#include "../../json/json.h"
|
#include "../../json/json.h"
|
||||||
|
|
||||||
#define URL_MAX 1024
|
#define URL_MAX 1024
|
||||||
@ -88,14 +89,31 @@ static Result update_read_src(void* data, u32 handle, u32* bytesRead, void* buff
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Result update_open_dst(void* data, u32 index, void* initialReadBlock, u32* handle) {
|
static Result update_open_dst(void* data, u32 index, void* initialReadBlock, u32* handle) {
|
||||||
return AM_StartCiaInstall(MEDIATYPE_SD, handle);
|
if(util_get_3dsx_path() != NULL) {
|
||||||
|
FS_Path* path = util_make_path_utf8(util_get_3dsx_path());
|
||||||
|
if(path != NULL) {
|
||||||
|
Result res = FSUSER_OpenFileDirectly(handle, ARCHIVE_SDMC, fsMakePath(PATH_EMPTY, ""), *path, FS_OPEN_WRITE | FS_OPEN_CREATE, 0);
|
||||||
|
|
||||||
|
util_free_path_utf8(path);
|
||||||
|
return res;
|
||||||
|
} else {
|
||||||
|
return R_FBI_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return AM_StartCiaInstall(MEDIATYPE_SD, handle);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Result update_close_dst(void* data, u32 index, bool succeeded, u32 handle) {
|
static Result update_close_dst(void* data, u32 index, bool succeeded, u32 handle) {
|
||||||
if(succeeded) {
|
if(util_get_3dsx_path() != NULL) {
|
||||||
return AM_FinishCiaInstall(handle);
|
return FSFILE_Close(handle);
|
||||||
} else {
|
} else {
|
||||||
return AM_CancelCIAInstall(handle);
|
if(succeeded) {
|
||||||
|
return AM_FinishCiaInstall(handle);
|
||||||
|
} else {
|
||||||
|
return AM_CancelCIAInstall(handle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,9 +214,11 @@ static void update_check_update(ui_view* view, void* data, float* progress, char
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(assetName != NULL && assetUrl != NULL && strncmp(assetName->u.string.ptr, "FBI.cia", assetName->u.string.length) == 0) {
|
if(assetName != NULL && assetUrl != NULL) {
|
||||||
url = assetUrl->u.string.ptr;
|
if(strncmp(assetName->u.string.ptr, util_get_3dsx_path() != NULL ? "FBI.3dsx" : "FBI.cia", assetName->u.string.length) == 0) {
|
||||||
break;
|
url = assetUrl->u.string.ptr;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user