12#include "yaze_config.h"
15 "Path to the ROM file to load. "
16 "If not specified, the app will run without a ROM.");
21 std::string rom_filename =
"";
22 if (!FLAGS_rom_file->Get().empty()) {
23 rom_filename = FLAGS_rom_file->Get();
27 return yaze_run_cocoa_app_delegate(rom_filename.c_str());
30 auto controller = std::make_unique<yaze::core::Controller>();
32 while (controller->IsActive()) {
33 controller->OnInput();
34 if (
auto status = controller->OnLoad(); !status.ok()) {
35 std::cerr << status.message() << std::endl;
38 controller->DoRender();
45 std::string current_version;
47 ss << YAZE_VERSION_MAJOR <<
"." << YAZE_VERSION_MINOR <<
"."
48 << YAZE_VERSION_PATCH;
49 ss >> current_version;
51 if (version != current_version) {
52 std::cout <<
"Yaze version mismatch: expected " << current_version
53 <<
", got " << version << std::endl;
61 return yaze_status::YAZE_ERROR;
65 if (yaze_ctx->
rom ==
nullptr) {
67 return yaze_status::YAZE_ERROR;
70 return yaze_status::YAZE_OK;
77 return yaze_status::YAZE_OK;
96 rom->
impl = internal_rom;
115 if (
auto status = internal_rom->
SaveToFile(
false,
false, filename);
117 throw std::runtime_error(status.message().data());
127 bitmap.
data =
nullptr;
132 int palette_set,
int palette,
135 color_struct.
red = 0;
136 color_struct.
green = 0;
137 color_struct.
blue = 0;
144 ->palette(palette)[color];
145 color_struct = get_color.rom_color();
154 if (rom->
impl ==
nullptr) {
160 if (!internal_overworld->Load(internal_rom).ok()) {
165 overworld->
impl = internal_overworld;
167 for (
const auto &ow_map : internal_overworld->overworld_maps()) {
169 overworld->
maps[map_id]->
id = map_id;
176 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.
#define DEFINE_FLAG(type, name, default_val, help_text)
#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_overworld_map zelda3_overworld_map
Primitive of an overworld map.
struct zelda3_overworld zelda3_overworld
Primitive of the overworld.
struct zelda3_rom zelda3_rom