Fix this small bug too

This commit is contained in:
2026-06-03 22:26:07 +02:00
parent 08cd13b858
commit 3080d4d45a
+5 -1
View File
@@ -36,8 +36,11 @@ void PIF::Reset() {
void PIF::MaybeLoadMempak() { void PIF::MaybeLoadMempak() {
if (!mempakOpen) { if (!mempakOpen) {
fs::path mempakPath_ = mempakPath; fs::path mempakPath_ = mempakPath;
std::string savePath = Options::GetInstance().GetValue<std::string>("general", "savePath"); fs::path savePath = Options::GetInstance().GetValue<std::string>("general", "savePath");
if (!savePath.empty()) { if (!savePath.empty()) {
if (!fs::exists(savePath))
fs::create_directory(savePath);
mempakPath_ = savePath / mempakPath_.filename(); mempakPath_ = savePath / mempakPath_.filename();
} }
mempakPath = mempakPath_.replace_extension(".mempak").string(); mempakPath = mempakPath_.replace_extension(".mempak").string();
@@ -52,6 +55,7 @@ void PIF::MaybeLoadMempak() {
auto mempakVec = ircolib::ReadFileBinary(mempakPath); auto mempakVec = ircolib::ReadFileBinary(mempakPath);
if (mempak.empty()) { if (mempak.empty()) {
info(R"(Empty mempak, making one @ "{}" ...)", mempakPath);
ircolib::WriteFileBinary(std::array<u8, MEMPAK_SIZE>{}, mempakPath); ircolib::WriteFileBinary(std::array<u8, MEMPAK_SIZE>{}, mempakPath);
mempakVec = ircolib::ReadFileBinary(mempakPath); mempakVec = ircolib::ReadFileBinary(mempakPath);
} }