Here's the code I'm using to correctly scale the screen. It seems to work well for everything I've tried. I hope the code tag works on this:
Code:
DWORD dwScaleX = *g_GraphicsInfo.xVI_X_SCALE_REG & 0xFFF;
DWORD dwScaleY = *g_GraphicsInfo.xVI_Y_SCALE_REG & 0xFFF;
float fScaleX = (float)dwScaleX / (1<<10);
float fScaleY = (float)dwScaleY / (1<<10);
DWORD dwHStartReg = *g_GraphicsInfo.xVI_H_START_REG;
DWORD dwVStartReg = *g_GraphicsInfo.xVI_V_START_REG;
u32 hstart = dwHStartReg >> 16;
u32 hend = dwHStartReg & 0xffff;
//DBGConsole_Msg( 0, "h start/end %d %d", hstart, hend ); // 128 725 - 597
u32 vstart = dwVStartReg >> 16;
u32 vend = dwVStartReg & 0xffff;
//DBGConsole_Msg( 0, "v start/end %d %d", vstart, vend ); // 56 501 - 445
mViWidth = (hend-hstart) * fScaleX;
mViHeight = ((vend-vstart)/2) * fScaleY; // /2 is because vertical is measured in half-lines