Change gfx groups from vectors to arrays in Rom
This commit is contained in:
@@ -27,7 +27,6 @@ namespace app {
|
||||
|
||||
using core::Renderer;
|
||||
constexpr int Uncompressed3BPPSize = 0x0600;
|
||||
constexpr int kEntranceGfxGroup = 0x5D97;
|
||||
|
||||
namespace {
|
||||
int GetGraphicsAddress(const uchar *data, uint8_t addr, uint32_t ptr1,
|
||||
@@ -142,7 +141,6 @@ absl::Status Rom::LoadFromFile(const std::string &filename, bool z3_load) {
|
||||
std::string full_filename = std::filesystem::absolute(filename).string();
|
||||
filename_ = full_filename;
|
||||
|
||||
// Open file
|
||||
std::ifstream file(filename_, std::ios::binary);
|
||||
if (!file.is_open()) {
|
||||
return absl::NotFoundError(
|
||||
@@ -165,8 +163,6 @@ absl::Status Rom::LoadFromFile(const std::string &filename, bool z3_load) {
|
||||
|
||||
// Read file into rom_data_
|
||||
file.read(reinterpret_cast<char *>(rom_data_.data()), size_);
|
||||
|
||||
// Close file
|
||||
file.close();
|
||||
|
||||
// Set is_loaded_ flag and return success
|
||||
@@ -179,7 +175,6 @@ absl::Status Rom::LoadFromFile(const std::string &filename, bool z3_load) {
|
||||
// Set up the resource labels
|
||||
std::string resource_label_filename = absl::StrFormat("%s.labels", filename);
|
||||
resource_label_manager_.LoadLabels(resource_label_filename);
|
||||
|
||||
return absl::OkStatus();
|
||||
}
|
||||
|
||||
@@ -226,6 +221,7 @@ absl::Status Rom::LoadZelda3() {
|
||||
|
||||
// Load additional resources
|
||||
RETURN_IF_ERROR(gfx::LoadAllPalettes(rom_data_, palette_groups_));
|
||||
// TODO Load gfx groups or expanded ZS values
|
||||
RETURN_IF_ERROR(LoadGfxGroups());
|
||||
|
||||
// Expand the ROM data to 2MB without changing the data in the first 1MB
|
||||
@@ -373,11 +369,6 @@ absl::Status Rom::SaveAllPalettes() {
|
||||
}
|
||||
|
||||
absl::Status Rom::LoadGfxGroups() {
|
||||
main_blockset_ids.resize(kNumMainBlocksets, std::vector<uint8_t>(8));
|
||||
room_blockset_ids.resize(kNumRoomBlocksets, std::vector<uint8_t>(4));
|
||||
spriteset_ids.resize(kNumSpritesets, std::vector<uint8_t>(4));
|
||||
paletteset_ids.resize(kNumPalettesets, std::vector<uint8_t>(4));
|
||||
|
||||
ASSIGN_OR_RETURN(auto main_blockset_ptr, ReadWord(kGfxGroupsPointer));
|
||||
main_blockset_ptr = core::SnesToPc(main_blockset_ptr);
|
||||
|
||||
|
||||
@@ -120,11 +120,12 @@ constexpr uint32_t kNormalGfxSpaceStart = 0x87000;
|
||||
constexpr uint32_t kNormalGfxSpaceEnd = 0xC4200;
|
||||
constexpr uint32_t kFontSpriteLocation = 0x70000;
|
||||
constexpr uint32_t kGfxGroupsPointer = 0x6237;
|
||||
constexpr uint32_t kUncompressedSheetSize = 0x0800;
|
||||
constexpr uint32_t kNumMainBlocksets = 37;
|
||||
constexpr uint32_t kNumRoomBlocksets = 82;
|
||||
constexpr uint32_t kNumSpritesets = 144;
|
||||
constexpr uint32_t kNumPalettesets = 72;
|
||||
constexpr uint32_t kUncompressedSheetSize = 0x0800;
|
||||
constexpr uint32_t kEntranceGfxGroup = 0x5D97;
|
||||
|
||||
// TODO: Verify what this was used for in ZS
|
||||
constexpr uint32_t kMaxGraphics = 0xC3FB5;
|
||||
@@ -482,10 +483,10 @@ class Rom : public core::ExperimentFlags {
|
||||
return kVersionConstantsMap.at(version_);
|
||||
}
|
||||
|
||||
std::vector<std::vector<uint8_t>> main_blockset_ids;
|
||||
std::vector<std::vector<uint8_t>> room_blockset_ids;
|
||||
std::vector<std::vector<uint8_t>> spriteset_ids;
|
||||
std::vector<std::vector<uint8_t>> paletteset_ids;
|
||||
std::array<std::array<uint8_t, 8>, kNumMainBlocksets> main_blockset_ids;
|
||||
std::array<std::array<uint8_t, 4>, kNumRoomBlocksets> room_blockset_ids;
|
||||
std::array<std::array<uint8_t, 4>, kNumSpritesets> spriteset_ids;
|
||||
std::array<std::array<uint8_t, 4>, kNumPalettesets> paletteset_ids;
|
||||
|
||||
struct WriteAction {
|
||||
int address;
|
||||
|
||||
Reference in New Issue
Block a user