16 return absl::InvalidArgumentError(
"ROM is not loaded");
28 data_.reserve(256 * 256);
29 for (
int i = 0; i < 256 * 256; i++) {
30 data_.push_back(0xFF);
40 return absl::OkStatus();
45 for (
int i = 0; i < 6 * 0x2000; i++)
48 std::vector<uint8_t> test;
49 for (
int i = 0; i < 0x4000; i++) {
52 for (
int i = 0x8000; i < +0x8000 + 0x2000; i++) {
57 return absl::FailedPreconditionError(
"GameData not set for Inventory");
67 return absl::OkStatus();
82 std::vector<IconDef> bow_icons = {{0x00,
"No bow"},
84 {0x10,
"Bow and arrows"},
85 {0x18,
"Empty silvers bow"},
86 {0x20,
"Silver bow and arrows"}};
89 std::vector<IconDef> boom_icons = {{0x28,
"No boomerang"},
90 {0x30,
"Blue boomerang"},
91 {0x38,
"Red boomerang"}};
94 std::vector<IconDef> hook_icons = {{0x40,
"No hookshot"}, {0x48,
"Hookshot"}};
97 std::vector<IconDef> bomb_icons = {{0x50,
"No bombs"}, {0x58,
"Bombs"}};
100 auto load_icons = [&](
const std::vector<IconDef>& icons) -> absl::Status {
101 for (
const auto& icon_def : icons) {
103 int icon_addr = pc_addr + icon_def.offset;
109 icon.
name = icon_def.name;
113 return absl::OkStatus();
148 return absl::OkStatus();
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
absl::StatusOr< uint16_t > ReadWord(int offset)
void QueueTextureCommand(TextureCommandType type, Bitmap *bitmap)
void Create(int width, int height, int depth, std::span< uint8_t > data)
Create a bitmap with the given dimensions and data.
void SetPalette(const SnesPalette &palette)
Set the palette for the bitmap using SNES palette format.
absl::Status BuildTileset(Rom *rom)
Build the tileset from 2BPP graphics.
absl::Status Create(Rom *rom, GameData *game_data=nullptr)
Initialize and load inventory screen data from ROM.
gfx::SnesPalette palette_
std::vector< uint8_t > data_
std::vector< ItemIcon > item_icons_
gfx::Bitmap tilesheets_bmp_
std::vector< uint8_t > test_
absl::Status LoadItemIcons(Rom *rom)
Load individual item icons from ROM.
std::vector< uint8_t > tilesheets_
#define ASSIGN_OR_RETURN(type_variable_name, expression)
absl::StatusOr< std::vector< uint8_t > > Load2BppGraphics(const Rom &rom)
Loads 2BPP graphics sheets from ROM.
constexpr int kItemIconsPtr
uint32_t SnesToPc(uint32_t addr) noexcept
#define RETURN_IF_ERROR(expr)
gfx::PaletteGroupMap palette_groups
Represents a single item icon (2x2 tiles = 4 tile words)