backend-infra-engineer: Release 0.2.2 snapshot
This commit is contained in:
@@ -11,7 +11,6 @@
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
using ImGui::BeginChild;
|
||||
@@ -297,5 +296,4 @@ void GfxGroupEditor::DrawPaletteViewer() {
|
||||
}
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "app/rom.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
/**
|
||||
@@ -43,6 +42,5 @@ class GfxGroupEditor : public SharedRom {
|
||||
};
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
#endif // YAZE_APP_EDITOR_GFX_GROUP_EDITOR_H
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#include "graphics_editor.h"
|
||||
|
||||
#include "ImGuiFileDialog/ImGuiFileDialog.h"
|
||||
#include <filesystem>
|
||||
|
||||
#include "absl/status/status.h"
|
||||
#include "absl/status/statusor.h"
|
||||
#include "app/core/platform/clipboard.h"
|
||||
#include "app/core/platform/file_dialog.h"
|
||||
#include "app/core/platform/renderer.h"
|
||||
#include "app/editor/graphics/palette_editor.h"
|
||||
#include "app/gfx/bitmap.h"
|
||||
@@ -23,7 +25,6 @@
|
||||
#include "imgui_memory_editor.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
using core::Renderer;
|
||||
@@ -515,22 +516,19 @@ absl::Status GraphicsEditor::DrawCgxImport() {
|
||||
gui::TextWithSeparators("Cgx Import");
|
||||
InputInt("BPP", ¤t_bpp_);
|
||||
|
||||
InputText("##CGXFile", cgx_file_name_, sizeof(cgx_file_name_));
|
||||
InputText("##CGXFile", &cgx_file_name_);
|
||||
SameLine();
|
||||
|
||||
gui::FileDialogPipeline("ImportCgxKey", ".CGX,.cgx\0", "Open CGX", [this]() {
|
||||
strncpy(cgx_file_path_,
|
||||
ImGuiFileDialog::Instance()->GetFilePathName().c_str(),
|
||||
sizeof(cgx_file_path_));
|
||||
strncpy(cgx_file_name_,
|
||||
ImGuiFileDialog::Instance()->GetCurrentFileName().c_str(),
|
||||
sizeof(cgx_file_name_));
|
||||
if (ImGui::Button("Open CGX")) {
|
||||
auto filename = core::FileDialogWrapper::ShowOpenFileDialog();
|
||||
cgx_file_name_ = filename;
|
||||
cgx_file_path_ = std::filesystem::absolute(filename).string();
|
||||
is_open_ = true;
|
||||
cgx_loaded_ = true;
|
||||
});
|
||||
}
|
||||
|
||||
if (ImGui::Button("Copy CGX Path")) {
|
||||
ImGui::SetClipboardText(cgx_file_path_);
|
||||
ImGui::SetClipboardText(cgx_file_path_.c_str());
|
||||
}
|
||||
|
||||
if (ImGui::Button("Load CGX Data")) {
|
||||
@@ -548,19 +546,15 @@ absl::Status GraphicsEditor::DrawCgxImport() {
|
||||
}
|
||||
|
||||
absl::Status GraphicsEditor::DrawScrImport() {
|
||||
InputText("##ScrFile", scr_file_name_, sizeof(scr_file_name_));
|
||||
InputText("##ScrFile", &scr_file_name_);
|
||||
|
||||
gui::FileDialogPipeline(
|
||||
"ImportScrKey", ".SCR,.scr,.BAK\0", "Open SCR", [this]() {
|
||||
strncpy(scr_file_path_,
|
||||
ImGuiFileDialog::Instance()->GetFilePathName().c_str(),
|
||||
sizeof(scr_file_path_));
|
||||
strncpy(scr_file_name_,
|
||||
ImGuiFileDialog::Instance()->GetCurrentFileName().c_str(),
|
||||
sizeof(scr_file_name_));
|
||||
is_open_ = true;
|
||||
scr_loaded_ = true;
|
||||
});
|
||||
if (ImGui::Button("Open SCR")) {
|
||||
auto filename = core::FileDialogWrapper::ShowOpenFileDialog();
|
||||
scr_file_name_ = filename;
|
||||
scr_file_path_ = std::filesystem::absolute(filename).string();
|
||||
is_open_ = true;
|
||||
scr_loaded_ = true;
|
||||
}
|
||||
|
||||
InputInt("SCR Mod", &scr_mod_value_);
|
||||
|
||||
@@ -584,38 +578,35 @@ absl::Status GraphicsEditor::DrawScrImport() {
|
||||
|
||||
absl::Status GraphicsEditor::DrawPaletteControls() {
|
||||
gui::TextWithSeparators("COL Import");
|
||||
InputText("##ColFile", col_file_name_, sizeof(col_file_name_));
|
||||
InputText("##ColFile", &col_file_name_);
|
||||
SameLine();
|
||||
|
||||
gui::FileDialogPipeline(
|
||||
"ImportColKey", ".COL,.col,.BAK,.bak\0", "Open COL", [this]() {
|
||||
strncpy(col_file_path_,
|
||||
ImGuiFileDialog::Instance()->GetFilePathName().c_str(),
|
||||
sizeof(col_file_path_));
|
||||
strncpy(col_file_name_,
|
||||
ImGuiFileDialog::Instance()->GetCurrentFileName().c_str(),
|
||||
sizeof(col_file_name_));
|
||||
status_ = temp_rom_.LoadFromFile(col_file_path_,
|
||||
/*z3_load=*/false);
|
||||
auto col_data_ = gfx::GetColFileData(temp_rom_.data());
|
||||
if (col_file_palette_group_.size() != 0) {
|
||||
col_file_palette_group_.clear();
|
||||
}
|
||||
auto col_file_palette_group_status =
|
||||
gfx::CreatePaletteGroupFromColFile(col_data_);
|
||||
if (col_file_palette_group_status.ok()) {
|
||||
col_file_palette_group_ = col_file_palette_group_status.value();
|
||||
}
|
||||
col_file_palette_ = gfx::SnesPalette(col_data_);
|
||||
if (ImGui::Button("Open COL")) {
|
||||
auto filename = core::FileDialogWrapper::ShowOpenFileDialog();
|
||||
col_file_name_ = filename;
|
||||
col_file_path_ = std::filesystem::absolute(filename).string();
|
||||
status_ = temp_rom_.LoadFromFile(col_file_path_,
|
||||
/*z3_load=*/false);
|
||||
auto col_data_ = gfx::GetColFileData(temp_rom_.mutable_data());
|
||||
if (col_file_palette_group_.size() != 0) {
|
||||
col_file_palette_group_.clear();
|
||||
}
|
||||
auto col_file_palette_group_status =
|
||||
gfx::CreatePaletteGroupFromColFile(col_data_);
|
||||
if (col_file_palette_group_status.ok()) {
|
||||
col_file_palette_group_ = col_file_palette_group_status.value();
|
||||
}
|
||||
col_file_palette_ = gfx::SnesPalette(col_data_);
|
||||
|
||||
// gigaleak dev format based code
|
||||
decoded_col_ = gfx::scad_format::DecodeColFile(col_file_path_);
|
||||
col_file_ = true;
|
||||
is_open_ = true;
|
||||
});
|
||||
// gigaleak dev format based code
|
||||
decoded_col_ = gfx::scad_format::DecodeColFile(col_file_path_);
|
||||
col_file_ = true;
|
||||
is_open_ = true;
|
||||
}
|
||||
HOVER_HINT(".COL, .BAK");
|
||||
|
||||
if (ImGui::Button("Copy Col Path")) {
|
||||
ImGui::SetClipboardText(col_file_path_);
|
||||
ImGui::SetClipboardText(col_file_path_.c_str());
|
||||
}
|
||||
|
||||
if (rom()->is_loaded()) {
|
||||
@@ -636,17 +627,17 @@ absl::Status GraphicsEditor::DrawPaletteControls() {
|
||||
absl::Status GraphicsEditor::DrawObjImport() {
|
||||
gui::TextWithSeparators("OBJ Import");
|
||||
|
||||
InputText("##ObjFile", obj_file_path_, sizeof(obj_file_path_));
|
||||
InputText("##ObjFile", &obj_file_path_);
|
||||
SameLine();
|
||||
|
||||
gui::FileDialogPipeline(
|
||||
"ImportObjKey", ".obj,.OBJ,.bak,.BAK\0", "Open OBJ", [this]() {
|
||||
strncpy(file_path_,
|
||||
ImGuiFileDialog::Instance()->GetFilePathName().c_str(),
|
||||
sizeof(file_path_));
|
||||
status_ = temp_rom_.LoadFromFile(file_path_);
|
||||
is_open_ = true;
|
||||
});
|
||||
if (ImGui::Button("Open OBJ")) {
|
||||
auto filename = core::FileDialogWrapper::ShowOpenFileDialog();
|
||||
obj_file_path_ = std::filesystem::absolute(filename).string();
|
||||
status_ = temp_rom_.LoadFromFile(obj_file_path_);
|
||||
is_open_ = true;
|
||||
obj_loaded_ = true;
|
||||
}
|
||||
HOVER_HINT(".OBJ, .BAK");
|
||||
|
||||
return absl::OkStatus();
|
||||
}
|
||||
@@ -654,23 +645,22 @@ absl::Status GraphicsEditor::DrawObjImport() {
|
||||
absl::Status GraphicsEditor::DrawTilemapImport() {
|
||||
gui::TextWithSeparators("Tilemap Import");
|
||||
|
||||
InputText("##TMapFile", tilemap_file_path_, sizeof(tilemap_file_path_));
|
||||
InputText("##TMapFile", &tilemap_file_path_);
|
||||
SameLine();
|
||||
|
||||
gui::FileDialogPipeline(
|
||||
"ImportTilemapKey", ".DAT,.dat,.BIN,.bin,.hex,.HEX\0", "Open Tilemap",
|
||||
[this]() {
|
||||
strncpy(tilemap_file_path_,
|
||||
ImGuiFileDialog::Instance()->GetFilePathName().c_str(),
|
||||
sizeof(tilemap_file_path_));
|
||||
status_ = tilemap_rom_.LoadFromFile(tilemap_file_path_);
|
||||
if (ImGui::Button("Open Tilemap")) {
|
||||
auto filename = core::FileDialogWrapper::ShowOpenFileDialog();
|
||||
tilemap_file_path_ = std::filesystem::absolute(filename).string();
|
||||
status_ = tilemap_rom_.LoadFromFile(tilemap_file_path_);
|
||||
status_ = tilemap_rom_.LoadFromFile(tilemap_file_path_);
|
||||
|
||||
// Extract the high and low bytes from the file.
|
||||
auto decomp_sheet = gfx::lc_lz2::DecompressV2(
|
||||
tilemap_rom_.data(), gfx::lc_lz2::kNintendoMode1);
|
||||
tilemap_loaded_ = true;
|
||||
is_open_ = true;
|
||||
});
|
||||
// Extract the high and low bytes from the file.
|
||||
auto decomp_sheet = gfx::lc_lz2::DecompressV2(tilemap_rom_.data(),
|
||||
gfx::lc_lz2::kNintendoMode1);
|
||||
tilemap_loaded_ = true;
|
||||
is_open_ = true;
|
||||
}
|
||||
HOVER_HINT(".DAT, .BIN, .HEX");
|
||||
|
||||
return absl::OkStatus();
|
||||
}
|
||||
@@ -678,30 +668,30 @@ absl::Status GraphicsEditor::DrawTilemapImport() {
|
||||
absl::Status GraphicsEditor::DrawFileImport() {
|
||||
gui::TextWithSeparators("BIN Import");
|
||||
|
||||
InputText("##ROMFile", file_path_, sizeof(file_path_));
|
||||
InputText("##ROMFile", &file_path_);
|
||||
SameLine();
|
||||
|
||||
gui::FileDialogPipeline("ImportDlgKey", ".bin,.hex\0", "Open BIN", [this]() {
|
||||
strncpy(file_path_, ImGuiFileDialog::Instance()->GetFilePathName().c_str(),
|
||||
sizeof(file_path_));
|
||||
if (ImGui::Button("Open BIN")) {
|
||||
auto filename = core::FileDialogWrapper::ShowOpenFileDialog();
|
||||
file_path_ = filename;
|
||||
status_ = temp_rom_.LoadFromFile(file_path_);
|
||||
is_open_ = true;
|
||||
});
|
||||
}
|
||||
HOVER_HINT(".BIN, .HEX");
|
||||
|
||||
if (Button("Copy File Path")) {
|
||||
ImGui::SetClipboardText(file_path_);
|
||||
ImGui::SetClipboardText(file_path_.c_str());
|
||||
}
|
||||
|
||||
gui::InputHex("BIN Offset", ¤t_offset_);
|
||||
gui::InputHex("BIN Size", &bin_size_);
|
||||
|
||||
if (Button("Decompress BIN")) {
|
||||
if (strlen(file_path_) > 0) {
|
||||
RETURN_IF_ERROR(DecompressImportData(bin_size_))
|
||||
} else {
|
||||
if (file_path_.empty()) {
|
||||
return absl::InvalidArgumentError(
|
||||
"Please select a file before importing.");
|
||||
"Please select a file before decompressing.");
|
||||
}
|
||||
RETURN_IF_ERROR(DecompressImportData(bin_size_))
|
||||
}
|
||||
|
||||
return absl::OkStatus();
|
||||
@@ -740,13 +730,12 @@ absl::Status GraphicsEditor::DrawClipboardImport() {
|
||||
absl::Status GraphicsEditor::DrawExperimentalFeatures() {
|
||||
gui::TextWithSeparators("Experimental");
|
||||
if (Button("Decompress Super Donkey Full")) {
|
||||
if (strlen(file_path_) > 0) {
|
||||
RETURN_IF_ERROR(DecompressSuperDonkey())
|
||||
} else {
|
||||
if (file_path_.empty()) {
|
||||
return absl::InvalidArgumentError(
|
||||
"Please select `super_donkey_1.bin` before "
|
||||
"importing.");
|
||||
}
|
||||
RETURN_IF_ERROR(DecompressSuperDonkey())
|
||||
}
|
||||
ImGui::SetItemTooltip(
|
||||
"Requires `super_donkey_1.bin` to be imported under the "
|
||||
@@ -758,7 +747,8 @@ absl::Status GraphicsEditor::DrawMemoryEditor() {
|
||||
std::string title = "Memory Editor";
|
||||
if (is_open_) {
|
||||
static MemoryEditor mem_edit;
|
||||
mem_edit.DrawWindow(title.c_str(), temp_rom_.data(), temp_rom_.size());
|
||||
mem_edit.DrawWindow(title.c_str(), temp_rom_.mutable_data(),
|
||||
temp_rom_.size());
|
||||
}
|
||||
return absl::OkStatus();
|
||||
}
|
||||
@@ -844,5 +834,4 @@ absl::Status GraphicsEditor::DecompressSuperDonkey() {
|
||||
}
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
@@ -4,19 +4,18 @@
|
||||
#include <stack>
|
||||
|
||||
#include "absl/status/status.h"
|
||||
#include "app/editor/graphics/palette_editor.h"
|
||||
#include "app/editor/editor.h"
|
||||
#include "app/editor/graphics/palette_editor.h"
|
||||
#include "app/gfx/bitmap.h"
|
||||
#include "app/gfx/snes_tile.h"
|
||||
#include "app/gui/modules/asset_browser.h"
|
||||
#include "app/gui/canvas.h"
|
||||
#include "app/gui/modules/asset_browser.h"
|
||||
#include "app/rom.h"
|
||||
#include "app/zelda3/overworld/overworld.h"
|
||||
#include "imgui/imgui.h"
|
||||
#include "imgui_memory_editor.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
// "99973","A3D80",
|
||||
@@ -143,16 +142,16 @@ class GraphicsEditor : public SharedRom, public Editor {
|
||||
bool obj_loaded_ = false;
|
||||
bool tilemap_loaded_ = false;
|
||||
|
||||
char file_path_[256] = "";
|
||||
char col_file_path_[256] = "";
|
||||
char col_file_name_[256] = "";
|
||||
char cgx_file_path_[256] = "";
|
||||
char cgx_file_name_[256] = "";
|
||||
char scr_file_path_[256] = "";
|
||||
char scr_file_name_[256] = "";
|
||||
char obj_file_path_[256] = "";
|
||||
char tilemap_file_path_[256] = "";
|
||||
char tilemap_file_name_[256] = "";
|
||||
std::string file_path_ = "";
|
||||
std::string col_file_path_ = "";
|
||||
std::string col_file_name_ = "";
|
||||
std::string cgx_file_path_ = "";
|
||||
std::string cgx_file_name_ = "";
|
||||
std::string scr_file_path_ = "";
|
||||
std::string scr_file_name_ = "";
|
||||
std::string obj_file_path_ = "";
|
||||
std::string tilemap_file_path_ = "";
|
||||
std::string tilemap_file_name_ = "";
|
||||
|
||||
gui::GfxSheetAssetBrowser asset_browser_;
|
||||
|
||||
@@ -160,7 +159,7 @@ class GraphicsEditor : public SharedRom, public Editor {
|
||||
|
||||
Rom temp_rom_;
|
||||
Rom tilemap_rom_;
|
||||
zelda3::overworld::Overworld overworld_;
|
||||
zelda3::Overworld overworld_;
|
||||
MemoryEditor cgx_memory_editor_;
|
||||
MemoryEditor col_memory_editor_;
|
||||
PaletteEditor palette_editor_;
|
||||
@@ -196,7 +195,6 @@ class GraphicsEditor : public SharedRom, public Editor {
|
||||
};
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
#endif // YAZE_APP_EDITOR_GRAPHICS_EDITOR_H
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
using ImGui::AcceptDragDropPayload;
|
||||
@@ -472,5 +471,4 @@ absl::Status PaletteEditor::ResetColorToOriginal(
|
||||
}
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
namespace palette_internal {
|
||||
@@ -120,7 +119,6 @@ class PaletteEditor : public SharedRom, public Editor {
|
||||
};
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
#endif
|
||||
|
||||
@@ -13,12 +13,12 @@
|
||||
#include "app/gfx/snes_tile.h"
|
||||
#include "app/gfx/tilesheet.h"
|
||||
#include "app/gui/canvas.h"
|
||||
#include "app/gui/color.h"
|
||||
#include "app/gui/icons.h"
|
||||
#include "app/gui/input.h"
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
using core::Renderer;
|
||||
@@ -167,7 +167,7 @@ absl::Status ScreenEditor::LoadDungeonMaps() {
|
||||
gdata[j] = rom()->data()[pc_ptr_gfx++];
|
||||
}
|
||||
|
||||
std::string label = core::UppercaseHexByte(rdata[j]);
|
||||
std::string label = core::HexByte(rdata[j]);
|
||||
dungeon_map_labels_[d][i][j] = label;
|
||||
}
|
||||
|
||||
@@ -318,7 +318,7 @@ void ScreenEditor::DrawDungeonMapsTabs() {
|
||||
std::string label =
|
||||
dungeon_map_labels_[selected_dungeon][floor_number][j];
|
||||
screen_canvas_.DrawText(label, (posX * 2), (posY * 2));
|
||||
std::string gfx_id = core::UppercaseHexByte(tile16_id);
|
||||
std::string gfx_id = core::HexByte(tile16_id);
|
||||
screen_canvas_.DrawText(gfx_id, (posX * 2), (posY * 2) + 16);
|
||||
}
|
||||
}
|
||||
@@ -392,13 +392,30 @@ void ScreenEditor::DrawDungeonMapsEditor() {
|
||||
sheets_.emplace(1, rom()->gfx_sheets()[213]);
|
||||
sheets_.emplace(2, rom()->gfx_sheets()[214]);
|
||||
sheets_.emplace(3, rom()->gfx_sheets()[215]);
|
||||
int current_tile8 = 0;
|
||||
int tile_data_offset = 0;
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
for (int j = 0; j < 32; j++) {
|
||||
std::vector<uint8_t> tile_data(64, 0); // 8x8 tile (64 bytes
|
||||
int tile_index = current_tile8 + j;
|
||||
int x = (j % 8) * 8;
|
||||
int y = (j / 8) * 8;
|
||||
sheets_[i].Get8x8Tile(tile_index, 0, 0, tile_data, tile_data_offset);
|
||||
tile8_individual_.emplace_back(gfx::Bitmap(8, 8, 4, tile_data));
|
||||
RETURN_VOID_IF_ERROR(tile8_individual_.back().ApplyPalette(
|
||||
*rom()->mutable_dungeon_palette(3)));
|
||||
Renderer::GetInstance().RenderBitmap(&tile8_individual_.back());
|
||||
}
|
||||
tile_data_offset = 0;
|
||||
}
|
||||
dungeon_maps_loaded_ = true;
|
||||
} else {
|
||||
ImGui::Text("Failed to load dungeon map tile16");
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui::BeginTable("##DungeonMapToolset", 2, ImGuiTableFlags_SizingFixedFit)) {
|
||||
if (ImGui::BeginTable("##DungeonMapToolset", 2,
|
||||
ImGuiTableFlags_SizingFixedFit)) {
|
||||
ImGui::TableSetupColumn("Draw Mode");
|
||||
ImGui::TableSetupColumn("Edit Mode");
|
||||
|
||||
@@ -470,8 +487,13 @@ void ScreenEditor::DrawDungeonMapsEditor() {
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
current_tile_canvas_.DrawBackground(ImVec2(64 * 2 + 2, 64 * 2 + 4));
|
||||
current_tile_canvas_
|
||||
.DrawBackground(); // ImVec2(64 * 2 + 2, 64 * 2 + 4));
|
||||
current_tile_canvas_.DrawContextMenu();
|
||||
if (current_tile_canvas_.DrawTilePainter(
|
||||
tile8_individual_[selected_tile8_], 16)) {
|
||||
// Modify the tile16 based on the selected tile and current_tile16_info
|
||||
}
|
||||
current_tile_canvas_.DrawBitmap(tile16_individual_[selected_tile16_], 2,
|
||||
4.0f);
|
||||
current_tile_canvas_.DrawGrid(16.f);
|
||||
@@ -538,8 +560,10 @@ void ScreenEditor::LoadBinaryGfx() {
|
||||
gfx_sheets.emplace_back(converted_bin.begin() + (i * 0x1000),
|
||||
converted_bin.begin() + ((i + 1) * 0x1000));
|
||||
sheets_.emplace(i, gfx::Bitmap(128, 32, 8, gfx_sheets[i]));
|
||||
sheets_[i].ApplyPalette(*rom()->mutable_dungeon_palette(3));
|
||||
Renderer::GetInstance().RenderBitmap(&sheets_[i]);
|
||||
status_ = sheets_[i].ApplyPalette(*rom()->mutable_dungeon_palette(3));
|
||||
if (status_.ok()) {
|
||||
Renderer::GetInstance().RenderBitmap(&sheets_[i]);
|
||||
}
|
||||
}
|
||||
binary_gfx_loaded_ = true;
|
||||
} else {
|
||||
@@ -589,5 +613,4 @@ void ScreenEditor::DrawToolset() {
|
||||
}
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
/**
|
||||
@@ -33,7 +32,7 @@ namespace editor {
|
||||
* The class inherits from the SharedRom class.
|
||||
*/
|
||||
class ScreenEditor : public SharedRom, public Editor {
|
||||
public:
|
||||
public:
|
||||
ScreenEditor() {
|
||||
screen_canvas_.SetCanvasSize(ImVec2(512, 512));
|
||||
type_ = EditorType::kScreen;
|
||||
@@ -50,7 +49,7 @@ public:
|
||||
|
||||
absl::Status SaveDungeonMaps();
|
||||
|
||||
private:
|
||||
private:
|
||||
void DrawTitleScreenEditor();
|
||||
void DrawNamingScreenEditor();
|
||||
void DrawOverworldMapEditor();
|
||||
@@ -86,12 +85,13 @@ private:
|
||||
bool copy_button_pressed = false;
|
||||
bool paste_button_pressed = false;
|
||||
|
||||
std::vector<uint8_t> all_gfx_;
|
||||
std::array<uint16_t, 4> current_tile16_data_;
|
||||
std::unordered_map<int, gfx::Bitmap> tile16_individual_;
|
||||
std::vector<gfx::Bitmap> tile8_individual_;
|
||||
std::vector<uint8_t> all_gfx_;
|
||||
std::vector<uint8_t> gfx_bin_data_;
|
||||
std::vector<zelda3::screen::DungeonMap> dungeon_maps_;
|
||||
std::vector<std::vector<std::array<std::string, 25>>> dungeon_map_labels_;
|
||||
std::array<uint16_t, 4> current_tile16_data_;
|
||||
std::vector<uint8_t> gfx_bin_data_;
|
||||
|
||||
absl::Status status_;
|
||||
|
||||
@@ -100,18 +100,17 @@ private:
|
||||
gfx::Tilesheet tile16_sheet_;
|
||||
gfx::InternalTile16 current_tile16_info;
|
||||
|
||||
gui::Canvas current_tile_canvas_{"##CurrentTileCanvas"};
|
||||
gui::Canvas current_tile_canvas_{"##CurrentTileCanvas", ImVec2(32, 32),
|
||||
gui::CanvasGridSize::k16x16, 2.0f};
|
||||
gui::Canvas screen_canvas_;
|
||||
gui::Canvas tilesheet_canvas_;
|
||||
gui::Canvas tilemap_canvas_{"##TilemapCanvas",
|
||||
ImVec2(128 + 2, (192) + 4),
|
||||
gui::Canvas tilemap_canvas_{"##TilemapCanvas", ImVec2(128 + 2, (192) + 4),
|
||||
gui::CanvasGridSize::k8x8, 2.f};
|
||||
|
||||
zelda3::screen::Inventory inventory_;
|
||||
};
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
} // namespace editor
|
||||
} // namespace yaze
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "ImGuiFileDialog/ImGuiFileDialog.h"
|
||||
#include "absl/status/status.h"
|
||||
#include "absl/status/statusor.h"
|
||||
#include "app/core/platform/file_dialog.h"
|
||||
#include "app/core/platform/renderer.h"
|
||||
#include "app/editor/graphics/palette_editor.h"
|
||||
#include "app/editor/editor.h"
|
||||
#include "app/editor/graphics/palette_editor.h"
|
||||
#include "app/gfx/bitmap.h"
|
||||
#include "app/gfx/snes_palette.h"
|
||||
#include "app/gfx/snes_tile.h"
|
||||
@@ -21,7 +21,6 @@
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
using core::Renderer;
|
||||
@@ -52,7 +51,7 @@ using ImGui::Text;
|
||||
absl::Status Tile16Editor::InitBlockset(
|
||||
const gfx::Bitmap& tile16_blockset_bmp, const gfx::Bitmap& current_gfx_bmp,
|
||||
const std::vector<gfx::Bitmap>& tile16_individual,
|
||||
uint8_t all_tiles_types[0x200]) {
|
||||
std::array<uint8_t, 0x200>& all_tiles_types) {
|
||||
all_tiles_types_ = all_tiles_types;
|
||||
tile16_blockset_bmp_ = tile16_blockset_bmp;
|
||||
tile16_individual_ = tile16_individual;
|
||||
@@ -60,7 +59,7 @@ absl::Status Tile16Editor::InitBlockset(
|
||||
RETURN_IF_ERROR(LoadTile8());
|
||||
ImVector<std::string> tile16_names;
|
||||
for (int i = 0; i < 0x200; ++i) {
|
||||
std::string str = core::UppercaseHexByte(all_tiles_types_[i]);
|
||||
std::string str = core::HexByte(all_tiles_types_[i]);
|
||||
tile16_names.push_back(str);
|
||||
}
|
||||
|
||||
@@ -251,7 +250,7 @@ absl::Status Tile16Editor::DrawTileEditControls() {
|
||||
gui::InputHexByte("Palette", ¬ify_palette.mutable_get());
|
||||
notify_palette.apply_changes();
|
||||
if (notify_palette.modified()) {
|
||||
auto palette = palettesets_[current_palette_].main;
|
||||
auto palette = palettesets_[current_palette_].main_;
|
||||
auto value = notify_palette.get();
|
||||
if (notify_palette.get() > 0x04 && notify_palette.get() < 0x06) {
|
||||
palette = palettesets_[current_palette_].aux1;
|
||||
@@ -364,16 +363,10 @@ absl::Status Tile16Editor::UpdateTile16Transfer() {
|
||||
absl::Status Tile16Editor::UpdateTransferTileCanvas() {
|
||||
// Create a button for loading another ROM
|
||||
if (Button("Load ROM")) {
|
||||
ImGuiFileDialog::Instance()->OpenDialog(
|
||||
"ChooseTransferFileDlgKey", "Open Transfer ROM", ".sfc,.smc", ".");
|
||||
auto file_name = core::FileDialogWrapper::ShowOpenFileDialog();
|
||||
transfer_status_ = transfer_rom_.LoadFromFile(file_name);
|
||||
transfer_started_ = true;
|
||||
}
|
||||
gui::FileDialogPipeline(
|
||||
"ChooseTransferFileDlgKey", ".sfc,.smc", std::nullopt, [&]() {
|
||||
std::string filePathName =
|
||||
ImGuiFileDialog::Instance()->GetFilePathName();
|
||||
transfer_status_ = transfer_rom_.LoadFromFile(filePathName);
|
||||
transfer_started_ = true;
|
||||
});
|
||||
|
||||
// TODO: Implement tile16 transfer
|
||||
if (transfer_started_ && !transfer_blockset_loaded_) {
|
||||
@@ -400,5 +393,4 @@ absl::Status Tile16Editor::UpdateTransferTileCanvas() {
|
||||
}
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
@@ -13,18 +13,17 @@
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
/**
|
||||
* @brief Popup window to edit Tile16 data
|
||||
*/
|
||||
class Tile16Editor : public GfxContext, public SharedRom {
|
||||
class Tile16Editor : public gfx::GfxContext, public SharedRom {
|
||||
public:
|
||||
absl::Status InitBlockset(const gfx::Bitmap& tile16_blockset_bmp,
|
||||
const gfx::Bitmap& current_gfx_bmp,
|
||||
const std::vector<gfx::Bitmap>& tile16_individual,
|
||||
uint8_t all_tiles_types[0x200]);
|
||||
std::array<uint8_t, 0x200>& all_tiles_types);
|
||||
|
||||
absl::Status Update();
|
||||
absl::Status DrawMenu();
|
||||
@@ -63,7 +62,7 @@ class Tile16Editor : public GfxContext, public SharedRom {
|
||||
bool priority_tile;
|
||||
int tile_size;
|
||||
|
||||
uint8_t* all_tiles_types_;
|
||||
std::array<uint8_t, 0x200> all_tiles_types_;
|
||||
|
||||
// Tile16 blockset for selecting the tile to edit
|
||||
gui::Canvas blockset_canvas_{"blocksetCanvas", ImVec2(0x100, 0x4000),
|
||||
@@ -91,7 +90,7 @@ class Tile16Editor : public GfxContext, public SharedRom {
|
||||
PaletteEditor palette_editor_;
|
||||
|
||||
gfx::SnesPalette palette_;
|
||||
zelda3::overworld::Overworld transfer_overworld_;
|
||||
zelda3::Overworld transfer_overworld_;
|
||||
|
||||
absl::Status status_;
|
||||
|
||||
@@ -100,6 +99,5 @@ class Tile16Editor : public GfxContext, public SharedRom {
|
||||
};
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
#endif // YAZE_APP_EDITOR_TILE16EDITOR_H
|
||||
|
||||
Reference in New Issue
Block a user