|
Tabula Sonora 0.1.0
A native C++20 implementation of the Roland Sound Canvas VA synth voice
|
Read-only access to SCCore.dll as a data file. More...
#include <tabulasonora/rom_image.hpp>
Public Member Functions | |
| RomImage (RomImage &&) noexcept | |
| RomImage & | operator= (RomImage &&) noexcept |
| RomImage (const RomImage &)=delete | |
| RomImage & | operator= (const RomImage &)=delete |
| ~RomImage () | |
| const std::string & | path () const noexcept |
| Path, or descriptive name, the image was opened from. | |
| std::int64_t | length () const noexcept |
| Length of the file in bytes. | |
| const TableManifest & | manifest () const noexcept |
| The offset map these reads are interpreted through. | |
| void | read (std::int64_t file_offset, std::span< std::uint8_t > destination) const |
| Reads into a caller-supplied buffer, filling it completely. | |
| std::vector< std::uint8_t > | read (std::int64_t file_offset, std::size_t length) const |
| Reads length bytes starting at file_offset. | |
| std::vector< std::uint8_t > | read (const TableEntry &entry) const |
| Reads the bytes of one cached table, exactly entry.size long. | |
| std::uint32_t | read_pe_timestamp () const |
| Reads the COFF TimeDateStamp from the PE header, or 0 if the file is not a PE image. | |
| std::string | compute_sha256 () const |
| Computes the SHA-256 of the whole file as lower-case hex. | |
Static Public Member Functions | |
| static RomImage | open (const std::string &path, RomVerification verification=RomVerification::full, const TableManifest *manifest=nullptr) |
| Opens and verifies an SCCore.dll. | |
| static RomImage | from_memory (std::span< const std::uint8_t > image, RomVerification verification=RomVerification::full, const TableManifest *manifest=nullptr, std::string name="<memory>") |
| Wraps an SCCore.dll already held in memory, and verifies it. | |
Read-only access to SCCore.dll as a data file.
The DLL is never loaded as code — no LoadLibrary, no dlopen, no native dependency. It is opened as a plain file and sliced at the offsets recorded in TableManifest, which is what lets this engine stay portable and run on hosts the original plugin never supported.
A file image reads positionally (pread) rather than through a memory map, so no 27 MB copy is ever resident. A host without a filesystem supplies the bytes instead; see from_memory.
|
noexcept |
|
delete |
| ts::RomImage::~RomImage | ( | ) |
|
staticnodiscard |
Opens and verifies an SCCore.dll.
Throws RomIdentityError if the file is not the pinned build, or std::runtime_error if it cannot be opened. The manifest defaults to the embedded one.
|
staticnodiscard |
Wraps an SCCore.dll already held in memory, and verifies it.
Nothing is copied — the memory is read in place — so the caller must keep it alive and unchanged for as long as the image is used, exactly as a file image needs its handle open.
|
inlinenodiscardnoexcept |
Path, or descriptive name, the image was opened from.
|
inlinenodiscardnoexcept |
Length of the file in bytes.
|
inlinenodiscardnoexcept |
The offset map these reads are interpreted through.
| void ts::RomImage::read | ( | std::int64_t | file_offset, |
| std::span< std::uint8_t > | destination ) const |
Reads into a caller-supplied buffer, filling it completely.
Throws std::runtime_error if the file ends before the buffer is filled.
|
nodiscard |
Reads length bytes starting at file_offset.
|
nodiscard |
Reads the bytes of one cached table, exactly entry.size long.
|
nodiscard |
Reads the COFF TimeDateStamp from the PE header, or 0 if the file is not a PE image.
|
nodiscard |
Computes the SHA-256 of the whole file as lower-case hex.