mirror of
https://github.com/BernardoGiordano/Checkpoint
synced 2024-11-28 11:30:22 +00:00
fix bugs introduced by last commit
This commit is contained in:
parent
394797d7fa
commit
eb7233a1f5
5 changed files with 35 additions and 20 deletions
|
@ -50,6 +50,7 @@ public:
|
|||
|
||||
void draw(void) override;
|
||||
void push_back(u32 color, u32 colorMessage, const std::string& message) override;
|
||||
void resetIndex(void) override;
|
||||
void updateSelection(void) override;
|
||||
|
||||
protected:
|
||||
|
|
|
@ -166,21 +166,24 @@ void io::backup(size_t index)
|
|||
std::u16string customPath;
|
||||
if (Gui::multipleSelectionEnabled())
|
||||
{
|
||||
customPath = isNewFolder ? StringUtils::UTF8toUTF16(suggestion.c_str()) : StringUtils::UTF8toUTF16(Gui::nameFromCell(cellIndex).c_str());
|
||||
customPath = isNewFolder ? StringUtils::UTF8toUTF16(suggestion.c_str()) : StringUtils::UTF8toUTF16("");
|
||||
}
|
||||
else
|
||||
{
|
||||
customPath = isNewFolder ? StringUtils::removeForbiddenCharacters(swkbd(suggestion)) : StringUtils::UTF8toUTF16(Gui::nameFromCell(cellIndex).c_str());
|
||||
customPath = isNewFolder ? StringUtils::removeForbiddenCharacters(swkbd(suggestion)) : StringUtils::UTF8toUTF16("");
|
||||
}
|
||||
|
||||
if (!customPath.compare(StringUtils::UTF8toUTF16(" ")))
|
||||
std::u16string dstPath;
|
||||
if (customPath.empty())
|
||||
{
|
||||
FSUSER_CloseArchive(archive);
|
||||
return;
|
||||
// we're overriding an existing folder
|
||||
dstPath = mode == MODE_SAVE ? title.fullSavePath(cellIndex) : title.fullExtdataPath(cellIndex);
|
||||
}
|
||||
|
||||
std::u16string dstPath = mode == MODE_SAVE ? title.savePath() : title.extdataPath();
|
||||
dstPath += StringUtils::UTF8toUTF16("/") + customPath;
|
||||
else
|
||||
{
|
||||
dstPath = mode == MODE_SAVE ? title.savePath() : title.extdataPath();
|
||||
dstPath += StringUtils::UTF8toUTF16("/") + customPath;
|
||||
}
|
||||
|
||||
if (!isNewFolder || io::directoryExists(Archive::sdmc(), dstPath))
|
||||
{
|
||||
|
@ -234,20 +237,24 @@ void io::backup(size_t index)
|
|||
std::u16string customPath;
|
||||
if (Gui::multipleSelectionEnabled())
|
||||
{
|
||||
customPath = isNewFolder ? StringUtils::UTF8toUTF16(suggestion.c_str()) : StringUtils::UTF8toUTF16(Gui::nameFromCell(cellIndex).c_str());
|
||||
customPath = isNewFolder ? StringUtils::UTF8toUTF16(suggestion.c_str()) : StringUtils::UTF8toUTF16("");
|
||||
}
|
||||
else
|
||||
{
|
||||
customPath = isNewFolder ? swkbd(suggestion) : StringUtils::UTF8toUTF16(Gui::nameFromCell(cellIndex).c_str());
|
||||
}
|
||||
|
||||
if (!customPath.compare(StringUtils::UTF8toUTF16(" ")))
|
||||
{
|
||||
return;
|
||||
customPath = isNewFolder ? swkbd(suggestion) : StringUtils::UTF8toUTF16("");
|
||||
}
|
||||
|
||||
std::u16string dstPath = mode == MODE_SAVE ? title.savePath() : title.extdataPath();
|
||||
dstPath += StringUtils::UTF8toUTF16("/") + customPath;
|
||||
std::u16string dstPath;
|
||||
if (customPath.empty())
|
||||
{
|
||||
// we're overriding an existing folder
|
||||
dstPath = mode == MODE_SAVE ? title.fullSavePath(cellIndex) : title.fullExtdataPath(cellIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
dstPath = mode == MODE_SAVE ? title.savePath() : title.extdataPath();
|
||||
dstPath += StringUtils::UTF8toUTF16("/") + customPath;
|
||||
}
|
||||
|
||||
if (!isNewFolder || io::directoryExists(Archive::sdmc(), dstPath))
|
||||
{
|
||||
|
@ -389,8 +396,8 @@ void io::restore(size_t index)
|
|||
u32 saveSize = SPIGetCapacity(cardType);
|
||||
u32 pageSize = SPIGetPageSize(cardType);
|
||||
|
||||
std::u16string srcPath = mode == MODE_SAVE ? title.savePath() : title.extdataPath();
|
||||
srcPath += StringUtils::UTF8toUTF16("/") + StringUtils::UTF8toUTF16(Gui::nameFromCell(cellIndex).c_str()) + StringUtils::UTF8toUTF16("/") + StringUtils::UTF8toUTF16(title.shortDescription().c_str()) + StringUtils::UTF8toUTF16(".sav");
|
||||
std::u16string srcPath = mode == MODE_SAVE ? title.fullSavePath(cellIndex) : title.fullExtdataPath(cellIndex) + StringUtils::UTF8toUTF16("/") + StringUtils::UTF8toUTF16(title.shortDescription().c_str()) + StringUtils::UTF8toUTF16(".sav");
|
||||
srcPath += StringUtils::UTF8toUTF16("/");
|
||||
|
||||
u8* saveFile = new u8[saveSize];
|
||||
FSStream stream(Archive::sdmc(), srcPath, FS_OPEN_READ);
|
||||
|
|
|
@ -51,6 +51,7 @@ int main() {
|
|||
Gui::bottomScroll(false);
|
||||
Gui::updateButtonsColor();
|
||||
Gui::clearSelectedEntries();
|
||||
Gui::resetScrollableIndex();
|
||||
}
|
||||
|
||||
if (kDown & KEY_X)
|
||||
|
|
|
@ -26,6 +26,12 @@
|
|||
|
||||
#include "scrollable.hpp"
|
||||
|
||||
void Scrollable::resetIndex(void)
|
||||
{
|
||||
mHid->index(0);
|
||||
mHid->page(0);
|
||||
}
|
||||
|
||||
void Scrollable::push_back(u32 color, u32 colorMessage, const std::string& message)
|
||||
{
|
||||
static const float spacing = mh / mVisibleEntries;
|
||||
|
|
|
@ -91,7 +91,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void resetIndex(void)
|
||||
virtual void resetIndex(void)
|
||||
{
|
||||
mIndex = 0;
|
||||
mPage = 0;
|
||||
|
|
Loading…
Reference in a new issue