[nostalgia/player] Explicitly run FS desctructor, as it is allocated with alloca

This commit is contained in:
Gary Talent 2020-01-12 20:54:32 -06:00
parent 1890b4101e
commit 0f3b71e63f

View File

@ -10,21 +10,19 @@
#include <ox/std/units.hpp> #include <ox/std/units.hpp>
#include <nostalgia/world/world.hpp> #include <nostalgia/world/world.hpp>
using namespace nostalgia::common; using namespace nostalgia;
using namespace nostalgia::core;
using namespace nostalgia::world;
ox::Error run(ox::FileSystem *fs) { ox::Error run(ox::FileSystem *fs) {
Context ctx; core::Context ctx;
ctx.rom = fs; ctx.rom = fs;
oxReturnError(init(&ctx)); oxReturnError(core::init(&ctx));
//Zone zone; //Zone zone;
//oxReturnError(zone.init(&ctx, Bounds{0, 0, 40, 40}, "/TileSheets/Charset.ng", "/Palettes/Charset.npal")); //oxReturnError(zone.init(&ctx, Bounds{0, 0, 40, 40}, "/TileSheets/Charset.ng", "/Palettes/Charset.npal"));
//zone.draw(&ctx); //zone.draw(&ctx);
oxReturnError(initConsole(&ctx)); oxReturnError(core::initConsole(&ctx));
puts(&ctx, 10, 9, "DOPENESS!!!"); core::puts(&ctx, 10, 9, "DOPENESS!!!");
oxReturnError(run()); oxReturnError(core::run());
oxReturnError(shutdownGfx()); oxReturnError(core::shutdownGfx());
return OxError(0); return OxError(0);
} }
@ -36,7 +34,7 @@ int main(int argc, const char **argv) {
const auto lastDot = ox_lastIndexOf(path, '.'); const auto lastDot = ox_lastIndexOf(path, '.');
const auto fsExt = lastDot != -1 ? path + lastDot : ""; const auto fsExt = lastDot != -1 ? path + lastDot : "";
if (ox_strcmp(fsExt, ".oxfs") == 0) { if (ox_strcmp(fsExt, ".oxfs") == 0) {
rom = loadRom(path); rom = core::loadRom(path);
if (!rom) { if (!rom) {
return 1; return 1;
} }
@ -50,7 +48,8 @@ int main(int argc, const char **argv) {
} }
auto err = run(fs); auto err = run(fs);
oxAssert(err, "Something went wrong..."); oxAssert(err, "Something went wrong...");
unloadRom(rom); fs->~FileSystem();
core::unloadRom(rom);
return err; return err;
} }
return 3; return 3;