- Updated the Rom class to use core::ResourceLabelManager for better namespace clarity. - Introduced a comprehensive YazeProject structure consolidating project metadata, settings, and resource management. - Enhanced project management capabilities with methods for creating, opening, saving, and validating projects. - Implemented support for ZScream project format import and export, improving compatibility with existing projects. - Added workspace settings and feature flags to streamline user configurations and project setup.
44 lines
1.3 KiB
C++
44 lines
1.3 KiB
C++
#ifndef YAZE_APP_EDITOR_SAFEGUARDS_H
|
|
#define YAZE_APP_EDITOR_SAFEGUARDS_H
|
|
|
|
#include "absl/status/status.h"
|
|
#include "absl/strings/str_format.h"
|
|
#include "app/rom.h"
|
|
|
|
namespace yaze {
|
|
namespace editor {
|
|
|
|
// Macro for checking ROM loading state in editor methods
|
|
#define REQUIRE_ROM_LOADED(rom_ptr, operation) \
|
|
do { \
|
|
if (!(rom_ptr) || !(rom_ptr)->is_loaded()) { \
|
|
return absl::FailedPreconditionError( \
|
|
absl::StrFormat("%s: ROM not loaded", (operation))); \
|
|
} \
|
|
} while (0)
|
|
|
|
// Macro for ROM state checking with custom error message
|
|
#define CHECK_ROM_STATE(rom_ptr, message) \
|
|
do { \
|
|
if (!(rom_ptr) || !(rom_ptr)->is_loaded()) { \
|
|
return absl::FailedPreconditionError(message); \
|
|
} \
|
|
} while (0)
|
|
|
|
// Helper function for generating consistent ROM status messages
|
|
inline std::string GetRomStatusMessage(const Rom* rom) {
|
|
if (!rom) return "No ROM loaded";
|
|
if (!rom->is_loaded()) return "ROM failed to load";
|
|
return absl::StrFormat("ROM loaded: %s", rom->title());
|
|
}
|
|
|
|
// Helper function to check if ROM is in a valid state for editing
|
|
inline bool IsRomReadyForEditing(const Rom* rom) {
|
|
return rom && rom->is_loaded() && !rom->title().empty();
|
|
}
|
|
|
|
} // namespace editor
|
|
} // namespace yaze
|
|
|
|
#endif // YAZE_APP_EDITOR_SAFEGUARDS_H
|