mirror of
https://github.com/torlando-tech/pyxis.git
synced 2026-10-09 07:47:51 +00:00
A 31-character pack ID makes mounted tile paths (/sd/pyxis-map/packs/<id>/tiles/<z>/<x>/<y>.png) exceed the 68-byte mount buffer once either x or y is two digits, so beginRead returns INVALID_ARGUMENT and the UI shows 'Tile I/O error' at z4+ even though the file exists and is intact. Compiles the unmodified MapTilePack/MapTileStoreSD/SDAccess/codec/manifest sources against small Arduino/FreeRTOS host shims. The core section (no card needed) drives the real store with a model of the mount-prefix arithmetic and asserts the 31-char-ID boundary loads at z4/z5; an optional end-to-end section runs the real MapTilePack over a bound card root when /sd is writable. Fails on the current 64-byte PATH_CAPACITY: red by design.
49 lines
1.2 KiB
C++
49 lines
1.2 KiB
C++
// Host shim for <Arduino.h> — compiles the real T-Deck SD storage sources
|
|
// (MapTileStoreSD.cpp, SDAccess.cpp) unmodified on x86.
|
|
//
|
|
// MapTileStoreSD.cpp uses Arduino.h only for fs::File (pulled via SD.h);
|
|
// SDAccess.cpp uses pinMode/digitalWrite/Serial, modelled here as no-ops.
|
|
// The ARDUINO macro itself is supplied by the test driver (-DARDUINO=100).
|
|
#ifndef SDHOSTSHIM_ARDUINO_H
|
|
#define SDHOSTSHIM_ARDUINO_H
|
|
|
|
#include <cstdarg>
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <cstdio>
|
|
#include <cstring>
|
|
|
|
#define HIGH 1
|
|
#define LOW 0
|
|
#define INPUT 0
|
|
#define OUTPUT 1
|
|
|
|
namespace {
|
|
|
|
struct HostSerial {
|
|
template <typename... Args>
|
|
void println(const char* const format, Args&&...) {
|
|
std::fputs(format ? format : "\n", stderr);
|
|
std::fputc('\n', stderr);
|
|
}
|
|
void println() { std::fputc('\n', stderr); }
|
|
void printf(const char* format, ...) {
|
|
va_list args;
|
|
va_start(args, format);
|
|
std::vfprintf(stderr, format, args);
|
|
va_end(args);
|
|
}
|
|
};
|
|
|
|
HostSerial __attribute__((unused)) host_serial;
|
|
|
|
} // namespace
|
|
|
|
#define Serial host_serial
|
|
|
|
inline void pinMode(std::uint8_t, std::uint8_t) {}
|
|
inline void digitalWrite(std::uint8_t, std::uint8_t) {}
|
|
inline void delay(std::uint32_t) {}
|
|
|
|
#endif
|