yaze 0.2.0
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
scad_format.h
Go to the documentation of this file.
1#ifndef YAZE_APP_GFX_scad_format_H
2#define YAZE_APP_GFX_scad_format_H
3
4#include <SDL.h>
5
6#include <cmath>
7#include <cstdint>
8#include <cstdlib>
9#include <cstring>
10#include <fstream>
11#include <iostream>
12#include <memory>
13#include <string>
14#include <unordered_map>
15#include <vector>
16
17#include "absl/status/status.h"
18#include "absl/status/statusor.h"
19#include "app/core/constants.h"
20
21namespace yaze {
22namespace app {
23namespace gfx {
24
29namespace scad_format {
30
46struct CgxHeader {
47 char file_type[4];
48 char bit_mode[5];
50 uint32_t header_size;
52 uint8_t bg_obj_flag;
54 uint8_t reserved[0xE3];
55 uint8_t color_path[0x100];
56};
57
58constexpr uint16_t kMatchedBytes[] = {0x4E, 0x41, 0x4B, 0x31, 0x39, 0x38, 0x39};
59constexpr uint16_t kOffsetFromMatchedBytesEnd = 0x1D;
60
64void FindMetastamp();
65
69absl::Status LoadScr(std::string_view filename, uint8_t input_value,
70 std::vector<uint8_t>& map_data);
71
75absl::Status LoadCgx(uint8_t bpp, std::string_view filename,
76 std::vector<uint8_t>& cgx_data,
77 std::vector<uint8_t>& cgx_loaded,
78 std::vector<uint8_t>& cgx_header);
79
83absl::Status DrawScrWithCgx(uint8_t bpp, std::vector<uint8_t>& map_bitmap_data,
84 std::vector<uint8_t>& map_data,
85 std::vector<uint8_t>& cgx_loaded);
86
90std::vector<SDL_Color> DecodeColFile(const std::string_view filename);
91
95absl::Status DecodeObjFile(
96 std::string_view filename, std::vector<uint8_t>& obj_data,
97 std::vector<uint8_t> actual_obj_data,
98 std::unordered_map<std::string, std::vector<uint8_t>> decoded_obj,
99 std::vector<uint8_t>& decoded_extra_obj, int& obj_loaded);
100
101} // namespace scad_format
102} // namespace gfx
103} // namespace app
104} // namespace yaze
105
106#endif // YAZE_APP_GFX_scad_format_H
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)
Load Cgx file (graphical content)
std::vector< SDL_Color > DecodeColFile(const std::string_view filename)
Decode color 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)
Decode obj file.
absl::Status LoadScr(std::string_view filename, uint8_t input_value, std::vector< uint8_t > &map_data)
Load Scr file (screen data)
void FindMetastamp()
Find metastamp in CGX file.
constexpr uint16_t kMatchedBytes[]
Definition scad_format.h:58
absl::Status DrawScrWithCgx(uint8_t bpp, std::vector< uint8_t > &map_data, std::vector< uint8_t > &map_bitmap_data, std::vector< uint8_t > &cgx_loaded)
Draw screen tilemap with graphical data.
constexpr uint16_t kOffsetFromMatchedBytesEnd
Definition scad_format.h:59
Definition common.cc:22
Cgx file header キャラクタ(.SCH)ファイル ヘッダー情報 アドレス 説明 00000 - 00003 ファイルタイプ "SCH" 00004 - 00008 ビットモード "?...
Definition scad_format.h:46