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