12#include "yaze_config.h"
17 std::string rom_filename =
"";
18 if (!FLAGS_rom_file->Get().empty()) {
19 rom_filename = FLAGS_rom_file->Get();
23 return yaze_run_cocoa_app_delegate(rom_filename.c_str());
26 auto controller = std::make_unique<core::Controller>();
28 while (controller->IsActive()) {
29 controller->OnInput();
30 if (
auto status = controller->OnLoad(); !status.ok()) {
31 std::cerr << status.message() << std::endl;
34 controller->DoRender();
41 std::string current_version;
43 ss << YAZE_VERSION_MAJOR <<
"." << YAZE_VERSION_MINOR <<
"."
44 << YAZE_VERSION_PATCH;
45 ss >> current_version;
47 if (version != current_version) {
48 std::cout <<
"Yaze version mismatch: expected " << current_version
49 <<
", got " << version << std::endl;
57 return yaze_status::YAZE_ERROR;
61 if (yaze_ctx->
rom ==
nullptr) {
63 return yaze_status::YAZE_ERROR;
66 return yaze_status::YAZE_OK;
73 return yaze_status::YAZE_OK;
92 rom->
impl = internal_rom;
111 internal_rom->
SaveToFile(
false,
false, filename);
120 bitmap.
data =
nullptr;
125 int palette_set,
int palette,
128 color_struct.
red = 0;
129 color_struct.
green = 0;
130 color_struct.
blue = 0;
139 if (!get_color.ok()) {
142 color_struct = get_color.value().rom_color();
151 if (rom->
impl ==
nullptr) {
157 if (!internal_overworld->Load(*internal_rom).ok()) {
162 overworld->
impl = internal_overworld;
164 for (
const auto &ow_map : internal_overworld->overworld_maps()) {
166 overworld->
maps[map_id]->
id = map_id;
173 if (rom->
impl ==
nullptr) {
The Rom class is used to load, save, and modify Rom data.
absl::Status LoadFromFile(const std::string &filename, bool z3_load=true)
auto palette_group() const
absl::Status SaveToFile(bool backup, bool save_new=false, std::string filename="")
Saves the Rom data to a file.
void Parse(int argc, char **argv)
Represents the full Overworld data, light and dark world.
struct zelda3_overworld_map zelda3_overworld_map
Primitive of an overworld map.
struct zelda3_overworld zelda3_overworld
Primitive of the overworld.
#define RETURN_IF_EXCEPTION(expression)
#define EXIT_IF_ERROR(expression)
constexpr const char * kPaletteGroupAddressesKeys[]
FlagRegistry * global_flag_registry()
Primitive of 16-bit RGB SNES color.
const char * error_message
const char * rom_filename
Primitive of the overworld.
zelda3_overworld_map ** maps
zelda3_overworld * yaze_load_overworld(const zelda3_rom *rom)
void yaze_unload_rom(zelda3_rom *rom)
yaze_status yaze_shutdown(yaze_editor_context *yaze_ctx)
yaze_bitmap yaze_load_bitmap(const char *filename)
int yaze_app_main(int argc, char **argv)
yaze_status yaze_init(yaze_editor_context *yaze_ctx)
zelda3_dungeon_room * yaze_load_all_rooms(const zelda3_rom *rom)
void yaze_check_version(const char *version)
snes_color yaze_get_color_from_paletteset(const zelda3_rom *rom, int palette_set, int palette, int color)
yaze_project yaze_load_project(const char *filename)
zelda3_rom * yaze_load_rom(const char *filename)
void yaze_save_rom(zelda3_rom *rom, const char *filename)
struct zelda3_rom zelda3_rom