housekeeping
This commit is contained in:
@@ -28,6 +28,7 @@ namespace constants {
|
|||||||
//===========================================================================================
|
//===========================================================================================
|
||||||
// 65816 LanguageDefinition
|
// 65816 LanguageDefinition
|
||||||
//===========================================================================================
|
//===========================================================================================
|
||||||
|
|
||||||
static const char *const kKeywords[] = {
|
static const char *const kKeywords[] = {
|
||||||
"ADC", "AND", "ASL", "BCC", "BCS", "BEQ", "BIT", "BMI", "BNE",
|
"ADC", "AND", "ASL", "BCC", "BCS", "BEQ", "BIT", "BMI", "BNE",
|
||||||
"BPL", "BRA", "BRL", "BVC", "BVS", "CLC", "CLD", "CLI", "CLV",
|
"BPL", "BRA", "BRL", "BVC", "BVS", "CLC", "CLD", "CLI", "CLV",
|
||||||
|
|||||||
@@ -71,7 +71,6 @@ void Controller::onInput() {
|
|||||||
case SDL_WINDOWEVENT:
|
case SDL_WINDOWEVENT:
|
||||||
switch (event.window.event) {
|
switch (event.window.event) {
|
||||||
case SDL_WINDOWEVENT_CLOSE:
|
case SDL_WINDOWEVENT_CLOSE:
|
||||||
editor_.Shutdown();
|
|
||||||
quit();
|
quit();
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_SIZE_CHANGED:
|
case SDL_WINDOWEVENT_SIZE_CHANGED:
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class Controller {
|
|||||||
};
|
};
|
||||||
|
|
||||||
bool active_;
|
bool active_;
|
||||||
gui::editor::Editor editor_;
|
app::editor::Editor editor_;
|
||||||
std::shared_ptr<SDL_Window> sdl_window_;
|
std::shared_ptr<SDL_Window> sdl_window_;
|
||||||
std::shared_ptr<SDL_Renderer> sdl_renderer_;
|
std::shared_ptr<SDL_Renderer> sdl_renderer_;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
#include "gui/input.h"
|
#include "gui/input.h"
|
||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
namespace gui {
|
namespace app {
|
||||||
namespace editor {
|
namespace editor {
|
||||||
|
|
||||||
Editor::Editor() {
|
Editor::Editor() {
|
||||||
@@ -125,8 +125,6 @@ void Editor::UpdateScreen() {
|
|||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::Shutdown() {}
|
|
||||||
|
|
||||||
void Editor::DrawYazeMenu() {
|
void Editor::DrawYazeMenu() {
|
||||||
MENU_BAR()
|
MENU_BAR()
|
||||||
DrawFileMenu();
|
DrawFileMenu();
|
||||||
@@ -276,6 +274,7 @@ void Editor::DrawViewMenu() {
|
|||||||
void Editor::DrawHelpMenu() const {
|
void Editor::DrawHelpMenu() const {
|
||||||
if (ImGui::BeginMenu("Help")) {
|
if (ImGui::BeginMenu("Help")) {
|
||||||
if (ImGui::MenuItem("About")) {
|
if (ImGui::MenuItem("About")) {
|
||||||
|
// insert the about window here
|
||||||
}
|
}
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
@@ -297,10 +296,10 @@ void Editor::DrawGraphicsSheet(int offset) {
|
|||||||
|
|
||||||
unsigned int snesAddr = 0;
|
unsigned int snesAddr = 0;
|
||||||
unsigned int pcAddr = 0;
|
unsigned int pcAddr = 0;
|
||||||
snesAddr = (unsigned int)((((uchar)(rom_.data()[0x4F80 + offset]) << 16) |
|
snesAddr = (unsigned int)((((rom_.data()[0x4F80 + offset]) << 16) |
|
||||||
((uchar)(rom_.data()[0x505F + offset]) << 8) |
|
((rom_.data()[0x505F + offset]) << 8) |
|
||||||
((uchar)(rom_.data()[0x513E + offset]))));
|
((rom_.data()[0x513E + offset]))));
|
||||||
pcAddr = rom_.SnesToPc(snesAddr);
|
pcAddr = core::SnesToPc(snesAddr);
|
||||||
std::cout << "Decompressing..." << std::endl;
|
std::cout << "Decompressing..." << std::endl;
|
||||||
char *decomp = rom_.Decompress(pcAddr);
|
char *decomp = rom_.Decompress(pcAddr);
|
||||||
std::cout << "Converting to 8bpp sheet..." << std::endl;
|
std::cout << "Converting to 8bpp sheet..." << std::endl;
|
||||||
@@ -338,7 +337,7 @@ void Editor::DrawProjectEditor() {
|
|||||||
for (int i = 0; i < 8; i++) {
|
for (int i = 0; i < 8; i++) {
|
||||||
std::string id = "##PaletteColor" + std::to_string(i);
|
std::string id = "##PaletteColor" + std::to_string(i);
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::ColorEdit4(id.c_str(), (float *)¤t_palette_[i].x,
|
ImGui::ColorEdit4(id.c_str(), ¤t_palette_[i].x,
|
||||||
ImGuiColorEditFlags_NoInputs |
|
ImGuiColorEditFlags_NoInputs |
|
||||||
ImGuiColorEditFlags_DisplayRGB |
|
ImGuiColorEditFlags_DisplayRGB |
|
||||||
ImGuiColorEditFlags_DisplayHex);
|
ImGuiColorEditFlags_DisplayHex);
|
||||||
@@ -521,5 +520,5 @@ void Editor::DrawHUDEditor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace editor
|
} // namespace editor
|
||||||
} // namespace gui
|
} // namespace app
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
#include "gui/input.h"
|
#include "gui/input.h"
|
||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
namespace gui {
|
namespace app {
|
||||||
namespace editor {
|
namespace editor {
|
||||||
|
|
||||||
class Editor {
|
class Editor {
|
||||||
@@ -24,7 +24,6 @@ class Editor {
|
|||||||
~Editor();
|
~Editor();
|
||||||
void SetupScreen(std::shared_ptr<SDL_Renderer> renderer);
|
void SetupScreen(std::shared_ptr<SDL_Renderer> renderer);
|
||||||
void UpdateScreen();
|
void UpdateScreen();
|
||||||
void Shutdown();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void DrawYazeMenu();
|
void DrawYazeMenu();
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
// have an overworld map viewer, in less than few hours if are able to
|
// have an overworld map viewer, in less than few hours if are able to
|
||||||
// understand the data quickly
|
// understand the data quickly
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
namespace gui {
|
namespace app {
|
||||||
namespace editor {
|
namespace editor {
|
||||||
|
|
||||||
void OverworldEditor::SetupROM(app::rom::ROM &rom) { rom_ = rom; }
|
void OverworldEditor::SetupROM(app::rom::ROM &rom) { rom_ = rom; }
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include "gui/icons.h"
|
#include "gui/icons.h"
|
||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
namespace gui {
|
namespace app {
|
||||||
namespace editor {
|
namespace editor {
|
||||||
|
|
||||||
static constexpr unsigned int k4BPP = 4;
|
static constexpr unsigned int k4BPP = 4;
|
||||||
|
|||||||
@@ -12,7 +12,6 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
namespace app {
|
namespace app {
|
||||||
namespace gfx {
|
namespace gfx {
|
||||||
@@ -49,9 +48,8 @@ SNESPalette::SNESPalette(uint8_t mSize) : size_(mSize) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SNESPalette::SNESPalette(char* data) {
|
SNESPalette::SNESPalette(char* data) : size_(sizeof(data) / 2) {
|
||||||
assert((sizeof(data) % 4 == 0) && (sizeof(data) <= 32));
|
assert((sizeof(data) % 4 == 0) && (sizeof(data) <= 32));
|
||||||
size_ = sizeof(data) / 2;
|
|
||||||
for (unsigned i = 0; i < sizeof(data); i += 2) {
|
for (unsigned i = 0; i < sizeof(data); i += 2) {
|
||||||
SNESColor col;
|
SNESColor col;
|
||||||
col.snes = static_cast<uchar>(data[i + 1]) << 8;
|
col.snes = static_cast<uchar>(data[i + 1]) << 8;
|
||||||
@@ -62,9 +60,8 @@ SNESPalette::SNESPalette(char* data) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SNESPalette::SNESPalette(const unsigned char* snes_pal) {
|
SNESPalette::SNESPalette(const unsigned char* snes_pal) : size_(sizeof(snes_pal) / 2) {
|
||||||
assert((sizeof(snes_pal) % 4 == 0) && (sizeof(snes_pal) <= 32));
|
assert((sizeof(snes_pal) % 4 == 0) && (sizeof(snes_pal) <= 32));
|
||||||
size_ = sizeof(snes_pal) / 2;
|
|
||||||
for (unsigned i = 0; i < sizeof(snes_pal); i += 2) {
|
for (unsigned i = 0; i < sizeof(snes_pal); i += 2) {
|
||||||
SNESColor col;
|
SNESColor col;
|
||||||
col.snes = snes_pal[i + 1] << (uint16_t)8;
|
col.snes = snes_pal[i + 1] << (uint16_t)8;
|
||||||
@@ -75,7 +72,7 @@ SNESPalette::SNESPalette(const unsigned char* snes_pal) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SNESPalette::SNESPalette(std::vector<ImVec4> cols) {
|
SNESPalette::SNESPalette(const std::vector<ImVec4> & cols) {
|
||||||
for (const auto& each : cols) {
|
for (const auto& each : cols) {
|
||||||
SNESColor scol;
|
SNESColor scol;
|
||||||
scol.setRgb(each);
|
scol.setRgb(each);
|
||||||
@@ -85,10 +82,9 @@ SNESPalette::SNESPalette(std::vector<ImVec4> cols) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
char* SNESPalette::encode() {
|
char* SNESPalette::encode() {
|
||||||
// char* data(size * 2, 0);
|
|
||||||
char* data = new char[size_ * 2];
|
char* data = new char[size_ * 2];
|
||||||
for (unsigned int i = 0; i < size_; i++) {
|
for (unsigned int i = 0; i < size_; i++) {
|
||||||
// std::cout << QString::number(colors[i].snes, 16);
|
std::cout << colors[i].snes << std::endl;
|
||||||
data[i * 2] = (char)(colors[i].snes & 0xFF);
|
data[i * 2] = (char)(colors[i].snes & 0xFF);
|
||||||
data[i * 2 + 1] = (char)(colors[i].snes >> 8);
|
data[i * 2 + 1] = (char)(colors[i].snes >> 8);
|
||||||
}
|
}
|
||||||
@@ -100,20 +96,20 @@ SDL_Palette* SNESPalette::GetSDL_Palette() {
|
|||||||
auto sdl_palette = std::make_shared<SDL_Palette>();
|
auto sdl_palette = std::make_shared<SDL_Palette>();
|
||||||
sdl_palette->ncolors = size_;
|
sdl_palette->ncolors = size_;
|
||||||
|
|
||||||
auto* sdl_colors = new SDL_Color[size_];
|
auto color = std::vector<SDL_Color>(size_);
|
||||||
for (int i = 0; i < size_; i++) {
|
for (int i = 0; i < size_; i++) {
|
||||||
sdl_colors[i].r = (uint8_t)colors[i].rgb.x * 100;
|
color[i].r = (uint8_t)colors[i].rgb.x * 100;
|
||||||
sdl_colors[i].g = (uint8_t)colors[i].rgb.y * 100;
|
color[i].g = (uint8_t)colors[i].rgb.y * 100;
|
||||||
sdl_colors[i].b = (uint8_t)colors[i].rgb.z * 100;
|
color[i].b = (uint8_t)colors[i].rgb.z * 100;
|
||||||
std::cout << "Color " << i << " added (R:" << sdl_colors[i].r
|
std::cout << "Color " << i << " added (R:" << color[i].r
|
||||||
<< " G:" << sdl_colors[i].g << " B:" << sdl_colors[i].b << ")"
|
<< " G:" << color[i].g << " B:" << color[i].b << ")"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
sdl_palette->colors = sdl_colors;
|
sdl_palette->colors = color.data();
|
||||||
|
|
||||||
// store the pointers to free them later
|
// store the pointers to free them later
|
||||||
sdl_palettes_.push_back(sdl_palette);
|
sdl_palettes_.push_back(sdl_palette);
|
||||||
colors_arrays_.push_back(sdl_colors);
|
colors_.push_back(color);
|
||||||
|
|
||||||
return sdl_palette.get();
|
return sdl_palette.get();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class SNESPalette {
|
|||||||
explicit SNESPalette(uint8_t mSize);
|
explicit SNESPalette(uint8_t mSize);
|
||||||
explicit SNESPalette(char* snesPal);
|
explicit SNESPalette(char* snesPal);
|
||||||
explicit SNESPalette(const unsigned char* snes_pal);
|
explicit SNESPalette(const unsigned char* snes_pal);
|
||||||
explicit SNESPalette(std::vector<ImVec4>);
|
explicit SNESPalette(const std::vector<ImVec4>&);
|
||||||
|
|
||||||
char* encode();
|
char* encode();
|
||||||
SDL_Palette* GetSDL_Palette();
|
SDL_Palette* GetSDL_Palette();
|
||||||
@@ -43,6 +43,7 @@ class SNESPalette {
|
|||||||
std::vector<SNESColor> colors;
|
std::vector<SNESColor> colors;
|
||||||
std::vector<std::shared_ptr<SDL_Palette>> sdl_palettes_;
|
std::vector<std::shared_ptr<SDL_Palette>> sdl_palettes_;
|
||||||
std::vector<SDL_Color*> colors_arrays_;
|
std::vector<SDL_Color*> colors_arrays_;
|
||||||
|
std::vector<std::vector<SDL_Color>> colors_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace gfx
|
} // namespace gfx
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
#define YAZE_APP_GFX_TILE_H
|
#define YAZE_APP_GFX_TILE_H
|
||||||
|
|
||||||
#include <rommapping.h>
|
#include <rommapping.h>
|
||||||
#include <tile.h>
|
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
@@ -22,6 +21,12 @@ namespace yaze {
|
|||||||
namespace app {
|
namespace app {
|
||||||
namespace gfx {
|
namespace gfx {
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
unsigned int id;
|
||||||
|
char data[64];
|
||||||
|
unsigned int palette_id;
|
||||||
|
} tile8;
|
||||||
|
|
||||||
using ushort = unsigned short;
|
using ushort = unsigned short;
|
||||||
using uchar = unsigned char;
|
using uchar = unsigned char;
|
||||||
using ulong = unsigned long;
|
using ulong = unsigned long;
|
||||||
|
|||||||
@@ -29,9 +29,9 @@ void Overworld::Load(app::rom::ROM& rom, uchar* allGfxPtr) {
|
|||||||
rom_ = rom;
|
rom_ = rom;
|
||||||
allGfx16Ptr = allGfxPtr;
|
allGfx16Ptr = allGfxPtr;
|
||||||
|
|
||||||
overworldMapPointer = std::make_shared<uchar[]>(0x40000);
|
overworldMapPointer = std::make_shared<uchar>(0x40000);
|
||||||
mapblockset16 = std::make_shared<uchar[]>(1048576);
|
mapblockset16 = std::make_shared<uchar>(1048576);
|
||||||
currentOWgfx16Ptr = std::make_shared<uchar[]>((128 * 512) / 2);
|
currentOWgfx16Ptr = std::make_shared<uchar>((128 * 512) / 2);
|
||||||
|
|
||||||
AssembleMap32Tiles();
|
AssembleMap32Tiles();
|
||||||
AssembleMap16Tiles();
|
AssembleMap16Tiles();
|
||||||
|
|||||||
@@ -15,13 +15,13 @@ using ushort = unsigned short;
|
|||||||
|
|
||||||
class OverworldMap {
|
class OverworldMap {
|
||||||
public:
|
public:
|
||||||
int parent_ = 0;
|
int parent_ = 0;
|
||||||
int index_ = 0;
|
int index_ = 0;
|
||||||
int message_id_ = 0;
|
int message_id_ = 0;
|
||||||
int gfx_ = 0;
|
int gfx_ = 0;
|
||||||
int palette_ = 0;
|
int palette_ = 0;
|
||||||
bool initialized_ = false;
|
bool initialized_ = false;
|
||||||
bool large_map_ = false;
|
bool large_map_ = false;
|
||||||
uchar sprite_graphics_[3];
|
uchar sprite_graphics_[3];
|
||||||
uchar sprite_palette_[3];
|
uchar sprite_palette_[3];
|
||||||
uchar musics[4];
|
uchar musics[4];
|
||||||
|
|||||||
Reference in New Issue
Block a user