Fixes save lag on Switch (#1499)
* Greatly improves saving speed on the Switch. * Fixes build on non-switch platforms.
This commit is contained in:
parent
006506240f
commit
978b325a30
|
@ -479,14 +479,21 @@ void SaveManager::SaveFile(int fileNum) {
|
||||||
section.second.second();
|
section.second.second();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __SWITCH__
|
||||||
|
const char* json_string = baseBlock.dump(4).c_str();
|
||||||
|
FILE* w = fopen(GetFileName(fileNum).c_str(), "w");
|
||||||
|
fwrite(json_string, sizeof(char), strlen(json_string), w);
|
||||||
|
fclose(w);
|
||||||
|
#else
|
||||||
|
|
||||||
std::ofstream output(GetFileName(fileNum));
|
std::ofstream output(GetFileName(fileNum));
|
||||||
|
|
||||||
#ifdef __WIIU__
|
#ifdef __WIIU__
|
||||||
alignas(0x40) char buffer[8192];
|
alignas(0x40) char buffer[8192];
|
||||||
output.rdbuf()->pubsetbuf(buffer, sizeof(buffer));
|
output.rdbuf()->pubsetbuf(buffer, sizeof(buffer));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
output << std::setw(4) << baseBlock << std::endl;
|
output << std::setw(4) << baseBlock << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
InitMeta(fileNum);
|
InitMeta(fileNum);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue