Files
ctrff-pub/include/ctrff/3dsx.hpp

47 lines
1.1 KiB
C++
Raw Permalink Normal View History

2025-05-04 13:32:07 +02:00
#pragma once
#include <ctrff/helper.hpp>
#include <ctrff/smdh.hpp>
#include <ctrff/types.hpp>
2025-05-04 13:32:07 +02:00
namespace ctrff {
class CTRFF_API _3dsx : public BinFile {
public:
_3dsx() {}
~_3dsx() {}
void Load(const std::string& path) {
std::fstream f(path, std::ios::in | std::ios::binary);
Read(f);
f.close();
}
bool HasMeta() { return SMDHSize == SMDH_Size; }
/** Write not supported btw */
void Write(std::fstream& f) const override;
void Read(std::fstream& f) override;
ctrff::u32 Magic;
ctrff::u16 HeaderSize;
ctrff::u16 RelocHeaderSize;
ctrff::u32 FormatVersion;
ctrff::u32 Flags;
2025-05-04 13:32:07 +02:00
// Sizes of the code, rodata and data segments +
// size of the BSS section (uninitialized latter half of the data segment)
ctrff::u32 CodeSegSize;
ctrff::u32 RodataSegSize;
ctrff::u32 DataSegSize;
ctrff::u32 BssSize;
2025-05-04 13:32:07 +02:00
/// Extended Header ///
// smdh offset
ctrff::u32 SMDHOff;
2025-05-04 13:32:07 +02:00
// smdh size
ctrff::u32 SMDHSize;
2025-05-04 13:32:07 +02:00
// fs offset
ctrff::u32 FsOff;
2025-05-04 13:32:07 +02:00
SMDH Meta;
};
/** Probably only germen people will understand */
using DreiDSX = _3dsx;
} // namespace ctrff