mirror of
https://github.com/hedge-dev/XenonRecomp.git
synced 2025-06-20 14:35:08 +00:00
Format Headers
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
This commit is contained in:
parent
10b627e986
commit
f9fbd822ff
@ -13,10 +13,10 @@ struct Function
|
||||
{
|
||||
struct Block
|
||||
{
|
||||
size_t base{};
|
||||
size_t size{};
|
||||
size_t projectedSize{ static_cast<size_t>(-1) }; // scratch
|
||||
DEBUG(size_t parent{});
|
||||
size_t base {};
|
||||
size_t size {};
|
||||
size_t projectedSize { static_cast<size_t>(-1) }; // scratch
|
||||
DEBUG(size_t parent {});
|
||||
|
||||
Block()
|
||||
{
|
||||
@ -33,9 +33,9 @@ struct Function
|
||||
}
|
||||
};
|
||||
|
||||
size_t base{};
|
||||
size_t size{};
|
||||
std::vector<Block> blocks{};
|
||||
size_t base {};
|
||||
size_t size {};
|
||||
std::vector<Block> blocks {};
|
||||
|
||||
Function()
|
||||
{
|
||||
|
@ -2,11 +2,12 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
#include <charconv>
|
||||
#include <cstddef>
|
||||
#include <disasm.h>
|
||||
#include <file.h>
|
||||
#include <filesystem>
|
||||
#include <fmt/core.h>
|
||||
#include <fstream>
|
||||
#include <function.h>
|
||||
#include <image.h>
|
||||
@ -14,6 +15,5 @@
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
#include <xbox.h>
|
||||
#include <xxhash.h>
|
||||
#include <fmt/core.h>
|
||||
#include <xmmintrin.h>
|
||||
#include <xxhash.h>
|
||||
|
@ -5,17 +5,17 @@
|
||||
|
||||
struct RecompilerLocalVariables
|
||||
{
|
||||
bool ctr{};
|
||||
bool xer{};
|
||||
bool reserved{};
|
||||
bool cr[8]{};
|
||||
bool r[32]{};
|
||||
bool f[32]{};
|
||||
bool v[128]{};
|
||||
bool env{};
|
||||
bool temp{};
|
||||
bool vTemp{};
|
||||
bool ea{};
|
||||
bool ctr {};
|
||||
bool xer {};
|
||||
bool reserved {};
|
||||
bool cr[8] {};
|
||||
bool r[32] {};
|
||||
bool f[32] {};
|
||||
bool v[128] {};
|
||||
bool env {};
|
||||
bool temp {};
|
||||
bool vTemp {};
|
||||
bool ea {};
|
||||
};
|
||||
|
||||
enum class CSRState
|
||||
|
@ -4,9 +4,9 @@
|
||||
|
||||
namespace ppc
|
||||
{
|
||||
struct DisassemblerEngine
|
||||
{
|
||||
disassemble_info info{};
|
||||
struct DisassemblerEngine
|
||||
{
|
||||
disassemble_info info {};
|
||||
DisassemblerEngine(const DisassemblerEngine&) = default;
|
||||
DisassemblerEngine& operator=(const DisassemblerEngine&) = delete;
|
||||
|
||||
@ -17,19 +17,19 @@ namespace ppc
|
||||
* \return Numbers of bytes decoded
|
||||
*/
|
||||
int Disassemble(const void* code, size_t size, uint64_t base, ppc_insn& out);
|
||||
};
|
||||
};
|
||||
|
||||
thread_local extern DisassemblerEngine gBigEndianDisassembler;
|
||||
thread_local extern DisassemblerEngine gBigEndianDisassembler;
|
||||
|
||||
static int Disassemble(const void* code, size_t size, uint64_t base, ppc_insn& out)
|
||||
{
|
||||
static int Disassemble(const void* code, size_t size, uint64_t base, ppc_insn& out)
|
||||
{
|
||||
return gBigEndianDisassembler.Disassemble(code, size, base, out);
|
||||
}
|
||||
|
||||
static int Disassemble(const void* code, uint64_t base, ppc_insn& out)
|
||||
{
|
||||
return Disassemble(code, 4, base, out);
|
||||
}
|
||||
|
||||
static int Disassemble(const void* code, uint64_t base, ppc_insn* out, size_t nOut);
|
||||
}
|
||||
|
||||
static int Disassemble(const void* code, uint64_t base, ppc_insn& out)
|
||||
{
|
||||
return Disassemble(code, 4, base, out);
|
||||
}
|
||||
|
||||
static int Disassemble(const void* code, uint64_t base, ppc_insn* out, size_t nOut);
|
||||
} // namespace ppc
|
||||
|
@ -46,7 +46,6 @@ typedef __s64 Elf64_Sxword;
|
||||
#define PT_GNU_RELRO (PT_LOOS + 0x474e552)
|
||||
#define PT_GNU_PROPERTY (PT_LOOS + 0x474e553)
|
||||
|
||||
|
||||
/* ARM MTE memory tag segment type */
|
||||
#define PT_AARCH64_MEMTAG_MTE (PT_LOPROC + 0x2)
|
||||
|
||||
@ -72,7 +71,7 @@ typedef __s64 Elf64_Sxword;
|
||||
*/
|
||||
#define PN_XNUM 0xffff
|
||||
|
||||
/* These constants define the different elf file types */
|
||||
/* These constants define the different elf file types */
|
||||
#define ET_NONE 0
|
||||
#define ET_REL 1
|
||||
#define ET_EXEC 2
|
||||
@ -146,17 +145,21 @@ typedef __s64 Elf64_Sxword;
|
||||
#define ELF64_ST_BIND(x) ELF_ST_BIND(x)
|
||||
#define ELF64_ST_TYPE(x) ELF_ST_TYPE(x)
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
Elf32_Sword d_tag;
|
||||
union {
|
||||
union
|
||||
{
|
||||
Elf32_Sword d_val;
|
||||
Elf32_Addr d_ptr;
|
||||
} d_un;
|
||||
} Elf32_Dyn;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
Elf64_Sxword d_tag; /* entry tag value */
|
||||
union {
|
||||
union
|
||||
{
|
||||
Elf64_Xword d_val;
|
||||
Elf64_Addr d_ptr;
|
||||
} d_un;
|
||||
@ -169,29 +172,34 @@ typedef struct {
|
||||
#define ELF64_R_SYM(i) ((i) >> 32)
|
||||
#define ELF64_R_TYPE(i) ((i) & 0xffffffff)
|
||||
|
||||
typedef struct elf32_rel {
|
||||
typedef struct elf32_rel
|
||||
{
|
||||
Elf32_Addr r_offset;
|
||||
Elf32_Word r_info;
|
||||
} Elf32_Rel;
|
||||
|
||||
typedef struct elf64_rel {
|
||||
typedef struct elf64_rel
|
||||
{
|
||||
Elf64_Addr r_offset; /* Location at which to apply the action */
|
||||
Elf64_Xword r_info; /* index and type of relocation */
|
||||
} Elf64_Rel;
|
||||
|
||||
typedef struct elf32_rela {
|
||||
typedef struct elf32_rela
|
||||
{
|
||||
Elf32_Addr r_offset;
|
||||
Elf32_Word r_info;
|
||||
Elf32_Sword r_addend;
|
||||
} Elf32_Rela;
|
||||
|
||||
typedef struct elf64_rela {
|
||||
typedef struct elf64_rela
|
||||
{
|
||||
Elf64_Addr r_offset; /* Location at which to apply the action */
|
||||
Elf64_Xword r_info; /* index and type of relocation */
|
||||
Elf64_Sxword r_addend; /* Constant addend used to compute value */
|
||||
} Elf64_Rela;
|
||||
|
||||
typedef struct elf32_sym {
|
||||
typedef struct elf32_sym
|
||||
{
|
||||
Elf32_Word st_name;
|
||||
Elf32_Addr st_value;
|
||||
Elf32_Word st_size;
|
||||
@ -200,7 +208,8 @@ typedef struct elf32_sym {
|
||||
Elf32_Half st_shndx;
|
||||
} Elf32_Sym;
|
||||
|
||||
typedef struct elf64_sym {
|
||||
typedef struct elf64_sym
|
||||
{
|
||||
Elf64_Word st_name; /* Symbol name, index in string tbl */
|
||||
unsigned char st_info; /* Type and binding attributes */
|
||||
unsigned char st_other; /* No defined meaning, 0 */
|
||||
@ -209,10 +218,10 @@ typedef struct elf64_sym {
|
||||
Elf64_Xword st_size; /* Associated symbol size */
|
||||
} Elf64_Sym;
|
||||
|
||||
|
||||
#define EI_NIDENT 16
|
||||
|
||||
typedef struct elf32_hdr {
|
||||
typedef struct elf32_hdr
|
||||
{
|
||||
unsigned char e_ident[EI_NIDENT];
|
||||
Elf32_Half e_type;
|
||||
Elf32_Half e_machine;
|
||||
@ -229,7 +238,8 @@ typedef struct elf32_hdr {
|
||||
Elf32_Half e_shstrndx;
|
||||
} Elf32_Ehdr;
|
||||
|
||||
typedef struct elf64_hdr {
|
||||
typedef struct elf64_hdr
|
||||
{
|
||||
unsigned char e_ident[EI_NIDENT]; /* ELF "magic number" */
|
||||
Elf64_Half e_type;
|
||||
Elf64_Half e_machine;
|
||||
@ -252,7 +262,8 @@ typedef struct elf64_hdr {
|
||||
#define PF_W 0x2
|
||||
#define PF_X 0x1
|
||||
|
||||
typedef struct elf32_phdr {
|
||||
typedef struct elf32_phdr
|
||||
{
|
||||
Elf32_Word p_type;
|
||||
Elf32_Off p_offset;
|
||||
Elf32_Addr p_vaddr;
|
||||
@ -263,7 +274,8 @@ typedef struct elf32_phdr {
|
||||
Elf32_Word p_align;
|
||||
} Elf32_Phdr;
|
||||
|
||||
typedef struct elf64_phdr {
|
||||
typedef struct elf64_phdr
|
||||
{
|
||||
Elf64_Word p_type;
|
||||
Elf64_Word p_flags;
|
||||
Elf64_Off p_offset; /* Segment file offset */
|
||||
@ -311,7 +323,8 @@ typedef struct elf64_phdr {
|
||||
#define SHN_COMMON 0xfff2
|
||||
#define SHN_HIRESERVE 0xffff
|
||||
|
||||
typedef struct elf32_shdr {
|
||||
typedef struct elf32_shdr
|
||||
{
|
||||
Elf32_Word sh_name;
|
||||
Elf32_Word sh_type;
|
||||
Elf32_Word sh_flags;
|
||||
@ -324,7 +337,8 @@ typedef struct elf32_shdr {
|
||||
Elf32_Word sh_entsize;
|
||||
} Elf32_Shdr;
|
||||
|
||||
typedef struct elf64_shdr {
|
||||
typedef struct elf64_shdr
|
||||
{
|
||||
Elf64_Word sh_name; /* Section name, index in string tbl */
|
||||
Elf64_Word sh_type; /* Type of section */
|
||||
Elf64_Xword sh_flags; /* Miscellaneous section attributes */
|
||||
@ -386,7 +400,7 @@ typedef struct elf64_shdr {
|
||||
#define NT_PRPSINFO 3
|
||||
#define NT_TASKSTRUCT 4
|
||||
#define NT_AUXV 6
|
||||
/*
|
||||
/*
|
||||
* Note to userspace developers: size of NT_SIGINFO note may increase
|
||||
* in the future to accomodate more fields, don't assume it is fixed!
|
||||
*/
|
||||
@ -466,14 +480,16 @@ typedef struct elf64_shdr {
|
||||
#define NT_GNU_PROPERTY_TYPE_0 5
|
||||
|
||||
/* Note header in a PT_NOTE section */
|
||||
typedef struct elf32_note {
|
||||
typedef struct elf32_note
|
||||
{
|
||||
Elf32_Word n_namesz; /* Name size */
|
||||
Elf32_Word n_descsz; /* Content size */
|
||||
Elf32_Word n_type; /* Content type */
|
||||
} Elf32_Nhdr;
|
||||
|
||||
/* Note header in a PT_NOTE section */
|
||||
typedef struct elf64_note {
|
||||
typedef struct elf64_note
|
||||
{
|
||||
Elf64_Word n_namesz; /* Name size */
|
||||
Elf64_Word n_descsz; /* Content size */
|
||||
Elf64_Word n_type; /* Content type */
|
||||
|
@ -18,7 +18,7 @@ inline std::vector<uint8_t> LoadFile(const std::filesystem::path& path)
|
||||
|
||||
std::vector<uint8_t> data;
|
||||
data.resize(size);
|
||||
stream.read((char *)(data.data()), size);
|
||||
stream.read((char*)(data.data()), size);
|
||||
if (stream.bad())
|
||||
{
|
||||
return {};
|
||||
|
@ -1,19 +1,19 @@
|
||||
#pragma once
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <set>
|
||||
#include <section.h>
|
||||
#include "symbol_table.h"
|
||||
#include <memory>
|
||||
#include <section.h>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
struct Image
|
||||
{
|
||||
std::unique_ptr<uint8_t[]> data{};
|
||||
size_t base{};
|
||||
uint32_t size{};
|
||||
std::unique_ptr<uint8_t[]> data {};
|
||||
size_t base {};
|
||||
uint32_t size {};
|
||||
|
||||
size_t entry_point{};
|
||||
std::set<Section, SectionComparer> sections{};
|
||||
SymbolTable symbols{};
|
||||
size_t entry_point {};
|
||||
std::set<Section, SectionComparer> sections {};
|
||||
SymbolTable symbols {};
|
||||
|
||||
/**
|
||||
* \brief Map data to image by RVA
|
||||
|
@ -3,12 +3,13 @@
|
||||
#include <filesystem>
|
||||
|
||||
#if defined(_WIN32)
|
||||
# include <Windows.h>
|
||||
#include <Windows.h>
|
||||
#else
|
||||
# include <sys/mman.h>
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
struct MemoryMappedFile {
|
||||
struct MemoryMappedFile
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
HANDLE fileHandle = nullptr;
|
||||
HANDLE fileMappingHandle = nullptr;
|
||||
@ -16,17 +17,17 @@ struct MemoryMappedFile {
|
||||
LARGE_INTEGER fileSize = {};
|
||||
#else
|
||||
int fileHandle = -1;
|
||||
void *fileView = MAP_FAILED;
|
||||
void* fileView = MAP_FAILED;
|
||||
off_t fileSize = 0;
|
||||
#endif
|
||||
|
||||
MemoryMappedFile();
|
||||
MemoryMappedFile(const std::filesystem::path &path);
|
||||
MemoryMappedFile(MemoryMappedFile &&other);
|
||||
MemoryMappedFile(const std::filesystem::path& path);
|
||||
MemoryMappedFile(MemoryMappedFile&& other);
|
||||
~MemoryMappedFile();
|
||||
bool open(const std::filesystem::path &path);
|
||||
bool open(const std::filesystem::path& path);
|
||||
void close();
|
||||
bool isOpen() const;
|
||||
uint8_t *data() const;
|
||||
uint8_t* data() const;
|
||||
size_t size() const;
|
||||
};
|
||||
|
@ -17,8 +17,8 @@
|
||||
#ifdef _WIN32
|
||||
#include <intrin.h>
|
||||
#else
|
||||
#include <xmmintrin.h>
|
||||
#include <smmintrin.h>
|
||||
#include <xmmintrin.h>
|
||||
#endif
|
||||
|
||||
#define PPC_JOIN(x, y) x##y
|
||||
@ -27,7 +27,7 @@
|
||||
#define PPC_FUNC(x) void x(PPCContext& __restrict ctx, uint8_t* base)
|
||||
#define PPC_FUNC_IMPL(x) extern "C" PPC_FUNC(x)
|
||||
#define PPC_EXTERN_FUNC(x) extern PPC_FUNC(x)
|
||||
#define PPC_WEAK_FUNC(x) __attribute__((weak,noinline)) PPC_FUNC(x)
|
||||
#define PPC_WEAK_FUNC(x) __attribute__((weak, noinline)) PPC_FUNC(x)
|
||||
|
||||
#define PPC_FUNC_PROLOGUE() __builtin_assume(((size_t)base & 0x1F) == 0)
|
||||
|
||||
@ -52,7 +52,7 @@
|
||||
// The fallback would be a runtime exception handler which will intercept reads from MMIO regions
|
||||
// and log the PC for compiling to static code later.
|
||||
#ifndef PPC_MM_LOAD_U8
|
||||
#define PPC_MM_LOAD_U8(x) PPC_LOAD_U8 (x)
|
||||
#define PPC_MM_LOAD_U8(x) PPC_LOAD_U8(x)
|
||||
#endif
|
||||
|
||||
#ifndef PPC_MM_LOAD_U16
|
||||
@ -86,7 +86,7 @@
|
||||
// MMIO Store handling is completely reliant on being preeceded by eieio.
|
||||
// TODO: Verify if that's always the case.
|
||||
#ifndef PPC_MM_STORE_U8
|
||||
#define PPC_MM_STORE_U8(x, y) PPC_STORE_U8 (x, y)
|
||||
#define PPC_MM_STORE_U8(x, y) PPC_STORE_U8(x, y)
|
||||
#endif
|
||||
|
||||
#ifndef PPC_MM_STORE_U16
|
||||
@ -513,6 +513,8 @@ struct PPCContext
|
||||
#endif
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
|
||||
inline uint8_t VectorMaskL[] =
|
||||
{
|
||||
0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00,
|
||||
@ -593,6 +595,8 @@ inline uint8_t VectorShiftTableR[] =
|
||||
0x10, 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01,
|
||||
};
|
||||
|
||||
// clang-format on
|
||||
|
||||
inline __m128i _mm_adds_epu32(__m128i a, __m128i b)
|
||||
{
|
||||
return _mm_add_epi32(a, _mm_min_epu32(_mm_xor_si128(a, _mm_cmpeq_epi32(a, a)), b));
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
enum SectionFlags : uint8_t
|
||||
{
|
||||
@ -11,11 +11,11 @@ enum SectionFlags : uint8_t
|
||||
|
||||
struct Section
|
||||
{
|
||||
std::string name{};
|
||||
size_t base{};
|
||||
uint32_t size{};
|
||||
SectionFlags flags{};
|
||||
uint8_t* data{};
|
||||
std::string name {};
|
||||
size_t base {};
|
||||
uint32_t size {};
|
||||
SectionFlags flags {};
|
||||
uint8_t* data {};
|
||||
|
||||
bool operator<(size_t address) const
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
enum SymbolType
|
||||
{
|
||||
@ -12,10 +12,10 @@ enum SymbolType
|
||||
|
||||
struct Symbol
|
||||
{
|
||||
mutable std::string name{};
|
||||
size_t address{};
|
||||
size_t size{};
|
||||
mutable SymbolType type{};
|
||||
mutable std::string name {};
|
||||
size_t address {};
|
||||
size_t size {};
|
||||
mutable SymbolType type {};
|
||||
|
||||
Symbol()
|
||||
{
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
class SymbolTable : public std::multiset<Symbol, SymbolComparer>
|
||||
{
|
||||
public:
|
||||
public:
|
||||
const_iterator find(size_t address) const
|
||||
{
|
||||
auto [beginIt, endIt] = equal_range(address);
|
||||
@ -13,7 +13,7 @@ public:
|
||||
return end();
|
||||
}
|
||||
|
||||
size_t closest{ address - beginIt->address };
|
||||
size_t closest { address - beginIt->address };
|
||||
auto match = end();
|
||||
for (auto it = beginIt; it != endIt; ++it)
|
||||
{
|
||||
@ -41,7 +41,7 @@ public:
|
||||
return end();
|
||||
}
|
||||
|
||||
size_t closest{ address - beginIt->address };
|
||||
size_t closest { address - beginIt->address };
|
||||
auto match = end();
|
||||
for (auto it = beginIt; it != endIt; ++it)
|
||||
{
|
||||
|
@ -1,12 +1,12 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <type_traits>
|
||||
#include <bit>
|
||||
#include <string>
|
||||
#include "byteswap.h"
|
||||
#include <bit>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
// real win32 handles will never use the upper bits unless something goes really wrong
|
||||
@ -15,7 +15,7 @@
|
||||
#define HOST_HANDLE(HANDLE) ((HANDLE) & ~0x80000000)
|
||||
|
||||
// Return true to free the associated memory
|
||||
typedef bool(*TypeDestructor_t)(void*);
|
||||
typedef bool (*TypeDestructor_t)(void*);
|
||||
|
||||
template<typename T>
|
||||
bool DestroyObject(void* obj)
|
||||
@ -71,13 +71,13 @@ struct be
|
||||
return byteswap(value);
|
||||
}
|
||||
|
||||
be& operator| (T value)
|
||||
be& operator|(T value)
|
||||
{
|
||||
set(get() | value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
be& operator& (T value)
|
||||
be& operator&(T value)
|
||||
{
|
||||
set(get() & value);
|
||||
return *this;
|
||||
@ -119,7 +119,7 @@ struct xpointer
|
||||
return reinterpret_cast<T*>(MmGetHostAddress(ptr));
|
||||
}
|
||||
|
||||
operator T* () const
|
||||
operator T*() const
|
||||
{
|
||||
return get();
|
||||
}
|
||||
@ -196,7 +196,7 @@ typedef struct _XDISPATCHER_HEADER
|
||||
|
||||
be<uint32_t> SignalState;
|
||||
XLIST_ENTRY WaitListHead;
|
||||
} XDISPATCHER_HEADER, * XPDISPATCHER_HEADER;
|
||||
} XDISPATCHER_HEADER, *XPDISPATCHER_HEADER;
|
||||
|
||||
// These variables are never accessed in guest code, we can safely use them in little endian
|
||||
typedef struct _XRTL_CRITICAL_SECTION
|
||||
@ -207,7 +207,8 @@ typedef struct _XRTL_CRITICAL_SECTION
|
||||
uint32_t OwningThread;
|
||||
} XRTL_CRITICAL_SECTION;
|
||||
|
||||
typedef struct _XANSI_STRING {
|
||||
typedef struct _XANSI_STRING
|
||||
{
|
||||
be<uint16_t> Length;
|
||||
be<uint16_t> MaximumLength;
|
||||
xpointer<char> Buffer;
|
||||
@ -224,14 +225,16 @@ typedef XDISPATCHER_HEADER XKEVENT;
|
||||
|
||||
typedef struct _XIO_STATUS_BLOCK
|
||||
{
|
||||
union {
|
||||
union
|
||||
{
|
||||
be<uint32_t> Status;
|
||||
be<uint32_t> Pointer;
|
||||
};
|
||||
be<uint32_t> Information;
|
||||
} XIO_STATUS_BLOCK;
|
||||
|
||||
typedef struct _XOVERLAPPED {
|
||||
typedef struct _XOVERLAPPED
|
||||
{
|
||||
be<uint32_t> Internal;
|
||||
be<uint32_t> InternalHigh;
|
||||
be<uint32_t> Offset;
|
||||
@ -240,7 +243,8 @@ typedef struct _XOVERLAPPED {
|
||||
} XOVERLAPPED;
|
||||
|
||||
// this name is so dumb
|
||||
typedef struct _XXOVERLAPPED {
|
||||
typedef struct _XXOVERLAPPED
|
||||
{
|
||||
union
|
||||
{
|
||||
struct
|
||||
@ -265,7 +269,8 @@ typedef struct _XXOVERLAPPED {
|
||||
static_assert(sizeof(_XXOVERLAPPED) == 0x1C);
|
||||
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-memorystatus
|
||||
typedef struct _XMEMORYSTATUS {
|
||||
typedef struct _XMEMORYSTATUS
|
||||
{
|
||||
be<uint32_t> dwLength;
|
||||
be<uint32_t> dwMemoryLoad;
|
||||
be<uint32_t> dwTotalPhys;
|
||||
@ -274,7 +279,7 @@ typedef struct _XMEMORYSTATUS {
|
||||
be<uint32_t> dwAvailPageFile;
|
||||
be<uint32_t> dwTotalVirtual;
|
||||
be<uint32_t> dwAvailVirtual;
|
||||
} XMEMORYSTATUS, * XLPMEMORYSTATUS;
|
||||
} XMEMORYSTATUS, *XLPMEMORYSTATUS;
|
||||
|
||||
typedef struct _XVIDEO_MODE
|
||||
{
|
||||
@ -296,7 +301,8 @@ typedef struct _XKSEMAPHORE
|
||||
be<uint32_t> Limit;
|
||||
} XKSEMAPHORE;
|
||||
|
||||
typedef struct _XUSER_SIGNIN_INFO {
|
||||
typedef struct _XUSER_SIGNIN_INFO
|
||||
{
|
||||
be<uint64_t> xuid;
|
||||
be<uint32_t> dwField08;
|
||||
be<uint32_t> SigninState;
|
||||
@ -315,7 +321,7 @@ typedef struct _XTIME_FIELDS
|
||||
be<uint16_t> Second;
|
||||
be<uint16_t> Milliseconds;
|
||||
be<uint16_t> Weekday;
|
||||
} XTIME_FIELDS, * PXTIME_FIELDS;
|
||||
} XTIME_FIELDS, *PXTIME_FIELDS;
|
||||
|
||||
// Content types
|
||||
#define XCONTENTTYPE_SAVEDATA 1
|
||||
@ -335,15 +341,14 @@ typedef struct _XCONTENT_DATA
|
||||
be<uint32_t> dwContentType;
|
||||
be<uint16_t> szDisplayName[XCONTENT_MAX_DISPLAYNAME];
|
||||
char szFileName[XCONTENT_MAX_FILENAME];
|
||||
} XCONTENT_DATA, * PXCONTENT_DATA;
|
||||
} XCONTENT_DATA, *PXCONTENT_DATA;
|
||||
|
||||
typedef struct _XHOSTCONTENT_DATA : _XCONTENT_DATA
|
||||
{
|
||||
// This is a host exclusive type so we don't care what goes on
|
||||
std::string szRoot{};
|
||||
std::string szRoot {};
|
||||
} XHOSTCONTENT_DATA, *PXHOSTCONTENT_DATA;
|
||||
|
||||
|
||||
#define XCONTENTDEVICETYPE_HDD 1
|
||||
#define XCONTENTDEVICETYPE_MU 2
|
||||
|
||||
@ -391,7 +396,7 @@ typedef struct _XAMINPUT_VIBRATION
|
||||
{
|
||||
uint16_t wLeftMotorSpeed;
|
||||
uint16_t wRightMotorSpeed;
|
||||
} XAMINPUT_VIBRATION, * PXAMINPUT_VIBRATION;
|
||||
} XAMINPUT_VIBRATION, *PXAMINPUT_VIBRATION;
|
||||
|
||||
typedef struct _XAMINPUT_CAPABILITIES
|
||||
{
|
||||
@ -400,10 +405,10 @@ typedef struct _XAMINPUT_CAPABILITIES
|
||||
uint16_t Flags;
|
||||
XAMINPUT_GAMEPAD Gamepad;
|
||||
XAMINPUT_VIBRATION Vibration;
|
||||
} XAMINPUT_CAPABILITIES, * PXAMINPUT_CAPABILITIES;
|
||||
} XAMINPUT_CAPABILITIES, *PXAMINPUT_CAPABILITIES;
|
||||
|
||||
typedef struct _XAMINPUT_STATE
|
||||
{
|
||||
uint32_t dwPacketNumber;
|
||||
XAMINPUT_GAMEPAD Gamepad;
|
||||
} XAMINPUT_STATE, * PXAMINPUT_STATE;
|
||||
} XAMINPUT_STATE, *PXAMINPUT_STATE;
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include "xdbf.h"
|
||||
#include <vector>
|
||||
|
||||
struct Achievement
|
||||
{
|
||||
@ -27,7 +27,7 @@ struct XDBFBlock
|
||||
|
||||
class XDBFWrapper
|
||||
{
|
||||
public:
|
||||
public:
|
||||
const uint8_t* pBuffer;
|
||||
size_t BufferSize;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#include <memory>
|
||||
#include "xbox.h"
|
||||
#include <memory>
|
||||
|
||||
inline constexpr uint8_t Xex2RetailKey[16] = { 0x20, 0xB1, 0x85, 0xA5, 0x9D, 0x28, 0xFD, 0xC3, 0x40, 0x58, 0x3F, 0xBB, 0x08, 0x96, 0xBF, 0x91 };
|
||||
inline constexpr uint8_t AESBlankIV[16] = {};
|
||||
|
@ -18,7 +18,8 @@
|
||||
|
||||
struct XexPatcher
|
||||
{
|
||||
enum class Result {
|
||||
enum class Result
|
||||
{
|
||||
Success,
|
||||
FileOpenFailed,
|
||||
FileWriteFailed,
|
||||
@ -30,6 +31,6 @@ struct XexPatcher
|
||||
PatchUnsupported
|
||||
};
|
||||
|
||||
static Result apply(const uint8_t* xexBytes, size_t xexBytesSize, const uint8_t* patchBytes, size_t patchBytesSize, std::vector<uint8_t> &outBytes, bool skipData);
|
||||
static Result apply(const std::filesystem::path &baseXexPath, const std::filesystem::path &patchXexPath, const std::filesystem::path &newXexPath);
|
||||
static Result apply(const uint8_t* xexBytes, size_t xexBytesSize, const uint8_t* patchBytes, size_t patchBytesSize, std::vector<uint8_t>& outBytes, bool skipData);
|
||||
static Result apply(const std::filesystem::path& baseXexPath, const std::filesystem::path& patchXexPath, const std::filesystem::path& newXexPath);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user