refactor(repo)!: move apps, shared packages, and patch definitions
Everything sat in packages/: two programs next to the small libraries
they use, and the patch data loose at the root. The programs now live in
apps/ and the shared libraries in packages/:
apps/server the local server (was packages/local-service),
package @wto/server
packages/patcher builds the game copy (was packages/build),
package @wto/patcher
patches/exe exe patch definitions (was exe-patches)
patches/gui GUI script patches (was gui-patches)
Inside the server, the network layer folder becomes transport/ so it is
not server/server/, the entry module is server.ts, and startLocalService
and its types become startServer, ServerOptions and RunningServer. The
health answer names the app wto-server, and the TLS files in the data
folder are server.key and server.crt (made again on the next start).
Comments, logs and tool texts say "local server".
The patcher no longer reaches into the server's folder. It read the
default tuning/store.jsonc by a relative path to register bundle GUIDs
for the multi-vehicle packs, which also ignored the player's overrides
in <data>/tuning/. It now takes the pack ids from its caller; the
server exports multiVehiclePackIds(dataFolder), which reads them the way
the running server does. rebuildGuiPack takes the patch folder from its
caller as well.
The development build moves out of the patcher to
scripts/build-game-copy.ts, since it uses both the server and the
patcher. It needs --data (the folder the server will run with) and
defaults the patch folders and the hook library to this repository.
Checked with the root typecheck, check-patches, check-gui,
check-offsets, the native build, a run of build-game-copy.ts into a
scratch folder (12 exe patches, 35 GUI patches, 496 bundle GUIDs as
before) and a server start from apps/server answering wto-server.
BREAKING CHANGE: Use @wto/server and @wto/patcher from the new workspace paths. Run the development build with scripts/build-game-copy.ts and pass --data.
This commit is contained in:
1 parent
9c813ccf7d
commit
930ea07630
476 files changed
+275
-251
No files matched your search
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Connections and datagrams: a destination that is the marker address
|
||||
* or outside the loopback network goes to 127.0.0.1:<local service port> instead; when that
|
||||
* or outside the loopback network goes to 127.0.0.1:<local server port> instead; when that
|
||||
* is impossible (no port configured, IPv6 destination) the call fails as unreachable.
|
||||
*
|
||||
* ConnectEx is not an export: programs fetch it with WSAIoctl(SIO_GET_EXTENSION_FUNCTION_POINTER),
|
||||
@@ -28,7 +28,7 @@ static WSAIoctl_fn real_WSAIoctl;
|
||||
static LPFN_CONNECTEX real_ConnectEx;
|
||||
|
||||
/*
|
||||
* The destination to use: the original one, or the local service. Returns 0 when the call
|
||||
* The destination to use: the original one, or the local server. Returns 0 when the call
|
||||
* must fail (WSAENETUNREACH is set). Connections are logged; datagrams only when refused or
|
||||
* the first time a destination is seen would be too noisy to track, so only refusals.
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* wto_ws.dll: the network hook library of WTOffline.
|
||||
*
|
||||
* aces.exe imports its network functions from this DLL instead of WS2_32.dll
|
||||
* (exe-patches/online/network-hook-library). Every export is forwarded to the system's
|
||||
* (patches/exe/online/network-hook-library). Every export is forwarded to the system's
|
||||
* ws2_32.dll (wto_ws.def); on load the DLL hooks the resolution, connection and datagram
|
||||
* functions of the system's ws2_32.dll itself with MinHook, so the calls of every module in
|
||||
* the process pass through the hooks, not only the executable's.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Settings and log next to the DLL.
|
||||
*
|
||||
* wto_ws.cfg, written by the build into the game copy: one line "port=<local service port>".
|
||||
* wto_ws.cfg, written by the build into the game copy: one line "port=<local server port>".
|
||||
* Without a valid port the hooks still answer every host name locally but refuse every
|
||||
* connection that would leave the machine.
|
||||
*
|
||||
@@ -62,7 +62,7 @@ void config_load(HMODULE self)
|
||||
read_port();
|
||||
if (_snwprintf_s(path, MAX_PATH, _TRUNCATE, L"%swto_ws.log", g_folder) >= 0)
|
||||
g_log = _wfsopen(path, L"w", _SH_DENYWR);
|
||||
log_line("wto_ws: local service port %u%s", g_service_port, g_service_port ? "" : " (none: outside connections are refused)");
|
||||
log_line("wto_ws: local server port %u%s", g_service_port, g_service_port ? "" : " (none: outside connections are refused)");
|
||||
}
|
||||
|
||||
void log_line(const char *format, ...)
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
* "InBattleReward". A LocalMP host has no battle server, so the kill and event hooks call
|
||||
* local_mp_report_award_event() instead. It raises the HUD script event
|
||||
* LMP_AWARD_EVENT_NAME carrying facts only (event code, victim class and name); the
|
||||
* scripts price it with the parameters sent by the local service, show the banner and keep
|
||||
* the record that the local service settles after the battle. Nothing here computes money.
|
||||
* scripts price it with the parameters sent by the local server, show the banner and keep
|
||||
* the record that the local server settles after the battle. Nothing here computes money.
|
||||
*
|
||||
* The event is queued with the same call addScoreMessage uses, but without its
|
||||
* "hudShowAwardMessages" option gate, so the record does not depend on a HUD setting.
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
#define LMP_MIS_OFF_ARCADE_COUNTRY 0x01d0u
|
||||
#define LMP_MIS_OFF_CUSTOM_BOTS 0x0718u
|
||||
/* MissionSettings copy of the mission block customScoreParams (2.61.0.37 loader 0x12657a0 copies it at
|
||||
* 0x126d762); the client never reads it, local_mp_scores.c reads the local service's score table there. */
|
||||
* 0x126d762); the client never reads it, local_mp_scores.c reads the local server's score table there. */
|
||||
#define LMP_MIS_OFF_CUSTOM_SCORE_PARAMS 0x06d8u
|
||||
#define LMP_MATCH_INFO_OFF_TEAM 0x0004u
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Mission scores of combat events on the LocalMP scoreboard, read from the mission settings.
|
||||
*
|
||||
* Online the battle server scores every event. The local service writes the official mission
|
||||
* Online the battle server scores every event. The local server writes the official mission
|
||||
* scores (tuning/battle-economy.jsonc, BattleEconomy.missionScores) into the mission settings
|
||||
* block `customScoreParams`, which the 2.61.0.37 client copies into MissionSettings+0x6d8
|
||||
* (0x126d762 in the mission settings loader 0x12657a0) and never reads itself. Keys:
|
||||
|
||||
@@ -55,7 +55,7 @@ enum redirect_result redirect_destination(const struct sockaddr *name, int lengt
|
||||
if (!is_marker_v4(&v4) && is_loopback_v4(&v4))
|
||||
return REDIRECT_KEEP;
|
||||
}
|
||||
/* The local service listens on IPv4 only, which an IPv6 socket cannot always reach. */
|
||||
/* The local server listens on IPv4 only, which an IPv6 socket cannot always reach. */
|
||||
return REDIRECT_REFUSE;
|
||||
}
|
||||
return REDIRECT_KEEP;
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
* Where a connection may go.
|
||||
*
|
||||
* Every host name resolves to MARKER_ADDRESS (127.0.0.2). A destination that is the marker,
|
||||
* or any address outside the loopback network, is replaced by 127.0.0.1:<local service port>;
|
||||
* or any address outside the loopback network, is replaced by 127.0.0.1:<local server port>;
|
||||
* other loopback addresses (127.0.0.1 and the rest of 127/8, ::1) are left alone, because the
|
||||
* game reaches the local service and its own helpers there.
|
||||
* game reaches the local server and its own helpers there.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
@@ -14,12 +14,12 @@
|
||||
#define MARKER_ADDRESS "127.0.0.2"
|
||||
#define MARKER_ADDRESS_W L"127.0.0.2"
|
||||
|
||||
/* The local service port read from wto_ws.cfg; 0 when there is none, and then nothing is let out. */
|
||||
/* The local server port read from wto_ws.cfg; 0 when there is none, and then nothing is let out. */
|
||||
extern unsigned short g_service_port;
|
||||
|
||||
enum redirect_result {
|
||||
REDIRECT_KEEP, /* leave the destination as it is */
|
||||
REDIRECT_CHANGED, /* *out holds the local service address */
|
||||
REDIRECT_CHANGED, /* *out holds the local server address */
|
||||
REDIRECT_REFUSE /* no way to keep it local: fail the call */
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user