Allow Skipping Page-Size Check

This commit is contained in:
TheBrokenRail 2024-07-05 03:24:27 -04:00
parent f7bc756063
commit f08afbf654
6 changed files with 16 additions and 15 deletions

View File

@ -56,17 +56,15 @@ static void print_debug_information() {
}
// Bootstrap
void bootstrap() {
void bootstrap(const options_t &options) {
// Debug Information
print_debug_information();
// Check Page Size (Not Needed When Using QEMU)
#ifndef MCPI_RUNTIME_IS_QEMU
long page_size = sysconf(_SC_PAGESIZE);
if (page_size != REQUIRED_PAGE_SIZE) {
ERR("Invalid page size! A page size of %ld bytes is required, but the system size is %ld bytes.", (long) REQUIRED_PAGE_SIZE, page_size);
CONDITIONAL_ERR(!options.skip_pagesize_check, "Invalid page size! A page size of %ld bytes is required, but the system size is %ld bytes.", (long) REQUIRED_PAGE_SIZE, page_size);
}
#endif
// Get Binary Directory
const std::string binary_directory = get_binary_directory();

View File

@ -2,6 +2,8 @@
#include <string>
void bootstrap();
#include "options/parser.h"
void bootstrap(const options_t &options);
void copy_sdk(const std::string &binary_directory, bool log_with_debug);
std::string bootstrap_mods(const std::string &binary_directory);

View File

@ -90,7 +90,7 @@ static void start_game(const options_t &options) {
}
// Bootstrap
bootstrap();
bootstrap(options);
}
// Main

View File

@ -9,4 +9,5 @@ OPTION(benchmark, "benchmark", -7, "Run Client-Mode Benchmark")
OPTION(only_generate, "only-generate", -8, "Generate World And Exit (Server-Mode Only)")
OPTION(force_headless, "force-headless", -9, "Force Disable Game Rendering")
OPTION(force_non_headless, "force-non-headless", -10, "Force Enable Game Rendering")
OPTION(server_mode, "server", -11, "Run In Server-Mode")
OPTION(server_mode, "server", -11, "Run In Server-Mode")
OPTION(skip_pagesize_check, "skip-pagesize-check", -12, "Skip Page-Size Check (Not Recommended)")

View File

@ -21,6 +21,14 @@ int reborn_get_debug_fd();
#define DEBUG(format, ...) RAW_DEBUG(reborn_debug_tag, format, ##__VA_ARGS__)
#define ERR(format, ...) { fprintf(stderr, "[ERR]: (%s:%i): " format "\n", __FILE__, __LINE__, ##__VA_ARGS__); exit(EXIT_FAILURE); }
#define IMPOSSIBLE() ERR("This Should Never Be Called")
#define CONDITIONAL_ERR(is_error, ...) \
{ \
if ((is_error)) { \
ERR(__VA_ARGS__); \
} else { \
WARN(__VA_ARGS__); \
} \
}
#ifdef __cplusplus
}

View File

@ -251,14 +251,6 @@ static const char *RAKNET_ERROR_NAMES[] = {
"Couldn't Generate GUID",
"Unknown"
};
#define CONDITIONAL_ERR(is_error, ...) \
{ \
if ((is_error)) { \
ERR(__VA_ARGS__); \
} else { \
WARN(__VA_ARGS__); \
} \
}
static RakNet_StartupResult RakNetInstance_host_RakNet_RakPeer_Startup_injection(RakNet_RakPeer *rak_peer, unsigned short maxConnections, unsigned char *socketDescriptors, uint32_t socketDescriptorCount, int32_t threadPriority) {
// Call Original Method
RakNet_StartupResult result = rak_peer->Startup(maxConnections, socketDescriptors, socketDescriptorCount, threadPriority);