Remove rom namespace
This commit is contained in:
@@ -12,6 +12,6 @@ int AddressFromBytes(uint8_t addr1, uint8_t addr2, uint8_t addr3);
|
|||||||
|
|
||||||
} // namespace core
|
} // namespace core
|
||||||
} // namespace app
|
} // namespace app
|
||||||
} // namespace premia
|
} // namespace yaze
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -47,7 +47,7 @@ class Editor {
|
|||||||
bool is_loaded_ = true;
|
bool is_loaded_ = true;
|
||||||
bool asm_is_loaded = false;
|
bool asm_is_loaded = false;
|
||||||
|
|
||||||
rom::ROM rom_;
|
ROM rom_;
|
||||||
gui::Canvas canvas_;
|
gui::Canvas canvas_;
|
||||||
AssemblyEditor assembly_editor_;
|
AssemblyEditor assembly_editor_;
|
||||||
OverworldEditor overworld_editor_;
|
OverworldEditor overworld_editor_;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace yaze {
|
|||||||
namespace app {
|
namespace app {
|
||||||
namespace editor {
|
namespace editor {
|
||||||
|
|
||||||
void OverworldEditor::SetupROM(rom::ROM &rom) { rom_ = rom; }
|
void OverworldEditor::SetupROM(ROM &rom) { rom_ = rom; }
|
||||||
|
|
||||||
void OverworldEditor::Update() {
|
void OverworldEditor::Update() {
|
||||||
if (rom_.isLoaded() && !all_gfx_loaded_) {
|
if (rom_.isLoaded() && !all_gfx_loaded_) {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ static constexpr unsigned int k4BPP = 4;
|
|||||||
|
|
||||||
class OverworldEditor {
|
class OverworldEditor {
|
||||||
public:
|
public:
|
||||||
void SetupROM(app::rom::ROM &rom);
|
void SetupROM(ROM &rom);
|
||||||
void Update();
|
void Update();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -31,7 +31,7 @@ class OverworldEditor {
|
|||||||
void LoadBlockset();
|
void LoadBlockset();
|
||||||
void LoadGraphics();
|
void LoadGraphics();
|
||||||
|
|
||||||
rom::ROM rom_;
|
ROM rom_;
|
||||||
|
|
||||||
zelda3::Overworld overworld_;
|
zelda3::Overworld overworld_;
|
||||||
gfx::SNESPalette palette_;
|
gfx::SNESPalette palette_;
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
namespace app {
|
namespace app {
|
||||||
namespace rom {
|
|
||||||
|
|
||||||
void ROM::Close() {
|
void ROM::Close() {
|
||||||
if (is_loaded_) {
|
if (is_loaded_) {
|
||||||
@@ -77,7 +76,7 @@ char *ROM::Decompress(int pos, int size, bool reversed) {
|
|||||||
(ushort)(((current_rom_[pos] << 8) | current_rom_[pos + 1]) & 0x3FF);
|
(ushort)(((current_rom_[pos] << 8) | current_rom_[pos + 1]) & 0x3FF);
|
||||||
pos += 2; // Advance 2 bytes in ROM
|
pos += 2; // Advance 2 bytes in ROM
|
||||||
|
|
||||||
} else { // Normal Command
|
} else { // Normal Command
|
||||||
cmd = (uchar)((databyte >> 5) & 0x07);
|
cmd = (uchar)((databyte >> 5) & 0x07);
|
||||||
length = (uchar)(databyte & 0x1F);
|
length = (uchar)(databyte & 0x1F);
|
||||||
pos += 1; // Advance 1 byte in ROM
|
pos += 1; // Advance 1 byte in ROM
|
||||||
@@ -235,8 +234,8 @@ int ROM::GetPCGfxAddress(uint8_t id) {
|
|||||||
uint8_t gfxGamePointer2 = current_rom_[gfxPtr2 + id];
|
uint8_t gfxGamePointer2 = current_rom_[gfxPtr2 + id];
|
||||||
uint8_t gfxGamePointer3 = current_rom_[gfxPtr3 + id];
|
uint8_t gfxGamePointer3 = current_rom_[gfxPtr3 + id];
|
||||||
|
|
||||||
return core::SnesToPc(
|
return core::SnesToPc(core::AddressFromBytes(gfxGamePointer1, gfxGamePointer2,
|
||||||
core::AddressFromBytes(gfxGamePointer1, gfxGamePointer2, gfxGamePointer3));
|
gfxGamePointer3));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0-112 -> compressed 3bpp bgr -> (decompressed each) 0x600 chars
|
// 0-112 -> compressed 3bpp bgr -> (decompressed each) 0x600 chars
|
||||||
@@ -281,6 +280,5 @@ char *ROM::CreateAllGfxDataRaw() {
|
|||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace rom
|
|
||||||
} // namespace app
|
} // namespace app
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
@@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
namespace app {
|
namespace app {
|
||||||
namespace rom {
|
|
||||||
|
|
||||||
class ROM {
|
class ROM {
|
||||||
public:
|
public:
|
||||||
@@ -29,7 +28,8 @@ class ROM {
|
|||||||
void LoadFromFile(const std::string& path);
|
void LoadFromFile(const std::string& path);
|
||||||
char* Decompress(int pos, int size = 0x800, bool reversed = false);
|
char* Decompress(int pos, int size = 0x800, bool reversed = false);
|
||||||
gfx::SNESPalette ExtractPalette(uint addr, int bpp);
|
gfx::SNESPalette ExtractPalette(uint addr, int bpp);
|
||||||
uchar* SNES3bppTo8bppSheet(uchar* buffer_in, int sheet_id = 0, int size = 0x1000);
|
uchar* SNES3bppTo8bppSheet(uchar* buffer_in, int sheet_id = 0,
|
||||||
|
int size = 0x1000);
|
||||||
SDL_Texture* DrawGraphicsSheet(int offset);
|
SDL_Texture* DrawGraphicsSheet(int offset);
|
||||||
|
|
||||||
int GetPCGfxAddress(uint8_t id);
|
int GetPCGfxAddress(uint8_t id);
|
||||||
@@ -59,7 +59,6 @@ class ROM {
|
|||||||
std::shared_ptr<SDL_Renderer> sdl_renderer_;
|
std::shared_ptr<SDL_Renderer> sdl_renderer_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace rom
|
|
||||||
} // namespace app
|
} // namespace app
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ static TileInfo GetTilesInfo(ushort tile) {
|
|||||||
return TileInfo(tid, p, v, h, o);
|
return TileInfo(tid, p, v, h, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Overworld::Load(app::rom::ROM& rom, uchar* allGfxPtr) {
|
void Overworld::Load(ROM& rom, uchar* allGfxPtr) {
|
||||||
rom_ = rom;
|
rom_ = rom;
|
||||||
allGfx16Ptr = allGfxPtr;
|
allGfx16Ptr = allGfxPtr;
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace zelda3 {
|
|||||||
|
|
||||||
class Overworld {
|
class Overworld {
|
||||||
public:
|
public:
|
||||||
void Load(app::rom::ROM& rom, uchar* allGfxPtr);
|
void Load(ROM& rom, uchar* allGfxPtr);
|
||||||
auto GetTiles16() const { return tiles16; }
|
auto GetTiles16() const { return tiles16; }
|
||||||
auto GetCurrentGfxSetPtr() { return currentOWgfx16Ptr; }
|
auto GetCurrentGfxSetPtr() { return currentOWgfx16Ptr; }
|
||||||
auto GetMapBlockset16Ptr() { return mapblockset16; }
|
auto GetMapBlockset16Ptr() { return mapblockset16; }
|
||||||
@@ -35,7 +35,7 @@ class Overworld {
|
|||||||
void FetchLargeMaps();
|
void FetchLargeMaps();
|
||||||
void LoadOverworldMap();
|
void LoadOverworldMap();
|
||||||
|
|
||||||
app::rom::ROM rom_;
|
ROM rom_;
|
||||||
int gameState = 1;
|
int gameState = 1;
|
||||||
bool isLoaded = false;
|
bool isLoaded = false;
|
||||||
uchar mapParent[160];
|
uchar mapParent[160];
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ namespace zelda3 {
|
|||||||
using namespace core;
|
using namespace core;
|
||||||
using namespace gfx;
|
using namespace gfx;
|
||||||
|
|
||||||
OverworldMap::OverworldMap(app::rom::ROM& rom,
|
OverworldMap::OverworldMap(ROM& rom, const std::vector<gfx::Tile16>& tiles16,
|
||||||
const std::vector<gfx::Tile16>& tiles16, int index_)
|
int index_)
|
||||||
: parent_(index_), index_(index_), rom_(rom), tiles16_(tiles16) {
|
: parent_(index_), index_(index_), rom_(rom), tiles16_(tiles16) {
|
||||||
if (index_ != 0x80 && index_ <= 150 &&
|
if (index_ != 0x80 && index_ <= 150 &&
|
||||||
rom_.data()[constants::overworldMapSize + (index_ & 0x3F)] != 0) {
|
rom_.data()[constants::overworldMapSize + (index_ & 0x3F)] != 0) {
|
||||||
|
|||||||
@@ -30,14 +30,14 @@ class OverworldMap {
|
|||||||
uchar* currentOWgfx16Ptr_ = nullptr;
|
uchar* currentOWgfx16Ptr_ = nullptr;
|
||||||
uchar* allGfx16Ptr_ = nullptr;
|
uchar* allGfx16Ptr_ = nullptr;
|
||||||
|
|
||||||
app::rom::ROM rom_;
|
ROM rom_;
|
||||||
gfx::Bitmap gfxBitmap;
|
gfx::Bitmap gfxBitmap;
|
||||||
std::vector<gfx::Tile16> tiles16_;
|
std::vector<gfx::Tile16> tiles16_;
|
||||||
|
|
||||||
uchar* staticgfx = new uchar[16];
|
uchar* staticgfx = new uchar[16];
|
||||||
std::vector<std::vector<ushort>> tiles_used_;
|
std::vector<std::vector<ushort>> tiles_used_;
|
||||||
|
|
||||||
OverworldMap(app::rom::ROM& rom, const std::vector<gfx::Tile16>& tiles16,
|
OverworldMap(ROM& rom, const std::vector<gfx::Tile16>& tiles16,
|
||||||
int index);
|
int index);
|
||||||
void BuildMap(uchar* mapParent, int count, int gameState,
|
void BuildMap(uchar* mapParent, int count, int gameState,
|
||||||
std::vector<std::vector<ushort>>& allmapsTilesLW,
|
std::vector<std::vector<ushort>>& allmapsTilesLW,
|
||||||
|
|||||||
Reference in New Issue
Block a user