Skip to content
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,14 @@ DualShock numbering, Backbone Pro quirks. Keyboards: arrows, Z/X/A/S, Enter,
Shift/Backspace, Q/W (L/R) and E/R (L2/R2) map to the gamepad for the
emulators.

In the launcher, left / right on the game list go to the previous / next
console's games. Tapping the console above the boxart (or X on a gamepad, F
on a keyboard) opens the console picker, which shows only one console's
games, or all of them again; an outline on the console means the list is
filtered, and left / right then move the filter to the next console.
`emulink filter <console>` (snes, gba, genesis, playstation, pc, pico8 or
all) does the same over USB.

Jedi Knight gets the full keyboard and mouse look; on a gamepad the left
stick strafes, the right stick looks, R = fire, L = secondary fire, A =
activate, B = jump, X = crouch, Y = use item.
Expand Down
32 changes: 30 additions & 2 deletions components/gui/include/gui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,36 @@ class Gui {
return rom_infos_;
}

/// Select the first game whose name or rom path contains `text`
/// Select the first game whose name or rom path contains `text` (a game
/// the console filter hides lifts the filter)
bool select_rom_matching(std::string_view text);

/// The consoles that have games, in list order.
std::vector<Console> consoles() const;
/// The console whose games the list shows, if it is filtered.
std::optional<Console> console_filter() const;
/// Show only `console`'s games (nullopt: every console's); false if it has none.
bool set_console_filter(std::optional<Console> console);

/// The launcher screen (RGB565, little endian, rows packed), for the USB
/// link's screenshot when no game runs; empty if it cannot be drawn.
struct Snapshot {
size_t width{0}, height{0};
std::vector<uint8_t> pixels;
};
Snapshot snapshot();

protected:
void init_ui();
void deinit_ui();
void update_shared_state();
void select_rom(int index);
void build_list(int keep_rom);
void step_console(int dir);
void update_filter_marker();
void open_console_picker();
void close_console_picker();
static void picker_event(lv_event_t *e);
void update();

void on_volume(const std::vector<uint8_t> &data);
Expand Down Expand Up @@ -108,7 +130,13 @@ class Gui {
lv_obj_t *video_dropdown_{nullptr};
lv_obj_t *resume_switch_{nullptr};
lv_obj_t *battery_label_{nullptr};
std::vector<lv_obj_t *> rom_buttons_;
std::vector<lv_obj_t *> rom_buttons_; ///< per game (rom_infos_ index); nullptr if filtered out

// the console filter: the Console whose games the list shows, -1 all
int filter_{-1};
lv_obj_t *picker_{nullptr}; ///< the console picker, while it is open
lv_group_t *picker_group_{nullptr};
std::vector<int> picker_consoles_; ///< the picker's rows: Console, -1 all

std::string metadata_filename_;
std::filesystem::file_time_type metadata_last_modified_{};
Expand Down
Loading
Loading