libnedit
Lightweight C++ library for Nintendo DS(i) formats
Loading...
Searching...
No Matches
fmt_NSCR.hpp
1
2#pragma once
3#include <ntr/fmt/fmt_Common.hpp>
4#include <ntr/gfx/gfx_Base.hpp>
5
6namespace ntr::fmt {
7
8 struct NSCR : public fs::FileFormat {
9
10 struct Header : public CommonHeader<0x4E534352 /* "RCSN" */ > {
11 };
12
13 struct ScreenDataBlock : public CommonBlock<0x5343524E /* "NRCS" */ > {
14 u16 screen_width;
15 u16 screen_height;
16 gfx::ScreenColorMode screen_color_mode;
17 gfx::ScreenFormat screen_format;
18 u32 data_size;
19 };
20
21 Header header;
22 ScreenDataBlock screen_data;
23 u8 *data;
24
25 NSCR() : data(nullptr) {}
26 NSCR(const NSCR&) = delete;
27
28 ~NSCR() {
29 if(this->data != nullptr) {
30 delete[] this->data;
31 this->data = nullptr;
32 }
33 }
34
35 Result ValidateImpl(const std::string &path, std::shared_ptr<fs::FileHandle> file_handle, const fs::FileCompression comp) override;
36 Result ReadImpl(const std::string &path, std::shared_ptr<fs::FileHandle> file_handle, const fs::FileCompression comp) override;
37
38 Result WriteImpl(const std::string &path, std::shared_ptr<fs::FileHandle> file_handle, const fs::FileCompression comp) override {
39 NTR_R_FAIL(ResultNSCRWriteNotSupported);
40 }
41 };
42
43}
Definition fmt_Common.hpp:53
Definition fmt_Common.hpp:35
Definition fmt_NSCR.hpp:10
Definition fmt_NSCR.hpp:13
Definition fmt_NSCR.hpp:8
Definition fs_Base.hpp:45