XNA 4.0 Compatibility
How this page measures coverage. The numbers below are not estimates. Every public type in FNA — the reference C# reimplementation of XNA 4.0 — was enumerated and checked against CNA's public headers. That gives a defensible answer to "does this type exist," which is what the table reports. It does not tell you the type behaves correctly; for that, see Verification & Known Issues, which lists every gap that is currently known.
Coverage at a glance
XNA 4.0 public types present in CNA, per namespace:
| Namespace | Types present | Notes |
|---|---|---|
Microsoft.Xna.Framework | 42 / 42 | Game, GameTime, all math and bounding-volume types. |
….Graphics | 91 / 91 | Every XNA 4.0 graphics type exists. Behavioural gaps are listed separately. |
….Graphics.PackedVector | 18 / 18 | Complete, including IEEE 754 half-float types. |
….Audio | 19 / 19 | Includes a real XACT runtime (.xgs/.xwb/.xsb parsing). |
….Input | 17 / 17 | Keyboard, Mouse, GamePad incl. rumble and trigger motors. |
….Input.Touch | 8 / 8 | Touch panel and gesture recognition. |
….Media | 25 / 25 shells | Present, but 14 of the 24 classes are API-shaped shells that throw. See below. |
….Storage | 3 / 3 | Real filesystem-backed save data. |
….Content | 4 / 12 major gap | No .xnb pipeline — a deliberate architectural choice. See below. |
| Total | 227 / 245 (92.7%) |
Two namespaces sit outside that comparison because FNA does not implement them at all, while CNA does: Microsoft.Xna.Framework.Net (23 types, backed by real UDP networking over ENet) and Microsoft.Xna.Framework.GamerServices (54 types, a local-only facade). CNA additionally implements the Windows-Phone Microsoft.Devices.Sensors namespace, with genuine Android NDK sensor access.
Present is not the same as working. Three areas have a large gap between the two, and you should know about them before porting:
| Area | The gap |
|---|---|
| Content pipeline | CNA cannot read .xnb files. ContentReader, ContentTypeReaderManager and the ContentSerializer* attributes do not exist. Assets are loaded as raw files (.png, .wav, .ogg, .dds…) plus JSON descriptors for fonts, models and shaders. |
| Custom shaders | Effect's compiled-bytecode constructor throws NotImplementedException. The five stock effects work on every backend; custom HLSL must be hand-rewritten as GLSL/SPIR-V using the CNA-only ShaderEffect. |
| Media library | Song, MediaPlayer, Video and VideoPlayer are genuinely implemented (FFmpeg-backed video, SDL3_mixer audio). But MediaLibrary and the whole catalogue tree — Album, Artist, Genre, Picture, Playlist and their collections — are shells whose members throw. |
Status legend for the per-class tables below:
Implemented Partial In Progress Planned
Microsoft.Xna.Framework
| Class | Status | Notes |
|---|---|---|
Game | Implemented | Full lifecycle: Initialize, LoadContent, Update, Draw, UnloadContent. |
GameTime | Implemented | ElapsedGameTime, TotalGameTime, IsRunningSlowly. |
GameComponent | Implemented | |
DrawableGameComponent | Implemented | |
GameComponentCollection | Implemented | |
GameServiceContainer | Implemented | |
GameWindow | Implemented | Title, resize events, AllowUserResizing. |
GraphicsDeviceInformation | Implemented | |
FrameworkDispatcher | Implemented | |
LaunchParameters | Implemented | |
TitleContainer | Implemented | |
TitleLocation | Implemented | |
Color | Implemented | Predefined colours including CornflowerBlue. |
Vector2 | Implemented | |
Vector3 | Implemented | |
Vector4 | Implemented | |
Matrix | Implemented | |
Quaternion | Implemented | |
Point | Implemented | |
Rectangle | Implemented | |
BoundingBox | Implemented | |
BoundingSphere | Implemented | |
BoundingFrustum | Implemented | |
Plane | Implemented | |
Ray | Implemented | |
MathHelper | Implemented | Trig, Clamp, Lerp, etc. |
Curve | Implemented | |
CurveKey | Implemented | |
CurveKeyCollection | Implemented |
Microsoft.Xna.Framework.Graphics
| Class | Status | Notes |
|---|---|---|
GraphicsDevice | Implemented | Clear, Present, render targets, blend/depth/rasterizer/sampler states, scissor, viewport, DrawPrimitives, DrawIndexedPrimitives, DrawInstancedPrimitives, GetBackBufferData. |
GraphicsDeviceManager | Implemented | Auto-reset, fullscreen toggle, preferred display modes. |
SpriteBatch | Implemented | All SpriteSortMode values, transform matrix, custom Effect, blend/sampler states, DrawString. |
Texture2D | Implemented | Load from file, GetData/SetData, SaveAsPng/SaveAsJpeg, all mip levels, 18 PackedVector pixel formats. |
RenderTarget2D | Implemented | Subclass of Texture2D. FBO + depth renderbuffer (EasyGL); off-screen image (Vulkan). |
Effect | Implemented | EffectParameter with all Get/Set overloads. IEffectMatrices, IEffectFog, IEffectLights. |
BasicEffect | Implemented | Full lighting, fog, texture, vertex color support. |
AlphaTestEffect | Implemented | |
DualTextureEffect | Implemented | |
EnvironmentMapEffect | Implemented | |
SkinnedEffect | Implemented | |
SpriteEffect | Implemented | |
SpriteFont | Implemented | Full glyph model, MeasureString, DrawString (3 overloads). Loaded from .font.json. |
Model | Implemented | Model::Draw with bone transforms, IEffectMatrices binding. Loaded from .model.json. |
VertexBuffer / DynamicVertexBuffer | Implemented | All four VertexPosition* types supported. |
IndexBuffer / DynamicIndexBuffer | Implemented | 16-bit and 32-bit index formats. |
OcclusionQuery | Implemented | EasyGL: GL_ANY_SAMPLES_PASSED; others stub. |
VertexDeclaration | Implemented | |
BlendState / DepthStencilState / RasterizerState / SamplerState | Implemented | All wired to backend Apply* methods. |
Viewport | Implemented | Project / Unproject fully implemented. |
Texture3D / TextureCube | Implemented | SetData/GetData implemented on EasyGL, Vulkan, and Bgfx backends. |
Microsoft.Xna.Framework.Graphics.PackedVector
| Class | Status | Notes |
|---|---|---|
Alpha8 | Implemented | 8-bit alpha channel. |
Bgr565 | Implemented | 16-bit BGR. |
Bgra4444 | Implemented | 16-bit BGRA, 4 bits per channel. |
Bgra5551 | Implemented | 16-bit BGRA, 5-5-5-1. |
Byte4 | Implemented | 32-bit, 4 unsigned bytes. |
HalfSingle | Implemented | 16-bit IEEE 754 half-float. |
HalfVector2 | Implemented | 32-bit, 2x half-float. |
HalfVector4 | Implemented | 64-bit, 4x half-float. |
NormalizedByte2 | Implemented | 16-bit, 2x signed normalized byte. |
NormalizedByte4 | Implemented | 32-bit, 4x signed normalized byte. |
NormalizedShort2 | Implemented | 32-bit, 2x signed normalized short. |
NormalizedShort4 | Implemented | 64-bit, 4x signed normalized short. |
Rg32 | Implemented | 32-bit, 2x unsigned normalized short (16-16). |
Rgba1010102 | Implemented | 32-bit, 10-10-10-2 packed RGBA. |
Rgba64 | Implemented | 64-bit, 4x unsigned normalized short. |
Short2 | Implemented | 32-bit, 2x signed int16. |
Short4 | Implemented | 64-bit, 4x signed int16. |
All 17 PackedVector types include full Pack/Unpack with correct IEEE 754 rounding and edge-case handling (subnormals, ±∞, ±0, NaN).
Microsoft.Xna.Framework.Storage
| Class | Status | Notes |
|---|---|---|
StorageDevice | Implemented | Native filesystem; full XNA API shape. |
StorageContainer | Implemented | Native filesystem backed. |
StorageDeviceNotConnectedException | Implemented |
Microsoft.Xna.Framework.GamerServices
Ported in full (kicked off 2026-06-30, landed 2026-07-07, 132/132 tasks closed, hardening pass ongoing). Not binary-compatible with real Xbox Live — reimplements the public API shape with local/synthetic semantics, the same approach FNA itself uses for this namespace.
| Class | Status | Notes |
|---|---|---|
Guide | Implemented | Real message-box overlay (SpriteBatch-based) and captured-text keyboard input via TextInputEXT, not stubs. |
GamerServicesComponent | Implemented | Registers with Game.Components; drives live local gamer services. |
GamerServicesNotAvailableException | Implemented | Exception type present. |
Gamer / SignedInGamer / GamerProfile / FriendGamer / FriendCollection | Implemented | Complete XNA-shaped API surface with local/synthetic semantics. |
LeaderboardReader / LeaderboardWriter / LeaderboardEntry | Implemented | Disk-persisted, not in-memory-only. |
| Achievements | Implemented | Disk-persisted. |
AvatarAnimation / AvatarDescription / AvatarRenderer | Implemented | Ported from a decompiled real Microsoft XNA 4.0 reference assembly — FNA itself never implemented Avatar. Toy-like, Xbox-Avatar-inspired stylization with fully original CNA geometry/textures (no proprietary Xbox Avatar assets used, not even as private reference). |
Microsoft.Xna.Framework.Net
Complete NetworkSession API surface (5 enums + 18 classes). Real networking for NetworkSessionType::SystemLink, backed by ENet (reliable UDP, vendored) — hosting, joining, LAN discovery, AppData relay, disconnect handling, and StartGame/EndGame state broadcast all run over a genuine transport, not a stub. Every other NetworkSessionType remains a synthetic (non-networked) stub, matching upstream XNA/FNA behavior. Verified real networking across four platforms: Linux (native ENet/UDP, genuine two-process loopback test), Windows (native ENet/UDP via WinSock2, cross-compiled with MinGW-w64, verified under Wine), Web/Emscripten (real ENet traffic over actual WebSocket connections — client-only, browsers cannot open listening sockets), Android NDK (native ENet/UDP via bionic libc, verified on a real x86_64 emulator).
| Class | Status | Notes |
|---|---|---|
NetworkSession | Implemented | Real ENet-backed SystemLink hosting/joining/state broadcast. |
AvailableNetworkSession / AvailableNetworkSessionCollection | Implemented | Real LAN discovery. |
NetworkSessionProperties | Implemented | |
NetworkSessionType / NetworkSessionState / NetworkSessionEndReason / NetworkSessionJoinError | Implemented | Enums. |
NetworkSessionJoinException / NetworkSessionEndedEventArgs | Implemented |
Xbox Live-exclusive session types (PlayerMatch, Ranked, Invite) stay documented, tested-as-unsupported stubs — no synthetic offline approximation is attempted for those.
Microsoft.Xna.Framework.Input
| Class | Status | Notes |
|---|---|---|
Keyboard / KeyboardState | Implemented | Full Keys enum, all standard keys. |
Mouse / MouseState | Implemented | Position, all buttons, scroll wheel. |
GamePad / GamePadState | Implemented | All 4 players, axes, buttons, D-pad, triggers, thumbsticks with dead-zone handling. |
TouchPanel / TouchLocation | Implemented | ~98% behavior — byte-faithful FNA gesture-pipeline port (Tap, FreeDrag, Flick, Pinch...PinchComplete), wired end-to-end and tested with a deterministic clock. Documented deviations only: event-driven vs poll-based GetState(); MaximumTouchCount reports 4 and GetState() caps at 8, both intentionally matching FNA. |
TextInputEXT | Implemented | IME text input integration. |
Microsoft.Xna.Framework.Audio
| Class | Status | Notes |
|---|---|---|
SoundEffect | Implemented | Load from file, play, volume control. |
SoundEffectInstance | Implemented | Per-instance playback state, pitch, pan, volume. |
DynamicSoundEffectInstance | Implemented | Runtime audio buffer submission. |
SoundBank / WaveBank | Implemented | ~97% functional. Real .xgs/.xsb/.xwb parser + SDL3_mixer playback; category/lifecycle/3D/instance-limit and fade (category- and cue-level) all real. Remaining gaps are documented accepted deviations (no HRTF/elevation, no AttackTime/ReleaseTime envelope tracking), not missing implementation. |
Song | Implemented | MP3, OGG, WAV, FLAC, OPUS, AAC, WMA playback. |
MediaPlayer | Implemented | Play, pause, stop, volume, repeat. |
AudioEmitter / AudioListener | Partial | Data structures implemented; full 3D spatial audio not complete. |
AudioEngine | Implemented | Real category/cue instance-limit enforcement with fade in/out, continuous RPC volume/pitch curve re-evaluation, stereo pan crossfeed — matches FAudio's actual shipped behavior rather than a "corrected" reimplementation. |
Microphone | Planned | API present, no implementation. |
Microsoft.Xna.Framework.Content
| Class | Status | Notes |
|---|---|---|
ContentManager | Implemented | Extensible ContentTypeReader<T> pattern. Loaders for Texture2D, SpriteFont, Model, Effect, SoundEffect, Song, Video. Uses JSON descriptors, not XNB. |
Note: IServiceProvider / ServiceProvider in CNA is simplified compared to XNA. Game.Services is available but not all XNA services are pre-registered. The ContentManager constructor accepts a IServiceProvider reference.
Microsoft.Xna.Framework.Media
| Class | Status | Notes |
|---|---|---|
Video / VideoPlayer | Partial | FFmpeg-based YUV→RGBA decode to Texture2D. MP4, OGV, WEBM, MKV, AVI, MOV. Linux/Windows only (excluded on Emscripten/Android). |
MediaLibrary | Stub | Photo/playlist query APIs stub only. |
Is it actually usable?
Type-presence percentages only go so far. The most direct evidence that CNA's XNA surface holds up under real code is the sibling cna-samples repository, which ports Microsoft's official XNA Game Studio 4.0 sample collection to C++ on CNA.
| Result | Detail |
|---|---|
| 63 of 86 official XNA samples building | Including Platformer, MarbleMaze, RolePlayingGame, CatapultWars, HoneycombRush, GameStateManagement, Audio3D and the networking samples. |
| The remaining 23 blocked | Overwhelmingly blocked on one thing: they ship custom .fx shaders. BloomSample, ShadowMapping, NormalMapping, SkinningSample, PerPixelLighting and friends all need HLSL that CNA cannot compile. |
That single dependency — compiled shader bytecode — is the clearest measure of what stands between CNA and a drop-in XNA experience. Everything else in those 23 samples already works.
Beyond the samples, CNA Craft (a voxel game ported from fogleman/Craft) runs on CNA's VertexBuffer/BasicEffect/Texture2D API on the desktop and in the browser via WebAssembly.
C++ API differences from C# XNA
While CNA mirrors XNA's API surface, there are necessary differences due to the C++ language:
- No garbage collection: Resources are managed with RAII and
std::unique_ptr/std::shared_ptr. Objects must be explicitly managed by the caller. - No properties: C# properties become getter/setter methods (e.g.
getGraphicsDeviceProperty()instead of the C#GraphicsDeviceproperty). - No events: C# event delegates are replaced with virtual method overrides or callbacks where applicable.
- Namespace syntax:
Microsoft::Xna::Frameworkwith::instead of.. - No extension methods, LINQ, or generics as they exist in C#.
Known gaps and limitations
The headline gaps are below. The Verification & Known Issues page carries the complete, current list, including every open rendering bug.
- XNB content pipeline — not supported. CNA loads raw assets plus JSON descriptors. A compiled
.xnbfile cannot be read at all, so porting a game means re-authoring its content. - Compiled
.fxshader bytecode —Effect's bytecode constructor throws. Custom shaders must be hand-written as GLSL/SPIR-V throughShaderEffect. This is the single biggest practical barrier to porting an existing XNA game. MediaLibraryand the media catalogue —Album,Artist,Genre,Picture,Playlistand their collections are shells that throw. Song and video playback is real.BoundingFrustum::Intersects(Ray)— throwsNotImplementedException; the other overloads work.- Xbox LIVE services — leaderboards, gamertag lookup and the Guide message box throw or no-op, because the service they need no longer exists. FNA stubs these out for the same reason.
- SDL_Renderer is 2D-only — by design. Every 3D entry point throws. Use EasyGL, Vulkan or bgfx for 3D.
- macOS — not a target. SDL3 supports it, but CNA has no macOS toolchain file, CI job, or build evidence.
Intentionally excluded from CNA
- Real Xbox Live server-side services (authentication against Microsoft's servers, matchmaking, cloud-synced achievements/leaderboards) — GamerServices and Net are ported with local/synthetic semantics instead (see above), the same approach FNA itself uses; genuine Xbox Live server integration is out of scope.
- Non-SystemLink
NetworkSessionTypevalues (PlayerMatch, Ranked, Invite) — documented, tested-as-unsupported stubs; no synthetic offline approximation. - XNB binary content pipeline — replaced by JSON descriptors; XNB import is not planned.
- Windows Phone sensor emulation — the
Accelerometerclass works where SDL3 supports it; Phone-specific emulation is excluded. - Direct3D-specific APIs —
GraphicsAdapterenumeration returns a stub on non-Windows platforms.