ReXGlue SDK
Loading...
Searching...
No Matches
export.h
Go to the documentation of this file.
1
12
13#pragma once
14
15#include <optional>
16#include <span>
17#include <string_view>
18#include <unordered_map>
19
20#include <rex/platform.h>
22#include <rex/types.h>
23
24namespace rex::kernel {
25
26enum class ExportModule : u8 {
27 kXboxkrnl,
28 kXAM,
29 kXBDM,
30};
31
32enum class ExportType : u8 {
35};
36
38 u16 ordinal;
39 ExportType type;
40 std::string_view name;
41 ::PPCFunc* fn;
42};
43
45 public:
47 void SetAddress(u16 ordinal, u32 address) { addresses_[ordinal] = address; }
48
50 u32 GetAddress(u16 ordinal) const {
51 const auto it = addresses_.find(ordinal);
52 return it == addresses_.end() ? 0 : it->second;
53 }
54
55 private:
56 std::unordered_map<u16, u32> addresses_;
57};
58
60REX_KERNEL_API std::span<const ExportEntry> GetExports(ExportModule module);
61
67REX_KERNEL_API const ExportEntry* FindByOrdinal(ExportModule module, u16 ordinal);
68
74REX_KERNEL_API bool IsNoReturnExport(ExportModule module, u16 ordinal);
75
83REX_KERNEL_API std::optional<ExportModule> ModuleFromName(std::string_view name);
84
85} // namespace rex::kernel
Definition export.h:44
void SetAddress(u16 ordinal, u32 address)
Definition export.h:47
u32 GetAddress(u16 ordinal) const
Definition export.h:50
Definition export.h:24
std::optional< ExportModule > ModuleFromName(std::string_view name)
ExportType
Definition export.h:32
@ kFunction
Definition export.h:33
@ kVariable
Definition export.h:34
bool IsNoReturnExport(ExportModule module, u16 ordinal)
std::span< const ExportEntry > GetExports(ExportModule module)
const ExportEntry * FindByOrdinal(ExportModule module, u16 ordinal)
Platform flags, packing macros and export markers.
#define REX_KERNEL_API
Definition platform.h:297
Definition export.h:37
::PPCFunc * fn
Definition export.h:41
u16 ordinal
Definition export.h:38
Integer types, byte order wrappers and size literals.