2023-03-28 14:36:19 +00:00
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
|
|
#include "../types.h"
|
|
|
|
#include "../Core/FsFile.h"
|
|
|
|
|
|
|
|
struct self_header
|
|
|
|
{
|
|
|
|
static const u32 signature = 0x1D3D154Fu;
|
|
|
|
|
|
|
|
u32 magic;
|
|
|
|
u08 version;
|
|
|
|
u08 mode;
|
|
|
|
u08 endian;// 1 is little endian
|
|
|
|
u08 attributes;
|
|
|
|
u08 category;
|
|
|
|
u08 program_type;
|
|
|
|
u16 padding1;
|
|
|
|
u16 header_size;
|
|
|
|
u16 meta_size;
|
|
|
|
u32 file_size;
|
|
|
|
u32 padding2;
|
|
|
|
u16 segment_count;
|
|
|
|
u16 unknown1A; //always 0x22
|
|
|
|
u32 padding3;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct self_segment_header
|
|
|
|
{
|
|
|
|
u64 flags;
|
2023-03-30 14:38:37 +00:00
|
|
|
u64 file_offset;
|
|
|
|
u64 file_size;
|
|
|
|
u64 memory_size;
|
2023-03-28 14:36:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class Elf
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
void Open(const std::string & file_name);
|
2023-03-28 16:21:34 +00:00
|
|
|
bool isSelfFile() const;
|
|
|
|
void DebugDump();
|
2023-03-28 14:36:19 +00:00
|
|
|
private:
|
|
|
|
FsFile* m_f = nullptr;
|
|
|
|
self_header* m_self = nullptr;
|
2023-03-30 14:38:37 +00:00
|
|
|
self_segment_header* m_self_segments = nullptr;
|
2023-03-28 14:36:19 +00:00
|
|
|
};
|
|
|
|
|