Skip to content

Commit

Permalink
launcher: mark incompatible blit files
Browse files Browse the repository at this point in the history
  • Loading branch information
Daft-Freak committed May 31, 2024
1 parent 0c1402f commit c97b8a8
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions launcher/launcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ static void load_file_list(const std::string &directory) {
return true;
}

return res == CanLaunchResult::Success;
// will filter incompatible later
return res == CanLaunchResult::Success || res == CanLaunchResult::IncompatibleBlit;
});

game_list.reserve(files.size()); // worst case
Expand All @@ -189,6 +190,7 @@ static void load_file_list(const std::string &directory) {

if(ext == "blit") {
game.type = GameType::game;
game.can_launch = api.can_launch(game.filename.c_str()) == CanLaunchResult::Success;

// check for metadata
BlitGameMetadata meta;
Expand Down Expand Up @@ -546,8 +548,10 @@ static void render_screenshot() {

static void render_game_info() {
// run game / launch file
screen.sprite(1, Point(game_actions_offset.x, game_actions_offset.y + 12));
screen.sprite(0, Point(game_actions_offset.x + 10, game_actions_offset.y + 12), SpriteTransform::R90);
if(selected_game.can_launch) {
screen.sprite(1, Point(game_actions_offset.x, game_actions_offset.y + 12));
screen.sprite(0, Point(game_actions_offset.x + 10, game_actions_offset.y + 12), SpriteTransform::R90);
}

// game info
if(selected_game_metadata.splash)
Expand All @@ -572,6 +576,11 @@ static void render_game_info() {
char buf[20];
snprintf(buf, 20, "%i block%s", num_blocks, num_blocks == 1 ? "" : "s");
screen.text(buf, minimal_font, Point(game_info_offset.x, screen.bounds.h - 16));

if(!selected_game.can_launch) {
screen.pen = {255, 0, 0};
screen.text("INCOMPATIBLE", minimal_font, Point(screen.bounds.w - 10, screen.bounds.h - 16), true, TextAlign::top_right);
}
}

void render(uint32_t time) {
Expand Down Expand Up @@ -767,7 +776,7 @@ void update(uint32_t time) {
if(button_a) {
if(selected_game.type == GameType::screenshot && !selected_game.can_launch) {
current_screen = Screen::screenshot;
} else {
} else if(selected_game.can_launch) {
if(!launch_current_game())
dialog.show("Error!", "Failed to launch " + selected_game.filename, [](bool){}, false);
}
Expand Down

0 comments on commit c97b8a8

Please sign in to comment.