This commit is contained in:
BernardoGiordano 2019-07-05 21:59:00 +02:00
parent cfbf391a6e
commit 11f2837893
3 changed files with 28 additions and 2 deletions

View file

@ -86,3 +86,19 @@ void IHid::page_forward(void)
mPage = 0;
}
}
void IHid::pageBack(size_t count)
{
page_back();
if (mIndex > maxEntries(count)) {
mIndex = maxEntries(count);
}
}
void IHid::pageForward(size_t count)
{
page_forward();
if (mIndex > maxEntries(count)) {
mIndex = maxEntries(count);
}
}

View file

@ -54,6 +54,8 @@ public:
int page(void) const;
void page(int v);
void reset(void);
void pageBack(size_t count);
void pageForward(size_t count);
protected:
void page_back(void);

View file

@ -201,14 +201,22 @@ void MainScreen::update(touchPosition* touch)
void MainScreen::updateSelector(touchPosition* touch)
{
if (!g_backupScrollEnabled) {
size_t count = getTitleCount(g_currentUId);
size_t oldindex = hid.index();
hid.update(getTitleCount(g_currentUId));
hid.update(count);
// change page
if (hidKeysDown(CONTROLLER_P1_AUTO) & KEY_L) {
hid.pageBack(count);
}
else if (hidKeysDown(CONTROLLER_P1_AUTO) & KEY_R) {
hid.pageForward(count);
}
// loop through every rendered title
for (u8 row = 0; row < rowlen; row++) {
for (u8 col = 0; col < collen; col++) {
u8 index = row * collen + col;
if (index > hid.maxEntries(getTitleCount(g_currentUId)))
if (index > hid.maxEntries(count))
break;
u32 x = selectorX(index);