2023-03-02 10:41:32 -05:00
|
|
|
// Copyright 2023 xensik. All rights reserved.
|
|
|
|
//
|
|
|
|
// Use of this source code is governed by a GNU GPLv3 license
|
|
|
|
// that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
namespace xsk::arc
|
|
|
|
{
|
|
|
|
|
2023-05-13 13:24:57 -04:00
|
|
|
constexpr usize header_size_v1 = 64;
|
|
|
|
constexpr usize header_size_v2 = 72;
|
|
|
|
constexpr usize header_size_v3 = 0;
|
|
|
|
|
|
|
|
enum class string_type : u8
|
|
|
|
{
|
|
|
|
literal = 0,
|
|
|
|
canonical = 1,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class param_type : u8
|
|
|
|
{
|
|
|
|
value = 0,
|
|
|
|
reference = 1,
|
|
|
|
vararg = 2,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class export_flags : u8
|
|
|
|
{
|
|
|
|
export_none = 0x00,
|
|
|
|
export_public = 0x01,
|
|
|
|
export_autoexec = 0x02,
|
|
|
|
export_private = 0x04,
|
|
|
|
export_codecall = 0x08,
|
|
|
|
export_private2 = 0x10,
|
|
|
|
export_varargs = 0x20,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class import_flags : u8
|
|
|
|
{
|
|
|
|
none = 0,
|
|
|
|
func_reference = 1,
|
|
|
|
func_call = 2,
|
|
|
|
func_call_thread = 3,
|
|
|
|
meth_call = 4,
|
|
|
|
meth_call_thread = 5,
|
|
|
|
developer = 0x10,
|
|
|
|
unk = 0x20, // T7, T8, T9
|
|
|
|
};
|
2023-03-02 10:41:32 -05:00
|
|
|
|
|
|
|
struct header
|
|
|
|
{
|
|
|
|
u64 magic;
|
|
|
|
u32 source_crc;
|
|
|
|
u32 include_offset;
|
|
|
|
u32 animtree_offset;
|
|
|
|
u32 cseg_offset;
|
|
|
|
u32 stringtablefixup_offset;
|
|
|
|
u32 devblock_stringtablefixup_offset;
|
|
|
|
u32 exports_offset;
|
|
|
|
u32 imports_offset;
|
|
|
|
u32 fixup_offset;
|
2023-05-13 13:24:57 -04:00
|
|
|
u32 globalvar_offset;
|
2023-03-02 10:41:32 -05:00
|
|
|
u32 profile_offset;
|
|
|
|
u32 cseg_size;
|
|
|
|
u32 name;
|
|
|
|
u16 stringtablefixup_count;
|
|
|
|
u16 exports_count;
|
|
|
|
u16 imports_count;
|
|
|
|
u16 fixup_count;
|
2023-05-13 13:24:57 -04:00
|
|
|
u16 globalvar_count;
|
2023-03-02 10:41:32 -05:00
|
|
|
u16 profile_count;
|
|
|
|
u16 devblock_stringtablefixup_count;
|
|
|
|
u8 include_count;
|
|
|
|
u8 animtree_count;
|
|
|
|
u8 flags;
|
|
|
|
};
|
|
|
|
|
2023-05-13 13:24:57 -04:00
|
|
|
struct animation_ref
|
2023-03-02 10:41:32 -05:00
|
|
|
{
|
|
|
|
std::string name;
|
2023-05-13 13:24:57 -04:00
|
|
|
u32 ref;
|
2023-03-02 10:41:32 -05:00
|
|
|
};
|
|
|
|
|
2023-05-13 13:24:57 -04:00
|
|
|
struct animtree_ref
|
2023-03-02 10:41:32 -05:00
|
|
|
{
|
2023-05-13 13:24:57 -04:00
|
|
|
using ptr = std::shared_ptr<animtree_ref>;
|
2023-03-02 10:41:32 -05:00
|
|
|
|
|
|
|
std::string name;
|
2023-05-13 13:24:57 -04:00
|
|
|
std::vector<u32> refs;
|
|
|
|
std::vector<animation_ref> anims;
|
2023-03-02 10:41:32 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
struct string_ref
|
|
|
|
{
|
|
|
|
using ptr = std::shared_ptr<string_ref>;
|
|
|
|
|
|
|
|
std::string name;
|
|
|
|
u8 type;
|
|
|
|
std::vector<u32> refs;
|
|
|
|
};
|
|
|
|
|
2023-05-13 13:24:57 -04:00
|
|
|
struct import_ref
|
2023-03-02 10:41:32 -05:00
|
|
|
{
|
2023-05-13 13:24:57 -04:00
|
|
|
using ptr = std::shared_ptr<import_ref>;
|
2023-03-02 10:41:32 -05:00
|
|
|
|
2023-05-13 13:24:57 -04:00
|
|
|
std::string space;
|
2023-03-02 10:41:32 -05:00
|
|
|
std::string name;
|
2023-05-13 13:24:57 -04:00
|
|
|
u8 params;
|
|
|
|
u8 flags;
|
|
|
|
std::vector<u32> refs;
|
2023-03-02 10:41:32 -05:00
|
|
|
};
|
|
|
|
|
2023-05-13 13:24:57 -04:00
|
|
|
struct export_ref
|
2023-03-02 10:41:32 -05:00
|
|
|
{
|
2023-05-13 13:24:57 -04:00
|
|
|
using ptr = std::shared_ptr<export_ref>;
|
2023-03-02 10:41:32 -05:00
|
|
|
|
2023-05-13 13:24:57 -04:00
|
|
|
std::string space;
|
2023-03-02 10:41:32 -05:00
|
|
|
std::string name;
|
2023-05-13 13:24:57 -04:00
|
|
|
u32 checksum;
|
|
|
|
u32 offset;
|
|
|
|
u32 size;
|
|
|
|
u8 params;
|
|
|
|
u8 flags;
|
2023-03-02 10:41:32 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace xsk::arc
|