Refactor yaze_init and yaze_cleanup to use project ROM filename and simplify header includes
This commit is contained in:
14
src/yaze.cc
14
src/yaze.cc
@@ -16,16 +16,12 @@ void yaze_check_version(const char* version) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int yaze_init(yaze_editor_context* yaze_ctx) {
|
int yaze_init(yaze_editor_context* yaze_ctx) {
|
||||||
if (yaze_ctx->flags == nullptr) {
|
if (yaze_ctx->project->rom_filename == nullptr) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (yaze_ctx->flags->rom_filename == nullptr) {
|
yaze_ctx->rom = yaze_load_rom(yaze_ctx->project->rom_filename);
|
||||||
return -1;
|
if (yaze_ctx->rom == nullptr) {
|
||||||
}
|
|
||||||
|
|
||||||
yaze_ctx->flags->rom = yaze_load_rom(yaze_ctx->flags->rom_filename);
|
|
||||||
if (yaze_ctx->flags->rom == nullptr) {
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,8 +29,8 @@ int yaze_init(yaze_editor_context* yaze_ctx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void yaze_cleanup(yaze_editor_context* yaze_ctx) {
|
void yaze_cleanup(yaze_editor_context* yaze_ctx) {
|
||||||
if (yaze_ctx->flags->rom) {
|
if (yaze_ctx->rom) {
|
||||||
yaze_unload_rom(yaze_ctx->flags->rom);
|
yaze_unload_rom(yaze_ctx->rom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ extern "C" {
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "incl/dungeon.h"
|
#include "dungeon.h"
|
||||||
#include "incl/overworld.h"
|
#include "overworld.h"
|
||||||
#include "incl/snes_color.h"
|
#include "snes_color.h"
|
||||||
#include "incl/sprite.h"
|
#include "sprite.h"
|
||||||
|
|
||||||
typedef struct z3_rom z3_rom;
|
typedef struct z3_rom z3_rom;
|
||||||
|
|
||||||
@@ -23,6 +23,7 @@ typedef struct yaze_event_dispatcher yaze_event_dispatcher;
|
|||||||
* @brief Extension editor context.
|
* @brief Extension editor context.
|
||||||
*/
|
*/
|
||||||
typedef struct yaze_editor_context {
|
typedef struct yaze_editor_context {
|
||||||
|
z3_rom* rom;
|
||||||
yaze_project* project;
|
yaze_project* project;
|
||||||
|
|
||||||
yaze_command_registry* command_registry;
|
yaze_command_registry* command_registry;
|
||||||
|
|||||||
Reference in New Issue
Block a user