From cd1fe3f2e4c101bf71970601e19e3826c55fc99c Mon Sep 17 00:00:00 2001 From: Justin Scofield Date: Wed, 20 Jul 2022 18:47:23 +0000 Subject: [PATCH] ROM housekeeping --- src/app/rom.cc | 24 +++++++++++------------- src/app/rom.h | 12 ++++-------- 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/src/app/rom.cc b/src/app/rom.cc index d0a164cd..03386a0d 100644 --- a/src/app/rom.cc +++ b/src/app/rom.cc @@ -1,8 +1,5 @@ #include "rom.h" -#include -#include - #include #include #include @@ -14,6 +11,7 @@ #include "app/core/common.h" #include "app/core/constants.h" +#include "app/gfx/pseudo_vram.h" #include "app/gfx/snes_tile.h" namespace yaze { @@ -92,6 +90,16 @@ void ROM::LoadAllGraphicsData() { master_gfx_bin_ = buffer; } +uint ROM::GetGraphicsAddress(uint8_t offset) const { + uint snes_address = 0; + uint pc_address = 0; + snes_address = (uint)((((current_rom_[0x4F80 + offset]) << 16) | + ((current_rom_[0x505F + offset]) << 8) | + ((current_rom_[0x513E + offset])))); + pc_address = core::SnesToPc(snes_address); + return pc_address; +} + uchar *ROM::DecompressGraphics(int pos, int size) { return Decompress(pos, size, false); } @@ -229,16 +237,6 @@ uchar *ROM::SNES3bppTo8bppSheet(uchar *buffer_in, int sheet_id, int size) { return sheet_buffer_out; } -uint ROM::GetGraphicsAddress(uint8_t offset) const { - uint snes_address = 0; - uint pc_address = 0; - snes_address = (uint)((((current_rom_[0x4F80 + offset]) << 16) | - ((current_rom_[0x505F + offset]) << 8) | - ((current_rom_[0x513E + offset])))); - pc_address = core::SnesToPc(snes_address); - return pc_address; -} - SDL_Texture *ROM::DrawGraphicsSheet(int offset) { SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormat(0, 128, 32, 8, SDL_PIXELFORMAT_INDEX8); diff --git a/src/app/rom.h b/src/app/rom.h index a55eae5c..66976e71 100644 --- a/src/app/rom.h +++ b/src/app/rom.h @@ -1,9 +1,6 @@ #ifndef YAZE_APP_ROM_H #define YAZE_APP_ROM_H -#include -#include - #include #include #include @@ -42,18 +39,19 @@ class ROM { void LoadFromPointer(uchar* data); void LoadAllGraphicsData(); + uint GetGraphicsAddress(uint8_t id) const; + uchar* DecompressGraphics(int pos, int size); uchar* DecompressOverworld(int pos, int size); uchar* Decompress(int pos, int size = 0x800, bool reversed = false); - uchar* SNES3bppTo8bppSheet(uchar* buffer_in, int sheet_id = 0, int size = 0x1000); - uint GetGraphicsAddress(uint8_t id) const; + SDL_Texture* DrawGraphicsSheet(int offset); + long getSize() const { return size_; } uchar* data() { return current_rom_; } const uchar* getTitle() const { return title; } - long getSize() const { return size_; } bool isLoaded() const { return is_loaded_; } auto Renderer() { return sdl_renderer_; } auto GetGraphicsBin() const { return graphics_bin_; } @@ -67,8 +65,6 @@ class ROM { uchar* master_gfx_bin_; uchar title[21] = "ROM Not Loaded"; bool is_loaded_ = false; - bool isbpp3[core::NumberOfSheets]; - enum rom_type type_ = LoROM; ImVec4 display_palette_[8];