[nostalgia] Replace C strings with ox::StringView
This commit is contained in:
@@ -14,7 +14,7 @@ namespace nostalgia::core {
|
||||
|
||||
ox::String getClipboardText(class Context *ctx) noexcept;
|
||||
|
||||
void setClipboardText(class Context *ctx, const ox::String &text) noexcept;
|
||||
void setClipboardText(class Context *ctx, ox::CRStringView text) noexcept;
|
||||
|
||||
template<typename T>
|
||||
void setClipboardObject([[maybe_unused]] class Context *ctx, [[maybe_unused]] ox::UniquePtr<T> obj) noexcept {
|
||||
|
||||
@@ -63,7 +63,7 @@ class Context {
|
||||
const ox::FileAddress &palettePath) noexcept;
|
||||
friend ox::Error run(Context *ctx) noexcept;
|
||||
friend void shutdown(Context *ctx) noexcept;
|
||||
friend ox::Result<ox::UniquePtr<Context>> init(ox::UniquePtr<ox::FileSystem> fs, const char *appName) noexcept;
|
||||
friend ox::Result<ox::UniquePtr<Context>> init(ox::UniquePtr<ox::FileSystem> fs, ox::CRStringView appName) noexcept;
|
||||
friend ox::String getClipboardText(Context *ctx) noexcept;
|
||||
friend uint64_t ticksMs(Context *ctx) noexcept;
|
||||
friend uint8_t bgStatus(Context *ctx) noexcept;
|
||||
@@ -73,17 +73,15 @@ class Context {
|
||||
friend void setBgCbb(Context *ctx, unsigned bgIdx, unsigned cbb) noexcept;
|
||||
friend void setBgStatus(Context *ctx, uint32_t status) noexcept;
|
||||
friend void setBgStatus(Context *ctx, unsigned bg, bool status) noexcept;
|
||||
friend void setClipboardText(Context *ctx, const ox::String &text) noexcept;
|
||||
friend void setUpdateHandler(Context *ctx, UpdateHandler h) noexcept;
|
||||
friend constexpr void setKeyEventHandler(Context *ctx, KeyEventHandler h) noexcept;
|
||||
friend constexpr KeyEventHandler keyEventHandler(Context *ctx) noexcept;
|
||||
friend void setTile(Context *ctx, unsigned bgIdx, int column, int row, uint8_t tile) noexcept;
|
||||
friend void setWindowTitle(Context *ctx, const char *title) noexcept;
|
||||
|
||||
public:
|
||||
ox::UniquePtr<ox::FileSystem> rom;
|
||||
ox::Vector<Drawer*, 5> drawers;
|
||||
const char *appName = "Nostalgia";
|
||||
ox::StringView appName = "Nostalgia";
|
||||
|
||||
#ifndef OX_BARE_METAL
|
||||
AssetManager assetManager;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
namespace nostalgia::core {
|
||||
|
||||
ox::Result<ox::UniquePtr<Context>> init(ox::UniquePtr<ox::FileSystem> fs, const char *appName = "Nostalgia") noexcept;
|
||||
ox::Result<ox::UniquePtr<Context>> init(ox::UniquePtr<ox::FileSystem> fs, ox::CRStringView appName = "Nostalgia") noexcept;
|
||||
|
||||
ox::Error run(Context *ctx) noexcept;
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ static ox::Result<std::size_t> findPreloadSection() noexcept {
|
||||
return OxError(1);
|
||||
}
|
||||
|
||||
ox::Result<ox::UniquePtr<Context>> init(ox::UniquePtr<ox::FileSystem> fs, const char *appName) noexcept {
|
||||
ox::Result<ox::UniquePtr<Context>> init(ox::UniquePtr<ox::FileSystem> fs, ox::CRStringView appName) noexcept {
|
||||
auto ctx = ox::make_unique<Context>();
|
||||
ctx->rom = std::move(fs);
|
||||
ctx->appName = appName;
|
||||
|
||||
@@ -85,7 +85,7 @@ ox::Error shutdownGfx(Context*) noexcept {
|
||||
return {};
|
||||
}
|
||||
|
||||
void setWindowTitle(Context*, const char*) noexcept {
|
||||
void setWindowTitle(Context*, ox::CRStringView) noexcept {
|
||||
}
|
||||
|
||||
void focusWindow(Context*) noexcept {
|
||||
@@ -210,10 +210,11 @@ ox::Error loadSpritePalette(Context *ctx, unsigned cbb, const ox::FileAddress &p
|
||||
}
|
||||
|
||||
// Do NOT use Context in the GBA version of this function.
|
||||
void puts(Context *ctx, int column, int row, const char *str) noexcept {
|
||||
for (int i = 0; str[i]; i++) {
|
||||
void puts(Context *ctx, int column, int row, ox::CRStringView str) noexcept {
|
||||
const auto col = static_cast<unsigned>(column);
|
||||
for (auto i = 0u; i < str.bytes(); i++) {
|
||||
const auto c = charMap[static_cast<unsigned>(str[i])];
|
||||
setTile(ctx, 0, column + i, row, static_cast<uint8_t>(c));
|
||||
setTile(ctx, 0, static_cast<int>(col + i), row, static_cast<uint8_t>(c));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
namespace nostalgia::core {
|
||||
|
||||
ox::Result<char*> loadRom(const char*) noexcept {
|
||||
ox::Result<char*> loadRom(ox::CRStringView) noexcept {
|
||||
// put the header in the wrong order to prevent mistaking this code for the
|
||||
// media section
|
||||
constexpr auto headerP2 = "HEADER__________";
|
||||
|
||||
@@ -27,7 +27,7 @@ void panic(const char*, int, const char *msg, const ox::Error &err) noexcept {
|
||||
puts(nullptr, 32 + 1, 4, "UNEXPECTED STATE:");
|
||||
puts(nullptr, 32 + 2, 6, msg);
|
||||
if (err) {
|
||||
puts(nullptr, 32 + 2, 8, serr.c_str());
|
||||
puts(nullptr, 32 + 2, 8, serr);
|
||||
}
|
||||
puts(nullptr, 32 + 1, 15, "PLEASE RESTART THE SYSTEM");
|
||||
// disable all interrupt handling and IntrWait on no interrupts
|
||||
|
||||
@@ -93,11 +93,11 @@ struct TileSheet {
|
||||
other.columns = 0;
|
||||
other.rows = 0;
|
||||
}
|
||||
constexpr SubSheet(const char *pName, int pColumns, int pRows, int bpp) noexcept:
|
||||
constexpr SubSheet(ox::CRStringView pName, int pColumns, int pRows, int bpp) noexcept:
|
||||
name(pName), columns(pColumns), rows(pRows),
|
||||
pixels(static_cast<std::size_t>(columns * rows * PixelsPerTile) / (bpp == 4 ? 2u : 1u)) {
|
||||
}
|
||||
constexpr SubSheet(const char *pName, int pColumns, int pRows, ox::Vector<uint8_t> pPixels) noexcept:
|
||||
constexpr SubSheet(ox::CRStringView pName, int pColumns, int pRows, ox::Vector<uint8_t> pPixels) noexcept:
|
||||
name(pName), columns(pColumns), rows(pRows), pixels(std::move(pPixels)) {
|
||||
}
|
||||
|
||||
@@ -375,7 +375,7 @@ struct TileSheet {
|
||||
constexpr ox::Error addSubSheet(const SubSheetIdx &idx) noexcept {
|
||||
auto &parent = getSubSheet(idx);
|
||||
if (parent.subsheets.size() < 2) {
|
||||
parent.subsheets.emplace_back(ox::sfmt("Subsheet {}", parent.subsheets.size()).c_str(), 1, 1, bpp);
|
||||
parent.subsheets.emplace_back(ox::sfmt("Subsheet {}", parent.subsheets.size()), 1, 1, bpp);
|
||||
} else {
|
||||
parent.subsheets.emplace_back("Subsheet 0", parent.columns, parent.rows, bpp);
|
||||
parent.subsheets.emplace_back("Subsheet 1", 1, 1, bpp);
|
||||
@@ -482,7 +482,7 @@ void addCustomDrawer(Context *ctx, Drawer *cd) noexcept;
|
||||
|
||||
void removeCustomDrawer(Context *ctx, Drawer *cd) noexcept;
|
||||
|
||||
void setWindowTitle(Context *ctx, const char *title) noexcept;
|
||||
void setWindowTitle(Context *ctx, ox::CRStringView title) noexcept;
|
||||
|
||||
void focusWindow(Context *ctx) noexcept;
|
||||
|
||||
@@ -518,7 +518,7 @@ ox::Error loadSpriteTileSheet(Context *ctx,
|
||||
const ox::FileAddress &tilesheetAddr,
|
||||
const ox::FileAddress &paletteAddr) noexcept;
|
||||
|
||||
void puts(Context *ctx, int column, int row, const char *str) noexcept;
|
||||
void puts(Context *ctx, int column, int row, ox::CRStringView str) noexcept;
|
||||
|
||||
void setTile(Context *ctx, unsigned bgIdx, int column, int row, uint8_t tile) noexcept;
|
||||
|
||||
|
||||
@@ -17,9 +17,11 @@ ox::String getClipboardText(Context *ctx) noexcept {
|
||||
return glfwGetClipboardString(id->window);
|
||||
}
|
||||
|
||||
void setClipboardText(Context *ctx, const ox::String &text) noexcept {
|
||||
void setClipboardText(Context *ctx, ox::CRStringView text) noexcept {
|
||||
const auto id = ctx->windowerData<GlfwImplData>();
|
||||
glfwSetClipboardString(id->window, text.c_str());
|
||||
auto cstr = ox_malloca(text.bytes() + 1, char);
|
||||
ox_strncpy(cstr.get(), text.data(), text.bytes());
|
||||
glfwSetClipboardString(id->window, cstr);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
namespace nostalgia::core {
|
||||
|
||||
ox::Result<ox::UniquePtr<Context>> init(ox::UniquePtr<ox::FileSystem> fs, const char *appName) noexcept {
|
||||
ox::Result<ox::UniquePtr<Context>> init(ox::UniquePtr<ox::FileSystem> fs, ox::CRStringView appName) noexcept {
|
||||
auto ctx = ox::make_unique<Context>();
|
||||
ctx->rom = std::move(fs);
|
||||
ctx->appName = appName;
|
||||
|
||||
@@ -192,7 +192,9 @@ ox::Error initGfx(Context *ctx) noexcept {
|
||||
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE);
|
||||
}
|
||||
glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE);
|
||||
id->window = glfwCreateWindow(240 * Scale, 160 * Scale, ctx->appName, nullptr, nullptr);
|
||||
auto cstr = ox_malloca(ctx->appName.bytes() + 1, char);
|
||||
ox_strncpy(cstr.get(), ctx->appName.data(), ctx->appName.bytes());
|
||||
id->window = glfwCreateWindow(240 * Scale, 160 * Scale, cstr, nullptr, nullptr);
|
||||
if (id->window == nullptr) {
|
||||
return OxError(1, "Could not open GLFW window");
|
||||
}
|
||||
@@ -220,9 +222,11 @@ ox::Error initGfx(Context *ctx) noexcept {
|
||||
return OxError(0);
|
||||
}
|
||||
|
||||
void setWindowTitle(Context *ctx, const char *title) noexcept {
|
||||
void setWindowTitle(Context *ctx, ox::CRStringView title) noexcept {
|
||||
const auto id = ctx->windowerData<GlfwImplData>();
|
||||
glfwSetWindowTitle(id->window, title);
|
||||
auto cstr = ox_malloca(title.bytes() + 1, char);
|
||||
ox_strncpy(cstr.get(), title.data(), title.bytes());
|
||||
glfwSetWindowTitle(id->window, cstr);
|
||||
}
|
||||
|
||||
void focusWindow(Context *ctx) noexcept {
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace nostalgia::core {
|
||||
|
||||
ox::Result<ox::UniquePtr<Context>> init(ox::UniquePtr<ox::FileSystem>, const char*) noexcept {
|
||||
ox::Result<ox::UniquePtr<Context>> init(ox::UniquePtr<ox::FileSystem>, ox::CRStringView) noexcept {
|
||||
return OxError(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ ox::Error shutdownGfx(Context*) noexcept {
|
||||
return OxError(0);
|
||||
}
|
||||
|
||||
void setWindowTitle(Context*, const char*) noexcept {
|
||||
void setWindowTitle(Context*, ox::CRStringView) noexcept {
|
||||
}
|
||||
|
||||
void focusWindow(Context*) noexcept {
|
||||
@@ -75,7 +75,7 @@ ox::Error loadSpritePalette(Context*, int, const ox::FileAddress&) noexcept {
|
||||
}
|
||||
|
||||
// Do NOT use Context in the GBA version of this function.
|
||||
void puts(Context*, int, int, const char*) noexcept {
|
||||
void puts(Context*, int, int, ox::CRStringView) noexcept {
|
||||
}
|
||||
|
||||
void setTile(Context*, int, int, int, uint8_t) noexcept {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
namespace nostalgia::core {
|
||||
|
||||
ox::Result<char*> loadRom(const char*) noexcept {
|
||||
ox::Result<char*> loadRom(ox::CRStringView) noexcept {
|
||||
return OxError(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
namespace nostalgia::core {
|
||||
|
||||
ox::Result<ox::UniquePtr<ox::FileSystem>> loadRomFs(const char *path) noexcept {
|
||||
ox::Result<ox::UniquePtr<ox::FileSystem>> loadRomFs(ox::CRStringView path) noexcept {
|
||||
const auto lastDot = ox_lastIndexOf(path, '.');
|
||||
const auto fsExt = lastDot != -1 ? path + lastDot : "";
|
||||
const auto fsExt = lastDot != -1 ? path.substr(static_cast<std::size_t>(lastDot)) : "";
|
||||
if (ox_strcmp(fsExt, ".oxfs") == 0) {
|
||||
oxRequire(rom, core::loadRom(path));
|
||||
return {ox::make_unique<ox::FileSystem32>(rom, 32 * ox::units::MB, unloadRom)};
|
||||
|
||||
@@ -89,9 +89,9 @@ ox::Error writeObj(Context *ctx, const ox::FileAddress &file, const T &obj,
|
||||
return ctx->rom->write(file, objBuff.data(), objBuff.size());
|
||||
}
|
||||
|
||||
ox::Result<ox::UniquePtr<ox::FileSystem>> loadRomFs(const char *path) noexcept;
|
||||
ox::Result<ox::UniquePtr<ox::FileSystem>> loadRomFs(ox::CRStringView path) noexcept;
|
||||
|
||||
ox::Result<char*> loadRom(const char *path = "") noexcept;
|
||||
ox::Result<char*> loadRom(ox::CRStringView path = "") noexcept;
|
||||
|
||||
void unloadRom(char*) noexcept;
|
||||
|
||||
|
||||
@@ -416,7 +416,7 @@ void TileSheetEditorImGui::SubSheetEditor::draw() noexcept {
|
||||
if (ImGui::Button("OK")) {
|
||||
ImGui::CloseCurrentPopup();
|
||||
m_show = false;
|
||||
inputSubmitted.emit(m_name.c_str(), m_cols, m_rows);
|
||||
inputSubmitted.emit(m_name, m_cols, m_rows);
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Cancel")) {
|
||||
|
||||
@@ -32,7 +32,7 @@ class TileSheetEditorImGui: public studio::BaseEditor {
|
||||
int m_rows = 0;
|
||||
bool m_show = false;
|
||||
public:
|
||||
ox::Signal<ox::Error(const ox::String &name, int cols, int rows)> inputSubmitted;
|
||||
ox::Signal<ox::Error(const ox::StringView &name, int cols, int rows)> inputSubmitted;
|
||||
constexpr void show(const ox::String &name, int cols, int rows) noexcept {
|
||||
m_show = true;
|
||||
m_name = name.c_str();
|
||||
|
||||
@@ -256,7 +256,7 @@ class AddSubSheetCommand: public TileSheetCommand {
|
||||
auto &parent = m_img->getSubSheet(m_parentIdx);
|
||||
if (m_addedSheets.size() < 2) {
|
||||
auto i = parent.subsheets.size();
|
||||
parent.subsheets.emplace_back(ox::sfmt("Subsheet {}", i).c_str(), 1, 1, m_img->bpp);
|
||||
parent.subsheets.emplace_back(ox::sfmt("Subsheet {}", i), 1, 1, m_img->bpp);
|
||||
} else {
|
||||
parent.subsheets.emplace_back("Subsheet 0", parent.columns, parent.rows, std::move(parent.pixels));
|
||||
parent.rows = 0;
|
||||
|
||||
@@ -49,8 +49,8 @@ static const auto converters = [] {
|
||||
}();
|
||||
|
||||
[[nodiscard]]
|
||||
static auto findConverter(const char *srcTypeName, int srcTypeVersion,
|
||||
const char *dstTypeName, int dstTypeVersion) noexcept -> ox::Result<BaseConverter*> {
|
||||
static auto findConverter(ox::CRStringView srcTypeName, int srcTypeVersion,
|
||||
ox::CRStringView dstTypeName, int dstTypeVersion) noexcept -> ox::Result<BaseConverter*> {
|
||||
for (auto &c : converters) {
|
||||
if (c->matches(srcTypeName, srcTypeVersion, dstTypeName, dstTypeVersion)) {
|
||||
return c.get();
|
||||
@@ -60,8 +60,8 @@ static auto findConverter(const char *srcTypeName, int srcTypeVersion,
|
||||
};
|
||||
|
||||
static ox::Result<ox::UniquePtr<Wrap>> convert(const ox::Buffer &srcBuffer,
|
||||
const char *srcTypeName, int srcTypeVersion,
|
||||
const char *dstTypeName, int dstTypeVersion) noexcept {
|
||||
ox::CRStringView srcTypeName, int srcTypeVersion,
|
||||
ox::CRStringView dstTypeName, int dstTypeVersion) noexcept {
|
||||
// look for direct converter
|
||||
auto [c, err] = findConverter(srcTypeName, srcTypeVersion, dstTypeName, dstTypeVersion);
|
||||
if (!err) {
|
||||
@@ -82,9 +82,9 @@ static ox::Result<ox::UniquePtr<Wrap>> convert(const ox::Buffer &srcBuffer,
|
||||
return OxError(1, "Could not convert between types");
|
||||
}
|
||||
|
||||
ox::Result<ox::UniquePtr<Wrap>> convert(const ox::Buffer &srcBuffer, const char *dstTypeName, int dstTypeVersion) noexcept {
|
||||
ox::Result<ox::UniquePtr<Wrap>> convert(const ox::Buffer &srcBuffer, ox::CRStringView dstTypeName, int dstTypeVersion) noexcept {
|
||||
oxRequire(hdr, ox::readClawHeader(srcBuffer));
|
||||
return convert(srcBuffer, hdr.typeName.c_str(), hdr.typeVersion, dstTypeName, dstTypeVersion);
|
||||
return convert(srcBuffer, hdr.typeName, hdr.typeVersion, dstTypeName, dstTypeVersion);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -51,24 +51,24 @@ struct BaseConverter {
|
||||
virtual ~BaseConverter() noexcept = default;
|
||||
|
||||
[[nodiscard]]
|
||||
virtual const char *srcTypeName() noexcept = 0;
|
||||
virtual ox::StringView srcTypeName() noexcept = 0;
|
||||
|
||||
[[nodiscard]]
|
||||
virtual int srcTypeVersion() noexcept = 0;
|
||||
|
||||
[[nodiscard]]
|
||||
virtual bool srcMatches(const char *srcTypeName, int srcTypeVersion) const noexcept = 0;
|
||||
virtual bool srcMatches(ox::CRStringView srcTypeName, int srcTypeVersion) const noexcept = 0;
|
||||
|
||||
[[nodiscard]]
|
||||
virtual bool dstMatches(const char *dstTypeName, int dstTypeVersion) const noexcept = 0;
|
||||
virtual bool dstMatches(ox::CRStringView dstTypeName, int dstTypeVersion) const noexcept = 0;
|
||||
|
||||
virtual ox::Result<ox::UniquePtr<Wrap>> convertPtrToPtr(Wrap *src) noexcept = 0;
|
||||
|
||||
virtual ox::Result<ox::UniquePtr<Wrap>> convertBuffToPtr(const ox::Buffer &srcBuff) noexcept = 0;
|
||||
|
||||
[[nodiscard]]
|
||||
inline bool matches(const char *srcTypeName, int srcTypeVersion,
|
||||
const char *dstTypeName, int dstTypeVersion) const noexcept {
|
||||
inline bool matches(ox::CRStringView srcTypeName, int srcTypeVersion,
|
||||
ox::CRStringView dstTypeName, int dstTypeVersion) const noexcept {
|
||||
return srcMatches(srcTypeName, srcTypeVersion)
|
||||
&& dstMatches(dstTypeName, dstTypeVersion);
|
||||
}
|
||||
@@ -81,7 +81,7 @@ struct Converter: public BaseConverter {
|
||||
virtual ox::Error convert(SrcType*, DstType*) noexcept = 0;
|
||||
|
||||
[[nodiscard]]
|
||||
const char *srcTypeName() noexcept final {
|
||||
ox::StringView srcTypeName() noexcept final {
|
||||
return ox::requireModelTypeName<SrcType>();
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ struct Converter: public BaseConverter {
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool srcMatches(const char *srcTypeName, int srcTypeVersion) const noexcept final {
|
||||
bool srcMatches(ox::CRStringView srcTypeName, int srcTypeVersion) const noexcept final {
|
||||
static constexpr auto SrcTypeName = ox::requireModelTypeName<SrcType>();
|
||||
static constexpr auto SrcTypeVersion = ox::requireModelTypeVersion<SrcType>();
|
||||
return ox_strcmp(srcTypeName, SrcTypeName) == 0
|
||||
@@ -99,7 +99,7 @@ struct Converter: public BaseConverter {
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool dstMatches(const char *dstTypeName, int dstTypeVersion) const noexcept final {
|
||||
bool dstMatches(ox::CRStringView dstTypeName, int dstTypeVersion) const noexcept final {
|
||||
static constexpr auto DstTypeName = ox::requireModelTypeName<DstType>();
|
||||
static constexpr auto DstTypeVersion = ox::requireModelTypeVersion<DstType>();
|
||||
return ox_strcmp(dstTypeName, DstTypeName) == 0
|
||||
@@ -122,7 +122,7 @@ struct Converter: public BaseConverter {
|
||||
};
|
||||
|
||||
ox::Result<ox::UniquePtr<Wrap>> convert(const ox::Buffer &srcBuffer,
|
||||
const char *dstTypeName, int dstTypeVersion) noexcept;
|
||||
ox::CRStringView dstTypeName, int dstTypeVersion) noexcept;
|
||||
|
||||
template<typename DstType>
|
||||
ox::Result<DstType> convert(const ox::Buffer &srcBuffer) noexcept {
|
||||
|
||||
@@ -52,9 +52,10 @@ ox::Error loadSpriteTileSheet(Context*,
|
||||
return OxError(0);
|
||||
}
|
||||
|
||||
void puts(Context *ctx, int column, int row, const char *str) noexcept {
|
||||
for (int i = 0; str[i]; ++i) {
|
||||
setTile(ctx, 0, column + i, row, static_cast<uint8_t>(charMap[static_cast<uint8_t>(str[i])]));
|
||||
void puts(Context *ctx, int column, int row, ox::CRStringView str) noexcept {
|
||||
const auto col = static_cast<unsigned>(column);
|
||||
for (auto i = 0u; i < str.bytes(); ++i) {
|
||||
setTile(ctx, 0, static_cast<int>(col + i), row, static_cast<uint8_t>(charMap[static_cast<uint8_t>(str[i])]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
namespace nostalgia::core {
|
||||
|
||||
ox::Result<char*> loadRom(const char *path) noexcept {
|
||||
std::ifstream file(path, std::ios::binary | std::ios::ate);
|
||||
ox::Result<char*> loadRom(ox::CRStringView path) noexcept {
|
||||
std::ifstream file(toStdStringView(path), std::ios::binary | std::ios::ate);
|
||||
if (!file.good()) {
|
||||
oxErrorf("Could not find ROM file: {}", path);
|
||||
return OxError(1, "Could not find ROM file");
|
||||
|
||||
Reference in New Issue
Block a user