UX Overhaul (#305)

* Fix bgm checking bug

* Converted install and menu options into button menus rather than combos

* Fix sort order

* Various touch screen changes so that most functions can be done via touch

 * Dim theme list when navigating menus

* Translation framework implemented

* bug when no themes loaded fixed

* Fix theme preview regression introduced in d037691
This commit is contained in:
Alex Taber
2024-05-12 14:24:43 -04:00
committed by GitHub
parent 546d459696
commit a43cbcca74
23 changed files with 1060 additions and 536 deletions

View File

@@ -54,6 +54,8 @@ static inline int max(const int a, const int b)
#define FASTSCROLL_WAIT 1e8
#define BETWEEN(min, x, max) (min < x && x < max)
typedef enum {
MODE_THEMES = 0,
MODE_SPLASHES,
@@ -61,6 +63,14 @@ typedef enum {
MODE_AMOUNT,
} EntryMode;
typedef enum {
DRAW_MODE_LIST = 0,
DRAW_MODE_INSTALL,
DRAW_MODE_EXTRA,
DRAW_MODE_AMOUNT,
} DrawMode;
extern const char * main_paths[MODE_AMOUNT];
extern const int entries_per_screen_v[MODE_AMOUNT];
extern const int entries_per_screen_h[MODE_AMOUNT];

View File

@@ -4,6 +4,6 @@
#include "common.h"
size_t bin_to_abgr(char ** bufp, size_t size);
size_t png_to_abgr(char ** bufp, size_t size);
size_t png_to_abgr(char ** bufp, size_t size, u32 *height);
#endif
#endif

View File

@@ -163,7 +163,7 @@ void end_frame(void);
void set_screen(C3D_RenderTarget * screen);
void throw_error(const char * error, ErrorLevel level);
bool draw_confirm(const char * conf_msg, Entry_List_s * list);
bool draw_confirm(const char * conf_msg, Entry_List_s * list, DrawMode draw_mode);
void draw_preview(C2D_Image preview, int preview_offset);
@@ -178,6 +178,6 @@ void draw_home(u64 start_time, u64 cur_time);
void draw_base_interface(void);
void draw_grid_interface(Entry_List_s * list, Instructions_s instructions);
void draw_interface(Entry_List_s * list, Instructions_s instructions);
void draw_interface(Entry_List_s * list, Instructions_s instructions, DrawMode draw_mode);
#endif

View File

@@ -1,166 +0,0 @@
/*
* This file is part of Anemone3DS
* Copyright (C) 2016-2020 Contributors in CONTRIBUTORS.md
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
* * Requiring preservation of specified reasonable legal notices or
* author attributions in that material or in the Appropriate Legal
* Notices displayed by works containing it.
* * Prohibiting misrepresentation of the origin of that material,
* or requiring that modified versions of such material be marked in
* reasonable ways as different from the original version.
*/
#ifndef INSTRUCTIONS_H
#define INSTRUCTIONS_H
#include "draw.h"
#include "colors.h"
Instructions_s normal_instructions[MODE_AMOUNT] = {
{
.info_line = NULL,
.instructions = {
{
"\uE000 Hold to install",
"\uE001 Queue shuffle theme"
},
{
"\uE002 Hold for more",
"\uE003 Preview theme"
},
{
"\uE004 Switch to splashes",
"\uE005 Scan QR code"
},
{
"Exit",
"Delete from SD"
}
}
},
{
.info_line = NULL,
.instructions = {
{
"\uE000 Install splash",
"\uE001 Delete installed splash"
},
{
"\uE002 Hold for more",
"\uE003 Preview splash"
},
{
"\uE004 Switch to themes",
"\uE005 Scan QR code"
},
{
"Exit",
"Delete from SD"
}
}
}
};
Instructions_s install_instructions = {
.info_line = "Release \uE000 to cancel or hold \uE006 and release \uE000 to install",
.instructions = {
{
"\uE079 Normal install",
"\uE07A Shuffle install"
},
{
"\uE07B BGM-only install",
"\uE07C No-BGM install"
},
{
NULL,
NULL
},
{
"Exit",
NULL
}
}
};
Instructions_s extra_instructions[3] = {
{
.info_line = "Release \uE002 to cancel or hold \uE006 and release \uE002 to sort",
.instructions = {
{
"\uE079 Sort by name",
"\uE07A Sort by author"
},
{
"\uE07B Sort by filename",
NULL
},
{
NULL,
NULL
},
{
"Exit",
NULL
}
}
},
{
.info_line = "Release \uE002 to cancel or hold \uE006 and release \uE002 to do stuff",
.instructions = {
{
"\uE079 Jump in the list",
"\uE07A Reload broken icons"
},
{
"\uE07B Browse ThemePlaza",
NULL
},
{
"\uE004 Sorting menu",
"\uE005 Dumping menu"
},
{
"Exit",
NULL
}
}
},
{
.info_line = "Release \uE002 to cancel or hold \uE006 and release \uE002 to dump",
.instructions = {
{
"\uE079 Dump Current Theme",
"\uE07A Dump All Themes"
},
{
NULL,
NULL
},
{
NULL,
NULL
},
{
"Exit",
NULL
}
}
}
};
#endif

View File

@@ -68,7 +68,7 @@ void copy_texture_data(C3D_Tex * texture, const u16 * src, const Entry_Icon_s *
void parse_smdh(Icon_s * icon, Entry_s * entry, const u16 * fallback_name);
bool load_preview_from_buffer(char * row_pointers, u32 size, C2D_Image * preview_image, int * preview_offset);
bool load_preview_from_buffer(char * row_pointers, u32 size, C2D_Image * preview_image, int * preview_offset, int height);
bool load_preview(const Entry_List_s * list, C2D_Image * preview_image, int * preview_offset);
void free_preview(C2D_Image preview_image);
Result load_audio(const Entry_s *, audio_s *);

188
include/ui_strings.h Normal file
View File

@@ -0,0 +1,188 @@
/*
* This file is part of Anemone3DS
* Copyright (C) 2016-2020 Contributors in CONTRIBUTORS.md
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
* * Requiring preservation of specified reasonable legal notices or
* author attributions in that material or in the Appropriate Legal
* Notices displayed by works containing it.
* * Prohibiting misrepresentation of the origin of that material,
* or requiring that modified versions of such material be marked in
* reasonable ways as different from the original version.
*/
#ifndef UISTRINGS_H
#define UISTRINGS_H
#include "colors.h"
#include "draw.h"
#include "common.h"
#define SPLASHES_STRINGS 2
#define THEMES_STRINGS 6
typedef struct {
const char *quit;
const char *thread_error;
const char *zip_not_theme_splash;
const char *file_not_zip;
const char *download_failed;
} Camera_Strings_s;
typedef struct {
const char *theme_mode;
const char *splash_mode;
const char *no_themes;
const char *no_splashes;
const char *qr_download;
const char *switch_splashes;
const char *switch_themes;
const char *quit;
const char *by;
const char *selected;
const char *sel;
const char *tp_theme_mode;
const char *tp_splash_mode;
const char *search;
const char *page;
const char *err_quit;
const char *warn_continue;
const char *yes_no;
const char *load_themes;
const char *load_splash;
const char *load_icons;
const char *install_splash;
const char *delete_splash;
const char *install_theme;
const char *install_shuffle;
const char *install_bgm;
const char *install_no_bgm;
const char *downloading;
const char *checking_dl;
const char *delete_sd;
const char *download_themes;
const char *download_splashes;
const char *download_preview;
const char *download_bgm;
const char *dump_single;
const char *dump_all_official;
float start_pos;
} Draw_Strings_s;
typedef struct {
const char *illegal_input;
const char *new_or_overwrite;
const char *cancel;
const char *overwrite;
const char *rename;
const char *swkbd_fail;
const char *sd_full;
const char *fs_error;
} FS_Strings_s;
typedef struct {
const char *no_preview;
} Loading_Strings_s;
typedef struct {
const char *position_too_big;
const char *position_zero;
const char *jump_q;
const char *cancel;
const char *jump;
const char *no_theme_extdata;
const char *loading_qr;
const char *no_wifi;
const char *qr_homebrew;
const char *camera_broke;
const char *too_many_themes;
const char *not_enough_themes;
const char *uninstall_confirm;
const char *delete_confirm;
} Main_Strings_s;
typedef struct {
const char *no_results;
const char *check_wifi;
const char *new_page_big;
const char *new_page_zero;
const char *jump_page;
const char *cancel;
const char *jump;
const char *tags;
const char *search;
const char *parental_fail;
const char *zip_not_found;
const char *generic_httpc_error;
const char *http303_tp;
const char *http303;
const char *http404;
const char *http_err_url;
const char *http_errcode_generic;
const char *http401;
const char *http403;
const char *http407;
const char *http414;
const char *http418;
const char *http426;
const char *http451;
const char *http500;
const char *http502;
const char *http503;
const char *http504;
const char *http_unexpected;
} Remote_Strings_s;
typedef struct {
const char *no_splash_found;
const char *splash_disabled;
} Splashes_Strings_s;
typedef struct {
const char *no_body_found;
const char *mono_warn;
const char *illegal_char;
const char *name_folder;
const char *cancel;
const char *done;
} Themes_Strings_s;
typedef struct {
Instructions_s normal_instructions[MODE_AMOUNT];
Instructions_s install_instructions;
Instructions_s extra_instructions[3];
Camera_Strings_s camera;
Draw_Strings_s draw;
FS_Strings_s fs;
Loading_Strings_s loading;
Main_Strings_s main;
Remote_Strings_s remote;
Instructions_s remote_instructions[MODE_AMOUNT];
Instructions_s remote_extra_instructions;
Splashes_Strings_s splashes;
Themes_Strings_s themes;
} Language_s;
typedef enum {
LANGUAGE_EN,
LANGUAGE_AMOUNT,
} Language_Name;
Language_s init_strings(CFG_Language lang);
extern Language_s language;
#endif