diff --git a/launcher/src/bootstrap.cpp b/launcher/src/bootstrap.cpp index ea428c53..1a7850e4 100644 --- a/launcher/src/bootstrap.cpp +++ b/launcher/src/bootstrap.cpp @@ -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(); diff --git a/launcher/src/bootstrap.h b/launcher/src/bootstrap.h index db58f0ae..452fa784 100644 --- a/launcher/src/bootstrap.h +++ b/launcher/src/bootstrap.h @@ -2,6 +2,8 @@ #include -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); diff --git a/launcher/src/main.cpp b/launcher/src/main.cpp index 0d4653c0..e642bd61 100644 --- a/launcher/src/main.cpp +++ b/launcher/src/main.cpp @@ -90,7 +90,7 @@ static void start_game(const options_t &options) { } // Bootstrap - bootstrap(); + bootstrap(options); } // Main diff --git a/launcher/src/options/option-list.h b/launcher/src/options/option-list.h index 19fc58ef..52329aba 100644 --- a/launcher/src/options/option-list.h +++ b/launcher/src/options/option-list.h @@ -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") \ No newline at end of file +OPTION(server_mode, "server", -11, "Run In Server-Mode") +OPTION(skip_pagesize_check, "skip-pagesize-check", -12, "Skip Page-Size Check (Not Recommended)") \ No newline at end of file diff --git a/libreborn/include/libreborn/log.h b/libreborn/include/libreborn/log.h index cdc99ce5..47419a02 100644 --- a/libreborn/include/libreborn/log.h +++ b/libreborn/include/libreborn/log.h @@ -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 } diff --git a/mods/src/misc/misc.cpp b/mods/src/misc/misc.cpp index 9036560b..29a35a78 100644 --- a/mods/src/misc/misc.cpp +++ b/mods/src/misc/misc.cpp @@ -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);