From afab2f687876515bbc8dbb64ba080d70c9763ee2 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 1 Feb 2020 00:47:08 -0600 Subject: [PATCH] [nostalgia/core] Add loadRomFs --- src/nostalgia/core/media.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/nostalgia/core/media.cpp diff --git a/src/nostalgia/core/media.cpp b/src/nostalgia/core/media.cpp new file mode 100644 index 00000000..51fd9546 --- /dev/null +++ b/src/nostalgia/core/media.cpp @@ -0,0 +1,23 @@ +/* + * Copyright 2016 - 2020 gtalent2@gmail.com + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include + +#include "media.hpp" +#include "ox/std/bit.hpp" + +namespace nostalgia::core { + +ox::FileSystem *loadRomFs(const char *path) { + auto rom = loadRom(path); + return new ox::FileSystem32(rom, 32 * ox::units::MB, [](uint8_t *buff) { + unloadRom(ox::bit_cast(buff)); + }); +} + +}