Implement basic title loading

This commit is contained in:
Maschell 2020-02-21 21:37:32 +01:00
parent 6c0c6387b6
commit 1cced24ea6
2 changed files with 32 additions and 6 deletions

View File

@ -211,6 +211,7 @@ void GuiIconGrid::OnGameTitleListUpdated(GameList * gameList) {
gameList->unlock(); gameList->unlock();
setSelectedGame(0); setSelectedGame(0);
gameSelectionChanged(this, selectedGame);
curPage = 0; curPage = 0;
currentLeftPosition = 0; currentLeftPosition = 0;
bUpdatePositions = true; bUpdatePositions = true;
@ -244,6 +245,7 @@ void GuiIconGrid::OnLeftClick(GuiButton *button, const GuiController *controller
uint64_t newTitleId = position.at(offset); uint64_t newTitleId = position.at(offset);
if(newTitleId > 0) { if(newTitleId > 0) {
setSelectedGame(newTitleId); setSelectedGame(newTitleId);
gameSelectionChanged(this, selectedGame);
} }
} }
@ -264,6 +266,7 @@ void GuiIconGrid::OnRightClick(GuiButton *button, const GuiController *controlle
uint64_t newTitleId = position.at(offset); uint64_t newTitleId = position.at(offset);
if(newTitleId > 0) { if(newTitleId > 0) {
setSelectedGame(newTitleId); setSelectedGame(newTitleId);
gameSelectionChanged(this, selectedGame);
} }
} }
@ -284,6 +287,7 @@ void GuiIconGrid::OnDownClick(GuiButton *button, const GuiController *controller
uint64_t newTitleId = position.at(offset); uint64_t newTitleId = position.at(offset);
if(newTitleId > 0) { if(newTitleId > 0) {
setSelectedGame(newTitleId); setSelectedGame(newTitleId);
gameSelectionChanged(this, selectedGame);
} }
} }
void GuiIconGrid::OnUpClick(GuiButton *button, const GuiController *controller, GuiTrigger *trigger) { void GuiIconGrid::OnUpClick(GuiButton *button, const GuiController *controller, GuiTrigger *trigger) {
@ -303,6 +307,7 @@ void GuiIconGrid::OnUpClick(GuiButton *button, const GuiController *controller,
uint64_t newTitleId = position.at(offset); uint64_t newTitleId = position.at(offset);
if(newTitleId > 0) { if(newTitleId > 0) {
setSelectedGame(newTitleId); setSelectedGame(newTitleId);
gameSelectionChanged(this, selectedGame);
} }
} }

View File

@ -24,6 +24,7 @@
#include "gui/GuiIconGrid.h" #include "gui/GuiIconGrid.h"
#include <sysapp/launch.h> #include <sysapp/launch.h>
#include <future> #include <future>
#include <coreinit/title.h>
#include "utils/AsyncExecutor.h" #include "utils/AsyncExecutor.h"
MainWindow::MainWindow(int32_t w, int32_t h) MainWindow::MainWindow(int32_t w, int32_t h)
@ -371,6 +372,26 @@ void MainWindow::OnGameSelectionChange(GuiTitleBrowser *element, uint64_t select
} }
} }
void MainWindow::OnGameLaunch(GuiTitleBrowser *element, uint64_t selectedIdx) { #define HBL_TITLE_ID (0x0005000013374842)
#define MII_MAKER_JPN_TITLE_ID (0x000500101004A000)
#define MII_MAKER_USA_TITLE_ID (0x000500101004A100)
#define MII_MAKER_EUR_TITLE_ID (0x000500101004A200)
extern "C" void _SYSLaunchTitleByPathFromLauncher(const char * path, int len, int);
void MainWindow::OnGameLaunch(GuiTitleBrowser *element, uint64_t titleID) {
gameInfo * info = gameList.getGameInfo(titleID);
if(info != NULL) {
uint64_t titleID = OSGetTitleID();
if (titleID == HBL_TITLE_ID ||
titleID == MII_MAKER_JPN_TITLE_ID ||
titleID == MII_MAKER_USA_TITLE_ID ||
titleID == MII_MAKER_EUR_TITLE_ID) {
SYSLaunchTitle(info->titleId);
} else {
const char* path = info->gamePath.c_str();
_SYSLaunchTitleByPathFromLauncher(path, strlen(path),0);
}
}
} }