#pragma once #include constexpr int fb_width = 1404; constexpr int fb_height = 1872; constexpr int fb_pixel_size = sizeof(uint16_t); // this is the number of bytes that xochitl mmaps() from the framebuffer. // MIGHT CHANGE BETWEEN XOCHITL VERSIONS! // the below value was extracted from xochitl 3.10.2.2063. // // to figure out this value, decompile xochitl using ghidra and // - search for the string "Error writing variable information" // - this string should be used in a call to perror() which is contained // in the if-part of a branch // - look for the corresponding else-branch: the first statement should be // a call to mmap() with the below size. // (of course, these instruction might become outdated if remarkable folks // rewrite this part of xochitl :/) constexpr int fb_size = 0x17bd800; constexpr auto default_fb_name = "/rm2fb.01"; // TODO: use unistdpp struct SharedFB { int fd = -1; uint16_t* mem = nullptr; SharedFB(const char* path); ~SharedFB(); SharedFB(const SharedFB& other) = delete; SharedFB& operator=(const SharedFB& other) = delete; SharedFB(SharedFB&& other) noexcept; SharedFB& operator=(SharedFB&& other) noexcept; };