diff options
author | Malte Voos <git@mal.tc> | 2024-04-03 18:12:50 +0200 |
---|---|---|
committer | Malte Voos <git@mal.tc> | 2024-04-03 18:12:50 +0200 |
commit | 6eaea5ca33cfaeea7a7fc9434e082ce1a9e0c6c5 (patch) | |
tree | 0f65ca7bb4c5a951f132b6ad53582dc7b5dcc12a /fakefbdev/SharedBuffer.h | |
download | reMder-6eaea5ca33cfaeea7a7fc9434e082ce1a9e0c6c5.tar.gz reMder-6eaea5ca33cfaeea7a7fc9434e082ce1a9e0c6c5.zip |
init
Diffstat (limited to 'fakefbdev/SharedBuffer.h')
-rw-r--r-- | fakefbdev/SharedBuffer.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/fakefbdev/SharedBuffer.h b/fakefbdev/SharedBuffer.h new file mode 100644 index 0000000..8c96668 --- /dev/null +++ b/fakefbdev/SharedBuffer.h @@ -0,0 +1,38 @@ +#pragma once + +#include <cstdint> + +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; +}; |