Skip to content

chore: Remove all code related to _XBOX#2505

Merged
xezon merged 1 commit intoTheSuperHackers:mainfrom
stephanmeesters:chore/remove-xbox-define
Mar 30, 2026
Merged

chore: Remove all code related to _XBOX#2505
xezon merged 1 commit intoTheSuperHackers:mainfrom
stephanmeesters:chore/remove-xbox-define

Conversation

@stephanmeesters
Copy link
Copy Markdown

@stephanmeesters stephanmeesters changed the title chore(ww3d2): Remove XBOX define chore: Remove XBOX define Mar 30, 2026
@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Mar 30, 2026

Greptile Summary

This PR removes Xbox-specific (_XBOX) conditional compilation code from the WW3D2 rendering library shared between Command & Conquer Generals and Generals Zero Hour. It relates to #2499 and is part of a broader cleanup effort.

Key changes:

  • codex.h / gimex.h: Drops !defined(_XBOX) guard from the GCALL / __stdcall definition, now unconditionally applying __stdcall on MSVC (correct for PC).
  • ww3dformat.h: Removes the four Xbox-linear depth/stencil enum values (WW3D_ZFORMAT_LIN_*) and their handling in ww3dformat.cpp switch statements.
  • formconv.cpp: Collapses the #ifndef _XBOX / #else / #endif blocks around the Z-format conversion array initializer and the HIGHEST_SUPPORTED_D3D*FORMAT macro definitions to the PC-only branch.
  • texture.cpp: Removes the Xbox guard around GetPriority() / SetPriority() calls.
  • Both dx8wrapper.cpp copies: Removes already-commented-out // #ifndef _XBOX / // #endif // XBOX lines and the dead XBOX branch for Vertex_Processing_Behavior in GeneralsMD.

All removals are internally consistent: the enum values removed from the header are also removed from all switch statements and conversion arrays. No logic changes are introduced for PC builds.

Confidence Score: 5/5

Safe to merge — all changes are pure removal of dead Xbox code; no logic modifications to any PC code path.

Every deletion in this PR was already inactive on PC: the _XBOX macro was never defined for this target, the commented-out guards were already no-ops, and the removed enum values were guarded by #ifdef _XBOX. The array size in formconv.cpp and the switch coverage in ww3dformat.cpp remain consistent after the removals. No P0 or P1 findings were identified.

No files require special attention.

Important Files Changed

Filename Overview
Core/Libraries/Source/WWVegas/WW3D2/ww3dformat.h Removes four Xbox-linear Z-format enum values; WW3D_ZFORMAT_COUNT now correctly reflects PC-only formats.
Core/Libraries/Source/WWVegas/WW3D2/formconv.cpp Collapses Xbox/PC ifdef branches in the Z-format conversion array and macro definitions; array size now matches the updated enum count.
Core/Libraries/Source/WWVegas/WW3D2/ww3dformat.cpp Removes Xbox-specific cases from three switch statements consistent with enum changes in ww3dformat.h.
Core/Libraries/Source/WWVegas/WW3D2/texture.cpp Removes Xbox guards around GetPriority/SetPriority; PC behavior unchanged.
Core/Libraries/Source/Compression/EAC/codex.h Removes Xbox exclusion from GCALL/__stdcall definition; now unconditionally uses __stdcall on MSVC.
Core/Libraries/Source/Compression/EAC/gimex.h Same GCALL cleanup as codex.h; no functional change for PC builds.
Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp Removes already-commented-out Xbox preprocessor guard lines from two Set_Render_Target overloads; no runtime change.
GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp Removes commented-out Xbox guards in Set_Render_Target and the dead XBOX branch for Vertex_Processing_Behavior in Create_Device.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[WW3DZFormat enum\nww3dformat.h] -->|WW3D_ZFORMAT_* values\n8 entries, no LIN_ variants| B[WW3DZFormatToD3DFormat\nConversionArray\nformconv.cpp]
    A -->|switch cases| C[Get_WW3D_ZFormat_Name\nww3dformat.cpp]
    A -->|switch cases| D[Get_Num_Depth_Bits\nww3dformat.cpp]
    A -->|switch cases| E[Get_Num_Stencil_Bits\nww3dformat.cpp]
    B -->|Init_D3D_To_WW3_Conversion| F[D3DFormatToWW3DZFormat\nConversionArray]
    G[GCALL / __stdcall\ncodex.h / gimex.h] -->|Always __stdcall on MSVC\nno Xbox exclusion| H[Function pointer tables\nQFUNCTIONS / GFUNCTIONS]
    I[DX8Wrapper\ndx8wrapper.cpp] -->|Set_Render_Target\nno dead Xbox comment guards| J[IDirect3DSurface8\nrender target]
Loading

Reviews (1): Last reviewed commit: "chore(ww3d2): Remove XBOX define" | Re-trigger Greptile

@xezon xezon added the Refactor Edits the code with insignificant behavior changes, is never user facing label Mar 30, 2026
@xezon xezon changed the title chore: Remove XBOX define chore: Remove _XBOX define Mar 30, 2026
@xezon xezon changed the title chore: Remove _XBOX define chore: Remove all code related to _XBOX Mar 30, 2026
@xezon xezon merged commit d90909d into TheSuperHackers:main Mar 30, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Refactor Edits the code with insignificant behavior changes, is never user facing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants