here are a few fixes for xtales xgube source. the new alpha func will fix bam3k.
// cpu.c (see 750cx_um3-17-05.pdf)
// correct "OP3 (31, 274, 0) = STBUX;" to "OP3 (31, 247, 0) = STBUX;"
// gx.c (thanks to pete & gcemu)
void gx_set_alphafunc() {
__u32 op0,op1,logic,a0,a1;
// PETE: that's an hard one: two alpha funcs, AND(0)/OR(1)/XOR(2)/XNOR(3)-Logic
// investigate this!
// if it is getting used, we can maybe do some "op1 alpha test" in
// the fragment shader
//
// stuff we can emulate with standard OGL:
//
// if op1=7 and logic=0: nice, just use op0 (as OGL does it)
// if op0=7 and logic=0: nice, just use op1 (as OGL does it)
// if op0=op1 and logic<2 and a0=a1: nice, just use op1 (as OGL does it)
// if op0=4 (or op1=4) and logic=1: nice, just use !op (as OGL does it)
// if op=7 and logic=1: always (disable test)
logic = TEV_ALPHAFUNC_LOGIC;
op0 = TEV_ALPHAFUNC_OP0;
op1 = TEV_ALPHAFUNC_OP1;
a0 = TEV_ALPHAFUNC_A0;
a1 = TEV_ALPHAFUNC_A1;
op0 += GL_NEVER;
op1 += GL_NEVER;
if(logic==1 && (op0==GL_ALWAYS || op1==GL_ALWAYS))
glDisable(GL_ALPHA_TEST);
else
if((op1==GL_ALWAYS && logic==0) || (op1==GL_NEVER && logic==1)) {
if(op0 != GL_ALWAYS) {
glEnable(GL_ALPHA_TEST);
glAlphaFunc(op0, ((GLclampf)a0)/255.0f);
} else
glDisable(GL_ALPHA_TEST);
} else
if((op0==GL_ALWAYS && logic==0) || (op0==GL_NEVER && logic==1)) {
if(op1 != GL_ALWAYS) {
glEnable(GL_ALPHA_TEST);
glAlphaFunc(op1, ((GLclampf)a1)/255.0f);
} else
glDisable(GL_ALPHA_TEST);
} else {
// we simply do op0 right now
if(op0 != GL_ALWAYS) {
glEnable(GL_ALPHA_TEST);
glAlphaFunc(op0, ((GLclampf)a0)/255.0f);
} else
glDisable(GL_ALPHA_TEST);
}
}