Repository navigation
Conversation
The getter returned a fixed 2 ahead of its own logic, and the console setter raised every value below 2 to 2 in release builds, so a server could never start a round with a single player: the client kept showing "The game will start when 1 more player(s) join" even with sv.numPlayersNeededToStart 1 and bots on the map. Retail does neither. The bf2 ELF getter (080BC1F0) returns 6, or 8 from 33 slots up, on ranked servers and the configured value otherwise; the console SET is a raw field write. Both functions now match that. Validated on the Windows x86 dedicated server with the retail 1.50 client: with sv.numPlayersNeededToStart 1 the round starts on the first human spawn and the bots join the round. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Math, Core, IO, Scene, Physics and Platform units the AI library needs, plus the GameLogic/GameEvents AI call sites (collision-handler and radio-courier reports, CombatArea AI queries, PortalEvent, DropVehicleEvent producer). Minimal hunks only; Polynom.h keeps its libstdc++ licence notice. goUpInPath restores the leading slash it strips, as the ELF does; on Windows only when the path had one, because isPathAbsolute also accepts drive paths there. The Linux plugin loader calls deinitDll before dlclose so a map reload cannot reuse stale AI singletons ([CHOSEN, not recovered], a native-port design). The RendDX9 and bf2_runtime_pair manifests link the units the recovered Math code now needs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: OpenAI Codex <noreply@openai.com>
All 10,961 in-scope libaidll.so functions of BF2 1.50, recovered from the ia-32 ELF with amd-64 and PE cross-checks; evidence vocabulary as in AGENTS.md ([INFERRED], [UNRESOLVED], [PLATFORM], [CHOSEN, not recovered]). Chosen declarations exist only for never-implemented pure slots and null-only member pointers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: OpenAI Codex <noreply@openai.com>
…rary One AIDLL source manifest, Code/Build/aidll_sources.txt, feeds both CMake and aidll.cmd. It lists the units in the retail link order, which is also the static-initialisation order, read from the .ctors table of libaidll.so. The engine image excludes every AIDLL-only unit by a directory rule (AI/AIDLL minus the shared CommonSingletonServer, plus three units outside it), so bf2_w32ded.exe never links them. syntaxcheck.cmd covers every AI unit. The linux-x64 preset builds a native libaidll.so with an export map (AidllAbi); this native library is a native-port design, not retail. AIDLL test fixtures are updated for the retired stops. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: OpenAI Codex <noreply@openai.com>
The engine's instance (bf2 ds:0x8ABBCB0) was declared under the [CHOSEN] name g_random and defined in ParticleTemplate.cpp; the AI DLL's (libaidll BSS 0x4DD454) as Rand in Random.cpp. Both retail images name it dice::hfe::Rand and initialise it in Random.cpp's static init (bf2 0x83CB610, libaidll 0x48A850: iostream Init, then the default seed). Random.h now declares one extern Random Rand; Random.cpp defines it for each image; every g_random use is renamed (mechanical, no behaviour change). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: OpenAI Codex <noreply@openai.com>
bf2_runtime_pair (x86 checks): e44067b added the [TEMP] grenade_trace diagnostic (GrenadeTrace.h), whose log() reads WorldPref::mTickCount from PointPhysicsNode.cpp. The counter is defined in Core/System.cpp, which the harness does not link, so link.exe failed with LNK2019. Define the counter in the harness's existing link-completion scaffolding, next to the other retail globals it stands in for. No production TU changes, so the x86 retail images are untouched; runtime_pair.cmd needs no source-list change. bf2_w64ded (x64 strict link): e0fcdaa made VoipServerInternal call the CBF2VoipServer facade, which the x86 image imports from the BF2VoipServer_w32ded.dll side image. That DLL target is defined only under NOT BF2_BUILD_X64 (and its .def pins x86 decorations), so the x64 exe had no definitions. Link the voice-server module statically into the native Windows x64 port, as the Linux image already does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BGWewitYSRmJLenBNiW8ar
Ai/reconstruction
AIDLL_r.dll is a DICE Canada BoosterPack2 debug build of the AI DLL (2006-05-04, asserts and __FILE__ paths, no PDB). It is older than 1.50 but already has the 1.50 AI features. It is used as evidence for names, enum values and source-file placement only; behaviour stays matched to retail 1.50 (libaidll.so / AIDLL.dll). Follows the review notes on B2BF#68. Names - WTSticky -> WTC4 (assert "wInfo->getWeaponType() == WTC4", BBC4.cpp). - Information::isOfType(InformationType), DICE's name (assert "!targetPrimaryInfo->isOfType(ITSoldier)"). The single-bit object-type flag tests use it with the IT* names (enum-to-string switch 0x100D3010), resolving the [UNRESOLVED] flag notes. BotMain::event_airborn tests ITAir, then ITHelicopter, as retail compiles it (ELF 0x18D740). - Kit types documented: 6 is KTAT, 7..12 KTExtended1..6. - 89 member and parameter renames from AIDLL_r assert expressions, each checked by the field offset the assert reads and by its use in the tree (BotNavigation, BotMain, SquadManager/Formation, SAI, AIStrategicObject*, AISettings, BotManager, QuadTree/ClusterGraph, ...). Evidence addresses are in the comments. Source placement (AIDLL_r __FILE__ paths) - Moved: Aimer, BotScript.h -> AIBotActionPlan/; UrgencyMerger -> AIBot/; AIMineManager -> AIKnowledge/; WeaponInfoManager, CustomCurve -> AIUtils/; AerialHeightMap -> AIPathFinding/AerialHeightMap/; UserOrderManager -> AIStrategicEntity/UserOrders/; AILandingZoneManager, InformationManager -> Main/. - Split, functions moved unchanged: SensingAgentPatterns into the Soldier, Turret, MouseFreeLook and Null pattern TUs; SCurve out of CustomCurve; IAIMain, IAIPathfindingSetup and IBotManagerModifier into their own TUs. - Code/Build/aidll_sources.txt, Code/Tests/syntaxcheck.cmd and the Code/Tests/aidll fixtures follow the moves and renames. No behaviour change intended: where AIDLL_r and the tree were compared, they agree with 1.50 apart from asserts. Built and smoke-tested on macOS (bf2_aidll, vtable audit unchanged, 16-bot round); the Windows fixtures were updated as text only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AI: cross-check against the AIDLL_r debug build (names, TU placement)
…ainst retail) Recovers the retail Memory.dll (Ver 1.01, 2005/01/10 "Final") into Code/BF2/Memory as its own image, bf2_memory. Every function cites its PE address; placement follows the shipped function and data order. The Final build is mostly stubs: only the chunk pools, the sanity limit, getStatus and the resource counters do work; the counters, trace and histogram exports return constants, as in retail. - Platform seams behind #if, [CHOSEN, not recovered]: constructor/destructor instead of DllMain on POSIX, stderr instead of the message box, pthreads, and a 16-byte header slot on 64-bit. - BF2_MEMORY_PASSTHROUGH (AUTO/ON/OFF) forwards to malloc/free under AddressSanitizer. - Built on request only (EXCLUDE_FROM_ALL) and linked into no game image: the game keeps allocating through the shared CRT (issue #7). Code/BF2/Memory is skipped by the engine source discovery in CMakeLists.txt and Code/Build/build.cmd. - Windows: Code/Build/memory.cmd. Tests: Code/Tests/memory (unit tests, internal tests, and memory_diff, which runs one allocation script against the retail and the rebuilt DLL; the outputs were identical with MSVC x86). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Memory: recover Memory.dll (111/111 functions, differential-tested against retail)
Branch: `mac/pr1-engine` → `main`. First of three stacked PRs: (1) this, (2) `mac/pr2-renderer`, (3) `mac/pr3-macos`. Diff: 583 files, +23,580 / −3,585. Code and build files only. Contents - Engine and game recoveries and fixes in Core, IO, Game, Scene, Sound, Physics, Animation, Math and VoIP. Examples: - the scene object lifecycle and ObjectManager queries, recovered against the PE; - the GameServer radio messages in self-hosted games; - zoom hides the crosshair; - the input and window message paths. - Menu, HUD and client UI: SwiffPlayer natives, gameswf and BFMeme recoveries and fixes. - AI: updates to the AI library since #1/#2. - Platform-neutral helpers the later stages build on: - scripted input (`Platform/InputScript`); - the x87 arithmetic policy (`X87Compat`, `ExtendedFloat` for arm64). - Shared interfaces from the renderer tree. Engine code here uses three headers from it: `GeomMisc/DebugCircleDrawer.h`, `GeomMisc/DebugLineDrawer.h` and `Geom/ParticleSystem/ParticleSystemManager.h`. - Tests: - `runtime_pair` fixtures for the recovered `Object` manager and destructor contracts (PE 0x0071E3D0, 0x007200D0); - POSIX registry, network and thread checks. - Build files: `CMakeLists.txt`, `CMakePresets.json`, `Code/Build` scripts and `package_release.py`. - These are one file each for all three stages, so they already define the renderer and macOS targets. - The macOS parts only take effect on macOS (PR 3). The detailed history of every change, with the PE/ELF evidence, is on `mac-metal`. This PR carries the final state of its files. Validation (this stage on its own) - Windows (MSVC 14.44, the CI steps): - x86: `build_python.cmd`, configure, `bf2_run_checks` and `bf2_editor_run_checks`, `bf2_w32ded`, `bf2_aidll`. - x64: `build_python.cmd`, configure, `bf2_w64ded`. - All pass. - Linux (Ubuntu 26.04, `linux-x64`): `bf2` and `dice_py_check_run` pass. - Not built at this stage: the Windows client and editor. Their renderer is still `main`'s and needs PR 2; hosted CI skips both anyway (no April 2005 DirectX SDK). The per-change history with the PE/ELF evidence is on mac-metal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Branch: `mac/pr3-macos` → `mac/pr2-renderer` (stacked; retarget to `main` after PRs 1 and 2 are merged). Diff: 198 files, +50,796 / −7. Code and build files only. After this PR, `main` equals the validated `mac/metal-client` branch byte for byte. Contents - The macOS client (`[CHOSEN, not recovered]`; there was no retail macOS image). A native client for Intel (x86_64) and Apple silicon (arm64), with no Wine and no Windows DLLs. - `Code/BF2/Platform/Gfx/Metal`: Metal implements the Direct3D 9 / D3DX subset the renderer uses. It covers resources, state, shaders, MSAA, device loss and reset after a fullscreen focus loss, and screenshots. - `Code/BF2/Platform/Gfx/Effect`: native effect compilation with vkd3d-shader 2.1 and MojoShader, both carrying the repository's patches. - `Code/BF2/Platform/macOS`: the Cocoa host. It provides the window, fullscreen, focus and input, display modes, the paths, the CPU info and protected data. - `Code/BF2/IO/Input/Mac*`, `BF2Window_macos.cpp`: input devices and the window on the Cocoa host. - `tools/macos`: only the files the build runs. - The native dependency build (`nativefx/`, `vkd3d-patches/`, `d3dxfx/patches`). - The D3D9 forwarding generator check. - The static-plugin and AI vtable audits, which `bf2_client` depends on. - `Code/Tests/macos_*`: the macOS checks (Metal device, forwarding, effects) and the M2 bundle scripts. - CI. `.github/workflows/build.yml` gains a `macos` job on `macos-14` with one leg each for arm64 and x86_64 (x86_64 is cross-compiled). - It fetches the pinned vkd3d (`vkd3d-2.1`, fb7f9ff3) and MojoShader (ad5dff84) sources and builds the native effect libraries. - It builds `bf2_client`, `bf2` and `bf2_aidll`, checks the architectures, runs the Python runtime check on arm64, and uploads the client and server packages. - `release.yml` attaches the four macOS packages; `package_release.py` already knows them (PR 1). Not included (stays on `mac-metal`) - `docs/` (the port's engineer guides, the track logs), `AGENTS.md`, and the test and VM tooling under `tools/`. - Exceptions the code cites. Recovered code refers to the two owner exceptions in `mac-metal`'s `AGENTS.md`, the unimplemented-slot exception and the unobservable-type exception. - The M2 bundle tooling. `Code/Tests/macos_c_arm64` (`package.sh`, `run.sh`) needs the loopback harness `tools/macos/loopback`, which stays on `mac-metal`. Validation (the final tree, identical to `mac/metal-client`) macOS, Intel (i7-8569U, Iris Plus 655, macOS 15.7): - CI simulation. The CI steps ran from scratch: the fetch, the native effect build (5.5 min), the `macos-x64` preset build (vtable audit 139/0, all images x86_64), `dice_py_check_run` and packaging. - Renderer gate: PASS. infantry-range, render-view-dalian and render-view-ocs were all within their view limits, plus a map2 reload, with 0 `[FRONTIER]` and 0 crash reports. - Final test at High with 4x AA (Dalian, scripted run and gun, 16 bots): Metal runs `samples=4`, 42 fps. Apple silicon (MacBook Air M2, 8 GB, macOS 26.5), from the arm64 bundle of the same renderer code: - All arm64 checks pass (Metal device and GPU, vtable runtime checks, Python, AI loader). - The gate: infantry-range, render-view-dalian, render-view-ocs and map2-reload all pass, with 0 `[FRONTIER]` and 0 crash reports. - High with 4x AA: `samples=4`, 91 fps. Windows and Linux on the final tree: the CI steps pass (x86 checks 5/5 and editor checks 926/0, both servers, the AI library, both clients, the editor, and Linux `bf2` with `dice_py_check_run`). Notes for review - macOS CI not yet run on GitHub. The macOS job has only been simulated locally (Intel host). Its first real run on the arm64 runner happens with this PR. - LGPL obligations. The macOS client links vkd3d-shader and the FFmpeg Bink decoders (both LGPL-2.1+) statically. The packages carry the licences; release binaries also carry the LGPL relinking obligations. The per-change history with the PE/ELF evidence is on mac-metal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Branch: `mac/pr2-renderer` → `mac/pr1-engine` (stacked; retarget to `main` after PR 1 is merged).
Diff: 360 files, +82,923 / −34,311. Code and build files only.
Contents
- RendDX9.dll is fully recovered. The renderer core and Geom, GeomMisc and RendMisc are covered: renderer, video options, effects, shaders, textures, terrain, meshes, lighting and shadows, particles, decals, roads, overgrowth, post-production, fonts, the debug renderers and the console bindings.
- Counts: 5767 functions recovered (5679 done, 88 `[CHOSEN]` under the unobservable-type exception); 3916 compiler/STL/CRT/SDK library functions; 76 thunks.
- 3 accepted stops:
- `Effect::begin`, the retail null-dereference path;
- `TerrainEditable::runTool` on macOS, an editor-only boundary;
- the Linux Bink branch of `Video::open`, since there is no Linux client.
- Evidence: every body cites its PE address. The detailed history with the evidence is on `mac-metal`.
- Video-mode fallback (`[CHOSEN, not recovered]`, kr4uzi/OpenBF2 issue #4). Retail stops on a profile resolution or refresh rate the display does not offer, which kills a fullscreen client without a message. `VideoOptions::setDynamicOption` now selects the closest supported mode instead, using the scoring of the client-side DLL fix in kr4uzi/gamespy-emulator.
- Bink movies through vendored FFmpeg Bink decoders (LGPL-2.1+, `External/ffmpeg-bink`), in black-box agreement with retail `binkw32`. Windows x64 now plays the intro and menu movies; Windows x86 keeps `binkw32.dll`.
- Mesh stripifier: vendored meshoptimizer (MIT).
- The platform-neutral D3D9/D3DX subset (`Platform/Gfx/D3D9Subset.h`, `D3DX9Subset.h`, `Include/`, `D3D9Forward/`). The Windows D3DX fallback (builds without the DirectX SDK) and the optional `BF2_GFX_SEAM` build use it.
- `Code/Build/renddx9.cmd`: the full source list, split for cmd.exe's line limit, plus the x64 Bink sources.
Validation (this stage on its own, on top of PR 1)
- Windows (MSVC 14.44, the CI steps):
- x86: the checks, `bf2_w32ded`, `bf2_aidll`, `bf2_client`, `bf2_editor`.
- x64: `bf2_w64ded`, `bf2_client`.
- All pass.
- Linux (`linux-x64`): `bf2` and `dice_py_check_run` pass.
- Earlier in game, on the same code (Boot Camp VM, retail server on port 16890):
- x86 and x64 clients spawn and play the scripted run and gun at High with 4x AA;
- the video-mode fallback works in fullscreen;
- the x64 client plays EA, dice, legal, intro and the menu movie.
The per-change history with the PE/ELF evidence is on mac-metal.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GitHub no longer provides the macos-14 image ("The configuration 'macos-14-arm64-us-default' is not
supported"), so both macOS legs were cancelled before their first step. macos-15 is the current
Apple-silicon image.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The first macos-15 run stopped in vkd3d's configure: "perl module 'JSON' not found". The local builds had the module already. cpanminus installs it into a local lib that PERL5LIB points at. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ls the job The step called dxsdk.cmd without `fallback`, so on a hosted runner (no April 2005 SDK) it failed with exit code 1: the if-errorlevel branch wrote its notice but left the error level set. The step now makes the same call as renddx9.cmd and textureatlasbuilder.cmd (`dxsdk.cmd x86 fallback`) and always exits 0; it reports found=false only when neither the SDK nor the D3DX fallback is usable. The x86 client and editor build with the fallback on hosted runners, as main's workflow already shows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The second macos-15 run stopped in vkd3d's configure: "vulkan.h not found". The local builds take vulkan-headers, spirv-headers and pkg-config from Homebrew under /usr/local, which the compiler searches by default; the Apple-silicon runner's /opt/homebrew is not, so CPPFLAGS names both include directories. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Windows matrix built the client only on x86, from before the x64 client existed. The D3DX check now runs for both architectures (dxsdk.cmd <arch> fallback) and the client step builds bf2_client on x64 as well: RendDX9 x64 with the Bink port, through the D3DX fallback on hosted runners. The x64 package stays server-only; the editor and the retail layout checks stay x86-only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The aim correction rounds a sub-unit mouse step up to one count with `mx = mx > 0 ? 1 : -1`, an int assigned to a float, which MSVC x86 reports as C4244. The constants are now 1.0f and -1.0f; the values are unchanged. This was the only warning the change added over main's x86 build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Engine, game, AI, UI and the fully recovered renderer (1/2)
macOS client with the Metal renderer, macOS CI (2/2)
…scard - PerformanceLogging (BF2Engine +0x74) is now a complete type (Game/Main/PerformanceLogging.h), so shutdownGame and shutdownEngine no longer delete an incomplete type (MSVC C4150, clang -Wdelete-incomplete). Linux ELF evidence: vtable 0x08892F60 with the single slot handleEvent (empty body, 0x0813AFF0); typeinfo 0x08892FA8 with the single base IEventListener. The vtable is stored only by the two inlined destructors (0x08138259, 0x081394DF), and GSPerfLogAtPlayerCount is only registered as a default (0x0812F44D), so 1.50 never creates the object. No data members ([CHOSEN, not recovered]: nothing constructs or reads one). The client PE is [INFERRED] to match. - BF2Engine::shutdownEngine: the window (+0x10) and BF2Render (+0x18) deletes are compiled only into client images. The dedicated image never creates either object (BF2Engine::init's client branch does), so both pointers stay null there; the client-only classes are not declared in a dedicated build, which made the deletes incomplete (C4150). - dwordB0 (+0xB0), a one-byte allocation of unresolved type held as void*: both frees call ::operator delete, the bare operator delete the image calls (0x8138b43), instead of deleting a void*. - Consistent class keys for MSVC: GameTemplateConsoleAccess and MissileLockMessage are structs (MaskObjectTemplate.h, AIDllTypes.h declared them as classes; C4099). Neither name is in an export list. - The AI's unused std::set::find results, which the image computes and discards, are cast to void (C4834). - RendDX9Base.h defines WIN32_LEAN_AND_MEAN only when it is not already defined (C4005). No behaviour change: PerformanceLogging stays null, the client deletes are unchanged, and the dedicated pointers are provably null. Left as they are, because they encode the shipped arithmetic or are third-party code: C4018 (signed/unsigned comparisons), C4334 (32-bit shifts in the AI), C4244 in HudScoreboard.cpp, C5287 (GameSpy). Validation: macOS bf2_client, bf2 and bf2_aidll build without the warnings above. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Destructor and warning fixes: complete delete types, class keys, nodiscard
Each cast states what the binary does; only the OBB vertex-count test changes behaviour, back to the shipped signed comparison. - C4018, the unsigned tick comparisons, now explicit: GameLogic::getTimeToNextStateChange (PE 0x464B30, unsigned), Player's heal and gave-ammo flags (unsigned), and Soldier's hit-by-vehicle window (ELF 0x081B67CF, cmp/jae). - C4018, ResponsePhysicsManager::checkMeshObjectVsObjects' OBB stage: both vertex counts compare signed against the limit (ELF 0x0837185B jg, 0x08371AB6 jle). The implicit unsigned comparison differed from retail once a console write made the limit negative; the counts are now cast to int. - C4334, the AI's control bits: `1 << key` is a 32-bit int shift that is then sign-extended to the 64-bit mask (ELF libaidll BBPRevive 0x002994BE: shl, cltd). The shift is now explicitly an int at all eight sites; the widening is unchanged. - C4244, HudScoreboard: m_field028 (only ever zero here) is passed to the float row-highlight parameter through an explicit cast. - C5287, GameSpy's enum comparisons: the vendored C targets disable the warning; the SDK code stays as shipped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Windows x64 build reported 60 warnings that the x86 build cannot show; none is a 64-bit defect. - GameSpy (56): C4244/C4267 are string, packet and buffer lengths (size_t, pointer differences) held in int or DWORD; C4311/C4312 are buddy and block indices passed through a callback's void* user data and back (gpiBuddy.c, gpiProfile.c, int -> unsigned long -> void* -> int). Both round-trip losslessly at the sizes GameSpy handles, as in the x86 build. The vendored C targets disable these four warnings; the SDK code stays as shipped. - PasswordCodec::readHexPairs and ::decode (4): the half-length of the stored hex string is a 32-bit count, as in the image; the size_t is now narrowed explicitly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Remaining MSVC warnings: shipped comparisons and shifts made explicit
The owner asked for a dedicated switch: "the flag should be tutorialMessages and it is switched on by default". It supersedes the +help 0/1 tutorial override. - +tutorialMessages 0|1 (client images, option id 78) hides or shows the tutorial messages for this session through the existing GSCommandLineShowTutorialMessages entry; the profile setting, on by default, is never written and applies when the switch is absent. Any other or a missing value prints "+tutorialMessages: expected 0 or 1" and ends start-up, like +widescreenHud. - +help and +? use the retail texts on every image again, and every +help form prints the usage and returns false, as in retail. - The tutorial fixture covers the new switch's forms and refusals, all +help/+? forms and the no-switch profile path; building.md and the release readme hints name +tutorialMessages 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Providers that answer the retail GameSpy names, for example BF2Hub, need those names to resolve elsewhere while URLs and HTTP Host headers stay retail. All redirection now happens in one resolver seam of the vendored SDK, gsiRedirectHostname / gsiGetHostByName, used by every compiled service lookup (availability, qr2, gcdkey, gstats, natneg, gp, server list, ghttp and its resolver thread). The redirect only returns another name; the SDK's own resolver looks it up at every lookup, so nothing is resolved or cached at start-up. - +gamespyRedirect <IPv4|domain> (every image) covers names containing "gamespy" or under dice.se. An IPv4 address: those names resolve to it. A domain D: the retail domain is swapped (gpcm.gamespy.com -> gpcm.D, eapusher.dice.se -> eapusher.D); if that name does not resolve, the lookup fails. - +gamespyRedirect<label> <IPv4|host> (client images) redirects one retail host by the exact label before its domain: available, ms14, master, gpcm, gpsp, gamestats, BF2Web, stage-net, eapusher, natneg1, natneg2, natneg3. A label option wins over +gamespyRedirect. key.gamespy.com has none: it is never looked up, CD keys are checked at the heartbeat address. - +gamespy <domain> is removed, together with its URL and Host rewriting; HTTPRequest, PlayerStatsManager and StatsManager use the retail strings again. Without any option nothing is installed. - Values are checked at start-up (IPv4 or host name, domains up to 230 characters); an invalid one ends start-up. Redirected names are logged with their target, and the options are passed on when the client restarts for a mod. [CHOSEN, not recovered]: retail has none of this. The SDK change is recorded in GameSpy/LOCAL_CHANGES.md. bf2_online_provider_check covers the names, IPv4 and domain fallbacks with per-lookup re-resolution, every label, precedence, all SDK services and the stats web requests reaching their targets with retail Host headers, refusals and the restart string; the persistence and leaderboard checks use the redirect. docs/building.md has the option table and the migration from +gamespy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add +tutorialMessages client switch; +help is retail again
Online services: retail names only, +gamespyRedirect per host
…ative Client images on CPUs without the x87 80-bit long double (Apple silicon, Linux AArch64) now evaluate the recovered x87 expression arms in binary32 instead of the software ExtendedFloat. Retail's main thread runs the x87 at 24-bit precision: BF2.exe's only _controlfp call is the CRT startup _controlfp(_PC_53, _MCW_PC) at 0x83DBBC, and the client creates its D3D9 device with behaviour flags 0x50, without D3DCREATE_FPU_PRESERVE, so every arithmetic result of the thread that runs rendering, game logic, collisions, the local host and the menus is rounded to 24 bits. Only the exponent range of the intermediates differs. The software arm cost hundreds of milliseconds on the first bullet impacts on Apple silicon (#39): on arm64, DecalObject::buildProjected drops from 2786 instructions and 162 calls (60 ExtendedFloat::pack, 58 feraiseexcept) to 358 and 20. The operations take binary64 operands and round once to binary32, which for binary32 operands is the binary32 operation itself. Loads of int32 and double values therefore stay exact up to the first operation, as FILD and FLD are, and comparisons and integer conversions of loaded values are exact; this covers the implicit loads, such as ActionScript numbers converted to integers. wideExact() marks the explicit loads of doubles and large integers that reach a comparison, an integer conversion or a time difference. No bf2x87 user runs on another client thread. The dedicated server (DEDICATED=1), the AI library and BF2_TEST_SOFT_EXTENDED builds keep ExtendedFloat; BF2X87_CLIENT_EXACT_EXTENDED selects it for a client build, and the numeric checks of the exact arm now define it. x86 and x86-64 objects are unchanged. portable_x87 covers the binary32 arm (BF2_TEST_CLIENT_FLOAT), including a randomized comparison with the host x87 at 24-bit precision control. The SwiffPlayer transparency comment now names the 24-bit precision of the menu thread. Refs #39. Replaces the per-file decal scope proposed in #40. Co-Authored-By: jussimir <31292834+jussimir@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
FLD of a signaling NaN raises invalid and loads it quiet. In the binary32 client arm a loaded float that reaches a store without an arithmetic operation went through no instruction at all: GCC at -O2, and Clang without -frounding-math (the client's own flags), fold the float -> double -> float round trip of wide() and store(), so consoleFloat() returned 0x7f800001 unchanged without raising invalid, and decoded() stored the signaling payload. bf2_arm_portable_x87_float aborted at the consoleFloat check with GCC Release. wideQuiet() marks those loads and performs the FLD step explicitly in the binary32 arm: a range check on the bits, feraiseexcept(FE_INVALID) and the quiet bit for a signaling NaN, for float and double. Arithmetic operations quiet the value in hardware, and compare() and integer() raise invalid for every NaN, so no other load needs it; the hot paths are unchanged. consoleFloat() and decoded() are the only pass-through loads of the arm. The native, soft extended, dedicated and AI objects are unchanged (wideQuiet is wideExact there). portable_x87 now reads its signaling inputs through memory, so GCC cannot fold them, and checks the quieted bits and the exception for float and double loads, and that quiet NaNs, infinities and denormals load without one. The native arm keeps its previous check; GCC elides FLD/FSTP there too. Refs #39. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Client arithmetic: binary32 x87 arms where the 80-bit format is not n…
#41 Retail repaints the loading screen on every effect load (shaderLoadingEvent posts ECMenu UpdateLoadingScreen outside LoadStat's 1/30 s throttle), about 1,700 presents for a Dalian Plant load. With vsync on, each blocking Present waited for a free back buffer, so the load ran at the display refresh rate (macOS Metal, i7-8569U: 7.8 s of a 44.5 s warm load waiting in nextDrawable). [CHOSEN, not recovered] While LoadStat's load callback is registered, rendererPresent presents with D3DPRESENT_DONOTWAIT on every client platform, as renderer.presentAsync does. On WASSTILLDRAWING the retail busy handling keeps the frame and presents it at the next beginScene, which skips that event's draw; every drawn loading frame still reaches the screen. Presents outside a level load are unchanged. Per backend: Windows D3D9 answers busy while its present queue is full. The Metal device already acquires the drawable on a worker and answers busy while none is free; it now asks for the next drawable right after a DONOTWAIT present, and traced runs report shown and busy DONOTWAIT presents. DXVK Native (Linux) ignores the flag, so Linux presents as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lay (#41) #41 A level load repaints far faster than the display refreshes, with or without vsync, and every repaint the display cannot show still costs a full loading-screen draw (about 5.7 ms of main-thread time per frame on an i7-8569U). [CHOSEN, not recovered] A Metal DONOTWAIT present now answers WASSTILLDRAWING until the previous DONOTWAIT drawable's presented handler has run, or 100 ms have passed (an occluded window). The renderer's retail busy handling then skips that repaint's draw and shows the frame it keeps at the next beginScene. Warm Dalian Plant load: 39.0 -> 33.2 s with vsync off, 44.5 -> 32.0 s with vsync on (both commits). Blocking presents are unchanged; renderer.presentAsync presents get the same display pacing. macOS only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
act read the JSON boolean in the event file as false and the event file overrides --input, so the Windows jobs ran and failed on the placeholder image after the Linux jobs had passed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SwiffRender's font slots +0x80 (text hit) and +0x84 (text selection) forward SwiffPlayer's int* outs to the font wrapper. Their MSVC spelling carried the outs in 32-bit ints, which only holds on x86. MSVC x64 truncated the stack addresses, and DifFont::hitTest (and the selection getter) wrote through the truncated value: clicking an empty text field in the menu crashed RendDX9.dll. Take the native int* signatures on MSVC x64 too, as SwiffFont's +32/+40 bodies already do (`!defined(_MSC_VER) || defined(_WIN64)`). The x86 arms are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When gpConnectUniqueNick failed, login() called gpDestroy before reportError(lastErrorString()). gpDestroy nulls the connection, so gpGetErrorString returned without writing and lastErrorString built the popup text from its uninitialised 256-byte stack buffer. A wrong password in "Retrieve account" (loginAccount: gpsp nicks and check succeed, then the gpcm login refuses) showed "H" on Windows x64 and "general error" on macOS instead of the server's errmsg. All platforms are affected. BF2.exe 0x4A6BD0 calls gpDisconnect (0x5AFA40: the null and simulation checks, gpiDisconnect, gpiReset) on that path, then lastErrorString (0x4A4BE0) and reportError; the connection and its error text stay alive until the next logout destroys them. Do the same. bf2_profile_manager_login_error_check (macOS, on request) runs the production ProfileManager with the linked GameSpy SDK against loopback availability/gpcm/gpsp stand-ins whose login refuses the password, and checks that the popup carries the server's errmsg. The x86 fixture's refused-connect call order now expects disconnect instead of destroy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This SDK revision sends "\ka\\final\" to gpcm after two idle minutes. Retail BF2.exe 1.50 never does: its only "\ka\" is in the incoming message table (0x506354) and "\ka\\final\" is not in the image. BF2Hub's gpcm answers the unknown command with "\error\\err\0\fatal\\errmsg\Not implemented", which logged the player out (to the login screen) a few minutes after logging in. The server's own "\ka\" is still read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The menus fit their movie to the SwiffHost viewport, and since #50 the pointer and the drawing use the same centred 4:3 rectangle. Retail hands the menu WM_MOUSEMOVE's client coordinates unchanged (BF2.exe 0x58DF40 dispatches the handlers, which pass LOWORD/HIWORD) and sets the viewport from REChangeResolution's requested mode (0x4097B0). Both only describe the drawn pixels while the window's client area is exactly that mode. A windowed device has zero back-buffer dimensions, so D3D takes the back buffer from the client area at the reset. When the desktop clamps the window (a mode as tall as the screen plus the caption), the client area, and with it the back buffer, is smaller than the requested mode. The menu offset then came from the real back buffer while its scale and the pointer came from the requested mode, so clicks drifted away from the pointer. A window resized without a reset shows its back buffer stretched, which the pointer did not follow either. Windowed, REChangeResolution now takes the client area the device really has for the menu and the SwiffHost viewport, and WM_MOUSEMOVE scales client coordinates to that viewport when the two differ, as the native hosts already report back-buffer pixels. Equal sizes keep the retail values. macOS and Linux are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A clean Windows 11 install has no MSVCP140.dll, so the x64 client did not start without the VC++ redistributable. /MD stays mandatory (the executable, dice_py.dll and the plugins share one CRT heap). [CHOSEN, not recovered] package_release.py copies vcruntime140*.dll and msvcp140*.dll from the newest Microsoft.VC*.CRT folder of the package's architecture beside each Windows executable (both clients, both servers, the editor), as ship.ps1 does for the x86 server and retail did with MSVCR71.dll. The input is --vc-redist-dir, by default %VCToolsRedistDir%; CI calls vsdevcmd.cmd in the packaging step and passes it. Packaging fails without it or when a DLL is not a PE image of the package's architecture. The DLLs are runtime files (hashed in build-info.json, which also records the CRT folder as vc_runtime), and --release windows and release.yml refuse a component without them. licenses/Microsoft-VC-Runtime.txt names the files as Microsoft Distributable Code under the Visual Studio 2022 license terms (with the redist list URL from Visual Studio's own Redist.txt). The READMEs now say the runtime is included and that the UCRT is part of Windows 10/11. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The vendor client exists only as 32-bit Windows DLLs (pb/pbcl.dll), so the Windows x64, macOS and Linux clients never have PunkBuster. Their main menu still offered the PunkBuster checkbox on JOIN INTERNET and the "PunkBuster" server filter, and a profile with GSClPunkBuster on made a join announce PunkBuster: a PunkBuster server then let the client in with a glue that can only report "PunkBuster Client Not Installed", instead of refusing it at once with denial 31. Retail has no availability query to answer. mainMenu.swf seeds the checkbox from GeneralSettings.getAllowPunkBuster and never disables it; BF2Engine::startGame passes GSClPunkBuster to joinServer as read (BF2.exe 0x4052A1..0x4052E7); the only pb/pbcl.dll test in BF2.exe is PB_set_cl_punkbuster's (0x4D953B), and SwiffPlayer.dll has none. [CHOSEN, not recovered], on builds without PunkBuster only (Game/PunkBuster/PbAvailability.h, SwiffPlayer/PunkBusterMenu.h): - the join announces no PunkBuster, whatever the profile says; - getAllowPunkBuster and getToggleFilter(128) answer false and call the authored checkbox's own disable() (dice.UIs.Form, as the movie does for filtersButton), so the option shows off and greyed out; - a stored "bf2_anticheat = 1" filter is left out of the browser query. GSClPunkBuster is not rewritten, so a profile shared with an x86 client keeps it; the movie's own callback clears the stored filter bit when it seeds the filter panel. The x86 Windows client is unchanged. bf2_swiff_punkbuster_menu_check (macOS) covers the policy and the greying helper. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The SEH handler in bf2WinMain wrote no dump. getCrashDumpDirectory() returns "<Documents>\Battlefield 2\dmp\" and crashDumpFileName appends "\bf2_v<build>.dmp", as retail's 0x401410 does, so the name holds "dmp\\bf2_v". writeCrashDump's worker prefixes it with \\?\, which turns off path normalization, and CreateFileW fails with ERROR_INVALID_NAME (123). The worker skips MiniDumpWriteDump when CreateFileW fails, so the process exits with 42 and leaves only the empty dmp directory. Retail builds the same name; checked on Windows 11 with a CreateFileW probe. [CHOSEN, not recovered] crashDumpFileName leaves out its separator when the directory already ends in one. The file now lands at <Documents>\Battlefield 2\dmp\bf2_v1.5.3153-802.0_<date>_<time>.dmp. This affects BF2.exe and bf2_w32ded.exe (x86 and x64). w64_crash_dump_runtime now also runs the extracted crashDumpFileName and bf2WinMain bodies: an access violation in the engine stand-in goes through the real SEH filter, crashDumpTargetName and writeCrashDump, and the test checks that the dump has the exception stream, the faulting thread and exit code 42. Without the fix it fails with ERROR_FILE_NOT_FOUND. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Retail protects an empty key too: protect refuses it and writeHex then dereferences the null blob, so joining a server with no stored CD key crashed at the first challenge (seen on macOS arm64 against BF2Hub). translateCdKey now returns empty for an empty key, and handleChallenge's existing reason-7 disconnect runs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The owner chose the sub-domains bf2.org provides for the online services; the setup application ships provider files for BF2Hub and OpenSpy and passes the selected one. One option, +onlineProviderConfig <path> (id 91, client and dedicated server images, process command line only), now names that JSON file. +gamespyRedirect and the +gamespyRedirect<label> options are removed; their ids 77 and 79 to 90 stay unused like 75. The file is the setup's provider format: "schema" must be 1, "provider" is a display name for the log, "services" maps "*" (the former +gamespyRedirect) and the twelve retail labels, spelled exactly (the former label options), to an IPv4 address or a host/domain name. Other top-level keys such as "valid_to" are ignored. A small strict JSON reader in OnlineProvider.cpp (no vendored reader exists, no new dependency) refuses malformed JSON, files over 64 KiB, duplicate keys, wrong types, unknown service keys and the values the old options refused; a refused file ends start-up with one message naming the option, the file and the reason. Label entries now apply on dedicated servers too: the label options were client-only by registration only, and the resolver seam is the same in both images, so one file serves both. The resolver seam, the retail names, URLs and Host headers are unchanged; the log names the file's key (services.gpcm, services.*) and the start-up line the provider and the file. A client that restarts for a mod passes the same path on, quoted when needed. [CHOSEN, not recovered]: retail has none of this. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bf2_online_provider_check now drives every scenario through provider files written into a temporary directory it removes. New scenarios: "file" (each refusal rule with its reason, the 64 KiB limit, the byte order mark, ignored top-level keys, case-sensitive labels, label precedence in any order, a refused file changing nothing, the restart arguments with and without a space) and "setup-files" (the setup's two shipped files, a macOS path with spaces through the entry point's argv joining and the mod restart's splitting, Windows paths with drive letters and backslashes at string level). "names" checks that the old switches are no options any more. The test links MacSystem.cpp for the client's real restart splitting. The persistence and leaderboard checks load a provider text with "*" at their test domain instead of calling the removed setter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/building.md "Online services" states the +onlineProviderConfig
contract for the setup application: the option and its path handling
(absolute or relative, quoting, parser limits, the mod restart), the
file format and every rule, the error messages, the logging, the
shipped BF2Hub file as the example, a split-provider example and the
migration from both removed option forms. architecture.md and
ROADMAP.md name the new option.
loopback.py --name-redirect writes online-provider.json ("*": the test
domain) into the run directory, passes +onlineProviderConfig to server
and client, and allows reading that file in both sandbox profiles. The
name redirect and stats fixture instructions use a provider file.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.