Add short name handling for ROMs in Rom class; update EditorManager to use short names in the ROM selector for improved UI clarity.

This commit is contained in:
scawful
2025-04-16 17:33:48 -04:00
parent 75d7ba9382
commit 00d30efbf1
4 changed files with 107 additions and 38 deletions

View File

@@ -168,7 +168,7 @@ class Rom {
auto vector() const { return rom_data_; }
auto filename() const { return filename_; }
auto set_filename(std::string name) { filename_ = name; }
auto short_name() const { return short_name_; }
std::vector<uint8_t> graphics_buffer() const { return graphics_buffer_; }
auto mutable_graphics_buffer() { return &graphics_buffer_; }
auto palette_group() const { return palette_groups_; }
@@ -248,6 +248,9 @@ class Rom {
// Filename of the ROM
std::string filename_ = "";
// Short name of the ROM
std::string short_name_ = "";
// Full contiguous rom space
std::vector<uint8_t> rom_data_;
@@ -386,6 +389,13 @@ class SharedRom {
return rom;
}
static void set_rom(Rom* rom) {
if (!shared_rom_) {
shared_rom_ = std::make_shared<Rom>();
}
shared_rom_ = std::shared_ptr<Rom>(rom);
}
// private:
static std::shared_ptr<Rom> shared_rom_;
};