Fix this small bug too
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user