Ask on invalid zip if zip is badge file

This commit is contained in:
2024-06-03 10:23:18 -04:00
parent 1a01ba502f
commit 9860dec103
5 changed files with 33 additions and 1 deletions

View File

@@ -184,5 +184,6 @@ void draw_home(u64 start_time, u64 cur_time);
void draw_base_interface(void); void draw_base_interface(void);
void draw_grid_interface(Entry_List_s * list, Instructions_s instructions, int extra_mode); void draw_grid_interface(Entry_List_s * list, Instructions_s instructions, int extra_mode);
void draw_interface(Entry_List_s * list, Instructions_s instructions, DrawMode draw_mode); void draw_interface(Entry_List_s * list, Instructions_s instructions, DrawMode draw_mode);
bool draw_confirm_no_interface(const char *conf_msg);
#endif #endif

View File

@@ -37,6 +37,7 @@ typedef struct {
const char *zip_not_theme_splash; const char *zip_not_theme_splash;
const char *file_not_zip; const char *file_not_zip;
const char *download_failed; const char *download_failed;
const char *badge_question;
} Camera_Strings_s; } Camera_Strings_s;
typedef struct { typedef struct {

View File

@@ -397,10 +397,18 @@ bool init_qr(void)
success = true; success = true;
} }
else else
{
bool badge = draw_confirm_no_interface(language.camera.badge_question);
if (badge)
{
save_zip_to_sd(filename, zip_size, zip_buf, REMOTE_MODE_BADGES);
// don't set success since we don't need to reload lists for badge zips
} else
{ {
throw_error(language.camera.zip_not_theme_splash, ERROR_LEVEL_WARNING); throw_error(language.camera.zip_not_theme_splash, ERROR_LEVEL_WARNING);
} }
} }
}
else else
{ {
throw_error(language.camera.file_not_zip, ERROR_LEVEL_WARNING); throw_error(language.camera.file_not_zip, ERROR_LEVEL_WARNING);

View File

@@ -348,6 +348,24 @@ bool draw_confirm(const char * conf_msg, Entry_List_s * list, DrawMode draw_mode
return false; return false;
} }
bool draw_confirm_no_interface(const char *conf_msg)
{
while(aptMainLoop())
{
draw_base_interface();
draw_text_center(GFX_TOP, 100, 0.5f, 0.7f, 0.7f, colors[COLOR_YELLOW], conf_msg);
draw_c2d_text_center(GFX_TOP, 170, 0.5f, 0.6f, 0.6f, colors[COLOR_WHITE], &text[TEXT_CONFIRM_YES_NO]);
end_frame();
hidScanInput();
u32 kDown = hidKeysDown();
if(kDown & KEY_A) return true;
if(kDown & KEY_B) return false;
}
return false;
}
void draw_preview(C2D_Image preview, int preview_offset, float preview_scale) void draw_preview(C2D_Image preview, int preview_offset, float preview_scale)
{ {
start_frame(); start_frame();

View File

@@ -170,6 +170,7 @@ const Language_s language_english = {
.zip_not_theme_splash = "Zip downloaded is neither\na splash nor a theme", .zip_not_theme_splash = "Zip downloaded is neither\na splash nor a theme",
.file_not_zip = "File downloaded isn't a zip.", .file_not_zip = "File downloaded isn't a zip.",
.download_failed = "Download failed.", .download_failed = "Download failed.",
.badge_question = "Theme or splash not detected.\nIs this a badge?",
}, },
.draw = .draw =
{ {
@@ -530,6 +531,7 @@ const Language_s language_spanish = {
.zip_not_theme_splash = "El archivo ZIP descargado no es\nni un fondo ni un tema", .zip_not_theme_splash = "El archivo ZIP descargado no es\nni un fondo ni un tema",
.file_not_zip = "El archivo descargado no es un ZIP.", .file_not_zip = "El archivo descargado no es un ZIP.",
.download_failed = "Fallo en la descarga.", .download_failed = "Fallo en la descarga.",
.badge_question = "Theme or splash not detected.\nIs this a badge?",
}, },
.draw = .draw =
{ {
@@ -890,6 +892,7 @@ const Language_s language_french = {
.zip_not_theme_splash = "Le fichier zip téléchargé n'est\nni un thème, ni un splash", .zip_not_theme_splash = "Le fichier zip téléchargé n'est\nni un thème, ni un splash",
.file_not_zip = "Le fichier téléchargé n'est pas un zip.", .file_not_zip = "Le fichier téléchargé n'est pas un zip.",
.download_failed = "Le téléchargement a échoué.", .download_failed = "Le téléchargement a échoué.",
.badge_question = "Theme or splash not detected.\nIs this a badge?",
}, },
.draw = .draw =
{ {
@@ -1250,6 +1253,7 @@ const Language_s language_portuguese = {
.zip_not_theme_splash = "O zip baixado não é um splash nem um tema", .zip_not_theme_splash = "O zip baixado não é um splash nem um tema",
.file_not_zip = "O arquivo baixado não é um zip.", .file_not_zip = "O arquivo baixado não é um zip.",
.download_failed = "Falha no download.", .download_failed = "Falha no download.",
.badge_question = "Theme or splash not detected.\nIs this a badge?",
}, },
.draw = .draw =
{ {