cleaning up the mess i've made
This commit is contained in:
@@ -48,6 +48,8 @@ class ROM {
|
|||||||
uint compress_size_;
|
uint compress_size_;
|
||||||
long int size_;
|
long int size_;
|
||||||
enum rom_type type_ = LoROM;
|
enum rom_type type_ = LoROM;
|
||||||
|
|
||||||
|
std::shared_ptr<uchar> rom_ptr_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Data
|
} // namespace Data
|
||||||
|
|||||||
@@ -63,8 +63,8 @@ Editor::Editor() {
|
|||||||
current_set_.pcTilesLocation = 0x80000;
|
current_set_.pcTilesLocation = 0x80000;
|
||||||
current_set_.SNESTilesLocation = 0x0000;
|
current_set_.SNESTilesLocation = 0x0000;
|
||||||
current_set_.length = 28672;
|
current_set_.length = 28672;
|
||||||
current_set_.pcPaletteLocation = 0xDD326;
|
current_set_.pcPaletteLocation = 906022;
|
||||||
current_set_.SNESPaletteLocation = 0x0000;
|
current_set_.SNESPaletteLocation = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::UpdateScreen() {
|
void Editor::UpdateScreen() {
|
||||||
@@ -263,22 +263,21 @@ void Editor::DrawProjectEditor() {
|
|||||||
ImGui::Text("Version: %d", rom_.getVersion());
|
ImGui::Text("Version: %d", rom_.getVersion());
|
||||||
ImGui::Text("ROM Size: %ld", rom_.getSize());
|
ImGui::Text("ROM Size: %ld", rom_.getSize());
|
||||||
|
|
||||||
|
ImGui::InputScalar("Bits per Pixel", ImGuiDataType_U32,
|
||||||
|
(void *)¤t_set_.bpp);
|
||||||
|
|
||||||
ImGui::InputInt("PC Tile Location", ¤t_set_.pcTilesLocation);
|
ImGui::InputInt("PC Tile Location", ¤t_set_.pcTilesLocation);
|
||||||
// 1, 100, ImGuiInputTextFlags_CharsHexadecimal
|
// 1, 100, ImGuiInputTextFlags_CharsHexadecimal
|
||||||
|
|
||||||
ImGui::InputScalar("SNES Tile Location", ImGuiDataType_U32,
|
ImGui::InputScalar("SNES Tile Location", ImGuiDataType_U16,
|
||||||
(void *)¤t_set_.SNESTilesLocation);
|
(void *)¤t_set_.SNESTilesLocation);
|
||||||
|
|
||||||
ImGui::InputScalar("Tile Preset Length", ImGuiDataType_U32,
|
ImGui::InputScalar("Tile Preset Length", ImGuiDataType_U32,
|
||||||
(void *)¤t_set_.length);
|
(void *)¤t_set_.length);
|
||||||
|
|
||||||
ImGui::InputScalar("Bits per Pixel", ImGuiDataType_U32,
|
ImGui::InputInt("PC Palette Location", ¤t_set_.pcPaletteLocation);
|
||||||
(void *)¤t_set_.bpp);
|
|
||||||
|
|
||||||
ImGui::InputScalar("PC Palette Location", ImGuiDataType_U32,
|
ImGui::InputScalar("SNES Palette Location", ImGuiDataType_U16,
|
||||||
(void *)¤t_set_.pcPaletteLocation);
|
|
||||||
|
|
||||||
ImGui::InputScalar("SNES Palette Location", ImGuiDataType_U32,
|
|
||||||
(void *)¤t_set_.SNESPaletteLocation);
|
(void *)¤t_set_.SNESPaletteLocation);
|
||||||
|
|
||||||
BASIC_BUTTON("ExtractTiles") {
|
BASIC_BUTTON("ExtractTiles") {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ void SNESColor::setSNES(uint16_t val) {
|
|||||||
rgb = ImVec4(col.red, col.green, col.blue, 1.f);
|
rgb = ImVec4(col.red, col.green, col.blue, 1.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
SNESPalette::SNESPalette(uint8_t mSize) : size(mSize) {
|
SNESPalette::SNESPalette(uint8_t mSize) : size_(mSize) {
|
||||||
for (unsigned int i = 0; i < mSize; i++) {
|
for (unsigned int i = 0; i < mSize; i++) {
|
||||||
SNESColor col;
|
SNESColor col;
|
||||||
colors.push_back(col);
|
colors.push_back(col);
|
||||||
@@ -41,7 +41,7 @@ SNESPalette::SNESPalette(uint8_t mSize) : size(mSize) {
|
|||||||
|
|
||||||
SNESPalette::SNESPalette(char* data) {
|
SNESPalette::SNESPalette(char* data) {
|
||||||
assert((sizeof(data) % 4 == 0) && (sizeof(data) <= 32));
|
assert((sizeof(data) % 4 == 0) && (sizeof(data) <= 32));
|
||||||
size = sizeof(data) / 2;
|
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;
|
||||||
@@ -58,13 +58,13 @@ SNESPalette::SNESPalette(std::vector<ImVec4> cols) {
|
|||||||
scol.setRgb(each);
|
scol.setRgb(each);
|
||||||
colors.push_back(scol);
|
colors.push_back(scol);
|
||||||
}
|
}
|
||||||
size = cols.size();
|
size_ = cols.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
char* SNESPalette::encode() {
|
char* SNESPalette::encode() {
|
||||||
// char* data(size * 2, 0);
|
// 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 << QString::number(colors[i].snes, 16);
|
||||||
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);
|
||||||
@@ -73,21 +73,22 @@ char* SNESPalette::encode() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SDL_Palette* SNESPalette::GetSDL_Palette() {
|
SDL_Palette* SNESPalette::GetSDL_Palette() {
|
||||||
SDL_Palette* result = new SDL_Palette;
|
auto sdl_palette = std::make_shared<SDL_Palette>();
|
||||||
result->ncolors = size;
|
sdl_palette->ncolors = size_;
|
||||||
SDL_Color* sdl_colors = new SDL_Color[size];
|
|
||||||
for (int i = 0; i < size; i++) {
|
auto* sdl_colors = new SDL_Color[size_];
|
||||||
|
for (int i = 0; i < size_; i++) {
|
||||||
sdl_colors[i].r = (uint8_t)colors[i].rgb.x * 100;
|
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].g = (uint8_t)colors[i].rgb.y * 100;
|
||||||
sdl_colors[i].b = (uint8_t)colors[i].rgb.z * 100;
|
sdl_colors[i].b = (uint8_t)colors[i].rgb.z * 100;
|
||||||
}
|
}
|
||||||
result->colors = sdl_colors;
|
sdl_palette->colors = sdl_colors;
|
||||||
|
|
||||||
// store the pointers to free them later
|
// store the pointers to free them later
|
||||||
sdl_palettes_.push_back(result);
|
sdl_palettes_.push_back(sdl_palette);
|
||||||
colors_arrays_.push_back(sdl_colors);
|
colors_arrays_.push_back(sdl_colors);
|
||||||
|
|
||||||
return result;
|
return sdl_palette.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Graphics
|
} // namespace Graphics
|
||||||
|
|||||||
@@ -36,9 +36,9 @@ class SNESPalette {
|
|||||||
char* encode();
|
char* encode();
|
||||||
SDL_Palette* GetSDL_Palette();
|
SDL_Palette* GetSDL_Palette();
|
||||||
|
|
||||||
int size = 0;
|
int size_ = 0;
|
||||||
std::vector<SNESColor> colors;
|
std::vector<SNESColor> colors;
|
||||||
std::vector<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_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -145,16 +145,6 @@ std::vector<std::vector<tile8> > TilesPattern::transform(
|
|||||||
return pattern.transform(tiles);
|
return pattern.transform(tiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
TilePreset::TilePreset() {
|
|
||||||
bpp = 0;
|
|
||||||
length = 0;
|
|
||||||
pcTilesLocation = -1;
|
|
||||||
SNESTilesLocation = 0;
|
|
||||||
pcPaletteLocation = 0;
|
|
||||||
SNESPaletteLocation = 0;
|
|
||||||
paletteNoZeroColor = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Graphics
|
} // namespace Graphics
|
||||||
} // namespace Application
|
} // namespace Application
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
|
|||||||
@@ -88,17 +88,15 @@ class TilesPattern {
|
|||||||
|
|
||||||
class TilePreset {
|
class TilePreset {
|
||||||
public:
|
public:
|
||||||
TilePreset();
|
TilePreset() = default;
|
||||||
|
|
||||||
bool paletteNoZeroColor;
|
|
||||||
int pcTilesLocation;
|
|
||||||
uint16_t SNESTilesLocation;
|
|
||||||
uint16_t SNESPaletteLocation;
|
|
||||||
uint32_t pcPaletteLocation;
|
|
||||||
uint32_t length;
|
|
||||||
uint32_t bpp;
|
|
||||||
|
|
||||||
TilesPattern tilesPattern;
|
TilesPattern tilesPattern;
|
||||||
|
bool no_zero_color_ = false;
|
||||||
|
int pc_tiles_location_ = -1;
|
||||||
|
int pc_palette_location_ = 0;
|
||||||
|
uint32_t length_ = 0;
|
||||||
|
uint32_t bits_per_pixel_ = 0;
|
||||||
|
uint16_t SNESTilesLocation = 0;
|
||||||
|
uint16_t SNESPaletteLocation = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Graphics
|
} // namespace Graphics
|
||||||
|
|||||||
13
src/yaze.h
13
src/yaze.h
@@ -1,19 +1,6 @@
|
|||||||
#ifndef YAZE_YAZE_H
|
#ifndef YAZE_YAZE_H
|
||||||
#define YAZE_YAZE_H
|
#define YAZE_YAZE_H
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <memory>
|
|
||||||
#include <utility>
|
|
||||||
#include <algorithm>
|
|
||||||
#include <functional>
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <sstream>
|
|
||||||
#include <array>
|
|
||||||
#include <vector>
|
|
||||||
#include <unordered_map>
|
|
||||||
#include <unordered_set>
|
|
||||||
|
|
||||||
#include "Application/Core/controller.h"
|
#include "Application/Core/controller.h"
|
||||||
#include "Application/Core/entry_point.h"
|
#include "Application/Core/entry_point.h"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user