diff --git a/source/core/data/smdh.c b/source/core/data/smdh.c index 7a2ea9b..e73e5f8 100644 --- a/source/core/data/smdh.c +++ b/source/core/data/smdh.c @@ -10,12 +10,12 @@ static const char* smdh_region_strings[SMDH_NUM_REGIONS] = { "日本", - "北美洲", - "歐洲", - "澳大利亞", - "中國", - "韓國", - "中國臺灣" + "美国", + "欧洲", + "澳大利亚", + "中国", + "韩国", + "台湾" }; void smdh_region_to_string(char* out, u32 region, size_t size) { @@ -26,7 +26,7 @@ void smdh_region_to_string(char* out, u32 region, size_t size) { if(region == 0) { snprintf(out, size, "未知"); } else if((region & SMDH_ALL_REGIONS) == SMDH_ALL_REGIONS) { - snprintf(out, size, "全區"); + snprintf(out, size, "无"); } else { size_t pos = 0; @@ -71,5 +71,3 @@ SMDH_title* smdh_select_title(SMDH* smdh) { return &smdh->titles[systemLanguage]; } - -// オケー \ No newline at end of file diff --git a/source/core/error.c b/source/core/error.c index fd21b76..58a9de7 100644 --- a/source/core/error.c +++ b/source/core/error.c @@ -71,8 +71,8 @@ void error_panic(const char* s, ...) { PrintConsole* console = consoleInit(GFX_TOP, NULL); - const char* header = "FBI has encountered a fatal error!"; - const char* footer = "Press any button to exit."; + const char* header = "FBI 遇到致命错误!"; + const char* footer = "按任意键退出."; printf("\x1b[0;0H"); for(int i = 0; i < console->consoleWidth; i++) { diff --git a/source/core/screen.c b/source/core/screen.c index c159433..fa0c577 100644 --- a/source/core/screen.c +++ b/source/core/screen.c @@ -41,7 +41,7 @@ static struct { static void screen_set_blend(u32 color, bool rgb, bool alpha) { C3D_TexEnv* env = C3D_GetTexEnv(0); if(env == NULL) { - error_panic("Failed to retrieve combiner settings."); + error_panic("无法检索组合器设置."); return; } @@ -68,7 +68,7 @@ static void screen_set_blend(u32 color, bool rgb, bool alpha) { void screen_init() { if(!C3D_Init(C3D_DEFAULT_CMDBUF_SIZE * 4)) { - error_panic("Failed to initialize the GPU."); + error_panic("无法初始化 GPU."); return; } @@ -78,7 +78,7 @@ void screen_init() { target_top = C3D_RenderTargetCreate(TOP_SCREEN_HEIGHT, TOP_SCREEN_WIDTH, GPU_RB_RGB8, 0); if(target_top == NULL) { - error_panic("Failed to initialize the top screen target."); + error_panic("无法初始化上屏."); return; } @@ -86,7 +86,7 @@ void screen_init() { target_bottom = C3D_RenderTargetCreate(BOTTOM_SCREEN_HEIGHT, BOTTOM_SCREEN_WIDTH, GPU_RB_RGB8, 0); if(target_bottom == NULL) { - error_panic("Failed to initialize the bottom screen target."); + error_panic("无法初始化下屏."); return; } @@ -97,13 +97,13 @@ void screen_init() { dvlb = DVLB_ParseFile((u32*) default_shbin, default_shbin_len); if(dvlb == NULL) { - error_panic("Failed to parse shader."); + error_panic("无法解析着色器."); return; } Result progInitRes = shaderProgramInit(&program); if(R_FAILED(progInitRes)) { - error_panic("Failed to initialize shader program: 0x%08lX", progInitRes); + error_panic("无法初始化着色器: 0x%08lX", progInitRes); return; } @@ -111,7 +111,7 @@ void screen_init() { Result progSetVshRes = shaderProgramSetVsh(&program, &dvlb->DVLE[0]); if(R_FAILED(progSetVshRes)) { - error_panic("Failed to set up vertex shader: 0x%08lX", progInitRes); + error_panic("无法设置顶点着色器: 0x%08lX", progInitRes); return; } @@ -119,7 +119,7 @@ void screen_init() { C3D_AttrInfo* attrInfo = C3D_GetAttrInfo(); if(attrInfo == NULL) { - error_panic("Failed to retrieve attribute info."); + error_panic("无法检索属性信息."); return; } @@ -133,7 +133,7 @@ void screen_init() { Result fontMapRes = fontEnsureMapped(); if(R_FAILED(fontMapRes)) { - error_panic("Failed to map system font: 0x%08lX", fontMapRes); + error_panic("无法映射系统字体: 0x%08lX", fontMapRes); return; } @@ -142,7 +142,7 @@ void screen_init() { glyph_count = glyphInfo->nSheets; glyph_sheets = calloc(glyph_count, sizeof(C3D_Tex)); if(glyph_sheets == NULL) { - error_panic("Failed to allocate font glyph texture data."); + error_panic("无法分配字形纹理的数据."); return; } @@ -201,7 +201,7 @@ void screen_set_base_alpha(u8 alpha) { void screen_set_color(u32 id, u32 color) { if(id >= MAX_COLORS) { - error_panic("Attempted to draw string with invalid color ID \"%lu\".", id); + error_panic("尝试绘制具有无效颜色 ID \"%lu\" 的字符串.", id); return; } @@ -232,7 +232,7 @@ u32 screen_allocate_free_texture() { } if(id == 0) { - error_panic("Out of free textures."); + error_panic("超出空闲纹理."); return 0; } @@ -241,7 +241,7 @@ u32 screen_allocate_free_texture() { static void screen_prepare_texture(u32* pow2WidthOut, u32* pow2HeightOut, u32 id, u32 width, u32 height, GPU_TEXCOLOR format, bool linearFilter) { if(id >= MAX_TEXTURES) { - error_panic("Attempted to prepare invalid texture ID \"%lu\".", id); + error_panic("尝试准备无效的纹理 ID \"%lu\".", id); return; } @@ -261,7 +261,7 @@ static void screen_prepare_texture(u32* pow2WidthOut, u32* pow2HeightOut, u32 id } if(textures[id].tex.data == NULL && !C3D_TexInit(&textures[id].tex, (u16) pow2Width, (u16) pow2Height, format)) { - error_panic("Failed to initialize texture with ID \"%lu\".", id); + error_panic("无法初始化具有 ID \"%lu\" 的纹理.", id); return; } @@ -324,13 +324,13 @@ void screen_load_texture_untiled(u32 id, void* data, u32 size, u32 width, u32 he void screen_load_texture_path(u32 id, const char* path, bool linearFilter) { if(id >= MAX_TEXTURES) { - error_panic("Attempted to load path \"%s\" to invalid texture ID \"%lu\".", path, id); + error_panic("尝试加载路径 \"%s\" 到无效的纹理 ID \"%lu\".", path, id); return; } FILE* fd = fopen(path, "rb"); if(fd == NULL) { - error_panic("Failed to load PNG file \"%s\": %s", path, strerror(errno)); + error_panic("无法加载 PNG 文件 \"%s\": %s", path, strerror(errno)); return; } @@ -341,7 +341,7 @@ void screen_load_texture_path(u32 id, const char* path, bool linearFilter) { void screen_load_texture_file(u32 id, FILE* fd, bool linearFilter) { if(id >= MAX_TEXTURES) { - error_panic("Attempted to load file to invalid texture ID \"%lu\".", id); + error_panic("尝试加载文件到无效的纹理 ID \"%lu\".", id); return; } @@ -351,7 +351,7 @@ void screen_load_texture_file(u32 id, FILE* fd, bool linearFilter) { u8* image = stbi_load_from_file(fd, &width, &height, &depth, STBI_rgb_alpha); if(image == NULL) { - error_panic("Failed to load PNG file to texture ID \"%lu\".", id); + error_panic("尝试加载 PNG 文件到纹理 ID \"%lu\".", id); return; } @@ -378,7 +378,7 @@ void screen_load_texture_file(u32 id, FILE* fd, bool linearFilter) { void screen_unload_texture(u32 id) { if(id >= MAX_TEXTURES) { - error_panic("Attempted to unload invalid texture ID \"%lu\".", id); + error_panic("尝试卸载无效的纹理 ID \"%lu\".", id); return; } @@ -392,7 +392,7 @@ void screen_unload_texture(u32 id) { void screen_get_texture_size(u32* width, u32* height, u32 id) { if(id >= MAX_TEXTURES) { - error_panic("Attempted to get size of invalid texture ID \"%lu\".", id); + error_panic("尝试获取无效的纹理 ID \"%lu\" 的大小.", id); return; } @@ -407,7 +407,7 @@ void screen_get_texture_size(u32* width, u32* height, u32 id) { void screen_begin_frame() { if(!C3D_FrameBegin(C3D_FRAME_SYNCDRAW)) { - error_panic("Failed to begin frame."); + error_panic("无法启动相框."); return; } } @@ -421,7 +421,7 @@ void screen_select(gfxScreen_t screen) { C3D_RenderTargetClear(target, C3D_CLEAR_ALL, 0, 0); if(!C3D_FrameDrawOn(target)) { - error_panic("Failed to select render target."); + error_panic("无法选择渲染目标."); return; } @@ -448,7 +448,7 @@ static void screen_draw_quad(float x1, float y1, float x2, float y2, float left, void screen_draw_texture(u32 id, float x, float y, float width, float height) { if(id >= MAX_TEXTURES) { - error_panic("Attempted to draw invalid texture ID \"%lu\".", id); + error_panic("尝试绘制无效的纹理 ID \"%lu\".", id); return; } @@ -470,7 +470,7 @@ void screen_draw_texture(u32 id, float x, float y, float width, float height) { void screen_draw_texture_crop(u32 id, float x, float y, float width, float height) { if(id >= MAX_TEXTURES) { - error_panic("Attempted to draw invalid texture ID \"%lu\".", id); + error_panic("尝试绘制无效的纹理 ID \"%lu\".", id); return; } @@ -639,7 +639,7 @@ static void screen_draw_string_internal(const char* text, float x, float y, floa } if(colorId >= MAX_COLORS) { - error_panic("Attempted to draw string with invalid color ID \"%lu\".", colorId); + error_panic("尝试绘制具有无效颜色 ID \"%lu\" 的字符串.", colorId); return; } diff --git a/source/core/task/dataop.c b/source/core/task/dataop.c index fc04e0e..f6c62ab 100644 --- a/source/core/task/dataop.c +++ b/source/core/task/dataop.c @@ -267,7 +267,7 @@ static void task_data_op_thread(void* arg) { if(R_FAILED(res)) { if(res == R_APP_CANCELLED) { - prompt_display_notify("失敗", "操作被取消", COLOR_TEXT, NULL, NULL, NULL); + prompt_display_notify("失败", "已取消.", COLOR_TEXT, NULL, NULL, NULL); break; } else if(res != R_APP_SKIPPED) { ui_view* errorView = NULL; @@ -277,7 +277,7 @@ static void task_data_op_thread(void* arg) { svcWaitSynchronization(errorView->active, U64_MAX); } - ui_view* retryView = prompt_display_yes_no("確認", "即將重試,是否繼續?", COLOR_TEXT, data, NULL, task_data_op_retry_onresponse); + ui_view* retryView = prompt_display_yes_no("确认", "重试?", COLOR_TEXT, data, NULL, task_data_op_retry_onresponse); if(retryView != NULL) { svcWaitSynchronization(retryView->active, U64_MAX); diff --git a/source/core/task/task.c b/source/core/task/task.c index 6b0fe5a..35fa855 100644 --- a/source/core/task/task.c +++ b/source/core/task/task.c @@ -33,14 +33,14 @@ void task_init() { Result res = 0; if(R_FAILED(res = svcCreateEvent(&task_pause_event, RESET_STICKY))) { - error_panic("Failed to create task pause event: 0x%08lX", res); + error_panic("无法创建任务暂停事件: 0x%08lX", res); return; } if(R_FAILED(res = svcCreateEvent(&task_suspend_event, RESET_STICKY))) { svcCloseHandle(task_pause_event); - error_panic("Failed to create task suspend event: 0x%08lX", res); + error_panic("无法创建任务挂起事件: 0x%08lX", res); return; } diff --git a/source/core/ui/error.c b/source/core/ui/error.c index b09d465..77c6404 100644 --- a/source/core/ui/error.c +++ b/source/core/ui/error.c @@ -730,7 +730,7 @@ ui_view* error_display(void* data, void (*drawTop)(ui_view* view, void* data, fl vsnprintf(errorData->fullText, 4096, text, list); va_end(list); - return prompt_display_notify("Error", errorData->fullText, COLOR_TEXT, errorData, error_draw_top, error_onresponse); + return prompt_display_notify("错误", errorData->fullText, COLOR_TEXT, errorData, error_draw_top, error_onresponse); } ui_view* 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, ...) { @@ -754,9 +754,9 @@ ui_view* error_display_res(void* data, void (*drawTop)(ui_view* view, void* data 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); + snprintf(errorData->fullText, 4096, "%s\n错误代码: 0x%08lX\n等级: %s (%d)\n摘要: %s (%d)\n模组: %s (%d)\n描述: %s (%d)", textBuf, result, level_to_string(result), level, summary_to_string(result), summary, module_to_string(result), module, description_to_string(result), description); - return prompt_display_notify("Error", errorData->fullText, COLOR_TEXT, errorData, error_draw_top, error_onresponse); + return prompt_display_notify("错误", errorData->fullText, COLOR_TEXT, errorData, error_draw_top, error_onresponse); } ui_view* error_display_errno(void* data, void (*drawTop)(ui_view* view, void* data, float x1, float y1, float x2, float y2), int err, const char* text, ...) { @@ -781,5 +781,5 @@ ui_view* error_display_errno(void* data, void (*drawTop)(ui_view* view, void* da snprintf(errorData->fullText, 4096, "%s\nI/O Error: %s (%d)", textBuf, strerror(err), err); - return prompt_display_notify("Error", errorData->fullText, COLOR_TEXT, errorData, error_draw_top, error_onresponse); -} \ No newline at end of file + return prompt_display_notify("错误", errorData->fullText, COLOR_TEXT, errorData, error_draw_top, error_onresponse); +} diff --git a/source/core/ui/info.c b/source/core/ui/info.c index 48b350f..8b2f7d2 100644 --- a/source/core/ui/info.c +++ b/source/core/ui/info.c @@ -72,7 +72,7 @@ ui_view* info_display(const char* name, const char* info, bool bar, void* data, void (*drawTop)(ui_view* view, void* data, float x1, float y1, float x2, float y2)) { info_data* infoData = (info_data*) calloc(1, sizeof(info_data)); if(infoData == NULL) { - error_display(NULL, NULL, "Failed to allocate info data."); + error_display(NULL, NULL, "无法分配信息的数据."); return NULL; } @@ -80,7 +80,7 @@ ui_view* info_display(const char* name, const char* info, bool bar, void* data, infoData->bar = bar; infoData->data = data; infoData->progress = 0; - snprintf(infoData->text, PROGRESS_TEXT_MAX, "Please wait..."); + snprintf(infoData->text, PROGRESS_TEXT_MAX, "请稍等..."); infoData->update = update; infoData->drawTop = drawTop; diff --git a/source/core/ui/kbd.c b/source/core/ui/kbd.c index daff87b..9288e00 100644 --- a/source/core/ui/kbd.c +++ b/source/core/ui/kbd.c @@ -45,7 +45,7 @@ static void kbd_update(ui_view* view, void* data, float bx1, float by1, float bx ui_view* kbd_display(const char* hint, const char* initialText, SwkbdType type, u32 features, SwkbdValidInput validation, u32 maxSize, void* data, void (*onResponse)(ui_view* view, void* data, SwkbdButton button, const char* response)) { kbd_data* kbdData = (kbd_data*) calloc(1, sizeof(kbd_data)); if(kbdData == NULL) { - error_display(NULL, NULL, "Failed to allocate keyboard data."); + error_display(NULL, NULL, "无法分配键盘的数据."); return NULL; } @@ -59,7 +59,7 @@ ui_view* kbd_display(const char* hint, const char* initialText, SwkbdType type, kbdData->response = (char*) calloc(1, maxSize); if(kbdData->response == NULL) { - error_display(NULL, NULL, "Failed to allocate keyboard response buffer."); + error_display(NULL, NULL, "无法分配键盘响应的缓存."); free(kbdData); return NULL; diff --git a/source/core/ui/list.c b/source/core/ui/list.c index d98c62d..695222c 100644 --- a/source/core/ui/list.c +++ b/source/core/ui/list.c @@ -268,7 +268,7 @@ ui_view* list_display(const char* name, const char* info, void* data, void (*upd void (*drawTop)(ui_view* view, void* data, float x1, float y1, float x2, float y2, list_item* selected)) { list_data* listData = (list_data*) calloc(1, sizeof(list_data)); if(listData == NULL) { - error_display(NULL, NULL, "Failed to allocate list data."); + error_display(NULL, NULL, "无法分配列表的数据."); return NULL; } diff --git a/source/core/ui/prompt.c b/source/core/ui/prompt.c index e0ffd54..c7d533e 100644 --- a/source/core/ui/prompt.c +++ b/source/core/ui/prompt.c @@ -75,12 +75,12 @@ static void prompt_draw_top(ui_view* view, void* data, float x1, float y1, float static const char* button_strings[32] = { "A", "B", - "Select", - "Start", - "十字鍵 右", - "十字鍵 左", - "十字鍵 上", - "十字鍵 下", + "SELECT", + "START", + "方向键 右", + "方向键 左", + "方向键 上", + "方向键 下", "R", "L", "X", @@ -97,19 +97,19 @@ static const char* button_strings[32] = { "", "", "", - "C搖桿 右", - "C搖桿 左", - "C搖桿 上", - "C搖桿 下", - "搖桿 右", - "搖桿 左", - "搖桿 上", - "搖桿 下" + "C 摇杆 右", + "C 摇杆 左", + "C 摇杆 上", + "C 摇杆 下", + "摇杆 右", + "摇杆 左", + "摇杆 上", + "摇杆 下" }; static void prompt_button_to_string(char* out, size_t size, u32 button) { if(button == PROMPT_BUTTON_ANY) { - snprintf(out, size, "任意鍵"); + snprintf(out, size, "任意键"); return; } @@ -158,7 +158,7 @@ ui_view* prompt_display_multi_choice(const char* name, const char* text, u32 col void (*onResponse)(ui_view* view, void* data, u32 response)) { prompt_data* promptData = (prompt_data*) calloc(1, sizeof(prompt_data)); if(promptData == NULL) { - error_display(NULL, NULL, "無法分配提示數據"); + error_display(NULL, NULL, "无法分配提示的数据."); return NULL; } @@ -190,7 +190,7 @@ ui_view* prompt_display_multi_choice(const char* name, const char* text, u32 col ui_view* prompt_display_notify(const char* name, const char* text, u32 color, void* data, void (*drawTop)(ui_view* view, void* data, float x1, float y1, float x2, float y2), void (*onResponse)(ui_view* view, void* data, u32 response)) { - static const char* options[1] = {"OK"}; + static const char* options[1] = {"好"}; static u32 optionButtons[1] = {PROMPT_BUTTON_ANY}; return prompt_display_multi_choice(name, text, color, options, optionButtons, 1, data, drawTop, onResponse); } @@ -201,5 +201,3 @@ ui_view* prompt_display_yes_no(const char* name, const char* text, u32 color, vo static u32 optionButtons[2] = {KEY_A, KEY_B}; return prompt_display_multi_choice(name, text, color, options, optionButtons, 2, data, drawTop, onResponse); } - -// オケー \ No newline at end of file diff --git a/source/core/ui/ui.c b/source/core/ui/ui.c index c5c585f..3e9b4ba 100644 --- a/source/core/ui/ui.c +++ b/source/core/ui/ui.c @@ -42,13 +42,13 @@ void ui_exit() { ui_view* ui_create() { ui_view* view = (ui_view*) calloc(1, sizeof(ui_view)); if(view == NULL) { - error_panic("Failed to allocate UI view."); + error_panic("无法分配 UI 的视图."); return NULL; } Result res = 0; if(R_FAILED(res = svcCreateEvent(&view->active, RESET_STICKY))) { - error_panic("Failed to create view active event: 0x%08lX", res); + error_panic("无法创建视图活动事件: 0x%08lX", res); free(view); return NULL; @@ -212,7 +212,7 @@ static void ui_draw_top(ui_view* ui) { } u64 size = (u64) resource.freeClusters * (u64) resource.clusterSize; - snprintf(currBuffer, sizeof(ui_free_space_buffer) - (currBuffer - ui_free_space_buffer), "SD: %.1f %s", + snprintf(currBuffer, sizeof(ui_free_space_buffer) - (currBuffer - ui_free_space_buffer), "SD 卡: %.1f %s", ui_get_display_size(size), ui_get_display_size_units(size)); currBuffer += strlen(currBuffer); } @@ -248,7 +248,7 @@ static void ui_draw_top(ui_view* ui) { } u64 size = (u64) resource.freeClusters * (u64) resource.clusterSize; - snprintf(currBuffer, sizeof(ui_free_space_buffer) - (currBuffer - ui_free_space_buffer), "TWL Photo: %.1f %s", + snprintf(currBuffer, sizeof(ui_free_space_buffer) - (currBuffer - ui_free_space_buffer), "TWL 照片: %.1f %s", ui_get_display_size(size), ui_get_display_size_units(size)); currBuffer += strlen(currBuffer); } @@ -411,5 +411,5 @@ const char* ui_get_display_size_units(u64 size) { return "KiB"; } - return "Byte"; + return "B"; } \ No newline at end of file