From 6242a7565e982b67db9c17a01f5104426bba6e0c Mon Sep 17 00:00:00 2001 From: tobid7 Date: Fri, 28 Nov 2025 17:48:27 +0100 Subject: [PATCH] fixes --- source/bcstm.cpp | 3 ++- source/binutil.cpp | 2 +- source/helper.cpp | 8 ++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/source/bcstm.cpp b/source/bcstm.cpp index c5de545..dd02155 100644 --- a/source/bcstm.cpp +++ b/source/bcstm.cpp @@ -163,7 +163,8 @@ CTRFF_API void BCSTM::ReadGotoBeginning(bool use_loop_beg) { CTRFF_API void BCSTM::ReadBlock(PD::u32 block, PD::u8* ref) { if (pFile.tellg() > pHeader.FileSize || block >= GetNumBlocks()) { - throw std::runtime_error("BCSTM: Decode block Out of range!"); + throw std::runtime_error(std::format( + "BCSTM: Decode block Out of range! ({} > {})", block, GetNumBlocks())); } pFile.read( reinterpret_cast(ref), diff --git a/source/binutil.cpp b/source/binutil.cpp index 1eed924..b100a9c 100644 --- a/source/binutil.cpp +++ b/source/binutil.cpp @@ -21,7 +21,7 @@ void BinUtil::Read(T& v) { // Read data into buffer m_file.read(reinterpret_cast(buf.data()), sizeof(T)); // Loop or in be reverse loop and chift the values - for (int i = 0; i < sizeof(T); i++) { + for (size_t i = 0; i < sizeof(T); i++) { v |= static_cast(buf[m_big ? sizeof(T) - 1 - i : i]) << (8 * i); } } diff --git a/source/helper.cpp b/source/helper.cpp index e3ad894..08bea05 100644 --- a/source/helper.cpp +++ b/source/helper.cpp @@ -31,8 +31,8 @@ CTRFF_API void ctrff::RGB565toRGBA(std::vector &img, PD::u16 *icon, img.resize(48 * 48 * 4); img.clear(); } - for (PD::u32 y = 0; y < h; y++) { - for (PD::u32 x = 0; x < w; x++) { + for (int y = 0; y < h; y++) { + for (int x = 0; x < w; x++) { auto idx = TileIndex(x, y, w); PD::u32 pos = (y * w + x) * 4; MakePixelRGBA(img[pos + 0], img[pos + 1], img[pos + 2], img[pos + 3], @@ -45,8 +45,8 @@ CTRFF_API void ctrff::RGBA2RGB565(PD::u16 *out, const std::vector &img, const int &w, const int &h) { if (img.size() != size_t(w * h * 4)) return; std::vector px8 = img; - for (PD::u32 y = 0; y < h; y++) { - for (PD::u32 x = 0; x < w; x++) { + for (int y = 0; y < h; y++) { + for (int x = 0; x < w; x++) { auto idx = TileIndex(x, y, w); PD::u32 pos = (y * w + x) * 4; out[idx] = MakePixel565(img[pos], img[pos + 1], img[pos + 2]);