DrawStructure(int LinksOffset, int position, int X1, int Y1, int Z1, int level) { DWORD StructurePtr; DWORD DlistPtr,DlistPtr2=0; int i; StructurePtr = Flip32(*(DWORD *)(RDRAM+LinksOffset+position*4)); for(i=0;i<level;i++) printf(" "); printf("StructurePtr %X\n",StructurePtr); StructurePtr&=0xFFFFFF; short X,Y,Z; unsigned char A,B; X=((RDRAM[StructurePtr+0]<<8)+RDRAM[StructurePtr+1]); Y=((RDRAM[StructurePtr+2]<<8)+RDRAM[StructurePtr+3]); Z=((RDRAM[StructurePtr+4]<<8)+RDRAM[StructurePtr+5]); A=RDRAM[StructurePtr+6]; B=RDRAM[StructurePtr+7]; DlistPtr=Flip32(*(DWORD *)(RDRAM+StructurePtr+8)); DlistPtr&=0xFFFFFF; if(mode==2) { DlistPtr2=Flip32(*(DWORD *)(RDRAM+StructurePtr+12)); DlistPtr2&=0xFFFFFF; } if(DlistPtr!=0) { glPushMatrix(); for(i=0;i<level;i++) printf(" "); printf("[%d] X %d Y %d Z %d A: %d B: %d DL:%X DL:%X\n",position, X,Y,Z,A,B,DlistPtr,DlistPtr2); glTranslatef(X1,Y1,Z1); for(i=0;i<level;i++) printf(" "); printf("[%d] X1 %d Y1 %d Z1 %d DL: %08X DL: %08X\n",position, X1,Y1,Z1,DlistPtr,DlistPtr2); ProcessDisplayListSW(DlistPtr); glPopMatrix(); glPushMatrix(); glTranslatef(X1,Y1,Z1); if(mode==2 && DlistPtr2!=0) { ProcessDisplayListSW(DlistPtr2); } glPopMatrix(); } if(A!=255) { DrawStructure(LinksOffset, A, X1+X, Y1+Y, Z1+Z, level+1); } if(B!=255) { DrawStructure(LinksOffset, B, X1+X, Y1+Y, Z1+Z, level+1); } }
DrawLinks() { DWORD LinksOffset; DWORD LinksCount; int i; LinksOffset=Flip32( *(DWORD *)(RDRAM+entrypoint) ); LinksOffset&=0xFFFFFF; LinksCount=RDRAM[entrypoint+4]; printf("LinksOffset %X LinksCount %d\n",LinksOffset,LinksCount); DrawStructure(LinksOffset, 0, 0, 0, 0, 0); }
u32 cu32( u32 x ) { Flip32( &x ); return x; }