Files
yaze/src/app/gfx/scad_format.h
scawful ba50d89e7d Update z3ed CLI tool and project build configuration
- Updated `.clang-tidy` and `.clangd` configurations for improved code quality checks and diagnostics.
- Added new submodules for JSON and HTTP libraries to support future features.
- Refined README and documentation files to standardize naming conventions and improve clarity.
- Introduced a new command palette in the CLI for easier command access and execution.
- Implemented various CLI handlers for managing ROM, sprites, palettes, and dungeon functionalities.
- Enhanced the TUI components for better user interaction and command execution.
- Added AI service integration for generating commands based on user prompts, expanding the CLI's capabilities.
2025-10-01 08:57:10 -04:00

106 lines
2.8 KiB
C++

#ifndef YAZE_APP_GFX_scad_format_H
#define YAZE_APP_GFX_scad_format_H
#include <SDL.h>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <string>
#include <unordered_map>
#include <vector>
#include "absl/status/status.h"
namespace yaze {
namespace gfx {
/**
* @brief Cgx file header
*
* @details
* キャラクタ(.SCH)ファイル
* ヘッダー情報
* アドレス 説明
* 00000 - 00003 ファイルタイプ "SCH"
* 00004 - 00008 ビットモード "?BIT"
* 00009 - 00013 バージョンナンバー "Ver-????\n"
* 00014 - 00017 ヘッダーサイズ
* 00018 - 0001B ハード名 "SFC" or "CGB" or "GB"
* 0001C - 0001C BG/OBJフラグ(AGBの時)
* 0001D - 0001D Color Pallette Number
* 0001D - 000FF 予約
* 00100 - 001FF Color Path
*/
struct CgxHeader {
char file_type[4];
char bit_mode[5];
char version_number[9];
uint32_t header_size;
char hardware_name[4];
uint8_t bg_obj_flag;
uint8_t color_palette_number;
uint8_t reserved[0xE3];
uint8_t color_path[0x100];
};
constexpr uint16_t kMatchedBytes[] = {0x4E, 0x41, 0x4B, 0x31, 0x39, 0x38, 0x39};
constexpr uint16_t kOffsetFromMatchedBytesEnd = 0x1D;
/**
* @brief Find metastamp in CGX file
*/
void FindMetastamp();
/**
* @brief Load Scr file (screen data)
*/
absl::Status LoadScr(std::string_view filename, uint8_t input_value,
std::vector<uint8_t>& map_data);
/**
* @brief Load Cgx file (graphical content)
*/
absl::Status LoadCgx(uint8_t bpp, std::string_view filename,
std::vector<uint8_t>& cgx_data,
std::vector<uint8_t>& cgx_loaded,
std::vector<uint8_t>& cgx_header);
/**
* @brief Draw screen tilemap with graphical data
*/
absl::Status DrawScrWithCgx(uint8_t bpp, std::vector<uint8_t>& map_bitmap_data,
std::vector<uint8_t>& map_data,
std::vector<uint8_t>& cgx_loaded);
/**
* @brief Save Cgx file (graphical content)
*/
absl::Status SaveCgx(uint8_t bpp, std::string_view filename,
const std::vector<uint8_t>& cgx_data,
const std::vector<uint8_t>& cgx_header);
/**
* @brief Decode color file
*/
std::vector<SDL_Color> DecodeColFile(const std::string_view filename);
/**
* @brief Decode obj file
*/
absl::Status DecodeObjFile(
std::string_view filename, std::vector<uint8_t>& obj_data,
std::vector<uint8_t> actual_obj_data,
std::unordered_map<std::string, std::vector<uint8_t>> decoded_obj,
std::vector<uint8_t>& decoded_extra_obj, int& obj_loaded);
/**
* @brief Save Col file (palette data)
*/
absl::Status SaveCol(std::string_view filename, const std::vector<SDL_Color>& palette);
} // namespace gfx
} // namespace yaze
#endif // YAZE_APP_GFX_scad_format_H