mirror of
https://github.com/BernardoGiordano/Checkpoint
synced 2025-02-26 11:47:13 +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 draw(void) override;
|
||||||
void push_back(u32 color, u32 colorMessage, const std::string& message) override;
|
void push_back(u32 color, u32 colorMessage, const std::string& message) override;
|
||||||
|
void resetIndex(void) override;
|
||||||
void updateSelection(void) override;
|
void updateSelection(void) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -166,21 +166,24 @@ void io::backup(size_t index)
|
||||||
std::u16string customPath;
|
std::u16string customPath;
|
||||||
if (Gui::multipleSelectionEnabled())
|
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
|
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);
|
// we're overriding an existing folder
|
||||||
return;
|
dstPath = mode == MODE_SAVE ? title.fullSavePath(cellIndex) : title.fullExtdataPath(cellIndex);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
std::u16string dstPath = mode == MODE_SAVE ? title.savePath() : title.extdataPath();
|
{
|
||||||
dstPath += StringUtils::UTF8toUTF16("/") + customPath;
|
dstPath = mode == MODE_SAVE ? title.savePath() : title.extdataPath();
|
||||||
|
dstPath += StringUtils::UTF8toUTF16("/") + customPath;
|
||||||
|
}
|
||||||
|
|
||||||
if (!isNewFolder || io::directoryExists(Archive::sdmc(), dstPath))
|
if (!isNewFolder || io::directoryExists(Archive::sdmc(), dstPath))
|
||||||
{
|
{
|
||||||
|
@ -234,20 +237,24 @@ void io::backup(size_t index)
|
||||||
std::u16string customPath;
|
std::u16string customPath;
|
||||||
if (Gui::multipleSelectionEnabled())
|
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
|
else
|
||||||
{
|
{
|
||||||
customPath = isNewFolder ? swkbd(suggestion) : StringUtils::UTF8toUTF16(Gui::nameFromCell(cellIndex).c_str());
|
customPath = isNewFolder ? swkbd(suggestion) : StringUtils::UTF8toUTF16("");
|
||||||
}
|
|
||||||
|
|
||||||
if (!customPath.compare(StringUtils::UTF8toUTF16(" ")))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::u16string dstPath = mode == MODE_SAVE ? title.savePath() : title.extdataPath();
|
std::u16string dstPath;
|
||||||
dstPath += StringUtils::UTF8toUTF16("/") + customPath;
|
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))
|
if (!isNewFolder || io::directoryExists(Archive::sdmc(), dstPath))
|
||||||
{
|
{
|
||||||
|
@ -389,8 +396,8 @@ void io::restore(size_t index)
|
||||||
u32 saveSize = SPIGetCapacity(cardType);
|
u32 saveSize = SPIGetCapacity(cardType);
|
||||||
u32 pageSize = SPIGetPageSize(cardType);
|
u32 pageSize = SPIGetPageSize(cardType);
|
||||||
|
|
||||||
std::u16string srcPath = mode == MODE_SAVE ? title.savePath() : title.extdataPath();
|
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("/") + StringUtils::UTF8toUTF16(Gui::nameFromCell(cellIndex).c_str()) + StringUtils::UTF8toUTF16("/") + StringUtils::UTF8toUTF16(title.shortDescription().c_str()) + StringUtils::UTF8toUTF16(".sav");
|
srcPath += StringUtils::UTF8toUTF16("/");
|
||||||
|
|
||||||
u8* saveFile = new u8[saveSize];
|
u8* saveFile = new u8[saveSize];
|
||||||
FSStream stream(Archive::sdmc(), srcPath, FS_OPEN_READ);
|
FSStream stream(Archive::sdmc(), srcPath, FS_OPEN_READ);
|
||||||
|
|
|
@ -51,6 +51,7 @@ int main() {
|
||||||
Gui::bottomScroll(false);
|
Gui::bottomScroll(false);
|
||||||
Gui::updateButtonsColor();
|
Gui::updateButtonsColor();
|
||||||
Gui::clearSelectedEntries();
|
Gui::clearSelectedEntries();
|
||||||
|
Gui::resetScrollableIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (kDown & KEY_X)
|
if (kDown & KEY_X)
|
||||||
|
|
|
@ -26,6 +26,12 @@
|
||||||
|
|
||||||
#include "scrollable.hpp"
|
#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)
|
void Scrollable::push_back(u32 color, u32 colorMessage, const std::string& message)
|
||||||
{
|
{
|
||||||
static const float spacing = mh / mVisibleEntries;
|
static const float spacing = mh / mVisibleEntries;
|
||||||
|
|
|
@ -91,7 +91,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void resetIndex(void)
|
virtual void resetIndex(void)
|
||||||
{
|
{
|
||||||
mIndex = 0;
|
mIndex = 0;
|
||||||
mPage = 0;
|
mPage = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue