mirror of
https://github.com/Polprzewodnikowy/N64FlashcartMenu.git
synced 2024-11-21 18:19:19 +01:00
Update menu views (#19)
<!--- Provide a general summary of your changes in the Title above --> ## Description Based on #16 this updates the other views to use RDPQ. ## Motivation and Context <!--- What does this sample do? What problem does it solve? --> <!--- If it fixes/closes/resolves an open issue, please link to the issue here --> Aligns all views and makes them easier to convert if needed. ## How Has This Been Tested? <!-- (if applicable) --> <!--- Please describe in detail how you tested your sample/changes. --> <!--- Include details of your testing environment, and the tests you ran to --> <!--- see how your change affects other areas of the code, etc. --> ## Screenshots <!-- (if appropriate): --> ## Types of changes <!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [x] Improvement (non-breaking change that adds a new feature) - [ ] Bug fix (fixes an issue) - [ ] Breaking change (breaking change) - [ ] Config and build (change in the configuration and build system, has no impact on code or features) ## Checklist: <!--- Go over all the following points, and put an `x` in all the boxes that apply. --> <!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> - [ ] My code follows the code style of this project. - [ ] My change requires a change to the documentation. - [ ] I have updated the documentation accordingly. - [ ] I have added tests to cover my changes. - [ ] All new and existing tests passed. <!--- It would be nice if you could sign off your contribution by replacing the name with your GitHub user name and GitHub email contact. --> Signed-off-by: GITHUB_USER <GITHUB_USER_EMAIL>
This commit is contained in:
parent
f235f25205
commit
df6d9265a0
@ -82,3 +82,10 @@ To update to the latest version, use `git submodule update --remote ` from the t
|
||||
# Generate documentation
|
||||
Run `doxygen` from the dev container terminal.
|
||||
Make sure you fix the warnings before creating a PR!
|
||||
|
||||
|
||||
# OSS licenses used for libraries
|
||||
* UNLICENSE (libdragon)
|
||||
* BSD 2-Clause (libspng)
|
||||
* CC0 1.0 Universal (minimp3)
|
||||
* Permissive, unspecific (miniz)
|
||||
|
@ -1,21 +0,0 @@
|
||||
/**
|
||||
* @file menu_res_setup.h
|
||||
* @brief Menu Resolution (non RDPQ)
|
||||
* @ingroup menu
|
||||
*/
|
||||
|
||||
#ifndef MENU_RES_SETUP_H__
|
||||
#define MENU_RES_SETUP_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
static const int16_t font_vertical_pixels = 8;
|
||||
static const int16_t overscan_vertical_pixels = 24;
|
||||
static const int16_t vertical_start_position = overscan_vertical_pixels / 2;
|
||||
|
||||
static const int16_t font_horizontal_pixels = 8;
|
||||
static const int16_t overscan_horizontal_pixels = 32;
|
||||
static const int16_t horizontal_start_position = overscan_horizontal_pixels + font_horizontal_pixels;
|
||||
static const int16_t horizontal_indent = horizontal_start_position + (font_horizontal_pixels * 2);
|
||||
|
||||
#endif
|
@ -1,11 +1,11 @@
|
||||
#include <libdragon.h>
|
||||
|
||||
#include "../menu_res_setup.h"
|
||||
#include "fragments/fragments.h"
|
||||
#include "views.h"
|
||||
|
||||
|
||||
#ifndef MENU_VERSION
|
||||
#define MENU_VERSION "0.0.0.4"
|
||||
#define MENU_VERSION "0.0.0.5.ALPHA"
|
||||
#endif
|
||||
|
||||
|
||||
@ -16,37 +16,52 @@ static void process (menu_t *menu) {
|
||||
}
|
||||
|
||||
static void draw (menu_t *menu, surface_t *d) {
|
||||
graphics_fill_screen(d, 0x00);
|
||||
layout_t *layout = layout_get();
|
||||
|
||||
graphics_draw_text(d, (d->width / 2) - 64, vertical_start_position, "MENU INFORMATION"); // centre = numchars * font_horizontal_pixels / 2
|
||||
graphics_draw_line(d, 0, 30, d->width, 30, 0xff);
|
||||
const int text_x = layout->offset_x + layout->offset_text_x;
|
||||
int text_y = layout->offset_y + layout->offset_text_y;
|
||||
|
||||
int16_t vertical_position = 40;
|
||||
const color_t bg_color = RGBA32(0x00, 0x00, 0x00, 0xFF);
|
||||
const color_t text_color = RGBA32(0xFF, 0xFF, 0xFF, 0xFF);
|
||||
|
||||
graphics_draw_text(d, horizontal_start_position, vertical_position, "Menu Revision: V");
|
||||
graphics_draw_text(d, horizontal_start_position + 16 * 8, vertical_position, MENU_VERSION);
|
||||
vertical_position += (font_vertical_pixels * 2);
|
||||
graphics_draw_text(d, horizontal_start_position, vertical_position, "Authors:");
|
||||
graphics_draw_text(d, horizontal_indent, vertical_position += font_vertical_pixels, "JonesAlmighty / NetworkFusion");
|
||||
graphics_draw_text(d, horizontal_indent, vertical_position += font_vertical_pixels, "korgeaux / Polprzewodnikowy");
|
||||
vertical_position += (font_vertical_pixels * 2);
|
||||
graphics_draw_text(d, horizontal_start_position, vertical_position += font_vertical_pixels, "Credits:");
|
||||
graphics_draw_text(d, horizontal_indent, vertical_position += font_vertical_pixels, "N64Brew / libdragon contributors.");
|
||||
vertical_position += (font_vertical_pixels * 2);
|
||||
graphics_draw_text(d, horizontal_start_position, vertical_position += font_vertical_pixels, "Github:");
|
||||
// graphics_draw_text(d, horizontal_indent, vertical_position += font_vertical_pixels, "https://github.com/Polprzewodnikowy/SummerCart64");
|
||||
graphics_draw_text(d, horizontal_indent, vertical_position += font_vertical_pixels, "https://github.com/Polprzewodnikowy/N64FlashcartMenu");
|
||||
graphics_draw_text(d, horizontal_indent, vertical_position += font_vertical_pixels, "https://github.com/NetworkFusion/N64FlashcartMenu");
|
||||
//graphics_draw_text(d, horizontal_indent, vertical_position += font_vertical_pixels, "https://github.com/dragonminded/libdragon");
|
||||
vertical_position += (font_vertical_pixels * 2);
|
||||
graphics_draw_text(d, horizontal_start_position, vertical_position, "OSS licenses used:");
|
||||
graphics_draw_text(d, horizontal_indent,vertical_position += font_vertical_pixels, "UNLICENSE");
|
||||
graphics_draw_text(d, horizontal_indent,vertical_position += font_vertical_pixels, "MIT");
|
||||
rdpq_attach(d, NULL);
|
||||
rdpq_clear(bg_color);
|
||||
|
||||
graphics_draw_line(d, 0, d->height - overscan_vertical_pixels - font_vertical_pixels, d->width,d->height - overscan_vertical_pixels - font_vertical_pixels, 0xff);
|
||||
graphics_draw_text(d, (d->width / 2) - 80,d->height - overscan_vertical_pixels, "Press (B) to return!"); // centre = numchars * font_horizontal_pixels / 2
|
||||
// Layout
|
||||
fragment_borders(d);
|
||||
|
||||
display_show(d);
|
||||
// Text start
|
||||
fragment_text_start(text_color);
|
||||
|
||||
text_y += fragment_textf((d->width / 2) - 76, text_y, "MENU INFORMATION");
|
||||
|
||||
text_y += fragment_textf(text_x, text_y, "\n");
|
||||
|
||||
text_y += fragment_textf(text_x, text_y, "Menu Revision: V%s", MENU_VERSION);
|
||||
text_y += fragment_textf(text_x, text_y, "\n");
|
||||
text_y += fragment_textf(text_x, text_y, "Authors:");
|
||||
text_y += fragment_textf(text_x, text_y, " JonesAlmighty / NetworkFusion");
|
||||
text_y += fragment_textf(text_x, text_y, " korgeaux / Polprzewodnikowy");
|
||||
text_y += fragment_textf(text_x, text_y, "\n");
|
||||
text_y += fragment_textf(text_x, text_y, "Credits:");
|
||||
text_y += fragment_textf(text_x, text_y, " N64Brew / libdragon contributors.");
|
||||
text_y += fragment_textf(text_x, text_y, "\n");
|
||||
text_y += fragment_textf(text_x, text_y, "Github:");
|
||||
text_y += fragment_textf(text_x, text_y, " https://github.com/Polprzewodnikowy/N64FlashcartMenu");
|
||||
text_y += fragment_textf(text_x, text_y, "\n");
|
||||
text_y += fragment_textf(text_x, text_y, "OSS licenses used:");
|
||||
text_y += fragment_textf(text_x, text_y, " UNLICENSE"); /* libdragon license */
|
||||
text_y += fragment_textf(text_x, text_y, " MIT");
|
||||
text_y += fragment_textf(text_x, text_y, " BSD 2-Clause"); /* libspng license */
|
||||
text_y += fragment_textf(text_x, text_y, " CC0 1.0 Universal"); /* minimp3 license */
|
||||
// text_y += fragment_textf(text_x, text_y, " Permissive, unspecific"); /* miniz license */
|
||||
|
||||
|
||||
// Actions bar
|
||||
text_y = layout->actions_y + layout->offset_text_y;
|
||||
text_y += fragment_textf(text_x, text_y, "B: Exit");
|
||||
|
||||
rdpq_detach_show();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include <libdragon.h>
|
||||
|
||||
#include "../menu_res_setup.h"
|
||||
#include "views.h"
|
||||
|
||||
|
||||
@ -13,7 +12,7 @@ static void process (menu_t *menu) {
|
||||
static void draw (menu_t *menu, surface_t *d) {
|
||||
graphics_fill_screen(d, graphics_make_color(0, 0, 0, 255));
|
||||
|
||||
graphics_draw_text(d, overscan_horizontal_pixels, overscan_vertical_pixels, "ERROR!");
|
||||
graphics_draw_text(d, 40, 32, "ERROR!");
|
||||
|
||||
display_show(d);
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "../png_decoder.h"
|
||||
#include "../rom_database.h"
|
||||
#include "fragments/fragments.h"
|
||||
#include "utils/fs.h"
|
||||
#include "utils/str_utils.h"
|
||||
#include "views.h"
|
||||
|
||||
@ -14,6 +15,7 @@
|
||||
|
||||
|
||||
static FILINFO info;
|
||||
static const char *n64_rom_extensions[] = { "z64", "n64", "v64", NULL };
|
||||
static rom_header_t rom_header;
|
||||
static surface_t *boxart_image;
|
||||
static rspq_block_t *cached_boxart_image_dl;
|
||||
@ -316,8 +318,7 @@ static void draw (menu_t *menu, surface_t *d) {
|
||||
fragment_text_start(text_color);
|
||||
|
||||
|
||||
if (strcmp(format_file_type(), "N64 ROM") == 0) {
|
||||
|
||||
if (file_has_extensions(info.fname, n64_rom_extensions)) {
|
||||
menu_fileinfo_draw_n64_rom_info(d, layout);
|
||||
}
|
||||
else {
|
||||
@ -359,7 +360,7 @@ void view_file_info_init (menu_t *menu) {
|
||||
if (f_stat(path_get(file), &info) != FR_OK) {
|
||||
menu->next_mode = MENU_MODE_ERROR;
|
||||
}
|
||||
if (strcmp(format_file_type(), "N64 ROM") == 0) {
|
||||
if (file_has_extensions(info.fname, n64_rom_extensions)) {
|
||||
rom_header = file_read_rom_header(path_get(file));
|
||||
|
||||
boxart_image_load(rom_header.metadata.unique_identifier);
|
||||
|
@ -1,8 +1,7 @@
|
||||
#include <time.h>
|
||||
|
||||
#include <libdragon.h>
|
||||
|
||||
#include "../menu_res_setup.h"
|
||||
#include "fragments/fragments.h"
|
||||
#include "views.h"
|
||||
|
||||
|
||||
@ -30,66 +29,70 @@ static void process (menu_t *menu) {
|
||||
}
|
||||
|
||||
static void draw (menu_t *menu, surface_t *d) {
|
||||
char str_buffer[512];
|
||||
|
||||
graphics_fill_screen(d, 0x00);
|
||||
layout_t *layout = layout_get();
|
||||
|
||||
graphics_draw_text(d, (d->width / 2) - 64, vertical_start_position, "N64 SYSTEM INFORMATION"); // centre = numchars * font_horizontal_pixels / 2
|
||||
graphics_draw_line(d, 0, 30, d->width, 30, 0xff);
|
||||
const int text_x = layout->offset_x + layout->offset_text_x;
|
||||
int text_y = layout->offset_y + layout->offset_text_y;
|
||||
|
||||
const color_t bg_color = RGBA32(0x00, 0x00, 0x00, 0xFF);
|
||||
const color_t text_color = RGBA32(0xFF, 0xFF, 0xFF, 0xFF);
|
||||
|
||||
rdpq_attach(d, NULL);
|
||||
rdpq_clear(bg_color);
|
||||
|
||||
// Layout
|
||||
fragment_borders(d);
|
||||
|
||||
// Text start
|
||||
fragment_text_start(text_color);
|
||||
|
||||
text_y += fragment_textf((d->width / 2) - 108, text_y, "N64 SYSTEM INFORMATION\n\n");
|
||||
|
||||
text_y += fragment_textf(text_x, text_y, "\n");
|
||||
|
||||
int16_t vertical_position = 40;
|
||||
|
||||
time_t current_time = -1;
|
||||
current_time = time( NULL );
|
||||
if( current_time != -1 )
|
||||
{
|
||||
sprintf(str_buffer, "Current date & time: %s\n\n", ctime( ¤t_time ));
|
||||
graphics_draw_text(d, horizontal_start_position, vertical_position += font_vertical_pixels, str_buffer);
|
||||
|
||||
graphics_draw_text(d, horizontal_start_position, vertical_position += font_vertical_pixels, "To change the time, use USB App...");
|
||||
text_y += fragment_textf(text_x, text_y, "Current date & time: %s\n\n", ctime( ¤t_time ));
|
||||
text_y += fragment_textf(text_x, text_y, "To change the time, use USB App...");
|
||||
}
|
||||
|
||||
vertical_position += font_vertical_pixels;
|
||||
text_y += fragment_textf(text_x, text_y, "\n");
|
||||
|
||||
sprintf(str_buffer, "Expansion PAK is %sinserted\n", is_memory_expanded() ? "" : "not " );
|
||||
graphics_draw_text(d, horizontal_start_position, vertical_position += font_vertical_pixels, str_buffer);
|
||||
text_y += fragment_textf(text_x, text_y, "Expansion PAK is %sinserted\n", is_memory_expanded() ? "" : "not " );
|
||||
|
||||
vertical_position += font_vertical_pixels;
|
||||
text_y += fragment_textf(text_x, text_y, "\n");
|
||||
|
||||
int controllers = get_controllers_present();
|
||||
|
||||
sprintf(str_buffer, "JoyPad 1 is %sconnected\n", (controllers & CONTROLLER_1_INSERTED) ? "" : "not " );
|
||||
graphics_draw_text(d, horizontal_start_position, vertical_position += font_vertical_pixels, str_buffer);
|
||||
sprintf(str_buffer, "JoyPad 2 is %sconnected\n", (controllers & CONTROLLER_2_INSERTED) ? "" : "not " );
|
||||
graphics_draw_text(d, horizontal_start_position, vertical_position += font_vertical_pixels, str_buffer);
|
||||
sprintf(str_buffer, "JoyPad 3 is %sconnected\n", (controllers & CONTROLLER_3_INSERTED) ? "" : "not " );
|
||||
graphics_draw_text(d, horizontal_start_position, vertical_position += font_vertical_pixels, str_buffer);
|
||||
sprintf(str_buffer, "JoyPad 4 is %sconnected\n", (controllers & CONTROLLER_4_INSERTED) ? "" : "not " );
|
||||
graphics_draw_text(d, horizontal_start_position, vertical_position += font_vertical_pixels, str_buffer);
|
||||
text_y += fragment_textf(text_x, text_y, "JoyPad 1 is %sconnected\n", (controllers & CONTROLLER_1_INSERTED) ? "" : "not " );
|
||||
text_y += fragment_textf(text_x, text_y, "JoyPad 2 is %sconnected\n", (controllers & CONTROLLER_2_INSERTED) ? "" : "not " );
|
||||
text_y += fragment_textf(text_x, text_y, "JoyPad 3 is %sconnected\n", (controllers & CONTROLLER_3_INSERTED) ? "" : "not " );
|
||||
text_y += fragment_textf(text_x, text_y, "JoyPad 4 is %sconnected\n", (controllers & CONTROLLER_4_INSERTED) ? "" : "not " );
|
||||
|
||||
vertical_position += font_vertical_pixels;
|
||||
text_y += fragment_textf(text_x, text_y, "\n");
|
||||
|
||||
struct controller_data output;
|
||||
int accessories = get_accessories_present( &output );
|
||||
|
||||
sprintf(str_buffer, "JoyPad 1 Accessory Pak is %sinserted %s\n", (accessories & CONTROLLER_1_INSERTED) ? "" : "not ",
|
||||
text_y += fragment_textf(text_x, text_y, "JoyPad 1 Accessory Pak is %sinserted %s\n", (accessories & CONTROLLER_1_INSERTED) ? "" : "not ",
|
||||
(accessories & CONTROLLER_1_INSERTED) ? accessory_type_s( identify_accessory( 0 ) ) : "" );
|
||||
graphics_draw_text(d, horizontal_start_position, vertical_position += font_vertical_pixels, str_buffer);
|
||||
sprintf(str_buffer, "JoyPad 2 Accessory Pak is %sinserted %s\n", (accessories & CONTROLLER_2_INSERTED) ? "" : "not ",
|
||||
text_y += fragment_textf(text_x, text_y, "JoyPad 2 Accessory Pak is %sinserted %s\n", (accessories & CONTROLLER_2_INSERTED) ? "" : "not ",
|
||||
(accessories & CONTROLLER_2_INSERTED) ? accessory_type_s( identify_accessory( 1 ) ) : "" );
|
||||
graphics_draw_text(d, horizontal_start_position, vertical_position += font_vertical_pixels, str_buffer);
|
||||
sprintf(str_buffer, "JoyPad 3 Accessory Pak is %sinserted %s\n", (accessories & CONTROLLER_3_INSERTED) ? "" : "not ",
|
||||
text_y += fragment_textf(text_x, text_y, "JoyPad 3 Accessory Pak is %sinserted %s\n", (accessories & CONTROLLER_3_INSERTED) ? "" : "not ",
|
||||
(accessories & CONTROLLER_3_INSERTED) ? accessory_type_s( identify_accessory( 2 ) ) : "" );
|
||||
graphics_draw_text(d, horizontal_start_position, vertical_position += font_vertical_pixels, str_buffer);
|
||||
sprintf(str_buffer, "JoyPad 4 Accessory Pak is %sinserted %s\n", (accessories & CONTROLLER_4_INSERTED) ? "" : "not ",
|
||||
text_y += fragment_textf(text_x, text_y, "JoyPad 4 Accessory Pak is %sinserted %s\n", (accessories & CONTROLLER_4_INSERTED) ? "" : "not ",
|
||||
(accessories & CONTROLLER_4_INSERTED) ? accessory_type_s( identify_accessory( 3 ) ) : "" );
|
||||
graphics_draw_text(d, horizontal_start_position, vertical_position += font_vertical_pixels, str_buffer);
|
||||
|
||||
|
||||
graphics_draw_line(d, 0, d->height - overscan_vertical_pixels - font_vertical_pixels, d->width,d->height - overscan_vertical_pixels - font_vertical_pixels, 0xff);
|
||||
graphics_draw_text(d, (d->width / 2) - 80,d->height - overscan_vertical_pixels, "Press (B) to return!"); // centre = numchars * font_horizontal_pixels / 2
|
||||
// Actions bar
|
||||
text_y = layout->actions_y + layout->offset_text_y;
|
||||
text_y += fragment_textf(text_x, text_y, "B: Exit");
|
||||
|
||||
display_show(d);
|
||||
rdpq_detach_show();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user