Skip to content

Commit

Permalink
Merge branch 'stenzek:master' into update-GitHubActions
Browse files Browse the repository at this point in the history
  • Loading branch information
Addin committed May 18, 2024
2 parents 0c4ee96 + 1adaea9 commit 3832ad5
Show file tree
Hide file tree
Showing 21 changed files with 731 additions and 132 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gamedb-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:

jobs:
gamedb-lint:
runs-on: ubuntu-24.04
runs-on: ubuntu-22.04
timeout-minutes: 120
steps:
- uses: actions/checkout@v4.1.1
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/rolling-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ jobs:


linux-build:
runs-on: ubuntu-24.04
runs-on: ubuntu-22.04
timeout-minutes: 120
steps:
# Work around https://github.com/actions/runner-images/issues/8659
Expand Down Expand Up @@ -267,7 +267,7 @@ jobs:


linux-flatpak-build:
runs-on: ubuntu-24.04
runs-on: ubuntu-22.04
container:
image: ghcr.io/flathub-infra/flatpak-github-actions:kde-6.7
options: --privileged
Expand Down Expand Up @@ -393,11 +393,11 @@ jobs:

create-release:
needs: [windows-build, windows-arm64-build, linux-build, linux-flatpak-build, macos-build]
runs-on: ubuntu-24.04
runs-on: ubuntu-22.04
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev'
steps:
- name: Download Artifacts
uses: actions/upload-artifact@v4.3.3
uses: actions/download-artifact@v4.1.7
with:
path: ./artifacts/

Expand Down
6 changes: 4 additions & 2 deletions data/resources/gamedb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30661,6 +30661,8 @@ SCPS-10003:
name: "Crime Crackers (Japan)"
controllers:
- DigitalController
codes:
- HASH-111C340E270B10A8
metadata:
publisher: "Sony"
developer: "Media Vision Entertainment"
Expand Down Expand Up @@ -65511,6 +65513,8 @@ SLPS-00104:
name: "Gouketsuji Ichizoku 2 - Chotto dake Saikyou Densetsu (Japan)"
controllers:
- DigitalController
codes:
- HASH-407D4E2254F5ABBE
metadata:
publisher: "Atlus Co"
developer: "A.I"
Expand Down Expand Up @@ -111475,8 +111479,6 @@ SLES-01987:
name: "Next Tetris, The (Europe) (En,Fr,De,Es,It,Nl)"
controllers:
- DigitalController
traits:
- ForceRecompilerICache
metadata:
publisher: "Atari / Hasbro Interactive"
developer: "Blue Planet Interactive"
Expand Down
198 changes: 146 additions & 52 deletions src/core/fullscreen_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ static void DrawGameList(const ImVec2& heading_size);
static void DrawGameGrid(const ImVec2& heading_size);
static void HandleGameListActivate(const GameList::Entry* entry);
static void HandleGameListOptions(const GameList::Entry* entry);
static void HandleSelectDiscForDiscSet(std::string_view disc_set_name);
static void DrawGameListSettingsWindow();
static void SwitchToGameList();
static void PopulateGameListEntryList();
Expand Down Expand Up @@ -2754,7 +2755,7 @@ void FullscreenUI::SwitchToGameSettings()
return;

