Remove ATL dependency so VC++ Express can build

The Express editions of Visual C++ ship without ATL. The only ATL usage was
in MUNGA_L4/L4APP.cpp (atlbase.h/atlconv.h + USES_CONVERSION/W2A macros, all
in that one file) for wide-to-ANSI conversion of command-line arguments.

- Replace the ATL includes with a self-contained L4WideToAnsi helper (a
  WideCharToMultiByte wrapper) and local USES_CONVERSION/W2A macros that
  reproduce ATL's W2A semantics. All call sites consume the result immediately
  (stricmp / CString assignment / atoi / atol), so behaviour is unchanged.
- Set UseOfATL="0" in Munga_L4.vcproj, RP_L4.vcproj and their VS2008 variants.
- Document the Express build path and the confirmed June 2010 DirectX SDK in
  BUILD.md (new section 6) and docs/BUILD-NOTES.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Cyd
2026-07-01 09:30:08 -05:00
co-authored by Claude Opus 4.8
parent 2229f154d1
commit f849415c02
7 changed files with 103 additions and 14 deletions
+28 -3
View File
@@ -12,9 +12,9 @@ You must supply the toolchain — none of it is checked into this repo.
| Component | Required version | Notes |
|-----------|------------------|-------|
| **Visual Studio** | 2005 (v8) or 2008 (v9) | Project files are the legacy `.vcproj` format. Modern MSBuild **cannot** build `.vcproj` directly — it needs `VCBuild.exe`, which only ships with VS 2005/2008. A newer VS (2022) can build these but will first *upgrade* the projects to `.vcxproj`. |
| **DirectX SDK** | March 2009 (June 2010 also works) | Provides `d3d9.lib`, `d3dx9.lib`, `dinput8.lib`, `dxguid.lib`, `dxerr.lib` and headers. |
| **Windows SDK / Platform SDK** | Matching your VS | Provides `WS2_32.lib`, `dbghelp.lib`, etc. |
| **Visual Studio** | 2005 (v8) or 2008 (v9)**Express is fine** | Project files are the legacy `.vcproj` format. Modern MSBuild **cannot** build `.vcproj` directly — it needs `VCBuild.exe`, which only ships with VS 2005/2008. A newer VS (2022) can build these but will first *upgrade* the projects to `.vcxproj`. The code uses **no MFC** and (as of the ATL-removal change) **no ATL**, so the free **Visual C++ Express** editions build it — see §6. |
| **DirectX SDK** | June 2010 (installed) — March 2009 also works | Provides `d3d9.lib`, `d3dx9.lib`, `dinput8.lib`, `dxguid.lib`, `dxerr.lib` and headers. ✅ Confirmed installed at `C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)` with `DXSDK_DIR` set machine-wide. |
| **Windows SDK / Platform SDK** | Matching your VS (e.g. Windows SDK 7.1) | Provides `WS2_32.lib`, `dbghelp.lib`, etc. With an Express edition, install the standalone Windows SDK 7.1 to guarantee these. Note: `dbghelp.lib` is listed as a link input but **no source references it** — drop it from the linker line if it isn't found. |
| **`DXSDK_DIR` environment variable** | — | The DirectX SDK installer sets this automatically (includes a trailing backslash). The projects reference the SDK **only** through this variable — see §4. |
### Bundled third-party libraries (already in the repo)
@@ -116,3 +116,28 @@ $env:DXSDK_DIR = "C:\DXSDK\" # note the trailing backslash
- Requires the OpenAL and libsndfile **runtime DLLs** at run time (see §1).
- See [docs/BUILD-NOTES.md](docs/BUILD-NOTES.md) for the repository cleanup
history, orphaned files, and the full findings behind this document.
---
## 6. Building with Visual C++ Express (2008)
The Express editions are free but ship **without MFC and without ATL**. This
codebase uses no MFC, and its only ATL dependency has been removed, so Express
now builds it:
- `MUNGA_L4/L4APP.cpp` previously included `<atlbase.h>` / `<atlconv.h>` and used
the `USES_CONVERSION` / `W2A` macros to convert wide command-line arguments to
ANSI. These were replaced with a small self-contained `L4WideToAnsi` helper
(a thin `WideCharToMultiByte` wrapper) that reproduces ATL's `W2A` behaviour.
- `UseOfATL` was set to `0` in `Munga_L4.vcproj`, `RP_L4.vcproj` and their
`VS2008` variants.
Checklist for a clean Express build:
1. Install **Visual C++ 2008 Express SP1**.
2. Install the **Windows SDK 7.1** (for `WS2_32.lib`, `dbghelp.lib`, core Win32
headers/libs that Express's bundled SDK subset may not fully cover).
3. Install the **DirectX SDK** (already done — June 2010) and confirm `DXSDK_DIR`.
4. Open `WinTesla.sln`, pick `Release|Win32`, build.
5. If the linker can't find `dbghelp.lib`, remove it from
`RP_L4` → Linker → Input → Additional Dependencies (it is unused).
+39 -2
View File
@@ -13,8 +13,45 @@
#include "l4mppr.h"
#include "..\munga\player.h"
#include "..\munga\mission.h"
#include <atlbase.h>
#include <atlconv.h>
//
// Minimal stand-in for ATL's <atlconv.h> USES_CONVERSION / W2A macros.
// VC++ Express and the Windows SDK do not ship ATL, and the only ATL feature
// this file used was wide-to-ANSI conversion of command-line tokens below.
// L4WideToAnsi mirrors ATL's W2A semantics: each use produces an independent
// buffer that stays valid until the end of the enclosing full-expression.
//
namespace
{
class L4WideToAnsi
{
public:
explicit L4WideToAnsi(const wchar_t* wide) : mBuffer(0)
{
int needed = (wide != 0)
? ::WideCharToMultiByte(CP_ACP, 0, wide, -1, 0, 0, 0, 0)
: 0;
if (needed <= 0)
{
needed = 1;
}
mBuffer = new char[needed];
if (wide == 0 ||
::WideCharToMultiByte(CP_ACP, 0, wide, -1, mBuffer, needed, 0, 0) <= 0)
{
mBuffer[0] = '\0';
}
}
~L4WideToAnsi() { delete [] mBuffer; }
operator char*() { return mBuffer; }
private:
char* mBuffer;
L4WideToAnsi(const L4WideToAnsi&); // non-copyable
L4WideToAnsi& operator=(const L4WideToAnsi&);
};
}
#define USES_CONVERSION ((void)0)
#define W2A(w) (static_cast<char*>(L4WideToAnsi(w)))
L4Application*&
l4_application = (L4Application*&)application;
+1 -1
View File
@@ -20,7 +20,7 @@
OutputDirectory="..\lib"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
UseOfATL="1"
UseOfATL="0"
CharacterSet="1"
>
<Tool
+3 -3
View File
@@ -19,7 +19,7 @@
OutputDirectory="..\lib"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
UseOfATL="1"
UseOfATL="0"
CharacterSet="1"
>
<Tool
@@ -85,7 +85,7 @@
OutputDirectory="..\lib"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
UseOfATL="1"
UseOfATL="0"
CharacterSet="1"
>
<Tool
@@ -156,7 +156,7 @@
OutputDirectory="..\lib"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
UseOfATL="1"
UseOfATL="0"
CharacterSet="1"
>
<Tool
+2 -2
View File
@@ -22,7 +22,7 @@
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
UseOfATL="1"
UseOfATL="0"
CharacterSet="1"
>
<Tool
@@ -190,7 +190,7 @@
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
UseOfATL="1"
UseOfATL="0"
CharacterSet="1"
>
<Tool
+3 -3
View File
@@ -22,7 +22,7 @@
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
UseOfATL="1"
UseOfATL="0"
CharacterSet="1"
>
<Tool
@@ -107,7 +107,7 @@
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
UseOfATL="1"
UseOfATL="0"
CharacterSet="1"
WholeProgramOptimization="1"
>
@@ -200,7 +200,7 @@
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
UseOfATL="1"
UseOfATL="0"
CharacterSet="1"
>
<Tool
+27
View File
@@ -91,6 +91,33 @@ $(DXSDK_DIR)Lib\x86
`DXSDK_DIR` is set by the DirectX SDK installer and ends in a trailing
backslash, so `$(DXSDK_DIR)Include` resolves correctly.
> **Status update:** the **DirectX SDK (June 2010)** is now installed at
> `C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\`, and `DXSDK_DIR`
> is set machine-wide to that path. All required headers (`d3d9.h`, `d3dx9.h`,
> `dinput.h`) and libs (`d3d9.lib`, `d3dx9.lib`, `dxerr.lib`, `dxguid.lib`) are
> present. The un-hardcoded projects resolve to it automatically.
### 2.4 ATL removed (enables VC++ Express)
The Express editions of Visual C++ ship without ATL. The codebase's only ATL
usage was in `MUNGA_L4/L4APP.cpp``<atlbase.h>` / `<atlconv.h>` and the
`USES_CONVERSION` / `W2A` macros (28 references, all in that one file), used
purely to convert wide command-line arguments to ANSI in the arg parser. No
COM, no `CComPtr`, no ATL windows.
Changes:
- Replaced the ATL includes with a self-contained `L4WideToAnsi` helper class
(a `WideCharToMultiByte` wrapper) plus local `USES_CONVERSION` / `W2A` macros
that reproduce ATL's `W2A` semantics — each use yields an independent buffer
valid until the end of the enclosing full-expression. Every call site consumes
the result immediately (compare via `stricmp`, assign to MUNGA's `CString`,
or pass to `atoi`/`atol`), so the behaviour is identical.
- Set `UseOfATL="0"` in `Munga_L4.vcproj`, `RP_L4.vcproj`, and the two `VS2008`
variants.
`CString` in this file is **MUNGA's own** class (`MUNGA/CSTR.h`), not ATL's, so
dropping the ATL headers does not affect it.
---
## 3. Project reference data