Merge commit 'ce53be92716b0f5201882d6959c398b61c6cc93c'
This commit is contained in:
commit
62a3066c7c
1
deps/nostalgia/Makefile
vendored
1
deps/nostalgia/Makefile
vendored
@ -19,6 +19,7 @@ pkg-gba: build
|
||||
|
||||
.PHONY: generate-studio-rsrc
|
||||
generate-studio-rsrc:
|
||||
${BC_CMD_ENVRUN} ${BC_PY3} ./util/scripts/file-to-cpp.py --rsrc src/olympic/studio/applib/src/rsrc.json
|
||||
${BC_CMD_ENVRUN} ${BC_PY3} ./util/scripts/file-to-cpp.py --rsrc src/nostalgia/studio/rsrc.json
|
||||
|
||||
.PHONY: build-player
|
||||
|
@ -29,7 +29,7 @@ ClArgs::ClArgs(ox::SpanView<const char*> args) noexcept {
|
||||
m_bools[arg] = false;
|
||||
}
|
||||
m_strings[arg] = val;
|
||||
if (auto r = ox::atoi(val.c_str()); r.error == 0) {
|
||||
if (auto r = ox::strToInt(val); r.error == 0) {
|
||||
m_ints[arg] = r.value;
|
||||
}
|
||||
++i;
|
||||
|
2
deps/nostalgia/deps/ox/src/ox/claw/read.cpp
vendored
2
deps/nostalgia/deps/ox/src/ox/claw/read.cpp
vendored
@ -81,7 +81,7 @@ Result<ClawHeader> readClawHeader(ox::BufferView buff) noexcept {
|
||||
return ox::Error(4, "Claw format does not match any supported format/version combo");
|
||||
}
|
||||
hdr.typeName = typeName;
|
||||
std::ignore = ox::atoi(versionStr).copyTo(hdr.typeVersion);
|
||||
std::ignore = ox::strToInt(versionStr).copyTo(hdr.typeVersion);
|
||||
hdr.data = buffRaw;
|
||||
hdr.dataSize = buffLen;
|
||||
return hdr;
|
||||
|
@ -31,10 +31,10 @@ FileAddress::FileAddress(uint64_t inode) noexcept {
|
||||
FileAddress::FileAddress(ox::StringViewCR path) noexcept {
|
||||
auto pathSize = path.bytes();
|
||||
m_data.path = new char[pathSize + 1];
|
||||
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
||||
memcpy(m_data.path, path.data(), pathSize);
|
||||
OX_CLANG_NOWARN_BEGIN(-Wunsafe-buffer-usage)
|
||||
m_data.path[pathSize] = 0;
|
||||
OX_CLANG_NOWARN_END
|
||||
OX_ALLOW_UNSAFE_BUFFERS_END
|
||||
m_type = FileAddressType::Path;
|
||||
}
|
||||
|
||||
@ -48,9 +48,11 @@ FileAddress &FileAddress::operator=(const FileAddress &other) noexcept {
|
||||
case FileAddressType::Path:
|
||||
{
|
||||
if (other.m_data.path) {
|
||||
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
||||
auto strSize = ox::strlen(other.m_data.path) + 1;
|
||||
m_data.path = new char[strSize];
|
||||
ox::memcpy(m_data.path, other.m_data.path, strSize);
|
||||
OX_ALLOW_UNSAFE_BUFFERS_END
|
||||
} else {
|
||||
m_data.constPath = "";
|
||||
m_type = FileAddressType::ConstPath;
|
||||
|
@ -468,7 +468,7 @@ Error FileSystemTemplate<FileStore, Directory>::writeFilePath(
|
||||
|
||||
template<typename FileStore, typename Directory>
|
||||
Error FileSystemTemplate<FileStore, Directory>::writeFileInode(uint64_t inode, const void *buffer, uint64_t size, FileType fileType) noexcept {
|
||||
oxTrace("ox.fs.FileSystemTemplate.writeFileInode", ox::itoa(inode));
|
||||
oxTrace("ox.fs.FileSystemTemplate.writeFileInode", ox::intToStr(inode));
|
||||
return m_fs.write(inode, buffer, static_cast<size_t>(size), static_cast<uint8_t>(fileType));
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,9 @@ const std::map<ox::StringView, std::function<ox::Error(ox::StringView)>> tests =
|
||||
auto constexpr path = ox::StringLiteral("/usr/share/charset.gbag");
|
||||
ox::PathIterator it(path.c_str(), path.len());
|
||||
auto buff = static_cast<char*>(ox_alloca(path.len() + 1));
|
||||
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
||||
oxAssert(it.dirPath(buff, path.len()) == 0 && ox::strcmp(buff, "/usr/share/") == 0, "PathIterator shows incorrect dir path");
|
||||
OX_ALLOW_UNSAFE_BUFFERS_END
|
||||
return ox::Error(0);
|
||||
}
|
||||
},
|
||||
@ -127,7 +129,9 @@ const std::map<ox::StringView, std::function<ox::Error(ox::StringView)>> tests =
|
||||
"PathIterator::hasNext",
|
||||
[](ox::StringView) {
|
||||
const auto path = "/file1";
|
||||
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
||||
ox::PathIterator it(path, ox::strlen(path));
|
||||
OX_ALLOW_UNSAFE_BUFFERS_END
|
||||
oxAssert(it.hasNext(), "PathIterator shows incorrect hasNext");
|
||||
oxAssert(!it.next().hasNext(), "PathIterator shows incorrect hasNext");
|
||||
return ox::Error(0);
|
||||
@ -163,9 +167,11 @@ const std::map<ox::StringView, std::function<ox::Error(ox::StringView)>> tests =
|
||||
[](ox::StringView) {
|
||||
constexpr auto buffLen = 5000;
|
||||
constexpr auto str1 = "Hello, World!";
|
||||
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
||||
constexpr auto str1Len = ox::strlen(str1) + 1;
|
||||
constexpr auto str2 = "Hello, Moon!";
|
||||
constexpr auto str2Len = ox::strlen(str2) + 1;
|
||||
OX_ALLOW_UNSAFE_BUFFERS_END
|
||||
auto list = new (ox_alloca(buffLen)) ox::ptrarith::NodeBuffer<uint32_t, ox::FileStoreItem<uint32_t>>(buffLen);
|
||||
oxAssert(ox::FileStore32::format(list, buffLen), "FileStore::format failed.");
|
||||
ox::FileStore32 fileStore(list, buffLen);
|
||||
|
2
deps/nostalgia/deps/ox/src/ox/fs/tool.cpp
vendored
2
deps/nostalgia/deps/ox/src/ox/fs/tool.cpp
vendored
@ -57,7 +57,9 @@ static ox::Error runRead(ox::FileSystem *fs, ox::Span<const char*> args) noexcep
|
||||
return ox::Error(1);
|
||||
}
|
||||
OX_REQUIRE(buff, fs->read(ox::StringView(args[1])));
|
||||
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
||||
std::ignore = fwrite(buff.data(), sizeof(decltype(buff)::value_type), buff.size(), stdout);
|
||||
OX_ALLOW_UNSAFE_BUFFERS_END
|
||||
return ox::Error(0);
|
||||
}
|
||||
|
||||
|
64
deps/nostalgia/deps/ox/src/ox/mc/intops.hpp
vendored
64
deps/nostalgia/deps/ox/src/ox/mc/intops.hpp
vendored
@ -71,7 +71,9 @@ constexpr McInt encodeInteger(I pInput) noexcept {
|
||||
// move input to uint64_t to allow consistent bit manipulation, and to avoid
|
||||
// overflow concerns
|
||||
uint64_t val = 0;
|
||||
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
||||
ox::memcpy(&val, &input, sizeof(input));
|
||||
OX_ALLOW_UNSAFE_BUFFERS_END
|
||||
if (val) {
|
||||
// bits needed to represent number factoring in space possibly
|
||||
// needed for signed bit
|
||||
@ -94,7 +96,9 @@ constexpr McInt encodeInteger(I pInput) noexcept {
|
||||
}
|
||||
if (bytes == 9) {
|
||||
out.data[0] = bytesIndicator;
|
||||
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
||||
ox::memcpy(&out.data[1], &leVal, 8);
|
||||
OX_ALLOW_UNSAFE_BUFFERS_END
|
||||
if (inputNegative) {
|
||||
out.data[1] |= 0b1000'0000;
|
||||
}
|
||||
@ -104,7 +108,9 @@ constexpr McInt encodeInteger(I pInput) noexcept {
|
||||
auto intermediate =
|
||||
static_cast<uint64_t>(leVal.raw() | (negBit << (valBits - 1))) << bytes |
|
||||
static_cast<uint64_t>(bytesIndicator);
|
||||
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
||||
ox::memcpy(&out.data[0], &intermediate, sizeof(intermediate));
|
||||
OX_ALLOW_UNSAFE_BUFFERS_END
|
||||
}
|
||||
out.length = bytes;
|
||||
}
|
||||
@ -151,33 +157,37 @@ constexpr Result<I> decodeInteger(Reader_c auto&rdr, std::size_t *bytesRead) noe
|
||||
decoded >>= bytes;
|
||||
// move sign bit
|
||||
if constexpr(is_signed_v<I>) {
|
||||
const auto negBit = bytes * 8 - bytes - 1;
|
||||
// move sign
|
||||
const auto negative = (decoded >> negBit) == 1;
|
||||
if (negative) {
|
||||
// fill in all bits between encoded sign and real sign with 1s
|
||||
// split it up because the 32-bit ARM can't shift more than 32 bits
|
||||
ox::Array<uint32_t, 2> d = {};
|
||||
//d[0] = decoded & 0xffff'ffff;
|
||||
//d[1] = decoded >> 32;
|
||||
ox::memcpy(&d[0], &decoded, sizeof(decoded));
|
||||
auto bit = negBit;
|
||||
for (; bit < ox::min<std::size_t>(Bits<I>, 32); ++bit) {
|
||||
d[0] |= 1 << bit;
|
||||
}
|
||||
bit -= 32;
|
||||
for (; bit < Bits<I>; ++bit) {
|
||||
d[1] |= 1 << bit;
|
||||
}
|
||||
I out = 0;
|
||||
if constexpr(ox::defines::BigEndian) {
|
||||
const auto d0Tmp = d[0];
|
||||
d[0] = d[1];
|
||||
d[1] = d0Tmp;
|
||||
}
|
||||
ox::memcpy(&out, &d[0], sizeof(out));
|
||||
return out;
|
||||
}
|
||||
const auto negBit = bytes * 8 - bytes - 1;
|
||||
// move sign
|
||||
const auto negative = (decoded >> negBit) == 1;
|
||||
if (negative) {
|
||||
// fill in all bits between encoded sign and real sign with 1s
|
||||
// split it up because the 32-bit ARM can't shift more than 32 bits
|
||||
ox::Array<uint32_t, 2> d = {};
|
||||
//d[0] = decoded & 0xffff'ffff;
|
||||
//d[1] = decoded >> 32;
|
||||
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
||||
ox::memcpy(&d[0], &decoded, sizeof(decoded));
|
||||
OX_ALLOW_UNSAFE_BUFFERS_END
|
||||
auto bit = negBit;
|
||||
for (; bit < ox::min<std::size_t>(Bits<I>, 32); ++bit) {
|
||||
d[0] |= 1 << bit;
|
||||
}
|
||||
bit -= 32;
|
||||
for (; bit < Bits<I>; ++bit) {
|
||||
d[1] |= 1 << bit;
|
||||
}
|
||||
I out = 0;
|
||||
if constexpr(ox::defines::BigEndian) {
|
||||
const auto d0Tmp = d[0];
|
||||
d[0] = d[1];
|
||||
d[1] = d0Tmp;
|
||||
}
|
||||
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
||||
ox::memcpy(&out, &d[0], sizeof(out));
|
||||
OX_ALLOW_UNSAFE_BUFFERS_END
|
||||
return out;
|
||||
}
|
||||
}
|
||||
return static_cast<I>(decoded);
|
||||
}
|
||||
|
6
deps/nostalgia/deps/ox/src/ox/mc/write.hpp
vendored
6
deps/nostalgia/deps/ox/src/ox/mc/write.hpp
vendored
@ -211,10 +211,12 @@ constexpr Error MetalClawWriter<Writer>::field(const char *name, const IString<L
|
||||
}
|
||||
|
||||
template<Writer_c Writer>
|
||||
constexpr Error MetalClawWriter<Writer>::fieldCString(const char*, const char *const*val, std::size_t) noexcept {
|
||||
constexpr Error MetalClawWriter<Writer>::fieldCString(const char*, const char *const*val, std::size_t buffLen) noexcept {
|
||||
bool fieldSet = false;
|
||||
if (!m_unionIdx.has_value() || *m_unionIdx == m_field) {
|
||||
const auto strLen = *val ? ox::strlen(*val) : 0;
|
||||
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
||||
const auto strLen = *val ? ox::strnlen_s(*val, buffLen) : 0;
|
||||
OX_ALLOW_UNSAFE_BUFFERS_END
|
||||
// write the length
|
||||
const auto strLenBuff = mc::encodeInteger(strLen);
|
||||
OX_RETURN_ERROR(m_writer.write(reinterpret_cast<const char*>(strLenBuff.data.data()), strLenBuff.length));
|
||||
|
@ -997,7 +997,7 @@ constexpr ModelValue::ModelValue(const ModelValue &other) noexcept {
|
||||
case Type::SignedInteger16:
|
||||
case Type::SignedInteger32:
|
||||
case Type::SignedInteger64:
|
||||
ox::memcpy(&m_data, &other.m_data, sizeof(m_data));
|
||||
m_data = other.m_data;
|
||||
break;
|
||||
case Type::String:
|
||||
m_data.str = new String(other.get<String>());
|
||||
@ -1030,8 +1030,8 @@ constexpr ModelValue::ModelValue(ModelValue &&other) noexcept {
|
||||
case Type::SignedInteger16:
|
||||
case Type::SignedInteger32:
|
||||
case Type::SignedInteger64:
|
||||
ox::memcpy(&m_data, &other.m_data, sizeof(m_data));
|
||||
ox::memset(&other.m_data, 0, sizeof(m_data));
|
||||
m_data = other.m_data;
|
||||
other.m_data.ui64 = 0;
|
||||
break;
|
||||
case Type::String:
|
||||
m_data.str = other.m_data.str;
|
||||
@ -1223,7 +1223,7 @@ constexpr ModelValue &ModelValue::operator=(const ModelValue &other) noexcept {
|
||||
case Type::SignedInteger16:
|
||||
case Type::SignedInteger32:
|
||||
case Type::SignedInteger64:
|
||||
ox::memcpy(&m_data, &other.m_data, sizeof(m_data));
|
||||
m_data = other.m_data;
|
||||
break;
|
||||
case Type::String:
|
||||
m_data.str = new String(other.get<String>());
|
||||
@ -1261,8 +1261,8 @@ constexpr ModelValue &ModelValue::operator=(ModelValue &&other) noexcept {
|
||||
case Type::SignedInteger16:
|
||||
case Type::SignedInteger32:
|
||||
case Type::SignedInteger64:
|
||||
ox::memcpy(&m_data, &other.m_data, sizeof(m_data));
|
||||
ox::memset(&other.m_data, 0, sizeof(m_data));
|
||||
m_data = other.m_data;
|
||||
other.m_data = {};
|
||||
break;
|
||||
case Type::String:
|
||||
m_data.str = other.m_data.str;
|
||||
|
2
deps/nostalgia/deps/ox/src/ox/oc/read.cpp
vendored
2
deps/nostalgia/deps/ox/src/ox/oc/read.cpp
vendored
@ -15,7 +15,7 @@ namespace ox {
|
||||
|
||||
OrganicClawReader::OrganicClawReader(const uint8_t *buff, std::size_t buffSize) {
|
||||
auto json = reinterpret_cast<const char*>(buff);
|
||||
auto jsonLen = ox::strnlen(json, buffSize);
|
||||
auto jsonLen = ox::strnlen_s(json, buffSize);
|
||||
Json::CharReaderBuilder parserBuilder;
|
||||
auto parser = std::unique_ptr<Json::CharReader>(parserBuilder.newCharReader());
|
||||
if (!parser->parse(json, json + jsonLen, &m_json, nullptr)) {
|
||||
|
4
deps/nostalgia/deps/ox/src/ox/oc/read.hpp
vendored
4
deps/nostalgia/deps/ox/src/ox/oc/read.hpp
vendored
@ -8,7 +8,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ox/std/def.hpp>
|
||||
|
||||
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
||||
#include <json/json.h>
|
||||
OX_ALLOW_UNSAFE_BUFFERS_END
|
||||
|
||||
#include <ox/model/fieldcounter.hpp>
|
||||
#include <ox/model/modelhandleradaptor.hpp>
|
||||
|
8
deps/nostalgia/deps/ox/src/ox/oc/write.hpp
vendored
8
deps/nostalgia/deps/ox/src/ox/oc/write.hpp
vendored
@ -8,7 +8,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ox/std/def.hpp>
|
||||
|
||||
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
||||
#include <json/json.h>
|
||||
OX_ALLOW_UNSAFE_BUFFERS_END
|
||||
|
||||
#include <ox/model/fieldcounter.hpp>
|
||||
#include <ox/model/modelhandleradaptor.hpp>
|
||||
@ -258,7 +262,9 @@ Result<ox::Buffer> writeOC(const auto &val) noexcept {
|
||||
const auto str = Json::writeString(jsonBuilder, writer.m_json);
|
||||
Result<Buffer> buff;
|
||||
buff.value.resize(str.size() + 1);
|
||||
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
||||
memcpy(buff.value.data(), str.data(), str.size() + 1);
|
||||
OX_ALLOW_UNSAFE_BUFFERS_END
|
||||
return buff;
|
||||
}
|
||||
|
||||
@ -270,7 +276,9 @@ Result<ox::String> writeOCString(const auto &val) noexcept {
|
||||
const auto str = Json::writeString(jsonBuilder, writer.m_json);
|
||||
Result<ox::String> buff;
|
||||
buff.value.resize(str.size());
|
||||
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
||||
memcpy(buff.value.data(), str.data(), str.size() + 1);
|
||||
OX_ALLOW_UNSAFE_BUFFERS_END
|
||||
return buff;
|
||||
}
|
||||
|
||||
|
@ -30,9 +30,12 @@ constexpr T1 strncpy(T1 dest, T2 src, std::size_t maxLen) noexcept {
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr auto strnlen(const char *str1, std::size_t maxLen) noexcept {
|
||||
std::size_t len = 0;
|
||||
for (; len < maxLen && str1[len]; len++);
|
||||
constexpr size_t strnlen_s(const char *str, size_t const maxLen) noexcept {
|
||||
if (!str) [[unlikely]] {
|
||||
return 0;
|
||||
}
|
||||
size_t len = 0;
|
||||
for (; len < maxLen && str[len]; len++);
|
||||
return len;
|
||||
}
|
||||
|
||||
|
@ -245,7 +245,7 @@ struct MaybeView<ox::IString<sz>> {
|
||||
|
||||
template<Integer_c Integer>
|
||||
[[nodiscard]]
|
||||
constexpr auto itoa(Integer v) noexcept {
|
||||
constexpr auto intToStr(Integer v) noexcept {
|
||||
constexpr auto Cap = [] {
|
||||
auto out = 0;
|
||||
switch (sizeof(Integer)) {
|
||||
|
18
deps/nostalgia/deps/ox/src/ox/std/span.hpp
vendored
18
deps/nostalgia/deps/ox/src/ox/std/span.hpp
vendored
@ -8,6 +8,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if __has_include(<array>)
|
||||
#include <array>
|
||||
#endif
|
||||
|
||||
#include "array.hpp"
|
||||
#include "bit.hpp"
|
||||
#include "def.hpp"
|
||||
@ -35,6 +39,20 @@ class Span {
|
||||
|
||||
constexpr Span() noexcept = default;
|
||||
|
||||
#if __has_include(<array>)
|
||||
template<std::size_t sz>
|
||||
constexpr Span(std::array<T, sz> &a) noexcept:
|
||||
m_items(a.data()),
|
||||
m_size(a.size()) {
|
||||
}
|
||||
|
||||
template<std::size_t sz>
|
||||
constexpr Span(std::array<ox::remove_const_t<T>, sz> const&a) noexcept:
|
||||
m_items(a.data()),
|
||||
m_size(a.size()) {
|
||||
}
|
||||
#endif
|
||||
|
||||
template<std::size_t sz>
|
||||
constexpr Span(ox::Array<T, sz> &a) noexcept:
|
||||
m_items(a.data()),
|
||||
|
10
deps/nostalgia/deps/ox/src/ox/std/string.hpp
vendored
10
deps/nostalgia/deps/ox/src/ox/std/string.hpp
vendored
@ -28,7 +28,7 @@ OX_CLANG_NOWARN_BEGIN(-Wunsafe-buffer-usage)
|
||||
namespace ox {
|
||||
|
||||
template<typename Integer>
|
||||
constexpr ox::IString<21> itoa(Integer v) noexcept;
|
||||
constexpr ox::IString<21> intToStr(Integer v) noexcept;
|
||||
|
||||
template<std::size_t SmallStringSize_v>
|
||||
class BasicString {
|
||||
@ -317,13 +317,13 @@ constexpr BasicString<SmallStringSize_v> &BasicString<SmallStringSize_v>::operat
|
||||
|
||||
template<std::size_t SmallStringSize_v>
|
||||
constexpr BasicString<SmallStringSize_v> &BasicString<SmallStringSize_v>::operator=(int64_t i) noexcept {
|
||||
set(ox::itoa(i));
|
||||
set(ox::intToStr(i));
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<std::size_t SmallStringSize_v>
|
||||
constexpr BasicString<SmallStringSize_v> &BasicString<SmallStringSize_v>::operator=(uint64_t i) noexcept {
|
||||
set(ox::itoa(i));
|
||||
set(ox::intToStr(i));
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -371,7 +371,7 @@ constexpr BasicString<SmallStringSize_v> &BasicString<SmallStringSize_v>::operat
|
||||
|
||||
template<std::size_t SmallStringSize_v>
|
||||
constexpr BasicString<SmallStringSize_v> &BasicString<SmallStringSize_v>::operator+=(Integer_c auto i) noexcept {
|
||||
auto const str = ox::itoa(i);
|
||||
auto const str = ox::intToStr(i);
|
||||
return this->operator+=(str.c_str());
|
||||
}
|
||||
|
||||
@ -414,7 +414,7 @@ constexpr BasicString<SmallStringSize_v> BasicString<SmallStringSize_v>::operato
|
||||
|
||||
template<std::size_t SmallStringSize_v>
|
||||
constexpr BasicString<SmallStringSize_v> BasicString<SmallStringSize_v>::operator+(Integer_c auto i) const noexcept {
|
||||
auto const str = ox::itoa(i);
|
||||
auto const str = ox::intToStr(i);
|
||||
return *this + str;
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,9 @@ class StringLiteral: public detail::BaseStringView {
|
||||
|
||||
constexpr explicit StringLiteral(const char *str, std::size_t len) noexcept: BaseStringView(str, len) {}
|
||||
|
||||
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
||||
constexpr explicit StringLiteral(char const *str) noexcept: StringLiteral(str, ox::strlen(str)) {}
|
||||
OX_ALLOW_UNSAFE_BUFFERS_END
|
||||
|
||||
constexpr StringLiteral &operator=(StringLiteral const&other) noexcept {
|
||||
if (&other != this) {
|
||||
|
@ -100,7 +100,8 @@ constexpr auto toStdStringView(StringViewCR sv) noexcept {
|
||||
#endif
|
||||
|
||||
|
||||
constexpr ox::Result<int> atoi(ox::StringViewCR str) noexcept {
|
||||
constexpr ox::Result<int> strToInt(ox::StringViewCR str) noexcept {
|
||||
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
||||
int total = 0;
|
||||
int multiplier = 1;
|
||||
for (auto i = static_cast<int64_t>(str.len()) - 1; i != -1; --i) {
|
||||
@ -113,6 +114,7 @@ constexpr ox::Result<int> atoi(ox::StringViewCR str) noexcept {
|
||||
}
|
||||
}
|
||||
return total;
|
||||
OX_ALLOW_UNSAFE_BUFFERS_END
|
||||
}
|
||||
|
||||
|
||||
|
4
deps/nostalgia/deps/ox/src/ox/std/strops.cpp
vendored
4
deps/nostalgia/deps/ox/src/ox/std/strops.cpp
vendored
@ -9,6 +9,8 @@
|
||||
#include "def.hpp"
|
||||
#include "strops.hpp"
|
||||
|
||||
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
||||
|
||||
static_assert(ox::strcmp("asdf", "hijk") < 0, "asdf < hijk");
|
||||
static_assert(ox::strcmp("hijk", "asdf") > 0, "hijk > asdf");
|
||||
static_assert(ox::strcmp("resize", "read") > 0, "resize > read");
|
||||
@ -42,3 +44,5 @@ std::size_t strlen(const char *str) {
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
OX_ALLOW_UNSAFE_BUFFERS_END
|
@ -145,6 +145,7 @@ OX_CLANG_NOWARN_END
|
||||
return ox::Error{};
|
||||
}
|
||||
},
|
||||
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
||||
{
|
||||
"ABCDEFG != HIJKLMN",
|
||||
[]() {
|
||||
@ -169,6 +170,7 @@ OX_CLANG_NOWARN_END
|
||||
return ox::Error(ox::memcmp("ABCDEFGHI", "ABCDEFG", 7) != 0);
|
||||
}
|
||||
},
|
||||
OX_ALLOW_UNSAFE_BUFFERS_END
|
||||
{
|
||||
"IString",
|
||||
[]() {
|
||||
|
@ -39,6 +39,8 @@ enum LogChan {
|
||||
Debug = 4,
|
||||
};
|
||||
|
||||
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
||||
|
||||
template<LogChan chan>
|
||||
static void log(ox::StringViewCR str) {
|
||||
const auto sz = ox::min<std::size_t>(0x100, str.bytes());
|
||||
@ -103,5 +105,7 @@ void oxTraceHook([[maybe_unused]] const char *file, [[maybe_unused]] int line,
|
||||
#endif
|
||||
}
|
||||
|
||||
OX_ALLOW_UNSAFE_BUFFERS_END
|
||||
|
||||
}
|
||||
|
||||
|
4
deps/nostalgia/deps/ox/src/ox/std/uuid.hpp
vendored
4
deps/nostalgia/deps/ox/src/ox/std/uuid.hpp
vendored
@ -105,6 +105,10 @@ class UUID {
|
||||
ox::Array<uint8_t, 16> m_value{};
|
||||
|
||||
public:
|
||||
|
||||
static constexpr auto TypeName = "net.drinkingtea.ox.UUID";
|
||||
static constexpr auto TypeVersion = 1;
|
||||
|
||||
static void seedGenerator(const RandomSeed &seed) noexcept;
|
||||
|
||||
static ox::Result<UUID> generate() noexcept;
|
||||
|
5
deps/nostalgia/project/.nostalgia/type_descriptors/B.int32;0
vendored
Normal file
5
deps/nostalgia/project/.nostalgia/type_descriptors/B.int32;0
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||
"length" : 4,
|
||||
"primitiveType" : 1,
|
||||
"typeName" : "B.int32"
|
||||
}
|
5
deps/nostalgia/project/.nostalgia/type_descriptors/B.int8;0
vendored
Normal file
5
deps/nostalgia/project/.nostalgia/type_descriptors/B.int8;0
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||
"length" : 1,
|
||||
"primitiveType" : 1,
|
||||
"typeName" : "B.int8"
|
||||
}
|
4
deps/nostalgia/project/.nostalgia/type_descriptors/B.string;0
vendored
Normal file
4
deps/nostalgia/project/.nostalgia/type_descriptors/B.string;0
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||
"primitiveType" : 4,
|
||||
"typeName" : "B.string"
|
||||
}
|
4
deps/nostalgia/project/.nostalgia/type_descriptors/B.uint16;0
vendored
Normal file
4
deps/nostalgia/project/.nostalgia/type_descriptors/B.uint16;0
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||
"length" : 2,
|
||||
"typeName" : "B.uint16"
|
||||
}
|
4
deps/nostalgia/project/.nostalgia/type_descriptors/B.uint64;0
vendored
Normal file
4
deps/nostalgia/project/.nostalgia/type_descriptors/B.uint64;0
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||
"length" : 8,
|
||||
"typeName" : "B.uint64"
|
||||
}
|
4
deps/nostalgia/project/.nostalgia/type_descriptors/B.uint8;0
vendored
Normal file
4
deps/nostalgia/project/.nostalgia/type_descriptors/B.uint8;0
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||
"length" : 1,
|
||||
"typeName" : "B.uint8"
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||
"fieldList" :
|
||||
[
|
||||
{
|
||||
"fieldName" : "bpp",
|
||||
"typeId" : "B.int8;0"
|
||||
},
|
||||
{
|
||||
"fieldName" : "rows",
|
||||
"typeId" : "B.int32;0"
|
||||
},
|
||||
{
|
||||
"fieldName" : "columns",
|
||||
"typeId" : "B.int32;0"
|
||||
},
|
||||
{
|
||||
"fieldName" : "defaultPalette",
|
||||
"typeId" : "net.drinkingtea.ox.FileAddress;1"
|
||||
},
|
||||
{
|
||||
"fieldName" : "pal",
|
||||
"typeId" : "net.drinkingtea.nostalgia.core.Palette;1"
|
||||
},
|
||||
{
|
||||
"fieldName" : "pixels",
|
||||
"subscriptLevels" : 1,
|
||||
"subscriptStack" :
|
||||
[
|
||||
{
|
||||
"subscriptType" : 4
|
||||
}
|
||||
],
|
||||
"typeId" : "B.uint8;0"
|
||||
}
|
||||
],
|
||||
"primitiveType" : 5,
|
||||
"typeName" : "net.drinkingtea.nostalgia.core.NostalgiaGraphic",
|
||||
"typeVersion" : 1
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||
"fieldList" :
|
||||
[
|
||||
{
|
||||
"fieldName" : "name",
|
||||
"typeId" : "net.drinkingtea.ox.BasicString#8#;1"
|
||||
}
|
||||
],
|
||||
"primitiveType" : 5,
|
||||
"typeName" : "net.drinkingtea.nostalgia.core.Palette.ColorInfo",
|
||||
"typeVersion" : 3
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||
"fieldList" :
|
||||
[
|
||||
{
|
||||
"fieldName" : "name",
|
||||
"typeId" : "net.drinkingtea.ox.BasicString#8#;1"
|
||||
},
|
||||
{
|
||||
"fieldName" : "colors",
|
||||
"subscriptLevels" : 1,
|
||||
"subscriptStack" :
|
||||
[
|
||||
{
|
||||
"subscriptType" : 4
|
||||
}
|
||||
],
|
||||
"typeId" : "net.drinkingtea.nostalgia.core.PaletteColor;1"
|
||||
}
|
||||
],
|
||||
"primitiveType" : 5,
|
||||
"typeName" : "net.drinkingtea.nostalgia.core.Palette.PalettePage",
|
||||
"typeVersion" : 1
|
||||
}
|
19
deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.Palette;1
vendored
Normal file
19
deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.Palette;1
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||
"fieldList" :
|
||||
[
|
||||
{
|
||||
"fieldName" : "colors",
|
||||
"subscriptLevels" : 1,
|
||||
"subscriptStack" :
|
||||
[
|
||||
{
|
||||
"subscriptType" : 4
|
||||
}
|
||||
],
|
||||
"typeId" : "B.uint16;0"
|
||||
}
|
||||
],
|
||||
"primitiveType" : 5,
|
||||
"typeName" : "net.drinkingtea.nostalgia.core.Palette",
|
||||
"typeVersion" : 1
|
||||
}
|
23
deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.Palette;2
vendored
Normal file
23
deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.Palette;2
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||
"fieldList" :
|
||||
[
|
||||
{
|
||||
"fieldName" : "pages",
|
||||
"subscriptLevels" : 2,
|
||||
"subscriptStack" :
|
||||
[
|
||||
{
|
||||
"subscriptType" : 4
|
||||
},
|
||||
{
|
||||
"subscriptType" : 4
|
||||
}
|
||||
],
|
||||
"typeId" : "B.uint16;0"
|
||||
}
|
||||
],
|
||||
"preloadable" : true,
|
||||
"primitiveType" : 5,
|
||||
"typeName" : "net.drinkingtea.nostalgia.core.Palette",
|
||||
"typeVersion" : 2
|
||||
}
|
34
deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.Palette;3
vendored
Normal file
34
deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.Palette;3
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||
"fieldList" :
|
||||
[
|
||||
{
|
||||
"fieldName" : "colorInfo",
|
||||
"subscriptLevels" : 1,
|
||||
"subscriptStack" :
|
||||
[
|
||||
{
|
||||
"subscriptType" : 4
|
||||
}
|
||||
],
|
||||
"typeId" : "net.drinkingtea.nostalgia.core.Palette.ColorInfo;3"
|
||||
},
|
||||
{
|
||||
"fieldName" : "pages",
|
||||
"subscriptLevels" : 2,
|
||||
"subscriptStack" :
|
||||
[
|
||||
{
|
||||
"subscriptType" : 4
|
||||
},
|
||||
{
|
||||
"subscriptType" : 4
|
||||
}
|
||||
],
|
||||
"typeId" : "B.uint16;0"
|
||||
}
|
||||
],
|
||||
"preloadable" : true,
|
||||
"primitiveType" : 5,
|
||||
"typeName" : "net.drinkingtea.nostalgia.core.Palette",
|
||||
"typeVersion" : 3
|
||||
}
|
31
deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.Palette;4
vendored
Normal file
31
deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.Palette;4
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||
"fieldList" :
|
||||
[
|
||||
{
|
||||
"fieldName" : "colorNames",
|
||||
"subscriptLevels" : 1,
|
||||
"subscriptStack" :
|
||||
[
|
||||
{
|
||||
"subscriptType" : 4
|
||||
}
|
||||
],
|
||||
"typeId" : "net.drinkingtea.ox.BasicString#8#;1"
|
||||
},
|
||||
{
|
||||
"fieldName" : "pages",
|
||||
"subscriptLevels" : 1,
|
||||
"subscriptStack" :
|
||||
[
|
||||
{
|
||||
"subscriptType" : 4
|
||||
}
|
||||
],
|
||||
"typeId" : "net.drinkingtea.nostalgia.core.Palette.PalettePage;1"
|
||||
}
|
||||
],
|
||||
"preloadable" : true,
|
||||
"primitiveType" : 5,
|
||||
"typeName" : "net.drinkingtea.nostalgia.core.Palette",
|
||||
"typeVersion" : 4
|
||||
}
|
24
deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.PaletteColor;1
vendored
Normal file
24
deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.PaletteColor;1
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||
"fieldList" :
|
||||
[
|
||||
{
|
||||
"fieldName" : "r",
|
||||
"typeId" : "B.uint8;0"
|
||||
},
|
||||
{
|
||||
"fieldName" : "g",
|
||||
"typeId" : "B.uint8;0"
|
||||
},
|
||||
{
|
||||
"fieldName" : "b",
|
||||
"typeId" : "B.uint8;0"
|
||||
},
|
||||
{
|
||||
"fieldName" : "a",
|
||||
"typeId" : "B.uint8;0"
|
||||
}
|
||||
],
|
||||
"primitiveType" : 5,
|
||||
"typeName" : "net.drinkingtea.nostalgia.core.PaletteColor",
|
||||
"typeVersion" : 1
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||
"fieldList" :
|
||||
[
|
||||
{
|
||||
"fieldName" : "name",
|
||||
"typeId" : "net.drinkingtea.ox.BasicString#8#;1"
|
||||
},
|
||||
{
|
||||
"fieldName" : "rows",
|
||||
"typeId" : "B.int32;0"
|
||||
},
|
||||
{
|
||||
"fieldName" : "columns",
|
||||
"typeId" : "B.int32;0"
|
||||
},
|
||||
{
|
||||
"fieldName" : "subsheets",
|
||||
"subscriptLevels" : 1,
|
||||
"subscriptStack" :
|
||||
[
|
||||
{
|
||||
"subscriptType" : 4
|
||||
}
|
||||
],
|
||||
"typeId" : "net.drinkingtea.nostalgia.core.TileSheet.SubSheet;1"
|
||||
},
|
||||
{
|
||||
"fieldName" : "pixels",
|
||||
"subscriptLevels" : 1,
|
||||
"subscriptStack" :
|
||||
[
|
||||
{
|
||||
"subscriptType" : 4
|
||||
}
|
||||
],
|
||||
"typeId" : "B.uint8;0"
|
||||
}
|
||||
],
|
||||
"primitiveType" : 5,
|
||||
"typeName" : "net.drinkingtea.nostalgia.core.TileSheet.SubSheet",
|
||||
"typeVersion" : 1
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||
"fieldList" :
|
||||
[
|
||||
{
|
||||
"fieldName" : "name",
|
||||
"typeId" : "net.drinkingtea.ox.BasicString#8#;1"
|
||||
},
|
||||
{
|
||||
"fieldName" : "rows",
|
||||
"typeId" : "B.int32;0"
|
||||
},
|
||||
{
|
||||
"fieldName" : "columns",
|
||||
"typeId" : "B.int32;0"
|
||||
},
|
||||
{
|
||||
"fieldName" : "subsheets",
|
||||
"subscriptLevels" : 1,
|
||||
"subscriptStack" :
|
||||
[
|
||||
{
|
||||
"subscriptType" : 4
|
||||
}
|
||||
],
|
||||
"typeId" : "net.drinkingtea.nostalgia.core.TileSheet.SubSheet;3"
|
||||
},
|
||||
{
|
||||
"fieldName" : "pixels",
|
||||
"subscriptLevels" : 1,
|
||||
"subscriptStack" :
|
||||
[
|
||||
{
|
||||
"subscriptType" : 4
|
||||
}
|
||||
],
|
||||
"typeId" : "B.uint8;0"
|
||||
}
|
||||
],
|
||||
"primitiveType" : 5,
|
||||
"typeName" : "net.drinkingtea.nostalgia.core.TileSheet.SubSheet",
|
||||
"typeVersion" : 3
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||
"fieldList" :
|
||||
[
|
||||
{
|
||||
"fieldName" : "id",
|
||||
"typeId" : "B.int32;0"
|
||||
},
|
||||
{
|
||||
"fieldName" : "name",
|
||||
"typeId" : "net.drinkingtea.ox.BasicString#8#;1"
|
||||
},
|
||||
{
|
||||
"fieldName" : "rows",
|
||||
"typeId" : "B.int32;0"
|
||||
},
|
||||
{
|
||||
"fieldName" : "columns",
|
||||
"typeId" : "B.int32;0"
|
||||
},
|
||||
{
|
||||
"fieldName" : "subsheets",
|
||||
"subscriptLevels" : 1,
|
||||
"subscriptStack" :
|
||||
[
|
||||
{
|
||||
"subscriptType" : 4
|
||||
}
|
||||
],
|
||||
"typeId" : "net.drinkingtea.nostalgia.core.TileSheet.SubSheet;4"
|
||||
},
|
||||
{
|
||||
"fieldName" : "pixels",
|
||||
"subscriptLevels" : 1,
|
||||
"subscriptStack" :
|
||||
[
|
||||
{
|
||||
"subscriptType" : 4
|
||||
}
|
||||
],
|
||||
"typeId" : "B.uint8;0"
|
||||
}
|
||||
],
|
||||
"primitiveType" : 5,
|
||||
"typeName" : "net.drinkingtea.nostalgia.core.TileSheet.SubSheet",
|
||||
"typeVersion" : 4
|
||||
}
|
20
deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.TileSheet;2
vendored
Normal file
20
deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.TileSheet;2
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||
"fieldList" :
|
||||
[
|
||||
{
|
||||
"fieldName" : "bpp",
|
||||
"typeId" : "B.int8;0"
|
||||
},
|
||||
{
|
||||
"fieldName" : "defaultPalette",
|
||||
"typeId" : "net.drinkingtea.ox.FileAddress;1"
|
||||
},
|
||||
{
|
||||
"fieldName" : "subsheet",
|
||||
"typeId" : "net.drinkingtea.nostalgia.core.TileSheet.SubSheet;1"
|
||||
}
|
||||
],
|
||||
"primitiveType" : 5,
|
||||
"typeName" : "net.drinkingtea.nostalgia.core.TileSheet",
|
||||
"typeVersion" : 2
|
||||
}
|
24
deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.TileSheet;3
vendored
Normal file
24
deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.TileSheet;3
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||
"fieldList" :
|
||||
[
|
||||
{
|
||||
"fieldName" : "bpp",
|
||||
"typeId" : "B.int8;0"
|
||||
},
|
||||
{
|
||||
"fieldName" : "idIt",
|
||||
"typeId" : "B.int32;0"
|
||||
},
|
||||
{
|
||||
"fieldName" : "defaultPalette",
|
||||
"typeId" : "net.drinkingtea.ox.FileAddress;1"
|
||||
},
|
||||
{
|
||||
"fieldName" : "subsheet",
|
||||
"typeId" : "net.drinkingtea.nostalgia.core.TileSheet.SubSheet;3"
|
||||
}
|
||||
],
|
||||
"primitiveType" : 5,
|
||||
"typeName" : "net.drinkingtea.nostalgia.core.TileSheet",
|
||||
"typeVersion" : 3
|
||||
}
|
24
deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.TileSheet;4
vendored
Normal file
24
deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.TileSheet;4
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||
"fieldList" :
|
||||
[
|
||||
{
|
||||
"fieldName" : "bpp",
|
||||
"typeId" : "B.int8;0"
|
||||
},
|
||||
{
|
||||
"fieldName" : "idIt",
|
||||
"typeId" : "B.int32;0"
|
||||
},
|
||||
{
|
||||
"fieldName" : "defaultPalette",
|
||||
"typeId" : "net.drinkingtea.ox.FileAddress;1"
|
||||
},
|
||||
{
|
||||
"fieldName" : "subsheet",
|
||||
"typeId" : "net.drinkingtea.nostalgia.core.TileSheet.SubSheet;4"
|
||||
}
|
||||
],
|
||||
"primitiveType" : 5,
|
||||
"typeName" : "net.drinkingtea.nostalgia.core.TileSheet",
|
||||
"typeVersion" : 4
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||
"fieldList" :
|
||||
[
|
||||
{
|
||||
"fieldName" : "pages",
|
||||
"subscriptLevels" : 2,
|
||||
"subscriptStack" :
|
||||
[
|
||||
{
|
||||
"subscriptType" : 4
|
||||
},
|
||||
{
|
||||
"subscriptType" : 4
|
||||
}
|
||||
],
|
||||
"typeId" : "B.uint16;0"
|
||||
}
|
||||
],
|
||||
"preloadable" : true,
|
||||
"primitiveType" : 5,
|
||||
"typeName" : "net.drinkingtea.nostalgia.gfx.CompactPalette",
|
||||
"typeVersion" : 1
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||
"fieldList" :
|
||||
[
|
||||
{
|
||||
"fieldName" : "bpp",
|
||||
"typeId" : "B.int8;0"
|
||||
},
|
||||
{
|
||||
"fieldName" : "defaultPalette",
|
||||
"typeId" : "net.drinkingtea.ox.FileAddress;1"
|
||||
},
|
||||
{
|
||||
"fieldName" : "pixels",
|
||||
"subscriptLevels" : 1,
|
||||
"subscriptStack" :
|
||||
[
|
||||
{
|
||||
"subscriptType" : 4
|
||||
}
|
||||
],
|
||||
"typeId" : "B.uint8;0"
|
||||
}
|
||||
],
|
||||
"preloadable" : true,
|
||||
"primitiveType" : 5,
|
||||
"typeName" : "net.drinkingtea.nostalgia.gfx.CompactTileSheet",
|
||||
"typeVersion" : 1
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||
"fieldList" :
|
||||
[
|
||||
{
|
||||
"fieldName" : "name",
|
||||
"typeId" : "net.drinkingtea.ox.BasicString#8#;1"
|
||||
},
|
||||
{
|
||||
"fieldName" : "colors",
|
||||
"subscriptLevels" : 1,
|
||||
"subscriptStack" :
|
||||
[
|
||||
{
|
||||
"subscriptType" : 4
|
||||
}
|
||||
],
|
||||
"typeId" : "net.drinkingtea.nostalgia.gfx.PaletteColor;2"
|
||||
}
|
||||
],
|
||||
"primitiveType" : 5,
|
||||
"typeName" : "net.drinkingtea.nostalgia.gfx.Palette.PalettePage",
|
||||
"typeVersion" : 2
|
||||
}
|
31
deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.Palette;5
vendored
Normal file
31
deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.Palette;5
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||
"fieldList" :
|
||||
[
|
||||
{
|
||||
"fieldName" : "colorNames",
|
||||
"subscriptLevels" : 1,
|
||||
"subscriptStack" :
|
||||
[
|
||||
{
|
||||
"subscriptType" : 4
|
||||
}
|
||||
],
|
||||
"typeId" : "net.drinkingtea.ox.BasicString#8#;1"
|
||||
},
|
||||
{
|
||||
"fieldName" : "pages",
|
||||
"subscriptLevels" : 1,
|
||||
"subscriptStack" :
|
||||
[
|
||||
{
|
||||
"subscriptType" : 4
|
||||
}
|
||||
],
|
||||
"typeId" : "net.drinkingtea.nostalgia.gfx.Palette.PalettePage;2"
|
||||
}
|
||||
],
|
||||
"preloadable" : true,
|
||||
"primitiveType" : 5,
|
||||
"typeName" : "net.drinkingtea.nostalgia.gfx.Palette",
|
||||
"typeVersion" : 5
|
||||
}
|
24
deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.PaletteColor;2
vendored
Normal file
24
deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.PaletteColor;2
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||
"fieldList" :
|
||||
[
|
||||
{
|
||||
"fieldName" : "r",
|
||||
"typeId" : "B.uint8;0"
|
||||
},
|
||||
{
|
||||
"fieldName" : "g",
|
||||
"typeId" : "B.uint8;0"
|
||||
},
|
||||
{
|
||||
"fieldName" : "b",
|
||||
"typeId" : "B.uint8;0"
|
||||
},
|
||||
{
|
||||
"fieldName" : "a",
|
||||
"typeId" : "B.uint8;0"
|
||||
}
|
||||
],
|
||||
"primitiveType" : 5,
|
||||
"typeName" : "net.drinkingtea.nostalgia.gfx.PaletteColor",
|
||||
"typeVersion" : 2
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||
"fieldList" :
|
||||
[
|
||||
{
|
||||
"fieldName" : "id",
|
||||
"typeId" : "B.int32;0"
|
||||
},
|
||||
{
|
||||
"fieldName" : "name",
|
||||
"typeId" : "net.drinkingtea.ox.BasicString#8#;1"
|
||||
},
|
||||
{
|
||||
"fieldName" : "rows",
|
||||
"typeId" : "B.int32;0"
|
||||
},
|
||||
{
|
||||
"fieldName" : "columns",
|
||||
"typeId" : "B.int32;0"
|
||||
},
|
||||
{
|
||||
"fieldName" : "subsheets",
|
||||
"subscriptLevels" : 1,
|
||||
"subscriptStack" :
|
||||
[
|
||||
{
|
||||
"subscriptType" : 4
|
||||
}
|
||||
],
|
||||
"typeId" : "net.drinkingtea.nostalgia.gfx.TileSheet.SubSheet;5"
|
||||
},
|
||||
{
|
||||
"fieldName" : "pixels",
|
||||
"subscriptLevels" : 1,
|
||||
"subscriptStack" :
|
||||
[
|
||||
{
|
||||
"subscriptType" : 4
|
||||
}
|
||||
],
|
||||
"typeId" : "B.uint8;0"
|
||||
}
|
||||
],
|
||||
"primitiveType" : 5,
|
||||
"typeName" : "net.drinkingtea.nostalgia.gfx.TileSheet.SubSheet",
|
||||
"typeVersion" : 5
|
||||
}
|
24
deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.TileSheet;5
vendored
Normal file
24
deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.TileSheet;5
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||
"fieldList" :
|
||||
[
|
||||
{
|
||||
"fieldName" : "bpp",
|
||||
"typeId" : "B.int8;0"
|
||||
},
|
||||
{
|
||||
"fieldName" : "idIt",
|
||||
"typeId" : "B.int32;0"
|
||||
},
|
||||
{
|
||||
"fieldName" : "defaultPalette",
|
||||
"typeId" : "net.drinkingtea.ox.BasicString#8#;1"
|
||||
},
|
||||
{
|
||||
"fieldName" : "subsheet",
|
||||
"typeId" : "net.drinkingtea.nostalgia.gfx.TileSheet.SubSheet;5"
|
||||
}
|
||||
],
|
||||
"primitiveType" : 5,
|
||||
"typeName" : "net.drinkingtea.nostalgia.gfx.TileSheet",
|
||||
"typeVersion" : 5
|
||||
}
|
41
deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.scene.SceneDoc;1
vendored
Normal file
41
deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.scene.SceneDoc;1
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||
"fieldList" :
|
||||
[
|
||||
{
|
||||
"fieldName" : "tilesheet",
|
||||
"typeId" : "net.drinkingtea.ox.BasicString#8#;1"
|
||||
},
|
||||
{
|
||||
"fieldName" : "palettes",
|
||||
"subscriptLevels" : 1,
|
||||
"subscriptStack" :
|
||||
[
|
||||
{
|
||||
"subscriptType" : 4
|
||||
}
|
||||
],
|
||||
"typeId" : "net.drinkingtea.ox.BasicString#8#;1"
|
||||
},
|
||||
{
|
||||
"fieldName" : "tiles",
|
||||
"subscriptLevels" : 3,
|
||||
"subscriptStack" :
|
||||
[
|
||||
{
|
||||
"subscriptType" : 4
|
||||
},
|
||||
{
|
||||
"subscriptType" : 4
|
||||
},
|
||||
{
|
||||
"subscriptType" : 4
|
||||
}
|
||||
],
|
||||
"typeId" : "net.drinkingtea.nostalgia.scene.TileDoc;1"
|
||||
}
|
||||
],
|
||||
"preloadable" : true,
|
||||
"primitiveType" : 5,
|
||||
"typeName" : "net.drinkingtea.nostalgia.scene.SceneDoc",
|
||||
"typeVersion" : 1
|
||||
}
|
88
deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.scene.SceneStatic;1
vendored
Normal file
88
deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.scene.SceneStatic;1
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||
"fieldList" :
|
||||
[
|
||||
{
|
||||
"fieldName" : "tilesheet",
|
||||
"typeId" : "net.drinkingtea.ox.FileAddress;1"
|
||||
},
|
||||
{
|
||||
"fieldName" : "palettes",
|
||||
"subscriptLevels" : 1,
|
||||
"subscriptStack" :
|
||||
[
|
||||
{
|
||||
"subscriptType" : 4
|
||||
}
|
||||
],
|
||||
"typeId" : "net.drinkingtea.ox.FileAddress;1"
|
||||
},
|
||||
{
|
||||
"fieldName" : "columns",
|
||||
"subscriptLevels" : 1,
|
||||
"subscriptStack" :
|
||||
[
|
||||
{
|
||||
"subscriptType" : 4
|
||||
}
|
||||
],
|
||||
"typeId" : "B.uint16;0"
|
||||
},
|
||||
{
|
||||
"fieldName" : "rows",
|
||||
"subscriptLevels" : 1,
|
||||
"subscriptStack" :
|
||||
[
|
||||
{
|
||||
"subscriptType" : 4
|
||||
}
|
||||
],
|
||||
"typeId" : "B.uint16;0"
|
||||
},
|
||||
{
|
||||
"fieldName" : "tileMapIdx",
|
||||
"subscriptLevels" : 2,
|
||||
"subscriptStack" :
|
||||
[
|
||||
{
|
||||
"subscriptType" : 4
|
||||
},
|
||||
{
|
||||
"subscriptType" : 4
|
||||
}
|
||||
],
|
||||
"typeId" : "B.uint16;0"
|
||||
},
|
||||
{
|
||||
"fieldName" : "tileType",
|
||||
"subscriptLevels" : 2,
|
||||
"subscriptStack" :
|
||||
[
|
||||
{
|
||||
"subscriptType" : 4
|
||||
},
|
||||
{
|
||||
"subscriptType" : 4
|
||||
}
|
||||
],
|
||||
"typeId" : "B.uint8;0"
|
||||
},
|
||||
{
|
||||
"fieldName" : "layerAttachments",
|
||||
"subscriptLevels" : 2,
|
||||
"subscriptStack" :
|
||||
[
|
||||
{
|
||||
"subscriptType" : 4
|
||||
},
|
||||
{
|
||||
"subscriptType" : 4
|
||||
}
|
||||
],
|
||||
"typeId" : "B.uint8;0"
|
||||
}
|
||||
],
|
||||
"preloadable" : true,
|
||||
"primitiveType" : 5,
|
||||
"typeName" : "net.drinkingtea.nostalgia.scene.SceneStatic",
|
||||
"typeVersion" : 1
|
||||
}
|
33
deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.scene.TileDoc;1
vendored
Normal file
33
deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.scene.TileDoc;1
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||
"fieldList" :
|
||||
[
|
||||
{
|
||||
"fieldName" : "subsheet_id",
|
||||
"typeId" : "B.int32;0"
|
||||
},
|
||||
{
|
||||
"fieldName" : "subsheet_path",
|
||||
"typeId" : "net.drinkingtea.ox.BasicString#8#;1"
|
||||
},
|
||||
{
|
||||
"fieldName" : "type",
|
||||
"typeId" : "B.uint8;0"
|
||||
},
|
||||
{
|
||||
"fieldName" : "layer_attachments",
|
||||
"subscriptLevels" : 1,
|
||||
"subscriptStack" :
|
||||
[
|
||||
{
|
||||
"length" : 4,
|
||||
"subscriptType" : 3
|
||||
}
|
||||
],
|
||||
"typeId" : "B.uint8;0"
|
||||
}
|
||||
],
|
||||
"preloadable" : true,
|
||||
"primitiveType" : 5,
|
||||
"typeName" : "net.drinkingtea.nostalgia.scene.TileDoc",
|
||||
"typeVersion" : 1
|
||||
}
|
9
deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.ox.BasicString#8#;1
vendored
Normal file
9
deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.ox.BasicString#8#;1
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||
"primitiveType" : 4,
|
||||
"typeName" : "net.drinkingtea.ox.BasicString",
|
||||
"typeParams" :
|
||||
[
|
||||
"8"
|
||||
],
|
||||
"typeVersion" : 1
|
||||
}
|
20
deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.ox.FileAddress.Data;1
vendored
Normal file
20
deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.ox.FileAddress.Data;1
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||
"fieldList" :
|
||||
[
|
||||
{
|
||||
"fieldName" : "path",
|
||||
"typeId" : "B.string"
|
||||
},
|
||||
{
|
||||
"fieldName" : "constPath",
|
||||
"typeId" : "B.string"
|
||||
},
|
||||
{
|
||||
"fieldName" : "inode",
|
||||
"typeId" : "B.uint64;0"
|
||||
}
|
||||
],
|
||||
"primitiveType" : 6,
|
||||
"typeName" : "net.drinkingtea.ox.FileAddress.Data",
|
||||
"typeVersion" : 1
|
||||
}
|
16
deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.ox.FileAddress;1
vendored
Normal file
16
deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.ox.FileAddress;1
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||
"fieldList" :
|
||||
[
|
||||
{
|
||||
"fieldName" : "type",
|
||||
"typeId" : "B.int8;0"
|
||||
},
|
||||
{
|
||||
"fieldName" : "data",
|
||||
"typeId" : "net.drinkingtea.ox.FileAddress.Data"
|
||||
}
|
||||
],
|
||||
"primitiveType" : 5,
|
||||
"typeName" : "net.drinkingtea.ox.FileAddress",
|
||||
"typeVersion" : 1
|
||||
}
|
9
deps/nostalgia/release-notes.md
vendored
9
deps/nostalgia/release-notes.md
vendored
@ -1,8 +1,15 @@
|
||||
# d2025.04.0
|
||||
# d2025.05.0
|
||||
|
||||
* Add app icon for both window and file
|
||||
* Closing application will now confirm with user if any files have unsaved
|
||||
changes.
|
||||
* Fix selection clearing in TileSheet editor to work when clicking outside
|
||||
image.
|
||||
* Fix color number key range in PalettEditor. Previously, pressing A caused the
|
||||
editor to jump to the last color.
|
||||
* UUID duplicates will now be reported when opening a project
|
||||
* PalettEditor: page rename will now take effect upon pressing enter if the
|
||||
text input has focus
|
||||
|
||||
# d2025.02.1
|
||||
|
||||
|
28
deps/nostalgia/sample_project/Palettes/SC9K_Logo.npal
vendored
Normal file
28
deps/nostalgia/sample_project/Palettes/SC9K_Logo.npal
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
K1;3d1a77ec-265f-4905-2061-4f1003ee2189;O1;net.drinkingtea.nostalgia.gfx.Palette;5;{
|
||||
"colorNames" :
|
||||
[
|
||||
"Color 1",
|
||||
"Color 2",
|
||||
"Color 3"
|
||||
],
|
||||
"pages" :
|
||||
[
|
||||
{
|
||||
"colors" :
|
||||
[
|
||||
{
|
||||
"b" : 10,
|
||||
"g" : 5,
|
||||
"r" : 5
|
||||
},
|
||||
{},
|
||||
{
|
||||
"b" : 31,
|
||||
"g" : 31,
|
||||
"r" : 31
|
||||
}
|
||||
],
|
||||
"name" : "Page 1"
|
||||
}
|
||||
]
|
||||
}
|
4111
deps/nostalgia/sample_project/TileSheets/NS_Logo64.nts
vendored
Normal file
4111
deps/nostalgia/sample_project/TileSheets/NS_Logo64.nts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -238,7 +238,7 @@ uint_t spriteCount(Context &ctx) noexcept;
|
||||
|
||||
ox::Error initConsole(Context &ctx) noexcept;
|
||||
|
||||
void puts(Context &ctx, int column, int row, ox::StringViewCR str) noexcept;
|
||||
void consoleWrite(Context &ctx, int column, int row, ox::StringViewCR str) noexcept;
|
||||
|
||||
}
|
||||
|
||||
|
@ -36,13 +36,13 @@ OX_ALLOW_UNSAFE_BUFFERS_END
|
||||
setBgStatus(*ctx, 0, true);
|
||||
clearBg(*ctx, 0);
|
||||
auto const serr = ox::sfmt<ox::IString<23>>("Error code: {}", static_cast<int64_t>(err));
|
||||
puts(*ctx, 32 + 1, 1, "SADNESS...");
|
||||
puts(*ctx, 32 + 1, 4, "UNEXPECTED STATE:");
|
||||
puts(*ctx, 32 + 2, 6, panicMsg);
|
||||
consoleWrite(*ctx, 32 + 1, 1, "SADNESS...");
|
||||
consoleWrite(*ctx, 32 + 1, 4, "UNEXPECTED STATE:");
|
||||
consoleWrite(*ctx, 32 + 2, 6, panicMsg);
|
||||
if (err) {
|
||||
puts(*ctx, 32 + 2, 8, serr);
|
||||
consoleWrite(*ctx, 32 + 2, 8, serr);
|
||||
}
|
||||
puts(*ctx, 32 + 1, 15, "PLEASE RESTART THE SYSTEM");
|
||||
consoleWrite(*ctx, 32 + 1, 15, "PLEASE RESTART THE SYSTEM");
|
||||
// print to terminal if in mGBA
|
||||
oxErrf("\033[31;1;1mPANIC:\033[0m [{}:{}]: {}\n", file, line, panicMsg);
|
||||
if (err.msg) {
|
||||
|
@ -251,7 +251,7 @@ ox::Error initConsole(Context &ctx) noexcept {
|
||||
return loadBgPalette(ctx, 0, PaletteAddr);
|
||||
}
|
||||
|
||||
void puts(
|
||||
void consoleWrite(
|
||||
Context &ctx,
|
||||
int const column,
|
||||
int const row,
|
||||
|
@ -50,22 +50,25 @@ void PaletteEditorImGui::PageRenameDialog::draw(turbine::Context &tctx) noexcept
|
||||
return;
|
||||
}
|
||||
if (ig::BeginPopup(tctx, "Rename Page", m_show)) {
|
||||
if (ImGui::IsWindowAppearing()) {
|
||||
ImGui::SetKeyboardFocusHere();
|
||||
}
|
||||
ig::InputText("Name", m_name);
|
||||
switch (ig::PopupControlsOkCancel(m_show)) {
|
||||
case ig::PopupResponse::OK:
|
||||
inputSubmitted.emit(m_name);
|
||||
[[fallthrough]];
|
||||
case ig::PopupResponse::Cancel:
|
||||
close();
|
||||
default:
|
||||
break;
|
||||
auto const nameInputFocused = ImGui::IsItemFocused();
|
||||
auto const resp = ig::PopupControlsOkCancel(m_show);
|
||||
if ((nameInputFocused && ImGui::IsKeyPressed(ImGuiKey_Enter))
|
||||
|| resp == ig::PopupResponse::OK) {
|
||||
inputSubmitted.emit(m_name);
|
||||
close();
|
||||
} else if (resp == ig::PopupResponse::Cancel) {
|
||||
close();
|
||||
}
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PaletteEditorImGui::PaletteEditorImGui(studio::StudioContext &sctx, ox::StringParam path):
|
||||
PaletteEditorImGui::PaletteEditorImGui(studio::Context &sctx, ox::StringParam path):
|
||||
Editor(sctx, std::move(path)),
|
||||
m_sctx(sctx),
|
||||
m_tctx(sctx.tctx),
|
||||
@ -74,7 +77,7 @@ PaletteEditorImGui::PaletteEditorImGui(studio::StudioContext &sctx, ox::StringPa
|
||||
m_pageRenameDlg.inputSubmitted.connect(this, &PaletteEditorImGui::renamePage);
|
||||
}
|
||||
|
||||
void PaletteEditorImGui::draw(studio::StudioContext&) noexcept {
|
||||
void PaletteEditorImGui::draw(studio::Context&) noexcept {
|
||||
auto const paneSize = ImGui::GetContentRegionAvail();
|
||||
{
|
||||
ImGui::BeginChild("Pages", {280, paneSize.y}, true);
|
||||
@ -102,13 +105,13 @@ void PaletteEditorImGui::navigateTo(ox::StringViewCR arg) noexcept {
|
||||
auto const &color = args[0];
|
||||
auto const &page = args[1];
|
||||
{
|
||||
auto const [c, err] = atoi(color);
|
||||
auto const [c, err] = strToInt(color);
|
||||
if (!err && static_cast<size_t>(c) < colorCnt(m_pal)) {
|
||||
m_selectedColorRow = static_cast<size_t>(c);
|
||||
}
|
||||
}
|
||||
{
|
||||
auto const [pg, err] = atoi(page);
|
||||
auto const [pg, err] = strToInt(page);
|
||||
if (!err && static_cast<size_t>(pg) < m_pal.pages.size()) {
|
||||
m_page = static_cast<size_t>(pg);
|
||||
}
|
||||
@ -131,7 +134,7 @@ void PaletteEditorImGui::numShortcuts(size_t &val, size_t const sizeRange) noexc
|
||||
auto const lastElem = sizeRange - 1;
|
||||
if (ImGui::IsKeyPressed(ImGuiKey_0)) {
|
||||
val = ox::min<size_t>(9, lastElem);
|
||||
} else for (auto i = 9u; i < 10; --i) {
|
||||
} else for (auto i = 8u; i < 9; --i) {
|
||||
auto const key = static_cast<ImGuiKey>(ImGuiKey_1 + i);
|
||||
if (ImGui::IsKeyPressed(key)) {
|
||||
val = ox::min<size_t>(i, lastElem);
|
||||
|
@ -31,16 +31,16 @@ class PaletteEditorImGui: public studio::Editor {
|
||||
constexpr bool isOpen() const noexcept { return m_show; }
|
||||
void draw(turbine::Context &tctx) noexcept;
|
||||
} m_pageRenameDlg;
|
||||
studio::StudioContext &m_sctx;
|
||||
studio::Context &m_sctx;
|
||||
turbine::Context &m_tctx;
|
||||
Palette m_pal;
|
||||
size_t m_selectedColorRow = 0;
|
||||
size_t m_page = 0;
|
||||
|
||||
public:
|
||||
PaletteEditorImGui(studio::StudioContext &sctx, ox::StringParam path);
|
||||
PaletteEditorImGui(studio::Context &sctx, ox::StringParam path);
|
||||
|
||||
void draw(studio::StudioContext&) noexcept final;
|
||||
void draw(studio::Context&) noexcept final;
|
||||
|
||||
protected:
|
||||
ox::Error saveItem() noexcept final;
|
||||
@ -53,7 +53,7 @@ class PaletteEditorImGui: public studio::Editor {
|
||||
static void drawColumn(ox::CStringView txt) noexcept;
|
||||
|
||||
static void drawColumn(ox::Integer_c auto i) noexcept {
|
||||
drawColumn(ox::itoa(i));
|
||||
drawColumn(ox::intToStr(i));
|
||||
}
|
||||
|
||||
static void numShortcuts(size_t &val, size_t sizeRange) noexcept;
|
||||
|
@ -12,15 +12,15 @@
|
||||
namespace nostalgia::gfx {
|
||||
|
||||
static class: public studio::Module {
|
||||
ox::Vector<studio::EditorMaker> editors(studio::StudioContext &ctx) const noexcept final {
|
||||
ox::Vector<studio::EditorMaker> editors(studio::Context &ctx) const noexcept final {
|
||||
return {
|
||||
studio::editorMaker<TileSheetEditorImGui>(ctx, {FileExt_ng, FileExt_nts}),
|
||||
studio::editorMaker<PaletteEditorImGui>(ctx, FileExt_npal),
|
||||
};
|
||||
}
|
||||
|
||||
ox::Vector<ox::UPtr<studio::ItemMaker>> itemMakers(studio::StudioContext&) const noexcept final {
|
||||
ox::Vector<ox::UniquePtr<studio::ItemMaker>> out;
|
||||
ox::Vector<ox::UPtr<studio::ItemMaker>> itemMakers(studio::Context&) const noexcept final {
|
||||
ox::Vector<ox::UPtr<studio::ItemMaker>> out;
|
||||
out.emplace_back(ox::make<studio::ItemMakerT<TileSheet>>("Tile Sheet", "TileSheets", FileExt_nts));
|
||||
out.emplace_back(ox::make<studio::ItemMakerT<Palette>>("Palette", "Palettes", FileExt_npal, Palette{
|
||||
.colorNames = {},
|
||||
|
@ -35,8 +35,10 @@ ox::Error gfx::DeleteTilesCommand::redo() noexcept {
|
||||
auto const src = &p[srcPos];
|
||||
auto const dst1 = &p[m_deletePos];
|
||||
auto const dst2 = &p[(p.size() - m_deleteSz)];
|
||||
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
||||
ox::memmove(dst1, src, p.size() - srcPos);
|
||||
ox::memset(dst2, 0, m_deleteSz * sizeof(decltype(p[0])));
|
||||
OX_ALLOW_UNSAFE_BUFFERS_END
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -47,8 +49,10 @@ ox::Error DeleteTilesCommand::undo() noexcept {
|
||||
auto const dst1 = &p[m_deletePos + m_deleteSz];
|
||||
auto const dst2 = src;
|
||||
auto const sz = p.size() - m_deletePos - m_deleteSz;
|
||||
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
||||
ox::memmove(dst1, src, sz);
|
||||
ox::memcpy(dst2, m_deletedPixels.data(), m_deletedPixels.size());
|
||||
OX_ALLOW_UNSAFE_BUFFERS_END
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,8 @@ InsertTilesCommand::InsertTilesCommand(
|
||||
}
|
||||
}
|
||||
|
||||
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
||||
|
||||
ox::Error InsertTilesCommand::redo() noexcept {
|
||||
auto &s = getSubSheet(m_img, m_idx);
|
||||
auto &p = s.pixels;
|
||||
@ -55,6 +57,8 @@ ox::Error InsertTilesCommand::undo() noexcept {
|
||||
return {};
|
||||
}
|
||||
|
||||
OX_ALLOW_UNSAFE_BUFFERS_END
|
||||
|
||||
int InsertTilesCommand::commandId() const noexcept {
|
||||
return static_cast<int>(CommandId::InsertTile);
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ static ox::Error toPngFile(
|
||||
8)));
|
||||
}
|
||||
|
||||
TileSheetEditorImGui::TileSheetEditorImGui(studio::StudioContext &sctx, ox::StringParam path):
|
||||
TileSheetEditorImGui::TileSheetEditorImGui(studio::Context &sctx, ox::StringParam path):
|
||||
Editor(sctx, std::move(path)),
|
||||
m_sctx{sctx},
|
||||
m_tctx{m_sctx.tctx},
|
||||
@ -129,7 +129,7 @@ void TileSheetEditorImGui::keyStateChanged(turbine::Key const key, bool const do
|
||||
if (!down) {
|
||||
return;
|
||||
}
|
||||
if (key == turbine::Key::Escape) {
|
||||
if (ig::mainWinHasFocus() && key == turbine::Key::Escape) {
|
||||
m_subsheetEditor.close();
|
||||
m_exportMenu.close();
|
||||
m_palPicker.close();
|
||||
@ -188,7 +188,7 @@ void TileSheetEditorImGui::keyStateChanged(turbine::Key const key, bool const do
|
||||
}
|
||||
}
|
||||
|
||||
void TileSheetEditorImGui::draw(studio::StudioContext&) noexcept {
|
||||
void TileSheetEditorImGui::draw(studio::Context&) noexcept {
|
||||
if (ig::mainWinHasFocus() && m_tool == TileSheetTool::Select) {
|
||||
if (ImGui::IsKeyDown(ImGuiKey_ModCtrl) && !m_palPathFocused) {
|
||||
if (ImGui::IsKeyPressed(ImGuiKey_A)) {
|
||||
@ -549,7 +549,7 @@ void TileSheetEditorImGui::drawPaletteMenu() noexcept {
|
||||
ImGui::PushID(static_cast<int>(i));
|
||||
// Column: color idx
|
||||
ImGui::TableNextColumn();
|
||||
auto const label = ox::itoa(i + 1);
|
||||
auto const label = ox::intToStr(i + 1);
|
||||
auto const rowSelected = i == m_view.palIdx();
|
||||
if (ImGui::Selectable(
|
||||
label.c_str(), rowSelected, ImGuiSelectableFlags_SpanAllColumns)) {
|
||||
|
@ -45,7 +45,7 @@ class TileSheetEditorImGui: public studio::Editor {
|
||||
constexpr bool isOpen() const noexcept { return m_show; }
|
||||
};
|
||||
static constexpr float s_palViewWidth = 335;
|
||||
studio::StudioContext &m_sctx;
|
||||
studio::Context &m_sctx;
|
||||
turbine::Context &m_tctx;
|
||||
ox::Vector<ox::String> m_paletteList;
|
||||
SubSheetEditor m_subsheetEditor;
|
||||
@ -60,7 +60,7 @@ class TileSheetEditorImGui: public studio::Editor {
|
||||
ox::Vector<ox::UPtr<studio::UndoCommand>, 1> m_deferredCmds;
|
||||
|
||||
public:
|
||||
TileSheetEditorImGui(studio::StudioContext &sctx, ox::StringParam path);
|
||||
TileSheetEditorImGui(studio::Context &sctx, ox::StringParam path);
|
||||
|
||||
~TileSheetEditorImGui() override = default;
|
||||
|
||||
@ -77,7 +77,7 @@ class TileSheetEditorImGui: public studio::Editor {
|
||||
|
||||
void keyStateChanged(turbine::Key key, bool down) override;
|
||||
|
||||
void draw(studio::StudioContext&) noexcept override;
|
||||
void draw(studio::Context&) noexcept override;
|
||||
|
||||
void drawSubsheetSelector(TileSheet::SubSheet&, TileSheet::SubSheetIdx &path);
|
||||
|
||||
|
@ -45,7 +45,7 @@ Palette const TileSheetEditorModel::s_defaultPalette = {
|
||||
};
|
||||
|
||||
TileSheetEditorModel::TileSheetEditorModel(
|
||||
studio::StudioContext &sctx, ox::StringParam path, studio::UndoStack &undoStack):
|
||||
studio::Context &sctx, ox::StringParam path, studio::UndoStack &undoStack):
|
||||
m_sctx(sctx),
|
||||
m_tctx(m_sctx.tctx),
|
||||
m_path(std::move(path)),
|
||||
|
@ -22,7 +22,7 @@ class TileSheetEditorModel: public ox::SignalHandler {
|
||||
|
||||
private:
|
||||
static Palette const s_defaultPalette;
|
||||
studio::StudioContext &m_sctx;
|
||||
studio::Context &m_sctx;
|
||||
turbine::Context &m_tctx;
|
||||
ox::String m_path;
|
||||
ox::String m_palPath;
|
||||
@ -39,7 +39,7 @@ class TileSheetEditorModel: public ox::SignalHandler {
|
||||
bool m_updated = false;
|
||||
|
||||
public:
|
||||
TileSheetEditorModel(studio::StudioContext &sctx, ox::StringParam path, studio::UndoStack &undoStack);
|
||||
TileSheetEditorModel(studio::Context &sctx, ox::StringParam path, studio::UndoStack &undoStack);
|
||||
|
||||
~TileSheetEditorModel() override = default;
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
namespace nostalgia::gfx {
|
||||
|
||||
TileSheetEditorView::TileSheetEditorView(
|
||||
studio::StudioContext &sctx, ox::StringViewCR path, studio::UndoStack &undoStack):
|
||||
studio::Context &sctx, ox::StringViewCR path, studio::UndoStack &undoStack):
|
||||
m_model(sctx, path, undoStack),
|
||||
m_pixelsDrawer(m_model) {
|
||||
glBindVertexArray(0);
|
||||
|
@ -56,7 +56,7 @@ class TileSheetEditorView: public ox::SignalHandler {
|
||||
std::size_t m_palIdx = 0;
|
||||
|
||||
public:
|
||||
TileSheetEditorView(studio::StudioContext &sctx, ox::StringViewCR path, studio::UndoStack &undoStack);
|
||||
TileSheetEditorView(studio::Context &sctx, ox::StringViewCR path, studio::UndoStack &undoStack);
|
||||
|
||||
~TileSheetEditorView() override = default;
|
||||
|
||||
|
@ -5,12 +5,13 @@
|
||||
#include <ox/claw/write.hpp>
|
||||
|
||||
#include <nostalgia/gfx/consts.hpp>
|
||||
#include <nostalgia/gfx/gfx.hpp>
|
||||
|
||||
#include "tilesheetpixelgrid.hpp"
|
||||
|
||||
namespace nostalgia::gfx {
|
||||
|
||||
void TileSheetGrid::setPixelSizeMod(float sm) noexcept {
|
||||
void TileSheetGrid::setPixelSizeMod(float const sm) noexcept {
|
||||
m_pixelSizeMod = sm;
|
||||
}
|
||||
|
||||
@ -18,10 +19,11 @@ ox::Error TileSheetGrid::buildShader() noexcept {
|
||||
auto const pixelLineVshad = ox::sfmt(VShad, gl::GlslVersion);
|
||||
auto const pixelLineFshad = ox::sfmt(FShad, gl::GlslVersion);
|
||||
auto const pixelLineGshad = ox::sfmt(GShad, gl::GlslVersion);
|
||||
return glutils::buildShaderProgram(pixelLineVshad, pixelLineFshad, pixelLineGshad).moveTo(m_shader);
|
||||
return glutils::buildShaderProgram(
|
||||
pixelLineVshad, pixelLineFshad, pixelLineGshad).moveTo(m_shader);
|
||||
}
|
||||
|
||||
void TileSheetGrid::draw(bool update, ox::Vec2 const&scroll) noexcept {
|
||||
void TileSheetGrid::draw(bool const update, ox::Vec2 const&scroll) noexcept {
|
||||
// the lines just show up bigger on Windows for some reason
|
||||
if constexpr(ox::defines::OS == ox::OS::Windows) {
|
||||
glLineWidth(3 * m_pixelSizeMod * 0.25f);
|
||||
@ -51,7 +53,8 @@ void TileSheetGrid::initBufferSet(ox::Vec2 const&paneSize, TileSheet::SubSheet c
|
||||
// vbo layout
|
||||
auto const pt1Attr = static_cast<GLuint>(glGetAttribLocation(m_shader, "vPt1"));
|
||||
glEnableVertexAttribArray(pt1Attr);
|
||||
glVertexAttribPointer(pt1Attr, 2, GL_FLOAT, GL_FALSE, VertexVboRowLength * sizeof(float), nullptr);
|
||||
glVertexAttribPointer(
|
||||
pt1Attr, 2, GL_FLOAT, GL_FALSE, VertexVboRowLength * sizeof(float), nullptr);
|
||||
auto const pt2Attr = static_cast<GLuint>(glGetAttribLocation(m_shader, "vPt2"));
|
||||
glEnableVertexAttribArray(pt2Attr);
|
||||
glVertexAttribPointer(pt2Attr, 2, GL_FLOAT, GL_FALSE, VertexVboRowLength * sizeof(float),
|
||||
@ -70,18 +73,18 @@ void TileSheetGrid::update(ox::Vec2 const&paneSize, TileSheet::SubSheet const&su
|
||||
}
|
||||
|
||||
void TileSheetGrid::setBufferObject(
|
||||
ox::Point pt1,
|
||||
ox::Point pt2,
|
||||
Color32 c,
|
||||
float *vbo,
|
||||
ox::Point const pt1,
|
||||
ox::Point const pt2,
|
||||
Color32 const c,
|
||||
ox::Span<float> const vbo,
|
||||
ox::Vec2 const&pixSize) noexcept {
|
||||
auto const x1 = static_cast<float>(pt1.x) * pixSize.x - 1.f;
|
||||
auto const y1 = 1.f - static_cast<float>(pt1.y) * pixSize.y;
|
||||
auto const x2 = static_cast<float>(pt2.x) * pixSize.x - 1.f;
|
||||
auto const y2 = 1.f - static_cast<float>(pt2.y) * pixSize.y;
|
||||
// don't worry, this memcpy gets optimized to something much more ideal
|
||||
// don't worry, this gets optimized to something much more ideal
|
||||
ox::Array<float, VertexVboLength> const vertices = {x1, y1, x2, y2, redf(c), greenf(c), bluef(c)};
|
||||
memcpy(vbo, vertices.data(), sizeof(vertices));
|
||||
ox::spancpy(vbo, ox::SpanView<float>{vertices});
|
||||
}
|
||||
|
||||
void TileSheetGrid::setBufferObjects(ox::Vec2 const&paneSize, TileSheet::SubSheet const&subsheet) noexcept {
|
||||
@ -92,7 +95,8 @@ void TileSheetGrid::setBufferObjects(ox::Vec2 const&paneSize, TileSheet::SubShee
|
||||
}
|
||||
auto const pixSize = pixelSize(paneSize);
|
||||
auto const set = [&](std::size_t i, ox::Point pt1, ox::Point pt2, Color32 c) {
|
||||
auto const vbo = &m_bufferSet.vertices[i * VertexVboLength];
|
||||
auto const idx = i * VertexVboLength;
|
||||
auto const vbo = ox::Span{m_bufferSet.vertices} + idx;
|
||||
setBufferObject(pt1, pt2, c, vbo, pixSize);
|
||||
};
|
||||
// set buffer length
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include <glutils/glutils.hpp>
|
||||
#include <studio/studio.hpp>
|
||||
|
||||
#include <nostalgia/gfx/gfx.hpp>
|
||||
#include <nostalgia/gfx/tilesheet.hpp>
|
||||
|
||||
namespace nostalgia::gfx {
|
||||
@ -74,7 +73,7 @@ class TileSheetGrid {
|
||||
void update(ox::Vec2 const&paneSize, TileSheet::SubSheet const&subsheet) noexcept;
|
||||
|
||||
private:
|
||||
static void setBufferObject(ox::Point pt1, ox::Point pt2, Color32 c, float *vbo, ox::Vec2 const&pixSize) noexcept;
|
||||
static void setBufferObject(ox::Point pt1, ox::Point pt2, Color32 c, ox::Span<float> vbo, ox::Vec2 const&pixSize) noexcept;
|
||||
|
||||
void setBufferObjects(ox::Vec2 const&paneSize, TileSheet::SubSheet const&subsheet) noexcept;
|
||||
|
||||
|
@ -2,8 +2,6 @@
|
||||
* Copyright 2016 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <nostalgia/gfx/consts.hpp>
|
||||
#include <nostalgia/gfx/ptidxconv.hpp>
|
||||
#include "tilesheeteditormodel.hpp"
|
||||
#include "tilesheetpixels.hpp"
|
||||
|
||||
@ -88,11 +86,11 @@ ox::Vec2 TileSheetPixels::pixelSize(ox::Vec2 const&paneSize) const noexcept {
|
||||
|
||||
void TileSheetPixels::setPixelBufferObject(
|
||||
ox::Vec2 const&paneSize,
|
||||
unsigned vertexRow,
|
||||
unsigned const vertexRow,
|
||||
float x, float y,
|
||||
Color16 color,
|
||||
float *vbo,
|
||||
GLuint *ebo) const noexcept {
|
||||
Color16 const color,
|
||||
ox::Span<float> const vbo,
|
||||
ox::Span<GLuint> const ebo) const noexcept {
|
||||
auto const [xmod, ymod] = pixelSize(paneSize);
|
||||
x *= xmod;
|
||||
y *= -ymod;
|
||||
@ -106,12 +104,12 @@ void TileSheetPixels::setPixelBufferObject(
|
||||
x + xmod, y + ymod, r, g, b, // top right
|
||||
x, y + ymod, r, g, b, // top left
|
||||
};
|
||||
memcpy(vbo, vertices.data(), sizeof(vertices));
|
||||
ox::spancpy(vbo, ox::SpanView<float>{vertices});
|
||||
std::array const elms = {
|
||||
vertexRow + 0, vertexRow + 1, vertexRow + 2,
|
||||
vertexRow + 2, vertexRow + 3, vertexRow + 0,
|
||||
};
|
||||
memcpy(ebo, elms.data(), sizeof(elms));
|
||||
ox::spancpy(ebo, ox::SpanView<GLuint>{elms});
|
||||
}
|
||||
|
||||
void TileSheetPixels::setBufferObjects(ox::Vec2 const&paneSize) noexcept {
|
||||
@ -137,8 +135,8 @@ void TileSheetPixels::setBufferObjects(ox::Vec2 const&paneSize) noexcept {
|
||||
auto const pt = idxToPt(static_cast<int>(i), subSheet.columns);
|
||||
auto const fx = static_cast<float>(pt.x);
|
||||
auto const fy = static_cast<float>(pt.y);
|
||||
auto const vbo = &m_bufferSet.vertices[i * vboLen];
|
||||
auto const ebo = &m_bufferSet.elements[i * VertexEboLength];
|
||||
auto const vbo = ox::Span{m_bufferSet.vertices} + i * vboLen;
|
||||
auto const ebo = ox::Span{m_bufferSet.elements} + i * VertexEboLength;
|
||||
if (i * vboLen + vboLen > m_bufferSet.vertices.size()) {
|
||||
return;
|
||||
}
|
||||
|
@ -6,11 +6,9 @@
|
||||
|
||||
#include <ox/std/vec.hpp>
|
||||
|
||||
#include <glutils/glutils.hpp>
|
||||
#include <studio/studio.hpp>
|
||||
|
||||
#include <nostalgia/gfx/color.hpp>
|
||||
#include <nostalgia/gfx/gfx.hpp>
|
||||
|
||||
#include <glutils/glutils.hpp>
|
||||
|
||||
namespace nostalgia::gfx {
|
||||
|
||||
@ -44,15 +42,15 @@ class TileSheetPixels {
|
||||
|
||||
private:
|
||||
void setPixelBufferObject(
|
||||
ox::Vec2 const&paneS,
|
||||
ox::Vec2 const&paneSize,
|
||||
unsigned vertexRow,
|
||||
float x,
|
||||
float y,
|
||||
Color16 color,
|
||||
float *vbo,
|
||||
GLuint *ebo) const noexcept;
|
||||
ox::Span<float> vbo,
|
||||
ox::Span<GLuint> ebo) const noexcept;
|
||||
|
||||
void setBufferObjects(ox::Vec2 const&paneS) noexcept;
|
||||
void setBufferObjects(ox::Vec2 const&paneSize) noexcept;
|
||||
|
||||
};
|
||||
|
||||
|
@ -9,13 +9,13 @@
|
||||
namespace nostalgia::sound {
|
||||
|
||||
static class: public studio::Module {
|
||||
ox::Vector<studio::EditorMaker> editors(studio::StudioContext&) const noexcept final {
|
||||
ox::Vector<studio::EditorMaker> editors(studio::Context&) const noexcept final {
|
||||
return {
|
||||
};
|
||||
}
|
||||
|
||||
ox::Vector<ox::UPtr<studio::ItemMaker>> itemMakers(studio::StudioContext&) const noexcept final {
|
||||
ox::Vector<ox::UniquePtr<studio::ItemMaker>> out;
|
||||
ox::Vector<ox::UPtr<studio::ItemMaker>> itemMakers(studio::Context&) const noexcept final {
|
||||
ox::Vector<ox::UPtr<studio::ItemMaker>> out;
|
||||
return out;
|
||||
}
|
||||
} const mod;
|
||||
|
2
deps/nostalgia/src/nostalgia/player/app.cpp
vendored
2
deps/nostalgia/src/nostalgia/player/app.cpp
vendored
@ -69,7 +69,7 @@ static ox::Error runTest(turbine::Context &tctx) {
|
||||
OX_RETURN_ERROR(gfx::loadSpriteTileSheet(*cctx, "/TileSheets/Charset.nts"));
|
||||
OX_RETURN_ERROR(gfx::loadSpritePalette(*cctx, "/Palettes/Chester.npal"));
|
||||
OX_RETURN_ERROR(gfx::initConsole(*cctx));
|
||||
gfx::puts(*cctx, 10, 9, "DOPENESS!!!");
|
||||
gfx::consoleWrite(*cctx, 10, 9, "DOPENESS!!!");
|
||||
turbine::setUpdateHandler(tctx, testUpdateHandler);
|
||||
turbine::setKeyEventHandler(tctx, testKeyEventHandler);
|
||||
return turbine::run(tctx);
|
||||
|
16
deps/nostalgia/src/nostalgia/studio/icondata.cpp
vendored
16
deps/nostalgia/src/nostalgia/studio/icondata.cpp
vendored
@ -5,7 +5,7 @@
|
||||
|
||||
namespace studio {
|
||||
|
||||
static constexpr ox::Array<uint8_t, 134> WindowIcon16Data {
|
||||
static const ox::Array<uint8_t, 134> WindowIcon16Data {
|
||||
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00,
|
||||
0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x10,
|
||||
0x00, 0x00, 0x00, 0x10, 0x02, 0x03, 0x00, 0x00, 0x00, 0x62,
|
||||
@ -24,7 +24,7 @@ static constexpr ox::Array<uint8_t, 134> WindowIcon16Data {
|
||||
|
||||
ox::SpanView<uint8_t> WindowIcon16() noexcept { return WindowIcon16Data; }
|
||||
|
||||
static constexpr ox::Array<uint8_t, 149> WindowIcon24Data {
|
||||
static const ox::Array<uint8_t, 149> WindowIcon24Data {
|
||||
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00,
|
||||
0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x18,
|
||||
0x00, 0x00, 0x00, 0x18, 0x02, 0x03, 0x00, 0x00, 0x00, 0x9d,
|
||||
@ -44,7 +44,7 @@ static constexpr ox::Array<uint8_t, 149> WindowIcon24Data {
|
||||
|
||||
ox::SpanView<uint8_t> WindowIcon24() noexcept { return WindowIcon24Data; }
|
||||
|
||||
static constexpr ox::Array<uint8_t, 4249> WindowIcon32Data {
|
||||
static const ox::Array<uint8_t, 4249> WindowIcon32Data {
|
||||
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00,
|
||||
0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x20,
|
||||
0x00, 0x00, 0x00, 0x20, 0x02, 0x03, 0x00, 0x00, 0x00, 0x0e,
|
||||
@ -474,7 +474,7 @@ static constexpr ox::Array<uint8_t, 4249> WindowIcon32Data {
|
||||
|
||||
ox::SpanView<uint8_t> WindowIcon32() noexcept { return WindowIcon32Data; }
|
||||
|
||||
static constexpr ox::Array<uint8_t, 334> WindowIcon40Data {
|
||||
static const ox::Array<uint8_t, 334> WindowIcon40Data {
|
||||
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00,
|
||||
0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x28,
|
||||
0x00, 0x00, 0x00, 0x28, 0x08, 0x03, 0x00, 0x00, 0x00, 0xbb,
|
||||
@ -513,7 +513,7 @@ static constexpr ox::Array<uint8_t, 334> WindowIcon40Data {
|
||||
|
||||
ox::SpanView<uint8_t> WindowIcon40() noexcept { return WindowIcon40Data; }
|
||||
|
||||
static constexpr ox::Array<uint8_t, 163> WindowIcon48Data {
|
||||
static const ox::Array<uint8_t, 163> WindowIcon48Data {
|
||||
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00,
|
||||
0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x30,
|
||||
0x00, 0x00, 0x00, 0x30, 0x02, 0x03, 0x00, 0x00, 0x00, 0x2a,
|
||||
@ -535,7 +535,7 @@ static constexpr ox::Array<uint8_t, 163> WindowIcon48Data {
|
||||
|
||||
ox::SpanView<uint8_t> WindowIcon48() noexcept { return WindowIcon48Data; }
|
||||
|
||||
static constexpr ox::Array<uint8_t, 8148> WindowIcon128Data {
|
||||
static const ox::Array<uint8_t, 8148> WindowIcon128Data {
|
||||
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00,
|
||||
0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x80,
|
||||
0x00, 0x00, 0x00, 0x80, 0x02, 0x03, 0x00, 0x00, 0x00, 0xbe,
|
||||
@ -1355,7 +1355,7 @@ static constexpr ox::Array<uint8_t, 8148> WindowIcon128Data {
|
||||
|
||||
ox::SpanView<uint8_t> WindowIcon128() noexcept { return WindowIcon128Data; }
|
||||
|
||||
static constexpr ox::Array<uint8_t, 275> WindowIcon264Data {
|
||||
static const ox::Array<uint8_t, 275> WindowIcon264Data {
|
||||
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00,
|
||||
0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x01, 0x08,
|
||||
0x00, 0x00, 0x01, 0x08, 0x02, 0x03, 0x00, 0x00, 0x00, 0xde,
|
||||
@ -1388,7 +1388,7 @@ static constexpr ox::Array<uint8_t, 275> WindowIcon264Data {
|
||||
|
||||
ox::SpanView<uint8_t> WindowIcon264() noexcept { return WindowIcon264Data; }
|
||||
|
||||
static constexpr ox::Array<uint8_t, 851> WindowIcon1080Data {
|
||||
static const ox::Array<uint8_t, 851> WindowIcon1080Data {
|
||||
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00,
|
||||
0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x03, 0x48,
|
||||
0x00, 0x00, 0x03, 0x48, 0x02, 0x03, 0x00, 0x00, 0x00, 0x80,
|
||||
|
@ -15,7 +15,18 @@
|
||||
namespace keel {
|
||||
|
||||
ox::Error init(
|
||||
keel::Context &ctx,
|
||||
Context &ctx,
|
||||
ox::UPtr<ox::FileSystem> &&fs,
|
||||
ox::StringViewCR appName,
|
||||
DuplicateSet &duplicateSet) noexcept;
|
||||
|
||||
ox::Result<ox::UPtr<Context>> init(
|
||||
ox::UPtr<ox::FileSystem> &&fs,
|
||||
ox::StringViewCR appName,
|
||||
DuplicateSet &duplicateSet) noexcept;
|
||||
|
||||
ox::Error init(
|
||||
Context &ctx,
|
||||
ox::UPtr<ox::FileSystem> &&fs,
|
||||
ox::StringViewCR appName) noexcept;
|
||||
|
||||
|
@ -29,13 +29,14 @@ OX_MODEL_BEGIN(PreloadPtr)
|
||||
OX_MODEL_FIELD(preloadAddr)
|
||||
OX_MODEL_END()
|
||||
|
||||
ox::Result<std::size_t> getPreloadAddr(keel::Context &ctx, ox::FileAddress const&addr) noexcept;
|
||||
ox::Result<std::size_t> getPreloadAddr(keel::Context &ctx, ox::StringViewCR path) noexcept;
|
||||
ox::Result<std::size_t> getPreloadAddr(Context &ctx, ox::FileAddress const&addr) noexcept;
|
||||
ox::Result<std::size_t> getPreloadAddr(Context &ctx, ox::StringViewCR path) noexcept;
|
||||
|
||||
|
||||
void createUuidMapping(Context &ctx, ox::StringViewCR filePath, ox::UUID const&uuid) noexcept;
|
||||
|
||||
ox::Error buildUuidMap(Context &ctx) noexcept;
|
||||
// map of UUIDs to paths
|
||||
using DuplicateSet = ox::HashMap<ox::UUID, ox::Vector<ox::String>>;
|
||||
|
||||
ox::Result<ox::UUID> pathToUuid(Context &ctx, ox::StringViewCR path) noexcept;
|
||||
|
||||
@ -87,8 +88,8 @@ constexpr auto makeLoader(Context &ctx) {
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
ox::Result<keel::AssetRef<T>> readObjFile(
|
||||
keel::Context &ctx,
|
||||
ox::Result<AssetRef<T>> readObjFile(
|
||||
Context &ctx,
|
||||
ox::StringViewCR assetId,
|
||||
bool const forceLoad) noexcept {
|
||||
static constexpr auto load = [](
|
||||
@ -135,11 +136,11 @@ ox::Result<keel::AssetRef<T>> readObjNoCache(
|
||||
|
||||
#endif
|
||||
|
||||
ox::Error reloadAsset(keel::Context &ctx, ox::StringViewCR assetId) noexcept;
|
||||
ox::Error reloadAsset(Context &ctx, ox::StringViewCR assetId) noexcept;
|
||||
|
||||
template<typename T>
|
||||
ox::Result<keel::AssetRef<T>> readObj(
|
||||
keel::Context &ctx,
|
||||
ox::Result<AssetRef<T>> readObj(
|
||||
Context &ctx,
|
||||
ox::StringViewCR assetId,
|
||||
[[maybe_unused]] bool forceLoad = false) noexcept {
|
||||
#ifndef OX_BARE_METAL
|
||||
@ -150,8 +151,8 @@ ox::Result<keel::AssetRef<T>> readObj(
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
ox::Result<keel::AssetRef<T>> readObj(
|
||||
keel::Context &ctx,
|
||||
ox::Result<AssetRef<T>> readObj(
|
||||
Context &ctx,
|
||||
ox::FileAddress const&file,
|
||||
[[maybe_unused]] bool forceLoad = false) noexcept {
|
||||
#ifndef OX_BARE_METAL
|
||||
@ -169,7 +170,7 @@ ox::Result<keel::AssetRef<T>> readObj(
|
||||
|
||||
template<typename T>
|
||||
ox::Error writeObj(
|
||||
keel::Context &ctx,
|
||||
Context &ctx,
|
||||
ox::FileAddress const&file,
|
||||
T const&obj,
|
||||
ox::ClawFormat fmt = ox::ClawFormat::Metal) noexcept {
|
||||
@ -177,6 +178,8 @@ ox::Error writeObj(
|
||||
return ctx.rom->write(file, objBuff.data(), objBuff.size());
|
||||
}
|
||||
|
||||
ox::Error setRomFs(Context &ctx, ox::UPtr<ox::FileSystem> &&fs, DuplicateSet &duplicateSet) noexcept;
|
||||
|
||||
ox::Error setRomFs(Context &ctx, ox::UPtr<ox::FileSystem> &&fs) noexcept;
|
||||
|
||||
ox::Result<ox::UPtr<ox::FileSystem>> loadRomFs(ox::StringViewCR path) noexcept;
|
||||
|
@ -32,6 +32,7 @@ class WrapT: public Wrap {
|
||||
[[nodiscard]]
|
||||
virtual constexpr T &obj() noexcept = 0;
|
||||
|
||||
[[nodiscard]]
|
||||
ox::UAnyPtr moveToCopy() noexcept final {
|
||||
return new T{std::move(obj())};
|
||||
}
|
||||
@ -46,14 +47,17 @@ class WrapRef final: public WrapT<T> {
|
||||
public:
|
||||
constexpr explicit WrapRef(T &obj): m_obj{obj} {}
|
||||
|
||||
[[nodiscard]]
|
||||
ox::CStringView typeName() const noexcept override {
|
||||
return ox::ModelTypeName_v<T>;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
int typeVersion() const noexcept override {
|
||||
return ox::ModelTypeVersion_v<T>;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr T &obj() noexcept override {
|
||||
return m_obj;
|
||||
}
|
||||
@ -72,14 +76,17 @@ class WrapInline final: public WrapT<T> {
|
||||
constexpr explicit WrapInline(Args &&...args): m_obj(ox::forward<Args>(args)...) {
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
ox::CStringView typeName() const noexcept override {
|
||||
return ox::ModelTypeName_v<T>;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
int typeVersion() const noexcept override {
|
||||
return ox::ModelTypeVersion_v<T>;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr T &obj() noexcept override {
|
||||
return m_obj;
|
||||
}
|
||||
@ -197,22 +204,17 @@ class ConverterFunc final: public BaseConverter {
|
||||
class Converter {
|
||||
private:
|
||||
ox::AllocAlias<BaseConverter> m_buff{};
|
||||
BaseConverter *m_conv{};
|
||||
public:
|
||||
template<auto Func>
|
||||
static Converter make() noexcept {
|
||||
Converter out;
|
||||
static_assert(sizeof(ConverterFunc<Func>) <= sizeof(out.m_buff));
|
||||
out.m_conv = new (out.m_buff.data()) ConverterFunc<Func>{};
|
||||
new (out.m_buff.data()) ConverterFunc<Func>{};
|
||||
return out;
|
||||
}
|
||||
constexpr Converter() {}
|
||||
Converter(Converter const &other) noexcept:
|
||||
m_buff{other.m_buff},
|
||||
m_conv{m_buff.data()} {}
|
||||
[[nodiscard]]
|
||||
BaseConverter const *converter() const noexcept {
|
||||
return m_conv;
|
||||
BaseConverter const &converter() const noexcept {
|
||||
return *m_buff.data();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -36,7 +36,7 @@ ox::Result<ox::ModelObject> readAsset(ox::TypeStore &ts, ox::BufferView buff) no
|
||||
return ox::readClaw(ts, buff);
|
||||
}
|
||||
|
||||
ox::Result<ox::StringView> readAssetTypeId(ox::BufferView buff) noexcept {
|
||||
ox::Result<ox::StringView> readAssetTypeId(ox::BufferView const buff) noexcept {
|
||||
const auto err = readUuidHeader(buff).error;
|
||||
const auto offset = err ? 0u : K1HdrSz;
|
||||
if (offset >= buff.size()) [[unlikely]] {
|
||||
|
39
deps/nostalgia/src/olympic/keel/src/keel.cpp
vendored
39
deps/nostalgia/src/olympic/keel/src/keel.cpp
vendored
@ -6,21 +6,24 @@
|
||||
|
||||
namespace keel {
|
||||
|
||||
ox::Error init(
|
||||
keel::Context &ctx,
|
||||
static ox::Error init(
|
||||
Context &ctx,
|
||||
ox::UPtr<ox::FileSystem> &&fs,
|
||||
ox::StringViewCR appName) noexcept {
|
||||
ox::StringViewCR appName,
|
||||
DuplicateSet *duplicateSet) noexcept {
|
||||
ctx.appName = appName;
|
||||
std::ignore = setRomFs(ctx, std::move(fs));
|
||||
std::ignore = duplicateSet ?
|
||||
setRomFs(ctx, std::move(fs), *duplicateSet) :
|
||||
setRomFs(ctx, std::move(fs));
|
||||
#ifndef OX_BARE_METAL
|
||||
auto const&mods = modules();
|
||||
for (auto &mod : mods) {
|
||||
// register type converters
|
||||
for (auto c : mod->converters()) {
|
||||
for (auto const c : mod->converters()) {
|
||||
ctx.converters.emplace_back(c);
|
||||
}
|
||||
// register pack transforms
|
||||
for (auto c : mod->packTransforms()) {
|
||||
for (auto const c : mod->packTransforms()) {
|
||||
ctx.packTransforms.emplace_back(c);
|
||||
}
|
||||
}
|
||||
@ -28,6 +31,30 @@ ox::Error init(
|
||||
return {};
|
||||
}
|
||||
|
||||
ox::Error init(
|
||||
Context &ctx,
|
||||
ox::UPtr<ox::FileSystem> &&fs,
|
||||
ox::StringViewCR appName,
|
||||
DuplicateSet &duplicateSet) noexcept {
|
||||
return init(ctx, std::move(fs), appName, &duplicateSet);
|
||||
}
|
||||
|
||||
ox::Result<ox::UPtr<Context>> init(
|
||||
ox::UPtr<ox::FileSystem> &&fs,
|
||||
ox::StringViewCR appName,
|
||||
DuplicateSet &duplicateSet) noexcept {
|
||||
auto ctx = ox::make_unique<Context>();
|
||||
OX_RETURN_ERROR(keel::init(*ctx, std::move(fs), appName, &duplicateSet));
|
||||
return ctx;
|
||||
}
|
||||
|
||||
ox::Error init(
|
||||
Context &ctx,
|
||||
ox::UPtr<ox::FileSystem> &&fs,
|
||||
ox::StringViewCR appName) noexcept {
|
||||
return init(ctx, std::move(fs), appName, nullptr);
|
||||
}
|
||||
|
||||
ox::Result<ox::UPtr<Context>> init(ox::UPtr<ox::FileSystem> &&fs, ox::StringViewCR appName) noexcept {
|
||||
auto ctx = ox::make_unique<Context>();
|
||||
OX_RETURN_ERROR(keel::init(*ctx, std::move(fs), appName));
|
||||
|
31
deps/nostalgia/src/olympic/keel/src/media.cpp
vendored
31
deps/nostalgia/src/olympic/keel/src/media.cpp
vendored
@ -47,7 +47,7 @@ void createUuidMapping(Context &ctx, ox::StringViewCR filePath, ox::UUID const&u
|
||||
ctx.uuidToPath[uuid.toString()] = filePath;
|
||||
}
|
||||
|
||||
static ox::Error buildUuidMap(Context &ctx, ox::StringViewCR path) noexcept {
|
||||
static ox::Error buildUuidMap(Context &ctx, ox::StringViewCR path, DuplicateSet *duplicates) noexcept {
|
||||
OX_REQUIRE(files, ctx.rom->ls(path));
|
||||
for (auto const&f : files) {
|
||||
OX_REQUIRE_M(filePath, ox::join("/", ox::Array<ox::StringView, 2>{path, f}));
|
||||
@ -58,22 +58,31 @@ static ox::Error buildUuidMap(Context &ctx, ox::StringViewCR path) noexcept {
|
||||
ctx.rom->read(filePath, 0, buff.size(), buff));
|
||||
auto const [uuid, err] = readUuidHeader(buff);
|
||||
if (!err) {
|
||||
createUuidMapping(ctx, filePath, uuid);
|
||||
// check for duplication
|
||||
if (duplicates && ctx.uuidToPath[uuid.toString()].len()) {
|
||||
auto &dl = (*duplicates)[uuid];
|
||||
if (dl.empty()) {
|
||||
dl.emplace_back(ctx.uuidToPath[uuid.toString()]);
|
||||
}
|
||||
dl.emplace_back(filePath);
|
||||
} else {
|
||||
createUuidMapping(ctx, filePath, uuid);
|
||||
}
|
||||
}
|
||||
} else if (stat.fileType == ox::FileType::Directory) {
|
||||
if (!beginsWith(f, ".")) {
|
||||
OX_RETURN_ERROR(buildUuidMap(ctx, filePath));
|
||||
OX_RETURN_ERROR(buildUuidMap(ctx, filePath, duplicates));
|
||||
}
|
||||
}
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
ox::Error buildUuidMap(Context &ctx) noexcept {
|
||||
static ox::Error buildUuidMap(Context &ctx, DuplicateSet *duplicates) noexcept {
|
||||
if (!ctx.rom) {
|
||||
return ox::Error(1, "No ROM FS");
|
||||
return ox::Error{1, "No ROM FS"};
|
||||
}
|
||||
return buildUuidMap(ctx, "");
|
||||
return buildUuidMap(ctx, "", duplicates);
|
||||
}
|
||||
|
||||
ox::Result<ox::UUID> pathToUuid(Context &ctx, ox::StringViewCR path) noexcept {
|
||||
@ -199,7 +208,7 @@ namespace keel {
|
||||
static void clearUuidMap(Context&) noexcept {
|
||||
}
|
||||
|
||||
ox::Error buildUuidMap(Context&) noexcept {
|
||||
static ox::Error buildUuidMap(Context&, DuplicateSet*) noexcept {
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -249,10 +258,16 @@ ox::Error reloadAsset(keel::Context&, ox::StringView) noexcept {
|
||||
|
||||
namespace keel {
|
||||
|
||||
ox::Error setRomFs(Context &ctx, ox::UPtr<ox::FileSystem> &&fs, DuplicateSet &duplicateSet) noexcept {
|
||||
ctx.rom = std::move(fs);
|
||||
clearUuidMap(ctx);
|
||||
return buildUuidMap(ctx, &duplicateSet);
|
||||
}
|
||||
|
||||
ox::Error setRomFs(Context &ctx, ox::UPtr<ox::FileSystem> &&fs) noexcept {
|
||||
ctx.rom = std::move(fs);
|
||||
clearUuidMap(ctx);
|
||||
return buildUuidMap(ctx);
|
||||
return buildUuidMap(ctx, nullptr);
|
||||
}
|
||||
|
||||
ox::Result<ox::UPtr<ox::FileSystem>> loadRomFs(ox::StringViewCR path) noexcept {
|
||||
|
@ -6,13 +6,11 @@
|
||||
|
||||
#include <ox/clargs/clargs.hpp>
|
||||
#include <ox/fs/fs.hpp>
|
||||
#include <ox/logconn/def.hpp>
|
||||
#include <ox/logconn/logconn.hpp>
|
||||
#include <ox/oc/write.hpp>
|
||||
|
||||
#include <keel/keel.hpp>
|
||||
|
||||
static ox::Error writeFileBuff(ox::StringView path, ox::BufferView const buff) noexcept {
|
||||
static ox::Error writeFileBuff(ox::StringViewCR path, ox::BufferView const &buff) noexcept {
|
||||
try {
|
||||
std::ofstream f(std::string(toStdStringView(path)), std::ios::binary);
|
||||
f.write(buff.data(), static_cast<intptr_t>(buff.size()));
|
||||
@ -22,7 +20,7 @@ static ox::Error writeFileBuff(ox::StringView path, ox::BufferView const buff) n
|
||||
return {};
|
||||
}
|
||||
|
||||
static ox::Result<ox::Buffer> readFileBuff(ox::StringView path) noexcept {
|
||||
static ox::Result<ox::Buffer> readFileBuff(ox::StringViewCR path) noexcept {
|
||||
std::ifstream file(std::string(toStdStringView(path)), std::ios::binary | std::ios::ate);
|
||||
if (!file.good()) {
|
||||
oxErrorf("Could not find OxFS file: {}", path);
|
||||
@ -42,7 +40,7 @@ static ox::Result<ox::Buffer> readFileBuff(ox::StringView path) noexcept {
|
||||
|
||||
static ox::Error generateTypes(ox::TypeStore &ts) noexcept {
|
||||
for (auto const mod : keel::modules()) {
|
||||
for (auto gen : mod->types()) {
|
||||
for (auto const gen : mod->types()) {
|
||||
OX_RETURN_ERROR(gen(ts));
|
||||
}
|
||||
}
|
||||
@ -50,14 +48,27 @@ static ox::Error generateTypes(ox::TypeStore &ts) noexcept {
|
||||
}
|
||||
|
||||
static ox::Error pack(
|
||||
ox::StringView argSrc,
|
||||
ox::StringView argRomBin,
|
||||
ox::StringView argManifest,
|
||||
ox::StringView projectDataDir) noexcept {
|
||||
ox::StringViewCR argSrc,
|
||||
ox::StringViewCR argRomBin,
|
||||
ox::StringViewCR argManifest,
|
||||
ox::StringViewCR projectDataDir) noexcept {
|
||||
ox::Buffer dstBuff(32 * ox::units::MB);
|
||||
OX_RETURN_ERROR(ox::FileSystem32::format(dstBuff.data(), dstBuff.size()));
|
||||
ox::FileSystem32 dst(dstBuff);
|
||||
OX_REQUIRE(ctx, keel::init(ox::make_unique<ox::PassThroughFS>(argSrc), "keel-pack"));
|
||||
keel::DuplicateSet duplicateSet;
|
||||
OX_REQUIRE(ctx, keel::init(
|
||||
ox::make_unique<ox::PassThroughFS>(argSrc), "keel-pack", duplicateSet));
|
||||
if (duplicateSet.size()) {
|
||||
oxErr("Multiple files have the same UUID:\n");
|
||||
for (auto const &k : duplicateSet.keys()) {
|
||||
oxErrf("\n\t{}:\n", k.toString());
|
||||
for (auto const &v : duplicateSet[k]) {
|
||||
oxErrf("\t\t{}\n", v);
|
||||
}
|
||||
}
|
||||
oxErr("\n");
|
||||
std::exit(1);
|
||||
}
|
||||
keel::TypeStore ts(*ctx->rom, ox::sfmt("{}/type_descriptors", projectDataDir));
|
||||
OX_RETURN_ERROR(generateTypes(ts));
|
||||
keel::Manifest manifest;
|
||||
@ -82,10 +93,10 @@ static ox::Error pack(
|
||||
}
|
||||
|
||||
ox::Error run(
|
||||
[[maybe_unused]] ox::StringView project,
|
||||
[[maybe_unused]] ox::StringView appName,
|
||||
ox::StringView projectDataDir,
|
||||
ox::SpanView<ox::CString> argv) noexcept {
|
||||
[[maybe_unused]] ox::StringView const project,
|
||||
[[maybe_unused]] ox::StringView const appName,
|
||||
ox::StringView const projectDataDir,
|
||||
ox::SpanView<ox::CString> const argv) noexcept {
|
||||
ox::ClArgs const args(argv);
|
||||
auto const argSrc = args.getString("src", "");
|
||||
auto const argRomBin = args.getString("rom-bin", "");
|
||||
|
37
deps/nostalgia/src/olympic/keel/src/pack.cpp
vendored
37
deps/nostalgia/src/olympic/keel/src/pack.cpp
vendored
@ -11,13 +11,12 @@
|
||||
namespace keel {
|
||||
|
||||
static ox::Error pathToInode(
|
||||
keel::Context &ctx,
|
||||
ox::FileSystem &dest,
|
||||
Context &ctx,
|
||||
ox::FileSystem const &dest,
|
||||
ox::ModelObject &obj) noexcept {
|
||||
auto &o = obj;
|
||||
OX_REQUIRE(typeVal, o.at("type"));
|
||||
OX_REQUIRE(typeVal, obj.at("type"));
|
||||
auto const type = static_cast<ox::FileAddressType>(typeVal->get<int8_t>());
|
||||
OX_REQUIRE(dataVal, o.at("data"));
|
||||
OX_REQUIRE(dataVal, obj.at("data"));
|
||||
auto &data = dataVal->get<ox::ModelUnion>();
|
||||
ox::String path;
|
||||
switch (type) {
|
||||
@ -47,13 +46,17 @@ static ox::Error pathToInode(
|
||||
}
|
||||
|
||||
static ox::Error transformFileAddressesObj(
|
||||
keel::Context &ctx, ox::FileSystem &dest, ox::ModelObject &obj) noexcept;
|
||||
Context &ctx,
|
||||
ox::FileSystem const &dest,
|
||||
ox::ModelObject &obj) noexcept;
|
||||
static ox::Error transformFileAddressesVec(
|
||||
keel::Context &ctx, ox::FileSystem &dest, ox::ModelValueVector &v) noexcept;
|
||||
Context &ctx,
|
||||
ox::FileSystem const &dest,
|
||||
ox::ModelValueVector &v) noexcept;
|
||||
|
||||
static ox::Error transformFileAddresses(
|
||||
keel::Context &ctx,
|
||||
ox::FileSystem &dest,
|
||||
Context &ctx,
|
||||
ox::FileSystem const &dest,
|
||||
ox::ModelValue &v) noexcept {
|
||||
if (v.type() == ox::ModelValue::Type::Object) {
|
||||
auto &obj = v.get<ox::ModelObject>();
|
||||
@ -66,8 +69,8 @@ static ox::Error transformFileAddresses(
|
||||
}
|
||||
|
||||
static ox::Error transformFileAddressesVec(
|
||||
keel::Context &ctx,
|
||||
ox::FileSystem &dest,
|
||||
Context &ctx,
|
||||
ox::FileSystem const &dest,
|
||||
ox::ModelValueVector &v) noexcept {
|
||||
for (auto &f : v) {
|
||||
OX_RETURN_ERROR(transformFileAddresses(ctx, dest, f));
|
||||
@ -80,13 +83,13 @@ static ox::Error transformFileAddressesVec(
|
||||
* @return error
|
||||
*/
|
||||
static ox::Error transformFileAddressesObj(
|
||||
keel::Context &ctx,
|
||||
ox::FileSystem &dest,
|
||||
Context &ctx,
|
||||
ox::FileSystem const &dest,
|
||||
ox::ModelObject &obj) noexcept {
|
||||
if (obj.typeName() == "net.drinkingtea.ox.FileAddress" && obj.typeVersion() == 1) {
|
||||
return pathToInode(ctx, dest, obj);
|
||||
}
|
||||
for (auto &f : obj) {
|
||||
for (auto const &f : obj) {
|
||||
auto &v = f->value;
|
||||
OX_RETURN_ERROR(transformFileAddresses(ctx, dest, v));
|
||||
}
|
||||
@ -111,7 +114,7 @@ static ox::Error performPackTransforms(
|
||||
|
||||
static ox::Error doTransformations(
|
||||
Manifest &manifest,
|
||||
keel::Context &ctx,
|
||||
Context &ctx,
|
||||
ox::TypeStore &ts,
|
||||
ox::FileSystem &dest,
|
||||
ox::StringViewCR filePath) noexcept {
|
||||
@ -134,7 +137,7 @@ static ox::Error doTransformations(
|
||||
// transformations need to be done after the copy to the new FS is complete
|
||||
static ox::Error transformClaw(
|
||||
Manifest &manifest,
|
||||
keel::Context &ctx,
|
||||
Context &ctx,
|
||||
ox::TypeStore &ts,
|
||||
ox::FileSystem &dest,
|
||||
ox::StringViewCR path) noexcept {
|
||||
@ -200,7 +203,7 @@ static ox::Error copy(
|
||||
|
||||
ox::Error pack(
|
||||
Manifest &manifest,
|
||||
keel::Context &ctx,
|
||||
Context &ctx,
|
||||
ox::TypeStore &ts,
|
||||
ox::FileSystem &dest) noexcept {
|
||||
OX_RETURN_ERROR(copy(manifest, *ctx.rom, dest, "/"));
|
||||
|
10
deps/nostalgia/src/olympic/keel/src/typeconv.cpp
vendored
10
deps/nostalgia/src/olympic/keel/src/typeconv.cpp
vendored
@ -15,8 +15,8 @@ static ox::Result<BaseConverter const*> findConverter(
|
||||
ox::StringViewCR dstTypeName,
|
||||
int const dstTypeVersion) noexcept {
|
||||
for (auto const&c : converters) {
|
||||
if (c.converter()->matches(srcTypeName, srcTypeVersion, dstTypeName, dstTypeVersion)) {
|
||||
return c.converter();
|
||||
if (c.converter().matches(srcTypeName, srcTypeVersion, dstTypeName, dstTypeVersion)) {
|
||||
return &c.converter();
|
||||
}
|
||||
}
|
||||
return ox::Error{1, "Could not find converter"};
|
||||
@ -46,14 +46,14 @@ static ox::Result<ox::UPtr<Wrap>> convert(
|
||||
}
|
||||
// try to chain multiple converters
|
||||
for (auto const&subConverter : converters) {
|
||||
if (!subConverter.converter()->dstMatches(dstTypeName, dstTypeVersion)) {
|
||||
if (!subConverter.converter().dstMatches(dstTypeName, dstTypeVersion)) {
|
||||
continue;
|
||||
}
|
||||
const auto [intermediate, chainErr] =
|
||||
convert(ctx, converters, src, srcTypeName, srcTypeVersion,
|
||||
subConverter.converter()->srcTypeName(), subConverter.converter()->srcTypeVersion());
|
||||
subConverter.converter().srcTypeName(), subConverter.converter().srcTypeVersion());
|
||||
if (!chainErr) {
|
||||
return subConverter.converter()->convertPtrToPtr(ctx, *intermediate);
|
||||
return subConverter.converter().convertPtrToPtr(ctx, *intermediate);
|
||||
}
|
||||
}
|
||||
return ox::Error{1, "Could not convert between types"};
|
||||
|
@ -5,6 +5,7 @@ add_library(
|
||||
clawviewer.cpp
|
||||
deleteconfirmation.cpp
|
||||
filedialogmanager.cpp
|
||||
font.cpp
|
||||
makecopypopup.cpp
|
||||
newdir.cpp
|
||||
newmenu.cpp
|
||||
|
BIN
deps/nostalgia/src/olympic/studio/applib/src/Roboto-Medium.ttf
vendored
Normal file
BIN
deps/nostalgia/src/olympic/studio/applib/src/Roboto-Medium.ttf
vendored
Normal file
Binary file not shown.
@ -29,7 +29,11 @@ bool AboutPopup::isOpen() const noexcept {
|
||||
return m_stage == Stage::Open;
|
||||
}
|
||||
|
||||
void AboutPopup::draw(StudioContext &sctx) noexcept {
|
||||
void AboutPopup::draw(Context &sctx) noexcept {
|
||||
if (ImGui::IsKeyPressed(ImGuiKey_Escape)) {
|
||||
close();
|
||||
return;
|
||||
}
|
||||
switch (m_stage) {
|
||||
case Stage::Closed:
|
||||
break;
|
||||
|
@ -35,7 +35,7 @@ class AboutPopup: public studio::Popup {
|
||||
[[nodiscard]]
|
||||
bool isOpen() const noexcept override;
|
||||
|
||||
void draw(studio::StudioContext &sctx) noexcept override;
|
||||
void draw(studio::Context &sctx) noexcept override;
|
||||
|
||||
};
|
||||
|
||||
|
@ -28,7 +28,7 @@ class StudioUIDrawer: public turbine::gl::Drawer {
|
||||
};
|
||||
|
||||
static void keyEventHandler(turbine::Context &ctx, turbine::Key key, bool down) noexcept {
|
||||
auto sctx = turbine::applicationData<studio::StudioContext>(ctx);
|
||||
auto sctx = turbine::applicationData<studio::Context>(ctx);
|
||||
sctx->ui.handleKeyEvent(key, down);
|
||||
}
|
||||
|
||||
|
@ -8,12 +8,12 @@
|
||||
|
||||
namespace studio {
|
||||
|
||||
ClawEditor::ClawEditor(StudioContext &sctx, ox::StringParam path):
|
||||
ClawEditor::ClawEditor(Context &sctx, ox::StringParam path):
|
||||
Editor(sctx, std::move(path)),
|
||||
m_obj(sctx.project->loadObj<ox::ModelObject>(itemPath()).unwrapThrow()) {
|
||||
}
|
||||
|
||||
void ClawEditor::draw(StudioContext&) noexcept {
|
||||
void ClawEditor::draw(Context&) noexcept {
|
||||
ImGui::BeginChild("PaletteEditor");
|
||||
static constexpr auto flags = ImGuiTableFlags_RowBg | ImGuiTableFlags_NoBordersInBody;
|
||||
if (ImGui::BeginTable("ObjTree", 3, flags)) {
|
||||
|
@ -16,9 +16,9 @@ class ClawEditor: public Editor {
|
||||
using ObjPath = ox::Vector<ox::StringView, 8>;
|
||||
ox::ModelObject m_obj;
|
||||
public:
|
||||
ClawEditor(StudioContext &sctx, ox::StringParam path);
|
||||
ClawEditor(Context &sctx, ox::StringParam path);
|
||||
|
||||
void draw(StudioContext&) noexcept final;
|
||||
void draw(Context&) noexcept final;
|
||||
|
||||
private:
|
||||
static void drawRow(ox::ModelValue const&value) noexcept;
|
||||
|
@ -31,7 +31,11 @@ bool DeleteConfirmation::isOpen() const noexcept {
|
||||
return m_open;
|
||||
}
|
||||
|
||||
void DeleteConfirmation::draw(StudioContext &ctx) noexcept {
|
||||
void DeleteConfirmation::draw(Context &ctx) noexcept {
|
||||
if (ImGui::IsKeyPressed(ImGuiKey_Escape)) {
|
||||
close();
|
||||
return;
|
||||
}
|
||||
switch (m_stage) {
|
||||
case Stage::Closed:
|
||||
break;
|
||||
|
@ -36,7 +36,7 @@ class DeleteConfirmation final: public Popup {
|
||||
[[nodiscard]]
|
||||
bool isOpen() const noexcept override;
|
||||
|
||||
void draw(StudioContext &ctx) noexcept override;
|
||||
void draw(Context &ctx) noexcept override;
|
||||
|
||||
};
|
||||
|
||||
|
16272
deps/nostalgia/src/olympic/studio/applib/src/font.cpp
vendored
Normal file
16272
deps/nostalgia/src/olympic/studio/applib/src/font.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user