auto lock = GameList::GetLock();
const GameList::Entry* entry = GameList::GetEntryForPath(System::GetDiscPath().c_str());
const GameList::Entry* entry = GameList::GetEntryForPath(System::GetDiscPath());
if (!entry)
{
SwitchToGameSettingsForSerial(System::GetGameSerial());
Expand All @@ -2767,7 +2768,7 @@ void FullscreenUI::SwitchToGameSettings()
void FullscreenUI::SwitchToGameSettingsForPath(const std::string& path)
{
auto lock = GameList::GetLock();
const GameList::Entry* entry = GameList::GetEntryForPath(path.c_str());
const GameList::Entry* entry = GameList::GetEntryForPath(path);
if (entry)
SwitchToGameSettings(entry);
}
Expand Down Expand Up @@ -5535,7 +5536,7 @@ u32 FullscreenUI::PopulateSaveStateListEntries(const std::string& title, const s
bool FullscreenUI::OpenLoadStateSelectorForGame(const std::string& game_path)
{
auto lock = GameList::GetLock();
const GameList::Entry* entry = GameList::GetEntryForPath(game_path.c_str());
const GameList::Entry* entry = GameList::GetEntryForPath(game_path);
if (entry)
{
s_save_state_selector_loading = true;
Expand Down Expand Up @@ -5919,7 +5920,7 @@ bool FullscreenUI::OpenLoadStateSelectorForGameResume(const GameList::Entry* ent

void FullscreenUI::DrawResumeStateSelector()
{
ImGui::SetNextWindowSize(LayoutScale(800.0f, 600.0f));
ImGui::SetNextWindowSize(LayoutScale(800.0f, 602.0f));
ImGui::SetNextWindowPos(ImGui::GetIO().DisplaySize * 0.5f, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
ImGui::OpenPopup(FSUI_CSTR("Load Resume State"));

Expand Down Expand Up @@ -6048,11 +6049,27 @@ void FullscreenUI::PopulateGameListEntryList()
{
const s32 sort = Host::GetBaseIntSettingValue("Main", "FullscreenUIGameSort", 0);
const bool reverse = Host::GetBaseBoolSettingValue("Main", "FullscreenUIGameSortReverse", false);
const bool merge_disc_sets = Host::GetBaseBoolSettingValue("Main", "FullscreenUIMergeDiscSets", true);

const u32 count = GameList::GetEntryCount();
s_game_list_sorted_entries.resize(count);
s_game_list_sorted_entries.clear();
s_game_list_sorted_entries.reserve(count);
for (u32 i = 0; i < count; i++)
s_game_list_sorted_entries[i] = GameList::GetEntryByIndex(i);
{
const GameList::Entry* entry = GameList::GetEntryByIndex(i);
if (merge_disc_sets)
{
if (entry->disc_set_member)
continue;
}
else
{
if (entry->IsDiscSet())
continue;
}

s_game_list_sorted_entries.push_back(entry);
}

std::sort(s_game_list_sorted_entries.begin(), s_game_list_sorted_entries.end(),
[sort, reverse](const GameList::Entry* lhs, const GameList::Entry* rhs) {
Expand Down Expand Up @@ -6539,60 +6556,134 @@ void FullscreenUI::DrawGameGrid(const ImVec2& heading_size)

void FullscreenUI::HandleGameListActivate(const GameList::Entry* entry)
{
if (entry->IsDiscSet())
{
HandleSelectDiscForDiscSet(entry->path);
return;
}

// launch game
if (!OpenLoadStateSelectorForGameResume(entry))
DoStartPath(entry->path);
}

void FullscreenUI::HandleGameListOptions(const GameList::Entry* entry)
{
ImGuiFullscreen::ChoiceDialogOptions options = {
{FSUI_ICONSTR(ICON_FA_WRENCH, "Game Properties"), false},
{FSUI_ICONSTR(ICON_FA_FOLDER_OPEN, "Open Containing Directory"), false},
{FSUI_ICONSTR(ICON_FA_PLAY, "Resume Game"), false},
{FSUI_ICONSTR(ICON_FA_UNDO, "Load State"), false},
{FSUI_ICONSTR(ICON_FA_COMPACT_DISC, "Default Boot"), false},
{FSUI_ICONSTR(ICON_FA_LIGHTBULB, "Fast Boot"), false},
{FSUI_ICONSTR(ICON_FA_MAGIC, "Slow Boot"), false},
{FSUI_ICONSTR(ICON_FA_FOLDER_MINUS, "Reset Play Time"), false},
{FSUI_ICONSTR(ICON_FA_WINDOW_CLOSE, "Close Menu"), false},
};
if (!entry->IsDiscSet())
{
ImGuiFullscreen::ChoiceDialogOptions options = {
{FSUI_ICONSTR(ICON_FA_WRENCH, "Game Properties"), false},
{FSUI_ICONSTR(ICON_FA_FOLDER_OPEN, "Open Containing Directory"), false},
{FSUI_ICONSTR(ICON_FA_PLAY, "Resume Game"), false},
{FSUI_ICONSTR(ICON_FA_UNDO, "Load State"), false},
{FSUI_ICONSTR(ICON_FA_COMPACT_DISC, "Default Boot"), false},
{FSUI_ICONSTR(ICON_FA_LIGHTBULB, "Fast Boot"), false},
{FSUI_ICONSTR(ICON_FA_MAGIC, "Slow Boot"), false},
{FSUI_ICONSTR(ICON_FA_FOLDER_MINUS, "Reset Play Time"), false},
{FSUI_ICONSTR(ICON_FA_WINDOW_CLOSE, "Close Menu"), false},
};

OpenChoiceDialog(
entry->title.c_str(), false, std::move(options),
[entry_path = entry->path, entry_serial = entry->serial](s32 index, const std::string& title, bool checked) {
switch (index)
{
case 0: // Open Game Properties
SwitchToGameSettingsForPath(entry_path);
break;
case 1: // Open Containing Directory
ExitFullscreenAndOpenURL(Path::CreateFileURL(Path::GetDirectory(entry_path)));
break;
case 2: // Resume Game
DoStartPath(entry_path, System::GetGameSaveStateFileName(entry_serial, -1));
break;
case 3: // Load State
OpenLoadStateSelectorForGame(entry_path);
break;
case 4: // Default Boot
DoStartPath(entry_path);
break;
case 5: // Fast Boot
DoStartPath(entry_path, {}, true);
break;
case 6: // Slow Boot
DoStartPath(entry_path, {}, false);
break;
case 7: // Reset Play Time
GameList::ClearPlayedTimeForSerial(entry_serial);
break;
default:
break;
}
OpenChoiceDialog(
entry->title.c_str(), false, std::move(options),
[entry_path = entry->path, entry_serial = entry->serial](s32 index, const std::string& title, bool checked) {
switch (index)
{
case 0: // Open Game Properties
SwitchToGameSettingsForPath(entry_path);
break;
case 1: // Open Containing Directory
ExitFullscreenAndOpenURL(Path::CreateFileURL(Path::GetDirectory(entry_path)));
break;
case 2: // Resume Game
DoStartPath(entry_path, System::GetGameSaveStateFileName(entry_serial, -1));
break;
case 3: // Load State
OpenLoadStateSelectorForGame(entry_path);
break;
case 4: // Default Boot
DoStartPath(entry_path);
break;
case 5: // Fast Boot
DoStartPath(entry_path, {}, true);
break;
case 6: // Slow Boot
DoStartPath(entry_path, {}, false);
break;
case 7: // Reset Play Time
GameList::ClearPlayedTimeForSerial(entry_serial);
break;
default:
break;
}

CloseChoiceDialog();
});
CloseChoiceDialog();
});
}
else
{
// shouldn't fail
const GameList::Entry* first_disc_entry = GameList::GetFirstDiscSetMember(entry->path);
if (!first_disc_entry)
return;

ImGuiFullscreen::ChoiceDialogOptions options = {
{FSUI_ICONSTR(ICON_FA_WRENCH, "Game Properties"), false},
{FSUI_ICONSTR(ICON_FA_COMPACT_DISC, "Select Disc"), false},
{FSUI_ICONSTR(ICON_FA_WINDOW_CLOSE, "Close Menu"), false},
};

OpenChoiceDialog(entry->title.c_str(), false, std::move(options),
[entry_path = first_disc_entry->path,
disc_set_name = entry->path](s32 index, const std::string& title, bool checked) {
switch (index)
{
case 0: // Open Game Properties
SwitchToGameSettingsForPath(entry_path);
break;
case 1: // Select Disc
HandleSelectDiscForDiscSet(disc_set_name);
break;
default:
break;
}

CloseChoiceDialog();
});
}
}

void FullscreenUI::HandleSelectDiscForDiscSet(std::string_view disc_set_name)
{
auto lock = GameList::GetLock();
const std::vector<const GameList::Entry*> entries = GameList::GetDiscSetMembers(disc_set_name, true);
if (entries.empty())
return;

ImGuiFullscreen::ChoiceDialogOptions options;
std::vector<std::string> paths;
paths.reserve(entries.size());

for (const GameList::Entry* entry : entries)
{
std::string title = fmt::format(fmt::runtime(FSUI_ICONSTR(ICON_FA_COMPACT_DISC, "Disc {} | {}")),
entry->disc_set_index + 1, Path::GetFileName(entry->path));
options.emplace_back(std::move(title), false);
paths.push_back(entry->path);
}
options.emplace_back(FSUI_ICONSTR(ICON_FA_WINDOW_CLOSE, "Close Menu"), false);

OpenChoiceDialog(SmallString::from_format("Select Disc for {}", disc_set_name), false, std::move(options),
[paths = std::move(paths)](s32 index, const std::string& title, bool checked) {
if (static_cast<u32>(index) < paths.size())
{
auto lock = GameList::GetLock();
const GameList::Entry* entry = GameList::GetEntryForPath(paths[index]);
if (entry)
HandleGameListActivate(entry);
}

CloseChoiceDialog();
});
}

void FullscreenUI::DrawGameListSettingsWindow()
Expand Down Expand Up @@ -6742,6 +6833,9 @@ void FullscreenUI::DrawGameListSettingsWindow()
bsi, FSUI_ICONSTR(ICON_FA_SORT_ALPHA_DOWN, "Sort Reversed"),
FSUI_CSTR("Reverses the game list sort order from the default (usually ascending to descending)."), "Main",
"FullscreenUIGameSortReverse", false);
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_LIST, "Merge Multi-Disc Games"),
FSUI_CSTR("Merges multi-disc games into one item in the game list."), "Main",
"FullscreenUIMergeDiscSets", true);
}

MenuHeading(FSUI_CSTR("Cover Settings"));
Expand Down Expand Up @@ -6823,7 +6917,7 @@ GPUTexture* FullscreenUI::GetCoverForCurrentGame()
{
auto lock = GameList::GetLock();

const GameList::Entry* entry = GameList::GetEntryForPath(System::GetDiscPath().c_str());
const GameList::Entry* entry = GameList::GetEntryForPath(System::GetDiscPath());
if (!entry)
return s_fallback_disc_texture.get();

Expand Down
Loading

0 comments on commit 3832ad5

Please sign in to comment.