Skip to content

Commit 804f07c

Browse files
committed
feat: IDDB
1 parent f863d33 commit 804f07c

5 files changed

Lines changed: 188 additions & 188 deletions

File tree

include/REL/ID.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ namespace REL
1313
constexpr ID() noexcept = default;
1414

1515
explicit constexpr ID(std::uint64_t a_id) noexcept :
16-
_id(a_id)
16+
m_id(a_id)
1717
{}
1818

1919
constexpr ID& operator=(std::uint64_t a_id) noexcept
2020
{
21-
_id = a_id;
21+
m_id = a_id;
2222
return *this;
2323
}
2424

@@ -30,16 +30,16 @@ namespace REL
3030

3131
[[nodiscard]] constexpr std::uint64_t id() const noexcept
3232
{
33-
return _id;
33+
return m_id;
3434
}
3535

3636
[[nodiscard]] std::size_t offset() const
3737
{
3838
const auto iddb = IDDB::GetSingleton();
39-
return iddb->id2offset(_id);
39+
return iddb->offset(m_id);
4040
}
4141

4242
private:
43-
std::uint64_t _id{ static_cast<std::uint64_t>(-1) };
43+
std::uint64_t m_id{ 0 };
4444
};
4545
}

include/REL/IDDB.h

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
#include "REX/BASE.h"
44

5-
#include "REL/Version.h"
6-
75
#include "REX/REX/MemoryMap.h"
86
#include "REX/REX/Singleton.h"
97

@@ -22,42 +20,41 @@ namespace REL
2220
//OBSE,
2321
};
2422

25-
enum class Format : std::uint32_t
23+
enum class Format : std::int32_t
2624
{
27-
None = static_cast<std::uint32_t>(-1),
25+
None = std::numeric_limits<std::int32_t>::max(),
2826
V0 = 0,
2927
V1 = 1,
3028
V2 = 2,
29+
V5 = 5
3130
};
3231

3332
IDDB();
3433

35-
[[nodiscard]] std::size_t id2offset(std::uint64_t a_id) const;
34+
std::uint64_t offset(std::uint64_t a_id) const;
3635

3736
private:
38-
class istream_t;
39-
class header_t;
37+
class STREAM;
38+
class HEADER_V2;
39+
class HEADER_V5;
4040

41-
struct mapping_t
41+
struct MAPPING
4242
{
4343
std::uint64_t id;
4444
std::uint64_t offset;
4545
};
4646

47-
void load();
4847
void load_v0();
49-
void unpack_file(istream_t& a_in, const header_t& a_header);
50-
51-
protected:
52-
friend class Offset2ID;
53-
54-
[[nodiscard]] std::span<mapping_t> get_id2offset() const noexcept { return m_id2offset; }
48+
void load_v2(STREAM& a_stream);
49+
void load_v5(STREAM& a_stream);
50+
void unpack_file(STREAM& a_stream, const HEADER_V2& a_header);
5551

5652
private:
57-
Loader m_loader{ Loader::None };
58-
Format m_format{ Format::None };
59-
std::filesystem::path m_path;
60-
REX::MemoryMap m_mmap;
61-
std::span<mapping_t> m_id2offset;
53+
std::filesystem::path m_path;
54+
Loader m_loader{ Loader::None };
55+
Format m_format{ Format::None };
56+
REX::MemoryMap m_mmap;
57+
std::span<MAPPING> m_v0;
58+
std::span<std::uint32_t> m_v5;
6259
};
6360
}

include/REL/Offset2ID.h

Lines changed: 0 additions & 79 deletions
This file was deleted.

include/REL/REL.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include "REL/IDDB.h"
1010
#include "REL/Module.h"
1111
#include "REL/Offset.h"
12-
#include "REL/Offset2ID.h"
1312
#include "REL/Pattern.h"
1413
#include "REL/Relocation.h"
1514
#include "REL/Segment.h"

0 commit comments

Comments
 (0)