diff --git a/CMakeLists.txt b/CMakeLists.txt index 9cfbb07b..25d2cb80 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.22) set(CMAKE_POLICY_DEFAULT_CMP0110 NEW) @@ -31,7 +31,7 @@ set (LIBEVENT_LIBRARIES find_package(phosg REQUIRED) find_package(Iconv REQUIRED) -find_package(resource_file QUIET) +find_package(resource_file REQUIRED) @@ -141,14 +141,7 @@ endif() add_executable(newserv ${SOURCES}) target_include_directories(newserv PUBLIC ${LIBEVENT_INCLUDE_DIR} ${Iconv_INCLUDE_DIRS}) -target_link_libraries(newserv phosg::phosg ${LIBEVENT_LIBRARIES} ${Iconv_LIBRARIES} pthread) -if(resource_file_FOUND) - target_compile_definitions(newserv PUBLIC HAVE_RESOURCE_FILE) - target_link_libraries(newserv resource_file::resource_file) - message(STATUS "resource_file found; enabling patch support") -else() - message(WARNING "resource_file not found; disabling patch support") -endif() +target_link_libraries(newserv phosg::phosg ${LIBEVENT_LIBRARIES} ${Iconv_LIBRARIES} pthread resource_file::resource_file) add_dependencies(newserv newserv-Revision-cc) # target_compile_options(newserv PRIVATE -fsanitize=address) diff --git a/README.md b/README.md index f3b07edc..d9f3c89a 100644 --- a/README.md +++ b/README.md @@ -146,8 +146,7 @@ There are currently no precompiled releases for Linux. To run newserv on Linux, * If you're on Windows, install [Cygwin](https://www.cygwin.com/). While doing so, install the `cmake`, `gcc-core`, `gcc-g++`, `git`, `libevent2.1_7`, `libevent-devel`, `make`, `libiconv-devel`, and `zlib` packages. Do the rest of these steps inside a Cygwin shell (not a Windows cmd shell or PowerShell). * If you're on macOS, run `brew install cmake libevent libiconv`. * If you're on Linux, run `sudo apt-get install cmake libevent-dev` (or use your Linux distribution's package manager). -3. Build and install [phosg](https://github.com/fuzziqersoftware/phosg). -4. Optionally, install [resource_dasm](https://github.com/fuzziqersoftware/resource_dasm). This will enable newserv to send memory patches and load DOL files on PSO GC clients. PSO GC clients can play PSO normally on newserv without this. +3. Build and install [phosg](https://github.com/fuzziqersoftware/phosg) and [resource_dasm](https://github.com/fuzziqersoftware/resource_dasm). 5. Run `cmake . && make` in the newserv directory. After building newserv, edit system/config.example.json as needed **and rename it to system/config.json** (note that this step is not necessary for the precompiled releases!), set up [client patch directories](#client-patch-directories) if you're planning to play Blue Burst, then run `./newserv` in newserv's directory. @@ -437,8 +436,6 @@ Like quests, Episode 3 card definitions, maps, and quests are cached in memory. ## Memory patches, client functions, and DOL files -*Everything in this section requires resource_dasm to be installed, so newserv can use the assemblers and disassemblers from its libresource_file library. If resource_dasm is not installed, newserv will still build and run, but these features will not be available.* - You can put assembly files in the system/client-functions directory with filenames like PatchName.VERS.patch.s and they will appear in the Patches menu for clients that support client functions. Client functions are written in SH-4, PowerPC, or x86 assembly and are compiled when newserv is started. The assembly system's features are documented in the comments in system/client-functions/System/WriteMemoryGC.ppc.s. The VERS token in client function filenames refers to the specific version of the game that the client function applies to. Some versions do not support receiving client functions at all. *Note: newserv uses the shorter GameCube versioning convention, where discs labeled DOL-XXXX-0-0Y are version 1.Y. The PSO community seems to use the convention 1.0Y in some places instead, but these are the same version. For example, the version that newserv calls v1.4 is the same as v1.04, and is labeled DOL-GPOJ-0-04 on the underside of the disc.* @@ -518,8 +515,8 @@ There are many options available when starting a proxy session. All options are * **Save files**: saves copies of several kinds of files when they're sent by the remote server. The files are written to the current directory (which is usually the directory containing the system/ directory). These kinds of files can be saved: * Online quests and download quests (saved as .bin/.dat files) * GBA games (saved as .gba files) - * Patches (saved as .bin files, and disassembled to text files if newserv is built with patch support) - * Player data from BB sessions (saved as .bin files, which are not the same format as .nsc files) + * Patches (saved as .bin files and disassembled as .txt files) + * Player data from BB sessions (saved as .bin files, which are not the same format as .nsc or .psochar files) * Episode 3 online quests and maps (saved as .mnmd files) * Episode 3 download quests (saved as .mnm files) * Episode 3 card definitions (saved as .mnr files) diff --git a/src/AddressTranslator-Stub.hh b/src/AddressTranslator-Stub.hh deleted file mode 100644 index 02a084bd..00000000 --- a/src/AddressTranslator-Stub.hh +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -struct DiffEntry { - uint32_t address; - std::string a_data; - std::string b_data; -}; - -inline void run_address_translator(const std::string&, const std::string&, const std::string&) { - throw std::runtime_error("resource_file is not available; install it and rebuild newserv"); -} - -inline std::vector diff_dol_files(const std::string&, const std::string&) { - throw std::runtime_error("resource_file is not available; install it and rebuild newserv"); -} - -inline std::vector diff_xbe_files(const std::string&, const std::string&) { - throw std::runtime_error("resource_file is not available; install it and rebuild newserv"); -} diff --git a/src/FunctionCompiler.cc b/src/FunctionCompiler.cc index 81e4f4f0..c8e19f16 100644 --- a/src/FunctionCompiler.cc +++ b/src/FunctionCompiler.cc @@ -8,11 +8,9 @@ #include #include -#ifdef HAVE_RESOURCE_FILE #include #include #include -#endif #include "CommandFormats.hh" #include "CommonFileFormats.hh" @@ -24,11 +22,7 @@ using namespace std; static bool is_function_compiler_available = true; bool function_compiler_available() { -#ifndef HAVE_RESOURCE_FILE - return false; -#else return is_function_compiler_available; -#endif } void set_function_compiler_available(bool is_available) { @@ -131,15 +125,6 @@ shared_ptr compile_function_code( const string& system_directory, const string& name, const string& text) { -#ifndef HAVE_RESOURCE_FILE - (void)arch; - (void)function_directory; - (void)system_directory; - (void)name; - (void)text; - throw runtime_error("function compiler is not available"); - -#else auto ret = make_shared(); ret->arch = arch; ret->short_name = name; @@ -254,7 +239,6 @@ shared_ptr compile_function_code( } return ret; -#endif } FunctionCodeIndex::FunctionCodeIndex(const string& directory) { diff --git a/src/Main.cc b/src/Main.cc index 9c356641..8358d571 100644 --- a/src/Main.cc +++ b/src/Main.cc @@ -17,11 +17,7 @@ #include #include -#ifdef HAVE_RESOURCE_FILE #include "AddressTranslator.hh" -#else -#include "AddressTranslator-Stub.hh" -#endif #include "BMLArchive.hh" #include "CatSession.hh" #include "Compression.hh" @@ -3177,12 +3173,7 @@ Action a_run_server_replay_log( "", nullptr, +[](phosg::Arguments& args) { { string build_date = phosg::format_time(BUILD_TIMESTAMP); -#ifdef HAVE_RESOURCE_FILE - const char* resource_file_str = " with client function support"; -#else - const char* resource_file_str = " without client function support"; -#endif - config_log.info("newserv %s compiled%s at %s", GIT_REVISION_HASH, resource_file_str, build_date.c_str()); + config_log.info("newserv %s compiled at %s", GIT_REVISION_HASH, build_date.c_str()); } if (evthread_use_pthreads()) { diff --git a/src/ProxyCommands.cc b/src/ProxyCommands.cc index 42aa0030..17728be9 100644 --- a/src/ProxyCommands.cc +++ b/src/ProxyCommands.cc @@ -22,11 +22,9 @@ #include #include #include -#ifdef HAVE_RESOURCE_FILE #include #include #include -#endif #include "ChatCommands.hh" #include "Compression.hh" @@ -740,7 +738,6 @@ static HandlerResult S_B2(shared_ptr ses, uint16_t, phosg::save_file(output_filename, data); ses->log.info("Wrote code from server to file %s", output_filename.c_str()); -#ifdef HAVE_RESOURCE_FILE using FooterT = RELFileFooterT; // TODO: Support SH-4 disassembly too @@ -807,7 +804,6 @@ static HandlerResult S_B2(shared_ptr ses, uint16_t, ses->log.info("Failed to disassemble code from server: %s", e.what()); } } -#endif } if (ses->config.check_flag(Client::Flag::PROXY_BLOCK_FUNCTION_CALLS)) { diff --git a/src/QuestScript.cc b/src/QuestScript.cc index e7df09ca..edae40f3 100644 --- a/src/QuestScript.cc +++ b/src/QuestScript.cc @@ -8,15 +8,12 @@ #include #include #include -#include -#include -#include - -#ifdef HAVE_RESOURCE_FILE #include #include #include -#endif +#include +#include +#include #include "BattleParamsIndex.hh" #include "CommandFormats.hh" @@ -4329,7 +4326,6 @@ AssembledQuestScript assemble_quest_script( phosg::strip_whitespace(filename); code_w.write(get_native_include(filename)); } else if (phosg::starts_with(line.text, ".include_native ")) { -#ifdef HAVE_RESOURCE_FILE string filename = line.text.substr(16); phosg::strip_whitespace(filename); string native_text = get_native_include(filename); @@ -4344,9 +4340,6 @@ AssembledQuestScript assemble_quest_script( throw runtime_error("unknown architecture"); } code_w.write(code); -#else - throw runtime_error("native code cannot be compiled; rebuild newserv with libresource_file"); -#endif } return; }