make resource_file required

This commit is contained in:
Martin Michelsen
2025-03-18 18:59:16 -07:00
parent 595675df20
commit 6328453d38
7 changed files with 10 additions and 80 deletions
-24
View File
@@ -1,24 +0,0 @@
#pragma once
#include <stdexcept>
#include <string>
#include <utility>
#include <vector>
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<DiffEntry> 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<DiffEntry> diff_xbe_files(const std::string&, const std::string&) {
throw std::runtime_error("resource_file is not available; install it and rebuild newserv");
}
-16
View File
@@ -8,11 +8,9 @@
#include <phosg/Time.hh>
#include <stdexcept>
#ifdef HAVE_RESOURCE_FILE
#include <resource_file/Emulators/PPC32Emulator.hh>
#include <resource_file/Emulators/SH4Emulator.hh>
#include <resource_file/Emulators/X86Emulator.hh>
#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<CompiledFunctionCode> 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<CompiledFunctionCode>();
ret->arch = arch;
ret->short_name = name;
@@ -254,7 +239,6 @@ shared_ptr<CompiledFunctionCode> compile_function_code(
}
return ret;
#endif
}
FunctionCodeIndex::FunctionCodeIndex(const string& directory) {
+1 -10
View File
@@ -17,11 +17,7 @@
#include <thread>
#include <unordered_map>
#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()) {
-4
View File
@@ -22,11 +22,9 @@
#include <phosg/Random.hh>
#include <phosg/Strings.hh>
#include <phosg/Time.hh>
#ifdef HAVE_RESOURCE_FILE
#include <resource_file/Emulators/PPC32Emulator.hh>
#include <resource_file/Emulators/SH4Emulator.hh>
#include <resource_file/Emulators/X86Emulator.hh>
#endif
#include "ChatCommands.hh"
#include "Compression.hh"
@@ -740,7 +738,6 @@ static HandlerResult S_B2(shared_ptr<ProxyServer::LinkedSession> 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<BE>;
// TODO: Support SH-4 disassembly too
@@ -807,7 +804,6 @@ static HandlerResult S_B2(shared_ptr<ProxyServer::LinkedSession> 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)) {
+3 -10
View File
@@ -8,15 +8,12 @@
#include <map>
#include <phosg/Math.hh>
#include <phosg/Strings.hh>
#include <set>
#include <unordered_map>
#include <vector>
#ifdef HAVE_RESOURCE_FILE
#include <resource_file/Emulators/PPC32Emulator.hh>
#include <resource_file/Emulators/SH4Emulator.hh>
#include <resource_file/Emulators/X86Emulator.hh>
#endif
#include <set>
#include <unordered_map>
#include <vector>
#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;
}