2023-07-09 00:52:39 +02:00
|
|
|
#include <time.h>
|
|
|
|
|
2023-07-11 10:58:49 +02:00
|
|
|
#include "views.h"
|
2023-07-09 00:52:39 +02:00
|
|
|
|
|
|
|
|
2023-10-10 21:12:53 +02:00
|
|
|
static int joypad[4];
|
2023-08-03 17:18:55 +02:00
|
|
|
static int accessory[4];
|
|
|
|
|
|
|
|
|
2024-01-17 15:43:02 +01:00
|
|
|
static const char *format_accessory (int joypad) {
|
2023-10-10 21:12:53 +02:00
|
|
|
switch (accessory[joypad]) {
|
2024-01-17 15:43:02 +01:00
|
|
|
case JOYPAD_ACCESSORY_TYPE_RUMBLE_PAK: return "[Rumble Pak is inserted]";
|
|
|
|
case JOYPAD_ACCESSORY_TYPE_CONTROLLER_PAK: return "[Controller Pak is inserted]";
|
|
|
|
case JOYPAD_ACCESSORY_TYPE_TRANSFER_PAK: return "[Transfer Pak is inserted]";
|
|
|
|
case JOYPAD_ACCESSORY_TYPE_BIO_SENSOR: return "[BIO Sensor is inserted]";
|
|
|
|
case JOYPAD_ACCESSORY_TYPE_SNAP_STATION: return "[Snap Station is inserted]";
|
|
|
|
case JOYPAD_ACCESSORY_TYPE_NONE: return "";
|
|
|
|
default: return "[unknown accessory inserted]";
|
2023-07-09 00:52:39 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-03 17:18:55 +02:00
|
|
|
|
2023-07-09 00:52:39 +02:00
|
|
|
static void process (menu_t *menu) {
|
2024-01-17 15:43:02 +01:00
|
|
|
JOYPAD_PORT_FOREACH (port) {
|
|
|
|
joypad[port] = (joypad_get_style(port) != JOYPAD_STYLE_NONE);
|
|
|
|
accessory[port] = joypad_get_accessory_type(port);
|
|
|
|
}
|
|
|
|
|
2023-07-09 00:52:39 +02:00
|
|
|
if (menu->actions.back) {
|
|
|
|
menu->next_mode = MENU_MODE_BROWSER;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void draw (menu_t *menu, surface_t *d) {
|
2023-07-26 18:43:08 +02:00
|
|
|
rdpq_attach(d, NULL);
|
2023-07-28 21:36:51 +02:00
|
|
|
|
2023-08-03 17:18:55 +02:00
|
|
|
component_background_draw();
|
|
|
|
|
|
|
|
component_layout_draw();
|
|
|
|
|
|
|
|
component_main_text_draw(
|
|
|
|
ALIGN_CENTER, VALIGN_TOP,
|
|
|
|
"N64 SYSTEM INFORMATION"
|
|
|
|
);
|
|
|
|
|
|
|
|
component_main_text_draw(
|
|
|
|
ALIGN_LEFT, VALIGN_TOP,
|
|
|
|
"\n"
|
|
|
|
"\n"
|
|
|
|
"Current date & time: %s"
|
|
|
|
"\n"
|
|
|
|
"Expansion PAK is %sinserted\n"
|
|
|
|
"\n"
|
2024-01-17 15:43:02 +01:00
|
|
|
"Joypad 1 is %sconnected %s\n"
|
|
|
|
"Joypad 2 is %sconnected %s\n"
|
|
|
|
"Joypad 3 is %sconnected %s\n"
|
|
|
|
"Joypad 4 is %sconnected %s\n",
|
2023-10-10 21:12:53 +02:00
|
|
|
menu->current_time >= 0 ? ctime(&menu->current_time) : "Unknown\n",
|
2023-08-03 17:18:55 +02:00
|
|
|
is_memory_expanded() ? "" : "not ",
|
2023-10-10 21:12:53 +02:00
|
|
|
(joypad[0]) ? "" : "not ", format_accessory(0),
|
|
|
|
(joypad[1]) ? "" : "not ", format_accessory(1),
|
|
|
|
(joypad[2]) ? "" : "not ", format_accessory(2),
|
|
|
|
(joypad[3]) ? "" : "not ", format_accessory(3)
|
2023-08-03 17:18:55 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
component_actions_bar_text_draw(
|
|
|
|
ALIGN_LEFT, VALIGN_TOP,
|
2023-08-12 21:11:20 +02:00
|
|
|
"\n"
|
2023-08-03 17:18:55 +02:00
|
|
|
"B: Exit"
|
|
|
|
);
|
2023-07-09 00:52:39 +02:00
|
|
|
|
2023-07-26 18:43:08 +02:00
|
|
|
rdpq_detach_show();
|
2023-07-09 00:52:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-10-10 21:12:53 +02:00
|
|
|
void view_system_info_init (menu_t *menu) {
|
2024-01-17 15:43:02 +01:00
|
|
|
// Nothing to initialize (yet)
|
2023-07-09 00:52:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void view_system_info_display (menu_t *menu, surface_t *display) {
|
|
|
|
process(menu);
|
2023-08-03 17:18:55 +02:00
|
|
|
|
2023-07-09 00:52:39 +02:00
|
|
|
draw(menu, display);
|
2023-08-03 17:18:55 +02:00
|
|
|
}
|