mirror of
https://gitlab.com/Theopse/fbi-i18n-zh.git
synced 2025-04-06 03:58:02 +08:00
Revert threading changes, disable curl code for now.
This commit is contained in:
parent
1539c55ec5
commit
2c982d85ec
@ -182,7 +182,7 @@ Result task_capture_cam(capture_cam_data* data) {
|
|||||||
internalData->qrContext = quirc_new();
|
internalData->qrContext = quirc_new();
|
||||||
if(internalData->qrContext != NULL && quirc_resize(internalData->qrContext, data->width, data->height) == 0) {
|
if(internalData->qrContext != NULL && quirc_resize(internalData->qrContext, data->width, data->height) == 0) {
|
||||||
if(R_SUCCEEDED(res = svcCreateEvent(&data->cancelEvent, RESET_STICKY)) && R_SUCCEEDED(res = svcCreateMutex(&data->mutex, false))) {
|
if(R_SUCCEEDED(res = svcCreateEvent(&data->cancelEvent, RESET_STICKY)) && R_SUCCEEDED(res = svcCreateMutex(&data->mutex, false))) {
|
||||||
if(threadCreate(task_capture_cam_thread, internalData, 0x10000, 0x1A, 0, true) == NULL) {
|
if(threadCreate(task_capture_cam_thread, internalData, 0x10000, 0x1A, 1, true) == NULL) {
|
||||||
res = R_FBI_THREAD_CREATE_FAILED;
|
res = R_FBI_THREAD_CREATE_FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,9 +114,7 @@ Result init_services() {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
//static u32 old_time_limit = UINT32_MAX;
|
static u32 old_time_limit = UINT32_MAX;
|
||||||
|
|
||||||
FILE* dbg;
|
|
||||||
|
|
||||||
void init() {
|
void init() {
|
||||||
gfxInitDefault();
|
gfxInitDefault();
|
||||||
@ -140,17 +138,17 @@ void init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*APT_GetAppCpuTimeLimit(&old_time_limit);
|
osSetSpeedupEnable(true);
|
||||||
|
|
||||||
|
APT_GetAppCpuTimeLimit(&old_time_limit);
|
||||||
Result cpuRes = APT_SetAppCpuTimeLimit(30);
|
Result cpuRes = APT_SetAppCpuTimeLimit(30);
|
||||||
if(R_FAILED(cpuRes)) {
|
if(R_FAILED(cpuRes)) {
|
||||||
util_panic("Failed to set syscore CPU time limit: %08lX", cpuRes);
|
util_panic("Failed to set syscore CPU time limit: %08lX", cpuRes);
|
||||||
return;
|
return;
|
||||||
}*/
|
}
|
||||||
|
|
||||||
AM_InitializeExternalTitleDatabase(false);
|
AM_InitializeExternalTitleDatabase(false);
|
||||||
|
|
||||||
dbg = fopen("sdmc:/debug.txt", "wb");
|
|
||||||
|
|
||||||
curl_global_init(CURL_GLOBAL_ALL);
|
curl_global_init(CURL_GLOBAL_ALL);
|
||||||
|
|
||||||
screen_init();
|
screen_init();
|
||||||
@ -160,17 +158,17 @@ void init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void cleanup() {
|
void cleanup() {
|
||||||
fclose(dbg);
|
|
||||||
|
|
||||||
clipboard_clear();
|
clipboard_clear();
|
||||||
|
|
||||||
task_exit();
|
task_exit();
|
||||||
ui_exit();
|
ui_exit();
|
||||||
screen_exit();
|
screen_exit();
|
||||||
|
|
||||||
/*if(old_time_limit != UINT32_MAX) {
|
if(old_time_limit != UINT32_MAX) {
|
||||||
APT_SetAppCpuTimeLimit(old_time_limit);
|
APT_SetAppCpuTimeLimit(old_time_limit);
|
||||||
}*/
|
}
|
||||||
|
|
||||||
|
osSetSpeedupEnable(false);
|
||||||
|
|
||||||
cleanup_services();
|
cleanup_services();
|
||||||
|
|
||||||
@ -179,44 +177,17 @@ void cleanup() {
|
|||||||
gfxExit();
|
gfxExit();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void main_thread(void* arg) {
|
int main(int argc, const char* argv[]) {
|
||||||
|
if(argc > 0 && envIsHomebrew()) {
|
||||||
|
util_set_3dsx_path(argv[0]);
|
||||||
|
}
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
mainmenu_open();
|
mainmenu_open();
|
||||||
while(aptMainLoop() && ui_update());
|
while(aptMainLoop() && ui_update());
|
||||||
|
|
||||||
cleanup();
|
cleanup();
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
|
||||||
if(argc > 0 && envIsHomebrew()) {
|
|
||||||
util_set_3dsx_path(argv[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
osSetSpeedupEnable(true);
|
|
||||||
|
|
||||||
u32 oldTimeLimit = UINT32_MAX;
|
|
||||||
APT_GetAppCpuTimeLimit(&oldTimeLimit);
|
|
||||||
|
|
||||||
Result cpuRes = APT_SetAppCpuTimeLimit(30);
|
|
||||||
if(R_FAILED(cpuRes)) {
|
|
||||||
util_panic("Failed to set syscore CPU time limit: %08lX", cpuRes);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Thread mainThread = threadCreate(main_thread, NULL, 0x10000, 0x18, 1, true);
|
|
||||||
if(mainThread == NULL) {
|
|
||||||
util_panic("Failed to start main thread.");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
threadJoin(mainThread, U64_MAX);
|
|
||||||
|
|
||||||
if(oldTimeLimit != UINT32_MAX) {
|
|
||||||
APT_SetAppCpuTimeLimit(oldTimeLimit);
|
|
||||||
}
|
|
||||||
|
|
||||||
osSetSpeedupEnable(false);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
@ -451,9 +451,13 @@ void action_install_url(const char* confirmMessage, const char* urls, const char
|
|||||||
|
|
||||||
data->installInfo.data = data;
|
data->installInfo.data = data;
|
||||||
|
|
||||||
|
#ifdef USE_CURL
|
||||||
data->installInfo.op = DATAOP_DOWNLOAD;
|
data->installInfo.op = DATAOP_DOWNLOAD;
|
||||||
|
|
||||||
data->installInfo.downloadUrls = data->urls;
|
data->installInfo.downloadUrls = data->urls;
|
||||||
|
#else
|
||||||
|
data->installInfo.op = DATAOP_COPY;
|
||||||
|
#endif
|
||||||
|
|
||||||
data->installInfo.bufferSize = 128 * 1024;
|
data->installInfo.bufferSize = 128 * 1024;
|
||||||
data->installInfo.copyEmpty = false;
|
data->installInfo.copyEmpty = false;
|
||||||
|
@ -151,8 +151,6 @@ static Result task_data_op_copy(data_op_data* data, u32 index) {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern FILE* dbg;
|
|
||||||
|
|
||||||
static Result task_download_execute(const char* url, void* data, size_t write_callback(char* ptr, size_t size, size_t nmemb, void* userdata),
|
static Result task_download_execute(const char* url, void* data, size_t write_callback(char* ptr, size_t size, size_t nmemb, void* userdata),
|
||||||
int progress_callback(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow)) {
|
int progress_callback(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow)) {
|
||||||
Result res = 0;
|
Result res = 0;
|
||||||
@ -175,9 +173,6 @@ static Result task_download_execute(const char* url, void* data, size_t write_ca
|
|||||||
|
|
||||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false); // TODO: Certificates?
|
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false); // TODO: Certificates?
|
||||||
|
|
||||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, true);
|
|
||||||
curl_easy_setopt(curl, CURLOPT_STDERR, dbg);
|
|
||||||
|
|
||||||
CURLcode ret = curl_easy_perform(curl);
|
CURLcode ret = curl_easy_perform(curl);
|
||||||
if(ret == CURLE_OK) {
|
if(ret == CURLE_OK) {
|
||||||
long responseCode;
|
long responseCode;
|
||||||
@ -219,6 +214,7 @@ static size_t task_download_sync_write_callback(char* ptr, size_t size, size_t n
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result task_download_sync(const char* url, u32* downloadedSize, void* buf, size_t size) {
|
Result task_download_sync(const char* url, u32* downloadedSize, void* buf, size_t size) {
|
||||||
|
#ifdef USE_CURL
|
||||||
if(url == NULL || buf == NULL) {
|
if(url == NULL || buf == NULL) {
|
||||||
return R_FBI_INVALID_ARGUMENT;
|
return R_FBI_INVALID_ARGUMENT;
|
||||||
}
|
}
|
||||||
@ -233,6 +229,21 @@ Result task_download_sync(const char* url, u32* downloadedSize, void* buf, size_
|
|||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
#else
|
||||||
|
Result res = 0;
|
||||||
|
|
||||||
|
httpcContext context;
|
||||||
|
if(R_SUCCEEDED(res = util_http_open(&context, url, true))) {
|
||||||
|
res = util_http_read(&context, downloadedSize, buf, size);
|
||||||
|
|
||||||
|
Result closeRes = util_http_close(&context);
|
||||||
|
if(R_SUCCEEDED(res)) {
|
||||||
|
res = closeRes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
Result task_download_json_sync(const char* url, json_t** json, size_t maxSize) {
|
Result task_download_json_sync(const char* url, json_t** json, size_t maxSize) {
|
||||||
@ -548,7 +559,7 @@ Result task_data_op(data_op_data* data) {
|
|||||||
|
|
||||||
Result res = 0;
|
Result res = 0;
|
||||||
if(R_SUCCEEDED(res = svcCreateEvent(&data->cancelEvent, RESET_STICKY))) {
|
if(R_SUCCEEDED(res = svcCreateEvent(&data->cancelEvent, RESET_STICKY))) {
|
||||||
if(threadCreate(task_data_op_thread, data, 0x10000, 0x18, 0, true) == NULL) {
|
if(threadCreate(task_data_op_thread, data, 0x10000, 0x18, 1, true) == NULL) {
|
||||||
res = R_FBI_THREAD_CREATE_FAILED;
|
res = R_FBI_THREAD_CREATE_FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ Result task_populate_ext_save_data(populate_ext_save_data_data* data) {
|
|||||||
|
|
||||||
Result res = 0;
|
Result res = 0;
|
||||||
if(R_SUCCEEDED(res = svcCreateEvent(&data->cancelEvent, RESET_STICKY))) {
|
if(R_SUCCEEDED(res = svcCreateEvent(&data->cancelEvent, RESET_STICKY))) {
|
||||||
if(threadCreate(task_populate_ext_save_data_thread, data, 0x10000, 0x19, 0, true) == NULL) {
|
if(threadCreate(task_populate_ext_save_data_thread, data, 0x10000, 0x19, 1, true) == NULL) {
|
||||||
res = R_FBI_THREAD_CREATE_FAILED;
|
res = R_FBI_THREAD_CREATE_FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -317,7 +317,7 @@ Result task_populate_files(populate_files_data* data) {
|
|||||||
|
|
||||||
Result res = 0;
|
Result res = 0;
|
||||||
if(R_SUCCEEDED(res = svcCreateEvent(&data->cancelEvent, RESET_STICKY))) {
|
if(R_SUCCEEDED(res = svcCreateEvent(&data->cancelEvent, RESET_STICKY))) {
|
||||||
if(threadCreate(task_populate_files_thread, data, 0x10000, 0x19, 0, true) == NULL) {
|
if(threadCreate(task_populate_files_thread, data, 0x10000, 0x19, 1, true) == NULL) {
|
||||||
res = R_FBI_THREAD_CREATE_FAILED;
|
res = R_FBI_THREAD_CREATE_FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,7 @@ Result task_populate_pending_titles(populate_pending_titles_data* data) {
|
|||||||
|
|
||||||
Result res = 0;
|
Result res = 0;
|
||||||
if(R_SUCCEEDED(res = svcCreateEvent(&data->cancelEvent, RESET_STICKY))) {
|
if(R_SUCCEEDED(res = svcCreateEvent(&data->cancelEvent, RESET_STICKY))) {
|
||||||
if(threadCreate(task_populate_pending_titles_thread, data, 0x10000, 0x19, 0, true) == NULL) {
|
if(threadCreate(task_populate_pending_titles_thread, data, 0x10000, 0x19, 1, true) == NULL) {
|
||||||
res = R_FBI_THREAD_CREATE_FAILED;
|
res = R_FBI_THREAD_CREATE_FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ Result task_populate_system_save_data(populate_system_save_data_data* data) {
|
|||||||
|
|
||||||
Result res = 0;
|
Result res = 0;
|
||||||
if(R_SUCCEEDED(res = svcCreateEvent(&data->cancelEvent, RESET_STICKY))) {
|
if(R_SUCCEEDED(res = svcCreateEvent(&data->cancelEvent, RESET_STICKY))) {
|
||||||
if(threadCreate(task_populate_system_save_data_thread, data, 0x10000, 0x19, 0, true) == NULL) {
|
if(threadCreate(task_populate_system_save_data_thread, data, 0x10000, 0x19, 1, true) == NULL) {
|
||||||
res = R_FBI_THREAD_CREATE_FAILED;
|
res = R_FBI_THREAD_CREATE_FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ Result task_populate_tickets(populate_tickets_data* data) {
|
|||||||
|
|
||||||
Result res = 0;
|
Result res = 0;
|
||||||
if(R_SUCCEEDED(res = svcCreateEvent(&data->cancelEvent, RESET_STICKY))) {
|
if(R_SUCCEEDED(res = svcCreateEvent(&data->cancelEvent, RESET_STICKY))) {
|
||||||
if(threadCreate(task_populate_tickets_thread, data, 0x10000, 0x19, 0, true) == NULL) {
|
if(threadCreate(task_populate_tickets_thread, data, 0x10000, 0x19, 1, true) == NULL) {
|
||||||
res = R_FBI_THREAD_CREATE_FAILED;
|
res = R_FBI_THREAD_CREATE_FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -275,7 +275,7 @@ Result task_populate_titledb(populate_titledb_data* data) {
|
|||||||
if(R_SUCCEEDED(res = svcCreateEvent(&data->resumeEvent, RESET_STICKY))) {
|
if(R_SUCCEEDED(res = svcCreateEvent(&data->resumeEvent, RESET_STICKY))) {
|
||||||
svcSignalEvent(data->resumeEvent);
|
svcSignalEvent(data->resumeEvent);
|
||||||
|
|
||||||
if(threadCreate(task_populate_titledb_thread, data, 0x10000, 0x19, 0, true) == NULL) {
|
if(threadCreate(task_populate_titledb_thread, data, 0x10000, 0x19, 1, true) == NULL) {
|
||||||
res = R_FBI_THREAD_CREATE_FAILED;
|
res = R_FBI_THREAD_CREATE_FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -338,7 +338,7 @@ Result task_populate_titles(populate_titles_data* data) {
|
|||||||
|
|
||||||
Result res = 0;
|
Result res = 0;
|
||||||
if(R_SUCCEEDED(res = svcCreateEvent(&data->cancelEvent, RESET_STICKY))) {
|
if(R_SUCCEEDED(res = svcCreateEvent(&data->cancelEvent, RESET_STICKY))) {
|
||||||
if(threadCreate(task_populate_titles_thread, data, 0x10000, 0x19, 0, true) == NULL) {
|
if(threadCreate(task_populate_titles_thread, data, 0x10000, 0x19, 1, true) == NULL) {
|
||||||
res = R_FBI_THREAD_CREATE_FAILED;
|
res = R_FBI_THREAD_CREATE_FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user