Cxbx-reloaded: Investigate VertexDeclaration extensions

Created on 25 Aug 2019  路  1Comment  路  Source: Cxbx-Reloaded/Cxbx-Reloaded

Xbox vertex declarations can have a NOP token, which apparently may be an extension:
X_D3DVSD_TOKEN_NOP = 0, // NOP or extension

No extensions are currently implemented (or even known?)

King Kong may contain an example of extensions.
It has an Xbox vertex declaration that contains NOP tokens with extra information.

DWORD dwVSHDecl[] =
{
    D3DVSD_STREAM(0),
        D3DVSD_REG(0, D3DVSDT_FLOAT3),
    // NeedPatching: 0
    D3DVSD_STREAM(1),
        D3DVSD_REG(1, D3DVSDT_FLOAT3),
    // NeedPatching: 0
    D3DVSD_STREAM(2),
        D3DVSD_REG(2, D3DVSDT_D3DCOLOR),
    // NeedPatching: 0
    D3DVSD_STREAM(3),
        D3DVSD_REG(3, D3DVSDT_FLOAT2),
    // NeedPatching: 0
    D3DVSD_STREAM(5),
        D3DVSD_REG(5, D3DVSDT_FLOAT4),
    // NeedPatching: 0
    D3DVSD_STREAM(6),
[0x4EE8] WARN : VTXSH   Token NOP found, but extra parameters are given!
    D3DVSD_NOP(),
[0x4EE8] WARN : VTXSH   Token NOP found, but extra parameters are given!
    D3DVSD_NOP(),
[0x4EE8] WARN : VTXSH   Token NOP found, but extra parameters are given!
    D3DVSD_NOP(),
[0x4EE8] WARN : VTXSH   Token NOP found, but extra parameters are given!
    D3DVSD_NOP(),
    D3DVSD_NOP(),
    // NeedPatching: 0
    D3DVSD_STREAM(0),
        D3DVSD_REG(0, D3DVSDT_FLOAT3),
    // NeedPatching: 0
    D3DVSD_STREAM(1),
        D3DVSD_REG(2, D3DVSDT_FLOAT3),
    // NeedPatching: 0
    D3DVSD_STREAM(2),
        D3DVSD_REG(3, D3DVSDT_D3DCOLOR),
    // NeedPatching: 0
    D3DVSD_END()
};
// NbrStreams: 9
graphics

Most helpful comment

I took a look at the game code for King Kong in a dissasembler and it confirmed my suspicions:: The XDK (including the version used in King Kong) completely ignore any D3DVSD_NOP type declarations, even if there are extra parameters, so there's no special behavior here, and no extentions to implement.

That doesn't explain WHY King-Kong has such declarations, but knowing that the Xbox XDK ignores them is enough for our purpose.

We should just skip-over any streams that only contain NOP declarations.

Since this game is cross platform between Xbox 360, I suppose it's possbile these values have a special meaning there, but they just weren't removed in the Xbox port? Purely speculation, and we don't need to know the answer to solve this.

TLDR: All known versions of the XDK completely ignore any stream type that matches NOP, there are no such extensions on the Xbox.

>All comments

I took a look at the game code for King Kong in a dissasembler and it confirmed my suspicions:: The XDK (including the version used in King Kong) completely ignore any D3DVSD_NOP type declarations, even if there are extra parameters, so there's no special behavior here, and no extentions to implement.

That doesn't explain WHY King-Kong has such declarations, but knowing that the Xbox XDK ignores them is enough for our purpose.

We should just skip-over any streams that only contain NOP declarations.

Since this game is cross platform between Xbox 360, I suppose it's possbile these values have a special meaning there, but they just weren't removed in the Xbox port? Purely speculation, and we don't need to know the answer to solve this.

TLDR: All known versions of the XDK completely ignore any stream type that matches NOP, there are no such extensions on the Xbox.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Margen67 picture Margen67  路  3Comments

gandalfthewhite19890404 picture gandalfthewhite19890404  路  4Comments

PatrickvL picture PatrickvL  路  3Comments

LukeUsher picture LukeUsher  路  3Comments

chrisderwahre picture chrisderwahre  路  4Comments