housekeeping
This commit is contained in:
@@ -38,11 +38,11 @@ add_executable(
|
||||
gui/editor/overworld_editor.cc
|
||||
app/rom.cc
|
||||
app/core/controller.cc
|
||||
app/zelda3/overworld.cc
|
||||
app/zelda3/overworld_map.cc
|
||||
app/gfx/bitmap.cc
|
||||
app/gfx/tile.cc
|
||||
app/gfx/palette.cc
|
||||
app/zelda3/overworld.cc
|
||||
app/zelda3/overworld_map.cc
|
||||
# GUI libraries
|
||||
${IMGUI_PATH}/imgui.cpp
|
||||
${IMGUI_PATH}/imgui_demo.cpp
|
||||
@@ -67,6 +67,7 @@ target_include_directories(
|
||||
/
|
||||
Library/
|
||||
app/
|
||||
gui/
|
||||
"C:/msys64/mingw64/include/libpng16"
|
||||
"C:/msys64/mingw64/include/SDL2"
|
||||
"C:/msys64/mingw64/include"
|
||||
|
||||
@@ -43,7 +43,7 @@ class Controller {
|
||||
};
|
||||
|
||||
bool active_;
|
||||
Editor::Editor editor_;
|
||||
gui::editor::Editor editor_;
|
||||
std::shared_ptr<SDL_Window> sdl_window_;
|
||||
std::shared_ptr<SDL_Renderer> sdl_renderer_;
|
||||
};
|
||||
|
||||
@@ -28,7 +28,7 @@ int GetPCGfxAddress(char *romData, char id) {
|
||||
char gfxGamePointer3 = romData[gfxPointer3 + id];
|
||||
|
||||
return lorom_snes_to_pc(
|
||||
Data::AddressFromBytes(gfxGamePointer1, gfxGamePointer2, gfxGamePointer3),
|
||||
AddressFromBytes(gfxGamePointer1, gfxGamePointer2, gfxGamePointer3),
|
||||
info1);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "tile.h"
|
||||
|
||||
#include <tile.h>
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
@@ -7,6 +9,12 @@
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <regex>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "app/core/constants.h"
|
||||
#include "app/gfx/palette.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
|
||||
@@ -1,15 +1,21 @@
|
||||
#ifndef YAZE_APP_DATA_TILE_H
|
||||
#define YAZE_APP_DATA_TILE_H
|
||||
#ifndef YAZE_APP_GFX_TILE_H
|
||||
#define YAZE_APP_GFX_TILE_H
|
||||
|
||||
#include <tile.h>
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <regex>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "Core/constants.h"
|
||||
#include "gfx/palette.h"
|
||||
#include "app/core/constants.h"
|
||||
#include "app/gfx/palette.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
@@ -100,4 +106,4 @@ class TilePreset {
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
#endif
|
||||
#endif // YAZE_APP_GFX_TILE_H
|
||||
@@ -1,12 +1,27 @@
|
||||
#include "rom.h"
|
||||
|
||||
#include <filesystem>
|
||||
#include <compressions/alttpcompression.h>
|
||||
#include <rommapping.h>
|
||||
#include <tile.h>
|
||||
|
||||
#include "Core/constants.h"
|
||||
#include <cstddef>
|
||||
#include <cstring>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "app/core/constants.h"
|
||||
#include "app/gfx/tile.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace Data {
|
||||
|
||||
int AddressFromBytes(uchar addr1, uchar addr2, uchar addr3) {
|
||||
return (addr1 << 16) | (addr2 << 8) | addr3;
|
||||
}
|
||||
|
||||
ROM::~ROM() {
|
||||
if (loaded) {
|
||||
@@ -287,10 +302,5 @@ SDL_Texture *ROM::DrawgfxSheet(int offset) {
|
||||
return sheet_texture;
|
||||
}
|
||||
|
||||
int AddressFromBytes(uchar addr1, uchar addr2, uchar addr3) {
|
||||
return (addr1 << 16) | (addr2 << 8) | addr3;
|
||||
}
|
||||
|
||||
} // namespace Data
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
@@ -7,18 +7,18 @@
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstring>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "Core/constants.h"
|
||||
#include "gfx/tile.h"
|
||||
#include "app/core/constants.h"
|
||||
#include "app/gfx/tile.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace Data {
|
||||
|
||||
int AddressFromBytes(uchar addr1, uchar addr2, uchar addr3);
|
||||
|
||||
@@ -52,13 +52,13 @@ class ROM {
|
||||
private:
|
||||
bool loaded = false;
|
||||
bool has_header_ = false;
|
||||
uchar* current_rom_;
|
||||
uchar version_;
|
||||
uchar title[21] = "ROM Not Loaded";
|
||||
long int size_;
|
||||
uint uncompressed_size_;
|
||||
uint compressed_size_;
|
||||
uint compress_size_;
|
||||
long int size_;
|
||||
uchar* current_rom_;
|
||||
uchar version_;
|
||||
uchar title[21] = "ROM Not Loaded";
|
||||
enum rom_type type_ = LoROM;
|
||||
|
||||
std::shared_ptr<uchar> rom_ptr_;
|
||||
@@ -68,7 +68,6 @@ class ROM {
|
||||
std::shared_ptr<SDL_Renderer> sdl_renderer_;
|
||||
};
|
||||
|
||||
} // namespace Data
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ static TileInfo GetTilesInfo(ushort tile) {
|
||||
return TileInfo(tid, p, v, h, o);
|
||||
}
|
||||
|
||||
void Overworld::Load(Data::ROM& rom) {
|
||||
void Overworld::Load(ROM& rom) {
|
||||
rom_ = rom;
|
||||
for (int i = 0; i < 0x2B; i++) {
|
||||
tileLeftEntrance.push_back(constants::overworldEntranceAllowedTilesLeft +
|
||||
|
||||
@@ -21,7 +21,7 @@ class Overworld {
|
||||
Overworld() = default;
|
||||
~Overworld();
|
||||
|
||||
void Load(Data::ROM& rom);
|
||||
void Load(ROM& rom);
|
||||
|
||||
char* overworldMapPointer = new char[0x40000];
|
||||
gfx::Bitmap* overworldMapBitmap;
|
||||
@@ -30,7 +30,7 @@ class Overworld {
|
||||
gfx::Bitmap* owactualMapBitmap;
|
||||
|
||||
private:
|
||||
Data::ROM rom_;
|
||||
ROM rom_;
|
||||
int gameState = 1;
|
||||
bool isLoaded = false;
|
||||
uchar mapParent[160];
|
||||
|
||||
@@ -10,8 +10,8 @@ namespace zelda3 {
|
||||
using namespace core;
|
||||
using namespace gfx;
|
||||
|
||||
OverworldMap::OverworldMap(Data::ROM& rom,
|
||||
const std::vector<gfx::Tile16> tiles16, uchar index)
|
||||
OverworldMap::OverworldMap(ROM& rom, const std::vector<gfx::Tile16> tiles16,
|
||||
uchar index)
|
||||
: rom_(rom), index(index), tiles16_(tiles16), parent(index) {
|
||||
if (index != 0x80) {
|
||||
if (index <= 150) {
|
||||
|
||||
@@ -37,13 +37,12 @@ class OverworldMap {
|
||||
ushort** tilesUsed;
|
||||
|
||||
bool needRefresh = false;
|
||||
Data::ROM rom_;
|
||||
ROM rom_;
|
||||
|
||||
uchar* currentOWgfx16Ptr = new uchar[(128 * 512) / 2];
|
||||
std::vector<gfx::Tile16> tiles16_;
|
||||
|
||||
OverworldMap(Data::ROM& rom, const std::vector<gfx::Tile16> tiles16,
|
||||
uchar index);
|
||||
OverworldMap(ROM& rom, const std::vector<gfx::Tile16> tiles16, uchar index);
|
||||
void BuildMap(uchar* mapParent, int count, int gameState,
|
||||
ushort** allmapsTilesLW, ushort** allmapsTilesDW,
|
||||
ushort** allmapsTilesSP);
|
||||
|
||||
@@ -15,16 +15,14 @@
|
||||
#include "rom.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace Editor {
|
||||
|
||||
using namespace core;
|
||||
namespace gui {
|
||||
namespace editor {
|
||||
|
||||
Editor::Editor() {
|
||||
for (auto &k : core::constants::kKeywords)
|
||||
for (auto &k : app::core::constants::kKeywords)
|
||||
language_65816_.mKeywords.emplace(k);
|
||||
|
||||
for (auto &k : core::constants::kIdentifiers) {
|
||||
for (auto &k : app::core::constants::kIdentifiers) {
|
||||
TextEditor::Identifier id;
|
||||
id.mDeclaration = "Built-in function";
|
||||
language_65816_.mIdentifiers.insert(std::make_pair(std::string(k), id));
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
#include "rom.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace Editor {
|
||||
namespace gui {
|
||||
namespace editor {
|
||||
|
||||
class Editor {
|
||||
public:
|
||||
@@ -45,20 +45,18 @@ class Editor {
|
||||
void *rom_data_;
|
||||
bool is_loaded_ = true;
|
||||
|
||||
std::vector<tile8> tiles_;
|
||||
std::vector<std::vector<tile8>> arranged_tiles_;
|
||||
std::unordered_map<unsigned int, std::shared_ptr<SDL_Texture>> texture_cache_;
|
||||
std::unordered_map<unsigned int, SDL_Texture *> imagesCache;
|
||||
|
||||
std::shared_ptr<SDL_Renderer> sdl_renderer_;
|
||||
|
||||
Data::ROM rom_;
|
||||
app::ROM rom_;
|
||||
TextEditor asm_editor_;
|
||||
TextEditor::LanguageDefinition language_65816_;
|
||||
OverworldEditor overworld_editor_;
|
||||
|
||||
std::vector<tile8> tiles_;
|
||||
std::vector<std::vector<tile8>> arranged_tiles_;
|
||||
std::unordered_map<uint, SDL_Texture *> imagesCache;
|
||||
std::shared_ptr<SDL_Renderer> sdl_renderer_;
|
||||
|
||||
ImVec4 current_palette_[8];
|
||||
gfx::TilePreset current_set_;
|
||||
app::gfx::TilePreset current_set_;
|
||||
|
||||
ImGuiWindowFlags main_editor_flags_ =
|
||||
ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse |
|
||||
@@ -67,7 +65,7 @@ class Editor {
|
||||
ImGuiTableFlags toolset_table_flags_ = ImGuiTableFlags_SizingFixedFit;
|
||||
};
|
||||
|
||||
} // namespace Editor
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
|
||||
@@ -28,10 +28,10 @@
|
||||
// have an overworld map viewer, in less than few hours if are able to
|
||||
// understand the data quickly
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace Editor {
|
||||
namespace gui {
|
||||
namespace editor {
|
||||
|
||||
void OverworldEditor::SetupROM(Data::ROM &rom) { rom_ = rom; }
|
||||
void OverworldEditor::SetupROM(app::ROM &rom) { rom_ = rom; }
|
||||
|
||||
void OverworldEditor::Update() {
|
||||
if (rom_.isLoaded()) {
|
||||
|
||||
@@ -3,21 +3,20 @@
|
||||
|
||||
#include <imgui/imgui.h>
|
||||
|
||||
#include "zelda3/overworld.h"
|
||||
#include "gfx/palette.h"
|
||||
#include "gfx/tile.h"
|
||||
#include "gui/icons.h"
|
||||
|
||||
#include "zelda3/overworld.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace Editor {
|
||||
namespace gui {
|
||||
namespace editor {
|
||||
|
||||
static constexpr unsigned int k4BPP = 4;
|
||||
|
||||
class OverworldEditor {
|
||||
public:
|
||||
void SetupROM(Data::ROM &rom);
|
||||
void SetupROM(app::ROM &rom);
|
||||
void Update();
|
||||
|
||||
private:
|
||||
@@ -30,11 +29,11 @@ class OverworldEditor {
|
||||
|
||||
void Loadgfx();
|
||||
|
||||
Data::ROM rom_;
|
||||
Data::Overworld overworld_;
|
||||
gfx::Bitmap allgfxBitmap;
|
||||
gfx::SNESPalette palette_;
|
||||
gfx::TilePreset current_set_;
|
||||
app::ROM rom_;
|
||||
app::zelda3::Overworld overworld_;
|
||||
app::gfx::Bitmap allgfxBitmap;
|
||||
app::gfx::SNESPalette palette_;
|
||||
app::gfx::TilePreset current_set_;
|
||||
std::unordered_map<unsigned int, SDL_Texture *> all_texture_sheet_;
|
||||
|
||||
SDL_Texture *gfx_texture = nullptr;
|
||||
@@ -72,8 +71,8 @@ class OverworldEditor {
|
||||
ImGuiTableFlags_Resizable |
|
||||
ImGuiTableFlags_SizingStretchSame;
|
||||
};
|
||||
} // namespace Editor
|
||||
} // namespace app
|
||||
} // namespace editor
|
||||
} // namespace gui
|
||||
} // namespace yaze
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user