reman3/game_re/r3/binders/static_mem.cxx

16 lines
476 B
C++

#include "static_mem.h"
#include <spdlog/spdlog.h>
unsigned char gh_static_mem[GH_DATA_SIZE];
void gh_init_data_segment() {
SPDLOG_INFO("Initializing data segment");
FILE *f = fopen(R3_DATA_SEGMENT_FILE, "rb");
if (!f) {
throw std::runtime_error("Failed to open gh_datasegment.bin");
}
size_t actual = fread(gh_static_mem, 1, gh_data_size, f);
if (actual != gh_data_size) {
throw std::runtime_error("Failed to read gh_datasegment.bin");
}
fclose(f);
}