Update ROM references with new operators
This commit is contained in:
@@ -190,7 +190,7 @@ void MasterEditor::DrawViewMenu() {
|
|||||||
|
|
||||||
if (show_memory_editor) {
|
if (show_memory_editor) {
|
||||||
static MemoryEditor mem_edit;
|
static MemoryEditor mem_edit;
|
||||||
mem_edit.DrawWindow("Memory Editor", (void *)rom_.data(), rom_.GetSize());
|
mem_edit.DrawWindow("Memory Editor", (void *)&rom_, rom_.GetSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (show_imgui_demo) {
|
if (show_imgui_demo) {
|
||||||
|
|||||||
@@ -55,41 +55,41 @@ void Overworld::AssembleMap32Tiles() {
|
|||||||
tiles32.push_back(gfx::Tile32(tl, tr, bl, br));
|
tiles32.push_back(gfx::Tile32(tl, tr, bl, br));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
map_tiles_.light_world.resize(kTile32Num);
|
||||||
map_tiles_.light_world.resize(tiles32.size());
|
map_tiles_.dark_world.resize(kTile32Num);
|
||||||
map_tiles_.dark_world.resize(tiles32.size());
|
map_tiles_.special_world.resize(kTile32Num);
|
||||||
map_tiles_.special_world.resize(tiles32.size());
|
for (int i = 0; i < kTile32Num; i++) {
|
||||||
for (int i = 0; i < tiles32.size(); i++) {
|
map_tiles_.light_world[i].resize(kTile32Num);
|
||||||
map_tiles_.light_world[i].resize(tiles32.size());
|
map_tiles_.dark_world[i].resize(kTile32Num);
|
||||||
map_tiles_.dark_world[i].resize(tiles32.size());
|
map_tiles_.special_world[i].resize(kTile32Num);
|
||||||
map_tiles_.special_world[i].resize(tiles32.size());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Overworld::AssembleMap16Tiles() {
|
void Overworld::AssembleMap16Tiles() {
|
||||||
int tpos = core::map16Tiles;
|
int tpos = core::map16Tiles;
|
||||||
auto rom_data = rom_.data();
|
for (int i = 0; i < 4096; i += 1) {
|
||||||
for (int i = 0; i < 4096; i += 1) // 3760
|
auto t0 = gfx::GetTilesInfo((uintptr_t)(rom_ + tpos));
|
||||||
{
|
|
||||||
gfx::TileInfo t0 = gfx::GetTilesInfo((uintptr_t)(rom_data + tpos));
|
|
||||||
tpos += 2;
|
tpos += 2;
|
||||||
gfx::TileInfo t1 = gfx::GetTilesInfo((uintptr_t)(rom_data + tpos));
|
auto t1 = gfx::GetTilesInfo((uintptr_t)(rom_ + tpos));
|
||||||
tpos += 2;
|
tpos += 2;
|
||||||
gfx::TileInfo t2 = gfx::GetTilesInfo((uintptr_t)(rom_data + tpos));
|
auto t2 = gfx::GetTilesInfo((uintptr_t)(rom_ + tpos));
|
||||||
tpos += 2;
|
tpos += 2;
|
||||||
gfx::TileInfo t3 = gfx::GetTilesInfo((uintptr_t)(rom_data + tpos));
|
auto t3 = gfx::GetTilesInfo((uintptr_t)(rom_ + tpos));
|
||||||
tpos += 2;
|
tpos += 2;
|
||||||
tiles16.emplace_back(t0, t1, t2, t3);
|
tiles16.emplace_back(t0, t1, t2, t3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Overworld::AssignWorldTiles(std::vector<std::vector<ushort>> &world, int x,
|
void Overworld::AssignWorldTiles(OWBlockset &world, int x, int y, int sx,
|
||||||
int y, int sx, int sy, int tpos) {
|
int sy, int tpos) {
|
||||||
world[(x * 2) + (sx * 32)][(y * 2) + (sy * 32)] = tiles32[tpos].tile0_;
|
int position_x1 = (x * 2) + (sx * 32);
|
||||||
world[(x * 2) + 1 + (sx * 32)][(y * 2) + (sy * 32)] = tiles32[tpos].tile1_;
|
int position_y1 = (y * 2) + (sy * 32);
|
||||||
world[(x * 2) + (sx * 32)][(y * 2) + 1 + (sy * 32)] = tiles32[tpos].tile2_;
|
int position_x2 = (x * 2) + 1 + (sx * 32);
|
||||||
world[(x * 2) + 1 + (sx * 32)][(y * 2) + 1 + (sy * 32)] =
|
int position_y2 = (y * 2) + 1 + (sy * 32);
|
||||||
tiles32[tpos].tile3_;
|
world[position_x1][position_y1] = tiles32[tpos].tile0_;
|
||||||
|
world[position_x2][position_y1] = tiles32[tpos].tile1_;
|
||||||
|
world[position_x1][position_y2] = tiles32[tpos].tile2_;
|
||||||
|
world[position_x2][position_y2] = tiles32[tpos].tile3_;
|
||||||
}
|
}
|
||||||
|
|
||||||
absl::Status Overworld::DecompressAllMapTiles() {
|
absl::Status Overworld::DecompressAllMapTiles() {
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ class Overworld {
|
|||||||
ushort GenerateTile32(int i, int k, int dimension);
|
ushort GenerateTile32(int i, int k, int dimension);
|
||||||
void AssembleMap32Tiles();
|
void AssembleMap32Tiles();
|
||||||
void AssembleMap16Tiles();
|
void AssembleMap16Tiles();
|
||||||
void AssignWorldTiles(std::vector<std::vector<ushort>> &world, int x, int y,
|
void AssignWorldTiles(OWBlockset &world, int x, int y, int sx, int sy,
|
||||||
int sx, int sy, int tpos);
|
int tpos);
|
||||||
absl::Status DecompressAllMapTiles();
|
absl::Status DecompressAllMapTiles();
|
||||||
void FetchLargeMaps();
|
void FetchLargeMaps();
|
||||||
|
|
||||||
|
|||||||
@@ -108,15 +108,14 @@ void OverworldMap::BuildMap(int count, int game_state, uchar* map_parent,
|
|||||||
parent_ = map_parent[index_];
|
parent_ = map_parent[index_];
|
||||||
if (parent_ != index_ && !initialized_) {
|
if (parent_ != index_ && !initialized_) {
|
||||||
if (index_ >= 0x80 && index_ <= 0x8A && index_ != 0x88) {
|
if (index_ >= 0x80 && index_ <= 0x8A && index_ != 0x88) {
|
||||||
area_graphics_ =
|
area_graphics_ = rom_[core::overworldSpecialGFXGroup + (parent_ - 128)];
|
||||||
rom_.data()[core::overworldSpecialGFXGroup + (parent_ - 128)];
|
area_palette_ = rom_[core::overworldSpecialPALGroup + 1];
|
||||||
area_palette_ = rom_.data()[core::overworldSpecialPALGroup + 1];
|
|
||||||
} else if (index_ == 0x88) {
|
} else if (index_ == 0x88) {
|
||||||
area_graphics_ = 81;
|
area_graphics_ = 81;
|
||||||
area_palette_ = 0;
|
area_palette_ = 0;
|
||||||
} else {
|
} else {
|
||||||
area_graphics_ = rom_.data()[core::mapGfx + parent_];
|
area_graphics_ = rom_[core::mapGfx + parent_];
|
||||||
area_palette_ = rom_.data()[core::overworldMapPalette + parent_];
|
area_palette_ = rom_[core::overworldMapPalette + parent_];
|
||||||
}
|
}
|
||||||
|
|
||||||
initialized_ = true;
|
initialized_ = true;
|
||||||
@@ -200,33 +199,31 @@ absl::Status OverworldMap::BuildTileset(int game_state) {
|
|||||||
static_graphics_[10] = 115 + 6;
|
static_graphics_[10] = 115 + 6;
|
||||||
static_graphics_[11] = 115 + 7;
|
static_graphics_[11] = 115 + 7;
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
static_graphics_[12 + i] =
|
static_graphics_[12 + i] = (rom_[core::kSpriteBlocksetPointer +
|
||||||
(rom_.data()[core::kSpriteBlocksetPointer +
|
(sprite_graphics_[game_state] * 4) + i] +
|
||||||
(sprite_graphics_[game_state] * 4) + i] +
|
115);
|
||||||
115);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Main Blocksets
|
// Main Blocksets
|
||||||
for (int i = 0; i < 8; i++) {
|
for (int i = 0; i < 8; i++) {
|
||||||
static_graphics_[i] =
|
static_graphics_[i] =
|
||||||
rom_.data()[core::overworldgfxGroups2 + (index_world * 8) + i];
|
rom_[core::overworldgfxGroups2 + (index_world * 8) + i];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rom_.data()[core::overworldgfxGroups + (area_graphics_ * 4)] != 0) {
|
if (rom_[core::overworldgfxGroups + (area_graphics_ * 4)] != 0) {
|
||||||
static_graphics_[3] =
|
static_graphics_[3] = rom_[core::overworldgfxGroups + (area_graphics_ * 4)];
|
||||||
rom_.data()[core::overworldgfxGroups + (area_graphics_ * 4)];
|
|
||||||
}
|
}
|
||||||
if (rom_.data()[core::overworldgfxGroups + (area_graphics_ * 4) + 1] != 0) {
|
if (rom_[core::overworldgfxGroups + (area_graphics_ * 4) + 1] != 0) {
|
||||||
static_graphics_[4] =
|
static_graphics_[4] =
|
||||||
rom_.data()[core::overworldgfxGroups + (area_graphics_ * 4) + 1];
|
rom_[core::overworldgfxGroups + (area_graphics_ * 4) + 1];
|
||||||
}
|
}
|
||||||
if (rom_.data()[core::overworldgfxGroups + (area_graphics_ * 4) + 2] != 0) {
|
if (rom_[core::overworldgfxGroups + (area_graphics_ * 4) + 2] != 0) {
|
||||||
static_graphics_[5] =
|
static_graphics_[5] =
|
||||||
rom_.data()[core::overworldgfxGroups + (area_graphics_ * 4) + 2];
|
rom_[core::overworldgfxGroups + (area_graphics_ * 4) + 2];
|
||||||
}
|
}
|
||||||
if (rom_.data()[core::overworldgfxGroups + (area_graphics_ * 4) + 3] != 0) {
|
if (rom_[core::overworldgfxGroups + (area_graphics_ * 4) + 3] != 0) {
|
||||||
static_graphics_[6] =
|
static_graphics_[6] =
|
||||||
rom_.data()[core::overworldgfxGroups + (area_graphics_ * 4) + 3];
|
rom_[core::overworldgfxGroups + (area_graphics_ * 4) + 3];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hardcoded overworld GFX Values, for death mountain
|
// Hardcoded overworld GFX Values, for death mountain
|
||||||
@@ -249,7 +246,7 @@ absl::Status OverworldMap::BuildTileset(int game_state) {
|
|||||||
|
|
||||||
void OverworldMap::BuildTiles16Gfx(int count, uchar* ow_blockset) {
|
void OverworldMap::BuildTiles16Gfx(int count, uchar* ow_blockset) {
|
||||||
auto gfx_tile16_data = ow_blockset;
|
auto gfx_tile16_data = ow_blockset;
|
||||||
auto gfx_tile8_data = rom_.GetMasterGraphicsBin();
|
auto gfx_tile8_data = nullptr; // rom_.GetMasterGraphicsBin();
|
||||||
|
|
||||||
int offsets[] = {0, 8, 1024, 1032};
|
int offsets[] = {0, 8, 1024, 1032};
|
||||||
auto yy = 0;
|
auto yy = 0;
|
||||||
@@ -281,7 +278,7 @@ void OverworldMap::BuildTiles16Gfx(int count, uchar* ow_blockset) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
absl::Status OverworldMap::BuildTiles16GfxV2(int count) {
|
absl::Status OverworldMap::BuildTiles16GfxV2(int count) {
|
||||||
auto gfx_tile8_data = rom_.GetMasterGraphicsBin();
|
auto gfx_tile8_data = nullptr; // rom_.GetMasterGraphicsBin();
|
||||||
|
|
||||||
int offsets[] = {0, 8, 1024, 1032};
|
int offsets[] = {0, 8, 1024, 1032};
|
||||||
auto yy = 0;
|
auto yy = 0;
|
||||||
@@ -382,26 +379,6 @@ void OverworldMap::CopyTileToMap(int x, int y, int xx, int yy, int offset,
|
|||||||
gfx16Pointer[index + r] = (uchar)(((pixel >> 4) & 0x0F) + tile.palette_ * 16);
|
gfx16Pointer[index + r] = (uchar)(((pixel >> 4) & 0x0F) + tile.palette_ * 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverworldMap::CopyTile8bpp16From8(int xP, int yP, int tileID,
|
|
||||||
uchar* current_gfx) {
|
|
||||||
auto gfx_tile16_data = rom_.GetMasterGraphicsBin();
|
|
||||||
auto gfx_tile8_data = current_gfx;
|
|
||||||
|
|
||||||
auto tiles = tiles16_[tileID];
|
|
||||||
|
|
||||||
for (auto tile = 0; tile < 4; tile++) {
|
|
||||||
gfx::TileInfo info = tiles.tiles_info[tile];
|
|
||||||
int offset = kTileOffsets[tile];
|
|
||||||
|
|
||||||
for (auto y = 0; y < 8; y++) {
|
|
||||||
for (auto x = 0; x < 4; x++) {
|
|
||||||
CopyTileToMap(x, y, xP, yP, offset, info, gfx_tile16_data,
|
|
||||||
gfx_tile8_data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace zelda3
|
} // namespace zelda3
|
||||||
} // namespace app
|
} // namespace app
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
@@ -48,7 +48,7 @@ void Screen::BuildTileset() {
|
|||||||
uchar* currentmapgfx8Data = tiles8Bitmap.GetData();
|
uchar* currentmapgfx8Data = tiles8Bitmap.GetData();
|
||||||
|
|
||||||
// All gfx of the game pack of 2048 bytes (4bpp)
|
// All gfx of the game pack of 2048 bytes (4bpp)
|
||||||
uchar* allgfxData = rom_.GetMasterGraphicsBin();
|
uchar* allgfxData = nullptr; // rom_.GetMasterGraphicsBin();
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
for (int j = 0; j < 2048; j++) {
|
for (int j = 0; j < 2048; j++) {
|
||||||
uchar mapByte = allgfxData[j + (staticgfx[i] * 2048)];
|
uchar mapByte = allgfxData[j + (staticgfx[i] * 2048)];
|
||||||
@@ -67,8 +67,8 @@ void Screen::BuildTileset() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Screen::LoadTitleScreen() {
|
void Screen::LoadTitleScreen() {
|
||||||
int pos = (rom_.data()[0x138C + 3] << 16) + (rom_.data()[0x1383 + 3] << 8) +
|
int pos =
|
||||||
rom_.data()[0x137A + 3];
|
(rom_[0x138C + 3] << 16) + (rom_[0x1383 + 3] << 8) + rom_[0x137A + 3];
|
||||||
|
|
||||||
for (int i = 0; i < 1024; i++) {
|
for (int i = 0; i < 1024; i++) {
|
||||||
tilesBG1Buffer[i] = 492;
|
tilesBG1Buffer[i] = 492;
|
||||||
@@ -77,7 +77,7 @@ void Screen::LoadTitleScreen() {
|
|||||||
|
|
||||||
pos = core::SnesToPc(pos);
|
pos = core::SnesToPc(pos);
|
||||||
|
|
||||||
while ((rom_.data()[pos] & 0x80) != 0x80) {
|
while ((rom_[pos] & 0x80) != 0x80) {
|
||||||
int dest_addr = pos; // $03 and $04
|
int dest_addr = pos; // $03 and $04
|
||||||
pos += 2;
|
pos += 2;
|
||||||
short length = pos;
|
short length = pos;
|
||||||
|
|||||||
Reference in New Issue
Block a user