Rare Code Translations
======================
Here I will list the Human Readable Psudo-Commands under each Binary.
Object
B9000313 D410DD8
FOG, AFOG, CIN, 1-A; CIN, AIN, CMEM, 1-A.
B9,000,3,1D (0C18;2078) FC(26A004 1FFC93FC) C00800 02 00 000 5BC Archives:509478.bin
SETOTHERMODE_L, RenderMode, SetRenderMode
(
//(CLR_IN, 0, CLR_IN, 1)|(CLR_IN, A_IN, CLR_MEM, 1-A); // This produces a non fogging solid...
// cant be right...
(CLR_FOG, A_IN, CLR_IN, 1)|(CLR_IN, A_IN, CLR_MEM, 1-A); // This correctly Produces a fogging,
// Textured Solid, Never Fully Foggs
// Though. To Full FOG, c0 should end
// in 1-A rather than 1.
// I had to swap a and b in the equation
// above.
alpha_converge_selection; Converge_Dst_Clamp; depth_Zmode_opa; image_read;
depth update; depth compare; AA
)
SETCOMBINE(
((Texle1 - Tele0) * LOD_FRACTION + Texle0, (Texle1 - Tele0) * LOD_FRACTION + Texle0) |
((Combined - 0) * Shade, (0 - 0) * 0 + Shade))
)
________________________________________________________________
|CYCLE1 (TRILERP) | CYCLE2 (MODULATERGB) |
|CC0: t1 - t0 * LF + t0 | CC1: Com - 0 * shade + 0 |
|AC0: t1 - t0 * lf + t0 | AC1: 0 - 0 * 0 + shade |
|_______________________________|_______________________________|
***********************
* This translates to: *
***********************
Set the blender to first multiply fog colour with Z-Value placed on Vertex-Alpha, Add the result of the ColourCombiner and then divide the whole thing by Z-Value + 1.
On the second Pass, Multiply the result of the ColourCombiner (CLR_IN) with ColourCombiner_Alpha (A_IN) and add fist pass Multiplied by 1-A
[MUX1]
( CLR_FOG * A_IN + CLR_IN * 1 )
________________________________
(A_IN + 1)
[MUX2]
( CLR_IN * A_IN + CLR_MEM * 1-A )
_______________________________
(A_IN + 1-A)
So if we add arbitary numbers we can see whats happening.
Lets call the FOG 255, Z 0.5, CC 128, CC_A 1.
[-----------MUX1--------] [--------MUX2--------]
We end up with ((255*0.5) + (128*1))/1.5 = 170.333 ((128*1)+170.333)/1.5 = 198.89
This of cource is done for Red Green and Blue on every pixle displayed on screen.
The Colour Combiner Applies Tri-Linear Filtering and then applies the shading of the object.
In logical Terms the Colour Combiner should come first
**********************
B900031D 0C18 2078 FC26A0041F1093FF C0080002 00 000 278 Archives:509478.bin <- Any Of these = depot >
SETOTHERMODE_L, RenderMode, SetRenderMode
(
(CLR_FOG, A_IN, CLR_IN, 1)|(CLR_IN, A_IN, CLR_MEM, 1-A);
alpha_converge_selection; Converge_Dst_Clamp; depth_Zmode_opa; image_read;
depth update; depth compare; AA
)
// The majority of Rares Codes are the same for Blender B900031D 0C182078
[MUX1]
( CLR_FOG * A_IN + CLR_IN * 1 )
________________________________
(A_IN + 1)
[MUX2]
( CLR_IN * A_IN + CLR_MEM * 1-A )
_______________________________
(A_IN + 1-A)
SetCombine(Tex1-Tex0*L_F+Tex0, Tex1-Tex0*L_F+Tex0)|(Com-0*Shade+0, COM-0*Shade+COM)
________________________________________________________________________
| CYCLE1 TRILERP | CYCLE2 MODULATEIA2 |
| CC0: (Tex1-Tex0)*LOD_FRACTION + Tex0 | CC1: (Com-0)*Shade + 0 |
| AC0: (Tex1-Tex0)*LOD_FRACTION + Tex0 | AC1: (COM-0)*Shade + COM|
|_______________________________________|_______________________________|
This is a generic render mode.
It will produce a Fogging Tri-linear Filtered Mip-Maped textured shaded triangle.
It will also be z-buffered and Anti-Ailised.
If the texture contains Alpha or is a greyscale type (4/0 3/1 4/4 8/8) then it will be transparent HOWEVER, since the Zmode is Opaque it will either not draw objects behind this OR it will not Anti-Ailise edges,
==============================================
B900031D 00502078 FCFFFFFF FFFE793C Archives:50A164.bin
SETOTHERMODE_L, RenderMode, SetRenderMode
(
(CLR_IN, A_IN, CLR_MEM, A_IN)|(CLR_IN, A_IN, CLR_MEM, A_IN);
alpha_converge_selection; Converge_Dst_Clamp; depth_Zmode_opa; image_read;
depth update; depth compare; AA
)
[MUX1]
( CLR_IN * A_IN + CLR_MEM * 1-A )
________________________________
(A_IN + 1-A)
[MUX2]
( CLR_IN * A_IN + CLR_MEM * 1-A )
_______________________________
(A_IN + 1-A)
SetCombine(0-0*0+0,0-0*0+0, 0-Shade*Shade+shade,shade-0*shade+shade)
Cycle1 Cycle2 //Possibly swap
0 - 0 * 0 + 0 0 shade shade shade
0 - 0 * 0 + 0 shade 0 shade shade
This is a 1 Cycle un-textured tri.
It will NOT FOG.
It will ALWAYS appear Grey.
Its Preset Name for Blender is AA_ZB_SUB_SURF which means Subsurfaces.
"Sub surface mode, SUB_SURF, is intended to be used as a way to get an opaque object upon which an antialiased transparent surface can be overlaid. The coverage values from the transparent surface will fill in the zapped coverage values from the initial opaque surface. "
=======================================
B900031D 0C182078 FC26E404 1F10FFFF C00BB801 F8 074 DA6 PD Grid (Detail)
B900031D 0C1849D8 FC26E404 1F10FFFF C01B8001 FA 9A1 4B1 Bunker1:449360.bin <-Surface Trees
SETOTHERMODE_L, RenderMode, SetRenderMode
(
(CLR_FOG, A_IN, A_IN, 1)|(CLR_IN, A_IN, CLR_IN, 1-A);
FC_BL; Z_XUL; CVG_Wrap; C_CVG; IM_RD; Z_CMP; AA_EN;
// Force Blender, Z-Transparent, Coverage Wrap, Image Read, Z-Compare, AA_Enabled
)
[MUX1]
( CLR_IN * A_IN + CLR_MEM * 1-A )
________________________________
(A_IN + 1-A)
[MUX2]
( CLR_IN * A_IN + CLR_MEM * 1-A )
_______________________________
(A_IN + 1-A)
SetCombine()
CYCLE1 (TRILERP) |
Colour Combiner0: | (Texel1 - Texel0) * LOD_FRACTION + Texel0 |
Alpha Combiner0: | (PRIM_LOD_FRAC - 0) * Texel1 + 0 |
| |
CYCLE2 (MODULATERGB2) |
Colour Combiner1: | (Combined - 0) * Shade + 0 |
Alpha Combiner1: | (Combined - 0) * Shade + 0 |
This means that the Trees can FOG, they are Anti-Ailised and are transparent. They do Not Z-Buffer correctly, While they Compare their Z Value to other objects, they do not update their value. This is why they can overdraw themselves in some locations. Luckelly their Z-Value is usually higher than all the objects in Surface
The Blender is forced. This may be the key to detail maps?
The Combiner for the trees will do Tri-linear Filtering and then use the shade given to them via Vertexes.
The Alpha however is special, it Multiplies the first Tree image on Mip-Map Level1 (n+1) with the detail map on Level 0 (n).
on The second pass it combines this with FOG (since on Fogged tri's, FOG replaces Shade Alpha)
GE uses a different Rendermode from PD but the same Combiner.
Grids Rendermode is
(CFOG, AIN, CIN, 1)|(CIN, AIN, CMEM, 1-A); //This part is the same
Z_OPA; CVG_CLAMP; A_CVG; IM_RD; Z_UPD; Z_CMP; AA_EN
// Opaque Surface, Coverage is clamped, Uses Alpha for Coverage, they ZBuff corectly.
I also notice the C0 command is different which is bound to change the BA command.
================================
Ok, lets deal with a whole DList as something is missing.
Runway 66AFD4.bin
E7 00 00 00 00 00 00 00 Pipesync
BA 00 14 02 00 10 00 00 setothermode_h
B9 00 03 1D 0C 18 20 78 setothermode_l, G_MDSFT_RENDERMODE, SetRenderMode(
|)
FC 26 A0 04 1F FC 93 FC SetCombine
BA 00 10 01 00 01 00 00 setothermode_h
BB 00 30 01 FF FF FF FF Texture
C0 08 00 02 00 00 01 22 GETexture( 951976Other4040.bmp
BA 00 11 02 00 00 00 00 setothermode_h
BA 00 0C 02 00 00 20 00 setothermode_h
B7 00 00 00 00 00 20 00 setgeometrymode
FB 00 00 00 00 00 00 FF setenvcolour
04 E0 00 F0 0E 00 00 00 vertex
B1 00 76 32 64 54 20 10 tri4
E7 00 00 00 00 00 00 00 PipeSync
FC 26 A0 04 1F 10 93 FF SetCombine
BB 00 28 01 FF FF FF FF texture
C0 08 00 02 00 00 04 7A GETexture
B1 00 0E BA 00 DC A8 98 tri4
E7 00 00 00 00 00 00 00 PipeSync
FC 26 A0 04 1F FC 93 FC SetCombine
BB 00 30 01 FF FF FF FF Texture
C0 08 00 02 00 00 01 1E GETexture 95071BOther4040.bmp
04 F0 01 00 0E 00 00 F0 vertex
B1 00 76 32 64 54 20 10 tri4
B1 00 FE BA EC DC A8 98 tri4
B8 00 00 00 00 00 00 00 enddl
================================
Surface trees and Sniper Tower display list 6835C8.bin
E7 00 00 00 00 00 00 00 PipeSync
BA 00 14 02 00 10 00 00 SetOtherMode_H, SetCycle(2)
B9 00 03 1D 0C 18 4D D8 SetOtherMode_L, SetRenderMode(AA, Z_CMP, IM_RD, FC_BL, CL_CV, WRAP, DECAL, FOG, COLOUR)
FC 26 A0 04 1F 10 93 FF SetCombiner(TRILERP, MODULATERGBA)
BA 00 10 01 00 01 00 00 SetOtherMode_H, SetTextureLOD(LOD)
BB 08 28 01 FF FF FF FF Texture(Bowtie=8, 6, 0, ON) //Bowtie enabled to chop 4 scanlines for HW1 compatability
C0 08 00 02 00 00 04 F2 GESetTexture(SetTileSize(2), Type(2), 4F2) //Snow Edge Decal
BA 00 11 02 00 00 00 00 SetOtherMode_H, SetTextureDetail(Clamp)
BA 00 0C 02 00 00 20 00 SetOtherMode_H, SetTextureFilter(Bi-linear)
B7 00 00 00 00 00 20 00 SetGeometryMode(CullBack) //Sets Cull Back
FB 00 00 00 00 00 00 FF G_SETENVCOLOR(000,000,000,255)
04 F0 01 00 0E 00 55 70 vertex
B1 00 65 32 54 04 20 10 tri4
B1 00 CB 48 B9 A9 08 07 tri4
BF 00 00 00 00 82 8C 96 tri1
04 D0 00 E0 0E 00 56 70 vertex
B1 00 76 32 64 54 20 10 tri4
B1 00 DC 55 CA BA 84 98 tri4
04 F0 01 00 0E 00 57 50 vertex
B1 00 00 32 00 00 20 10 tri4
BB 08 30 01 FF FF FF FF Texture(Bowtie=8, 7, 0, ON) //Bowtie enabled to chop 4 scanlines for HW1 compatability
C0 18 00 02 00 00 00 95 GESetTexture(Clamp_T, SetTileSize(2), Type(2), 095) //Railings (shadow?)
E7 00 00 00 00 00 00 00 PipeSync
FB 00 00 00 00 00 00 66 G_SETENVCOLOR(000,000,000,102)
B1 00 BA 76 A8 98 64 54 tri4
B1 00 00 FE 00 00 EC DC tri4
E7 00 00 00 00 00 00 00 PipeSync
B9 00 03 1D 0C 18 49 D8 SetOtherMode_L, SetRenderMode(AA, Z_CMP, IM_RD, FC_BL, CL_CV, WRAP, XUL, FOG, COLOUR) //This mode doesnt work
FC 26 E4 04 1F 10 FF FF SetCombiner((Texel1-Texel0*LODFRAC+Texel0) (1-0*Texel1+0), MODULATERGBA)
BB 00 28 01 FF FF FF FF Texture(Bowtie=0, 6, 0, ON)
C0 1B 80 01 FA 9A 14 B1 GESetTexture(Clamp_T, SetTileSize(2), Shift_S(14), Type(1), prim_min_level(0.98), 9A1, 4B1) TreeTop
BA 00 11 02 00 04 00 00 SetOtherMode_H, SetTextureDetail(Detail) //set before drawing tris
FB 00 00 00 00 00 00 FF G_SETENVCOLOR(000,000,000,255)
04 F0 01 00 0E 00 58 50 vertex
B1 00 76 32 64 54 20 10 tri4
B1 00 FE BA EC DC A8 98 tri4
04 F0 01 00 0E 00 59 50 vertex
B1 00 76 32 64 54 20 10 tri4
C0 1B 80 01 FA 9A 14 B0 GESetTexture(Clamp_T, SetTileSize(2), Shift_S(14), Type(1), prim_min_level(0.98), 9A1, 4B0) TreeMid
B1 00 FE BA EC DC A8 98 tri4
04 F0 01 00 0E 00 5A 50 vertex
B1 00 76 32 64 54 20 10 tri4
B1 00 FE BA EC DC A8 98 tri4
C0 1B 80 01 FA 9A 14 AF GESetTexture(Clamp_T, SetTileSize(2), Shift_S(14), Type(1), prim_min_level(0.98), 9A1, 4AF) TreeMid2
04 F0 01 00 0E 00 5B 50 vertex
B1 00 76 32 64 54 20 10 tri4
B1 00 FE BA EC DC A8 98 tri4
04 F0 01 00 0E 00 5C 50 vertex
B1 00 76 32 64 54 20 10 tri4
C0 1B 80 01 FA 9A 14 AE GESetTexture(Clamp_T, SetTileSize(2), Shift_S(14), Type(1), prim_min_level(0.98), 9A1, 4AE) TreeBottom
B1 00 FE BA EC DC A8 98 tri4
04 F0 01 00 0E 00 5D 50 vertex
B1 00 76 32 64 54 20 10 tri4
B1 00 FE BA EC DC A8 98 tri4
E7 00 00 00 00 00 00 00 PipeSync
FC 26 A0 04 1F 10 93 FF SetCombiner(TRILERP, MODULATERGBA)
BB 00 30 01 FF FF FF FF Texture(Bowtie=0, 7, 0, ON)
C0 08 00 02 00 00 03 26 GESetTexture(SetTileSize(2), Type(2), 326) //Iceicles
BA 00 11 02 00 00 00 00 SetOtherMode_H, SetTextureDetail(CLAMP)
B6 00 00 00 00 00 30 00 ClearGeometryMode(CullBoth) //Clears Cull Settings, I.E. Show both sides
04 F0 01 00 0E 00 5E 50 vertex
B1 00 76 32 64 54 20 10 tri4
B1 00 FE BA EC DC A8 98 tri4
04 F0 01 00 0E 00 5F 50 vertex
B1 00 76 32 64 54 20 10 tri4
C0 18 00 02 00 00 00 95 GESetTexture(Clamp_T, SetTileSize(2), Type(2), 095) //Railings
B1 00 FE BA EC DC A8 98 tri4
04 F0 01 00 0E 00 60 50 vertex
B1 00 76 32 64 54 20 10 tri4
B1 00 FE BA EC DC A8 98 tri4
04 B0 00 C0 0E 00 61 50 vertex
B1 00 76 32 64 54 20 10 tri4
B1 00 00 BA 00 00 A8 98 tri4
B8 00 00 00 00 00 00 00 END DISPLAY LIST
One Cyle Mode from Demo ===============================================================
/*
* init RDP
*/
BA 00 14 02 00 00 00 00 gsDPSetCycleType(G_CYC_1CYCLE),
BA 00 17 01 00 80 00 00 gsDPPipelineMode(G_PM_1PRIMITIVE),
ED 00 00 00 00 50 03 C0 gsDPSetScissor(G_SC_NON_INTERLACE, 0, 0, SCREEN_WD, SCREEN_HT),
BA 00 10 01 00 00 00 00 gsDPSetTextureLOD(G_TL_TILE),
BA 00 0E 02 00 00 00 00 gsDPSetTextureLUT(G_TT_NONE),
BA 00 11 02 00 00 00 00 gsDPSetTextureDetail(G_TD_CLAMP),
BA 00 13 01 00 08 00 00 gsDPSetTexturePersp(G_TP_PERSP),
BA 00 0C 02 00 00 20 00 gsDPSetTextureFilter(G_TF_BILERP),
BA 00 09 03 00 00 0C 00 gsDPSetTextureConvert(G_TC_FILT),
FC FF FF FF FF FE 79 3C gsDPSetCombineMode(G_CC_SHADE, G_CC_SHADE),
BA 00 08 01 00 00 00 00 gsDPSetCombineKey(G_CK_NONE),
B9 00 00 02 00 00 00 00 gsDPSetAlphaCompare(G_AC_NONE),
B9 00 03 1D 00 55 20 78 gsDPSetRenderMode(G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2),
BA 00 06 02 00 00 00 40 gsDPSetColorDither(G_CD_BAYER),
BA 00 04 02 00 00 00 00 gsDPSetAlphaDither(G_AD_PATTERN),
E7 00 00 00 00 00 00 00 gsDPPipeSync(),
B8 00 00 00 00 00 00 00 gsSPEndDisplayList(),