2017-07-06 10:57:33 +00:00
|
|
|
#pragma once
|
|
|
|
#include <string>
|
2018-06-24 08:18:54 +00:00
|
|
|
#include <fnd/ISerialisable.h>
|
2017-07-17 08:21:39 +00:00
|
|
|
#include <fnd/List.h>
|
2018-06-24 08:18:54 +00:00
|
|
|
#include <nx/fac.h>
|
2017-07-06 10:57:33 +00:00
|
|
|
|
2017-07-06 11:17:21 +00:00
|
|
|
namespace nx
|
2017-07-06 10:57:33 +00:00
|
|
|
{
|
2017-07-06 11:17:21 +00:00
|
|
|
class FacHeader :
|
2018-06-24 08:18:54 +00:00
|
|
|
public fnd::ISerialisable
|
2017-07-06 10:57:33 +00:00
|
|
|
{
|
2017-07-06 11:17:21 +00:00
|
|
|
public:
|
2018-06-24 08:18:54 +00:00
|
|
|
struct sSection
|
2017-07-17 08:21:39 +00:00
|
|
|
{
|
2018-06-24 08:18:54 +00:00
|
|
|
size_t offset;
|
|
|
|
size_t size;
|
|
|
|
|
|
|
|
void operator=(const sSection& other)
|
|
|
|
{
|
|
|
|
offset = other.offset;
|
|
|
|
size = other.size;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator==(const sSection& other) const
|
|
|
|
{
|
|
|
|
return (offset == other.offset) \
|
|
|
|
&& (size == other.size);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator!=(const sSection& other) const
|
|
|
|
{
|
|
|
|
return !operator==(other);
|
|
|
|
}
|
2017-07-17 08:21:39 +00:00
|
|
|
};
|
|
|
|
|
2017-07-06 11:17:21 +00:00
|
|
|
FacHeader();
|
|
|
|
FacHeader(const FacHeader& other);
|
|
|
|
|
2018-06-24 08:18:54 +00:00
|
|
|
void operator=(const FacHeader& other);
|
2017-07-06 11:17:21 +00:00
|
|
|
bool operator==(const FacHeader& other) const;
|
|
|
|
bool operator!=(const FacHeader& other) const;
|
|
|
|
|
|
|
|
// export/import binary
|
2018-06-24 08:18:54 +00:00
|
|
|
void toBytes();
|
|
|
|
void fromBytes(const byte_t* bytes, size_t len);
|
|
|
|
const fnd::Vec<byte_t>& getBytes() const;
|
2017-07-06 11:17:21 +00:00
|
|
|
|
|
|
|
// variables
|
2017-07-15 08:28:01 +00:00
|
|
|
void clear();
|
|
|
|
size_t getFacSize() const;
|
2017-07-06 11:17:21 +00:00
|
|
|
|
2018-03-22 05:26:22 +00:00
|
|
|
uint32_t getFormatVersion() const;
|
|
|
|
void setFormatVersion(uint32_t version);
|
2017-07-17 08:21:39 +00:00
|
|
|
|
2018-06-24 08:18:54 +00:00
|
|
|
const fnd::List<fac::FsAccessFlag>& getFsaRightsList() const;
|
|
|
|
void setFsaRightsList(const fnd::List<fac::FsAccessFlag>& list);
|
2017-07-06 11:17:21 +00:00
|
|
|
|
2018-06-24 08:18:54 +00:00
|
|
|
const sSection& getContentOwnerIdPos() const;
|
2018-06-25 12:13:52 +00:00
|
|
|
void setContentOwnerIdPos(const sSection& pos);
|
2017-07-06 11:17:21 +00:00
|
|
|
|
2018-06-24 08:18:54 +00:00
|
|
|
const sSection& getSaveDataOwnerIdPos() const;;
|
2018-06-25 12:13:52 +00:00
|
|
|
void setSaveDataOwnerIdPos(const sSection& pos);
|
2017-07-06 11:17:21 +00:00
|
|
|
|
2017-07-06 10:57:33 +00:00
|
|
|
private:
|
2017-07-06 11:17:21 +00:00
|
|
|
const std::string kModuleName = "FAC_HEADER";
|
2018-06-24 08:18:54 +00:00
|
|
|
|
2017-07-06 11:17:21 +00:00
|
|
|
// raw binary
|
2018-06-24 08:18:54 +00:00
|
|
|
fnd::Vec<byte_t> mRawBinary;
|
2017-07-06 11:17:21 +00:00
|
|
|
|
|
|
|
// variables
|
2018-03-22 05:26:22 +00:00
|
|
|
uint32_t mVersion;
|
2018-06-24 08:18:54 +00:00
|
|
|
fnd::List<fac::FsAccessFlag> mFsaRights;
|
|
|
|
sSection mContentOwnerIdPos;
|
|
|
|
sSection mSaveDataOwnerIdPos;
|
2017-07-06 11:17:21 +00:00
|
|
|
};
|
|
|
|
}
|
2017-07-06 10:57:33 +00:00
|
|
|
|