Merge branch 'develop' into ed64-xseries

This commit is contained in:
Robin Jones 2024-11-11 17:57:55 +00:00 committed by GitHub
commit 942dc963ae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
47 changed files with 232 additions and 208 deletions

1
.gitignore vendored
View File

@ -8,6 +8,7 @@
# Ignore generated files in the libdragon FS # Ignore generated files in the libdragon FS
/filesystem/FiraMonoBold.font64 /filesystem/FiraMonoBold.font64
/filesystem/*.wav64 /filesystem/*.wav64
/filesystem/*.sprite
# Ignore external development tools # Ignore external development tools
/tools/* /tools/*

View File

@ -42,11 +42,6 @@ SRCS = \
libs/miniz/miniz.c \ libs/miniz/miniz.c \
menu/actions.c \ menu/actions.c \
menu/cart_load.c \ menu/cart_load.c \
menu/components/background.c \
menu/components/boxart.c \
menu/components/common.c \
menu/components/context_menu.c \
menu/components/file_list.c \
menu/disk_info.c \ menu/disk_info.c \
menu/fonts.c \ menu/fonts.c \
menu/hdmi.c \ menu/hdmi.c \
@ -57,6 +52,11 @@ SRCS = \
menu/rom_info.c \ menu/rom_info.c \
menu/settings.c \ menu/settings.c \
menu/sound.c \ menu/sound.c \
menu/ui_components/background.c \
menu/ui_components/boxart.c \
menu/ui_components/common.c \
menu/ui_components/context_menu.c \
menu/ui_components/file_list.c \
menu/usb_comm.c \ menu/usb_comm.c \
menu/views/browser.c \ menu/views/browser.c \
menu/views/credits.c \ menu/views/credits.c \
@ -86,6 +86,30 @@ SOUNDS = \
error.wav \ error.wav \
settings.wav settings.wav
JOYPAD_IMAGES = \
joypad_a.png \
joypad_b.png \
joypad_c_down.png \
joypad_c_left.png \
joypad_c_right.png \
joypad_c_up.png \
joypad_d_down.png \
joypad_d_left.png \
joypad_d_right.png \
joypad_d_up.png \
joypad_l.png \
joypad_r.png \
joypad_start.png \
joypad_z.png
# joypad_j_east.png \
# joypad_j_north.png \
# joypad_j_northeast.png \
# joypad_j_northwest.png \
# joypad_j_south.png \
# joypad_j_southeast.png \
# joypad_j_southwest.png \
# joypad_j_west.png \
OBJS = $(addprefix $(BUILD_DIR)/, $(addsuffix .o,$(basename $(SRCS)))) OBJS = $(addprefix $(BUILD_DIR)/, $(addsuffix .o,$(basename $(SRCS))))
MINIZ_OBJS = $(filter $(BUILD_DIR)/libs/miniz/%.o,$(OBJS)) MINIZ_OBJS = $(filter $(BUILD_DIR)/libs/miniz/%.o,$(OBJS))
SPNG_OBJS = $(filter $(BUILD_DIR)/libs/libspng/%.o,$(OBJS)) SPNG_OBJS = $(filter $(BUILD_DIR)/libs/libspng/%.o,$(OBJS))
@ -93,7 +117,8 @@ DEPS = $(OBJS:.o=.d)
FILESYSTEM = \ FILESYSTEM = \
$(addprefix $(FILESYSTEM_DIR)/, $(notdir $(FONTS:%.ttf=%.font64))) \ $(addprefix $(FILESYSTEM_DIR)/, $(notdir $(FONTS:%.ttf=%.font64))) \
$(addprefix $(FILESYSTEM_DIR)/, $(notdir $(SOUNDS:%.wav=%.wav64))) $(addprefix $(FILESYSTEM_DIR)/, $(notdir $(SOUNDS:%.wav=%.wav64))) \
$(addprefix $(FILESYSTEM_DIR)/, $(notdir $(JOYPAD_IMAGES:%.png=%.sprite)))
$(MINIZ_OBJS): N64_CFLAGS+=-DMINIZ_NO_TIME -fcompare-debug-second $(MINIZ_OBJS): N64_CFLAGS+=-DMINIZ_NO_TIME -fcompare-debug-second
$(SPNG_OBJS): N64_CFLAGS+=-isystem $(SOURCE_DIR)/libs/miniz -DSPNG_USE_MINIZ -fcompare-debug-second $(SPNG_OBJS): N64_CFLAGS+=-isystem $(SOURCE_DIR)/libs/miniz -DSPNG_USE_MINIZ -fcompare-debug-second
@ -102,14 +127,18 @@ $(FILESYSTEM_DIR)/%.wav64: AUDIOCONV_FLAGS=--wav-compress 1
$(@info $(shell mkdir -p ./$(FILESYSTEM_DIR) &> /dev/null)) $(@info $(shell mkdir -p ./$(FILESYSTEM_DIR) &> /dev/null))
$(FILESYSTEM_DIR)/%.font64: $(ASSETS_DIR)/%.ttf $(FILESYSTEM_DIR)/%.font64: $(ASSETS_DIR)/fonts/%.ttf
@echo " [FONT] $@" @echo " [FONT] $@"
@$(N64_MKFONT) $(MKFONT_FLAGS) -o $(FILESYSTEM_DIR) "$<" @$(N64_MKFONT) $(MKFONT_FLAGS) -o $(FILESYSTEM_DIR) "$<"
$(FILESYSTEM_DIR)/%.wav64: $(ASSETS_DIR)/%.wav $(FILESYSTEM_DIR)/%.wav64: $(ASSETS_DIR)/sounds/%.wav
@echo " [AUDIO] $@" @echo " [AUDIO] $@"
@$(N64_AUDIOCONV) $(AUDIOCONV_FLAGS) -o $(FILESYSTEM_DIR) "$<" @$(N64_AUDIOCONV) $(AUDIOCONV_FLAGS) -o $(FILESYSTEM_DIR) "$<"
$(FILESYSTEM_DIR)/%.sprite: $(ASSETS_DIR)/images/joypad/%.png
@echo " [SPRITE] $@"
@$(N64_MKSPRITE) $(MKSPRITE_FLAGS) -o $(dir $@) "$<"
$(BUILD_DIR)/$(PROJECT_NAME).dfs: $(FILESYSTEM) $(BUILD_DIR)/$(PROJECT_NAME).dfs: $(FILESYSTEM)
$(BUILD_DIR)/menu/views/credits.o: .FORCE $(BUILD_DIR)/menu/views/credits.o: .FORCE

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 649 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 666 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 707 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 715 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 711 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 419 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 423 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 419 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 376 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 672 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 B

@ -1 +1 @@
Subproject commit 5295016230d657cd6c7fce5b6ed4a342538e09f5 Subproject commit 0c4e388851cabab52f421bff5e75e9dc3ab36c72

View File

@ -87,7 +87,7 @@ static void menu_init (boot_params_t *boot_params) {
directory_create(path_get(path)); directory_create(path_get(path));
path_push(path, BACKGROUND_CACHE_FILE); path_push(path, BACKGROUND_CACHE_FILE);
component_background_init(path_get(path)); ui_components_background_init(path_get(path));
path_free(path); path_free(path);
@ -103,7 +103,7 @@ static void menu_init (boot_params_t *boot_params) {
static void menu_deinit (menu_t *menu) { static void menu_deinit (menu_t *menu) {
hdmi_send_game_id(menu->boot_params); hdmi_send_game_id(menu->boot_params);
component_background_free(); ui_components_background_free();
path_free(menu->load.disk_path); path_free(menu->load.disk_path);
path_free(menu->load.rom_path); path_free(menu->load.rom_path);

View File

@ -1,24 +1,20 @@
/** /**
* @file components.h * @file ui_components.h
* @brief Menu Graphical User Interface Components * @brief Menu Graphical User Interface Components
* @ingroup menu * @ingroup menu
*/ */
#ifndef COMPONENTS_H__ #ifndef UI_COMPONENTS_H__
#define COMPONENTS_H__ #define UI_COMPONENTS_H__
#include <libdragon.h> #include <libdragon.h>
#include "menu_state.h" #include "menu_state.h"
/**
* @addtogroup menu_ui_components
* @{
*/
/** /**
* @brief File image Enumeration. * @brief File image Enumeration.
* *
* Enumeration for different types of file images used in the GUI. * Enumeration for different types of file images used in the user interface.
*/ */
typedef enum { typedef enum {
IMAGE_BOXART_FRONT, /**< Boxart image from the front */ IMAGE_BOXART_FRONT, /**< Boxart image from the front */
@ -42,7 +38,7 @@ typedef enum {
* @param y1 Ending y-coordinate. * @param y1 Ending y-coordinate.
* @param color Color of the box. * @param color Color of the box.
*/ */
void component_box_draw(int x0, int y0, int x1, int y1, color_t color); void ui_components_box_draw(int x0, int y0, int x1, int y1, color_t color);
/** /**
* @brief Draw a border component. * @brief Draw a border component.
@ -52,12 +48,12 @@ void component_box_draw(int x0, int y0, int x1, int y1, color_t color);
* @param x1 Ending x-coordinate. * @param x1 Ending x-coordinate.
* @param y1 Ending y-coordinate. * @param y1 Ending y-coordinate.
*/ */
void component_border_draw(int x0, int y0, int x1, int y1); void ui_components_border_draw(int x0, int y0, int x1, int y1);
/** /**
* @brief Draw the layout component. * @brief Draw the layout component.
*/ */
void component_layout_draw(void); void ui_components_layout_draw(void);
/** /**
* @brief Draw a progress bar component. * @brief Draw a progress bar component.
@ -68,21 +64,21 @@ void component_layout_draw(void);
* @param y1 Ending y-coordinate. * @param y1 Ending y-coordinate.
* @param progress Progress value (0.0 to 1.0). * @param progress Progress value (0.0 to 1.0).
*/ */
void component_progressbar_draw(int x0, int y0, int x1, int y1, float progress); void ui_components_progressbar_draw(int x0, int y0, int x1, int y1, float progress);
/** /**
* @brief Draw a seek bar component. * @brief Draw a seek bar component.
* *
* @param progress Progress value (0.0 to 1.0). * @param progress Progress value (0.0 to 1.0).
*/ */
void component_seekbar_draw(float progress); void ui_components_seekbar_draw(float progress);
/** /**
* @brief Draw a loader component. * @brief Draw a loader component.
* *
* @param position Position value (0.0 to 1.0). * @param position Position value (0.0 to 1.0).
*/ */
void component_loader_draw(float position); void ui_components_loader_draw(float position);
/** /**
* @brief Draw a scrollbar component. * @brief Draw a scrollbar component.
@ -95,7 +91,7 @@ void component_loader_draw(float position);
* @param items Total number of items. * @param items Total number of items.
* @param visible_items Number of visible items. * @param visible_items Number of visible items.
*/ */
void component_scrollbar_draw(int x, int y, int width, int height, int position, int items, int visible_items); void ui_components_scrollbar_draw(int x, int y, int width, int height, int position, int items, int visible_items);
/** /**
* @brief Draw a list scrollbar component. * @brief Draw a list scrollbar component.
@ -104,7 +100,7 @@ void component_scrollbar_draw(int x, int y, int width, int height, int position,
* @param items Total number of items. * @param items Total number of items.
* @param visible_items Number of visible items. * @param visible_items Number of visible items.
*/ */
void component_list_scrollbar_draw(int position, int items, int visible_items); void ui_components_list_scrollbar_draw(int position, int items, int visible_items);
/** /**
* @brief Draw a dialog component. * @brief Draw a dialog component.
@ -112,7 +108,7 @@ void component_list_scrollbar_draw(int position, int items, int visible_items);
* @param width Width of the dialog. * @param width Width of the dialog.
* @param height Height of the dialog. * @param height Height of the dialog.
*/ */
void component_dialog_draw(int width, int height); void ui_components_dialog_draw(int width, int height);
/** /**
* @brief Draw a message box component. * @brief Draw a message box component.
@ -120,7 +116,7 @@ void component_dialog_draw(int width, int height);
* @param fmt Format string for the message. * @param fmt Format string for the message.
* @param ... Additional arguments for the format string. * @param ... Additional arguments for the format string.
*/ */
void component_messagebox_draw(char *fmt, ...); void ui_components_messagebox_draw(char *fmt, ...);
/** /**
* @brief Draw the main text component. * @brief Draw the main text component.
@ -130,7 +126,7 @@ void component_messagebox_draw(char *fmt, ...);
* @param fmt Format string for the text. * @param fmt Format string for the text.
* @param ... Additional arguments for the format string. * @param ... Additional arguments for the format string.
*/ */
void component_main_text_draw(rdpq_align_t align, rdpq_valign_t valign, char *fmt, ...); void ui_components_main_text_draw(rdpq_align_t align, rdpq_valign_t valign, char *fmt, ...);
/** /**
* @brief Draw the actions bar text component. * @brief Draw the actions bar text component.
@ -140,31 +136,31 @@ void component_main_text_draw(rdpq_align_t align, rdpq_valign_t valign, char *fm
* @param fmt Format string for the text. * @param fmt Format string for the text.
* @param ... Additional arguments for the format string. * @param ... Additional arguments for the format string.
*/ */
void component_actions_bar_text_draw(rdpq_align_t align, rdpq_valign_t valign, char *fmt, ...); void ui_components_actions_bar_text_draw(rdpq_align_t align, rdpq_valign_t valign, char *fmt, ...);
/** /**
* @brief Initialize the background component. * @brief Initialize the background component.
* *
* @param cache_location Location of the cache. * @param cache_location Location of the cache.
*/ */
void component_background_init(char *cache_location); void ui_components_background_init(char *cache_location);
/** /**
* @brief Free the background component resources. * @brief Free the background component resources.
*/ */
void component_background_free(void); void ui_components_background_free(void);
/** /**
* @brief Replace the background image. * @brief Replace the background image.
* *
* @param image New background image. * @param image New background image.
*/ */
void component_background_replace_image(surface_t *image); void ui_components_background_replace_image(surface_t *image);
/** /**
* @brief Draw the background component. * @brief Draw the background component.
*/ */
void component_background_draw(void); void ui_components_background_draw(void);
/** /**
* @brief Draw the file list component. * @brief Draw the file list component.
@ -173,7 +169,7 @@ void component_background_draw(void);
* @param entries Number of entries. * @param entries Number of entries.
* @param selected Index of the selected entry. * @param selected Index of the selected entry.
*/ */
void component_file_list_draw(entry_t *list, int entries, int selected); void ui_components_file_list_draw(entry_t *list, int entries, int selected);
/** /**
* @brief Context menu structure. * @brief Context menu structure.
@ -199,14 +195,14 @@ typedef struct component_context_menu {
* *
* @param cm Pointer to the context menu structure. * @param cm Pointer to the context menu structure.
*/ */
void component_context_menu_init(component_context_menu_t *cm); void ui_components_context_menu_init(component_context_menu_t *cm);
/** /**
* @brief Show the context menu component. * @brief Show the context menu component.
* *
* @param cm Pointer to the context menu structure. * @param cm Pointer to the context menu structure.
*/ */
void component_context_menu_show(component_context_menu_t *cm); void ui_components_context_menu_show(component_context_menu_t *cm);
/** /**
* @brief Process the context menu component. * @brief Process the context menu component.
@ -215,14 +211,14 @@ void component_context_menu_show(component_context_menu_t *cm);
* @param cm Pointer to the context menu structure. * @param cm Pointer to the context menu structure.
* @return True if the context menu was processed, false otherwise. * @return True if the context menu was processed, false otherwise.
*/ */
bool component_context_menu_process(menu_t *menu, component_context_menu_t *cm); bool ui_components_context_menu_process(menu_t *menu, component_context_menu_t *cm);
/** /**
* @brief Draw the context menu component. * @brief Draw the context menu component.
* *
* @param cm Pointer to the context menu structure. * @param cm Pointer to the context menu structure.
*/ */
void component_context_menu_draw(component_context_menu_t *cm); void ui_components_context_menu_draw(component_context_menu_t *cm);
/** /**
* @brief Box Art Structure. * @brief Box Art Structure.
@ -240,22 +236,20 @@ typedef struct {
* @param current_image_view Current image view type. * @param current_image_view Current image view type.
* @return Pointer to the initialized box art component. * @return Pointer to the initialized box art component.
*/ */
component_boxart_t *component_boxart_init(const char *storage_prefix, char *game_code, file_image_type_t current_image_view); component_boxart_t *ui_components_boxart_init(const char *storage_prefix, char *game_code, file_image_type_t current_image_view);
/** /**
* @brief Free the box art component resources. * @brief Free the box art component resources.
* *
* @param b Pointer to the box art component. * @param b Pointer to the box art component.
*/ */
void component_boxart_free(component_boxart_t *b); void ui_components_boxart_free(component_boxart_t *b);
/** /**
* @brief Draw the box art component. * @brief Draw the box art component.
* *
* @param b Pointer to the box art component. * @param b Pointer to the box art component.
*/ */
void component_boxart_draw(component_boxart_t *b); void ui_components_boxart_draw(component_boxart_t *b);
/** @} */ /* menu_ui_components */ #endif /* UI_COMPONENTS_H__ */
#endif /* COMPONENTS_H__ */

View File

@ -1,7 +1,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "../components.h" #include "../ui_components.h"
#include "constants.h" #include "constants.h"
#include "utils/fs.h" #include "utils/fs.h"
@ -157,7 +157,7 @@ static void display_list_free (void *arg) {
} }
void component_background_init (char *cache_location) { void ui_components_background_init (char *cache_location) {
if (!background) { if (!background) {
background = calloc(1, sizeof(component_background_t)); background = calloc(1, sizeof(component_background_t));
background->cache_location = strdup(cache_location); background->cache_location = strdup(cache_location);
@ -166,7 +166,7 @@ void component_background_init (char *cache_location) {
} }
} }
void component_background_free (void) { void ui_components_background_free (void) {
if (background) { if (background) {
if (background->image) { if (background->image) {
surface_free(background->image); surface_free(background->image);
@ -185,7 +185,7 @@ void component_background_free (void) {
} }
} }
void component_background_replace_image (surface_t *image) { void ui_components_background_replace_image (surface_t *image) {
if (!background) { if (!background) {
return; return;
} }
@ -206,7 +206,7 @@ void component_background_replace_image (surface_t *image) {
prepare_background(background); prepare_background(background);
} }
void component_background_draw (void) { void ui_components_background_draw (void) {
if (background && background->image_display_list) { if (background && background->image_display_list) {
rspq_block_run(background->image_display_list); rspq_block_run(background->image_display_list);
} else { } else {

View File

@ -1,6 +1,6 @@
#include <stdlib.h> #include <stdlib.h>
#include "../components.h" #include "../ui_components.h"
#include "../path.h" #include "../path.h"
#include "../png_decoder.h" #include "../png_decoder.h"
#include "constants.h" #include "constants.h"
@ -17,7 +17,7 @@ static void png_decoder_callback (png_err_t err, surface_t *decoded_image, void
} }
component_boxart_t *component_boxart_init (const char *storage_prefix, char *game_code, file_image_type_t current_image_view) { component_boxart_t *ui_components_boxart_init (const char *storage_prefix, char *game_code, file_image_type_t current_image_view) {
component_boxart_t *b; component_boxart_t *b;
char boxart_id_path[8]; char boxart_id_path[8];
@ -120,7 +120,7 @@ component_boxart_t *component_boxart_init (const char *storage_prefix, char *gam
return NULL; return NULL;
} }
void component_boxart_free (component_boxart_t *b) { void ui_components_boxart_free (component_boxart_t *b) {
if (b) { if (b) {
if (b->loading) { if (b->loading) {
png_decoder_abort(); png_decoder_abort();
@ -133,7 +133,7 @@ void component_boxart_free (component_boxart_t *b) {
} }
} }
void component_boxart_draw (component_boxart_t *b) { void ui_components_boxart_draw (component_boxart_t *b) {
int box_x = BOXART_X; int box_x = BOXART_X;
int box_y = BOXART_Y; int box_y = BOXART_Y;
@ -150,7 +150,7 @@ void component_boxart_draw (component_boxart_t *b) {
rdpq_tex_blit(b->image, box_x, box_y, NULL); rdpq_tex_blit(b->image, box_x, box_y, NULL);
rdpq_mode_pop(); rdpq_mode_pop();
} else { } else {
component_box_draw( ui_components_box_draw(
BOXART_X, BOXART_X,
BOXART_Y, BOXART_Y,
BOXART_X + BOXART_WIDTH, BOXART_X + BOXART_WIDTH,

View File

@ -1,11 +1,11 @@
#include <stdarg.h> #include <stdarg.h>
#include "../components.h" #include "../ui_components.h"
#include "../fonts.h" #include "../fonts.h"
#include "constants.h" #include "constants.h"
void component_box_draw (int x0, int y0, int x1, int y1, color_t color) { void ui_components_box_draw (int x0, int y0, int x1, int y1, color_t color) {
rdpq_mode_push(); rdpq_mode_push();
rdpq_set_mode_fill(color); rdpq_set_mode_fill(color);
@ -13,7 +13,7 @@ void component_box_draw (int x0, int y0, int x1, int y1, color_t color) {
rdpq_mode_pop(); rdpq_mode_pop();
} }
void component_border_draw (int x0, int y0, int x1, int y1) { void ui_components_border_draw (int x0, int y0, int x1, int y1) {
rdpq_mode_push(); rdpq_mode_push();
rdpq_set_mode_fill(BORDER_COLOR); rdpq_set_mode_fill(BORDER_COLOR);
@ -25,14 +25,14 @@ void component_border_draw (int x0, int y0, int x1, int y1) {
rdpq_mode_pop(); rdpq_mode_pop();
} }
void component_layout_draw (void) { void ui_components_layout_draw (void) {
component_border_draw( ui_components_border_draw(
VISIBLE_AREA_X0, VISIBLE_AREA_X0,
VISIBLE_AREA_Y0, VISIBLE_AREA_Y0,
VISIBLE_AREA_X1, VISIBLE_AREA_X1,
VISIBLE_AREA_Y1 VISIBLE_AREA_Y1
); );
component_box_draw( ui_components_box_draw(
VISIBLE_AREA_X0, VISIBLE_AREA_X0,
LAYOUT_ACTIONS_SEPARATOR_Y, LAYOUT_ACTIONS_SEPARATOR_Y,
VISIBLE_AREA_X1, VISIBLE_AREA_X1,
@ -41,47 +41,47 @@ void component_layout_draw (void) {
); );
} }
void component_progressbar_draw (int x0, int y0, int x1, int y1, float progress) { void ui_components_progressbar_draw (int x0, int y0, int x1, int y1, float progress) {
float progress_width = progress * (x1 - x0); float progress_width = progress * (x1 - x0);
component_box_draw(x0, y0, x0 + progress_width, y1, PROGRESSBAR_DONE_COLOR); ui_components_box_draw(x0, y0, x0 + progress_width, y1, PROGRESSBAR_DONE_COLOR);
component_box_draw(x0 + progress_width, y0, x1, y1, PROGRESSBAR_BG_COLOR); ui_components_box_draw(x0 + progress_width, y0, x1, y1, PROGRESSBAR_BG_COLOR);
} }
void component_seekbar_draw (float position) { void ui_components_seekbar_draw (float position) {
int x0 = SEEKBAR_X; int x0 = SEEKBAR_X;
int y0 = SEEKBAR_Y; int y0 = SEEKBAR_Y;
int x1 = SEEKBAR_X + SEEKBAR_WIDTH; int x1 = SEEKBAR_X + SEEKBAR_WIDTH;
int y1 = SEEKBAR_Y + SEEKBAR_HEIGHT; int y1 = SEEKBAR_Y + SEEKBAR_HEIGHT;
component_border_draw(x0, y0, x1, y1); ui_components_border_draw(x0, y0, x1, y1);
component_progressbar_draw(x0, y0, x1, y1, position); ui_components_progressbar_draw(x0, y0, x1, y1, position);
} }
void component_loader_draw (float progress) { void ui_components_loader_draw (float progress) {
int x0 = LOADER_X; int x0 = LOADER_X;
int y0 = LOADER_Y; int y0 = LOADER_Y;
int x1 = LOADER_X + LOADER_WIDTH; int x1 = LOADER_X + LOADER_WIDTH;
int y1 = LOADER_Y + LOADER_HEIGHT; int y1 = LOADER_Y + LOADER_HEIGHT;
component_border_draw(x0, y0, x1, y1); ui_components_border_draw(x0, y0, x1, y1);
component_progressbar_draw(x0, y0, x1, y1, progress); ui_components_progressbar_draw(x0, y0, x1, y1, progress);
} }
void component_scrollbar_draw (int x, int y, int width, int height, int position, int items, int visible_items) { void ui_components_scrollbar_draw (int x, int y, int width, int height, int position, int items, int visible_items) {
if (items <= 1 || items <= visible_items) { if (items <= 1 || items <= visible_items) {
component_box_draw(x, y, x + width, y + height, SCROLLBAR_INACTIVE_COLOR); ui_components_box_draw(x, y, x + width, y + height, SCROLLBAR_INACTIVE_COLOR);
} else { } else {
int scroll_height = (int) ((visible_items / (float) (items)) * height); int scroll_height = (int) ((visible_items / (float) (items)) * height);
float scroll_position = ((position / (float) (items - 1)) * (height - scroll_height)); float scroll_position = ((position / (float) (items - 1)) * (height - scroll_height));
component_box_draw(x, y, x + width, y + height, SCROLLBAR_BG_COLOR); ui_components_box_draw(x, y, x + width, y + height, SCROLLBAR_BG_COLOR);
component_box_draw(x, y + scroll_position, x + width, y + scroll_position + scroll_height, SCROLLBAR_POSITION_COLOR); ui_components_box_draw(x, y + scroll_position, x + width, y + scroll_position + scroll_height, SCROLLBAR_POSITION_COLOR);
} }
} }
void component_list_scrollbar_draw (int position, int items, int visible_items) { void ui_components_list_scrollbar_draw (int position, int items, int visible_items) {
component_scrollbar_draw( ui_components_scrollbar_draw(
LIST_SCROLLBAR_X, LIST_SCROLLBAR_X,
LIST_SCROLLBAR_Y, LIST_SCROLLBAR_Y,
LIST_SCROLLBAR_WIDTH, LIST_SCROLLBAR_WIDTH,
@ -92,17 +92,17 @@ void component_list_scrollbar_draw (int position, int items, int visible_items)
); );
} }
void component_dialog_draw (int width, int height) { void ui_components_dialog_draw (int width, int height) {
int x0 = DISPLAY_CENTER_X - (width / 2); int x0 = DISPLAY_CENTER_X - (width / 2);
int y0 = DISPLAY_CENTER_Y - (height / 2); int y0 = DISPLAY_CENTER_Y - (height / 2);
int x1 = DISPLAY_CENTER_X + (width / 2); int x1 = DISPLAY_CENTER_X + (width / 2);
int y1 = DISPLAY_CENTER_Y + (height / 2); int y1 = DISPLAY_CENTER_Y + (height / 2);
component_border_draw(x0, y0, x1, y1); ui_components_border_draw(x0, y0, x1, y1);
component_box_draw(x0, y0, x1, y1, DIALOG_BG_COLOR); ui_components_box_draw(x0, y0, x1, y1, DIALOG_BG_COLOR);
} }
void component_messagebox_draw (char *fmt, ...) { void ui_components_messagebox_draw (char *fmt, ...) {
char buffer[512]; char buffer[512];
size_t nbytes = sizeof(buffer); size_t nbytes = sizeof(buffer);
@ -126,7 +126,7 @@ void component_messagebox_draw (char *fmt, ...) {
free(formatted); free(formatted);
} }
component_dialog_draw( ui_components_dialog_draw(
paragraph->bbox.x1 - paragraph->bbox.x0 + MESSAGEBOX_MARGIN, paragraph->bbox.x1 - paragraph->bbox.x0 + MESSAGEBOX_MARGIN,
paragraph->bbox.y1 - paragraph->bbox.y0 + MESSAGEBOX_MARGIN paragraph->bbox.y1 - paragraph->bbox.y0 + MESSAGEBOX_MARGIN
); );
@ -136,7 +136,7 @@ void component_messagebox_draw (char *fmt, ...) {
rdpq_paragraph_free(paragraph); rdpq_paragraph_free(paragraph);
} }
void component_main_text_draw (rdpq_align_t align, rdpq_valign_t valign, char *fmt, ...) { void ui_components_main_text_draw (rdpq_align_t align, rdpq_valign_t valign, char *fmt, ...) {
char buffer[1024]; char buffer[1024];
size_t nbytes = sizeof(buffer); size_t nbytes = sizeof(buffer);
@ -166,7 +166,7 @@ void component_main_text_draw (rdpq_align_t align, rdpq_valign_t valign, char *f
} }
} }
void component_actions_bar_text_draw (rdpq_align_t align, rdpq_valign_t valign, char *fmt, ...) { void ui_components_actions_bar_text_draw (rdpq_align_t align, rdpq_valign_t valign, char *fmt, ...) {
char buffer[256]; char buffer[256];
size_t nbytes = sizeof(buffer); size_t nbytes = sizeof(buffer);

View File

@ -1,4 +1,4 @@
#include "../components.h" #include "../ui_components.h"
#include "../fonts.h" #include "../fonts.h"
#include "../sound.h" #include "../sound.h"
#include "constants.h" #include "constants.h"
@ -12,7 +12,7 @@ static component_context_menu_t *get_current_submenu (component_context_menu_t *
} }
void component_context_menu_init (component_context_menu_t *cm) { void ui_components_context_menu_init (component_context_menu_t *cm) {
cm->row_selected = -1; cm->row_selected = -1;
cm->row_count = 0; cm->row_count = 0;
cm->hide_pending = false; cm->hide_pending = false;
@ -22,12 +22,12 @@ void component_context_menu_init (component_context_menu_t *cm) {
} }
} }
void component_context_menu_show (component_context_menu_t *cm) { void ui_components_context_menu_show (component_context_menu_t *cm) {
cm->row_selected = 0; cm->row_selected = 0;
cm->submenu = NULL; cm->submenu = NULL;
} }
bool component_context_menu_process (menu_t *menu, component_context_menu_t *cm) { bool ui_components_context_menu_process (menu_t *menu, component_context_menu_t *cm) {
if (!cm || (cm->row_selected < 0)) { if (!cm || (cm->row_selected < 0)) {
return false; return false;
} }
@ -46,7 +46,7 @@ bool component_context_menu_process (menu_t *menu, component_context_menu_t *cm)
} else if (menu->actions.enter) { } else if (menu->actions.enter) {
if (cm->list[cm->row_selected].submenu) { if (cm->list[cm->row_selected].submenu) {
cm->submenu = cm->list[cm->row_selected].submenu; cm->submenu = cm->list[cm->row_selected].submenu;
component_context_menu_init(cm->submenu); ui_components_context_menu_init(cm->submenu);
cm->submenu->row_selected = 0; cm->submenu->row_selected = 0;
cm->submenu->parent = cm; cm->submenu->parent = cm;
} else if (cm->list[cm->row_selected].action) { } else if (cm->list[cm->row_selected].action) {
@ -71,7 +71,7 @@ bool component_context_menu_process (menu_t *menu, component_context_menu_t *cm)
return true; return true;
} }
void component_context_menu_draw (component_context_menu_t *cm) { void ui_components_context_menu_draw (component_context_menu_t *cm) {
if (!cm || (cm->row_selected < 0)) { if (!cm || (cm->row_selected < 0)) {
return; return;
} }
@ -105,14 +105,14 @@ void component_context_menu_draw (component_context_menu_t *cm) {
int width = layout->bbox.x1 - layout->bbox.x0 + MESSAGEBOX_MARGIN; int width = layout->bbox.x1 - layout->bbox.x0 + MESSAGEBOX_MARGIN;
int height = layout->bbox.y1 - layout->bbox.y0 + MESSAGEBOX_MARGIN; int height = layout->bbox.y1 - layout->bbox.y0 + MESSAGEBOX_MARGIN;
component_dialog_draw(width, height); ui_components_dialog_draw(width, height);
int highlight_x0 = DISPLAY_CENTER_X - (width / 2); int highlight_x0 = DISPLAY_CENTER_X - (width / 2);
int highlight_x1 = DISPLAY_CENTER_X + (width / 2); int highlight_x1 = DISPLAY_CENTER_X + (width / 2);
int highlight_height = (layout->bbox.y1 - layout->bbox.y0) / layout->nlines; int highlight_height = (layout->bbox.y1 - layout->bbox.y0) / layout->nlines;
int highlight_y = VISIBLE_AREA_Y0 + layout->bbox.y0 + ((cm->row_selected) * highlight_height); int highlight_y = VISIBLE_AREA_Y0 + layout->bbox.y0 + ((cm->row_selected) * highlight_height);
component_box_draw( ui_components_box_draw(
highlight_x0, highlight_x0,
highlight_y, highlight_y,
highlight_x1, highlight_x1,

View File

@ -1,6 +1,6 @@
#include <stdlib.h> #include <stdlib.h>
#include "../components.h" #include "../ui_components.h"
#include "../fonts.h" #include "../fonts.h"
#include "constants.h" #include "constants.h"
@ -25,7 +25,7 @@ static int format_file_size (char *buffer, int64_t size) {
} }
void component_file_list_draw (entry_t *list, int entries, int selected) { void ui_components_file_list_draw (entry_t *list, int entries, int selected) {
int starting_position = 0; int starting_position = 0;
if (entries > LIST_ENTRIES && selected >= (LIST_ENTRIES / 2)) { if (entries > LIST_ENTRIES && selected >= (LIST_ENTRIES / 2)) {
@ -35,10 +35,10 @@ void component_file_list_draw (entry_t *list, int entries, int selected) {
} }
} }
component_list_scrollbar_draw(selected, entries, LIST_ENTRIES); ui_components_list_scrollbar_draw(selected, entries, LIST_ENTRIES);
if (entries == 0) { if (entries == 0) {
component_main_text_draw( ui_components_main_text_draw(
ALIGN_LEFT, VALIGN_TOP, ALIGN_LEFT, VALIGN_TOP,
"^%02X** empty directory **", "^%02X** empty directory **",
STL_GRAY STL_GRAY
@ -117,7 +117,7 @@ void component_file_list_draw (entry_t *list, int entries, int selected) {
int highlight_height = (layout->bbox.y1 - layout->bbox.y0) / layout->nlines; int highlight_height = (layout->bbox.y1 - layout->bbox.y0) / layout->nlines;
int highlight_y = VISIBLE_AREA_Y0 + TEXT_MARGIN_VERTICAL + TEXT_OFFSET_VERTICAL + ((selected - starting_position) * highlight_height); int highlight_y = VISIBLE_AREA_Y0 + TEXT_MARGIN_VERTICAL + TEXT_OFFSET_VERTICAL + ((selected - starting_position) * highlight_height);
component_box_draw( ui_components_box_draw(
FILE_LIST_HIGHLIGHT_X, FILE_LIST_HIGHLIGHT_X,
highlight_y, highlight_y,
FILE_LIST_HIGHLIGHT_X + FILE_LIST_HIGHLIGHT_WIDTH, FILE_LIST_HIGHLIGHT_X + FILE_LIST_HIGHLIGHT_WIDTH,

View File

@ -288,11 +288,11 @@ static component_context_menu_t settings_context_menu = {
}; };
static void process (menu_t *menu) { static void process (menu_t *menu) {
if (component_context_menu_process(menu, &entry_context_menu)) { if (ui_components_context_menu_process(menu, &entry_context_menu)) {
return; return;
} }
if (component_context_menu_process(menu, &settings_context_menu)) { if (ui_components_context_menu_process(menu, &settings_context_menu)) {
return; return;
} }
@ -353,10 +353,10 @@ static void process (menu_t *menu) {
} }
sound_play_effect(SFX_EXIT); sound_play_effect(SFX_EXIT);
} else if (menu->actions.options && menu->browser.entry) { } else if (menu->actions.options && menu->browser.entry) {
component_context_menu_show(&entry_context_menu); ui_components_context_menu_show(&entry_context_menu);
sound_play_effect(SFX_SETTING); sound_play_effect(SFX_SETTING);
} else if (menu->actions.settings) { } else if (menu->actions.settings) {
component_context_menu_show(&settings_context_menu); ui_components_context_menu_show(&settings_context_menu);
sound_play_effect(SFX_SETTING); sound_play_effect(SFX_SETTING);
} }
} }
@ -365,11 +365,11 @@ static void process (menu_t *menu) {
static void draw (menu_t *menu, surface_t *d) { static void draw (menu_t *menu, surface_t *d) {
rdpq_attach(d, NULL); rdpq_attach(d, NULL);
component_background_draw(); ui_components_background_draw();
component_layout_draw(); ui_components_layout_draw();
component_file_list_draw(menu->browser.list, menu->browser.entries, menu->browser.selected); ui_components_file_list_draw(menu->browser.list, menu->browser.entries, menu->browser.selected);
const char *action = NULL; const char *action = NULL;
@ -385,7 +385,7 @@ static void draw (menu_t *menu, surface_t *d) {
} }
} }
component_actions_bar_text_draw( ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP, ALIGN_LEFT, VALIGN_TOP,
"%s\n" "%s\n"
"^%02XB: Back^00", "^%02XB: Back^00",
@ -393,7 +393,7 @@ static void draw (menu_t *menu, surface_t *d) {
path_is_root(menu->browser.directory) ? STL_GRAY : STL_DEFAULT path_is_root(menu->browser.directory) ? STL_GRAY : STL_DEFAULT
); );
component_actions_bar_text_draw( ui_components_actions_bar_text_draw(
ALIGN_RIGHT, VALIGN_TOP, ALIGN_RIGHT, VALIGN_TOP,
"Start: Settings\n" "Start: Settings\n"
"^%02XR: Options^00", "^%02XR: Options^00",
@ -401,7 +401,7 @@ static void draw (menu_t *menu, surface_t *d) {
); );
if (menu->current_time >= 0) { if (menu->current_time >= 0) {
component_actions_bar_text_draw( ui_components_actions_bar_text_draw(
ALIGN_CENTER, VALIGN_TOP, ALIGN_CENTER, VALIGN_TOP,
"\n" "\n"
"%s", "%s",
@ -409,9 +409,9 @@ static void draw (menu_t *menu, surface_t *d) {
); );
} }
component_context_menu_draw(&entry_context_menu); ui_components_context_menu_draw(&entry_context_menu);
component_context_menu_draw(&settings_context_menu); ui_components_context_menu_draw(&settings_context_menu);
rdpq_detach_show(); rdpq_detach_show();
} }
@ -419,8 +419,8 @@ static void draw (menu_t *menu, surface_t *d) {
void view_browser_init (menu_t *menu) { void view_browser_init (menu_t *menu) {
if (!menu->browser.valid) { if (!menu->browser.valid) {
component_context_menu_init(&entry_context_menu); ui_components_context_menu_init(&entry_context_menu);
component_context_menu_init(&settings_context_menu); ui_components_context_menu_init(&settings_context_menu);
if (load_directory(menu)) { if (load_directory(menu)) {
path_free(menu->browser.directory); path_free(menu->browser.directory);
menu->browser.directory = path_init(menu->storage_prefix, ""); menu->browser.directory = path_init(menu->storage_prefix, "");

View File

@ -20,16 +20,16 @@ static void process (menu_t *menu) {
static void draw (menu_t *menu, surface_t *d) { static void draw (menu_t *menu, surface_t *d) {
rdpq_attach(d, NULL); rdpq_attach(d, NULL);
component_background_draw(); ui_components_background_draw();
component_layout_draw(); ui_components_layout_draw();
component_main_text_draw( ui_components_main_text_draw(
ALIGN_CENTER, VALIGN_TOP, ALIGN_CENTER, VALIGN_TOP,
"MENU INFORMATION" "MENU INFORMATION"
); );
component_main_text_draw( ui_components_main_text_draw(
ALIGN_LEFT, VALIGN_TOP, ALIGN_LEFT, VALIGN_TOP,
"\n" "\n"
"\n" "\n"
@ -54,7 +54,7 @@ static void draw (menu_t *menu, surface_t *d) {
BUILD_TIMESTAMP BUILD_TIMESTAMP
); );
component_actions_bar_text_draw( ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP, ALIGN_LEFT, VALIGN_TOP,
"\n" "\n"
"B: Exit" "B: Exit"

View File

@ -12,12 +12,12 @@ static void process (menu_t *menu) {
static void draw (menu_t *menu, surface_t *d) { static void draw (menu_t *menu, surface_t *d) {
rdpq_attach(d, NULL); rdpq_attach(d, NULL);
component_background_draw(); ui_components_background_draw();
if (menu->error_message) { if (menu->error_message) {
component_messagebox_draw(menu->error_message); ui_components_messagebox_draw(menu->error_message);
} else { } else {
component_messagebox_draw("Unspecified error"); ui_components_messagebox_draw("Unspecified error");
} }
rdpq_detach_show(); rdpq_detach_show();

View File

@ -13,7 +13,7 @@ static void draw (menu_t *menu, surface_t *d) {
"SummerCart64: 2.17.0+" "SummerCart64: 2.17.0+"
); );
component_messagebox_draw( ui_components_messagebox_draw(
"UNRECOVERABLE ERROR\n" "UNRECOVERABLE ERROR\n"
"\n" "\n"
"%s\n" "%s\n"

View File

@ -58,11 +58,11 @@ static void process (menu_t *menu) {
static void draw (menu_t *menu, surface_t *d) { static void draw (menu_t *menu, surface_t *d) {
rdpq_attach(d, NULL); rdpq_attach(d, NULL);
component_background_draw(); ui_components_background_draw();
component_layout_draw(); ui_components_layout_draw();
component_main_text_draw( ui_components_main_text_draw(
ALIGN_CENTER, VALIGN_TOP, ALIGN_CENTER, VALIGN_TOP,
"ENTRY INFORMATION\n" "ENTRY INFORMATION\n"
"\n" "\n"
@ -70,7 +70,7 @@ static void draw (menu_t *menu, surface_t *d) {
menu->browser.entry->name menu->browser.entry->name
); );
component_main_text_draw( ui_components_main_text_draw(
ALIGN_LEFT, VALIGN_TOP, ALIGN_LEFT, VALIGN_TOP,
"\n" "\n"
"\n" "\n"
@ -87,7 +87,7 @@ static void draw (menu_t *menu, surface_t *d) {
ctime(&st.st_mtime) ctime(&st.st_mtime)
); );
component_actions_bar_text_draw( ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP, ALIGN_LEFT, VALIGN_TOP,
"\n" "\n"
"B: Exit" "B: Exit"

View File

@ -36,18 +36,18 @@ static void process (menu_t *menu) {
static void draw (menu_t *menu, surface_t *d) { static void draw (menu_t *menu, surface_t *d) {
rdpq_attach(d, NULL); rdpq_attach(d, NULL);
component_background_draw(); ui_components_background_draw();
component_layout_draw(); ui_components_layout_draw();
component_main_text_draw( ui_components_main_text_draw(
ALIGN_CENTER, VALIGN_TOP, ALIGN_CENTER, VALIGN_TOP,
"FLASHCART INFORMATION" "FLASHCART INFORMATION"
"\n" "\n"
"\n" "\n"
); );
component_main_text_draw( ui_components_main_text_draw(
ALIGN_LEFT, VALIGN_TOP, ALIGN_LEFT, VALIGN_TOP,
"\n" "\n"
"\n" "\n"
@ -78,7 +78,7 @@ static void draw (menu_t *menu, surface_t *d) {
//format_diagnostic_data(flashcart_has_feature(FLASHCART_FEATURE_DIAGNOSTIC_DATA)) //format_diagnostic_data(flashcart_has_feature(FLASHCART_FEATURE_DIAGNOSTIC_DATA))
); );
component_actions_bar_text_draw( ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP, ALIGN_LEFT, VALIGN_TOP,
"\n" "\n"
"B: Back" "B: Back"

View File

@ -58,9 +58,9 @@ static void draw (menu_t *menu, surface_t *d) {
if (!image) { if (!image) {
rdpq_attach(d, NULL); rdpq_attach(d, NULL);
component_background_draw(); ui_components_background_draw();
component_loader_draw(png_decoder_get_progress()); ui_components_loader_draw(png_decoder_get_progress());
} else { } else {
rdpq_attach_clear(d, NULL); rdpq_attach_clear(d, NULL);
@ -73,13 +73,13 @@ static void draw (menu_t *menu, surface_t *d) {
rdpq_mode_pop(); rdpq_mode_pop();
if (show_message) { if (show_message) {
component_messagebox_draw( ui_components_messagebox_draw(
"Set \"%s\" as background image?\n\n" "Set \"%s\" as background image?\n\n"
"A: Yes, B: Back", "A: Yes, B: Back",
menu->browser.entry->name menu->browser.entry->name
); );
} else if (image_set_as_background) { } else if (image_set_as_background) {
component_messagebox_draw("Preparing background…"); ui_components_messagebox_draw("Preparing background…");
} }
} }
@ -93,7 +93,7 @@ static void deinit (menu_t *menu) {
if (image) { if (image) {
if (image_set_as_background) { if (image_set_as_background) {
component_background_replace_image(image); ui_components_background_replace_image(image);
} else { } else {
surface_free(image); surface_free(image);
free(image); free(image);

View File

@ -45,14 +45,14 @@ static void process (menu_t *menu) {
static void draw (menu_t *menu, surface_t *d) { static void draw (menu_t *menu, surface_t *d) {
rdpq_attach(d, NULL); rdpq_attach(d, NULL);
component_background_draw(); ui_components_background_draw();
if (menu->boot_pending.disk_file) { if (menu->boot_pending.disk_file) {
component_loader_draw(0.0f); ui_components_loader_draw(0.0f);
} else { } else {
component_layout_draw(); ui_components_layout_draw();
component_main_text_draw( ui_components_main_text_draw(
ALIGN_CENTER, VALIGN_TOP, ALIGN_CENTER, VALIGN_TOP,
"64DD disk information\n" "64DD disk information\n"
"\n" "\n"
@ -60,7 +60,7 @@ static void draw (menu_t *menu, surface_t *d) {
menu->browser.entry->name menu->browser.entry->name
); );
component_main_text_draw( ui_components_main_text_draw(
ALIGN_LEFT, VALIGN_TOP, ALIGN_LEFT, VALIGN_TOP,
"\n" "\n"
"\n" "\n"
@ -80,21 +80,21 @@ static void draw (menu_t *menu, surface_t *d) {
menu->load.rom_path ? path_last_get(menu->load.rom_path) : "" menu->load.rom_path ? path_last_get(menu->load.rom_path) : ""
); );
component_actions_bar_text_draw( ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP, ALIGN_LEFT, VALIGN_TOP,
"A: Load and run 64DD disk\n" "A: Load and run 64DD disk\n"
"B: Exit" "B: Exit"
); );
if (menu->load.rom_path) { if (menu->load.rom_path) {
component_actions_bar_text_draw( ui_components_actions_bar_text_draw(
ALIGN_RIGHT, VALIGN_TOP, ALIGN_RIGHT, VALIGN_TOP,
"R: Load with ROM" "R: Load with ROM"
); );
} }
if (boxart != NULL) { if (boxart != NULL) {
component_boxart_draw(boxart); ui_components_boxart_draw(boxart);
} }
} }
@ -107,9 +107,9 @@ static void draw_progress (float progress) {
if (d) { if (d) {
rdpq_attach(d, NULL); rdpq_attach(d, NULL);
component_background_draw(); ui_components_background_draw();
component_loader_draw(progress); ui_components_loader_draw(progress);
rdpq_detach_show(); rdpq_detach_show();
} }
@ -153,7 +153,7 @@ static void load (menu_t *menu) {
} }
static void deinit (void) { static void deinit (void) {
component_boxart_free(boxart); ui_components_boxart_free(boxart);
} }
void view_load_disk_init (menu_t *menu) { void view_load_disk_init (menu_t *menu) {
@ -172,7 +172,7 @@ void view_load_disk_init (menu_t *menu) {
return; return;
} }
boxart = component_boxart_init(menu->storage_prefix, menu->load.disk_info.id, IMAGE_BOXART_FRONT); boxart = ui_components_boxart_init(menu->storage_prefix, menu->load.disk_info.id, IMAGE_BOXART_FRONT);
} }
void view_load_disk_display (menu_t *menu, surface_t *display) { void view_load_disk_display (menu_t *menu, surface_t *display) {

View File

@ -43,19 +43,19 @@ static void process (menu_t *menu) {
static void draw (menu_t *menu, surface_t *d) { static void draw (menu_t *menu, surface_t *d) {
rdpq_attach(d, NULL); rdpq_attach(d, NULL);
component_background_draw(); ui_components_background_draw();
if (menu->boot_pending.emulator_file) { if (menu->boot_pending.emulator_file) {
component_loader_draw(0.0f); ui_components_loader_draw(0.0f);
} else { } else {
component_layout_draw(); ui_components_layout_draw();
component_main_text_draw( ui_components_main_text_draw(
ALIGN_CENTER, VALIGN_TOP, ALIGN_CENTER, VALIGN_TOP,
"Load Emulated ROM\n" "Load Emulated ROM\n"
); );
component_main_text_draw( ui_components_main_text_draw(
ALIGN_LEFT, VALIGN_TOP, ALIGN_LEFT, VALIGN_TOP,
"\n" "\n"
"\n" "\n"
@ -65,7 +65,7 @@ static void draw (menu_t *menu, surface_t *d) {
menu->browser.entry->name menu->browser.entry->name
); );
component_actions_bar_text_draw( ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP, ALIGN_LEFT, VALIGN_TOP,
"A: Load and run Emulated ROM\n" "A: Load and run Emulated ROM\n"
"B: Exit" "B: Exit"
@ -81,9 +81,9 @@ static void draw_progress (float progress) {
if (d) { if (d) {
rdpq_attach(d, NULL); rdpq_attach(d, NULL);
component_background_draw(); ui_components_background_draw();
component_loader_draw(progress); ui_components_loader_draw(progress);
rdpq_detach_show(); rdpq_detach_show();
} }

View File

@ -203,7 +203,7 @@ static component_context_menu_t options_context_menu = { .list = {
}}; }};
static void process (menu_t *menu) { static void process (menu_t *menu) {
if (component_context_menu_process(menu, &options_context_menu)) { if (ui_components_context_menu_process(menu, &options_context_menu)) {
return; return;
} }
@ -213,7 +213,7 @@ static void process (menu_t *menu) {
sound_play_effect(SFX_EXIT); sound_play_effect(SFX_EXIT);
menu->next_mode = MENU_MODE_BROWSER; menu->next_mode = MENU_MODE_BROWSER;
} else if (menu->actions.options) { } else if (menu->actions.options) {
component_context_menu_show(&options_context_menu); ui_components_context_menu_show(&options_context_menu);
sound_play_effect(SFX_SETTING); sound_play_effect(SFX_SETTING);
} else if (menu->actions.lz_context) { } else if (menu->actions.lz_context) {
if (show_extra_info_message) { if (show_extra_info_message) {
@ -228,14 +228,14 @@ static void process (menu_t *menu) {
static void draw (menu_t *menu, surface_t *d) { static void draw (menu_t *menu, surface_t *d) {
rdpq_attach(d, NULL); rdpq_attach(d, NULL);
component_background_draw(); ui_components_background_draw();
if (menu->boot_pending.rom_file) { if (menu->boot_pending.rom_file) {
component_loader_draw(0.0f); ui_components_loader_draw(0.0f);
} else { } else {
component_layout_draw(); ui_components_layout_draw();
component_main_text_draw( ui_components_main_text_draw(
ALIGN_CENTER, VALIGN_TOP, ALIGN_CENTER, VALIGN_TOP,
"N64 ROM information\n" "N64 ROM information\n"
"\n" "\n"
@ -243,7 +243,7 @@ static void draw (menu_t *menu, surface_t *d) {
menu->browser.entry->name menu->browser.entry->name
); );
component_main_text_draw( ui_components_main_text_draw(
ALIGN_LEFT, VALIGN_TOP, ALIGN_LEFT, VALIGN_TOP,
"\n" "\n"
"\n" "\n"
@ -262,24 +262,24 @@ static void draw (menu_t *menu, surface_t *d) {
format_rom_save_type(rom_info_get_save_type(&menu->load.rom_info), menu->load.rom_info.features.controller_pak) format_rom_save_type(rom_info_get_save_type(&menu->load.rom_info), menu->load.rom_info.features.controller_pak)
); );
component_actions_bar_text_draw( ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP, ALIGN_LEFT, VALIGN_TOP,
"A: Load and run ROM\n" "A: Load and run ROM\n"
"B: Back" "B: Back"
); );
component_actions_bar_text_draw( ui_components_actions_bar_text_draw(
ALIGN_RIGHT, VALIGN_TOP, ALIGN_RIGHT, VALIGN_TOP,
"L|Z: Extra Info\n" "L|Z: Extra Info\n"
"R: Options" "R: Options"
); );
if (boxart != NULL) { if (boxart != NULL) {
component_boxart_draw(boxart); ui_components_boxart_draw(boxart);
} }
if (show_extra_info_message) { if (show_extra_info_message) {
component_messagebox_draw( ui_components_messagebox_draw(
"EXTRA ROM INFO\n" "EXTRA ROM INFO\n"
"\n" "\n"
"Endianness: %s\n" "Endianness: %s\n"
@ -306,7 +306,7 @@ static void draw (menu_t *menu, surface_t *d) {
); );
} }
component_context_menu_draw(&options_context_menu); ui_components_context_menu_draw(&options_context_menu);
} }
rdpq_detach_show(); rdpq_detach_show();
@ -318,9 +318,9 @@ static void draw_progress (float progress) {
if (d) { if (d) {
rdpq_attach(d, NULL); rdpq_attach(d, NULL);
component_background_draw(); ui_components_background_draw();
component_loader_draw(progress); ui_components_loader_draw(progress);
rdpq_detach_show(); rdpq_detach_show();
} }
@ -348,7 +348,7 @@ static void load (menu_t *menu) {
} }
static void deinit (void) { static void deinit (void) {
component_boxart_free(boxart); ui_components_boxart_free(boxart);
boxart = NULL; boxart = NULL;
} }
@ -371,8 +371,8 @@ void view_load_rom_init (menu_t *menu) {
} }
if (!menu->settings.rom_autoload_enabled) { if (!menu->settings.rom_autoload_enabled) {
boxart = component_boxart_init(menu->storage_prefix, menu->load.rom_info.game_code, IMAGE_BOXART_FRONT); boxart = ui_components_boxart_init(menu->storage_prefix, menu->load.rom_info.game_code, IMAGE_BOXART_FRONT);
component_context_menu_init(&options_context_menu); ui_components_context_menu_init(&options_context_menu);
} }
} }

View File

@ -61,13 +61,13 @@ static void process (menu_t *menu) {
static void draw (menu_t *menu, surface_t *d) { static void draw (menu_t *menu, surface_t *d) {
rdpq_attach(d, NULL); rdpq_attach(d, NULL);
component_background_draw(); ui_components_background_draw();
component_layout_draw(); ui_components_layout_draw();
component_seekbar_draw(mp3player_get_progress()); ui_components_seekbar_draw(mp3player_get_progress());
component_main_text_draw( ui_components_main_text_draw(
ALIGN_CENTER, VALIGN_TOP, ALIGN_CENTER, VALIGN_TOP,
"MUSIC PLAYER\n" "MUSIC PLAYER\n"
"\n" "\n"
@ -83,7 +83,7 @@ static void draw (menu_t *menu, surface_t *d) {
mp3player_get_duration() mp3player_get_duration()
); );
component_main_text_draw( ui_components_main_text_draw(
ALIGN_LEFT, VALIGN_TOP, ALIGN_LEFT, VALIGN_TOP,
"\n" "\n"
"\n" "\n"
@ -102,7 +102,7 @@ static void draw (menu_t *menu, surface_t *d) {
mp3player_get_samplerate() mp3player_get_samplerate()
); );
component_actions_bar_text_draw( ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP, ALIGN_LEFT, VALIGN_TOP,
"A: %s\n" "A: %s\n"
"B: Exit | Left / Right: Rewind / Fast forward", "B: Exit | Left / Right: Rewind / Fast forward",

View File

@ -110,7 +110,7 @@ void component_editdatetime_draw ( struct tm t, rtc_field_t selected_field ) {
snprintf( current_selection_chars, sizeof(current_selection_chars), "******************^^^^*****"); snprintf( current_selection_chars, sizeof(current_selection_chars), "******************^^^^*****");
break; break;
} }
component_messagebox_draw( ui_components_messagebox_draw(
"|YYYY|MM|DD|HH|MM|SS| DOW\n%s\n%s\n", full_dt, current_selection_chars); "|YYYY|MM|DD|HH|MM|SS| DOW\n%s\n%s\n", full_dt, current_selection_chars);
} }
@ -165,14 +165,14 @@ static void process (menu_t *menu) {
static void draw (menu_t *menu, surface_t *d) { static void draw (menu_t *menu, surface_t *d) {
rdpq_attach(d, NULL); rdpq_attach(d, NULL);
component_background_draw(); ui_components_background_draw();
component_layout_draw(); ui_components_layout_draw();
if (!is_editing_mode) { if (!is_editing_mode) {
if( menu->current_time >= 0 ) { if( menu->current_time >= 0 ) {
component_main_text_draw( ui_components_main_text_draw(
ALIGN_CENTER, VALIGN_TOP, ALIGN_CENTER, VALIGN_TOP,
"ADJUST REAL TIME CLOCK\n" "ADJUST REAL TIME CLOCK\n"
"\n" "\n"
@ -186,7 +186,7 @@ static void draw (menu_t *menu, surface_t *d) {
menu->current_time >= 0 ? ctime(&menu->current_time) : "Unknown" menu->current_time >= 0 ? ctime(&menu->current_time) : "Unknown"
); );
component_actions_bar_text_draw( ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP, ALIGN_LEFT, VALIGN_TOP,
"A: Change\n" "A: Change\n"
"B: Back" "B: Back"
@ -194,7 +194,7 @@ static void draw (menu_t *menu, surface_t *d) {
} }
else { else {
component_main_text_draw( ui_components_main_text_draw(
ALIGN_CENTER, VALIGN_TOP, ALIGN_CENTER, VALIGN_TOP,
"ADJUST REAL TIME CLOCK\n" "ADJUST REAL TIME CLOCK\n"
"\n" "\n"
@ -206,7 +206,7 @@ static void draw (menu_t *menu, surface_t *d) {
menu->current_time >= 0 ? ctime(&menu->current_time) : "Unknown" menu->current_time >= 0 ? ctime(&menu->current_time) : "Unknown"
); );
component_actions_bar_text_draw( ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP, ALIGN_LEFT, VALIGN_TOP,
"\n" "\n"
"B: Back" "B: Back"
@ -214,12 +214,12 @@ static void draw (menu_t *menu, surface_t *d) {
} }
} }
else { else {
component_actions_bar_text_draw( ui_components_actions_bar_text_draw(
ALIGN_RIGHT, VALIGN_TOP, ALIGN_RIGHT, VALIGN_TOP,
"Up/Down: Adjust Field\n" "Up/Down: Adjust Field\n"
"Left/Right: Switch Field" "Left/Right: Switch Field"
); );
component_actions_bar_text_draw( ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP, ALIGN_LEFT, VALIGN_TOP,
"R: Save\n" "R: Save\n"
"B: Back" "B: Back"

View File

@ -106,12 +106,12 @@ static component_context_menu_t options_context_menu = { .list = {
static void process (menu_t *menu) { static void process (menu_t *menu) {
if (component_context_menu_process(menu, &options_context_menu)) { if (ui_components_context_menu_process(menu, &options_context_menu)) {
return; return;
} }
if (menu->actions.enter) { if (menu->actions.enter) {
component_context_menu_show(&options_context_menu); ui_components_context_menu_show(&options_context_menu);
sound_play_effect(SFX_SETTING); sound_play_effect(SFX_SETTING);
} else if (menu->actions.back) { } else if (menu->actions.back) {
sound_play_effect(SFX_EXIT); sound_play_effect(SFX_EXIT);
@ -122,17 +122,17 @@ static void process (menu_t *menu) {
static void draw (menu_t *menu, surface_t *d) { static void draw (menu_t *menu, surface_t *d) {
rdpq_attach(d, NULL); rdpq_attach(d, NULL);
component_background_draw(); ui_components_background_draw();
component_layout_draw(); ui_components_layout_draw();
component_main_text_draw( ui_components_main_text_draw(
ALIGN_CENTER, VALIGN_TOP, ALIGN_CENTER, VALIGN_TOP,
"MENU SETTINGS EDITOR\n" "MENU SETTINGS EDITOR\n"
"\n" "\n"
); );
component_main_text_draw( ui_components_main_text_draw(
ALIGN_LEFT, VALIGN_TOP, ALIGN_LEFT, VALIGN_TOP,
"\n\n" "\n\n"
" Default Directory : %s\n\n" " Default Directory : %s\n\n"
@ -163,13 +163,13 @@ static void draw (menu_t *menu, surface_t *d) {
); );
component_actions_bar_text_draw( ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP, ALIGN_LEFT, VALIGN_TOP,
"A: Change\n" "A: Change\n"
"B: Back" "B: Back"
); );
component_context_menu_draw(&options_context_menu); ui_components_context_menu_draw(&options_context_menu);
rdpq_detach_show(); rdpq_detach_show();
} }
@ -177,7 +177,7 @@ static void draw (menu_t *menu, surface_t *d) {
void view_settings_init (menu_t *menu) { void view_settings_init (menu_t *menu) {
component_context_menu_init(&options_context_menu); ui_components_context_menu_init(&options_context_menu);
} }

View File

@ -36,16 +36,16 @@ static void process (menu_t *menu) {
static void draw (menu_t *menu, surface_t *d) { static void draw (menu_t *menu, surface_t *d) {
rdpq_attach(d, NULL); rdpq_attach(d, NULL);
component_background_draw(); ui_components_background_draw();
component_layout_draw(); ui_components_layout_draw();
component_main_text_draw( ui_components_main_text_draw(
ALIGN_CENTER, VALIGN_TOP, ALIGN_CENTER, VALIGN_TOP,
"N64 SYSTEM INFORMATION" "N64 SYSTEM INFORMATION"
); );
component_main_text_draw( ui_components_main_text_draw(
ALIGN_LEFT, VALIGN_TOP, ALIGN_LEFT, VALIGN_TOP,
"\n" "\n"
"\n" "\n"
@ -65,7 +65,7 @@ static void draw (menu_t *menu, surface_t *d) {
(joypad[3]) ? "" : "not ", format_accessory(3) (joypad[3]) ? "" : "not ", format_accessory(3)
); );
component_actions_bar_text_draw( ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP, ALIGN_LEFT, VALIGN_TOP,
"\n" "\n"
"B: Exit" "B: Exit"

View File

@ -1,7 +1,7 @@
#include <stdio.h> #include <stdio.h>
#include <sys/stat.h> #include <sys/stat.h>
#include "../components/constants.h" #include "../ui_components/constants.h"
#include "../fonts.h" #include "../fonts.h"
#include "../sound.h" #include "../sound.h"
#include "utils/utils.h" #include "utils/utils.h"
@ -69,19 +69,19 @@ static void process (menu_t *menu) {
static void draw (menu_t *menu, surface_t *d) { static void draw (menu_t *menu, surface_t *d) {
rdpq_attach(d, NULL); rdpq_attach(d, NULL);
component_background_draw(); ui_components_background_draw();
component_layout_draw(); ui_components_layout_draw();
component_main_text_draw( ui_components_main_text_draw(
ALIGN_LEFT, VALIGN_TOP, ALIGN_LEFT, VALIGN_TOP,
"%s\n", "%s\n",
text->contents + text->offset text->contents + text->offset
); );
component_list_scrollbar_draw(text->current_line, text->lines, LIST_ENTRIES); ui_components_list_scrollbar_draw(text->current_line, text->lines, LIST_ENTRIES);
component_actions_bar_text_draw( ui_components_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP, ALIGN_LEFT, VALIGN_TOP,
"^%02XUp / Down: Scroll^00\n" "^%02XUp / Down: Scroll^00\n"
"B: Back", "B: Back",

View File

@ -8,7 +8,7 @@
#define VIEWS_H__ #define VIEWS_H__
#include "../components.h" #include "../ui_components.h"
#include "../menu_state.h" #include "../menu_state.h"