Update recompile code base

This commit is contained in:
2024-09-20 03:35:59 +08:00
parent d367252091
commit bd69031a3d
192 changed files with 161561 additions and 201 deletions

View File

@@ -0,0 +1,9 @@
#ifndef B8D59B54_1674_4C0F_AA2C_611385FF5D03
#define B8D59B54_1674_4C0F_AA2C_611385FF5D03
#include "gh_base.h"
#include "gh_static_mem.h"
#include "gh_structs.h"
#include "gh_global.h"
#endif /* B8D59B54_1674_4C0F_AA2C_611385FF5D03 */

View File

@@ -1,8 +1,11 @@
#ifndef DF40ED2B_5659_43AA_8A22_499A89C4BD62
#define DF40ED2B_5659_43AA_8A22_499A89C4BD62
// Header file that is automatically included in all generated code
#include "gh_types.h"
#include "gh_static_mem.h"
#include "../gh_global.h"
#endif /* DF40ED2B_5659_43AA_8A22_499A89C4BD62 */

View File

@@ -1,19 +1,18 @@
#ifndef A523F6DB_0645_4DEB_8AEB_3792CB732B49
#define A523F6DB_0645_4DEB_8AEB_3792CB732B49
// Header included in all decompiled files to fix some common recompilation issues
#include <stdint.h>
#include <Windows.h>
#include <stdint.h>
#include <stdio.h>
// Fallback to int if type is not annotated
typedef int64_t undefined;
// typedef int64_t undefined;
typedef uint32_t undefined4;
typedef uint16_t undefined2;
typedef unsigned char byte;
typedef byte undefined1;
typedef uint64_t uint;
typedef void* pointer;
// typedef uint64_t uint;
typedef void *pointer;
typedef char *TerminatedCString;
typedef char *string;

View File

@@ -0,0 +1,8 @@
#ifndef EDBE48FC_B879_4985_9274_B7ACF24AD024
#define EDBE48FC_B879_4985_9274_B7ACF24AD024
#include "gh_base.h"
#include "gh_structs.h"
#include "gh_static_mem.h"
#endif /* EDBE48FC_B879_4985_9274_B7ACF24AD024 */

View File

@@ -1,3 +1,13 @@
#include "gh_static_mem.h"
#include <spdlog/spdlog.h>
unsigned char gh_static_mem[GH_STATIC_MEM_SIZE];
unsigned char gh_static_mem[GH_DATA_SIZE];
void gh_init_data_segment() {
SPDLOG_INFO("Initializing data segment");
FILE *f = fopen("gh_datasegment.bin", "r");
if (!f) {
throw std::runtime_error("Failed to open gh_datasegment.bin");
}
fread(gh_static_mem, 1, gh_data_size, f);
fclose(f);
}

View File

@@ -1,12 +1,22 @@
#ifndef A18E3E17_2A80_4DBD_96CD_1CE0120A164E
#define A18E3E17_2A80_4DBD_96CD_1CE0120A164E
#define GH_STATIC_MEM_START 0x005b6400
#define GH_STATIC_MEM_END 0x00843fff
#define GH_STATIC_MEM_SIZE (GH_STATIC_MEM_END - GH_STATIC_MEM_START)
#include "../gh_datasegment.h"
#include <stdexcept>
extern unsigned char gh_static_mem[GH_STATIC_MEM_SIZE];
extern unsigned char gh_static_mem[GH_DATA_SIZE];
#define GH_STATIC(addr) (*(unsigned char *)(gh_static_mem + (addr - GH_STATIC_MEM_START)))
template <size_t addr> inline constexpr void checkMappedMemory() {
static_assert(addr >= GH_DATA_START, "Address outside lower bound");
static_assert(addr < GH_DATA_END, "Address outside upper bound");
}
inline uint8_t *memoryMapSafe(size_t addr) {
if (addr < GH_DATA_START || addr > GH_DATA_END) {
throw std::runtime_error("Address out of bounds");
}
return (uint8_t *)(gh_static_mem + (addr - GH_DATA_START));
}
#define GH_MEM(addr) (checkMappedMemory<addr>(), *memoryMapSafe(addr))
#endif /* A18E3E17_2A80_4DBD_96CD_1CE0120A164E */

View File

@@ -0,0 +1,6 @@
#ifndef F3E71404_380C_4417_8642_0AA89E12BE28
#define F3E71404_380C_4417_8642_0AA89E12BE28
#include "gh_base.h"
#endif /* F3E71404_380C_4417_8642_0AA89E12BE28 */