Allow configuring text colors, delete titles/tickets before installing over them.

This commit is contained in:
Steven Smith 2016-04-12 11:34:51 -07:00
parent 1eac6c70dd
commit ce821c74f0
37 changed files with 273 additions and 160 deletions

6
romfs/textcolor.cfg Normal file
View File

@ -0,0 +1,6 @@
text=FF000000
nand=FF0000FF
sd=FF00FF00
gamecard=FFFF0000
dstitle=FF82004B
directory=FF0000FF

View File

@ -1,5 +1,7 @@
#include <errno.h>
#include <malloc.h>
#include <stdio.h>
#include <stdlib.h>
#include <3ds.h>
#include <citro3d.h>
@ -26,6 +28,8 @@ GX_TRANSFER_FORMAT gpuToGxFormat[13] = {
GX_TRANSFER_FMT_RGBA8 // Unsupported
};
static u32 colorConfig[NUM_COLORS];
static bool c3dInitialized;
static bool shaderInitialized;
@ -141,6 +145,45 @@ void screen_init() {
tex->param = GPU_TEXTURE_MAG_FILTER(GPU_LINEAR) | GPU_TEXTURE_MIN_FILTER(GPU_LINEAR) | GPU_TEXTURE_WRAP_S(GPU_CLAMP_TO_EDGE) | GPU_TEXTURE_WRAP_T(GPU_CLAMP_TO_EDGE);
}
FILE* fd = util_open_resource("textcolor.cfg");
if(fd == NULL) {
util_panic("Failed to open text color config: %s\n", strerror(errno));
return;
}
char line[128];
while(fgets(line, sizeof(line), fd) != NULL) {
char* newline = strchr(line, '\n');
if(newline != NULL) {
*newline = '\0';
}
char* equals = strchr(line, '=');
if(equals != NULL) {
char key[64] = {'\0'};
char value[64] = {'\0'};
strncpy(key, line, equals - line);
strncpy(value, equals + 1, strlen(equals) - 1);
u32 color = strtoul(value, NULL, 16);
if(strcasecmp(key, "text") == 0) {
colorConfig[COLOR_TEXT] = color;
} else if(strcasecmp(key, "nand") == 0) {
colorConfig[COLOR_NAND] = color;
} else if(strcasecmp(key, "sd") == 0) {
colorConfig[COLOR_SD] = color;
} else if(strcasecmp(key, "gamecard") == 0) {
colorConfig[COLOR_GAME_CARD] = color;
} else if(strcasecmp(key, "dstitle") == 0) {
colorConfig[COLOR_DS_TITLE] = color;
} else if(strcasecmp(key, "directory") == 0) {
colorConfig[COLOR_DIRECTORY] = color;
}
}
}
screen_load_texture_file(TEXTURE_BOTTOM_SCREEN_BG, "bottom_screen_bg.png", true);
screen_load_texture_file(TEXTURE_BOTTOM_SCREEN_TOP_BAR, "bottom_screen_top_bar.png", true);
screen_load_texture_file(TEXTURE_BOTTOM_SCREEN_TOP_BAR_SHADOW, "bottom_screen_top_bar_shadow.png", true);
@ -300,22 +343,18 @@ void screen_load_texture_file(u32 id, const char* path, bool linearFilter) {
return;
}
u32 realPathSize = strlen(path) + 16;
char realPath[realPathSize];
snprintf(realPath, realPathSize, "sdmc:/fbitheme/%s", path);
FILE* fd = fopen(realPath, "rb");
if(fd != NULL) {
fclose(fd);
} else {
snprintf(realPath, realPathSize, "romfs:/%s", path);
FILE* fd = util_open_resource(path);
if(fd == NULL) {
util_panic("Failed to load PNG file \"%s\": %s", strerror(errno));
return;
}
int width;
int height;
int depth;
u8* image = stbi_load(realPath, &width, &height, &depth, STBI_rgb_alpha);
u8* image = stbi_load_from_file(fd, &width, &height, &depth, STBI_rgb_alpha);
if(image == NULL || depth != STBI_rgb_alpha) {
util_panic("Failed to load PNG file \"%s\".", realPath);
util_panic("Failed to load PNG file \"%s\".", path);
return;
}
@ -540,7 +579,7 @@ void screen_get_string_size(float* width, float* height, const char* text, float
screen_get_string_size_internal(width, height, text, scaleX, scaleY, false);
}
void screen_draw_string(const char* text, float x, float y, float scaleX, float scaleY, u32 rgba, bool baseline) {
void screen_draw_string(const char* text, float x, float y, float scaleX, float scaleY, u32 colorId, bool baseline) {
C3D_TexEnv* env = C3D_GetTexEnv(0);
if(env == NULL) {
util_panic("Failed to retrieve combiner settings.");
@ -552,7 +591,7 @@ void screen_draw_string(const char* text, float x, float y, float scaleX, float
C3D_TexEnvOp(env, C3D_Both, 0, 0, 0);
C3D_TexEnvFunc(env, C3D_RGB, GPU_REPLACE);
C3D_TexEnvFunc(env, C3D_Alpha, GPU_MODULATE);
C3D_TexEnvColor(env, rgba);
C3D_TexEnvColor(env, colorConfig[colorId]);
float stringWidth;
screen_get_string_size_internal(&stringWidth, NULL, text, scaleX, scaleY, false);

View File

@ -40,6 +40,22 @@
#define TEXTURE_WIFI_3 29
#define TEXTURE_AUTO_START 30
#define COLOR_TEXT 0
#define COLOR_NAND 1
#define COLOR_SD 2
#define COLOR_GAME_CARD 3
#define COLOR_DS_TITLE 4
#define COLOR_DIRECTORY 5
#define NUM_COLORS 6
/*#define COLOR_TEXT 0xFF000000
#define COLOR_NAND 0xFF0000FF
#define COLOR_SD 0xFF00FF00
#define COLOR_GAME_CARD 0xFFFF0000
#define COLOR_DS_TITLE 0xFF82004B
#define COLOR_DIRECTORY 0xFF0000FF */
void screen_init();
void screen_exit();
void screen_load_texture(u32 id, void* data, u32 size, u32 width, u32 height, GPU_TEXCOLOR format, bool linearFilter);
@ -56,4 +72,4 @@ void screen_select(gfxScreen_t screen);
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);
void screen_get_string_size(float* width, float* height, const char* text, float scaleX, float scaleY);
void screen_draw_string(const char* text, float x, float y, float scaleX, float scaleY, u32 rgba, bool baseline);
void screen_draw_string(const char* text, float x, float y, float scaleX, float scaleY, u32 colorId, bool baseline);

View File

@ -7,6 +7,7 @@
#include "error.h"
#include "prompt.h"
#include "../screen.h"
typedef struct {
char fullText[4096];
@ -568,7 +569,7 @@ void error_display(void* data, void (*drawTop)(ui_view* view, void* data, float
vsnprintf(errorData->fullText, 4096, text, list);
va_end(list);
ui_push(prompt_create("Error", errorData->fullText, 0xFF000000, false, errorData, NULL, error_draw_top, error_onresponse));
ui_push(prompt_create("Error", errorData->fullText, COLOR_TEXT, false, errorData, NULL, error_draw_top, error_onresponse));
}
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, ...) {
@ -588,7 +589,7 @@ void error_display_res(void* data, void (*drawTop)(ui_view* view, void* data, fl
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, 0xFF000000, false, errorData, NULL, error_draw_top, error_onresponse));
ui_push(prompt_create("Error", errorData->fullText, COLOR_TEXT, false, errorData, NULL, error_draw_top, error_onresponse));
}
void 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, ...) {
@ -604,5 +605,5 @@ void error_display_errno(void* data, void (*drawTop)(ui_view* view, void* data,
snprintf(errorData->fullText, 4096, "%s\nError: %s (%d)", textBuf, strerror(err), err);
ui_push(prompt_create("Error", errorData->fullText, 0xFF000000, false, errorData, NULL, error_draw_top, error_onresponse));
ui_push(prompt_create("Error", errorData->fullText, COLOR_TEXT, false, errorData, NULL, error_draw_top, error_onresponse));
}

View File

@ -12,19 +12,19 @@
static u32 mainmenu_item_count = MAINMENU_ITEM_COUNT;
static list_item mainmenu_items[MAINMENU_ITEM_COUNT] = {
{"SD", 0xFF000000, files_open_sd},
{"CTR NAND", 0xFF000000, files_open_ctr_nand},
{"TWL NAND", 0xFF000000, files_open_twl_nand},
{"TWL Photo", 0xFF000000, files_open_twl_photo},
{"TWL Sound", 0xFF000000, files_open_twl_sound},
{"Dump NAND", 0xFF000000, dump_nand},
{"Titles", 0xFF000000, titles_open},
{"Pending Titles", 0xFF000000, pendingtitles_open},
{"Tickets", 0xFF000000, tickets_open},
{"Ext Save Data", 0xFF000000, extsavedata_open},
{"System Save Data", 0xFF000000, systemsavedata_open},
{"Network Install to SD", 0xFF000000, networkinstall_open_sd},
{"Network Install to NAND", 0xFF000000, networkinstall_open_nand},
{"SD", COLOR_TEXT, files_open_sd},
{"CTR NAND", COLOR_TEXT, files_open_ctr_nand},
{"TWL NAND", COLOR_TEXT, files_open_twl_nand},
{"TWL Photo", COLOR_TEXT, files_open_twl_photo},
{"TWL Sound", COLOR_TEXT, files_open_twl_sound},
{"Dump NAND", COLOR_TEXT, dump_nand},
{"Titles", COLOR_TEXT, titles_open},
{"Pending Titles", COLOR_TEXT, pendingtitles_open},
{"Tickets", COLOR_TEXT, tickets_open},
{"Ext Save Data", COLOR_TEXT, extsavedata_open},
{"System Save Data", COLOR_TEXT, systemsavedata_open},
{"Network Install to SD", COLOR_TEXT, networkinstall_open_sd},
{"Network Install to NAND", COLOR_TEXT, networkinstall_open_nand},
};
static void mainmenu_draw_top(ui_view* view, void* data, float x1, float y1, float x2, float y2, list_item* selected) {
@ -45,7 +45,7 @@ static void mainmenu_draw_top(ui_view* view, void* data, float x1, float y1, flo
float verX = x1 + (x2 - x1 - verWidth) / 2;
float verY = logoY + logoHeight + (y2 - (logoY + logoHeight) - verHeight) / 2;
screen_draw_string(verString, verX, verY, 0.5f, 0.5f, 0xFF000000, false);
screen_draw_string(verString, verX, verY, 0.5f, 0.5f, COLOR_TEXT, false);
}
static void mainmenu_update(ui_view* view, void* data, list_item** items, u32** itemCount, list_item* selected, bool selectedTouched) {

View File

@ -54,7 +54,7 @@ static void progressbar_draw_bottom(ui_view* view, void* data, float x1, float y
float progressTextX = x1 + (x2 - x1 - progressTextWidth) / 2;
float progressTextY = progressBarBgY + progressBarBgHeight + 10;
screen_draw_string(progressBarData->progressText, progressTextX, progressTextY, 0.5f, 0.5f, 0xFF000000, false);
screen_draw_string(progressBarData->progressText, progressTextX, progressTextY, 0.5f, 0.5f, COLOR_TEXT, false);
}
ui_view* progressbar_create(const char* name, const char* info, void* data, void (*update)(ui_view* view, void* data, float* progress, char* progressText),

View File

@ -4,6 +4,7 @@
#include "clipboard.h"
#include "../../error.h"
#include "../../prompt.h"
#include "../../../screen.h"
static void action_copy_files_success_onresponse(ui_view* view, void* data, bool response) {
prompt_destroy(view);
@ -17,5 +18,5 @@ void action_copy_contents(file_info* info, bool* populated) {
return;
}
ui_push(prompt_create("Success", "Content copied to clipboard.", 0xFF000000, false, info, NULL, ui_draw_file_info, action_copy_files_success_onresponse));
ui_push(prompt_create("Success", "Content copied to clipboard.", COLOR_TEXT, false, info, NULL, ui_draw_file_info, action_copy_files_success_onresponse));
}

View File

@ -4,6 +4,7 @@
#include "../../error.h"
#include "../../progressbar.h"
#include "../../prompt.h"
#include "../../../screen.h"
static void action_delete_all_pending_titles_success_onresponse(ui_view* view, void* data, bool response) {
prompt_destroy(view);
@ -29,7 +30,7 @@ static void action_delete_all_pending_titles_update(ui_view* view, void* data, f
progressbar_destroy(view);
ui_pop();
ui_push(prompt_create("Success", "Pending titles deleted.", 0xFF000000, false, NULL, NULL, NULL, action_delete_all_pending_titles_success_onresponse));
ui_push(prompt_create("Success", "Pending titles deleted.", COLOR_TEXT, false, NULL, NULL, NULL, action_delete_all_pending_titles_success_onresponse));
}
static void action_delete_all_pending_titles_onresponse(ui_view* view, void* data, bool response) {
@ -41,5 +42,5 @@ static void action_delete_all_pending_titles_onresponse(ui_view* view, void* dat
}
void action_delete_all_pending_titles(pending_title_info* info, bool* populated) {
ui_push(prompt_create("Confirmation", "Delete all pending titles?", 0xFF000000, true, populated, NULL, NULL, action_delete_all_pending_titles_onresponse));
ui_push(prompt_create("Confirmation", "Delete all pending titles?", COLOR_TEXT, true, populated, NULL, NULL, action_delete_all_pending_titles_onresponse));
}

View File

@ -8,6 +8,7 @@
#include "../../error.h"
#include "../../progressbar.h"
#include "../../prompt.h"
#include "../../../screen.h"
#include "../../../util.h"
typedef struct {
@ -40,7 +41,7 @@ static void action_delete_dir_contents_update(ui_view* view, void* data, float*
progressbar_destroy(view);
ui_pop();
ui_push(prompt_create("Failure", "Delete cancelled.", 0xFF000000, false, data, NULL, action_delete_dir_contents_draw_top, action_delete_dir_contents_done_onresponse));
ui_push(prompt_create("Failure", "Delete cancelled.", COLOR_TEXT, false, data, NULL, action_delete_dir_contents_draw_top, action_delete_dir_contents_done_onresponse));
return;
}
@ -48,7 +49,7 @@ static void action_delete_dir_contents_update(ui_view* view, void* data, float*
progressbar_destroy(view);
ui_pop();
ui_push(prompt_create("Success", "Contents deleted.", 0xFF000000, false, data, NULL, action_delete_dir_contents_draw_top, action_delete_dir_contents_done_onresponse));
ui_push(prompt_create("Success", "Contents deleted.", COLOR_TEXT, false, data, NULL, action_delete_dir_contents_draw_top, action_delete_dir_contents_done_onresponse));
} else {
FS_Archive* archive = deleteData->base->archive;
char* path = deleteData->contents[deleteData->processed];
@ -114,7 +115,7 @@ void action_delete_contents(file_info* info, bool* populated) {
return;
}
ui_push(prompt_create("Confirmation", "Delete the selected content?", 0xFF000000, true, data, NULL, action_delete_dir_contents_draw_top, action_delete_dir_contents_onresponse));
ui_push(prompt_create("Confirmation", "Delete the selected content?", COLOR_TEXT, true, data, NULL, action_delete_dir_contents_draw_top, action_delete_dir_contents_onresponse));
}
void action_delete_dir_contents(file_info* info, bool* populated) {
@ -131,7 +132,7 @@ void action_delete_dir_contents(file_info* info, bool* populated) {
return;
}
ui_push(prompt_create("Confirmation", "Delete all contents of the selected directory?", 0xFF000000, true, data, NULL, action_delete_dir_contents_draw_top, action_delete_dir_contents_onresponse));
ui_push(prompt_create("Confirmation", "Delete all contents of the selected directory?", COLOR_TEXT, true, data, NULL, action_delete_dir_contents_draw_top, action_delete_dir_contents_onresponse));
}
void action_delete_dir_cias(file_info* info, bool* populated) {
@ -148,5 +149,5 @@ void action_delete_dir_cias(file_info* info, bool* populated) {
return;
}
ui_push(prompt_create("Confirmation", "Delete all CIAs in the selected directory?", 0xFF000000, true, data, NULL, action_delete_dir_contents_draw_top, action_delete_dir_contents_onresponse));
ui_push(prompt_create("Confirmation", "Delete all CIAs in the selected directory?", COLOR_TEXT, true, data, NULL, action_delete_dir_contents_draw_top, action_delete_dir_contents_onresponse));
}

View File

@ -7,6 +7,7 @@
#include "../../progressbar.h"
#include "../../prompt.h"
#include "../task/task.h"
#include "../../../screen.h"
typedef struct {
ext_save_data_info* info;
@ -35,7 +36,7 @@ static void action_delete_ext_save_data_update(ui_view* view, void* data, float*
} else {
*deleteData->populated = false;
ui_push(prompt_create("Success", "Ext save data deleted.", 0xFF000000, false, deleteData->info, NULL, ui_draw_ext_save_data_info, action_delete_ext_save_data_success_onresponse));
ui_push(prompt_create("Success", "Ext save data deleted.", COLOR_TEXT, false, deleteData->info, NULL, ui_draw_ext_save_data_info, action_delete_ext_save_data_success_onresponse));
}
free(data);
@ -56,5 +57,5 @@ void action_delete_ext_save_data(ext_save_data_info* info, bool* populated) {
data->info = info;
data->populated = populated;
ui_push(prompt_create("Confirmation", "Delete the selected ext save data?", 0xFF000000, true, data, NULL, action_delete_ext_save_data_draw_top, action_delete_ext_save_data_onresponse));
ui_push(prompt_create("Confirmation", "Delete the selected ext save data?", COLOR_TEXT, true, data, NULL, action_delete_ext_save_data_draw_top, action_delete_ext_save_data_onresponse));
}

View File

@ -6,6 +6,7 @@
#include "../../error.h"
#include "../../progressbar.h"
#include "../../prompt.h"
#include "../../../screen.h"
typedef struct {
pending_title_info* info;
@ -33,7 +34,7 @@ static void action_delete_pending_title_update(ui_view* view, void* data, float*
} else {
*deleteData->populated = false;
ui_push(prompt_create("Success", "Pending title deleted.", 0xFF000000, false, deleteData->info, NULL, ui_draw_pending_title_info, action_delete_pending_title_success_onresponse));
ui_push(prompt_create("Success", "Pending title deleted.", COLOR_TEXT, false, deleteData->info, NULL, ui_draw_pending_title_info, action_delete_pending_title_success_onresponse));
}
free(data);
@ -54,5 +55,5 @@ void action_delete_pending_title(pending_title_info* info, bool* populated) {
data->info = info;
data->populated = populated;
ui_push(prompt_create("Confirmation", "Delete the selected pending title?", 0xFF000000, true, data, NULL, action_delete_pending_title_draw_top, action_delete_pending_title_onresponse));
ui_push(prompt_create("Confirmation", "Delete the selected pending title?", COLOR_TEXT, true, data, NULL, action_delete_pending_title_draw_top, action_delete_pending_title_onresponse));
}

View File

@ -6,6 +6,7 @@
#include "../../error.h"
#include "../../progressbar.h"
#include "../../prompt.h"
#include "../../../screen.h"
typedef struct {
system_save_data_info* info;
@ -34,7 +35,7 @@ static void action_delete_system_save_data_update(ui_view* view, void* data, flo
} else {
*deleteData->populated = false;
ui_push(prompt_create("Success", "System save data deleted.", 0xFF000000, false, deleteData->info, NULL, ui_draw_system_save_data_info, action_delete_system_save_data_success_onresponse));
ui_push(prompt_create("Success", "System save data deleted.", COLOR_TEXT, false, deleteData->info, NULL, ui_draw_system_save_data_info, action_delete_system_save_data_success_onresponse));
}
free(data);
@ -55,5 +56,5 @@ void action_delete_system_save_data(system_save_data_info* info, bool* populated
data->info = info;
data->populated = populated;
ui_push(prompt_create("Confirmation", "Delete the selected system save data?", 0xFF000000, true, data, NULL, action_delete_system_save_data_draw_top, action_delete_system_save_data_onresponse));
ui_push(prompt_create("Confirmation", "Delete the selected system save data?", COLOR_TEXT, true, data, NULL, action_delete_system_save_data_draw_top, action_delete_system_save_data_onresponse));
}

View File

@ -6,6 +6,7 @@
#include "../../error.h"
#include "../../progressbar.h"
#include "../../prompt.h"
#include "../../../screen.h"
typedef struct {
ticket_info* info;
@ -33,7 +34,7 @@ static void action_delete_ticket_update(ui_view* view, void* data, float* progre
} else {
*deleteData->populated = false;
ui_push(prompt_create("Success", "Ticket deleted.", 0xFF000000, false, deleteData->info, NULL, ui_draw_ticket_info, action_delete_ticket_success_onresponse));
ui_push(prompt_create("Success", "Ticket deleted.", COLOR_TEXT, false, deleteData->info, NULL, ui_draw_ticket_info, action_delete_ticket_success_onresponse));
}
free(data);
@ -54,5 +55,5 @@ void action_delete_ticket(ticket_info* info, bool* populated) {
data->info = info;
data->populated = populated;
ui_push(prompt_create("Confirmation", "Delete the selected ticket?", 0xFF000000, true, data, NULL, action_delete_ticket_draw_top, action_delete_ticket_onresponse));
ui_push(prompt_create("Confirmation", "Delete the selected ticket?", COLOR_TEXT, true, data, NULL, action_delete_ticket_draw_top, action_delete_ticket_onresponse));
}

View File

@ -6,6 +6,7 @@
#include "../../error.h"
#include "../../progressbar.h"
#include "../../prompt.h"
#include "../../../screen.h"
typedef struct {
title_info* info;
@ -33,7 +34,7 @@ static void action_delete_title_update(ui_view* view, void* data, float* progres
} else {
*deleteData->populated = false;
ui_push(prompt_create("Success", "Title deleted.", 0xFF000000, false, deleteData->info, NULL, ui_draw_title_info, action_delete_title_success_onresponse));
ui_push(prompt_create("Success", "Title deleted.", COLOR_TEXT, false, deleteData->info, NULL, ui_draw_title_info, action_delete_title_success_onresponse));
}
free(data);
@ -54,5 +55,5 @@ void action_delete_title(title_info* info, bool* populated) {
data->info = info;
data->populated = populated;
ui_push(prompt_create("Confirmation", "Delete the selected title?", 0xFF000000, true, data, NULL, action_delete_title_draw_top, action_delete_title_onresponse));
ui_push(prompt_create("Confirmation", "Delete the selected title?", COLOR_TEXT, true, data, NULL, action_delete_title_draw_top, action_delete_title_onresponse));
}

View File

@ -7,6 +7,7 @@
#include "../../progressbar.h"
#include "../../prompt.h"
#include "../../../util.h"
#include "../../../screen.h"
static void action_export_secure_value_end_onresponse(ui_view* view, void* data, bool response) {
prompt_destroy(view);
@ -24,7 +25,7 @@ static void action_export_secure_value_update(ui_view* view, void* data, float*
progressbar_destroy(view);
ui_pop();
ui_push(prompt_create("Failure", "Secure value not set.", 0xFF000000, false, info, NULL, ui_draw_title_info, action_export_secure_value_end_onresponse));
ui_push(prompt_create("Failure", "Secure value not set.", COLOR_TEXT, false, info, NULL, ui_draw_title_info, action_export_secure_value_end_onresponse));
return;
}
@ -59,7 +60,7 @@ static void action_export_secure_value_update(ui_view* view, void* data, float*
progressbar_destroy(view);
ui_pop();
ui_push(prompt_create("Success", "Secure value exported.", 0xFF000000, false, info, NULL, ui_draw_title_info, action_export_secure_value_end_onresponse));
ui_push(prompt_create("Success", "Secure value exported.", COLOR_TEXT, false, info, NULL, ui_draw_title_info, action_export_secure_value_end_onresponse));
}
static void action_export_secure_value_onresponse(ui_view* view, void* data, bool response) {
@ -71,5 +72,5 @@ static void action_export_secure_value_onresponse(ui_view* view, void* data, boo
}
void action_export_secure_value(title_info* info, bool* populated) {
ui_push(prompt_create("Confirmation", "Export secure value for the selected title?", 0xFF000000, true, info, NULL, ui_draw_title_info, action_export_secure_value_onresponse));
ui_push(prompt_create("Confirmation", "Export secure value for the selected title?", COLOR_TEXT, true, info, NULL, ui_draw_title_info, action_export_secure_value_onresponse));
}

View File

@ -6,6 +6,7 @@
#include "../../error.h"
#include "../../progressbar.h"
#include "../../prompt.h"
#include "../../../screen.h"
static void action_import_secure_value_end_onresponse(ui_view* view, void* data, bool response) {
prompt_destroy(view);
@ -43,7 +44,7 @@ static void action_import_secure_value_update(ui_view* view, void* data, float*
progressbar_destroy(view);
ui_pop();
ui_push(prompt_create("Success", "Secure value imported.", 0xFF000000, false, info, NULL, ui_draw_title_info, action_import_secure_value_end_onresponse));
ui_push(prompt_create("Success", "Secure value imported.", COLOR_TEXT, false, info, NULL, ui_draw_title_info, action_import_secure_value_end_onresponse));
}
static void action_import_secure_value_onresponse(ui_view* view, void* data, bool response) {
@ -55,5 +56,5 @@ static void action_import_secure_value_onresponse(ui_view* view, void* data, boo
}
void action_import_secure_value(title_info* info, bool* populated) {
ui_push(prompt_create("Confirmation", "Import secure value for the selected title?", 0xFF000000, true, info, NULL, ui_draw_title_info, action_import_secure_value_onresponse));
ui_push(prompt_create("Confirmation", "Import secure value for the selected title?", COLOR_TEXT, true, info, NULL, ui_draw_title_info, action_import_secure_value_onresponse));
}

View File

@ -9,6 +9,7 @@
#include "../../error.h"
#include "../../progressbar.h"
#include "../../prompt.h"
#include "../../../screen.h"
#include "../../../util.h"
typedef struct {
@ -84,7 +85,7 @@ static void action_install_cias_update(ui_view* view, void* data, float* progres
}
if(installData->installResult.cancelled) {
ui_push(prompt_create("Failure", "Install cancelled.", 0xFF000000, false, data, NULL, action_install_cias_draw_top, action_install_cias_done_onresponse));
ui_push(prompt_create("Failure", "Install cancelled.", COLOR_TEXT, false, data, NULL, action_install_cias_draw_top, action_install_cias_done_onresponse));
} else if(installData->installResult.ioerr) {
if(strlen(path) > 48) {
error_display_errno(installData->base, ui_draw_file_info, installData->installResult.ioerrno, "Failed to install CIA file.\n%.45s...", path);
@ -92,7 +93,7 @@ static void action_install_cias_update(ui_view* view, void* data, float* progres
error_display_errno(installData->base, ui_draw_file_info, installData->installResult.ioerrno, "Failed to install CIA file.\n%.48s", path);
}
} else if(installData->installResult.wrongSystem) {
ui_push(prompt_create("Failure", "Attempted to install to wrong system.", 0xFF000000, false, data, NULL, action_install_cias_draw_top, action_install_cias_done_onresponse));
ui_push(prompt_create("Failure", "Attempted to install to wrong system.", COLOR_TEXT, false, data, NULL, action_install_cias_draw_top, action_install_cias_done_onresponse));
} else {
if(strlen(path) > 48) {
error_display_res(installData->base, ui_draw_file_info, installData->installResult.result, "Failed to install CIA file.\n%.45s...", path);
@ -120,7 +121,7 @@ static void action_install_cias_update(ui_view* view, void* data, float* progres
ui_pop();
progressbar_destroy(view);
ui_push(prompt_create("Success", "Install finished.", 0xFF000000, false, data, NULL, action_install_cias_draw_top, action_install_cias_done_onresponse));
ui_push(prompt_create("Success", "Install finished.", COLOR_TEXT, false, data, NULL, action_install_cias_draw_top, action_install_cias_done_onresponse));
return;
} else {
FS_Archive* archive = installData->base->archive;
@ -200,7 +201,7 @@ static void action_install_cias(file_info* info, FS_MediaType mediaType) {
return;
}
ui_push(prompt_create("Confirmation", "Install the selected CIA(s)?", 0xFF000000, true, data, NULL, action_install_cias_draw_top, action_install_cias_onresponse));
ui_push(prompt_create("Confirmation", "Install the selected CIA(s)?", COLOR_TEXT, true, data, NULL, action_install_cias_draw_top, action_install_cias_onresponse));
}
void action_install_cias_sd(file_info* info, bool* populated) {

View File

@ -1,10 +1,11 @@
#include <3ds.h>
#include "action.h"
#include "../task/task.h"
#include "../../error.h"
#include "../../progressbar.h"
#include "../../prompt.h"
#include "../task/task.h"
#include "../../../screen.h"
static void action_launch_title_update(ui_view* view, void* data, float* progress, char* progressText) {
title_info* info = (title_info*) data;
@ -45,5 +46,5 @@ static void action_launch_title_onresponse(ui_view* view, void* data, bool respo
}
void action_launch_title(title_info* info, bool* populated) {
ui_push(prompt_create("Confirmation", "Launch the selected title?", 0xFF000000, true, info, NULL, ui_draw_title_info, action_launch_title_onresponse));
ui_push(prompt_create("Confirmation", "Launch the selected title?", COLOR_TEXT, true, info, NULL, ui_draw_title_info, action_launch_title_onresponse));
}

View File

@ -9,6 +9,7 @@
#include "../../error.h"
#include "../../progressbar.h"
#include "../../prompt.h"
#include "../../../screen.h"
#include "../../../util.h"
typedef struct {
@ -45,7 +46,7 @@ static void action_paste_files_update(ui_view* view, void* data, float* progress
progressbar_destroy(view);
ui_pop();
ui_push(prompt_create("Failure", "Paste cancelled.", 0xFF000000, false, data, NULL, action_paste_files_draw_top, action_paste_files_done_onresponse));
ui_push(prompt_create("Failure", "Paste cancelled.", COLOR_TEXT, false, data, NULL, action_paste_files_draw_top, action_paste_files_done_onresponse));
return;
}
@ -53,7 +54,7 @@ static void action_paste_files_update(ui_view* view, void* data, float* progress
progressbar_destroy(view);
ui_pop();
ui_push(prompt_create("Success", "Contents pasted.", 0xFF000000, false, data, NULL, action_paste_files_draw_top, action_paste_files_done_onresponse));
ui_push(prompt_create("Success", "Contents pasted.", COLOR_TEXT, false, data, NULL, action_paste_files_draw_top, action_paste_files_done_onresponse));
} else {
FS_Archive* srcArchive = clipboard_get_archive();
char* srcPath = pasteData->contents[pasteData->processed];
@ -150,7 +151,7 @@ static void action_paste_files_onresponse(ui_view* view, void* data, bool respon
void action_paste_contents(file_info* info, bool* populated) {
if(!clipboard_has_contents()) {
ui_push(prompt_create("Failure", "Clipboard empty.", 0xFF000000, false, info, NULL, ui_draw_file_info, action_paste_files_failure_onresponse));
ui_push(prompt_create("Failure", "Clipboard empty.", COLOR_TEXT, false, info, NULL, ui_draw_file_info, action_paste_files_failure_onresponse));
return;
}
@ -167,5 +168,5 @@ void action_paste_contents(file_info* info, bool* populated) {
return;
}
ui_push(prompt_create("Confirmation", "Paste clipboard contents to the current directory?", 0xFF000000, true, data, NULL, action_paste_files_draw_top, action_paste_files_onresponse));
ui_push(prompt_create("Confirmation", "Paste clipboard contents to the current directory?", COLOR_TEXT, true, data, NULL, action_paste_files_draw_top, action_paste_files_onresponse));
}

View File

@ -6,6 +6,7 @@
#include "../error.h"
#include "../progressbar.h"
#include "../prompt.h"
#include "../../screen.h"
typedef struct {
Handle in;
@ -37,7 +38,7 @@ static void dumpnand_update(ui_view* view, void* data, float* progress, char* pr
progressbar_destroy(view);
ui_pop();
ui_push(prompt_create("Failure", "Dump cancelled.", 0xFF000000, false, data, NULL, NULL, dumpnand_done_onresponse));
ui_push(prompt_create("Failure", "Dump cancelled.", COLOR_TEXT, false, data, NULL, NULL, dumpnand_done_onresponse));
free(data);
@ -100,7 +101,7 @@ static void dumpnand_update(ui_view* view, void* data, float* progress, char* pr
progressbar_destroy(view);
ui_pop();
ui_push(prompt_create("Success", "NAND dumped.", 0xFF000000, false, NULL, NULL, NULL, dumpnand_done_onresponse));
ui_push(prompt_create("Success", "NAND dumped.", COLOR_TEXT, false, NULL, NULL, NULL, dumpnand_done_onresponse));
free(data);
} else {
@ -154,5 +155,5 @@ void dump_nand() {
data->offset = 0;
data->size = 0;
ui_push(prompt_create("Confirmation", "Dump raw NAND image to the SD card?", 0xFF000000, true, data, NULL, NULL, dumpnand_onresponse));
ui_push(prompt_create("Confirmation", "Dump raw NAND image to the SD card?", COLOR_TEXT, true, data, NULL, NULL, dumpnand_onresponse));
}

View File

@ -5,6 +5,7 @@
#include "action/action.h"
#include "task/task.h"
#include "../../screen.h"
#include "section.h"
#define EXTSAVEDATA_MAX 512
@ -20,9 +21,9 @@ typedef struct {
static u32 extsavedata_action_count = EXTSAVEDATA_ACTION_COUNT;
static list_item extsavedata_action_items[EXTSAVEDATA_ACTION_COUNT] = {
{"Browse User Save Data", 0xFF000000, action_browse_user_ext_save_data},
{"Browse SpotPass Save Data", 0xFF000000, action_browse_boss_ext_save_data},
{"Delete Save Data", 0xFF000000, action_delete_ext_save_data},
{"Browse User Save Data", COLOR_TEXT, action_browse_user_ext_save_data},
{"Browse SpotPass Save Data", COLOR_TEXT, action_browse_boss_ext_save_data},
{"Delete Save Data", COLOR_TEXT, action_delete_ext_save_data},
};
typedef struct {

View File

@ -7,8 +7,9 @@
#include "action/action.h"
#include "task/task.h"
#include "../../util.h"
#include "../error.h"
#include "../../screen.h"
#include "../../util.h"
#include "section.h"
#define FILES_MAX 1024
@ -28,43 +29,43 @@ typedef struct {
static u32 files_action_count = FILES_ACTION_COUNT;
static list_item files_action_items[FILES_ACTION_COUNT] = {
{"Delete", 0xFF000000, action_delete_contents},
{"Copy", 0xFF000000, action_copy_contents},
{"Paste", 0xFF000000, action_paste_contents},
{"Delete", COLOR_TEXT, action_delete_contents},
{"Copy", COLOR_TEXT, action_copy_contents},
{"Paste", COLOR_TEXT, action_paste_contents},
};
#define CIA_FILES_ACTION_COUNT 5
static u32 cia_files_action_count = CIA_FILES_ACTION_COUNT;
static list_item cia_files_action_items[CIA_FILES_ACTION_COUNT] = {
{"Install CIA to SD", 0xFF000000, action_install_cias_sd},
{"Install CIA to NAND", 0xFF000000, action_install_cias_nand},
{"Delete", 0xFF000000, action_delete_contents},
{"Copy", 0xFF000000, action_copy_contents},
{"Paste", 0xFF000000, action_paste_contents},
{"Install CIA to SD", COLOR_TEXT, action_install_cias_sd},
{"Install CIA to NAND", COLOR_TEXT, action_install_cias_nand},
{"Delete", COLOR_TEXT, action_delete_contents},
{"Copy", COLOR_TEXT, action_copy_contents},
{"Paste", COLOR_TEXT, action_paste_contents},
};
#define DIRECTORIES_ACTION_COUNT 4
static u32 directories_action_count = DIRECTORIES_ACTION_COUNT;
static list_item directories_action_items[DIRECTORIES_ACTION_COUNT] = {
{"Delete all contents", 0xFF000000, action_delete_dir_contents},
{"Delete", 0xFF000000, action_delete_contents},
{"Copy", 0xFF000000, action_copy_contents},
{"Paste", 0xFF000000, action_paste_contents},
{"Delete all contents", COLOR_TEXT, action_delete_dir_contents},
{"Delete", COLOR_TEXT, action_delete_contents},
{"Copy", COLOR_TEXT, action_copy_contents},
{"Paste", COLOR_TEXT, action_paste_contents},
};
#define CIA_DIRECTORIES_ACTION_COUNT 7
static u32 cia_directories_action_count = CIA_DIRECTORIES_ACTION_COUNT;
static list_item cia_directories_action_items[CIA_DIRECTORIES_ACTION_COUNT] = {
{"Install all CIAs to SD", 0xFF000000, action_install_cias_sd},
{"Install all CIAs to NAND", 0xFF000000, action_install_cias_nand},
{"Delete all CIAs", 0xFF000000, action_delete_dir_cias},
{"Delete all contents", 0xFF000000, action_delete_dir_contents},
{"Delete", 0xFF000000, action_delete_contents},
{"Copy", 0xFF000000, action_copy_contents},
{"Paste", 0xFF000000, action_paste_contents},
{"Install all CIAs to SD", COLOR_TEXT, action_install_cias_sd},
{"Install all CIAs to NAND", COLOR_TEXT, action_install_cias_nand},
{"Delete all CIAs", COLOR_TEXT, action_delete_dir_cias},
{"Delete all contents", COLOR_TEXT, action_delete_dir_contents},
{"Delete", COLOR_TEXT, action_delete_contents},
{"Copy", COLOR_TEXT, action_copy_contents},
{"Paste", COLOR_TEXT, action_paste_contents},
};
typedef struct {

View File

@ -4,6 +4,7 @@
#include <fcntl.h>
#include <malloc.h>
#include <stdio.h>
#include <string.h>
#include <3ds.h>
@ -86,6 +87,9 @@ static void networkinstall_close_client(network_install_data* data) {
data->total = 0;
data->currProcessed = 0;
data->currTotal = 0;
memset(&data->installResult, 0, sizeof(data->installResult));
data->installCancelEvent = 0;
}
static void networkinstall_install_update(ui_view* view, void* data, float* progress, char* progressText) {
@ -109,11 +113,11 @@ static void networkinstall_install_update(ui_view* view, void* data, float* prog
progressbar_destroy(view);
if(networkInstallData->installResult.cancelled) {
ui_push(prompt_create("Failure", "Install cancelled.", 0xFF000000, false, data, NULL, NULL, networkinstall_done_onresponse));
ui_push(prompt_create("Failure", "Install cancelled.", COLOR_TEXT, false, data, NULL, NULL, networkinstall_done_onresponse));
} else if(networkInstallData->installResult.ioerr) {
error_display_errno(NULL, NULL, networkInstallData->installResult.ioerrno, "Failed to install CIA file.");
} else if(networkInstallData->installResult.wrongSystem) {
ui_push(prompt_create("Failure", "Attempted to install to wrong system.", 0xFF000000, false, data, NULL, NULL, networkinstall_done_onresponse));
ui_push(prompt_create("Failure", "Attempted to install to wrong system.", COLOR_TEXT, false, data, NULL, NULL, networkinstall_done_onresponse));
} else {
error_display_res(NULL, NULL, networkInstallData->installResult.result, "Failed to install CIA file.");
}
@ -132,7 +136,7 @@ static void networkinstall_install_update(ui_view* view, void* data, float* prog
ui_pop();
progressbar_destroy(view);
ui_push(prompt_create("Success", "Install finished.", 0xFF000000, false, data, NULL, NULL, networkinstall_done_onresponse));
ui_push(prompt_create("Success", "Install finished.", COLOR_TEXT, false, data, NULL, NULL, networkinstall_done_onresponse));
return;
} else {
networkInstallData->currProcessed = 0;
@ -215,10 +219,11 @@ static void networkinstall_wait_update(ui_view* view, void* data, float bx1, flo
return;
}
networkInstallData->processed = 0;
networkInstallData->total = ntohl(networkInstallData->total);
networkInstallData->clientSocket = sock;
ui_push(prompt_create("Confirmation", "Install received CIA(s)?", 0xFF000000, true, data, NULL, NULL, networkinstall_confirm_onresponse));
ui_push(prompt_create("Confirmation", "Install received CIA(s)?", COLOR_TEXT, true, data, NULL, NULL, networkinstall_confirm_onresponse));
} else if(errno != EAGAIN) {
error_display_errno(NULL, NULL, errno, "Failed to open socket.");
}
@ -236,7 +241,7 @@ static void networkinstall_wait_draw_bottom(ui_view* view, void* data, float x1,
float textX = x1 + (x2 - x1 - textWidth) / 2;
float textY = y1 + (y2 - y1 - textHeight) / 2;
screen_draw_string(text, textX, textY, 0.5f, 0.5f, 0xFF000000, false);
screen_draw_string(text, textX, textY, 0.5f, 0.5f, COLOR_TEXT, false);
}
void networkinstall_open(FS_MediaType dest) {

View File

@ -5,6 +5,7 @@
#include "action/action.h"
#include "task/task.h"
#include "../../screen.h"
#include "section.h"
#define PENDINGTITLES_MAX 1024
@ -20,8 +21,8 @@ typedef struct {
static u32 pending_titles_action_count = PENDINGTITLES_ACTION_COUNT;
static list_item pending_titles_action_items[PENDINGTITLES_ACTION_COUNT] = {
{"Delete Pending Title", 0xFF000000, action_delete_pending_title},
{"Delete All Pending Titles", 0xFF000000, action_delete_all_pending_titles},
{"Delete Pending Title", COLOR_TEXT, action_delete_pending_title},
{"Delete All Pending Titles", COLOR_TEXT, action_delete_all_pending_titles},
};
typedef struct {

View File

@ -5,6 +5,7 @@
#include "action/action.h"
#include "task/task.h"
#include "../../screen.h"
#include "section.h"
#define SYSTEMSAVEDATA_MAX 512
@ -20,8 +21,8 @@ typedef struct {
static u32 systemsavedata_action_count = SYSTEMSAVEDATA_ACTION_COUNT;
static list_item systemsavedata_action_items[SYSTEMSAVEDATA_ACTION_COUNT] = {
{"Browse Save Data", 0xFF000000, action_browse_system_save_data},
{"Delete Save Data", 0xFF000000, action_delete_system_save_data},
{"Browse Save Data", COLOR_TEXT, action_browse_system_save_data},
{"Delete Save Data", COLOR_TEXT, action_delete_system_save_data},
};
typedef struct {

View File

@ -96,6 +96,11 @@ static void task_install_cia_thread(void* arg) {
break;
}
// TODO: Does this fix?
AM_DeleteTitle(data->dest, titleId);
AM_DeleteTicket(titleId);
AM_QueryAvailableExternalTitleDatabase(NULL);
if(R_FAILED(data->result->result = AM_StartCiaInstall(data->dest, &ciaHandle))) {
break;
}

View File

@ -80,11 +80,9 @@ static Result task_populate_ext_save_data_from(populate_ext_save_data_data* data
}
if(mediaType == MEDIATYPE_NAND) {
item->rgba = 0xFF0000FF;
item->rgba = COLOR_NAND;
} else if(mediaType == MEDIATYPE_SD) {
item->rgba = 0xFF00FF00;
} else if(mediaType == MEDIATYPE_GAME_CARD) {
item->rgba = 0xFFFF0000;
item->rgba = COLOR_SD;
}
item->data = extSaveDataInfo;

View File

@ -41,7 +41,7 @@ static void task_populate_files_thread(void* arg) {
list_item* dotItem = &data->items[*data->count];
strncpy(dotItem->name, ".", NAME_MAX);
dotItem->rgba = 0xFF0000FF;
dotItem->rgba = COLOR_DIRECTORY;
dotItem->data = dotFileInfo;
(*data->count)++;
@ -63,7 +63,7 @@ static void task_populate_files_thread(void* arg) {
list_item* dotDotItem = &data->items[*data->count];
strncpy(dotDotItem->name, "..", NAME_MAX);
dotDotItem->rgba = 0xFF0000FF;
dotDotItem->rgba = COLOR_DIRECTORY;
dotDotItem->data = dotDotFileInfo;
(*data->count)++;
@ -102,7 +102,7 @@ static void task_populate_files_thread(void* arg) {
list_item* item = &data->items[*data->count];
if(entries[i].attributes & FS_ATTRIBUTE_DIRECTORY) {
item->rgba = 0xFF0000FF;
item->rgba = COLOR_DIRECTORY;
snprintf(fileInfo->path, PATH_MAX, "%s%s/", data->path, entryName);
fileInfo->isDirectory = true;
@ -110,7 +110,7 @@ static void task_populate_files_thread(void* arg) {
fileInfo->size = 0;
fileInfo->isCia = false;
} else {
item->rgba = 0xFF000000;
item->rgba = COLOR_TEXT;
snprintf(fileInfo->path, PATH_MAX, "%s%s", data->path, entryName);
fileInfo->isDirectory = false;

View File

@ -8,6 +8,7 @@
#include "../../list.h"
#include "../../error.h"
#include "../../../screen.h"
#include "../../../util.h"
#include "task.h"
@ -46,9 +47,9 @@ static Result task_populate_pending_titles_from(populate_pending_titles_data* da
list_item* item = &data->items[*data->count];
snprintf(item->name, NAME_MAX, "%016llX", pendingTitleIds[i]);
if(mediaType == MEDIATYPE_NAND) {
item->rgba = 0xFF0000FF;
item->rgba = COLOR_NAND;
} else if(mediaType == MEDIATYPE_SD) {
item->rgba = 0xFF00FF00;
item->rgba = COLOR_SD;
}
item->data = pendingTitleInfo;

View File

@ -8,6 +8,7 @@
#include "../../list.h"
#include "../../error.h"
#include "../../../screen.h"
#include "../../../util.h"
#include "task.h"
@ -41,7 +42,7 @@ static void task_populate_system_save_data_thread(void* arg) {
list_item* item = &data->items[*data->count];
snprintf(item->name, NAME_MAX, "%08lX", systemSaveDataIds[i]);
item->rgba = 0xFF000000;
item->rgba = COLOR_TEXT;
item->data = systemSaveDataInfo;
(*data->count)++;

View File

@ -8,6 +8,7 @@
#include "../../list.h"
#include "../../error.h"
#include "../../../screen.h"
#include "../../../util.h"
#include "task.h"
@ -42,7 +43,7 @@ static void task_populate_tickets_thread(void* arg) {
list_item* item = &data->items[*data->count];
snprintf(item->name, NAME_MAX, "%016llX", ticketIds[i]);
item->rgba = 0xFF000000;
item->rgba = COLOR_TEXT;
item->data = ticketInfo;
(*data->count)++;

View File

@ -176,14 +176,14 @@ static Result task_populate_titles_from(populate_titles_data* data, FS_MediaType
if(mediaType == MEDIATYPE_NAND) {
if(dsiWare) {
item->rgba = 0xFF82004B;
item->rgba = COLOR_DS_TITLE;
} else {
item->rgba = 0xFF0000FF;
item->rgba = COLOR_NAND;
}
} else if(mediaType == MEDIATYPE_SD) {
item->rgba = 0xFF00FF00;
item->rgba = COLOR_SD;
} else if(mediaType == MEDIATYPE_GAME_CARD) {
item->rgba = 0xFFFF0000;
item->rgba = COLOR_GAME_CARD;
}
item->data = titleInfo;
@ -277,7 +277,7 @@ static Result task_populate_titles_from(populate_titles_data* data, FS_MediaType
titleInfo->smdhInfo.texture = screen_load_texture_auto(icon, sizeof(icon), 32, 32, GPU_RGBA5551, false);
item->rgba = 0xFFFF0000;
item->rgba = COLOR_DS_TITLE;
item->data = titleInfo;
(*data->count)++;

View File

@ -5,6 +5,7 @@
#include "action/action.h"
#include "task/task.h"
#include "../../screen.h"
#include "section.h"
#define TICKETS_MAX 1024
@ -20,7 +21,7 @@ typedef struct {
static u32 tickets_action_count = TICKETS_ACTION_COUNT;
static list_item tickets_action_items[TICKETS_ACTION_COUNT] = {
{"Delete Ticket", 0xFF000000, action_delete_ticket},
{"Delete Ticket", COLOR_TEXT, action_delete_ticket},
};
typedef struct {

View File

@ -5,6 +5,7 @@
#include "action/action.h"
#include "task/task.h"
#include "../../screen.h"
#include "section.h"
#define TITLES_MAX 1024
@ -20,34 +21,34 @@ typedef struct {
static u32 titles_action_count = TITLES_ACTION_COUNT;
static list_item titles_action_items[TITLES_ACTION_COUNT] = {
{"Launch Title", 0xFF000000, action_launch_title},
{"Delete Title", 0xFF000000, action_delete_title},
{"Browse Save Data", 0xFF000000, action_browse_title_save_data},
{"Import Secure Value", 0xFF000000, action_import_secure_value},
{"Export Secure Value", 0xFF000000, action_export_secure_value},
{"Launch Title", COLOR_TEXT, action_launch_title},
{"Delete Title", COLOR_TEXT, action_delete_title},
{"Browse Save Data", COLOR_TEXT, action_browse_title_save_data},
{"Import Secure Value", COLOR_TEXT, action_import_secure_value},
{"Export Secure Value", COLOR_TEXT, action_export_secure_value},
};
#define CARD_TITLES_ACTION_COUNT 2
static u32 card_titles_action_count = CARD_TITLES_ACTION_COUNT;
static list_item card_titles_action_items[CARD_TITLES_ACTION_COUNT] = {
{"Launch Title", 0xFF000000, action_launch_title},
{"Browse Save Data", 0xFF000000, action_browse_title_save_data},
{"Launch Title", COLOR_TEXT, action_launch_title},
{"Browse Save Data", COLOR_TEXT, action_browse_title_save_data},
};
#define DSIWARE_TITLES_ACTION_COUNT 2
static u32 dsiware_titles_action_count = DSIWARE_TITLES_ACTION_COUNT;
static list_item dsiware_titles_action_items[DSIWARE_TITLES_ACTION_COUNT] = {
{"Launch Title", 0xFF000000, action_launch_title},
{"Delete Title", 0xFF000000, action_delete_title},
{"Launch Title", COLOR_TEXT, action_launch_title},
{"Delete Title", COLOR_TEXT, action_delete_title},
};
#define DSIWARE_CARD_TITLES_ACTION_COUNT 1
static u32 dsiware_card_titles_action_count = DSIWARE_CARD_TITLES_ACTION_COUNT;
static list_item dsiware_card_titles_action_items[DSIWARE_CARD_TITLES_ACTION_COUNT] = {
{"Launch Title", 0xFF000000, action_launch_title},
{"Launch Title", COLOR_TEXT, action_launch_title},
};
typedef struct {

View File

@ -103,7 +103,7 @@ static void ui_draw_top(ui_view* ui) {
float timeTextWidth;
float timeTextHeight;
screen_get_string_size(&timeTextWidth, &timeTextHeight, timeText, 0.5f, 0.5f);
screen_draw_string(timeText, topScreenTopBarX + (topScreenTopBarWidth - timeTextWidth) / 2, topScreenTopBarY + (topScreenTopBarHeight - timeTextHeight) / 2, 0.5f, 0.5f, 0xFF000000, false);
screen_draw_string(timeText, topScreenTopBarX + (topScreenTopBarWidth - timeTextWidth) / 2, topScreenTopBarY + (topScreenTopBarHeight - timeTextHeight) / 2, 0.5f, 0.5f, COLOR_TEXT, false);
u32 batteryIcon = 0;
u8 batteryChargeState = 0;
@ -152,7 +152,7 @@ static void ui_draw_top(ui_view* ui) {
float freeSpaceHeight;
screen_get_string_size(NULL, &freeSpaceHeight, buffer, 0.5f, 0.5f);
screen_draw_string(buffer, topScreenBottomBarX + 2, topScreenBottomBarY + (topScreenBottomBarHeight - freeSpaceHeight) / 2, 0.5f, 0.5f, 0xFF000000, false);
screen_draw_string(buffer, topScreenBottomBarX + 2, topScreenBottomBarY + (topScreenBottomBarHeight - freeSpaceHeight) / 2, 0.5f, 0.5f, COLOR_TEXT, false);
}
static void ui_draw_bottom(ui_view* ui) {
@ -197,14 +197,14 @@ static void ui_draw_bottom(ui_view* ui) {
float nameWidth;
float nameHeight;
screen_get_string_size(&nameWidth, &nameHeight, ui->name, 0.5f, 0.5f);
screen_draw_string(ui->name, (BOTTOM_SCREEN_WIDTH - nameWidth) / 2, (bottomScreenTopBarHeight - nameHeight) / 2, 0.5f, 0.5f, 0xFF000000, false);
screen_draw_string(ui->name, (BOTTOM_SCREEN_WIDTH - nameWidth) / 2, (bottomScreenTopBarHeight - nameHeight) / 2, 0.5f, 0.5f, COLOR_TEXT, false);
}
if(ui->info != NULL) {
float infoWidth;
float infoHeight;
screen_get_string_size(&infoWidth, &infoHeight, ui->info, 0.5f, 0.5f);
screen_draw_string(ui->info, (BOTTOM_SCREEN_WIDTH - infoWidth) / 2, BOTTOM_SCREEN_HEIGHT - (bottomScreenBottomBarHeight + infoHeight) / 2, 0.5f, 0.5f, 0xFF000000, false);
screen_draw_string(ui->info, (BOTTOM_SCREEN_WIDTH - infoWidth) / 2, BOTTOM_SCREEN_HEIGHT - (bottomScreenBottomBarHeight + infoHeight) / 2, 0.5f, 0.5f, COLOR_TEXT, false);
}
}
@ -256,13 +256,13 @@ void ui_draw_ext_save_data_info(ui_view* view, void* data, float x1, float y1, f
float smdhTextX = smdhIconX + 48 + 8;
float smdhShortDescriptionY = smdhIconY + (48 - shortDescriptionHeight - 2 - longDescriptionHeight - 2 - publisherHeight) / 2;
screen_draw_string(info->smdhInfo.shortDescription, smdhTextX, smdhShortDescriptionY, 0.5f, 0.5f, 0xFF000000, false);
screen_draw_string(info->smdhInfo.shortDescription, smdhTextX, smdhShortDescriptionY, 0.5f, 0.5f, COLOR_TEXT, false);
float smdhLongDescriptionY = smdhShortDescriptionY + shortDescriptionHeight + 2;
screen_draw_string(info->smdhInfo.longDescription, smdhTextX, smdhLongDescriptionY, 0.5f, 0.5f, 0xFF000000, false);
screen_draw_string(info->smdhInfo.longDescription, smdhTextX, smdhLongDescriptionY, 0.5f, 0.5f, COLOR_TEXT, false);
float smdhPublisherY = smdhLongDescriptionY + longDescriptionHeight + 2;
screen_draw_string(info->smdhInfo.publisher, smdhTextX, smdhPublisherY, 0.5f, 0.5f, 0xFF000000, false);
screen_draw_string(info->smdhInfo.publisher, smdhTextX, smdhPublisherY, 0.5f, 0.5f, COLOR_TEXT, false);
}
snprintf(buf, 64, "Ext Save Data ID: %016llX", info->extSaveDataId);
@ -273,7 +273,7 @@ void ui_draw_ext_save_data_info(ui_view* view, void* data, float x1, float y1, f
float saveDataIdX = x1 + (x2 - x1 - saveDataIdWidth) / 2;
float saveDataIdY = y1 + (y2 - y1) / 2 - 8;
screen_draw_string(buf, saveDataIdX, saveDataIdY, 0.5f, 0.5f, 0xFF000000, false);
screen_draw_string(buf, saveDataIdX, saveDataIdY, 0.5f, 0.5f, COLOR_TEXT, false);
snprintf(buf, 64, "Shared: %s", info->shared ? "Yes" : "No");
@ -283,7 +283,7 @@ void ui_draw_ext_save_data_info(ui_view* view, void* data, float x1, float y1, f
float sharedX = x1 + (x2 - x1 - sharedWidth) / 2;
float sharedY = saveDataIdY + saveDataIdHeight + 2;
screen_draw_string(buf, sharedX, sharedY, 0.5f, 0.5f, 0xFF000000, false);
screen_draw_string(buf, sharedX, sharedY, 0.5f, 0.5f, COLOR_TEXT, false);
}
void ui_draw_file_info(ui_view* view, void* data, float x1, float y1, float x2, float y2) {
@ -303,7 +303,7 @@ void ui_draw_file_info(ui_view* view, void* data, float x1, float y1, float x2,
float nameX = x1 + (x2 - x1 - nameWidth) / 2;
float nameY = y1 + (y2 - y1) / 2 - 8;
screen_draw_string(buf, nameX, nameY, 0.5f, 0.5f, 0xFF000000, false);
screen_draw_string(buf, nameX, nameY, 0.5f, 0.5f, COLOR_TEXT, false);
if(!info->isDirectory) {
snprintf(buf, 64, "Size: %.2f MB", info->size / 1024.0 / 1024.0);
@ -314,7 +314,7 @@ void ui_draw_file_info(ui_view* view, void* data, float x1, float y1, float x2,
float sizeX = x1 + (x2 - x1 - sizeWidth) / 2;
float sizeY = nameY + nameHeight + 2;
screen_draw_string(buf, sizeX, sizeY, 0.5f, 0.5f, 0xFF000000, false);
screen_draw_string(buf, sizeX, sizeY, 0.5f, 0.5f, COLOR_TEXT, false);
if(info->isCia) {
if(info->ciaInfo.hasSmdh) {
@ -350,13 +350,13 @@ void ui_draw_file_info(ui_view* view, void* data, float x1, float y1, float x2,
float smdhTextX = smdhIconX + 48 + 8;
float smdhShortDescriptionY = smdhIconY + (48 - shortDescriptionHeight - 2 - longDescriptionHeight - 2 - publisherHeight) / 2;
screen_draw_string(info->ciaInfo.smdhInfo.shortDescription, smdhTextX, smdhShortDescriptionY, 0.5f, 0.5f, 0xFF000000, false);
screen_draw_string(info->ciaInfo.smdhInfo.shortDescription, smdhTextX, smdhShortDescriptionY, 0.5f, 0.5f, COLOR_TEXT, false);
float smdhLongDescriptionY = smdhShortDescriptionY + shortDescriptionHeight + 2;
screen_draw_string(info->ciaInfo.smdhInfo.longDescription, smdhTextX, smdhLongDescriptionY, 0.5f, 0.5f, 0xFF000000, false);
screen_draw_string(info->ciaInfo.smdhInfo.longDescription, smdhTextX, smdhLongDescriptionY, 0.5f, 0.5f, COLOR_TEXT, false);
float smdhPublisherY = smdhLongDescriptionY + longDescriptionHeight + 2;
screen_draw_string(info->ciaInfo.smdhInfo.publisher, smdhTextX, smdhPublisherY, 0.5f, 0.5f, 0xFF000000, false);
screen_draw_string(info->ciaInfo.smdhInfo.publisher, smdhTextX, smdhPublisherY, 0.5f, 0.5f, COLOR_TEXT, false);
}
snprintf(buf, 64, "Title ID: %016llX", info->ciaInfo.titleId);
@ -367,7 +367,7 @@ void ui_draw_file_info(ui_view* view, void* data, float x1, float y1, float x2,
float titleIdX = x1 + (x2 - x1 - titleIdWidth) / 2;
float titleIdY = sizeY + sizeHeight + 2;
screen_draw_string(buf, titleIdX, titleIdY, 0.5f, 0.5f, 0xFF000000, false);
screen_draw_string(buf, titleIdX, titleIdY, 0.5f, 0.5f, COLOR_TEXT, false);
snprintf(buf, 64, "Version: %hu", info->ciaInfo.version);
@ -377,7 +377,7 @@ void ui_draw_file_info(ui_view* view, void* data, float x1, float y1, float x2,
float versionX = x1 + (x2 - x1 - versionWidth) / 2;
float versionY = titleIdY + titleIdHeight + 2;
screen_draw_string(buf, versionX, versionY, 0.5f, 0.5f, 0xFF000000, false);
screen_draw_string(buf, versionX, versionY, 0.5f, 0.5f, COLOR_TEXT, false);
snprintf(buf, 64, "Installed Size (SD): %.2f MB", info->ciaInfo.installedSizeSD / 1024.0 / 1024.0);
@ -387,7 +387,7 @@ void ui_draw_file_info(ui_view* view, void* data, float x1, float y1, float x2,
float installedSizeSDX = x1 + (x2 - x1 - installedSizeSDWidth) / 2;
float installedSizeSDY = versionY + versionHeight + 2;
screen_draw_string(buf, installedSizeSDX, installedSizeSDY, 0.5f, 0.5f, 0xFF000000, false);
screen_draw_string(buf, installedSizeSDX, installedSizeSDY, 0.5f, 0.5f, COLOR_TEXT, false);
snprintf(buf, 64, "Installed Size (NAND): %.2f MB", info->ciaInfo.installedSizeNAND / 1024.0 / 1024.0);
@ -397,7 +397,7 @@ void ui_draw_file_info(ui_view* view, void* data, float x1, float y1, float x2,
float installedSizeNANDX = x1 + (x2 - x1 - installedSizeNANDWidth) / 2;
float installedSizeNANDY = installedSizeSDY + installedSizeSDHeight + 2;
screen_draw_string(buf, installedSizeNANDX, installedSizeNANDY, 0.5f, 0.5f, 0xFF000000, false);
screen_draw_string(buf, installedSizeNANDX, installedSizeNANDY, 0.5f, 0.5f, COLOR_TEXT, false);
}
} else {
snprintf(buf, 64, "Directory");
@ -408,7 +408,7 @@ void ui_draw_file_info(ui_view* view, void* data, float x1, float y1, float x2,
float directoryX = x1 + (x2 - x1 - directoryWidth) / 2;
float directoryY = nameY + nameHeight + 2;
screen_draw_string(buf, directoryX, directoryY, 0.5f, 0.5f, 0xFF000000, false);
screen_draw_string(buf, directoryX, directoryY, 0.5f, 0.5f, COLOR_TEXT, false);
}
}
@ -425,7 +425,7 @@ void ui_draw_pending_title_info(ui_view* view, void* data, float x1, float y1, f
float titleIdX = x1 + (x2 - x1 - titleIdWidth) / 2;
float titleIdY = y1 + (y2 - y1) / 2 - 8;
screen_draw_string(buf, titleIdX, titleIdY, 0.5f, 0.5f, 0xFF000000, false);
screen_draw_string(buf, titleIdX, titleIdY, 0.5f, 0.5f, COLOR_TEXT, false);
snprintf(buf, 64, "Media Type: %s", info->mediaType == MEDIATYPE_NAND ? "NAND" : info->mediaType == MEDIATYPE_SD ? "SD" : "Game Card");
@ -435,7 +435,7 @@ void ui_draw_pending_title_info(ui_view* view, void* data, float x1, float y1, f
float mediaTypeX = x1 + (x2 - x1 - mediaTypeWidth) / 2;
float mediaTypeY = titleIdY + titleIdHeight + 2;
screen_draw_string(buf, mediaTypeX, mediaTypeY, 0.5f, 0.5f, 0xFF000000, false);
screen_draw_string(buf, mediaTypeX, mediaTypeY, 0.5f, 0.5f, COLOR_TEXT, false);
snprintf(buf, 64, "Version: %hu", info->version);
@ -445,7 +445,7 @@ void ui_draw_pending_title_info(ui_view* view, void* data, float x1, float y1, f
float versionX = x1 + (x2 - x1 - versionWidth) / 2;
float versionY = mediaTypeY + mediaTypeHeight + 2;
screen_draw_string(buf, versionX, versionY, 0.5f, 0.5f, 0xFF000000, false);
screen_draw_string(buf, versionX, versionY, 0.5f, 0.5f, COLOR_TEXT, false);
}
void ui_draw_system_save_data_info(ui_view* view, void* data, float x1, float y1, float x2, float y2) {
@ -461,7 +461,7 @@ void ui_draw_system_save_data_info(ui_view* view, void* data, float x1, float y1
float saveDataIdX = x1 + (x2 - x1 - saveDataIdWidth) / 2;
float saveDataIdY = y1 + (y2 - y1) / 2 - 8;
screen_draw_string(buf, saveDataIdX, saveDataIdY, 0.5f, 0.5f, 0xFF000000, false);
screen_draw_string(buf, saveDataIdX, saveDataIdY, 0.5f, 0.5f, COLOR_TEXT, false);
}
void ui_draw_ticket_info(ui_view* view, void* data, float x1, float y1, float x2, float y2) {
@ -477,7 +477,7 @@ void ui_draw_ticket_info(ui_view* view, void* data, float x1, float y1, float x2
float titleIdX = x1 + (x2 - x1 - titleIdWidth) / 2;
float titleIdY = y1 + (y2 - y1) / 2 - 8;
screen_draw_string(buf, titleIdX, titleIdY, 0.5f, 0.5f, 0xFF000000, false);
screen_draw_string(buf, titleIdX, titleIdY, 0.5f, 0.5f, COLOR_TEXT, false);
}
void ui_draw_title_info(ui_view* view, void* data, float x1, float y1, float x2, float y2) {
@ -518,13 +518,13 @@ void ui_draw_title_info(ui_view* view, void* data, float x1, float y1, float x2,
float smdhTextX = smdhIconX + 48 + 8;
float smdhShortDescriptionY = smdhIconY + (48 - shortDescriptionHeight - 2 - longDescriptionHeight - 2 - publisherHeight) / 2;
screen_draw_string(info->smdhInfo.shortDescription, smdhTextX, smdhShortDescriptionY, 0.5f, 0.5f, 0xFF000000, false);
screen_draw_string(info->smdhInfo.shortDescription, smdhTextX, smdhShortDescriptionY, 0.5f, 0.5f, COLOR_TEXT, false);
float smdhLongDescriptionY = smdhShortDescriptionY + shortDescriptionHeight + 2;
screen_draw_string(info->smdhInfo.longDescription, smdhTextX, smdhLongDescriptionY, 0.5f, 0.5f, 0xFF000000, false);
screen_draw_string(info->smdhInfo.longDescription, smdhTextX, smdhLongDescriptionY, 0.5f, 0.5f, COLOR_TEXT, false);
float smdhPublisherY = smdhLongDescriptionY + longDescriptionHeight + 2;
screen_draw_string(info->smdhInfo.publisher, smdhTextX, smdhPublisherY, 0.5f, 0.5f, 0xFF000000, false);
screen_draw_string(info->smdhInfo.publisher, smdhTextX, smdhPublisherY, 0.5f, 0.5f, COLOR_TEXT, false);
}
snprintf(buf, 64, "Title ID: %016llX", info->titleId);
@ -535,7 +535,7 @@ void ui_draw_title_info(ui_view* view, void* data, float x1, float y1, float x2,
float titleIdX = x1 + (x2 - x1 - titleIdWidth) / 2;
float titleIdY = y1 + (y2 - y1) / 2 - 8;
screen_draw_string(buf, titleIdX, titleIdY, 0.5f, 0.5f, 0xFF000000, false);
screen_draw_string(buf, titleIdX, titleIdY, 0.5f, 0.5f, COLOR_TEXT, false);
snprintf(buf, 64, "Media Type: %s", info->mediaType == MEDIATYPE_NAND ? "NAND" : info->mediaType == MEDIATYPE_SD ? "SD" : "Game Card");
@ -545,7 +545,7 @@ void ui_draw_title_info(ui_view* view, void* data, float x1, float y1, float x2,
float mediaTypeX = x1 + (x2 - x1 - mediaTypeWidth) / 2;
float mediaTypeY = titleIdY + titleIdHeight + 2;
screen_draw_string(buf, mediaTypeX, mediaTypeY, 0.5f, 0.5f, 0xFF000000, false);
screen_draw_string(buf, mediaTypeX, mediaTypeY, 0.5f, 0.5f, COLOR_TEXT, false);
snprintf(buf, 64, "Product Code: %s", info->productCode);
@ -555,7 +555,7 @@ void ui_draw_title_info(ui_view* view, void* data, float x1, float y1, float x2,
float productCodeX = x1 + (x2 - x1 - productCodeWidth) / 2;
float productCodeY = mediaTypeY + mediaTypeHeight + 2;
screen_draw_string(buf, productCodeX, productCodeY, 0.5f, 0.5f, 0xFF000000, false);
screen_draw_string(buf, productCodeX, productCodeY, 0.5f, 0.5f, COLOR_TEXT, false);
snprintf(buf, 64, "Version: %hu", info->version);
@ -565,7 +565,7 @@ void ui_draw_title_info(ui_view* view, void* data, float x1, float y1, float x2,
float versionX = x1 + (x2 - x1 - versionWidth) / 2;
float versionY = productCodeY + productCodeHeight + 2;
screen_draw_string(buf, versionX, versionY, 0.5f, 0.5f, 0xFF000000, false);
screen_draw_string(buf, versionX, versionY, 0.5f, 0.5f, COLOR_TEXT, false);
snprintf(buf, 64, "Installed Size: %.2f MB", info->installedSize / 1024.0 / 1024.0);
@ -575,5 +575,5 @@ void ui_draw_title_info(ui_view* view, void* data, float x1, float y1, float x2,
float installedSizeX = x1 + (x2 - x1 - installedSizeWidth) / 2;
float installedSizeY = versionY + versionHeight + 2;
screen_draw_string(buf, installedSizeX, installedSizeY, 0.5f, 0.5f, 0xFF000000, false);
screen_draw_string(buf, installedSizeX, installedSizeY, 0.5f, 0.5f, COLOR_TEXT, false);
}

View File

@ -451,4 +451,20 @@ u32 util_next_pow_2(u32 i) {
u32 util_tiled_texture_index(u32 x, u32 y, u32 w, u32 h) {
return (((y >> 3) * (w >> 3) + (x >> 3)) << 6) + ((x & 1) | ((y & 1) << 1) | ((x & 2) << 1) | ((y & 2) << 2) | ((x & 4) << 2) | ((y & 4) << 3));
}
FILE* util_open_resource(const char* path) {
u32 realPathSize = strlen(path) + 16;
char realPath[realPathSize];
snprintf(realPath, realPathSize, "sdmc:/fbitheme/%s", path);
FILE* fd = fopen(realPath, "rb");
if(fd != NULL) {
return fd;
} else {
snprintf(realPath, realPathSize, "romfs:/%s", path);
return fopen(realPath, "rb");
}
}

View File

@ -1,5 +1,7 @@
#pragma once
#include <stdio.h>
typedef struct {
u16 shortDescription[0x40];
u16 longDescription[0x80];
@ -60,4 +62,6 @@ int util_compare_u64(const void* e1, const void* e2);
int util_compare_directory_entries(const void* e1, const void* e2);
u32 util_next_pow_2(u32 i);
u32 util_tiled_texture_index(u32 x, u32 y, u32 w, u32 h);
u32 util_tiled_texture_index(u32 x, u32 y, u32 w, u32 h);
FILE* util_open_resource(const char* path);