[Glide64] rename fullscreen to GfxInitDone
This commit is contained in:
parent
5a4ea8ad1f
commit
2b9cdb12c3
|
@ -15574,12 +15574,9 @@ void Combine()
|
|||
if (cmb.cmb_ext_use || cmb.tex_cmb_ext_use)
|
||||
{
|
||||
//have to draw something to allow use of standard combine functions
|
||||
if (fullscreen)
|
||||
{
|
||||
VERTEX v;
|
||||
memset(&v, 0, sizeof(v));
|
||||
grDrawPoint(&v);
|
||||
}
|
||||
VERTEX v;
|
||||
memset(&v, 0, sizeof(v));
|
||||
grDrawPoint(&v);
|
||||
cmb.cmb_ext_use = 0;
|
||||
cmb.tex_cmb_ext_use = 0;
|
||||
}
|
||||
|
@ -15737,61 +15734,58 @@ void Combine()
|
|||
//*/
|
||||
rdp.tex = cmb.tex;
|
||||
|
||||
if (fullscreen)
|
||||
TBUFF_COLOR_IMAGE * aTBuff[2] = { 0, 0 };
|
||||
if (rdp.aTBuffTex[0])
|
||||
aTBuff[rdp.aTBuffTex[0]->tile] = rdp.aTBuffTex[0];
|
||||
if (rdp.aTBuffTex[1])
|
||||
aTBuff[rdp.aTBuffTex[1]->tile] = rdp.aTBuffTex[1];
|
||||
if (cmb.tex && (aTBuff[0] || aTBuff[1]))
|
||||
{
|
||||
TBUFF_COLOR_IMAGE * aTBuff[2] = { 0, 0 };
|
||||
if (rdp.aTBuffTex[0])
|
||||
aTBuff[rdp.aTBuffTex[0]->tile] = rdp.aTBuffTex[0];
|
||||
if (rdp.aTBuffTex[1])
|
||||
aTBuff[rdp.aTBuffTex[1]->tile] = rdp.aTBuffTex[1];
|
||||
if (cmb.tex && (aTBuff[0] || aTBuff[1]))
|
||||
if (aTBuff[0] && (settings.frame_buffer&fb_read_alpha))
|
||||
{
|
||||
if (aTBuff[0] && (settings.frame_buffer&fb_read_alpha))
|
||||
{
|
||||
if ((settings.hacks&hack_PMario) && aTBuff[0]->width == rdp.ci_width)
|
||||
;
|
||||
else
|
||||
{
|
||||
grChromakeyValue(0);
|
||||
grChromakeyMode(GR_CHROMAKEY_ENABLE);
|
||||
}
|
||||
}
|
||||
if ((settings.hacks&hack_PMario) && aTBuff[0]->width == rdp.ci_width)
|
||||
;
|
||||
else
|
||||
grChromakeyMode(GR_CHROMAKEY_DISABLE);
|
||||
|
||||
if (aTBuff[0] && aTBuff[0]->info.format == GR_TEXFMT_ALPHA_INTENSITY_88)
|
||||
{
|
||||
if (cmb.tex_cmb_ext_use & TEX_COMBINE_EXT_COLOR)
|
||||
{
|
||||
if (cmb.t0c_ext_a == GR_CMBX_LOCAL_TEXTURE_RGB)
|
||||
cmb.t0c_ext_a = GR_CMBX_LOCAL_TEXTURE_ALPHA;
|
||||
if (cmb.t0c_ext_b == GR_CMBX_LOCAL_TEXTURE_RGB)
|
||||
cmb.t0c_ext_b = GR_CMBX_LOCAL_TEXTURE_ALPHA;
|
||||
if (cmb.t0c_ext_c == GR_CMBX_LOCAL_TEXTURE_RGB)
|
||||
cmb.t0c_ext_c = GR_CMBX_LOCAL_TEXTURE_ALPHA;
|
||||
}
|
||||
else
|
||||
cmb.tmu0_func = GR_COMBINE_FUNCTION_LOCAL_ALPHA;
|
||||
}
|
||||
|
||||
if (aTBuff[1] && aTBuff[1]->info.format == GR_TEXFMT_ALPHA_INTENSITY_88)
|
||||
{
|
||||
if (cmb.tex_cmb_ext_use & TEX_COMBINE_EXT_COLOR)
|
||||
{
|
||||
if (cmb.t1c_ext_a == GR_CMBX_LOCAL_TEXTURE_RGB)
|
||||
cmb.t1c_ext_a = GR_CMBX_LOCAL_TEXTURE_ALPHA;
|
||||
if (cmb.t1c_ext_b == GR_CMBX_LOCAL_TEXTURE_RGB)
|
||||
cmb.t1c_ext_b = GR_CMBX_LOCAL_TEXTURE_ALPHA;
|
||||
if (cmb.t1c_ext_c == GR_CMBX_LOCAL_TEXTURE_RGB)
|
||||
cmb.t1c_ext_c = GR_CMBX_LOCAL_TEXTURE_ALPHA;
|
||||
}
|
||||
else
|
||||
cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL_ALPHA;
|
||||
grChromakeyValue(0);
|
||||
grChromakeyMode(GR_CHROMAKEY_ENABLE);
|
||||
}
|
||||
}
|
||||
else
|
||||
grChromakeyMode(GR_CHROMAKEY_DISABLE);
|
||||
|
||||
if (aTBuff[0] && aTBuff[0]->info.format == GR_TEXFMT_ALPHA_INTENSITY_88)
|
||||
{
|
||||
if (cmb.tex_cmb_ext_use & TEX_COMBINE_EXT_COLOR)
|
||||
{
|
||||
if (cmb.t0c_ext_a == GR_CMBX_LOCAL_TEXTURE_RGB)
|
||||
cmb.t0c_ext_a = GR_CMBX_LOCAL_TEXTURE_ALPHA;
|
||||
if (cmb.t0c_ext_b == GR_CMBX_LOCAL_TEXTURE_RGB)
|
||||
cmb.t0c_ext_b = GR_CMBX_LOCAL_TEXTURE_ALPHA;
|
||||
if (cmb.t0c_ext_c == GR_CMBX_LOCAL_TEXTURE_RGB)
|
||||
cmb.t0c_ext_c = GR_CMBX_LOCAL_TEXTURE_ALPHA;
|
||||
}
|
||||
else
|
||||
cmb.tmu0_func = GR_COMBINE_FUNCTION_LOCAL_ALPHA;
|
||||
}
|
||||
|
||||
if (aTBuff[1] && aTBuff[1]->info.format == GR_TEXFMT_ALPHA_INTENSITY_88)
|
||||
{
|
||||
if (cmb.tex_cmb_ext_use & TEX_COMBINE_EXT_COLOR)
|
||||
{
|
||||
if (cmb.t1c_ext_a == GR_CMBX_LOCAL_TEXTURE_RGB)
|
||||
cmb.t1c_ext_a = GR_CMBX_LOCAL_TEXTURE_ALPHA;
|
||||
if (cmb.t1c_ext_b == GR_CMBX_LOCAL_TEXTURE_RGB)
|
||||
cmb.t1c_ext_b = GR_CMBX_LOCAL_TEXTURE_ALPHA;
|
||||
if (cmb.t1c_ext_c == GR_CMBX_LOCAL_TEXTURE_RGB)
|
||||
cmb.t1c_ext_c = GR_CMBX_LOCAL_TEXTURE_ALPHA;
|
||||
}
|
||||
else
|
||||
cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL_ALPHA;
|
||||
}
|
||||
}
|
||||
else
|
||||
grChromakeyMode(GR_CHROMAKEY_DISABLE);
|
||||
cmb.shade_mod_hash = (rdp.cmb_flags + rdp.cmb_flags_2) * (rdp.prim_color + rdp.env_color + rdp.K5);
|
||||
|
||||
LRDP(" | + Combine end\n");
|
||||
|
|
|
@ -170,7 +170,7 @@ wxNotebook(parent, id, pos, size, 0)
|
|||
#ifdef TEXTURE_FILTER
|
||||
if (settings.texenh_options)
|
||||
{
|
||||
if (!fullscreen)
|
||||
if (!GfxInitDone)
|
||||
{
|
||||
grGlideInit();
|
||||
grSstSelect(settings.card_id);
|
||||
|
@ -184,7 +184,7 @@ wxNotebook(parent, id, pos, size, 0)
|
|||
voodoo.sup_32bit_tex = TRUE;
|
||||
else
|
||||
voodoo.sup_32bit_tex = FALSE;
|
||||
if (!fullscreen)
|
||||
if (!GfxInitDone)
|
||||
grGlideShutdown();
|
||||
|
||||
TexturePanel = new wxPanel(this, wxID_ANY);
|
||||
|
@ -923,7 +923,7 @@ void ConfigNotebook::SaveSettings()
|
|||
}
|
||||
else
|
||||
WriteSettings(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
WriteSettings(is_advanced_changed != 0);
|
||||
}
|
||||
|
|
|
@ -273,7 +273,7 @@ extern "C" {
|
|||
__inline void FRDP_E(const char * /*fmt*/, ...) {}
|
||||
#endif
|
||||
|
||||
extern int fullscreen;
|
||||
extern int GfxInitDone;
|
||||
extern int romopen;
|
||||
extern int to_fullscreen;
|
||||
extern int debugging;
|
||||
|
|
|
@ -80,7 +80,7 @@ GFX_INFO gfx;
|
|||
wxWindow * GFXWindow = NULL;
|
||||
|
||||
int to_fullscreen = FALSE;
|
||||
int fullscreen = FALSE;
|
||||
int GfxInitDone = FALSE;
|
||||
int romopen = FALSE;
|
||||
GrContext_t gfx_context = 0;
|
||||
int debugging = FALSE;
|
||||
|
@ -799,25 +799,24 @@ void DisplayLoadProgress(const wchar_t *format, ...)
|
|||
// XXX: convert to multibyte
|
||||
wcstombs(buf, wbuf, INFO_BUF);
|
||||
|
||||
if (fullscreen)
|
||||
{
|
||||
float x;
|
||||
set_message_combiner();
|
||||
output(382, 380, 1, "LOADING TEXTURES. PLEASE WAIT...");
|
||||
int len = min((int)strlen(buf) * 8, 1024);
|
||||
x = (1024 - len) / 2.0f;
|
||||
output(x, 360, 1, buf);
|
||||
grBufferSwap(0);
|
||||
grColorMask(FXTRUE, FXTRUE);
|
||||
grBufferClear(0, 0, 0xFFFF);
|
||||
}
|
||||
float x;
|
||||
set_message_combiner();
|
||||
output(382, 380, 1, "LOADING TEXTURES. PLEASE WAIT...");
|
||||
int len = min((int)strlen(buf) * 8, 1024);
|
||||
x = (1024 - len) / 2.0f;
|
||||
output(x, 360, 1, buf);
|
||||
grBufferSwap(0);
|
||||
grColorMask(FXTRUE, FXTRUE);
|
||||
grBufferClear(0, 0, 0xFFFF);
|
||||
}
|
||||
#endif
|
||||
|
||||
int InitGfx()
|
||||
{
|
||||
if (fullscreen)
|
||||
if (GfxInitDone)
|
||||
{
|
||||
ReleaseGfx();
|
||||
}
|
||||
|
||||
OPEN_RDP_LOG(); // doesn't matter if opens again; it will check for it
|
||||
OPEN_RDP_E_LOG();
|
||||
|
@ -929,7 +928,7 @@ int InitGfx()
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
fullscreen = TRUE;
|
||||
GfxInitDone = TRUE;
|
||||
to_fullscreen = FALSE;
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
|
@ -1132,7 +1131,7 @@ void ReleaseGfx()
|
|||
// Shutdown glide
|
||||
grGlideShutdown();
|
||||
|
||||
fullscreen = FALSE;
|
||||
GfxInitDone = FALSE;
|
||||
rdp.window_changed = TRUE;
|
||||
}
|
||||
|
||||
|
@ -1233,21 +1232,6 @@ void CALL ReadScreen(void **dest, int *width, int *height)
|
|||
uint8_t * line = buff;
|
||||
*dest = (void*)buff;
|
||||
|
||||
if (!fullscreen)
|
||||
{
|
||||
for (uint32_t y = 0; y < settings.res_y; y++)
|
||||
{
|
||||
for (uint32_t x = 0; x < settings.res_x; x++)
|
||||
{
|
||||
line[x * 3] = 0x20;
|
||||
line[x * 3 + 1] = 0x7f;
|
||||
line[x * 3 + 2] = 0x40;
|
||||
}
|
||||
}
|
||||
LOG("ReadScreen. not in the fullscreen!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
GrLfbInfo_t info;
|
||||
info.size = sizeof(GrLfbInfo_t);
|
||||
if (grLfbLock(GR_LFB_READ_ONLY,
|
||||
|
@ -1362,7 +1346,7 @@ EXPORT void CALL ChangeWindow(void)
|
|||
// Go to fullscreen at next dlist
|
||||
// This is for compatibility with 1964, which reloads the plugin
|
||||
// when switching to fullscreen
|
||||
if (!fullscreen)
|
||||
if (!GfxInitDone)
|
||||
{
|
||||
to_fullscreen = TRUE;
|
||||
#ifdef __WINDOWS__
|
||||
|
@ -1420,8 +1404,7 @@ void CALL CloseDLL(void)
|
|||
settings.ghq_use = 0;
|
||||
}
|
||||
#endif
|
||||
if (fullscreen)
|
||||
ReleaseGfx();
|
||||
ReleaseGfx();
|
||||
ZLUT_release();
|
||||
ClearCache();
|
||||
delete[] voodoo.gamma_table_r;
|
||||
|
@ -1688,7 +1671,7 @@ void CALL RomClosed(void)
|
|||
CLOSE_RDP_E_LOG();
|
||||
rdp.window_changed = TRUE;
|
||||
romopen = FALSE;
|
||||
if (fullscreen && evoodoo)
|
||||
if (evoodoo)
|
||||
ReleaseGfx();
|
||||
}
|
||||
|
||||
|
@ -1711,7 +1694,7 @@ static void CheckDRAMSize()
|
|||
sprintf(out_buf, "Detected RDRAM size: %08lx\n", BMASK);
|
||||
LOG(out_buf);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
Function: RomOpen
|
||||
|
@ -1777,24 +1760,21 @@ void CALL RomOpen(void)
|
|||
OPEN_RDP_E_LOG();
|
||||
|
||||
// ** EVOODOO EXTENSIONS **
|
||||
if (!fullscreen)
|
||||
if (!GfxInitDone)
|
||||
{
|
||||
grGlideInit();
|
||||
grSstSelect(0);
|
||||
}
|
||||
const char *extensions = grGetString(GR_EXTENSION);
|
||||
if (!fullscreen)
|
||||
{
|
||||
grGlideShutdown();
|
||||
grGlideShutdown();
|
||||
|
||||
if (strstr(extensions, "EVOODOO"))
|
||||
evoodoo = 1;
|
||||
else
|
||||
evoodoo = 0;
|
||||
if (strstr(extensions, "EVOODOO"))
|
||||
evoodoo = 1;
|
||||
else
|
||||
evoodoo = 0;
|
||||
|
||||
if (evoodoo)
|
||||
InitGfx();
|
||||
}
|
||||
if (evoodoo)
|
||||
InitGfx();
|
||||
|
||||
if (strstr(extensions, "ROMNAME"))
|
||||
{
|
||||
|
@ -1857,20 +1837,13 @@ void drawNoFullscreenMessage();
|
|||
|
||||
static void DrawFrameBuffer()
|
||||
{
|
||||
if (!fullscreen)
|
||||
{
|
||||
drawNoFullscreenMessage();
|
||||
}
|
||||
if (to_fullscreen)
|
||||
GoToFullScreen();
|
||||
|
||||
if (fullscreen)
|
||||
{
|
||||
grDepthMask(FXTRUE);
|
||||
grColorMask(FXTRUE, FXTRUE);
|
||||
grBufferClear(0, 0, 0xFFFF);
|
||||
drawViRegBG();
|
||||
}
|
||||
grDepthMask(FXTRUE);
|
||||
grColorMask(FXTRUE, FXTRUE);
|
||||
grBufferClear(0, 0, 0xFFFF);
|
||||
drawViRegBG();
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
|
@ -1896,9 +1869,10 @@ void CALL UpdateScreen(void)
|
|||
LRDP(out_buf);
|
||||
|
||||
uint32_t width = (*gfx.VI_WIDTH_REG) << 1;
|
||||
if (fullscreen && (*gfx.VI_ORIGIN_REG > width))
|
||||
if (*gfx.VI_ORIGIN_REG > width)
|
||||
{
|
||||
update_screen_count++;
|
||||
|
||||
}
|
||||
#ifdef FPS
|
||||
// vertical interrupt has occurred, increment counter
|
||||
vi_count++;
|
||||
|
@ -1998,116 +1972,112 @@ void newSwapBuffers()
|
|||
|
||||
LRDP("swapped\n");
|
||||
|
||||
// Allow access to the whole screen
|
||||
if (fullscreen)
|
||||
{
|
||||
rdp.update |= UPDATE_SCISSOR | UPDATE_COMBINE | UPDATE_ZBUF_ENABLED | UPDATE_CULL_MODE;
|
||||
grClipWindow(0, 0, settings.scr_res_x, settings.scr_res_y);
|
||||
grDepthBufferFunction(GR_CMP_ALWAYS);
|
||||
grDepthMask(FXFALSE);
|
||||
grCullMode(GR_CULL_DISABLE);
|
||||
rdp.update |= UPDATE_SCISSOR | UPDATE_COMBINE | UPDATE_ZBUF_ENABLED | UPDATE_CULL_MODE;
|
||||
grClipWindow(0, 0, settings.scr_res_x, settings.scr_res_y);
|
||||
grDepthBufferFunction(GR_CMP_ALWAYS);
|
||||
grDepthMask(FXFALSE);
|
||||
grCullMode(GR_CULL_DISABLE);
|
||||
|
||||
if ((settings.show_fps & 0xF) || settings.clock)
|
||||
set_message_combiner();
|
||||
if ((settings.show_fps & 0xF) || settings.clock)
|
||||
set_message_combiner();
|
||||
#ifdef FPS
|
||||
float y = 0;//(float)settings.res_y;
|
||||
if (settings.show_fps & 0x0F)
|
||||
float y = 0;//(float)settings.res_y;
|
||||
if (settings.show_fps & 0x0F)
|
||||
{
|
||||
if (settings.show_fps & 4)
|
||||
{
|
||||
if (settings.show_fps & 4)
|
||||
{
|
||||
if (region) // PAL
|
||||
output(0, y, 1, "%d%% ", (int)pal_percent);
|
||||
else
|
||||
output(0, y, 1, "%d%% ", (int)ntsc_percent);
|
||||
y += 16;
|
||||
}
|
||||
if (settings.show_fps & 2)
|
||||
{
|
||||
output(0, y, 1, "VI/s: %.02f ", vi);
|
||||
y += 16;
|
||||
}
|
||||
if (settings.show_fps & 1)
|
||||
output(0, y, 1, "FPS: %.02f ", fps);
|
||||
if (region) // PAL
|
||||
output(0, y, 1, "%d%% ", (int)pal_percent);
|
||||
else
|
||||
output(0, y, 1, "%d%% ", (int)ntsc_percent);
|
||||
y += 16;
|
||||
}
|
||||
if (settings.show_fps & 2)
|
||||
{
|
||||
output(0, y, 1, "VI/s: %.02f ", vi);
|
||||
y += 16;
|
||||
}
|
||||
if (settings.show_fps & 1)
|
||||
output(0, y, 1, "FPS: %.02f ", fps);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (settings.clock)
|
||||
if (settings.clock)
|
||||
{
|
||||
if (settings.clock_24_hr)
|
||||
{
|
||||
if (settings.clock_24_hr)
|
||||
{
|
||||
output(956.0f, 0, 1, (char*)wxDateTime::Now().Format(wxT("%H:%M:%S")).char_str(), 0);
|
||||
}
|
||||
output(956.0f, 0, 1, (char*)wxDateTime::Now().Format(wxT("%H:%M:%S")).char_str(), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
output(930.0f, 0, 1, (char*)wxDateTime::Now().Format(wxT("%I:%M:%S %p")).char_str(), 0);
|
||||
}
|
||||
}
|
||||
//hotkeys
|
||||
//if (CheckKeyPressed(G64_VK_BACK, 0x0001))
|
||||
//{
|
||||
//hotkey_info.hk_filtering = 100;
|
||||
//if (settings.filtering < 2)
|
||||
//settings.filtering++;
|
||||
//else
|
||||
//settings.filtering = 0;
|
||||
//}
|
||||
if ((abs((int)(frame_count - curframe)) > 3) && CheckKeyPressed(G64_VK_ALT, 0x8000)) //alt +
|
||||
{
|
||||
if (CheckKeyPressed(G64_VK_B, 0x8000)) //b
|
||||
{
|
||||
hotkey_info.hk_motionblur = 100;
|
||||
hotkey_info.hk_ref = 0;
|
||||
curframe = frame_count;
|
||||
settings.frame_buffer ^= fb_motionblur;
|
||||
}
|
||||
else if (CheckKeyPressed(G64_VK_V, 0x8000)) //v
|
||||
{
|
||||
hotkey_info.hk_ref = 100;
|
||||
hotkey_info.hk_motionblur = 0;
|
||||
curframe = frame_count;
|
||||
settings.frame_buffer ^= fb_ref;
|
||||
}
|
||||
}
|
||||
if (settings.buff_clear && (hotkey_info.hk_ref || hotkey_info.hk_motionblur || hotkey_info.hk_filtering))
|
||||
{
|
||||
set_message_combiner();
|
||||
char buf[256];
|
||||
buf[0] = 0;
|
||||
char * message = 0;
|
||||
if (hotkey_info.hk_ref)
|
||||
{
|
||||
if (settings.frame_buffer & fb_ref)
|
||||
message = strcat(buf, "FB READ ALWAYS: ON");
|
||||
else
|
||||
{
|
||||
output(930.0f, 0, 1, (char*)wxDateTime::Now().Format(wxT("%I:%M:%S %p")).char_str(), 0);
|
||||
}
|
||||
message = strcat(buf, "FB READ ALWAYS: OFF");
|
||||
hotkey_info.hk_ref--;
|
||||
}
|
||||
//hotkeys
|
||||
//if (CheckKeyPressed(G64_VK_BACK, 0x0001))
|
||||
//{
|
||||
//hotkey_info.hk_filtering = 100;
|
||||
//if (settings.filtering < 2)
|
||||
//settings.filtering++;
|
||||
//else
|
||||
//settings.filtering = 0;
|
||||
//}
|
||||
if ((abs((int)(frame_count - curframe)) > 3) && CheckKeyPressed(G64_VK_ALT, 0x8000)) //alt +
|
||||
if (hotkey_info.hk_motionblur)
|
||||
{
|
||||
if (CheckKeyPressed(G64_VK_B, 0x8000)) //b
|
||||
{
|
||||
hotkey_info.hk_motionblur = 100;
|
||||
hotkey_info.hk_ref = 0;
|
||||
curframe = frame_count;
|
||||
settings.frame_buffer ^= fb_motionblur;
|
||||
}
|
||||
else if (CheckKeyPressed(G64_VK_V, 0x8000)) //v
|
||||
{
|
||||
hotkey_info.hk_ref = 100;
|
||||
hotkey_info.hk_motionblur = 0;
|
||||
curframe = frame_count;
|
||||
settings.frame_buffer ^= fb_ref;
|
||||
}
|
||||
if (settings.frame_buffer & fb_motionblur)
|
||||
message = strcat(buf, " MOTION BLUR: ON");
|
||||
else
|
||||
message = strcat(buf, " MOTION BLUR: OFF");
|
||||
hotkey_info.hk_motionblur--;
|
||||
}
|
||||
if (settings.buff_clear && (hotkey_info.hk_ref || hotkey_info.hk_motionblur || hotkey_info.hk_filtering))
|
||||
if (hotkey_info.hk_filtering)
|
||||
{
|
||||
set_message_combiner();
|
||||
char buf[256];
|
||||
buf[0] = 0;
|
||||
char * message = 0;
|
||||
if (hotkey_info.hk_ref)
|
||||
switch (settings.filtering)
|
||||
{
|
||||
if (settings.frame_buffer & fb_ref)
|
||||
message = strcat(buf, "FB READ ALWAYS: ON");
|
||||
else
|
||||
message = strcat(buf, "FB READ ALWAYS: OFF");
|
||||
hotkey_info.hk_ref--;
|
||||
case 0:
|
||||
message = strcat(buf, " FILTERING MODE: AUTOMATIC");
|
||||
break;
|
||||
case 1:
|
||||
message = strcat(buf, " FILTERING MODE: FORCE BILINEAR");
|
||||
break;
|
||||
case 2:
|
||||
message = strcat(buf, " FILTERING MODE: FORCE POINT-SAMPLED");
|
||||
break;
|
||||
}
|
||||
if (hotkey_info.hk_motionblur)
|
||||
{
|
||||
if (settings.frame_buffer & fb_motionblur)
|
||||
message = strcat(buf, " MOTION BLUR: ON");
|
||||
else
|
||||
message = strcat(buf, " MOTION BLUR: OFF");
|
||||
hotkey_info.hk_motionblur--;
|
||||
}
|
||||
if (hotkey_info.hk_filtering)
|
||||
{
|
||||
switch (settings.filtering)
|
||||
{
|
||||
case 0:
|
||||
message = strcat(buf, " FILTERING MODE: AUTOMATIC");
|
||||
break;
|
||||
case 1:
|
||||
message = strcat(buf, " FILTERING MODE: FORCE BILINEAR");
|
||||
break;
|
||||
case 2:
|
||||
message = strcat(buf, " FILTERING MODE: FORCE POINT-SAMPLED");
|
||||
break;
|
||||
}
|
||||
hotkey_info.hk_filtering--;
|
||||
}
|
||||
output(120.0f, 0.0f, 1, message, 0);
|
||||
hotkey_info.hk_filtering--;
|
||||
}
|
||||
output(120.0f, 0.0f, 1, message, 0);
|
||||
}
|
||||
|
||||
if (capture_screen)
|
||||
|
@ -2243,7 +2213,7 @@ void newSwapBuffers()
|
|||
grLfbUnlock(GR_LFB_READ_ONLY, GR_BUFFER_BACKBUFFER);
|
||||
}
|
||||
|
||||
if (fullscreen && debugging)
|
||||
if (debugging)
|
||||
{
|
||||
debug_keys();
|
||||
debug_cacheviewer();
|
||||
|
@ -2253,63 +2223,58 @@ void newSwapBuffers()
|
|||
if (settings.frame_buffer & fb_read_back_to_screen)
|
||||
DrawWholeFrameBufferToScreen();
|
||||
|
||||
if (fullscreen)
|
||||
if (fb_hwfbe_enabled && !(settings.hacks&hack_RE2) && !evoodoo)
|
||||
grAuxBufferExt(GR_BUFFER_AUXBUFFER);
|
||||
LOG("BUFFER SWAPPED\n");
|
||||
grBufferSwap(settings.vsync);
|
||||
fps_count++;
|
||||
if (*gfx.VI_STATUS_REG & 0x08) //gamma correction is used
|
||||
{
|
||||
if (fb_hwfbe_enabled && !(settings.hacks&hack_RE2) && !evoodoo)
|
||||
grAuxBufferExt(GR_BUFFER_AUXBUFFER);
|
||||
LOG("BUFFER SWAPPED\n");
|
||||
grBufferSwap(settings.vsync);
|
||||
fps_count++;
|
||||
if (*gfx.VI_STATUS_REG & 0x08) //gamma correction is used
|
||||
if (!voodoo.gamma_correction)
|
||||
{
|
||||
if (!voodoo.gamma_correction)
|
||||
{
|
||||
if (voodoo.gamma_table_size && !voodoo.gamma_table_r)
|
||||
GetGammaTable(); //save initial gamma tables
|
||||
guGammaCorrectionRGB(2.0f, 2.0f, 2.0f); //with gamma=2.0 gamma table is the same, as in N64
|
||||
voodoo.gamma_correction = 1;
|
||||
}
|
||||
if (voodoo.gamma_table_size && !voodoo.gamma_table_r)
|
||||
GetGammaTable(); //save initial gamma tables
|
||||
guGammaCorrectionRGB(2.0f, 2.0f, 2.0f); //with gamma=2.0 gamma table is the same, as in N64
|
||||
voodoo.gamma_correction = 1;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
if (voodoo.gamma_correction)
|
||||
{
|
||||
if (voodoo.gamma_correction)
|
||||
{
|
||||
if (voodoo.gamma_table_r)
|
||||
grLoadGammaTable(voodoo.gamma_table_size, voodoo.gamma_table_r, voodoo.gamma_table_g, voodoo.gamma_table_b);
|
||||
else
|
||||
guGammaCorrectionRGB(1.3f, 1.3f, 1.3f); //1.3f is default 3dfx gamma for everything but desktop
|
||||
voodoo.gamma_correction = 0;
|
||||
}
|
||||
if (voodoo.gamma_table_r)
|
||||
grLoadGammaTable(voodoo.gamma_table_size, voodoo.gamma_table_r, voodoo.gamma_table_g, voodoo.gamma_table_b);
|
||||
else
|
||||
guGammaCorrectionRGB(1.3f, 1.3f, 1.3f); //1.3f is default 3dfx gamma for everything but desktop
|
||||
voodoo.gamma_correction = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (_debugger.capture)
|
||||
debug_capture();
|
||||
|
||||
if (fullscreen)
|
||||
if (debugging || settings.wireframe || settings.buff_clear || (settings.hacks&hack_PPL && settings.ucode == 6))
|
||||
{
|
||||
if (debugging || settings.wireframe || settings.buff_clear || (settings.hacks&hack_PPL && settings.ucode == 6))
|
||||
{
|
||||
if (settings.hacks&hack_RE2 && fb_depth_render_enabled)
|
||||
grDepthMask(FXFALSE);
|
||||
else
|
||||
grDepthMask(FXTRUE);
|
||||
grBufferClear(0, 0, 0xFFFF);
|
||||
}
|
||||
/* //let the game to clear the buffers
|
||||
if (settings.hacks&hack_RE2 && fb_depth_render_enabled)
|
||||
grDepthMask(FXFALSE);
|
||||
else
|
||||
{
|
||||
grDepthMask (FXTRUE);
|
||||
grColorMask (FXFALSE, FXFALSE);
|
||||
grBufferClear (0, 0, 0xFFFF);
|
||||
grColorMask (FXTRUE, FXTRUE);
|
||||
}
|
||||
*/
|
||||
grDepthMask(FXTRUE);
|
||||
grBufferClear(0, 0, 0xFFFF);
|
||||
}
|
||||
/* //let the game to clear the buffers
|
||||
else
|
||||
{
|
||||
grDepthMask (FXTRUE);
|
||||
grColorMask (FXFALSE, FXFALSE);
|
||||
grBufferClear (0, 0, 0xFFFF);
|
||||
grColorMask (FXTRUE, FXTRUE);
|
||||
}
|
||||
*/
|
||||
|
||||
if (settings.frame_buffer & fb_read_back_to_screen2)
|
||||
{
|
||||
DrawWholeFrameBufferToScreen();
|
||||
|
||||
}
|
||||
frame_count++;
|
||||
|
||||
// Open/close debugger?
|
||||
|
@ -2374,10 +2339,10 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
switch (msg)
|
||||
{
|
||||
case WM_ACTIVATEAPP:
|
||||
if (wParam == TRUE && !fullscreen) rdp.window_changed = TRUE;
|
||||
if (wParam == TRUE && !GfxInitDone) rdp.window_changed = TRUE;
|
||||
break;
|
||||
case WM_PAINT:
|
||||
if (!fullscreen) rdp.window_changed = TRUE;
|
||||
if (!GfxInitDone) rdp.window_changed = TRUE;
|
||||
break;
|
||||
|
||||
/* case WM_DESTROY:
|
||||
|
@ -2404,7 +2369,7 @@ int CheckKeyPressed(int key, int mask)
|
|||
}
|
||||
|
||||
#ifdef ALTTAB_FIX
|
||||
int k_ctl=0, k_alt=0, k_del=0;
|
||||
int k_ctl = 0, k_alt = 0, k_del = 0;
|
||||
|
||||
LRESULT CALLBACK LowLevelKeyboardProc(int nCode,
|
||||
WPARAM wParam, LPARAM lParam)
|
||||
|
@ -2449,7 +2414,7 @@ LRESULT CALLBACK LowLevelKeyboardProc(int nCode,
|
|||
k_alt = 0;
|
||||
k_del = 0;
|
||||
ReleaseGfx ();
|
||||
}
|
||||
}
|
||||
|
||||
return CallNextHookEx(NULL, nCode, wParam, lParam);
|
||||
}
|
||||
|
|
|
@ -210,7 +210,6 @@ static TBUFF_COLOR_IMAGE * AllocateTextureBuffer(COLOR_IMAGE & cimage)
|
|||
int OpenTextureBuffer(COLOR_IMAGE & cimage)
|
||||
{
|
||||
FRDP("OpenTextureBuffer. cur_tex_buf: %d, addr: %08lx, width: %d, height: %d", rdp.cur_tex_buf, cimage.addr, cimage.width, cimage.height);
|
||||
if (!fullscreen) return FALSE;
|
||||
|
||||
int found = FALSE, search = TRUE;
|
||||
TBUFF_COLOR_IMAGE *texbuf = 0;
|
||||
|
@ -419,7 +418,7 @@ static GrTextureFormat_t TexBufSetupCombiner(int force_rgb = FALSE)
|
|||
|
||||
int CloseTextureBuffer(int draw)
|
||||
{
|
||||
if (!fullscreen || !rdp.cur_image)
|
||||
if (!rdp.cur_image)
|
||||
{
|
||||
LRDP("CloseTextureBuffer KO\n");
|
||||
return FALSE;
|
||||
|
@ -471,8 +470,6 @@ int CloseTextureBuffer(int draw)
|
|||
|
||||
int CopyTextureBuffer(COLOR_IMAGE & fb_from, COLOR_IMAGE & fb_to)
|
||||
{
|
||||
if (!fullscreen)
|
||||
return FALSE;
|
||||
FRDP("CopyTextureBuffer from %08x to %08x\n", fb_from.addr, fb_to.addr);
|
||||
if (rdp.cur_image)
|
||||
{
|
||||
|
@ -537,8 +534,6 @@ int CopyTextureBuffer(COLOR_IMAGE & fb_from, COLOR_IMAGE & fb_to)
|
|||
|
||||
int CopyDepthBuffer()
|
||||
{
|
||||
if (!fullscreen)
|
||||
return FALSE;
|
||||
LRDP("CopyDepthBuffer. ");
|
||||
float bound = 1024.0f;
|
||||
GrLOD_t LOD = GR_LOD_LOG2_1024;
|
||||
|
@ -592,7 +587,7 @@ int CopyDepthBuffer()
|
|||
|
||||
int SwapTextureBuffer()
|
||||
{
|
||||
if (!fullscreen || !rdp.tbuff_tex)
|
||||
if (!rdp.tbuff_tex)
|
||||
return FALSE;
|
||||
LRDP("SwapTextureBuffer.");
|
||||
COLOR_IMAGE ci;
|
||||
|
|
|
@ -501,7 +501,6 @@ void GetTexInfo(int id, int tile)
|
|||
|
||||
int ChooseBestTmu(int tmu1, int tmu2)
|
||||
{
|
||||
if (!fullscreen) return tmu1;
|
||||
if (voodoo.tex_UMA) return 0;
|
||||
|
||||
if (tmu1 >= voodoo.num_tmu) return tmu2;
|
||||
|
@ -733,94 +732,91 @@ void TexCache()
|
|||
rdp.t1 = tmu_1;
|
||||
|
||||
// SET the combiner
|
||||
if (fullscreen)
|
||||
if (rdp.allow_combine)
|
||||
{
|
||||
if (rdp.allow_combine)
|
||||
// Now actually combine
|
||||
if (cmb.cmb_ext_use)
|
||||
{
|
||||
// Now actually combine
|
||||
if (cmb.cmb_ext_use)
|
||||
{
|
||||
LRDP(" | | | |- combiner extension\n");
|
||||
if (!(cmb.cmb_ext_use & COMBINE_EXT_COLOR))
|
||||
ColorCombinerToExtension();
|
||||
if (!(cmb.cmb_ext_use & COMBINE_EXT_ALPHA))
|
||||
AlphaCombinerToExtension();
|
||||
cmb.grColorCombineExt(cmb.c_ext_a, cmb.c_ext_a_mode,
|
||||
cmb.c_ext_b, cmb.c_ext_b_mode,
|
||||
cmb.c_ext_c, cmb.c_ext_c_invert,
|
||||
cmb.c_ext_d, cmb.c_ext_d_invert, 0, 0);
|
||||
cmb.grAlphaCombineExt(cmb.a_ext_a, cmb.a_ext_a_mode,
|
||||
cmb.a_ext_b, cmb.a_ext_b_mode,
|
||||
cmb.a_ext_c, cmb.a_ext_c_invert,
|
||||
cmb.a_ext_d, cmb.a_ext_d_invert, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
grColorCombine(cmb.c_fnc, cmb.c_fac, cmb.c_loc, cmb.c_oth, FXFALSE);
|
||||
grAlphaCombine(cmb.a_fnc, cmb.a_fac, cmb.a_loc, cmb.a_oth, FXFALSE);
|
||||
}
|
||||
grConstantColorValue(cmb.ccolor);
|
||||
grAlphaBlendFunction(cmb.abf1, cmb.abf2, GR_BLEND_ZERO, GR_BLEND_ZERO);
|
||||
if (!rdp.tex) //nothing more to do
|
||||
return;
|
||||
LRDP(" | | | |- combiner extension\n");
|
||||
if (!(cmb.cmb_ext_use & COMBINE_EXT_COLOR))
|
||||
ColorCombinerToExtension();
|
||||
if (!(cmb.cmb_ext_use & COMBINE_EXT_ALPHA))
|
||||
AlphaCombinerToExtension();
|
||||
cmb.grColorCombineExt(cmb.c_ext_a, cmb.c_ext_a_mode,
|
||||
cmb.c_ext_b, cmb.c_ext_b_mode,
|
||||
cmb.c_ext_c, cmb.c_ext_c_invert,
|
||||
cmb.c_ext_d, cmb.c_ext_d_invert, 0, 0);
|
||||
cmb.grAlphaCombineExt(cmb.a_ext_a, cmb.a_ext_a_mode,
|
||||
cmb.a_ext_b, cmb.a_ext_b_mode,
|
||||
cmb.a_ext_c, cmb.a_ext_c_invert,
|
||||
cmb.a_ext_d, cmb.a_ext_d_invert, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
grColorCombine(cmb.c_fnc, cmb.c_fac, cmb.c_loc, cmb.c_oth, FXFALSE);
|
||||
grAlphaCombine(cmb.a_fnc, cmb.a_fac, cmb.a_loc, cmb.a_oth, FXFALSE);
|
||||
}
|
||||
grConstantColorValue(cmb.ccolor);
|
||||
grAlphaBlendFunction(cmb.abf1, cmb.abf2, GR_BLEND_ZERO, GR_BLEND_ZERO);
|
||||
if (!rdp.tex) //nothing more to do
|
||||
return;
|
||||
}
|
||||
|
||||
if (tmu_1 < voodoo.num_tmu)
|
||||
if (tmu_1 < voodoo.num_tmu)
|
||||
{
|
||||
if (cmb.tex_cmb_ext_use)
|
||||
{
|
||||
if (cmb.tex_cmb_ext_use)
|
||||
{
|
||||
LRDP(" | | | |- combiner extension tmu1\n");
|
||||
if (!(cmb.tex_cmb_ext_use & TEX_COMBINE_EXT_COLOR))
|
||||
TexColorCombinerToExtension(GR_TMU1);
|
||||
if (!(cmb.tex_cmb_ext_use & TEX_COMBINE_EXT_ALPHA))
|
||||
TexAlphaCombinerToExtension(GR_TMU1);
|
||||
cmb.grTexColorCombineExt(tmu_1, cmb.t1c_ext_a, cmb.t1c_ext_a_mode,
|
||||
cmb.t1c_ext_b, cmb.t1c_ext_b_mode,
|
||||
cmb.t1c_ext_c, cmb.t1c_ext_c_invert,
|
||||
cmb.t1c_ext_d, cmb.t1c_ext_d_invert, 0, 0);
|
||||
cmb.grTexAlphaCombineExt(tmu_1, cmb.t1a_ext_a, cmb.t1a_ext_a_mode,
|
||||
cmb.t1a_ext_b, cmb.t1a_ext_b_mode,
|
||||
cmb.t1a_ext_c, cmb.t1a_ext_c_invert,
|
||||
cmb.t1a_ext_d, cmb.t1a_ext_d_invert, 0, 0);
|
||||
cmb.grConstantColorValueExt(tmu_1, cmb.tex_ccolor);
|
||||
}
|
||||
else
|
||||
{
|
||||
grTexCombine(tmu_1, cmb.tmu1_func, cmb.tmu1_fac, cmb.tmu1_a_func, cmb.tmu1_a_fac, cmb.tmu1_invert, cmb.tmu1_a_invert);
|
||||
if (cmb.combine_ext)
|
||||
cmb.grConstantColorValueExt(tmu_1, 0);
|
||||
}
|
||||
grTexDetailControl(tmu_1, cmb.dc1_lodbias, cmb.dc1_detailscale, cmb.dc1_detailmax);
|
||||
grTexLodBiasValue(tmu_1, cmb.lodbias1);
|
||||
LRDP(" | | | |- combiner extension tmu1\n");
|
||||
if (!(cmb.tex_cmb_ext_use & TEX_COMBINE_EXT_COLOR))
|
||||
TexColorCombinerToExtension(GR_TMU1);
|
||||
if (!(cmb.tex_cmb_ext_use & TEX_COMBINE_EXT_ALPHA))
|
||||
TexAlphaCombinerToExtension(GR_TMU1);
|
||||
cmb.grTexColorCombineExt(tmu_1, cmb.t1c_ext_a, cmb.t1c_ext_a_mode,
|
||||
cmb.t1c_ext_b, cmb.t1c_ext_b_mode,
|
||||
cmb.t1c_ext_c, cmb.t1c_ext_c_invert,
|
||||
cmb.t1c_ext_d, cmb.t1c_ext_d_invert, 0, 0);
|
||||
cmb.grTexAlphaCombineExt(tmu_1, cmb.t1a_ext_a, cmb.t1a_ext_a_mode,
|
||||
cmb.t1a_ext_b, cmb.t1a_ext_b_mode,
|
||||
cmb.t1a_ext_c, cmb.t1a_ext_c_invert,
|
||||
cmb.t1a_ext_d, cmb.t1a_ext_d_invert, 0, 0);
|
||||
cmb.grConstantColorValueExt(tmu_1, cmb.tex_ccolor);
|
||||
}
|
||||
if (tmu_0 < voodoo.num_tmu)
|
||||
else
|
||||
{
|
||||
if (cmb.tex_cmb_ext_use)
|
||||
{
|
||||
LRDP(" | | | |- combiner extension tmu0\n");
|
||||
if (!(cmb.tex_cmb_ext_use & TEX_COMBINE_EXT_COLOR))
|
||||
TexColorCombinerToExtension(GR_TMU0);
|
||||
if (!(cmb.tex_cmb_ext_use & TEX_COMBINE_EXT_ALPHA))
|
||||
TexAlphaCombinerToExtension(GR_TMU0);
|
||||
cmb.grTexColorCombineExt(tmu_0, cmb.t0c_ext_a, cmb.t0c_ext_a_mode,
|
||||
cmb.t0c_ext_b, cmb.t0c_ext_b_mode,
|
||||
cmb.t0c_ext_c, cmb.t0c_ext_c_invert,
|
||||
cmb.t0c_ext_d, cmb.t0c_ext_d_invert, 0, 0);
|
||||
cmb.grTexAlphaCombineExt(tmu_0, cmb.t0a_ext_a, cmb.t0a_ext_a_mode,
|
||||
cmb.t0a_ext_b, cmb.t0a_ext_b_mode,
|
||||
cmb.t0a_ext_c, cmb.t0a_ext_c_invert,
|
||||
cmb.t0a_ext_d, cmb.t0a_ext_d_invert, 0, 0);
|
||||
cmb.grConstantColorValueExt(tmu_0, cmb.tex_ccolor);
|
||||
}
|
||||
else
|
||||
{
|
||||
grTexCombine(tmu_0, cmb.tmu0_func, cmb.tmu0_fac, cmb.tmu0_a_func, cmb.tmu0_a_fac, cmb.tmu0_invert, cmb.tmu0_a_invert);
|
||||
if (cmb.combine_ext)
|
||||
cmb.grConstantColorValueExt(tmu_0, 0);
|
||||
}
|
||||
grTexDetailControl(tmu_0, cmb.dc0_lodbias, cmb.dc0_detailscale, cmb.dc0_detailmax);
|
||||
grTexLodBiasValue(tmu_0, cmb.lodbias0);
|
||||
grTexCombine(tmu_1, cmb.tmu1_func, cmb.tmu1_fac, cmb.tmu1_a_func, cmb.tmu1_a_fac, cmb.tmu1_invert, cmb.tmu1_a_invert);
|
||||
if (cmb.combine_ext)
|
||||
cmb.grConstantColorValueExt(tmu_1, 0);
|
||||
}
|
||||
grTexDetailControl(tmu_1, cmb.dc1_lodbias, cmb.dc1_detailscale, cmb.dc1_detailmax);
|
||||
grTexLodBiasValue(tmu_1, cmb.lodbias1);
|
||||
}
|
||||
if (tmu_0 < voodoo.num_tmu)
|
||||
{
|
||||
if (cmb.tex_cmb_ext_use)
|
||||
{
|
||||
LRDP(" | | | |- combiner extension tmu0\n");
|
||||
if (!(cmb.tex_cmb_ext_use & TEX_COMBINE_EXT_COLOR))
|
||||
TexColorCombinerToExtension(GR_TMU0);
|
||||
if (!(cmb.tex_cmb_ext_use & TEX_COMBINE_EXT_ALPHA))
|
||||
TexAlphaCombinerToExtension(GR_TMU0);
|
||||
cmb.grTexColorCombineExt(tmu_0, cmb.t0c_ext_a, cmb.t0c_ext_a_mode,
|
||||
cmb.t0c_ext_b, cmb.t0c_ext_b_mode,
|
||||
cmb.t0c_ext_c, cmb.t0c_ext_c_invert,
|
||||
cmb.t0c_ext_d, cmb.t0c_ext_d_invert, 0, 0);
|
||||
cmb.grTexAlphaCombineExt(tmu_0, cmb.t0a_ext_a, cmb.t0a_ext_a_mode,
|
||||
cmb.t0a_ext_b, cmb.t0a_ext_b_mode,
|
||||
cmb.t0a_ext_c, cmb.t0a_ext_c_invert,
|
||||
cmb.t0a_ext_d, cmb.t0a_ext_d_invert, 0, 0);
|
||||
cmb.grConstantColorValueExt(tmu_0, cmb.tex_ccolor);
|
||||
}
|
||||
else
|
||||
{
|
||||
grTexCombine(tmu_0, cmb.tmu0_func, cmb.tmu0_fac, cmb.tmu0_a_func, cmb.tmu0_a_fac, cmb.tmu0_invert, cmb.tmu0_a_invert);
|
||||
if (cmb.combine_ext)
|
||||
cmb.grConstantColorValueExt(tmu_0, 0);
|
||||
}
|
||||
grTexDetailControl(tmu_0, cmb.dc0_lodbias, cmb.dc0_detailscale, cmb.dc0_detailmax);
|
||||
grTexLodBiasValue(tmu_0, cmb.lodbias0);
|
||||
}
|
||||
|
||||
if ((rdp.tex & 1) && tmu_0 < voodoo.num_tmu)
|
||||
|
@ -828,28 +824,22 @@ void TexCache()
|
|||
if (aTBuff[0] && aTBuff[0]->cache)
|
||||
{
|
||||
LRDP(" | |- Hires tex T0 found in cache.\n");
|
||||
if (fullscreen)
|
||||
{
|
||||
rdp.cur_cache[0] = aTBuff[0]->cache;
|
||||
rdp.cur_cache[0]->last_used = frame_count;
|
||||
rdp.cur_cache[0]->uses = rdp.debug_n;
|
||||
}
|
||||
rdp.cur_cache[0] = aTBuff[0]->cache;
|
||||
rdp.cur_cache[0]->last_used = frame_count;
|
||||
rdp.cur_cache[0]->uses = rdp.debug_n;
|
||||
}
|
||||
else if (tex_found[0][tmu_0] != -1)
|
||||
{
|
||||
LRDP(" | |- T0 found in cache.\n");
|
||||
if (fullscreen)
|
||||
{
|
||||
CACHE_LUT *cache = voodoo.tex_UMA ? &rdp.cache[0][tex_found[0][0]] : &rdp.cache[tmu_0][tex_found[0][tmu_0]];
|
||||
rdp.cur_cache_n[0] = tex_found[0][tmu_0];
|
||||
rdp.cur_cache[0] = cache;
|
||||
rdp.cur_cache[0]->last_used = frame_count;
|
||||
rdp.cur_cache[0]->uses = rdp.debug_n;
|
||||
grTexSource(tmu_0,
|
||||
(voodoo.tex_min_addr[tmu_0] + cache->tmem_addr),
|
||||
GR_MIPMAPLEVELMASK_BOTH,
|
||||
&cache->t_info);
|
||||
}
|
||||
CACHE_LUT *cache = voodoo.tex_UMA ? &rdp.cache[0][tex_found[0][0]] : &rdp.cache[tmu_0][tex_found[0][tmu_0]];
|
||||
rdp.cur_cache_n[0] = tex_found[0][tmu_0];
|
||||
rdp.cur_cache[0] = cache;
|
||||
rdp.cur_cache[0]->last_used = frame_count;
|
||||
rdp.cur_cache[0]->uses = rdp.debug_n;
|
||||
grTexSource(tmu_0,
|
||||
(voodoo.tex_min_addr[tmu_0] + cache->tmem_addr),
|
||||
GR_MIPMAPLEVELMASK_BOTH,
|
||||
&cache->t_info);
|
||||
}
|
||||
else
|
||||
LoadTex(0, tmu_0);
|
||||
|
@ -859,110 +849,101 @@ void TexCache()
|
|||
if (aTBuff[1] && aTBuff[1]->cache)
|
||||
{
|
||||
LRDP(" | |- Hires tex T1 found in cache.\n");
|
||||
if (fullscreen)
|
||||
{
|
||||
rdp.cur_cache[1] = aTBuff[1]->cache;
|
||||
rdp.cur_cache[1]->last_used = frame_count;
|
||||
rdp.cur_cache[1]->uses = rdp.debug_n;
|
||||
}
|
||||
rdp.cur_cache[1] = aTBuff[1]->cache;
|
||||
rdp.cur_cache[1]->last_used = frame_count;
|
||||
rdp.cur_cache[1]->uses = rdp.debug_n;
|
||||
}
|
||||
else if (tex_found[1][tmu_1] != -1)
|
||||
{
|
||||
LRDP(" | |- T1 found in cache.\n");
|
||||
if (fullscreen)
|
||||
{
|
||||
CACHE_LUT *cache = voodoo.tex_UMA ? &rdp.cache[0][tex_found[1][0]] : &rdp.cache[tmu_1][tex_found[1][tmu_1]];
|
||||
rdp.cur_cache_n[1] = tex_found[1][tmu_1];
|
||||
rdp.cur_cache[1] = cache;
|
||||
rdp.cur_cache[1]->last_used = frame_count;
|
||||
rdp.cur_cache[1]->uses = rdp.debug_n;
|
||||
grTexSource(tmu_1,
|
||||
(voodoo.tex_min_addr[tmu_1] + cache->tmem_addr),
|
||||
GR_MIPMAPLEVELMASK_BOTH,
|
||||
&cache->t_info);
|
||||
}
|
||||
CACHE_LUT *cache = voodoo.tex_UMA ? &rdp.cache[0][tex_found[1][0]] : &rdp.cache[tmu_1][tex_found[1][tmu_1]];
|
||||
rdp.cur_cache_n[1] = tex_found[1][tmu_1];
|
||||
rdp.cur_cache[1] = cache;
|
||||
rdp.cur_cache[1]->last_used = frame_count;
|
||||
rdp.cur_cache[1]->uses = rdp.debug_n;
|
||||
grTexSource(tmu_1,
|
||||
(voodoo.tex_min_addr[tmu_1] + cache->tmem_addr),
|
||||
GR_MIPMAPLEVELMASK_BOTH,
|
||||
&cache->t_info);
|
||||
}
|
||||
else
|
||||
LoadTex(1, tmu_1);
|
||||
}
|
||||
|
||||
if (fullscreen)
|
||||
int tmu_v[2];
|
||||
|
||||
tmu_v[0] = tmu_0;
|
||||
tmu_v[1] = tmu_1;
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
int tmu_v[2];
|
||||
const int tmu = tmu_v[i];
|
||||
|
||||
tmu_v[0] = tmu_0;
|
||||
tmu_v[1] = tmu_1;
|
||||
for (int i = 0; i < 2; i++)
|
||||
if (tmu >= voodoo.num_tmu) continue;
|
||||
|
||||
int tile = rdp.cur_tile + i;
|
||||
|
||||
if (settings.filtering == 0)
|
||||
{
|
||||
const int tmu = tmu_v[i];
|
||||
int filter = (rdp.filter_mode != 2) ? GR_TEXTUREFILTER_POINT_SAMPLED : GR_TEXTUREFILTER_BILINEAR;
|
||||
grTexFilterMode(tmu, filter, filter);
|
||||
}
|
||||
else
|
||||
{
|
||||
int filter = (settings.filtering == 1) ? GR_TEXTUREFILTER_BILINEAR : GR_TEXTUREFILTER_POINT_SAMPLED;
|
||||
grTexFilterMode(tmu, filter, filter);
|
||||
}
|
||||
|
||||
if (tmu >= voodoo.num_tmu) continue;
|
||||
|
||||
int tile = rdp.cur_tile + i;
|
||||
|
||||
if (settings.filtering == 0)
|
||||
if (rdp.cur_cache[i])
|
||||
{
|
||||
uint32_t mode_s, mode_t;
|
||||
int clamp_s, clamp_t;
|
||||
if (rdp.force_wrap && !rdp.texrecting)
|
||||
{
|
||||
int filter = (rdp.filter_mode != 2) ? GR_TEXTUREFILTER_POINT_SAMPLED : GR_TEXTUREFILTER_BILINEAR;
|
||||
grTexFilterMode(tmu, filter, filter);
|
||||
clamp_s = rdp.tiles[tile].clamp_s && rdp.tiles[tile].lr_s - rdp.tiles[tile].ul_s < 256;
|
||||
clamp_t = rdp.tiles[tile].clamp_t && rdp.tiles[tile].lr_t - rdp.tiles[tile].ul_t < 256;
|
||||
}
|
||||
else
|
||||
{
|
||||
int filter = (settings.filtering == 1) ? GR_TEXTUREFILTER_BILINEAR : GR_TEXTUREFILTER_POINT_SAMPLED;
|
||||
grTexFilterMode(tmu, filter, filter);
|
||||
clamp_s = (rdp.tiles[tile].clamp_s || rdp.tiles[tile].mask_s == 0) &&
|
||||
rdp.tiles[tile].lr_s - rdp.tiles[tile].ul_s < 256;
|
||||
clamp_t = (rdp.tiles[tile].clamp_t || rdp.tiles[tile].mask_t == 0) &&
|
||||
rdp.tiles[tile].lr_t - rdp.tiles[tile].ul_t < 256;
|
||||
}
|
||||
|
||||
if (rdp.cur_cache[i])
|
||||
if (rdp.cur_cache[i]->f_mirror_s)
|
||||
mode_s = GR_TEXTURECLAMP_MIRROR_EXT;
|
||||
else if (rdp.cur_cache[i]->f_wrap_s)
|
||||
mode_s = GR_TEXTURECLAMP_WRAP;
|
||||
else if (clamp_s)
|
||||
mode_s = GR_TEXTURECLAMP_CLAMP;
|
||||
else
|
||||
{
|
||||
uint32_t mode_s, mode_t;
|
||||
int clamp_s, clamp_t;
|
||||
if (rdp.force_wrap && !rdp.texrecting)
|
||||
{
|
||||
clamp_s = rdp.tiles[tile].clamp_s && rdp.tiles[tile].lr_s - rdp.tiles[tile].ul_s < 256;
|
||||
clamp_t = rdp.tiles[tile].clamp_t && rdp.tiles[tile].lr_t - rdp.tiles[tile].ul_t < 256;
|
||||
}
|
||||
else
|
||||
{
|
||||
clamp_s = (rdp.tiles[tile].clamp_s || rdp.tiles[tile].mask_s == 0) &&
|
||||
rdp.tiles[tile].lr_s - rdp.tiles[tile].ul_s < 256;
|
||||
clamp_t = (rdp.tiles[tile].clamp_t || rdp.tiles[tile].mask_t == 0) &&
|
||||
rdp.tiles[tile].lr_t - rdp.tiles[tile].ul_t < 256;
|
||||
}
|
||||
|
||||
if (rdp.cur_cache[i]->f_mirror_s)
|
||||
if (rdp.tiles[tile].mirror_s && voodoo.sup_mirroring)
|
||||
mode_s = GR_TEXTURECLAMP_MIRROR_EXT;
|
||||
else if (rdp.cur_cache[i]->f_wrap_s)
|
||||
else
|
||||
mode_s = GR_TEXTURECLAMP_WRAP;
|
||||
else if (clamp_s)
|
||||
mode_s = GR_TEXTURECLAMP_CLAMP;
|
||||
else
|
||||
{
|
||||
if (rdp.tiles[tile].mirror_s && voodoo.sup_mirroring)
|
||||
mode_s = GR_TEXTURECLAMP_MIRROR_EXT;
|
||||
else
|
||||
mode_s = GR_TEXTURECLAMP_WRAP;
|
||||
}
|
||||
|
||||
if (rdp.cur_cache[i]->f_mirror_t)
|
||||
mode_t = GR_TEXTURECLAMP_MIRROR_EXT;
|
||||
else if (rdp.cur_cache[i]->f_wrap_t)
|
||||
mode_t = GR_TEXTURECLAMP_WRAP;
|
||||
else if (clamp_t)
|
||||
mode_t = GR_TEXTURECLAMP_CLAMP;
|
||||
else
|
||||
{
|
||||
if (rdp.tiles[tile].mirror_t && voodoo.sup_mirroring)
|
||||
mode_t = GR_TEXTURECLAMP_MIRROR_EXT;
|
||||
else
|
||||
mode_t = GR_TEXTURECLAMP_WRAP;
|
||||
}
|
||||
|
||||
grTexClampMode(tmu,
|
||||
mode_s,
|
||||
mode_t);
|
||||
}
|
||||
if (aTBuff[i] && (rdp.tex&(i + 1)))
|
||||
SelectTBuffTex(aTBuff[i]);
|
||||
|
||||
if (rdp.cur_cache[i]->f_mirror_t)
|
||||
mode_t = GR_TEXTURECLAMP_MIRROR_EXT;
|
||||
else if (rdp.cur_cache[i]->f_wrap_t)
|
||||
mode_t = GR_TEXTURECLAMP_WRAP;
|
||||
else if (clamp_t)
|
||||
mode_t = GR_TEXTURECLAMP_CLAMP;
|
||||
else
|
||||
{
|
||||
if (rdp.tiles[tile].mirror_t && voodoo.sup_mirroring)
|
||||
mode_t = GR_TEXTURECLAMP_MIRROR_EXT;
|
||||
else
|
||||
mode_t = GR_TEXTURECLAMP_WRAP;
|
||||
}
|
||||
|
||||
grTexClampMode(tmu,
|
||||
mode_s,
|
||||
mode_t);
|
||||
}
|
||||
if (aTBuff[i] && (rdp.tex&(i + 1)))
|
||||
SelectTBuffTex(aTBuff[i]);
|
||||
}
|
||||
|
||||
LRDP(" | +- TexCache End\n");
|
||||
|
@ -1614,7 +1595,7 @@ void LoadTex(int id, int tmu)
|
|||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cache->t_info.format = LOWORD(result);
|
||||
|
||||
|
@ -1623,165 +1604,162 @@ void LoadTex(int id, int tmu)
|
|||
cache->lod = lod;
|
||||
cache->aspect = aspect;
|
||||
|
||||
if (fullscreen)
|
||||
{
|
||||
#ifdef TEXTURE_FILTER // Hiroshi Morii <koolsmoky@users.sourceforge.net>
|
||||
if (settings.ghq_use)
|
||||
{
|
||||
if (!ghqTexInfo.data && ghq_dmptex_toggle_key) {
|
||||
unsigned char *tmpbuf = (unsigned char*)texture;
|
||||
int tmpwidth = real_x;
|
||||
if (texinfo[id].splits > 1) {
|
||||
int dstpixoffset, srcpixoffset;
|
||||
int shift;
|
||||
switch (LOWORD(result) & 0x7fff) { // XXX is there a better way of determining the pixel color depth?
|
||||
case GR_TEXFMT_ARGB_8888:
|
||||
shift = 3;
|
||||
break;
|
||||
case GR_TEXFMT_ALPHA_INTENSITY_44:
|
||||
case GR_TEXFMT_ALPHA_8:
|
||||
shift = 0;
|
||||
break;
|
||||
default:
|
||||
shift = 1;
|
||||
}
|
||||
tmpwidth = texinfo[id].real_image_width;
|
||||
tmpbuf = (unsigned char*)malloc((256 * 256) << 3); // XXX performance overhead
|
||||
for (int i = 0; i < cache->splitheight; i++) {
|
||||
dstpixoffset = texinfo[id].real_image_width * i;
|
||||
srcpixoffset = 256 * i;
|
||||
for (int k = 0; k < texinfo[id].splits; k++) {
|
||||
memcpy(tmpbuf + (dstpixoffset << shift), texture + (srcpixoffset << shift), (256 << shift));
|
||||
dstpixoffset += 256;
|
||||
srcpixoffset += (256 * cache->splitheight);
|
||||
}
|
||||
}
|
||||
if (settings.ghq_use)
|
||||
{
|
||||
if (!ghqTexInfo.data && ghq_dmptex_toggle_key) {
|
||||
unsigned char *tmpbuf = (unsigned char*)texture;
|
||||
int tmpwidth = real_x;
|
||||
if (texinfo[id].splits > 1) {
|
||||
int dstpixoffset, srcpixoffset;
|
||||
int shift;
|
||||
switch (LOWORD(result) & 0x7fff) { // XXX is there a better way of determining the pixel color depth?
|
||||
case GR_TEXFMT_ARGB_8888:
|
||||
shift = 3;
|
||||
break;
|
||||
case GR_TEXFMT_ALPHA_INTENSITY_44:
|
||||
case GR_TEXFMT_ALPHA_8:
|
||||
shift = 0;
|
||||
break;
|
||||
default:
|
||||
shift = 1;
|
||||
}
|
||||
ext_ghq_dmptx(tmpbuf, (int)texinfo[id].real_image_width, (int)texinfo[id].real_image_height, (int)tmpwidth, (unsigned short)LOWORD(result), (unsigned short)((cache->format << 8) | (cache->size)), cache->ricecrc);
|
||||
if (tmpbuf != texture && tmpbuf) {
|
||||
free(tmpbuf);
|
||||
tmpwidth = texinfo[id].real_image_width;
|
||||
tmpbuf = (unsigned char*)malloc((256 * 256) << 3); // XXX performance overhead
|
||||
for (int i = 0; i < cache->splitheight; i++) {
|
||||
dstpixoffset = texinfo[id].real_image_width * i;
|
||||
srcpixoffset = 256 * i;
|
||||
for (int k = 0; k < texinfo[id].splits; k++) {
|
||||
memcpy(tmpbuf + (dstpixoffset << shift), texture + (srcpixoffset << shift), (256 << shift));
|
||||
dstpixoffset += 256;
|
||||
srcpixoffset += (256 * cache->splitheight);
|
||||
}
|
||||
}
|
||||
}
|
||||
ext_ghq_dmptx(tmpbuf, (int)texinfo[id].real_image_width, (int)texinfo[id].real_image_height, (int)tmpwidth, (unsigned short)LOWORD(result), (unsigned short)((cache->format << 8) | (cache->size)), cache->ricecrc);
|
||||
if (tmpbuf != texture && tmpbuf) {
|
||||
free(tmpbuf);
|
||||
}
|
||||
}
|
||||
|
||||
if (!ghqTexInfo.data)
|
||||
if (!settings.ghq_enht_nobg || !rdp.texrecting || (texinfo[id].splits == 1 && texinfo[id].width <= 256))
|
||||
ext_ghq_txfilter((unsigned char*)texture, (int)real_x, (int)real_y, LOWORD(result), (uint64)g64_crc, &ghqTexInfo);
|
||||
if (!ghqTexInfo.data)
|
||||
if (!settings.ghq_enht_nobg || !rdp.texrecting || (texinfo[id].splits == 1 && texinfo[id].width <= 256))
|
||||
ext_ghq_txfilter((unsigned char*)texture, (int)real_x, (int)real_y, LOWORD(result), (uint64)g64_crc, &ghqTexInfo);
|
||||
|
||||
if (ghqTexInfo.data)
|
||||
if (ghqTexInfo.data)
|
||||
{
|
||||
if (ghqTexInfo.aspectRatioLog2 < GR_ASPECT_LOG2_1x8 ||
|
||||
ghqTexInfo.aspectRatioLog2 > GR_ASPECT_LOG2_8x1 ||
|
||||
ghqTexInfo.largeLodLog2 > GR_LOD_LOG2_2048 ||
|
||||
ghqTexInfo.largeLodLog2 < GR_LOD_LOG2_1)
|
||||
{
|
||||
if (ghqTexInfo.aspectRatioLog2 < GR_ASPECT_LOG2_1x8 ||
|
||||
ghqTexInfo.aspectRatioLog2 > GR_ASPECT_LOG2_8x1 ||
|
||||
ghqTexInfo.largeLodLog2 > GR_LOD_LOG2_2048 ||
|
||||
ghqTexInfo.largeLodLog2 < GR_LOD_LOG2_1)
|
||||
/* invalid dimensions */
|
||||
}
|
||||
else
|
||||
{
|
||||
texture = (uint8_t *)ghqTexInfo.data;
|
||||
lod = ghqTexInfo.largeLodLog2;
|
||||
int splits = cache->splits;
|
||||
if (ghqTexInfo.is_hires_tex)
|
||||
{
|
||||
/* invalid dimensions */
|
||||
}
|
||||
else
|
||||
{
|
||||
texture = (uint8_t *)ghqTexInfo.data;
|
||||
lod = ghqTexInfo.largeLodLog2;
|
||||
int splits = cache->splits;
|
||||
if (ghqTexInfo.is_hires_tex)
|
||||
if (ghqTexInfo.tiles/*ghqTexInfo.untiled_width > max_tex_size*/)
|
||||
{
|
||||
if (ghqTexInfo.tiles/*ghqTexInfo.untiled_width > max_tex_size*/)
|
||||
cache->scale = 1.0f;
|
||||
cache->c_off = 0.5f;
|
||||
cache->splits = ghqTexInfo.tiles;//((hirestex.width-1)>>8)+1;
|
||||
cache->splitheight = ghqTexInfo.untiled_height;
|
||||
cache->scale_x = 1.0f;
|
||||
cache->scale_y = float(ghqTexInfo.untiled_height*ghqTexInfo.tiles) / float(ghqTexInfo.width);//*sy;
|
||||
if (splits == 1)
|
||||
{
|
||||
cache->scale = 1.0f;
|
||||
cache->c_off = 0.5f;
|
||||
cache->splits = ghqTexInfo.tiles;//((hirestex.width-1)>>8)+1;
|
||||
cache->splitheight = ghqTexInfo.untiled_height;
|
||||
cache->scale_x = 1.0f;
|
||||
cache->scale_y = float(ghqTexInfo.untiled_height*ghqTexInfo.tiles) / float(ghqTexInfo.width);//*sy;
|
||||
if (splits == 1)
|
||||
{
|
||||
int shift;
|
||||
for (shift = 9; (1 << shift) < ghqTexInfo.untiled_width; shift++);
|
||||
float mult = float(1 << shift >> 8);
|
||||
cache->c_scl_x *= mult;
|
||||
cache->c_scl_y *= mult;
|
||||
}
|
||||
else
|
||||
{
|
||||
int tile_width = rdp.tiles[td].width;
|
||||
if (rdp.timg.set_by == 1)
|
||||
tile_width = rdp.load_info[rdp.tiles[td].t_mem].tex_width;
|
||||
float mult = float(ghqTexInfo.untiled_width / tile_width);
|
||||
cache->c_scl_x *= mult;
|
||||
cache->c_scl_y *= mult;
|
||||
}
|
||||
int shift;
|
||||
for (shift = 9; (1 << shift) < ghqTexInfo.untiled_width; shift++);
|
||||
float mult = float(1 << shift >> 8);
|
||||
cache->c_scl_x *= mult;
|
||||
cache->c_scl_y *= mult;
|
||||
}
|
||||
else
|
||||
{
|
||||
cache->scale = 256.0f / float(1 << lod);
|
||||
cache->c_off = cache->scale * 0.5f;
|
||||
cache->splits = 1;
|
||||
if (aspect != ghqTexInfo.aspectRatioLog2)
|
||||
{
|
||||
float mscale = float(1 << abs(aspect - ghqTexInfo.aspectRatioLog2));
|
||||
if (abs(aspect) > abs(ghqTexInfo.aspectRatioLog2))
|
||||
{
|
||||
cache->c_scl_y *= mscale;
|
||||
cache->c_scl_x *= mscale;
|
||||
}
|
||||
/*
|
||||
else
|
||||
{
|
||||
if (rdp.tiles[td].mirror_s && sup_mirroring)
|
||||
cache->f_mirror_s = TRUE;
|
||||
if (rdp.tiles[td].mirror_t && sup_mirroring)
|
||||
cache->f_mirror_t = TRUE;
|
||||
//cache->c_scl_y /= mscale;
|
||||
//cache->c_scl_x /= mscale;
|
||||
}
|
||||
*/
|
||||
if (ghqTexInfo.aspectRatioLog2 >= 0)
|
||||
{
|
||||
cache->scale_x = 1.0f;
|
||||
cache->scale_y = 1.0f / float(1 << ghqTexInfo.aspectRatioLog2);
|
||||
}
|
||||
else
|
||||
{
|
||||
cache->scale_y = 1.0f;
|
||||
cache->scale_x = 1.0f / float(1 << (-ghqTexInfo.aspectRatioLog2));
|
||||
}
|
||||
}
|
||||
else if (splits > 1)
|
||||
{
|
||||
cache->c_scl_x /= splits;
|
||||
cache->c_scl_y /= splits;
|
||||
}
|
||||
int tile_width = rdp.tiles[td].width;
|
||||
if (rdp.timg.set_by == 1)
|
||||
tile_width = rdp.load_info[rdp.tiles[td].t_mem].tex_width;
|
||||
float mult = float(ghqTexInfo.untiled_width / tile_width);
|
||||
cache->c_scl_x *= mult;
|
||||
cache->c_scl_y *= mult;
|
||||
}
|
||||
if (voodoo.sup_mirroring)
|
||||
{
|
||||
if (rdp.tiles[td].mirror_s && texinfo[id].tile_width == 2 * texinfo[id].width)
|
||||
cache->f_mirror_s = TRUE;
|
||||
else if (texinfo[id].tile_width >= 2 * texinfo[id].width)
|
||||
cache->f_wrap_s = TRUE;
|
||||
if (rdp.tiles[td].mirror_t && texinfo[id].tile_height == 2 * texinfo[id].height)
|
||||
cache->f_mirror_t = TRUE;
|
||||
else if (texinfo[id].tile_height >= 2 * texinfo[id].height)
|
||||
cache->f_wrap_t = TRUE;
|
||||
if (cache->f_mirror_s && cache->f_mirror_t)
|
||||
{
|
||||
cache->c_scl_x *= 2.0f;
|
||||
cache->c_scl_y *= 2.0f;
|
||||
}
|
||||
}
|
||||
aspect = ghqTexInfo.aspectRatioLog2;
|
||||
cache->lod = lod;
|
||||
cache->aspect = aspect;
|
||||
}
|
||||
else
|
||||
{
|
||||
//cache->scale = 256.0f / float(1<<lod);
|
||||
cache->c_off = 128.0f / float(1 << lod);
|
||||
cache->scale = 256.0f / float(1 << lod);
|
||||
cache->c_off = cache->scale * 0.5f;
|
||||
cache->splits = 1;
|
||||
if (aspect != ghqTexInfo.aspectRatioLog2)
|
||||
{
|
||||
float mscale = float(1 << abs(aspect - ghqTexInfo.aspectRatioLog2));
|
||||
if (abs(aspect) > abs(ghqTexInfo.aspectRatioLog2))
|
||||
{
|
||||
cache->c_scl_y *= mscale;
|
||||
cache->c_scl_x *= mscale;
|
||||
}
|
||||
/*
|
||||
else
|
||||
{
|
||||
if (rdp.tiles[td].mirror_s && sup_mirroring)
|
||||
cache->f_mirror_s = TRUE;
|
||||
if (rdp.tiles[td].mirror_t && sup_mirroring)
|
||||
cache->f_mirror_t = TRUE;
|
||||
//cache->c_scl_y /= mscale;
|
||||
//cache->c_scl_x /= mscale;
|
||||
}
|
||||
*/
|
||||
if (ghqTexInfo.aspectRatioLog2 >= 0)
|
||||
{
|
||||
cache->scale_x = 1.0f;
|
||||
cache->scale_y = 1.0f / float(1 << ghqTexInfo.aspectRatioLog2);
|
||||
}
|
||||
else
|
||||
{
|
||||
cache->scale_y = 1.0f;
|
||||
cache->scale_x = 1.0f / float(1 << (-ghqTexInfo.aspectRatioLog2));
|
||||
}
|
||||
}
|
||||
else if (splits > 1)
|
||||
{
|
||||
cache->c_scl_x /= splits;
|
||||
cache->c_scl_y /= splits;
|
||||
}
|
||||
}
|
||||
real_x = ghqTexInfo.width;
|
||||
real_y = ghqTexInfo.height;
|
||||
result = (1 << 16) | ghqTexInfo.format;
|
||||
cache->t_info.format = ghqTexInfo.format;
|
||||
cache->realwidth = real_x;
|
||||
cache->realheight = real_y;
|
||||
if (voodoo.sup_mirroring)
|
||||
{
|
||||
if (rdp.tiles[td].mirror_s && texinfo[id].tile_width == 2 * texinfo[id].width)
|
||||
cache->f_mirror_s = TRUE;
|
||||
else if (texinfo[id].tile_width >= 2 * texinfo[id].width)
|
||||
cache->f_wrap_s = TRUE;
|
||||
if (rdp.tiles[td].mirror_t && texinfo[id].tile_height == 2 * texinfo[id].height)
|
||||
cache->f_mirror_t = TRUE;
|
||||
else if (texinfo[id].tile_height >= 2 * texinfo[id].height)
|
||||
cache->f_wrap_t = TRUE;
|
||||
if (cache->f_mirror_s && cache->f_mirror_t)
|
||||
{
|
||||
cache->c_scl_x *= 2.0f;
|
||||
cache->c_scl_y *= 2.0f;
|
||||
}
|
||||
}
|
||||
aspect = ghqTexInfo.aspectRatioLog2;
|
||||
cache->lod = lod;
|
||||
cache->aspect = aspect;
|
||||
}
|
||||
else
|
||||
{
|
||||
//cache->scale = 256.0f / float(1<<lod);
|
||||
cache->c_off = 128.0f / float(1 << lod);
|
||||
}
|
||||
real_x = ghqTexInfo.width;
|
||||
real_y = ghqTexInfo.height;
|
||||
result = (1 << 16) | ghqTexInfo.format;
|
||||
cache->t_info.format = ghqTexInfo.format;
|
||||
cache->realwidth = real_x;
|
||||
cache->realheight = real_y;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1620,83 +1620,80 @@ static void render_tri(uint16_t linew, int old_interpolate)
|
|||
}
|
||||
}
|
||||
*/
|
||||
if (fullscreen)
|
||||
if (settings.wireframe)
|
||||
{
|
||||
if (settings.wireframe)
|
||||
SetWireframeCol();
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
SetWireframeCol();
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
j = i + 1;
|
||||
if (j == n) j = 0;
|
||||
grDrawLine(&rdp.vtxbuf[i], &rdp.vtxbuf[j]);
|
||||
}
|
||||
j = i + 1;
|
||||
if (j == n) j = 0;
|
||||
grDrawLine(&rdp.vtxbuf[i], &rdp.vtxbuf[j]);
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
// VERTEX ** pv = rdp.vtx_buffer?(vtx_list2):(vtx_list1);
|
||||
// for (int k = 0; k < n; k ++)
|
||||
// FRDP ("DRAW[%d]: v.x = %f, v.y = %f, v.z = %f, v.u = %f, v.v = %f\n", k, pv[k]->x, pv[k]->y, pv[k]->z, pv[k]->coord[rdp.t0<<1], pv[k]->coord[(rdp.t0<<1)+1]);
|
||||
// pv[k]->y = settings.res_y - pv[k]->y;
|
||||
|
||||
if (linew > 0)
|
||||
{
|
||||
// VERTEX ** pv = rdp.vtx_buffer?(vtx_list2):(vtx_list1);
|
||||
// for (int k = 0; k < n; k ++)
|
||||
// FRDP ("DRAW[%d]: v.x = %f, v.y = %f, v.z = %f, v.u = %f, v.v = %f\n", k, pv[k]->x, pv[k]->y, pv[k]->z, pv[k]->coord[rdp.t0<<1], pv[k]->coord[(rdp.t0<<1)+1]);
|
||||
// pv[k]->y = settings.res_y - pv[k]->y;
|
||||
|
||||
if (linew > 0)
|
||||
VERTEX *V0 = &rdp.vtxbuf[0];
|
||||
VERTEX *V1 = &rdp.vtxbuf[1];
|
||||
if (fabs(V0->x - V1->x) < 0.01 && fabs(V0->y - V1->y) < 0.01)
|
||||
V1 = &rdp.vtxbuf[2];
|
||||
V0->z = ScaleZ(V0->z);
|
||||
V1->z = ScaleZ(V1->z);
|
||||
VERTEX v[4];
|
||||
v[0] = *V0;
|
||||
v[1] = *V0;
|
||||
v[2] = *V1;
|
||||
v[3] = *V1;
|
||||
float width = linew * 0.25f;
|
||||
if (fabs(V0->y - V1->y) < 0.0001)
|
||||
{
|
||||
VERTEX *V0 = &rdp.vtxbuf[0];
|
||||
VERTEX *V1 = &rdp.vtxbuf[1];
|
||||
if (fabs(V0->x - V1->x) < 0.01 && fabs(V0->y - V1->y) < 0.01)
|
||||
V1 = &rdp.vtxbuf[2];
|
||||
V0->z = ScaleZ(V0->z);
|
||||
V1->z = ScaleZ(V1->z);
|
||||
VERTEX v[4];
|
||||
v[0] = *V0;
|
||||
v[1] = *V0;
|
||||
v[2] = *V1;
|
||||
v[3] = *V1;
|
||||
float width = linew * 0.25f;
|
||||
if (fabs(V0->y - V1->y) < 0.0001)
|
||||
{
|
||||
v[0].x = v[1].x = V0->x;
|
||||
v[2].x = v[3].x = V1->x;
|
||||
v[0].x = v[1].x = V0->x;
|
||||
v[2].x = v[3].x = V1->x;
|
||||
|
||||
width *= rdp.scale_y;
|
||||
v[0].y = v[2].y = V0->y - width;
|
||||
v[1].y = v[3].y = V0->y + width;
|
||||
}
|
||||
else if (fabs(V0->x - V1->x) < 0.0001)
|
||||
{
|
||||
v[0].y = v[1].y = V0->y;
|
||||
v[2].y = v[3].y = V1->y;
|
||||
width *= rdp.scale_y;
|
||||
v[0].y = v[2].y = V0->y - width;
|
||||
v[1].y = v[3].y = V0->y + width;
|
||||
}
|
||||
else if (fabs(V0->x - V1->x) < 0.0001)
|
||||
{
|
||||
v[0].y = v[1].y = V0->y;
|
||||
v[2].y = v[3].y = V1->y;
|
||||
|
||||
width *= rdp.scale_x;
|
||||
v[0].x = v[2].x = V0->x - width;
|
||||
v[1].x = v[3].x = V0->x + width;
|
||||
}
|
||||
else
|
||||
{
|
||||
float dx = V1->x - V0->x;
|
||||
float dy = V1->y - V0->y;
|
||||
float len = sqrtf(dx*dx + dy*dy);
|
||||
float wx = dy * width * rdp.scale_x / len;
|
||||
float wy = dx * width * rdp.scale_y / len;
|
||||
v[0].x = V0->x + wx;
|
||||
v[0].y = V0->y - wy;
|
||||
v[1].x = V0->x - wx;
|
||||
v[1].y = V0->y + wy;
|
||||
v[2].x = V1->x + wx;
|
||||
v[2].y = V1->y - wy;
|
||||
v[3].x = V1->x - wx;
|
||||
v[3].y = V1->y + wy;
|
||||
}
|
||||
grDrawTriangle(&v[0], &v[1], &v[2]);
|
||||
grDrawTriangle(&v[1], &v[2], &v[3]);
|
||||
width *= rdp.scale_x;
|
||||
v[0].x = v[2].x = V0->x - width;
|
||||
v[1].x = v[3].x = V0->x + width;
|
||||
}
|
||||
else
|
||||
{
|
||||
DepthBuffer(rdp.vtxbuf, n);
|
||||
if ((rdp.rm & 0xC10) == 0xC10)
|
||||
grDepthBiasLevel(-deltaZ);
|
||||
grDrawVertexArray(GR_TRIANGLE_FAN, n, rdp.vtx_buffer ? (&vtx_list2) : (&vtx_list1));
|
||||
float dx = V1->x - V0->x;
|
||||
float dy = V1->y - V0->y;
|
||||
float len = sqrtf(dx*dx + dy*dy);
|
||||
float wx = dy * width * rdp.scale_x / len;
|
||||
float wy = dx * width * rdp.scale_y / len;
|
||||
v[0].x = V0->x + wx;
|
||||
v[0].y = V0->y - wy;
|
||||
v[1].x = V0->x - wx;
|
||||
v[1].y = V0->y + wy;
|
||||
v[2].x = V1->x + wx;
|
||||
v[2].y = V1->y - wy;
|
||||
v[3].x = V1->x - wx;
|
||||
v[3].y = V1->y + wy;
|
||||
}
|
||||
grDrawTriangle(&v[0], &v[1], &v[2]);
|
||||
grDrawTriangle(&v[1], &v[2], &v[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
DepthBuffer(rdp.vtxbuf, n);
|
||||
if ((rdp.rm & 0xC10) == 0xC10)
|
||||
grDepthBiasLevel(-deltaZ);
|
||||
grDrawVertexArray(GR_TRIANGLE_FAN, n, rdp.vtx_buffer ? (&vtx_list2) : (&vtx_list1));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1792,10 +1789,8 @@ void update_scissor()
|
|||
//grClipWindow specifies the hardware clipping window. Any pixels outside the clipping window are rejected.
|
||||
//Values are inclusive for minimum x and y values and exclusive for maximum x and y values.
|
||||
// grClipWindow (rdp.scissor.ul_x?rdp.scissor.ul_x+1:0, rdp.scissor.ul_y?rdp.scissor.ul_y+1:0, rdp.scissor.lr_x, rdp.scissor.lr_y);
|
||||
if (fullscreen)
|
||||
grClipWindow(rdp.scissor.ul_x, rdp.scissor.ul_y, rdp.scissor.lr_x, rdp.scissor.lr_y);
|
||||
FRDP(" |- scissor - (%d, %d) -> (%d, %d)\n", rdp.scissor.ul_x, rdp.scissor.ul_y,
|
||||
rdp.scissor.lr_x, rdp.scissor.lr_y);
|
||||
grClipWindow(rdp.scissor.ul_x, rdp.scissor.ul_y, rdp.scissor.lr_x, rdp.scissor.lr_y);
|
||||
FRDP(" |- scissor - (%d, %d) -> (%d, %d)\n", rdp.scissor.ul_x, rdp.scissor.ul_y, rdp.scissor.lr_x, rdp.scissor.lr_y);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1910,220 +1905,216 @@ void update()
|
|||
rdp.update ^= UPDATE_TEXTURE;
|
||||
}
|
||||
|
||||
if (fullscreen)
|
||||
// Z buffer
|
||||
if (rdp.update & UPDATE_ZBUF_ENABLED)
|
||||
{
|
||||
// Z buffer
|
||||
if (rdp.update & UPDATE_ZBUF_ENABLED)
|
||||
// already logged above
|
||||
rdp.update ^= UPDATE_ZBUF_ENABLED;
|
||||
|
||||
if (((rdp.flags & ZBUF_ENABLED) || rdp.zsrc == 1) && rdp.cycle_mode < 2)
|
||||
{
|
||||
// already logged above
|
||||
rdp.update ^= UPDATE_ZBUF_ENABLED;
|
||||
|
||||
if (((rdp.flags & ZBUF_ENABLED) || rdp.zsrc == 1) && rdp.cycle_mode < 2)
|
||||
if (rdp.flags & ZBUF_COMPARE)
|
||||
{
|
||||
if (rdp.flags & ZBUF_COMPARE)
|
||||
{
|
||||
switch ((rdp.rm & 0xC00) >> 10) {
|
||||
case 0:
|
||||
grDepthBiasLevel(0);
|
||||
grDepthBufferFunction(settings.zmode_compare_less ? GR_CMP_LESS : GR_CMP_LEQUAL);
|
||||
break;
|
||||
case 1:
|
||||
grDepthBiasLevel(-4);
|
||||
grDepthBufferFunction(settings.zmode_compare_less ? GR_CMP_LESS : GR_CMP_LEQUAL);
|
||||
break;
|
||||
case 2:
|
||||
grDepthBiasLevel(settings.ucode == 7 ? -4 : 0);
|
||||
grDepthBufferFunction(GR_CMP_LESS);
|
||||
break;
|
||||
case 3:
|
||||
// will be set dynamically per polygon
|
||||
//grDepthBiasLevel(-deltaZ);
|
||||
grDepthBufferFunction(GR_CMP_LEQUAL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch ((rdp.rm & 0xC00) >> 10) {
|
||||
case 0:
|
||||
grDepthBiasLevel(0);
|
||||
grDepthBufferFunction(GR_CMP_ALWAYS);
|
||||
grDepthBufferFunction(settings.zmode_compare_less ? GR_CMP_LESS : GR_CMP_LEQUAL);
|
||||
break;
|
||||
case 1:
|
||||
grDepthBiasLevel(-4);
|
||||
grDepthBufferFunction(settings.zmode_compare_less ? GR_CMP_LESS : GR_CMP_LEQUAL);
|
||||
break;
|
||||
case 2:
|
||||
grDepthBiasLevel(settings.ucode == 7 ? -4 : 0);
|
||||
grDepthBufferFunction(GR_CMP_LESS);
|
||||
break;
|
||||
case 3:
|
||||
// will be set dynamically per polygon
|
||||
//grDepthBiasLevel(-deltaZ);
|
||||
grDepthBufferFunction(GR_CMP_LEQUAL);
|
||||
break;
|
||||
}
|
||||
|
||||
if (rdp.flags & ZBUF_UPDATE)
|
||||
grDepthMask(FXTRUE);
|
||||
else
|
||||
grDepthMask(FXFALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
grDepthBiasLevel(0);
|
||||
grDepthBufferFunction(GR_CMP_ALWAYS);
|
||||
}
|
||||
|
||||
if (rdp.flags & ZBUF_UPDATE)
|
||||
grDepthMask(FXTRUE);
|
||||
else
|
||||
grDepthMask(FXFALSE);
|
||||
}
|
||||
}
|
||||
|
||||
// Alpha compare
|
||||
if (rdp.update & UPDATE_ALPHA_COMPARE)
|
||||
else
|
||||
{
|
||||
// already logged above
|
||||
rdp.update ^= UPDATE_ALPHA_COMPARE;
|
||||
grDepthBiasLevel(0);
|
||||
grDepthBufferFunction(GR_CMP_ALWAYS);
|
||||
grDepthMask(FXFALSE);
|
||||
}
|
||||
}
|
||||
|
||||
// if (rdp.acmp == 1 && !(rdp.othermode_l & 0x00002000) && !force_full_alpha)
|
||||
// if (rdp.acmp == 1 && !(rdp.othermode_l & 0x00002000) && (rdp.blend_color&0xFF))
|
||||
if (rdp.acmp == 1 && !(rdp.othermode_l & 0x00002000) && (!(rdp.othermode_l & 0x00004000) || (rdp.blend_color & 0xFF)))
|
||||
// Alpha compare
|
||||
if (rdp.update & UPDATE_ALPHA_COMPARE)
|
||||
{
|
||||
// already logged above
|
||||
rdp.update ^= UPDATE_ALPHA_COMPARE;
|
||||
|
||||
// if (rdp.acmp == 1 && !(rdp.othermode_l & 0x00002000) && !force_full_alpha)
|
||||
// if (rdp.acmp == 1 && !(rdp.othermode_l & 0x00002000) && (rdp.blend_color&0xFF))
|
||||
if (rdp.acmp == 1 && !(rdp.othermode_l & 0x00002000) && (!(rdp.othermode_l & 0x00004000) || (rdp.blend_color & 0xFF)))
|
||||
{
|
||||
uint8_t reference = (uint8_t)(rdp.blend_color & 0xFF);
|
||||
grAlphaTestFunction(reference ? GR_CMP_GEQUAL : GR_CMP_GREATER);
|
||||
grAlphaTestReferenceValue(reference);
|
||||
FRDP(" |- alpha compare: blend: %02lx\n", reference);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rdp.flags & ALPHA_COMPARE)
|
||||
{
|
||||
uint8_t reference = (uint8_t)(rdp.blend_color & 0xFF);
|
||||
grAlphaTestFunction(reference ? GR_CMP_GEQUAL : GR_CMP_GREATER);
|
||||
grAlphaTestReferenceValue(reference);
|
||||
FRDP(" |- alpha compare: blend: %02lx\n", reference);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rdp.flags & ALPHA_COMPARE)
|
||||
if ((rdp.othermode_l & 0x5000) != 0x5000)
|
||||
{
|
||||
if ((rdp.othermode_l & 0x5000) != 0x5000)
|
||||
{
|
||||
grAlphaTestFunction(GR_CMP_GEQUAL);
|
||||
grAlphaTestReferenceValue(0x20);//0xA0);
|
||||
LRDP(" |- alpha compare: 0x20\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
grAlphaTestFunction(GR_CMP_GREATER);
|
||||
if (rdp.acmp == 3)
|
||||
{
|
||||
grAlphaTestReferenceValue((uint8_t)(rdp.blend_color & 0xFF));
|
||||
FRDP(" |- alpha compare: blend: %02lx\n", rdp.blend_color & 0xFF);
|
||||
}
|
||||
else
|
||||
{
|
||||
grAlphaTestReferenceValue(0x00);
|
||||
LRDP(" |- alpha compare: 0x00\n");
|
||||
}
|
||||
}
|
||||
grAlphaTestFunction(GR_CMP_GEQUAL);
|
||||
grAlphaTestReferenceValue(0x20);//0xA0);
|
||||
LRDP(" |- alpha compare: 0x20\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
grAlphaTestFunction(GR_CMP_ALWAYS);
|
||||
LRDP(" |- alpha compare: none\n");
|
||||
}
|
||||
}
|
||||
if (rdp.acmp == 3 && rdp.cycle_mode < 2)
|
||||
{
|
||||
if (grStippleModeExt != 0)
|
||||
{
|
||||
if (settings.old_style_adither || rdp.alpha_dither_mode != 3) {
|
||||
LRDP(" |- alpha compare: dither\n");
|
||||
grStippleModeExt(settings.stipple_mode);
|
||||
grAlphaTestFunction(GR_CMP_GREATER);
|
||||
if (rdp.acmp == 3)
|
||||
{
|
||||
grAlphaTestReferenceValue((uint8_t)(rdp.blend_color & 0xFF));
|
||||
FRDP(" |- alpha compare: blend: %02lx\n", rdp.blend_color & 0xFF);
|
||||
}
|
||||
else
|
||||
grStippleModeExt(GR_STIPPLE_DISABLE);
|
||||
{
|
||||
grAlphaTestReferenceValue(0x00);
|
||||
LRDP(" |- alpha compare: 0x00\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (grStippleModeExt)
|
||||
{
|
||||
//LRDP (" |- alpha compare: dither disabled\n");
|
||||
grAlphaTestFunction(GR_CMP_ALWAYS);
|
||||
LRDP(" |- alpha compare: none\n");
|
||||
}
|
||||
}
|
||||
if (rdp.acmp == 3 && rdp.cycle_mode < 2)
|
||||
{
|
||||
if (grStippleModeExt != 0)
|
||||
{
|
||||
if (settings.old_style_adither || rdp.alpha_dither_mode != 3) {
|
||||
LRDP(" |- alpha compare: dither\n");
|
||||
grStippleModeExt(settings.stipple_mode);
|
||||
}
|
||||
else
|
||||
grStippleModeExt(GR_STIPPLE_DISABLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Cull mode (leave this in for z-clipped triangles)
|
||||
if (rdp.update & UPDATE_CULL_MODE)
|
||||
else
|
||||
{
|
||||
rdp.update ^= UPDATE_CULL_MODE;
|
||||
uint32_t mode = (rdp.flags & CULLMASK) >> CULLSHIFT;
|
||||
FRDP(" |- cull_mode - mode: %s\n", str_cull[mode]);
|
||||
switch (mode)
|
||||
if (grStippleModeExt)
|
||||
{
|
||||
case 0: // cull none
|
||||
case 3: // cull both
|
||||
grCullMode(GR_CULL_DISABLE);
|
||||
break;
|
||||
case 1: // cull front
|
||||
// grCullMode(GR_CULL_POSITIVE);
|
||||
grCullMode(GR_CULL_NEGATIVE);
|
||||
break;
|
||||
case 2: // cull back
|
||||
// grCullMode (GR_CULL_NEGATIVE);
|
||||
grCullMode(GR_CULL_POSITIVE);
|
||||
break;
|
||||
//LRDP (" |- alpha compare: dither disabled\n");
|
||||
grStippleModeExt(GR_STIPPLE_DISABLE);
|
||||
}
|
||||
}
|
||||
|
||||
//Added by Gonetz.
|
||||
if (settings.fog && (rdp.update & UPDATE_FOG_ENABLED))
|
||||
}
|
||||
// Cull mode (leave this in for z-clipped triangles)
|
||||
if (rdp.update & UPDATE_CULL_MODE)
|
||||
{
|
||||
rdp.update ^= UPDATE_CULL_MODE;
|
||||
uint32_t mode = (rdp.flags & CULLMASK) >> CULLSHIFT;
|
||||
FRDP(" |- cull_mode - mode: %s\n", str_cull[mode]);
|
||||
switch (mode)
|
||||
{
|
||||
rdp.update ^= UPDATE_FOG_ENABLED;
|
||||
case 0: // cull none
|
||||
case 3: // cull both
|
||||
grCullMode(GR_CULL_DISABLE);
|
||||
break;
|
||||
case 1: // cull front
|
||||
// grCullMode(GR_CULL_POSITIVE);
|
||||
grCullMode(GR_CULL_NEGATIVE);
|
||||
break;
|
||||
case 2: // cull back
|
||||
// grCullMode (GR_CULL_NEGATIVE);
|
||||
grCullMode(GR_CULL_POSITIVE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t blender = (uint16_t)(rdp.othermode_l >> 16);
|
||||
if (rdp.flags & FOG_ENABLED)
|
||||
{
|
||||
rdp_blender_setting &bl = *(rdp_blender_setting*)(&(blender));
|
||||
if ((rdp.fog_multiplier > 0) && (bl.c1_m1a == 3 || bl.c1_m2a == 3 || bl.c2_m1a == 3 || bl.c2_m2a == 3))
|
||||
{
|
||||
grFogColorValue(rdp.fog_color);
|
||||
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
|
||||
rdp.fog_mode = RDP::fog_enabled;
|
||||
LRDP("fog enabled \n");
|
||||
}
|
||||
else
|
||||
{
|
||||
LRDP("fog disabled in blender\n");
|
||||
rdp.fog_mode = RDP::fog_disabled;
|
||||
grFogMode(GR_FOG_DISABLE);
|
||||
}
|
||||
}
|
||||
else if (blender == 0xc410 || blender == 0xc411 || blender == 0xf500)
|
||||
//Added by Gonetz.
|
||||
if (settings.fog && (rdp.update & UPDATE_FOG_ENABLED))
|
||||
{
|
||||
rdp.update ^= UPDATE_FOG_ENABLED;
|
||||
|
||||
uint16_t blender = (uint16_t)(rdp.othermode_l >> 16);
|
||||
if (rdp.flags & FOG_ENABLED)
|
||||
{
|
||||
rdp_blender_setting &bl = *(rdp_blender_setting*)(&(blender));
|
||||
if ((rdp.fog_multiplier > 0) && (bl.c1_m1a == 3 || bl.c1_m2a == 3 || bl.c2_m1a == 3 || bl.c2_m2a == 3))
|
||||
{
|
||||
grFogColorValue(rdp.fog_color);
|
||||
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
|
||||
rdp.fog_mode = RDP::fog_blend;
|
||||
LRDP("fog blend \n");
|
||||
}
|
||||
else if (blender == 0x04d1)
|
||||
{
|
||||
grFogColorValue(rdp.fog_color);
|
||||
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
|
||||
rdp.fog_mode = RDP::fog_blend_inverse;
|
||||
LRDP("fog blend \n");
|
||||
rdp.fog_mode = RDP::fog_enabled;
|
||||
LRDP("fog enabled \n");
|
||||
}
|
||||
else
|
||||
{
|
||||
LRDP("fog disabled\n");
|
||||
LRDP("fog disabled in blender\n");
|
||||
rdp.fog_mode = RDP::fog_disabled;
|
||||
grFogMode(GR_FOG_DISABLE);
|
||||
}
|
||||
}
|
||||
else if (blender == 0xc410 || blender == 0xc411 || blender == 0xf500)
|
||||
{
|
||||
grFogColorValue(rdp.fog_color);
|
||||
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
|
||||
rdp.fog_mode = RDP::fog_blend;
|
||||
LRDP("fog blend \n");
|
||||
}
|
||||
else if (blender == 0x04d1)
|
||||
{
|
||||
grFogColorValue(rdp.fog_color);
|
||||
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
|
||||
rdp.fog_mode = RDP::fog_blend_inverse;
|
||||
LRDP("fog blend \n");
|
||||
}
|
||||
else
|
||||
{
|
||||
LRDP("fog disabled\n");
|
||||
rdp.fog_mode = RDP::fog_disabled;
|
||||
grFogMode(GR_FOG_DISABLE);
|
||||
}
|
||||
}
|
||||
|
||||
if (rdp.update & UPDATE_VIEWPORT)
|
||||
{
|
||||
rdp.update ^= UPDATE_VIEWPORT;
|
||||
if (fullscreen)
|
||||
float scale_x = (float)fabs(rdp.view_scale[0]);
|
||||
float scale_y = (float)fabs(rdp.view_scale[1]);
|
||||
|
||||
rdp.clip_min_x = max((rdp.view_trans[0] - scale_x + rdp.offset_x) / rdp.clip_ratio, 0.0f);
|
||||
rdp.clip_min_y = max((rdp.view_trans[1] - scale_y + rdp.offset_y) / rdp.clip_ratio, 0.0f);
|
||||
rdp.clip_max_x = min((rdp.view_trans[0] + scale_x + rdp.offset_x) * rdp.clip_ratio, settings.res_x);
|
||||
rdp.clip_max_y = min((rdp.view_trans[1] + scale_y + rdp.offset_y) * rdp.clip_ratio, settings.res_y);
|
||||
|
||||
FRDP(" |- viewport - (%d, %d, %d, %d)\n", (uint32_t)rdp.clip_min_x, (uint32_t)rdp.clip_min_y, (uint32_t)rdp.clip_max_x, (uint32_t)rdp.clip_max_y);
|
||||
if (!rdp.scissor_set)
|
||||
{
|
||||
float scale_x = (float)fabs(rdp.view_scale[0]);
|
||||
float scale_y = (float)fabs(rdp.view_scale[1]);
|
||||
|
||||
rdp.clip_min_x = max((rdp.view_trans[0] - scale_x + rdp.offset_x) / rdp.clip_ratio, 0.0f);
|
||||
rdp.clip_min_y = max((rdp.view_trans[1] - scale_y + rdp.offset_y) / rdp.clip_ratio, 0.0f);
|
||||
rdp.clip_max_x = min((rdp.view_trans[0] + scale_x + rdp.offset_x) * rdp.clip_ratio, settings.res_x);
|
||||
rdp.clip_max_y = min((rdp.view_trans[1] + scale_y + rdp.offset_y) * rdp.clip_ratio, settings.res_y);
|
||||
|
||||
FRDP(" |- viewport - (%d, %d, %d, %d)\n", (uint32_t)rdp.clip_min_x, (uint32_t)rdp.clip_min_y, (uint32_t)rdp.clip_max_x, (uint32_t)rdp.clip_max_y);
|
||||
if (!rdp.scissor_set)
|
||||
{
|
||||
rdp.scissor.ul_x = (uint32_t)rdp.clip_min_x;
|
||||
rdp.scissor.lr_x = (uint32_t)rdp.clip_max_x;
|
||||
rdp.scissor.ul_y = (uint32_t)rdp.clip_min_y;
|
||||
rdp.scissor.lr_y = (uint32_t)rdp.clip_max_y;
|
||||
grClipWindow(rdp.scissor.ul_x, rdp.scissor.ul_y, rdp.scissor.lr_x, rdp.scissor.lr_y);
|
||||
}
|
||||
rdp.scissor.ul_x = (uint32_t)rdp.clip_min_x;
|
||||
rdp.scissor.lr_x = (uint32_t)rdp.clip_max_x;
|
||||
rdp.scissor.ul_y = (uint32_t)rdp.clip_min_y;
|
||||
rdp.scissor.lr_y = (uint32_t)rdp.clip_max_y;
|
||||
grClipWindow(rdp.scissor.ul_x, rdp.scissor.ul_y, rdp.scissor.lr_x, rdp.scissor.lr_y);
|
||||
}
|
||||
}
|
||||
|
||||
if (rdp.update & UPDATE_SCISSOR)
|
||||
{
|
||||
update_scissor();
|
||||
}
|
||||
|
||||
LRDP(" + update end\n");
|
||||
}
|
||||
|
|
|
@ -459,8 +459,6 @@ static void copyWhiteToRDRAM()
|
|||
|
||||
static void CopyFrameBuffer(GrBuffer_t buffer = GR_BUFFER_BACKBUFFER)
|
||||
{
|
||||
if (!fullscreen)
|
||||
return;
|
||||
FRDP("CopyFrameBuffer: %08lx... ", rdp.cimg);
|
||||
|
||||
// don't bother to write the stuff in asm... the slow part is the read from video card,
|
||||
|
@ -653,8 +651,6 @@ EXPORT void CALL ProcessDList(void)
|
|||
SoftLocker lock(mutexProcessDList);
|
||||
if (!lock.IsOk()) //mutex is busy
|
||||
{
|
||||
if (!fullscreen)
|
||||
drawNoFullscreenMessage();
|
||||
// Set an interrupt to allow the game to continue
|
||||
*gfx.MI_INTR_REG |= 0x20;
|
||||
gfx.CheckInterrupts();
|
||||
|
@ -675,14 +671,6 @@ EXPORT void CALL ProcessDList(void)
|
|||
|
||||
LOG("ProcessDList ()\n");
|
||||
|
||||
if (!fullscreen)
|
||||
{
|
||||
drawNoFullscreenMessage();
|
||||
// Set an interrupt to allow the game to continue
|
||||
*gfx.MI_INTR_REG |= 0x20;
|
||||
gfx.CheckInterrupts();
|
||||
}
|
||||
|
||||
if (reset)
|
||||
{
|
||||
reset = 0;
|
||||
|
@ -710,9 +698,6 @@ EXPORT void CALL ProcessDList(void)
|
|||
if (to_fullscreen)
|
||||
GoToFullScreen();
|
||||
|
||||
if (!fullscreen && !settings.run_in_window)
|
||||
return;
|
||||
|
||||
// Clear out the RDP log
|
||||
#ifdef RDP_LOGGING
|
||||
if (settings.logging && settings.log_clear)
|
||||
|
@ -860,7 +845,8 @@ EXPORT void CALL ProcessDList(void)
|
|||
} while (!rdp.halt);
|
||||
}
|
||||
#ifdef CATCH_EXCEPTIONS
|
||||
} catch (...) {
|
||||
}
|
||||
catch (...) {
|
||||
if (fullscreen)
|
||||
{
|
||||
ReleaseGfx ();
|
||||
|
@ -878,7 +864,7 @@ EXPORT void CALL ProcessDList(void)
|
|||
else
|
||||
to_fullscreen = TRUE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (fb_emulation_enabled)
|
||||
|
@ -901,7 +887,7 @@ EXPORT void CALL ProcessDList(void)
|
|||
CI_SET = FALSE;
|
||||
}
|
||||
LRDP("ProcessDList end\n");
|
||||
}
|
||||
}
|
||||
|
||||
// undef - undefined instruction, always ignore
|
||||
static void undef()
|
||||
|
@ -1510,60 +1496,53 @@ static void rdp_texrect()
|
|||
apply_shade_mods(&vptr[i]);
|
||||
}
|
||||
|
||||
if (fullscreen)
|
||||
if (rdp.fog_mode >= RDP::fog_blend)
|
||||
{
|
||||
if (rdp.fog_mode >= RDP::fog_blend)
|
||||
{
|
||||
float fog;
|
||||
if (rdp.fog_mode == RDP::fog_blend)
|
||||
fog = 1.0f / max(1, rdp.fog_color & 0xFF);
|
||||
else
|
||||
fog = 1.0f / max(1, (~rdp.fog_color) & 0xFF);
|
||||
for (i = 0; i < n_vertices; i++)
|
||||
{
|
||||
vptr[i].f = fog;
|
||||
}
|
||||
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
|
||||
}
|
||||
|
||||
ConvertCoordsConvert(vptr, n_vertices);
|
||||
|
||||
if (settings.wireframe)
|
||||
{
|
||||
SetWireframeCol();
|
||||
grDrawLine(&vstd[0], &vstd[2]);
|
||||
grDrawLine(&vstd[2], &vstd[1]);
|
||||
grDrawLine(&vstd[1], &vstd[0]);
|
||||
grDrawLine(&vstd[2], &vstd[3]);
|
||||
grDrawLine(&vstd[3], &vstd[1]);
|
||||
}
|
||||
float fog;
|
||||
if (rdp.fog_mode == RDP::fog_blend)
|
||||
fog = 1.0f / max(1, rdp.fog_color & 0xFF);
|
||||
else
|
||||
fog = 1.0f / max(1, (~rdp.fog_color) & 0xFF);
|
||||
for (i = 0; i < n_vertices; i++)
|
||||
{
|
||||
grDrawVertexArrayContiguous(GR_TRIANGLE_STRIP, n_vertices, vptr, sizeof(VERTEX));
|
||||
vptr[i].f = fog;
|
||||
}
|
||||
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
|
||||
}
|
||||
|
||||
if (_debugger.capture)
|
||||
{
|
||||
VERTEX vl[3];
|
||||
vl[0] = vstd[0];
|
||||
vl[1] = vstd[2];
|
||||
vl[2] = vstd[1];
|
||||
add_tri(vl, 3, TRI_TEXRECT);
|
||||
rdp.tri_n++;
|
||||
vl[0] = vstd[2];
|
||||
vl[1] = vstd[3];
|
||||
vl[2] = vstd[1];
|
||||
add_tri(vl, 3, TRI_TEXRECT);
|
||||
rdp.tri_n++;
|
||||
}
|
||||
else
|
||||
rdp.tri_n += 2;
|
||||
ConvertCoordsConvert(vptr, n_vertices);
|
||||
|
||||
if (settings.wireframe)
|
||||
{
|
||||
SetWireframeCol();
|
||||
grDrawLine(&vstd[0], &vstd[2]);
|
||||
grDrawLine(&vstd[2], &vstd[1]);
|
||||
grDrawLine(&vstd[1], &vstd[0]);
|
||||
grDrawLine(&vstd[2], &vstd[3]);
|
||||
grDrawLine(&vstd[3], &vstd[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
rdp.tri_n += 2;
|
||||
grDrawVertexArrayContiguous(GR_TRIANGLE_STRIP, n_vertices, vptr, sizeof(VERTEX));
|
||||
}
|
||||
|
||||
if (_debugger.capture)
|
||||
{
|
||||
VERTEX vl[3];
|
||||
vl[0] = vstd[0];
|
||||
vl[1] = vstd[2];
|
||||
vl[2] = vstd[1];
|
||||
add_tri(vl, 3, TRI_TEXRECT);
|
||||
rdp.tri_n++;
|
||||
vl[0] = vstd[2];
|
||||
vl[1] = vstd[3];
|
||||
vl[2] = vstd[1];
|
||||
add_tri(vl, 3, TRI_TEXRECT);
|
||||
rdp.tri_n++;
|
||||
}
|
||||
else
|
||||
rdp.tri_n += 2;
|
||||
|
||||
delete[] vnew;
|
||||
}
|
||||
|
||||
|
@ -2365,37 +2344,34 @@ static void rdp_fillrect()
|
|||
if ((rdp.cimg == rdp.zimg) || (fb_emulation_enabled && rdp.ci_count > 0 && rdp.frame_buffers[rdp.ci_count - 1].status == ci_zimg) || pd_multiplayer)
|
||||
{
|
||||
LRDP("Fillrect - cleared the depth buffer\n");
|
||||
if (fullscreen)
|
||||
if (!(settings.hacks&hack_Hyperbike) || rdp.ci_width > 64) //do not clear main depth buffer for aux depth buffers
|
||||
{
|
||||
if (!(settings.hacks&hack_Hyperbike) || rdp.ci_width > 64) //do not clear main depth buffer for aux depth buffers
|
||||
update_scissor();
|
||||
grDepthMask(FXTRUE);
|
||||
grColorMask(FXFALSE, FXFALSE);
|
||||
grBufferClear(0, 0, rdp.fill_color ? rdp.fill_color & 0xFFFF : 0xFFFF);
|
||||
grColorMask(FXTRUE, FXTRUE);
|
||||
rdp.update |= UPDATE_ZBUF_ENABLED;
|
||||
}
|
||||
//if (settings.frame_buffer&fb_depth_clear)
|
||||
{
|
||||
ul_x = min(max(ul_x, rdp.scissor_o.ul_x), rdp.scissor_o.lr_x);
|
||||
lr_x = min(max(lr_x, rdp.scissor_o.ul_x), rdp.scissor_o.lr_x);
|
||||
ul_y = min(max(ul_y, rdp.scissor_o.ul_y), rdp.scissor_o.lr_y);
|
||||
lr_y = min(max(lr_y, rdp.scissor_o.ul_y), rdp.scissor_o.lr_y);
|
||||
uint32_t zi_width_in_dwords = rdp.ci_width >> 1;
|
||||
ul_x >>= 1;
|
||||
lr_x >>= 1;
|
||||
uint32_t * dst = (uint32_t*)(gfx.RDRAM + rdp.cimg);
|
||||
dst += ul_y * zi_width_in_dwords;
|
||||
for (uint32_t y = ul_y; y < lr_y; y++)
|
||||
{
|
||||
update_scissor();
|
||||
grDepthMask(FXTRUE);
|
||||
grColorMask(FXFALSE, FXFALSE);
|
||||
grBufferClear(0, 0, rdp.fill_color ? rdp.fill_color & 0xFFFF : 0xFFFF);
|
||||
grColorMask(FXTRUE, FXTRUE);
|
||||
rdp.update |= UPDATE_ZBUF_ENABLED;
|
||||
for (uint32_t x = ul_x; x < lr_x; x++)
|
||||
{
|
||||
dst[x] = rdp.fill_color;
|
||||
}
|
||||
dst += zi_width_in_dwords;
|
||||
}
|
||||
//if (settings.frame_buffer&fb_depth_clear)
|
||||
{
|
||||
ul_x = min(max(ul_x, rdp.scissor_o.ul_x), rdp.scissor_o.lr_x);
|
||||
lr_x = min(max(lr_x, rdp.scissor_o.ul_x), rdp.scissor_o.lr_x);
|
||||
ul_y = min(max(ul_y, rdp.scissor_o.ul_y), rdp.scissor_o.lr_y);
|
||||
lr_y = min(max(lr_y, rdp.scissor_o.ul_y), rdp.scissor_o.lr_y);
|
||||
uint32_t zi_width_in_dwords = rdp.ci_width >> 1;
|
||||
ul_x >>= 1;
|
||||
lr_x >>= 1;
|
||||
uint32_t * dst = (uint32_t*)(gfx.RDRAM + rdp.cimg);
|
||||
dst += ul_y * zi_width_in_dwords;
|
||||
for (uint32_t y = ul_y; y < lr_y; y++)
|
||||
{
|
||||
for (uint32_t x = ul_x; x < lr_x; x++)
|
||||
{
|
||||
dst[x] = rdp.fill_color;
|
||||
}
|
||||
dst += zi_width_in_dwords;
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -2425,8 +2401,7 @@ static void rdp_fillrect()
|
|||
}
|
||||
|
||||
// Update scissor
|
||||
if (fullscreen)
|
||||
update_scissor();
|
||||
update_scissor();
|
||||
|
||||
if (settings.decrease_fillrect_edge && rdp.cycle_mode == 0)
|
||||
{
|
||||
|
@ -2451,117 +2426,116 @@ static void rdp_fillrect()
|
|||
|
||||
FRDP(" - %d, %d, %d, %d\n", s_ul_x, s_ul_y, s_lr_x, s_lr_y);
|
||||
|
||||
if (fullscreen)
|
||||
grFogMode(GR_FOG_DISABLE);
|
||||
|
||||
const float Z = (rdp.cycle_mode == 3) ? 0.0f : set_sprite_combine_mode();
|
||||
|
||||
// Draw the rectangle
|
||||
VERTEX v[4] = {
|
||||
{ (float)s_ul_x, (float)s_ul_y, Z, 1.0f, 0, 0, 0, 0, { 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0 },
|
||||
{ (float)s_lr_x, (float)s_ul_y, Z, 1.0f, 0, 0, 0, 0, { 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0 },
|
||||
{ (float)s_ul_x, (float)s_lr_y, Z, 1.0f, 0, 0, 0, 0, { 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0 },
|
||||
{ (float)s_lr_x, (float)s_lr_y, Z, 1.0f, 0, 0, 0, 0, { 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0 } };
|
||||
|
||||
if (rdp.cycle_mode == 3)
|
||||
{
|
||||
grFogMode(GR_FOG_DISABLE);
|
||||
uint32_t color = rdp.fill_color;
|
||||
|
||||
const float Z = (rdp.cycle_mode == 3) ? 0.0f : set_sprite_combine_mode();
|
||||
|
||||
// Draw the rectangle
|
||||
VERTEX v[4] = {
|
||||
{ (float)s_ul_x, (float)s_ul_y, Z, 1.0f, 0, 0, 0, 0, { 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0 },
|
||||
{ (float)s_lr_x, (float)s_ul_y, Z, 1.0f, 0, 0, 0, 0, { 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0 },
|
||||
{ (float)s_ul_x, (float)s_lr_y, Z, 1.0f, 0, 0, 0, 0, { 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0 },
|
||||
{ (float)s_lr_x, (float)s_lr_y, Z, 1.0f, 0, 0, 0, 0, { 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0 } };
|
||||
|
||||
if (rdp.cycle_mode == 3)
|
||||
if ((settings.hacks&hack_PMario) && rdp.ci_count > 0 && rdp.frame_buffers[rdp.ci_count - 1].status == ci_aux)
|
||||
{
|
||||
uint32_t color = rdp.fill_color;
|
||||
//background of auxiliary frame buffers must have zero alpha.
|
||||
//make it black, set 0 alpha to plack pixels on frame buffer read
|
||||
color = 0;
|
||||
}
|
||||
else if (rdp.ci_size < 3)
|
||||
{
|
||||
color = ((color & 1) ? 0xFF : 0) |
|
||||
((uint32_t)((float)((color & 0xF800) >> 11) / 31.0f * 255.0f) << 24) |
|
||||
((uint32_t)((float)((color & 0x07C0) >> 6) / 31.0f * 255.0f) << 16) |
|
||||
((uint32_t)((float)((color & 0x003E) >> 1) / 31.0f * 255.0f) << 8);
|
||||
}
|
||||
|
||||
if ((settings.hacks&hack_PMario) && rdp.ci_count > 0 && rdp.frame_buffers[rdp.ci_count - 1].status == ci_aux)
|
||||
grConstantColorValue(color);
|
||||
|
||||
grColorCombine(GR_COMBINE_FUNCTION_LOCAL,
|
||||
GR_COMBINE_FACTOR_NONE,
|
||||
GR_COMBINE_LOCAL_CONSTANT,
|
||||
GR_COMBINE_OTHER_NONE,
|
||||
FXFALSE);
|
||||
|
||||
grAlphaCombine(GR_COMBINE_FUNCTION_LOCAL,
|
||||
GR_COMBINE_FACTOR_NONE,
|
||||
GR_COMBINE_LOCAL_CONSTANT,
|
||||
GR_COMBINE_OTHER_NONE,
|
||||
FXFALSE);
|
||||
|
||||
grAlphaBlendFunction(GR_BLEND_ONE, GR_BLEND_ZERO, GR_BLEND_ONE, GR_BLEND_ZERO);
|
||||
|
||||
grAlphaTestFunction(GR_CMP_ALWAYS);
|
||||
if (grStippleModeExt)
|
||||
{
|
||||
grStippleModeExt(GR_STIPPLE_DISABLE);
|
||||
}
|
||||
|
||||
grCullMode(GR_CULL_DISABLE);
|
||||
grFogMode(GR_FOG_DISABLE);
|
||||
grDepthBufferFunction(GR_CMP_ALWAYS);
|
||||
grDepthMask(FXFALSE);
|
||||
|
||||
rdp.update |= UPDATE_COMBINE | UPDATE_CULL_MODE | UPDATE_FOG_ENABLED | UPDATE_ZBUF_ENABLED;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32_t cmb_mode_c = (rdp.cycle1 << 16) | (rdp.cycle2 & 0xFFFF);
|
||||
uint32_t cmb_mode_a = (rdp.cycle1 & 0x0FFF0000) | ((rdp.cycle2 >> 16) & 0x00000FFF);
|
||||
if (cmb_mode_c == 0x9fff9fff || cmb_mode_a == 0x09ff09ff) //shade
|
||||
{
|
||||
AllowShadeMods(v, 4);
|
||||
for (int k = 0; k < 4; k++)
|
||||
{
|
||||
//background of auxiliary frame buffers must have zero alpha.
|
||||
//make it black, set 0 alpha to plack pixels on frame buffer read
|
||||
color = 0;
|
||||
apply_shade_mods(&v[k]);
|
||||
}
|
||||
else if (rdp.ci_size < 3)
|
||||
{
|
||||
color = ((color & 1) ? 0xFF : 0) |
|
||||
((uint32_t)((float)((color & 0xF800) >> 11) / 31.0f * 255.0f) << 24) |
|
||||
((uint32_t)((float)((color & 0x07C0) >> 6) / 31.0f * 255.0f) << 16) |
|
||||
((uint32_t)((float)((color & 0x003E) >> 1) / 31.0f * 255.0f) << 8);
|
||||
}
|
||||
|
||||
grConstantColorValue(color);
|
||||
|
||||
grColorCombine(GR_COMBINE_FUNCTION_LOCAL,
|
||||
GR_COMBINE_FACTOR_NONE,
|
||||
GR_COMBINE_LOCAL_CONSTANT,
|
||||
GR_COMBINE_OTHER_NONE,
|
||||
FXFALSE);
|
||||
|
||||
}
|
||||
if ((rdp.othermode_l & 0x4000) && ((rdp.othermode_l >> 16) == 0x0550)) //special blender mode for Bomberman64
|
||||
{
|
||||
grAlphaCombine(GR_COMBINE_FUNCTION_LOCAL,
|
||||
GR_COMBINE_FACTOR_NONE,
|
||||
GR_COMBINE_LOCAL_CONSTANT,
|
||||
GR_COMBINE_OTHER_NONE,
|
||||
FXFALSE);
|
||||
|
||||
grAlphaBlendFunction(GR_BLEND_ONE, GR_BLEND_ZERO, GR_BLEND_ONE, GR_BLEND_ZERO);
|
||||
|
||||
grAlphaTestFunction(GR_CMP_ALWAYS);
|
||||
if (grStippleModeExt)
|
||||
grStippleModeExt(GR_STIPPLE_DISABLE);
|
||||
|
||||
grCullMode(GR_CULL_DISABLE);
|
||||
grFogMode(GR_FOG_DISABLE);
|
||||
grDepthBufferFunction(GR_CMP_ALWAYS);
|
||||
grDepthMask(FXFALSE);
|
||||
|
||||
rdp.update |= UPDATE_COMBINE | UPDATE_CULL_MODE | UPDATE_FOG_ENABLED | UPDATE_ZBUF_ENABLED;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32_t cmb_mode_c = (rdp.cycle1 << 16) | (rdp.cycle2 & 0xFFFF);
|
||||
uint32_t cmb_mode_a = (rdp.cycle1 & 0x0FFF0000) | ((rdp.cycle2 >> 16) & 0x00000FFF);
|
||||
if (cmb_mode_c == 0x9fff9fff || cmb_mode_a == 0x09ff09ff) //shade
|
||||
{
|
||||
AllowShadeMods(v, 4);
|
||||
for (int k = 0; k < 4; k++)
|
||||
apply_shade_mods(&v[k]);
|
||||
}
|
||||
if ((rdp.othermode_l & 0x4000) && ((rdp.othermode_l >> 16) == 0x0550)) //special blender mode for Bomberman64
|
||||
{
|
||||
grAlphaCombine(GR_COMBINE_FUNCTION_LOCAL,
|
||||
GR_COMBINE_FACTOR_NONE,
|
||||
GR_COMBINE_LOCAL_CONSTANT,
|
||||
GR_COMBINE_OTHER_NONE,
|
||||
FXFALSE);
|
||||
grConstantColorValue((cmb.ccolor & 0xFFFFFF00) | (rdp.fog_color & 0xFF));
|
||||
rdp.update |= UPDATE_COMBINE;
|
||||
}
|
||||
grConstantColorValue((cmb.ccolor & 0xFFFFFF00) | (rdp.fog_color & 0xFF));
|
||||
rdp.update |= UPDATE_COMBINE;
|
||||
}
|
||||
}
|
||||
|
||||
if (settings.wireframe)
|
||||
{
|
||||
SetWireframeCol();
|
||||
grDrawLine(&v[0], &v[2]);
|
||||
grDrawLine(&v[2], &v[1]);
|
||||
grDrawLine(&v[1], &v[0]);
|
||||
grDrawLine(&v[2], &v[3]);
|
||||
grDrawLine(&v[3], &v[1]);
|
||||
//grDrawLine (&v[1], &v[2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
grDrawTriangle(&v[0], &v[2], &v[1]);
|
||||
grDrawTriangle(&v[2], &v[3], &v[1]);
|
||||
}
|
||||
if (settings.wireframe)
|
||||
{
|
||||
SetWireframeCol();
|
||||
grDrawLine(&v[0], &v[2]);
|
||||
grDrawLine(&v[2], &v[1]);
|
||||
grDrawLine(&v[1], &v[0]);
|
||||
grDrawLine(&v[2], &v[3]);
|
||||
grDrawLine(&v[3], &v[1]);
|
||||
//grDrawLine (&v[1], &v[2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
grDrawTriangle(&v[0], &v[2], &v[1]);
|
||||
grDrawTriangle(&v[2], &v[3], &v[1]);
|
||||
}
|
||||
|
||||
if (_debugger.capture)
|
||||
{
|
||||
VERTEX v1[3];
|
||||
v1[0] = v[0];
|
||||
v1[1] = v[2];
|
||||
v1[2] = v[1];
|
||||
add_tri(v1, 3, TRI_FILLRECT);
|
||||
rdp.tri_n++;
|
||||
v1[0] = v[2];
|
||||
v1[1] = v[3];
|
||||
add_tri(v1, 3, TRI_FILLRECT);
|
||||
rdp.tri_n++;
|
||||
}
|
||||
else
|
||||
rdp.tri_n += 2;
|
||||
if (_debugger.capture)
|
||||
{
|
||||
VERTEX v1[3];
|
||||
v1[0] = v[0];
|
||||
v1[1] = v[2];
|
||||
v1[2] = v[1];
|
||||
add_tri(v1, 3, TRI_FILLRECT);
|
||||
rdp.tri_n++;
|
||||
v1[0] = v[2];
|
||||
v1[1] = v[3];
|
||||
add_tri(v1, 3, TRI_FILLRECT);
|
||||
rdp.tri_n++;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2721,12 +2695,9 @@ static void RestoreScale()
|
|||
rdp.view_trans[1] *= rdp.scale_y;
|
||||
rdp.update |= UPDATE_VIEWPORT | UPDATE_SCISSOR;
|
||||
//*
|
||||
if (fullscreen)
|
||||
{
|
||||
grDepthMask(FXFALSE);
|
||||
grBufferClear(0, 0, 0xFFFF);
|
||||
grDepthMask(FXTRUE);
|
||||
}
|
||||
grDepthMask(FXFALSE);
|
||||
grBufferClear(0, 0, 0xFFFF);
|
||||
grDepthMask(FXTRUE);
|
||||
//*/
|
||||
}
|
||||
|
||||
|
@ -3129,8 +3100,6 @@ static void rsp_reserved3()
|
|||
|
||||
void SetWireframeCol()
|
||||
{
|
||||
if (!fullscreen) return;
|
||||
|
||||
switch (settings.wfmode)
|
||||
{
|
||||
//case 0: // normal colors, don't do anything
|
||||
|
@ -3902,88 +3871,85 @@ void lle_triangle(uint32_t w1, uint32_t w2, int shade, int texture, int zbuffer,
|
|||
}
|
||||
}
|
||||
|
||||
if (fullscreen)
|
||||
update();
|
||||
for (int k = 0; k < nbVtxs - 1; k++)
|
||||
{
|
||||
update();
|
||||
for (int k = 0; k < nbVtxs - 1; k++)
|
||||
VERTEX * v = &vtxbuf[k];
|
||||
v->x = v->x * rdp.scale_x + rdp.offset_x;
|
||||
v->y = v->y * rdp.scale_y + rdp.offset_y;
|
||||
// v->z = 1.0f;///v->w;
|
||||
v->q = 1.0f / v->w;
|
||||
v->u1 = v->u0 = v->ou;
|
||||
v->v1 = v->v0 = v->ov;
|
||||
if (rdp.tex >= 1 && rdp.cur_cache[0])
|
||||
{
|
||||
VERTEX * v = &vtxbuf[k];
|
||||
v->x = v->x * rdp.scale_x + rdp.offset_x;
|
||||
v->y = v->y * rdp.scale_y + rdp.offset_y;
|
||||
// v->z = 1.0f;///v->w;
|
||||
v->q = 1.0f / v->w;
|
||||
v->u1 = v->u0 = v->ou;
|
||||
v->v1 = v->v0 = v->ov;
|
||||
if (rdp.tex >= 1 && rdp.cur_cache[0])
|
||||
if (rdp.tiles[rdp.cur_tile].shift_s)
|
||||
{
|
||||
if (rdp.tiles[rdp.cur_tile].shift_s)
|
||||
{
|
||||
if (rdp.tiles[rdp.cur_tile].shift_s > 10)
|
||||
v->u0 *= (float)(1 << (16 - rdp.tiles[rdp.cur_tile].shift_s));
|
||||
else
|
||||
v->u0 /= (float)(1 << rdp.tiles[rdp.cur_tile].shift_s);
|
||||
}
|
||||
if (rdp.tiles[rdp.cur_tile].shift_t)
|
||||
{
|
||||
if (rdp.tiles[rdp.cur_tile].shift_t > 10)
|
||||
v->v0 *= (float)(1 << (16 - rdp.tiles[rdp.cur_tile].shift_t));
|
||||
else
|
||||
v->v0 /= (float)(1 << rdp.tiles[rdp.cur_tile].shift_t);
|
||||
}
|
||||
|
||||
v->u0 -= rdp.tiles[rdp.cur_tile].f_ul_s;
|
||||
v->v0 -= rdp.tiles[rdp.cur_tile].f_ul_t;
|
||||
v->u0 = rdp.cur_cache[0]->c_off + rdp.cur_cache[0]->c_scl_x * v->u0;
|
||||
v->v0 = rdp.cur_cache[0]->c_off + rdp.cur_cache[0]->c_scl_y * v->v0;
|
||||
v->u0 /= v->w;
|
||||
v->v0 /= v->w;
|
||||
if (rdp.tiles[rdp.cur_tile].shift_s > 10)
|
||||
v->u0 *= (float)(1 << (16 - rdp.tiles[rdp.cur_tile].shift_s));
|
||||
else
|
||||
v->u0 /= (float)(1 << rdp.tiles[rdp.cur_tile].shift_s);
|
||||
}
|
||||
if (rdp.tiles[rdp.cur_tile].shift_t)
|
||||
{
|
||||
if (rdp.tiles[rdp.cur_tile].shift_t > 10)
|
||||
v->v0 *= (float)(1 << (16 - rdp.tiles[rdp.cur_tile].shift_t));
|
||||
else
|
||||
v->v0 /= (float)(1 << rdp.tiles[rdp.cur_tile].shift_t);
|
||||
}
|
||||
|
||||
if (rdp.tex >= 2 && rdp.cur_cache[1])
|
||||
{
|
||||
if (rdp.tiles[rdp.cur_tile + 1].shift_s)
|
||||
{
|
||||
if (rdp.tiles[rdp.cur_tile + 1].shift_s > 10)
|
||||
v->u1 *= (float)(1 << (16 - rdp.tiles[rdp.cur_tile + 1].shift_s));
|
||||
else
|
||||
v->u1 /= (float)(1 << rdp.tiles[rdp.cur_tile + 1].shift_s);
|
||||
}
|
||||
if (rdp.tiles[rdp.cur_tile + 1].shift_t)
|
||||
{
|
||||
if (rdp.tiles[rdp.cur_tile + 1].shift_t > 10)
|
||||
v->v1 *= (float)(1 << (16 - rdp.tiles[rdp.cur_tile + 1].shift_t));
|
||||
else
|
||||
v->v1 /= (float)(1 << rdp.tiles[rdp.cur_tile + 1].shift_t);
|
||||
}
|
||||
|
||||
v->u1 -= rdp.tiles[rdp.cur_tile + 1].f_ul_s;
|
||||
v->v1 -= rdp.tiles[rdp.cur_tile + 1].f_ul_t;
|
||||
v->u1 = rdp.cur_cache[1]->c_off + rdp.cur_cache[1]->c_scl_x * v->u1;
|
||||
v->v1 = rdp.cur_cache[1]->c_off + rdp.cur_cache[1]->c_scl_y * v->v1;
|
||||
v->u1 /= v->w;
|
||||
v->v1 /= v->w;
|
||||
}
|
||||
apply_shade_mods(v);
|
||||
v->u0 -= rdp.tiles[rdp.cur_tile].f_ul_s;
|
||||
v->v0 -= rdp.tiles[rdp.cur_tile].f_ul_t;
|
||||
v->u0 = rdp.cur_cache[0]->c_off + rdp.cur_cache[0]->c_scl_x * v->u0;
|
||||
v->v0 = rdp.cur_cache[0]->c_off + rdp.cur_cache[0]->c_scl_y * v->v0;
|
||||
v->u0 /= v->w;
|
||||
v->v0 /= v->w;
|
||||
}
|
||||
ConvertCoordsConvert(vtxbuf, nbVtxs);
|
||||
grCullMode(GR_CULL_DISABLE);
|
||||
grDrawVertexArrayContiguous(GR_TRIANGLE_STRIP, nbVtxs - 1, vtxbuf, sizeof(VERTEX));
|
||||
if (_debugger.capture)
|
||||
|
||||
if (rdp.tex >= 2 && rdp.cur_cache[1])
|
||||
{
|
||||
VERTEX vl[3];
|
||||
vl[0] = vtxbuf[0];
|
||||
vl[1] = vtxbuf[2];
|
||||
if (rdp.tiles[rdp.cur_tile + 1].shift_s)
|
||||
{
|
||||
if (rdp.tiles[rdp.cur_tile + 1].shift_s > 10)
|
||||
v->u1 *= (float)(1 << (16 - rdp.tiles[rdp.cur_tile + 1].shift_s));
|
||||
else
|
||||
v->u1 /= (float)(1 << rdp.tiles[rdp.cur_tile + 1].shift_s);
|
||||
}
|
||||
if (rdp.tiles[rdp.cur_tile + 1].shift_t)
|
||||
{
|
||||
if (rdp.tiles[rdp.cur_tile + 1].shift_t > 10)
|
||||
v->v1 *= (float)(1 << (16 - rdp.tiles[rdp.cur_tile + 1].shift_t));
|
||||
else
|
||||
v->v1 /= (float)(1 << rdp.tiles[rdp.cur_tile + 1].shift_t);
|
||||
}
|
||||
|
||||
v->u1 -= rdp.tiles[rdp.cur_tile + 1].f_ul_s;
|
||||
v->v1 -= rdp.tiles[rdp.cur_tile + 1].f_ul_t;
|
||||
v->u1 = rdp.cur_cache[1]->c_off + rdp.cur_cache[1]->c_scl_x * v->u1;
|
||||
v->v1 = rdp.cur_cache[1]->c_off + rdp.cur_cache[1]->c_scl_y * v->v1;
|
||||
v->u1 /= v->w;
|
||||
v->v1 /= v->w;
|
||||
}
|
||||
apply_shade_mods(v);
|
||||
}
|
||||
ConvertCoordsConvert(vtxbuf, nbVtxs);
|
||||
grCullMode(GR_CULL_DISABLE);
|
||||
grDrawVertexArrayContiguous(GR_TRIANGLE_STRIP, nbVtxs - 1, vtxbuf, sizeof(VERTEX));
|
||||
if (_debugger.capture)
|
||||
{
|
||||
VERTEX vl[3];
|
||||
vl[0] = vtxbuf[0];
|
||||
vl[1] = vtxbuf[2];
|
||||
vl[2] = vtxbuf[1];
|
||||
add_tri(vl, 3, TRI_TRIANGLE);
|
||||
rdp.tri_n++;
|
||||
if (nbVtxs > 4)
|
||||
{
|
||||
vl[0] = vtxbuf[2];
|
||||
vl[1] = vtxbuf[3];
|
||||
vl[2] = vtxbuf[1];
|
||||
add_tri(vl, 3, TRI_TRIANGLE);
|
||||
rdp.tri_n++;
|
||||
if (nbVtxs > 4)
|
||||
{
|
||||
vl[0] = vtxbuf[2];
|
||||
vl[1] = vtxbuf[3];
|
||||
vl[2] = vtxbuf[1];
|
||||
add_tri(vl, 3, TRI_TRIANGLE);
|
||||
rdp.tri_n++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4231,8 +4197,6 @@ void CALL ProcessRDPList(void)
|
|||
SoftLocker lock(mutexProcessDList);
|
||||
if (!lock.IsOk()) //mutex is busy
|
||||
{
|
||||
if (!fullscreen)
|
||||
drawNoFullscreenMessage();
|
||||
// Set an interrupt to allow the game to continue
|
||||
*gfx.MI_INTR_REG |= 0x20;
|
||||
gfx.CheckInterrupts();
|
||||
|
|
|
@ -246,7 +246,7 @@ void DrawHiresDepthImage(const DRAWIMAGE & d)
|
|||
|
||||
void DrawDepthImage(const DRAWIMAGE & d)
|
||||
{
|
||||
if (!fullscreen || !fb_depth_render_enabled)
|
||||
if (!fb_depth_render_enabled)
|
||||
return;
|
||||
if (d.imageH > d.imageW)
|
||||
return;
|
||||
|
@ -442,16 +442,13 @@ void DrawImage(DRAWIMAGE & d)
|
|||
if (rdp.cycle_mode == 2)
|
||||
rdp.allow_combine = 0;
|
||||
|
||||
if (fullscreen)
|
||||
{
|
||||
if (rdp.ci_width == 512 && !no_dlist)
|
||||
grClipWindow(0, 0, settings.scr_res_x, settings.scr_res_y);
|
||||
else if (d.scaleX == 1.0f && d.scaleY == 1.0f)
|
||||
grClipWindow(rdp.scissor.ul_x, rdp.scissor.ul_y, rdp.scissor.lr_x, rdp.scissor.lr_y);
|
||||
else
|
||||
grClipWindow(rdp.scissor.ul_x, rdp.scissor.ul_y, min(rdp.scissor.lr_x, (uint32_t)((d.frameX + d.imageW / d.scaleX + 0.5f)*rdp.scale_x)), min(rdp.scissor.lr_y, (uint32_t)((d.frameY + d.imageH / d.scaleY + 0.5f)*rdp.scale_y)));
|
||||
rdp.update |= UPDATE_SCISSOR;
|
||||
}
|
||||
if (rdp.ci_width == 512 && !no_dlist)
|
||||
grClipWindow(0, 0, settings.scr_res_x, settings.scr_res_y);
|
||||
else if (d.scaleX == 1.0f && d.scaleY == 1.0f)
|
||||
grClipWindow(rdp.scissor.ul_x, rdp.scissor.ul_y, rdp.scissor.lr_x, rdp.scissor.lr_y);
|
||||
else
|
||||
grClipWindow(rdp.scissor.ul_x, rdp.scissor.ul_y, min(rdp.scissor.lr_x, (uint32_t)((d.frameX + d.imageW / d.scaleX + 0.5f)*rdp.scale_x)), min(rdp.scissor.lr_y, (uint32_t)((d.frameY + d.imageH / d.scaleY + 0.5f)*rdp.scale_y)));
|
||||
rdp.update |= UPDATE_SCISSOR;
|
||||
|
||||
// Texture ()
|
||||
rdp.cur_tile = 0;
|
||||
|
@ -548,8 +545,7 @@ void DrawImage(DRAWIMAGE & d)
|
|||
apply_shade_mods(&(v[s]));
|
||||
ConvertCoordsConvert(v, 4);
|
||||
|
||||
if (fullscreen)
|
||||
grDrawVertexArrayContiguous(GR_TRIANGLE_STRIP, 4, v, sizeof(VERTEX));
|
||||
grDrawVertexArrayContiguous(GR_TRIANGLE_STRIP, 4, v, sizeof(VERTEX));
|
||||
|
||||
if (_debugger.capture)
|
||||
{
|
||||
|
@ -605,8 +601,6 @@ void DrawImage(DRAWIMAGE & d)
|
|||
|
||||
void DrawHiresImage(DRAWIMAGE & d, int screensize = FALSE)
|
||||
{
|
||||
if (!fullscreen)
|
||||
return;
|
||||
TBUFF_COLOR_IMAGE *tbuff_tex = rdp.tbuff_tex;
|
||||
if (rdp.motionblur)
|
||||
rdp.tbuff_tex = &(rdp.texbufs[rdp.cur_tex_buf ^ 1].images[0]);
|
||||
|
@ -985,7 +979,7 @@ static void uc6_draw_polygons(VERTEX v[4])
|
|||
}
|
||||
rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_VIEWPORT;
|
||||
|
||||
if (fullscreen && settings.fog && (rdp.flags & FOG_ENABLED))
|
||||
if (settings.fog && (rdp.flags & FOG_ENABLED))
|
||||
{
|
||||
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
|
||||
}
|
||||
|
@ -1698,7 +1692,7 @@ void uc6_sprite2d()
|
|||
}
|
||||
rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_VIEWPORT;
|
||||
|
||||
if (fullscreen && settings.fog && (rdp.flags & FOG_ENABLED))
|
||||
if (settings.fog && (rdp.flags & FOG_ENABLED))
|
||||
{
|
||||
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue