[Glide64] Change Frame buffer emulation options bit to an enum
This commit is contained in:
parent
bcd2a6f6b6
commit
50994936ba
|
@ -15713,7 +15713,7 @@ void Combine()
|
|||
aTBuff[rdp.aTBuffTex[1]->tile] = rdp.aTBuffTex[1];
|
||||
if (cmb.tex && (aTBuff[0] || aTBuff[1]))
|
||||
{
|
||||
if (aTBuff[0] && (g_settings->frame_buffer&fb_read_alpha))
|
||||
if (aTBuff[0] && g_settings->fb_read_alpha_enabled())
|
||||
{
|
||||
if ((g_settings->hacks&hack_PMario) && aTBuff[0]->width == rdp.ci_width)
|
||||
;
|
||||
|
|
|
@ -554,31 +554,31 @@ public:
|
|||
|
||||
m_cbxFBEnable.Attach(GetDlgItem(IDC_CHK_FRAME_BUFFER_EMULATION));
|
||||
TTSetTxt(IDC_CHK_FRAME_BUFFER_EMULATION, "Enable frame buffer emulation:\n\nIf on, plugin will try to detect frame buffer usage and apply appropriate frame buffer emulation.\n\n[Recommended: on for games which use frame buffer effects]");
|
||||
m_cbxFBEnable.SetCheck((g_settings->frame_buffer&fb_emulation) > 0 ? BST_CHECKED : BST_UNCHECKED);
|
||||
m_cbxFBEnable.SetCheck(g_settings->fb_emulation_enabled() ? BST_CHECKED : BST_UNCHECKED);
|
||||
|
||||
m_cbxFBHWFBE.Attach(GetDlgItem(IDC_CHK_HARDWARE_FRAMEBUFFER));
|
||||
TTSetTxt(IDC_CHK_HARDWARE_FRAMEBUFFER, "Enable hardware frame buffer emulation:\n\nIf this option is on, plugin will create auxiliary frame buffers in video memory instead of copying frame buffer content into main memory.\nThis allows plugin to run frame buffer effects without slowdown and without scaling image down to N64's native resolution.\nThis feature is fully supported by Voodoo 4/5 cards and partially by Voodoo3 and Banshee. Modern cards also fully support it.\n\n[Recommended: on, if supported by your hardware]");
|
||||
m_cbxFBHWFBE.SetCheck((g_settings->frame_buffer&fb_hwfbe) > 0 ? BST_CHECKED : BST_UNCHECKED);
|
||||
m_cbxFBHWFBE.SetCheck(g_settings->fb_hwfbe_set() ? BST_CHECKED : BST_UNCHECKED);
|
||||
|
||||
m_cbxFBGetFBI.Attach(GetDlgItem(IDC_CHK_GET_FRAMEBUFFER));
|
||||
TTSetTxt(IDC_CHK_GET_FRAMEBUFFER, "Get information about frame buffers:\n\nThis is compatibility option. It must be set on for Mupen64 and off for 1964");
|
||||
m_cbxFBGetFBI.SetCheck((g_settings->frame_buffer&fb_get_info) > 0 ? BST_CHECKED : BST_UNCHECKED);
|
||||
m_cbxFBGetFBI.SetCheck(g_settings->fb_get_info_enabled() ? BST_CHECKED : BST_UNCHECKED);
|
||||
|
||||
m_cbxFBReadEveryFrame.Attach(GetDlgItem(IDC_CHK_READ_EVERY_FRAME));
|
||||
TTSetTxt(IDC_CHK_READ_EVERY_FRAME, "Read every frame:\n\nIn some games plugin can't detect frame buffer usage.\nIn such cases you need to enable this option to see frame buffer effects.\nEvery drawn frame will be read from video card -> it works very slow.\n\n[Recommended: mostly off (needed only for a few games)]");
|
||||
m_cbxFBReadEveryFrame.SetCheck((g_settings->frame_buffer&fb_ref) > 0 ? BST_CHECKED : BST_UNCHECKED);
|
||||
m_cbxFBReadEveryFrame.SetCheck(g_settings->fb_ref_enabled() ? BST_CHECKED : BST_UNCHECKED);
|
||||
|
||||
m_cbxFBasTex.Attach(GetDlgItem(IDC_RENDER_FRAME_AS_TEXTURE));
|
||||
TTSetTxt(IDC_RENDER_FRAME_AS_TEXTURE, "Render N64 frame buffer as texture:\n\nWhen this option is enabled, content of each N64 frame buffer is rendered as texture over the frame, rendered by the plugin.\nThis prevents graphics lost, but may cause slowdowns and various glitches in some games.\n\n[Recommended: mostly off]");
|
||||
m_cbxFBasTex.SetCheck((g_settings->frame_buffer&fb_read_back_to_screen) > 0 ? BST_CHECKED : BST_UNCHECKED);
|
||||
m_cbxFBasTex.SetCheck(g_settings->fb_read_back_to_screen_enabled() ? BST_CHECKED : BST_UNCHECKED);
|
||||
|
||||
m_cbxDetect.Attach(GetDlgItem(IDC_CHK_DETECT_CPU_WRITE));
|
||||
TTSetTxt(IDC_CHK_DETECT_CPU_WRITE, "Detect CPU write to the N64 frame buffer:\n\nThis option works as the previous options, but the plugin is trying to detect, when game uses CPU writes to N64 frame buffer.\nThe N64 frame buffer is rendered only when CPU writes is detected.\nUse this option for those games, in which you see still image or no image at all for some time with no reason.\n\n[Recommended: mostly off]");
|
||||
m_cbxDetect.SetCheck((g_settings->frame_buffer&fb_cpu_write_hack) > 0 ? BST_CHECKED : BST_UNCHECKED);
|
||||
m_cbxDetect.SetCheck(g_settings->fb_cpu_write_hack_enabled() ? BST_CHECKED : BST_UNCHECKED);
|
||||
|
||||
m_cbxFBDepthBuffer.Attach(GetDlgItem(IDC_SOFTWARE_DEPTH_BUFFER));
|
||||
TTSetTxt(IDC_SOFTWARE_DEPTH_BUFFER, "Enable depth buffer rendering:\n\nThis option is used to fully emulate N64 depth buffer.\nIt is required for correct emulation of depth buffer based effects.\nHowever, it requires fast (>1GHz) CPU to work full speed.\n\n[Recommended: on for fast PC]");
|
||||
m_cbxFBDepthBuffer.SetCheck((g_settings->frame_buffer&fb_depth_render) > 0 ? BST_CHECKED : BST_UNCHECKED);
|
||||
m_cbxFBDepthBuffer.SetCheck(g_settings->fb_depth_render_enabled() ? BST_CHECKED : BST_UNCHECKED);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -593,20 +593,34 @@ public:
|
|||
g_settings->buff_clear = m_cbxBuffer.GetCheck() == BST_CHECKED;
|
||||
g_settings->lodmode = m_cmbLOD.GetItemData(m_cmbLOD.GetCurSel());
|
||||
|
||||
if (m_cbxFBEnable.GetCheck() == BST_CHECKED) g_settings->frame_buffer |= fb_emulation;
|
||||
else g_settings->frame_buffer &= ~fb_emulation;
|
||||
if (m_cbxFBHWFBE.GetCheck() == BST_CHECKED) g_settings->frame_buffer |= fb_hwfbe;
|
||||
else g_settings->frame_buffer &= ~fb_hwfbe;
|
||||
if (m_cbxFBReadEveryFrame.GetCheck() == BST_CHECKED) g_settings->frame_buffer |= fb_ref;
|
||||
else g_settings->frame_buffer &= ~fb_ref;
|
||||
if (m_cbxFBasTex.GetCheck() == BST_CHECKED) g_settings->frame_buffer |= fb_read_back_to_screen;
|
||||
else g_settings->frame_buffer &= ~fb_read_back_to_screen;
|
||||
if (m_cbxDetect.GetCheck() == BST_CHECKED) g_settings->frame_buffer |= fb_cpu_write_hack;
|
||||
else g_settings->frame_buffer &= ~fb_cpu_write_hack;
|
||||
if (m_cbxFBGetFBI.GetCheck() == BST_CHECKED) g_settings->frame_buffer |= fb_get_info;
|
||||
else g_settings->frame_buffer &= ~fb_get_info;
|
||||
if (m_cbxFBDepthBuffer.GetCheck() == BST_CHECKED) g_settings->frame_buffer |= fb_depth_render;
|
||||
else g_settings->frame_buffer &= ~fb_depth_render;
|
||||
CButton * fb_buttons[] =
|
||||
{
|
||||
&m_cbxFBEnable, &m_cbxFBHWFBE, &m_cbxFBReadEveryFrame,
|
||||
&m_cbxFBasTex, &m_cbxDetect,
|
||||
&m_cbxFBGetFBI, &m_cbxFBDepthBuffer
|
||||
};
|
||||
|
||||
CSettings::fb_bits_t bits[] =
|
||||
{
|
||||
CSettings::fb_emulation, CSettings::fb_hwfbe, CSettings::fb_ref,
|
||||
CSettings::fb_read_back_to_screen, CSettings::fb_cpu_write_hack,
|
||||
CSettings::fb_get_info, CSettings::fb_depth_render
|
||||
};
|
||||
|
||||
uint32_t fb_add_bits = 0, fb_remove_bits = 0;
|
||||
for (int i = 0; i < (sizeof(fb_buttons) / sizeof(fb_buttons[0])); i++)
|
||||
{
|
||||
if (fb_buttons[i]->GetCheck() == BST_CHECKED)
|
||||
{
|
||||
fb_add_bits |= bits[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
fb_remove_bits |= bits[i];
|
||||
}
|
||||
}
|
||||
|
||||
g_settings->UpdateFrameBufferBits(fb_add_bits, fb_remove_bits);
|
||||
if (memcmp(&oldsettings, g_settings, sizeof(oldsettings))) //check that settings were changed
|
||||
{
|
||||
WriteSettings();
|
||||
|
@ -877,7 +891,7 @@ void CALL DllConfig(HWND hParent)
|
|||
else
|
||||
{
|
||||
char name[21] = "DEFAULT";
|
||||
ReadSpecialSettings(name);
|
||||
g_settings->ReadGameSettings(name);
|
||||
ZLUT_init();
|
||||
}
|
||||
|
||||
|
@ -890,8 +904,10 @@ void CloseConfig()
|
|||
{
|
||||
if (g_romopen)
|
||||
{
|
||||
if (fb_depth_render_enabled)
|
||||
if (g_settings->fb_depth_render_enabled())
|
||||
{
|
||||
ZLUT_init();
|
||||
}
|
||||
// re-init evoodoo graphics to resize window
|
||||
if (evoodoo)// && !ev_fullscreen)
|
||||
InitGfx();
|
||||
|
|
|
@ -578,7 +578,7 @@ void DrawDepthBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
|
|||
DrawDepthBufferToScreen256(fb_info);
|
||||
return;
|
||||
}
|
||||
if (fb_hwfbe_enabled && !evoodoo)
|
||||
if (g_settings->fb_hwfbe_enabled() && !evoodoo)
|
||||
{
|
||||
DrawHiresDepthBufferToScreen(fb_info);
|
||||
return;
|
||||
|
|
|
@ -288,7 +288,6 @@ extern "C" {
|
|||
#define GR_STIPPLE_ROTATE 0x2
|
||||
#endif
|
||||
|
||||
void ReadSpecialSettings(const char * name);
|
||||
void WriteSettings(void);
|
||||
|
||||
/******************************************************************
|
||||
|
|
|
@ -736,7 +736,6 @@ extern "C" int WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID /*lpReser
|
|||
if (fdwReason == DLL_PROCESS_ATTACH)
|
||||
{
|
||||
hinstDLL = hinst;
|
||||
SetupTrace();
|
||||
if (g_ProcessDListCS == NULL)
|
||||
{
|
||||
g_ProcessDListCS = new CriticalSection();
|
||||
|
@ -1011,7 +1010,7 @@ int CALL InitiateGFX(GFX_INFO Gfx_Info)
|
|||
rdp.scale_y = 1.0f;
|
||||
|
||||
char name[21] = "DEFAULT";
|
||||
ReadSpecialSettings(name);
|
||||
g_settings->ReadGameSettings(name);
|
||||
ZLUT_init();
|
||||
ConfigWrapper();
|
||||
#ifndef ANDROID
|
||||
|
@ -1182,7 +1181,7 @@ void CALL RomOpen(void)
|
|||
g_settings->ghq_use = 0;
|
||||
}
|
||||
strcpy(rdp.RomName, name);
|
||||
ReadSpecialSettings(name);
|
||||
g_settings->ReadGameSettings(name);
|
||||
ClearCache();
|
||||
|
||||
CheckDRAMSize();
|
||||
|
@ -1291,7 +1290,7 @@ void CALL UpdateScreen(void)
|
|||
update_screen_count++;
|
||||
}
|
||||
uint32_t limit = (g_settings->hacks&hack_Lego) ? 15 : 30;
|
||||
if ((g_settings->frame_buffer&fb_cpu_write_hack) && (update_screen_count > limit) && (rdp.last_bg == 0))
|
||||
if (g_settings->fb_cpu_write_hack_enabled() && (update_screen_count > limit) && (rdp.last_bg == 0))
|
||||
{
|
||||
WriteTrace(TraceRDP, TraceDebug, "DirectCPUWrite hack!");
|
||||
update_screen_count = 0;
|
||||
|
@ -1338,9 +1337,11 @@ static void DrawWholeFrameBufferToScreen()
|
|||
fb_info.lr_y = rdp.ci_height - 1;
|
||||
fb_info.opaque = 0;
|
||||
DrawFrameBufferToScreen(fb_info);
|
||||
if (!(g_settings->frame_buffer & fb_ref))
|
||||
if (!g_settings->fb_ref_enabled())
|
||||
{
|
||||
memset(gfx.RDRAM + rdp.cimg, 0, (rdp.ci_width*rdp.ci_height) << rdp.ci_size >> 1);
|
||||
}
|
||||
}
|
||||
|
||||
static void GetGammaTable()
|
||||
{
|
||||
|
@ -1565,11 +1566,15 @@ void newSwapBuffers()
|
|||
}
|
||||
}
|
||||
|
||||
if (g_settings->frame_buffer & fb_read_back_to_screen)
|
||||
if (g_settings->fb_read_back_to_screen_enabled())
|
||||
{
|
||||
DrawWholeFrameBufferToScreen();
|
||||
}
|
||||
|
||||
if (fb_hwfbe_enabled && !(g_settings->hacks&hack_RE2) && !evoodoo)
|
||||
if (g_settings->fb_hwfbe_enabled() && !(g_settings->hacks&hack_RE2) && !evoodoo)
|
||||
{
|
||||
grAuxBufferExt(GR_BUFFER_AUXBUFFER);
|
||||
}
|
||||
WriteTrace(TraceGlide64, TraceDebug, "BUFFER SWAPPED");
|
||||
grBufferSwap(g_settings->vsync);
|
||||
if (*gfx.VI_STATUS_REG & 0x08) //gamma correction is used
|
||||
|
@ -1596,23 +1601,14 @@ void newSwapBuffers()
|
|||
|
||||
if (g_settings->wireframe || g_settings->buff_clear || (g_settings->hacks&hack_PPL && g_settings->ucode == 6))
|
||||
{
|
||||
if (g_settings->hacks&hack_RE2 && fb_depth_render_enabled)
|
||||
if (g_settings->hacks&hack_RE2 && g_settings->fb_depth_render_enabled())
|
||||
grDepthMask(FXFALSE);
|
||||
else
|
||||
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 (g_settings->frame_buffer & fb_read_back_to_screen2)
|
||||
if (g_settings->fb_read_back_to_screen2_enabled())
|
||||
{
|
||||
DrawWholeFrameBufferToScreen();
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ int GetCurrentResIndex(void);
|
|||
short Set_basic_mode = 0, Set_texture_dir = 0, Set_log_dir = 0, Set_log_flush = 0;
|
||||
|
||||
CSettings::CSettings() :
|
||||
m_dirty(false),
|
||||
res_x(640),
|
||||
scr_res_x(640),
|
||||
res_y(480),
|
||||
|
@ -31,6 +32,7 @@ buff_clear(0),
|
|||
swapmode(0),
|
||||
lodmode(0),
|
||||
aspectmode(0),
|
||||
m_frame_buffer(0),
|
||||
use_hotkeys(0),
|
||||
//Texture filtering options
|
||||
texture_dir(""),
|
||||
|
@ -224,6 +226,17 @@ void CSettings::RegisterSettings(void)
|
|||
game_setting_default(Set_fb_render, "fb_render", Set_fb_render_default);
|
||||
}
|
||||
|
||||
void CSettings::UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove)
|
||||
{
|
||||
uint32_t frame_buffer_original = m_frame_buffer;
|
||||
m_frame_buffer |= BitsToAdd;
|
||||
m_frame_buffer &= ~BitsToRemove;
|
||||
if (frame_buffer_original != m_frame_buffer)
|
||||
{
|
||||
m_dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
void CSettings::ReadSettings()
|
||||
{
|
||||
#ifdef ANDROID
|
||||
|
@ -305,9 +318,10 @@ void CSettings::ReadSettings()
|
|||
GetSystemSettingSz(Set_log_dir, m_log_dir, sizeof(m_log_dir));
|
||||
}
|
||||
m_FlushLogs = Set_log_flush != 0 ? GetSystemSetting(Set_log_flush) != 0 : false;
|
||||
m_dirty = false;
|
||||
}
|
||||
|
||||
void ReadSpecialSettings(const char * name)
|
||||
void CSettings::ReadGameSettings(const char * name)
|
||||
{
|
||||
g_settings->hacks = 0;
|
||||
|
||||
|
@ -399,64 +413,57 @@ void ReadSpecialSettings(const char * name)
|
|||
g_settings->n64_z_scale = GetSetting(Set_n64_z_scale);
|
||||
|
||||
//frame buffer
|
||||
int optimize_texrect = GetSetting(g_romopen ? Set_optimize_texrect : Set_optimize_texrect_default);
|
||||
int ignore_aux_copy = GetSetting(Set_ignore_aux_copy);
|
||||
int hires_buf_clear = GetSetting(Set_hires_buf_clear);
|
||||
int read_alpha = GetSetting(Set_fb_read_alpha);
|
||||
int useless_is_useless = GetSetting(Set_useless_is_useless);
|
||||
int fb_crc_mode = GetSetting(Set_fb_crc_mode);
|
||||
short fb_Settings[] =
|
||||
{
|
||||
g_romopen ? Set_optimize_texrect : Set_optimize_texrect_default,
|
||||
Set_ignore_aux_copy,
|
||||
Set_hires_buf_clear,
|
||||
Set_fb_read_alpha,
|
||||
Set_useless_is_useless,
|
||||
g_romopen ? Set_fb_smart : Set_fb_smart_default,
|
||||
g_romopen ? Set_fb_hires : Set_fb_hires_default,
|
||||
g_romopen ? Set_fb_read_always : Set_fb_read_always_default,
|
||||
g_romopen ? Set_detect_cpu_write : Set_detect_cpu_write_default,
|
||||
g_romopen ? Set_fb_get_info : Set_fb_get_info_default,
|
||||
g_romopen ? Set_fb_render : Set_fb_render_default
|
||||
};
|
||||
|
||||
if (optimize_texrect > 0) g_settings->frame_buffer |= fb_optimize_texrect;
|
||||
else if (optimize_texrect == 0) g_settings->frame_buffer &= ~fb_optimize_texrect;
|
||||
if (ignore_aux_copy > 0) g_settings->frame_buffer |= fb_ignore_aux_copy;
|
||||
else if (ignore_aux_copy == 0) g_settings->frame_buffer &= ~fb_ignore_aux_copy;
|
||||
if (hires_buf_clear > 0) g_settings->frame_buffer |= fb_hwfbe_buf_clear;
|
||||
else if (hires_buf_clear == 0) g_settings->frame_buffer &= ~fb_hwfbe_buf_clear;
|
||||
if (read_alpha > 0) g_settings->frame_buffer |= fb_read_alpha;
|
||||
else if (read_alpha == 0) g_settings->frame_buffer &= ~fb_read_alpha;
|
||||
if (useless_is_useless > 0) g_settings->frame_buffer |= fb_useless_is_useless;
|
||||
else g_settings->frame_buffer &= ~fb_useless_is_useless;
|
||||
if (fb_crc_mode >= 0) g_settings->fb_crc_mode = (CSettings::FBCRCMODE)fb_crc_mode;
|
||||
fb_bits_t bits[] =
|
||||
{
|
||||
fb_optimize_texrect,
|
||||
fb_ignore_aux_copy,
|
||||
fb_hwfbe_buf_clear,
|
||||
fb_read_alpha,
|
||||
fb_useless_is_useless,
|
||||
fb_emulation,
|
||||
fb_hwfbe,
|
||||
fb_ref,
|
||||
fb_cpu_write_hack,
|
||||
fb_get_info,
|
||||
fb_depth_render
|
||||
};
|
||||
|
||||
g_settings->filtering = GetSetting(g_romopen ? Set_filtering : Set_filtering_default);
|
||||
g_settings->fog = GetSetting(g_romopen ? Set_fog : Set_fog_default);
|
||||
g_settings->buff_clear = GetSetting(g_romopen ? Set_buff_clear : Set_buff_clear_default);
|
||||
g_settings->swapmode = GetSetting(g_romopen ? Set_swapmode : Set_swapmode_default);
|
||||
g_settings->aspectmode = GetSetting(g_romopen ? Set_aspect : Set_aspect_default);
|
||||
g_settings->lodmode = GetSetting(g_romopen ? Set_lodmode : Set_lodmode_default);
|
||||
#ifdef _WIN32
|
||||
g_settings->res_data = GetSetting(Set_Resolution);
|
||||
if (g_settings->res_data < 0 || g_settings->res_data >= 0x18) g_settings->res_data = 12;
|
||||
g_settings->scr_res_x = g_settings->res_x = resolutions[g_settings->res_data][0];
|
||||
g_settings->scr_res_y = g_settings->res_y = resolutions[g_settings->res_data][1];
|
||||
#endif
|
||||
uint32_t fb_add_bits = 0, fb_remove_bits = 0;
|
||||
for (int i = 0; i < (sizeof(fb_Settings) / sizeof(fb_Settings[0])); i++)
|
||||
{
|
||||
if (GetSetting(fb_Settings[i]) != 0)
|
||||
{
|
||||
fb_add_bits |= bits[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
fb_remove_bits |= bits[i];
|
||||
}
|
||||
}
|
||||
fb_add_bits |= fb_motionblur;
|
||||
|
||||
//frame buffer
|
||||
int smart_read = GetSetting(g_romopen ? Set_fb_smart : Set_fb_smart_default);
|
||||
int hires = GetSetting(g_romopen ? Set_fb_hires : Set_fb_hires_default);
|
||||
int read_always = GetSetting(g_romopen ? Set_fb_read_always : Set_fb_read_always_default);
|
||||
int read_back_to_screen = GetSetting(g_romopen ? Set_read_back_to_screen : Set_read_back_to_screen_default);
|
||||
int cpu_write_hack = GetSetting(g_romopen ? Set_detect_cpu_write : Set_detect_cpu_write_default);
|
||||
int get_fbinfo = GetSetting(g_romopen ? Set_fb_get_info : Set_fb_get_info_default);
|
||||
int depth_render = GetSetting(g_romopen ? Set_fb_render : Set_fb_render_default);
|
||||
if (read_back_to_screen == 1) { fb_add_bits |= fb_read_back_to_screen; }
|
||||
else if (read_back_to_screen == 2) { fb_add_bits |= fb_read_back_to_screen2; }
|
||||
else if (read_back_to_screen == 0) { fb_remove_bits |= fb_read_back_to_screen | fb_read_back_to_screen2; }
|
||||
|
||||
if (smart_read > 0) g_settings->frame_buffer |= fb_emulation;
|
||||
else if (smart_read == 0) g_settings->frame_buffer &= ~fb_emulation;
|
||||
if (hires > 0) g_settings->frame_buffer |= fb_hwfbe;
|
||||
else if (hires == 0) g_settings->frame_buffer &= ~fb_hwfbe;
|
||||
if (read_always > 0) g_settings->frame_buffer |= fb_ref;
|
||||
else if (read_always == 0) g_settings->frame_buffer &= ~fb_ref;
|
||||
if (read_back_to_screen == 1) g_settings->frame_buffer |= fb_read_back_to_screen;
|
||||
else if (read_back_to_screen == 2) g_settings->frame_buffer |= fb_read_back_to_screen2;
|
||||
else if (read_back_to_screen == 0) g_settings->frame_buffer &= ~(fb_read_back_to_screen | fb_read_back_to_screen2);
|
||||
if (cpu_write_hack > 0) g_settings->frame_buffer |= fb_cpu_write_hack;
|
||||
else if (cpu_write_hack == 0) g_settings->frame_buffer &= ~fb_cpu_write_hack;
|
||||
if (get_fbinfo > 0) g_settings->frame_buffer |= fb_get_info;
|
||||
else if (get_fbinfo == 0) g_settings->frame_buffer &= ~fb_get_info;
|
||||
if (depth_render > 0) g_settings->frame_buffer |= fb_depth_render;
|
||||
else if (depth_render == 0) g_settings->frame_buffer &= ~fb_depth_render;
|
||||
g_settings->frame_buffer |= fb_motionblur;
|
||||
g_settings->flame_corona = (g_settings->hacks & hack_Zelda) && !fb_depth_render_enabled;
|
||||
g_settings->UpdateFrameBufferBits(fb_add_bits, fb_remove_bits);
|
||||
g_settings->flame_corona = (g_settings->hacks & hack_Zelda) && !fb_depth_render_enabled();
|
||||
}
|
||||
|
||||
void WriteSettings(void)
|
||||
|
@ -518,17 +525,17 @@ void WriteSettings(void)
|
|||
SetSetting(g_romopen ? Set_lodmode : Set_lodmode_default, g_settings->lodmode);
|
||||
SetSetting(g_romopen ? Set_aspect : Set_aspect_default, g_settings->aspectmode);
|
||||
|
||||
SetSetting(g_romopen ? Set_fb_read_always : Set_fb_read_always_default, g_settings->frame_buffer&fb_ref ? 1 : 0);
|
||||
SetSetting(g_romopen ? Set_fb_smart : Set_fb_smart_default, g_settings->frame_buffer & fb_emulation ? 1 : 0);
|
||||
SetSetting(g_romopen ? Set_fb_hires : Set_fb_hires_default, g_settings->frame_buffer & fb_hwfbe ? 1 : 0);
|
||||
SetSetting(g_romopen ? Set_fb_get_info : Set_fb_get_info_default, g_settings->frame_buffer & fb_get_info ? 1 : 0);
|
||||
SetSetting(g_romopen ? Set_fb_render : Set_fb_render_default, g_settings->frame_buffer & fb_depth_render ? 1 : 0);
|
||||
SetSetting(g_romopen ? Set_detect_cpu_write : Set_detect_cpu_write_default, g_settings->frame_buffer & fb_cpu_write_hack ? 1 : 0);
|
||||
if (g_settings->frame_buffer & fb_read_back_to_screen)
|
||||
SetSetting(g_romopen ? Set_fb_read_always : Set_fb_read_always_default, g_settings->fb_ref_enabled() ? true : false);
|
||||
SetSetting(g_romopen ? Set_fb_smart : Set_fb_smart_default, g_settings->fb_emulation_enabled() ? true : false);
|
||||
SetSetting(g_romopen ? Set_fb_hires : Set_fb_hires_default, g_settings->fb_hwfbe_set() ? true : false);
|
||||
SetSetting(g_romopen ? Set_fb_get_info : Set_fb_get_info_default, g_settings->fb_get_info_enabled() ? true : false);
|
||||
SetSetting(g_romopen ? Set_fb_render : Set_fb_render_default, g_settings->fb_depth_render_enabled() ? true : false);
|
||||
SetSetting(g_romopen ? Set_detect_cpu_write : Set_detect_cpu_write_default, g_settings->fb_cpu_write_hack_enabled() ? true : false);
|
||||
if (g_settings->fb_read_back_to_screen_enabled())
|
||||
{
|
||||
SetSetting(g_romopen ? Set_read_back_to_screen : Set_read_back_to_screen_default, 1);
|
||||
}
|
||||
else if (g_settings->frame_buffer & fb_read_back_to_screen2)
|
||||
else if (g_settings->fb_read_back_to_screen2_enabled())
|
||||
{
|
||||
SetSetting(g_romopen ? Set_read_back_to_screen : Set_read_back_to_screen_default, 2);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,25 @@ class CSettings
|
|||
public:
|
||||
CSettings();
|
||||
|
||||
//Frame buffer emulation options
|
||||
enum fb_bits_t
|
||||
{
|
||||
fb_emulation = (1 << 0), //frame buffer emulation
|
||||
fb_hwfbe = (1 << 1), //hardware frame buffer emualtion
|
||||
fb_motionblur = (1 << 2), //emulate motion blur
|
||||
fb_ref = (1 << 3), //read every frame
|
||||
fb_read_alpha = (1 << 4), //read alpha
|
||||
fb_hwfbe_buf_clear = (1 << 5), //clear auxiliary texture frame buffers
|
||||
fb_depth_render = (1 << 6), //enable software depth render
|
||||
fb_optimize_texrect = (1 << 7), //fast texrect rendering with hwfbe
|
||||
fb_ignore_aux_copy = (1 << 8), //do not copy auxiliary frame buffers
|
||||
fb_useless_is_useless = (1 << 10), //
|
||||
fb_get_info = (1 << 11), //get frame buffer info
|
||||
fb_read_back_to_screen = (1 << 12), //render N64 frame buffer to screen
|
||||
fb_read_back_to_screen2 = (1 << 13), //render N64 frame buffer to screen
|
||||
fb_cpu_write_hack = (1 << 14), //show images writed directly by CPU
|
||||
};
|
||||
|
||||
uint32_t res_x, scr_res_x;
|
||||
uint32_t res_y, scr_res_y;
|
||||
#ifndef ANDROID
|
||||
|
@ -28,27 +47,7 @@ public:
|
|||
int aspectmode;
|
||||
int use_hotkeys;
|
||||
|
||||
//Frame buffer emulation options
|
||||
#define fb_emulation (1<<0) //frame buffer emulation
|
||||
#define fb_hwfbe (1<<1) //hardware frame buffer emualtion
|
||||
#define fb_motionblur (1<<2) //emulate motion blur
|
||||
#define fb_ref (1<<3) //read every frame
|
||||
#define fb_read_alpha (1<<4) //read alpha
|
||||
#define fb_hwfbe_buf_clear (1<<5) //clear auxiliary texture frame buffers
|
||||
#define fb_depth_render (1<<6) //enable software depth render
|
||||
#define fb_optimize_texrect (1<<7) //fast texrect rendering with hwfbe
|
||||
#define fb_ignore_aux_copy (1<<8) //do not copy auxiliary frame buffers
|
||||
#define fb_useless_is_useless (1<<10) //
|
||||
#define fb_get_info (1<<11) //get frame buffer info
|
||||
#define fb_read_back_to_screen (1<<12) //render N64 frame buffer to screen
|
||||
#define fb_read_back_to_screen2 (1<<13) //render N64 frame buffer to screen
|
||||
#define fb_cpu_write_hack (1<<14) //show images writed directly by CPU
|
||||
|
||||
#define fb_emulation_enabled ((g_settings->frame_buffer&fb_emulation)>0)
|
||||
#define fb_hwfbe_enabled ((g_settings->frame_buffer&(fb_emulation|fb_hwfbe))==(fb_emulation|fb_hwfbe))
|
||||
#define fb_depth_render_enabled ((g_settings->frame_buffer&fb_depth_render)>0)
|
||||
|
||||
uint32_t frame_buffer;
|
||||
enum FBCRCMODE
|
||||
{
|
||||
fbcrcNone = 0,
|
||||
|
@ -56,6 +55,22 @@ public:
|
|||
fbcrcSafe = 2
|
||||
} fb_crc_mode;
|
||||
|
||||
inline bool fb_emulation_enabled(void) const { return ((m_frame_buffer&fb_emulation) != 0); }
|
||||
inline bool fb_ref_enabled(void) const { return ((m_frame_buffer&fb_ref) != 0); }
|
||||
inline bool fb_hwfbe_enabled(void) const { return ((m_frame_buffer&(fb_emulation |fb_hwfbe)) == (fb_emulation | fb_hwfbe)); }
|
||||
inline bool fb_hwfbe_set(void) const { return ((m_frame_buffer&fb_hwfbe) != 0); }
|
||||
inline bool fb_depth_render_enabled(void) const { return ((m_frame_buffer&fb_depth_render) != 0); }
|
||||
inline bool fb_get_info_enabled(void) const { return ((m_frame_buffer&fb_get_info) != 0); }
|
||||
inline bool fb_read_back_to_screen_enabled(void) const { return ((m_frame_buffer&fb_read_back_to_screen) != 0); }
|
||||
inline bool fb_read_back_to_screen2_enabled(void) const { return ((m_frame_buffer&fb_read_back_to_screen2) != 0); }
|
||||
inline bool fb_cpu_write_hack_enabled(void) const { return ((m_frame_buffer&fb_cpu_write_hack) != 0); }
|
||||
inline bool fb_ignore_aux_copy_enabled(void) const { return ((m_frame_buffer&fb_ignore_aux_copy) != 0); }
|
||||
inline bool fb_hwfbe_buf_clear_enabled(void) const { return ((m_frame_buffer&fb_hwfbe_buf_clear) != 0); }
|
||||
inline bool fb_useless_is_useless_enabled(void) const { return ((m_frame_buffer&fb_useless_is_useless) != 0); }
|
||||
inline bool fb_motionblur_enabled(void) const { return ((m_frame_buffer&fb_motionblur) != 0); }
|
||||
inline bool fb_read_alpha_enabled(void) const { return ((m_frame_buffer&fb_read_alpha) != 0); }
|
||||
inline bool fb_optimize_texrect_enabled(void) const { return ((m_frame_buffer&fb_optimize_texrect) != 0); }
|
||||
|
||||
inline const char * log_dir(void) const { return m_log_dir; }
|
||||
inline bool FlushLogs(void) const { return m_FlushLogs; }
|
||||
|
||||
|
@ -160,12 +175,18 @@ public:
|
|||
int wrpVRAM;
|
||||
int wrpFBO;
|
||||
int wrpAnisotropic;
|
||||
void UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove);
|
||||
|
||||
void ReadGameSettings(const char * name);
|
||||
|
||||
private:
|
||||
void ReadSettings();
|
||||
void RegisterSettings(void);
|
||||
|
||||
bool m_dirty;
|
||||
bool m_FlushLogs;
|
||||
char m_log_dir[260];
|
||||
uint32_t m_frame_buffer;
|
||||
};
|
||||
|
||||
extern CSettings * g_settings;
|
||||
|
|
|
@ -326,8 +326,8 @@ int OpenTextureBuffer(COLOR_IMAGE & cimage)
|
|||
grRenderBuffer(GR_BUFFER_TEXTUREBUFFER_EXT);
|
||||
grTextureBufferExt(rdp.cur_image->tmu, rdp.cur_image->tex_addr, rdp.cur_image->info.smallLodLog2, rdp.cur_image->info.largeLodLog2,
|
||||
rdp.cur_image->info.aspectRatioLog2, rdp.cur_image->info.format, GR_MIPMAPLEVELMASK_BOTH);
|
||||
///*
|
||||
if (rdp.cur_image->clear && (g_settings->frame_buffer&fb_hwfbe_buf_clear) && cimage.changed)
|
||||
|
||||
if (rdp.cur_image->clear && g_settings->fb_hwfbe_buf_clear_enabled() && cimage.changed)
|
||||
{
|
||||
rdp.cur_image->clear = FALSE;
|
||||
grDepthMask(FXFALSE);
|
||||
|
@ -665,10 +665,14 @@ int SwapTextureBuffer()
|
|||
static uint32_t CalcCRC(TBUFF_COLOR_IMAGE * pTCI)
|
||||
{
|
||||
uint32_t result = 0;
|
||||
if ((g_settings->frame_buffer&fb_ref) > 0)
|
||||
if (g_settings->fb_ref_enabled())
|
||||
{
|
||||
pTCI->crc = 0; //Since fb content changes each frame, crc check is meaningless.
|
||||
}
|
||||
else if (g_settings->fb_crc_mode == CSettings::fbcrcFast)
|
||||
{
|
||||
result = *((uint32_t*)(gfx.RDRAM + pTCI->addr + (pTCI->end_addr - pTCI->addr) / 2));
|
||||
}
|
||||
else if (g_settings->fb_crc_mode == CSettings::fbcrcSafe)
|
||||
{
|
||||
uint8_t * pSrc = gfx.RDRAM + pTCI->addr;
|
||||
|
|
|
@ -289,7 +289,7 @@ VERTEX **org_vtx;
|
|||
void draw_tri(VERTEX **vtx, uint16_t linew)
|
||||
{
|
||||
deltaZ = dzdx = 0;
|
||||
if (linew == 0 && (fb_depth_render_enabled || (rdp.rm & 0xC00) == 0xC00))
|
||||
if (linew == 0 && (g_settings->fb_depth_render_enabled() || (rdp.rm & 0xC00) == 0xC00))
|
||||
{
|
||||
double X0 = vtx[0]->sx / rdp.scale_x;
|
||||
double Y0 = vtx[0]->sy / rdp.scale_y;
|
||||
|
@ -308,12 +308,15 @@ void draw_tri(VERTEX **vtx, uint16_t linew)
|
|||
double diffz_02 = vtx[0]->sz - vtx[2]->sz;
|
||||
double diffz_12 = vtx[1]->sz - vtx[2]->sz;
|
||||
double fdzdx = (diffz_02 * diffy_12 - diffz_12 * diffy_02) / denom;
|
||||
if ((rdp.rm & 0xC00) == 0xC00) {
|
||||
if ((rdp.rm & 0xC00) == 0xC00)
|
||||
{
|
||||
// Calculate deltaZ per polygon for Decal z-mode
|
||||
double fdzdy = (diffz_02 * diffx_12 - diffz_12 * diffx_02) / denom;
|
||||
double fdz = fabs(fdzdx) + fabs(fdzdy);
|
||||
if ((g_settings->hacks & hack_Zelda) && (rdp.rm & 0x800))
|
||||
{
|
||||
fdz *= 4.0; // Decal mode in Zelda sometimes needs mutiplied deltaZ to work correct, e.g. roads
|
||||
}
|
||||
deltaZ = maxval(8, (int)fdz);
|
||||
}
|
||||
dzdx = (int)(fdzdx * 65536.0);
|
||||
|
@ -1033,7 +1036,7 @@ float ScaleZ(float z)
|
|||
|
||||
static void DepthBuffer(VERTEX * vtx, int n)
|
||||
{
|
||||
if (fb_depth_render_enabled && !(g_settings->hacks&hack_RE2) && dzdx && (rdp.flags & ZBUF_UPDATE))
|
||||
if (g_settings->fb_depth_render_enabled() && !(g_settings->hacks&hack_RE2) && dzdx && (rdp.flags & ZBUF_UPDATE))
|
||||
{
|
||||
vertexi v[12];
|
||||
if (u_cull_mode == 1) //cull front
|
||||
|
|
|
@ -421,7 +421,7 @@ static void CopyFrameBuffer(GrBuffer_t buffer = GR_BUFFER_BACKBUFFER)
|
|||
|
||||
uint32_t width = rdp.ci_width;//*gfx.VI_WIDTH_REG;
|
||||
uint32_t height;
|
||||
if (fb_emulation_enabled && !(g_settings->hacks&hack_PPL))
|
||||
if (g_settings->fb_emulation_enabled() && !(g_settings->hacks&hack_PPL))
|
||||
{
|
||||
int ind = (rdp.ci_count > 0) ? rdp.ci_count - 1 : 0;
|
||||
height = rdp.frame_buffers[ind].height;
|
||||
|
@ -454,7 +454,7 @@ static void CopyFrameBuffer(GrBuffer_t buffer = GR_BUFFER_BACKBUFFER)
|
|||
for (uint32_t x = 0; x < width; x++)
|
||||
{
|
||||
c = ptr_src[x + y * width];
|
||||
if (g_settings->frame_buffer&fb_read_alpha)
|
||||
if (g_settings->fb_read_alpha_enabled())
|
||||
{
|
||||
if (c > 0)
|
||||
c = (c & 0xFFC0) | ((c & 0x001F) << 1) | 1;
|
||||
|
@ -479,7 +479,7 @@ static void CopyFrameBuffer(GrBuffer_t buffer = GR_BUFFER_BACKBUFFER)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (rdp.motionblur && fb_hwfbe_enabled)
|
||||
if (rdp.motionblur && g_settings->fb_hwfbe_enabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -505,7 +505,7 @@ static void CopyFrameBuffer(GrBuffer_t buffer = GR_BUFFER_BACKBUFFER)
|
|||
uint16_t c;
|
||||
uint32_t stride = info.strideInBytes >> 1;
|
||||
|
||||
int read_alpha = g_settings->frame_buffer & fb_read_alpha;
|
||||
int read_alpha = g_settings->fb_read_alpha_enabled();
|
||||
if ((g_settings->hacks&hack_PMario) && rdp.frame_buffers[rdp.ci_count - 1].status != ci_aux)
|
||||
read_alpha = FALSE;
|
||||
int x_start = 0, y_start = 0, x_end = width, y_end = height;
|
||||
|
@ -652,7 +652,7 @@ EXPORT void CALL ProcessDList(void)
|
|||
depth_buffer_fog = TRUE;
|
||||
|
||||
//analize possible frame buffer usage
|
||||
if (fb_emulation_enabled)
|
||||
if (g_settings->fb_emulation_enabled())
|
||||
DetectFrameBufferUsage();
|
||||
if (!(g_settings->hacks&hack_Lego) || rdp.num_of_ci > 1)
|
||||
rdp.last_bg = 0;
|
||||
|
@ -764,19 +764,25 @@ EXPORT void CALL ProcessDList(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
if (fb_emulation_enabled)
|
||||
if (g_settings->fb_emulation_enabled())
|
||||
{
|
||||
rdp.scale_x = rdp.scale_x_bak;
|
||||
rdp.scale_y = rdp.scale_y_bak;
|
||||
}
|
||||
|
||||
if (g_settings->hacks & hack_OoT)
|
||||
{
|
||||
copyWhiteToRDRAM(); //Subscreen delay fix
|
||||
else if (g_settings->frame_buffer & fb_ref)
|
||||
}
|
||||
else if (g_settings->fb_ref_enabled())
|
||||
{
|
||||
CopyFrameBuffer();
|
||||
}
|
||||
|
||||
if (rdp.cur_image)
|
||||
{
|
||||
CloseTextureBuffer(rdp.read_whole_frame && ((g_settings->hacks&hack_PMario) || rdp.swap_ci_index >= 0));
|
||||
}
|
||||
|
||||
if ((g_settings->hacks&hack_TGR2) && rdp.vi_org_reg != *gfx.VI_ORIGIN_REG && CI_SET)
|
||||
{
|
||||
|
@ -932,7 +938,7 @@ static void rdp_texrect()
|
|||
return;
|
||||
}
|
||||
|
||||
if (rdp.skip_drawing || (!fb_emulation_enabled && (rdp.cimg == rdp.zimg)))
|
||||
if (rdp.skip_drawing || (!g_settings->fb_emulation_enabled() && (rdp.cimg == rdp.zimg)))
|
||||
{
|
||||
if ((g_settings->hacks&hack_PMario) && rdp.ci_status == ci_useless)
|
||||
{
|
||||
|
@ -1011,8 +1017,7 @@ static void rdp_texrect()
|
|||
lr_y = ceil(lr_y);
|
||||
}
|
||||
|
||||
//*
|
||||
if (rdp.tbuff_tex && (g_settings->frame_buffer & fb_optimize_texrect))
|
||||
if (rdp.tbuff_tex && g_settings->fb_optimize_texrect_enabled())
|
||||
{
|
||||
WriteTrace(TraceRDP, TraceDebug, "Attempt to optimize texrect");
|
||||
if (!rdp.tbuff_tex->drawn)
|
||||
|
@ -1050,7 +1055,7 @@ static void rdp_texrect()
|
|||
}
|
||||
//*
|
||||
//hack for Banjo2. it removes black texrects under Banjo
|
||||
if (!fb_hwfbe_enabled && ((rdp.cycle1 << 16) | (rdp.cycle2 & 0xFFFF)) == 0xFFFFFFFF && (rdp.othermode_l & 0xFFFF0000) == 0x00500000)
|
||||
if (!g_settings->fb_hwfbe_enabled() && ((rdp.cycle1 << 16) | (rdp.cycle2 & 0xFFFF)) == 0xFFFFFFFF && (rdp.othermode_l & 0xFFFF0000) == 0x00500000)
|
||||
{
|
||||
rdp.tri_n += 2;
|
||||
return;
|
||||
|
@ -1060,7 +1065,7 @@ static void rdp_texrect()
|
|||
//remove motion blur in night vision
|
||||
if ((g_settings->ucode == ucode_PerfectDark) && (rdp.maincimg[1].addr != rdp.maincimg[0].addr) && (rdp.timg.addr >= rdp.maincimg[1].addr) && (rdp.timg.addr < (rdp.maincimg[1].addr + rdp.ci_width*rdp.ci_height*rdp.ci_size)))
|
||||
{
|
||||
if (fb_emulation_enabled)
|
||||
if (g_settings->fb_emulation_enabled())
|
||||
if (rdp.ci_count > 0 && rdp.frame_buffers[rdp.ci_count - 1].status == ci_copy_self)
|
||||
{
|
||||
//WriteTrace(TraceRDP, TraceDebug, "Wrong Texrect. texaddr: %08lx, cimg: %08lx, cimg_end: %08lx", rdp.timg.addr, rdp.maincimg[1], rdp.maincimg[1]+rdp.ci_width*rdp.ci_height*rdp.ci_size);
|
||||
|
@ -1916,9 +1921,11 @@ static void rdp_loadblock()
|
|||
tile, ul_s, ul_t, lr_s,
|
||||
dxt, _dxt);
|
||||
|
||||
if (fb_hwfbe_enabled)
|
||||
if (g_settings->fb_hwfbe_enabled())
|
||||
{
|
||||
setTBufTex(rdp.tiles[tile].t_mem, cnt);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void loadTile(uint32_t *src, uint32_t *dst, int width, int height, int line, int off, uint32_t *end)
|
||||
{
|
||||
|
@ -2101,12 +2108,17 @@ static void rdp_loadtile()
|
|||
info.tile_ul_t = ul_t;
|
||||
info.tile_width = (rdp.tiles[tile].mask_s ? minval((uint16_t)width, 1 << rdp.tiles[tile].mask_s) : (uint16_t)width);
|
||||
info.tile_height = (rdp.tiles[tile].mask_t ? minval((uint16_t)height, 1 << rdp.tiles[tile].mask_t) : (uint16_t)height);
|
||||
if (g_settings->hacks&hack_MK64) {
|
||||
if (g_settings->hacks&hack_MK64)
|
||||
{
|
||||
if (info.tile_width % 2)
|
||||
{
|
||||
info.tile_width--;
|
||||
}
|
||||
if (info.tile_height % 2)
|
||||
{
|
||||
info.tile_height--;
|
||||
}
|
||||
}
|
||||
info.tex_width = rdp.timg.width;
|
||||
info.tex_size = rdp.timg.size;
|
||||
|
||||
|
@ -2137,9 +2149,11 @@ static void rdp_loadtile()
|
|||
WriteTrace(TraceRDP, TraceDebug, "loadtile: tile: %d, ul_s: %d, ul_t: %d, lr_s: %d, lr_t: %d", tile,
|
||||
ul_s, ul_t, lr_s, lr_t);
|
||||
|
||||
if (fb_hwfbe_enabled)
|
||||
if (g_settings->fb_hwfbe_enabled())
|
||||
{
|
||||
setTBufTex(rdp.tiles[tile].t_mem, rdp.tiles[tile].line*height);
|
||||
}
|
||||
}
|
||||
|
||||
static void rdp_settile()
|
||||
{
|
||||
|
@ -2173,7 +2187,7 @@ static void rdp_settile()
|
|||
tile->t_mem, tile->palette, str_cm[(tile->clamp_t << 1) | tile->mirror_t], tile->mask_t,
|
||||
tile->shift_t, str_cm[(tile->clamp_s << 1) | tile->mirror_s], tile->mask_s, tile->shift_s);
|
||||
|
||||
if (fb_hwfbe_enabled && rdp.last_tile < rdp.cur_tile + 2)
|
||||
if (g_settings->fb_hwfbe_enabled() && rdp.last_tile < rdp.cur_tile + 2)
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
|
@ -2214,7 +2228,7 @@ static void rdp_fillrect()
|
|||
return;
|
||||
}
|
||||
int pd_multiplayer = (g_settings->ucode == ucode_PerfectDark) && (rdp.cycle_mode == 3) && (rdp.fill_color == 0xFFFCFFFC);
|
||||
if ((rdp.cimg == rdp.zimg) || (fb_emulation_enabled && rdp.ci_count > 0 && rdp.frame_buffers[rdp.ci_count - 1].status == ci_zimg) || pd_multiplayer)
|
||||
if ((rdp.cimg == rdp.zimg) || (g_settings->fb_emulation_enabled() && rdp.ci_count > 0 && rdp.frame_buffers[rdp.ci_count - 1].status == ci_zimg) || pd_multiplayer)
|
||||
{
|
||||
WriteTrace(TraceRDP, TraceDebug, "Fillrect - cleared the depth buffer");
|
||||
if (!(g_settings->hacks&hack_Hyperbike) || rdp.ci_width > 64) //do not clear main depth buffer for aux depth buffers
|
||||
|
@ -2524,7 +2538,7 @@ static void rdp_settextureimage()
|
|||
}
|
||||
}
|
||||
|
||||
if (fb_hwfbe_enabled) //search this texture among drawn texture buffers
|
||||
if (g_settings->fb_hwfbe_enabled()) //search this texture among drawn texture buffers
|
||||
FindTextureBuffer(rdp.timg.addr, rdp.timg.width);
|
||||
|
||||
WriteTrace(TraceRDP, TraceDebug, "settextureimage: format: %s, size: %s, width: %d, addr: %08lx",
|
||||
|
@ -2562,7 +2576,7 @@ static uint32_t swapped_addr = 0;
|
|||
|
||||
static void rdp_setcolorimage()
|
||||
{
|
||||
if (fb_emulation_enabled && (rdp.num_of_ci < NUMTEXBUF))
|
||||
if (g_settings->fb_emulation_enabled() && (rdp.num_of_ci < NUMTEXBUF))
|
||||
{
|
||||
COLOR_IMAGE & cur_fb = rdp.frame_buffers[rdp.ci_count];
|
||||
COLOR_IMAGE & prev_fb = rdp.frame_buffers[rdp.ci_count ? rdp.ci_count - 1 : 0];
|
||||
|
@ -2583,7 +2597,7 @@ static void rdp_setcolorimage()
|
|||
rdp.scale_x = sx;
|
||||
rdp.scale_y = sy;
|
||||
}
|
||||
if (!fb_hwfbe_enabled)
|
||||
if (!g_settings->fb_hwfbe_enabled())
|
||||
{
|
||||
if ((rdp.num_of_ci > 1) &&
|
||||
(next_fb.status == ci_aux) &&
|
||||
|
@ -2596,14 +2610,14 @@ static void rdp_setcolorimage()
|
|||
else if (rdp.copy_ci_index && (g_settings->hacks&hack_PMario)) //tidal wave
|
||||
OpenTextureBuffer(rdp.frame_buffers[rdp.main_ci_index]);
|
||||
}
|
||||
else if (!rdp.motionblur && fb_hwfbe_enabled && !SwapOK && (rdp.ci_count <= rdp.copy_ci_index))
|
||||
else if (!rdp.motionblur && g_settings->fb_hwfbe_enabled() && !SwapOK && (rdp.ci_count <= rdp.copy_ci_index))
|
||||
{
|
||||
if (next_fb.status == ci_aux_copy)
|
||||
OpenTextureBuffer(rdp.frame_buffers[rdp.main_ci_index]);
|
||||
else
|
||||
OpenTextureBuffer(rdp.frame_buffers[rdp.copy_ci_index]);
|
||||
}
|
||||
else if (fb_hwfbe_enabled && prev_fb.status == ci_aux)
|
||||
else if (g_settings->fb_hwfbe_enabled() && prev_fb.status == ci_aux)
|
||||
{
|
||||
if (rdp.motionblur)
|
||||
{
|
||||
|
@ -2625,7 +2639,7 @@ static void rdp_setcolorimage()
|
|||
break;
|
||||
case ci_copy:
|
||||
{
|
||||
if (!rdp.motionblur || (g_settings->frame_buffer&fb_motionblur))
|
||||
if (!rdp.motionblur || g_settings->fb_motionblur_enabled())
|
||||
{
|
||||
if (cur_fb.width == rdp.ci_width)
|
||||
{
|
||||
|
@ -2673,13 +2687,13 @@ static void rdp_setcolorimage()
|
|||
CopyFrameBuffer();
|
||||
rdp.fb_drawn = TRUE;
|
||||
}
|
||||
if (fb_hwfbe_enabled)
|
||||
if (g_settings->fb_hwfbe_enabled())
|
||||
OpenTextureBuffer(cur_fb);
|
||||
}
|
||||
break;
|
||||
case ci_old_copy:
|
||||
{
|
||||
if (!rdp.motionblur || (g_settings->frame_buffer&fb_motionblur))
|
||||
if (!rdp.motionblur || g_settings->fb_motionblur_enabled())
|
||||
{
|
||||
if (cur_fb.width == rdp.ci_width)
|
||||
{
|
||||
|
@ -2704,12 +2718,12 @@ static void rdp_setcolorimage()
|
|||
*/
|
||||
case ci_aux:
|
||||
{
|
||||
if (!fb_hwfbe_enabled && cur_fb.format != 0)
|
||||
if (!g_settings->fb_hwfbe_enabled() && cur_fb.format != 0)
|
||||
rdp.skip_drawing = TRUE;
|
||||
else
|
||||
{
|
||||
rdp.skip_drawing = FALSE;
|
||||
if (fb_hwfbe_enabled && OpenTextureBuffer(cur_fb))
|
||||
if (g_settings->fb_hwfbe_enabled() && OpenTextureBuffer(cur_fb))
|
||||
;
|
||||
else
|
||||
{
|
||||
|
@ -2723,7 +2737,7 @@ static void rdp_setcolorimage()
|
|||
rdp.scale_y = 1.0f;
|
||||
// }
|
||||
}
|
||||
else if (!fb_hwfbe_enabled && (prev_fb.status == ci_main) &&
|
||||
else if (!g_settings->fb_hwfbe_enabled() && (prev_fb.status == ci_main) &&
|
||||
(prev_fb.width == cur_fb.width)) // for Pokemon Stadium
|
||||
CopyFrameBuffer();
|
||||
}
|
||||
|
@ -2734,7 +2748,7 @@ static void rdp_setcolorimage()
|
|||
case ci_zimg:
|
||||
if (g_settings->ucode != ucode_PerfectDark)
|
||||
{
|
||||
if (fb_hwfbe_enabled && !rdp.copy_ci_index && (rdp.copy_zi_index || (g_settings->hacks&hack_BAR)))
|
||||
if (g_settings->fb_hwfbe_enabled() && !rdp.copy_ci_index && (rdp.copy_zi_index || (g_settings->hacks&hack_BAR)))
|
||||
{
|
||||
GrLOD_t LOD = GR_LOD_LOG2_1024;
|
||||
if (g_settings->scr_res_x > 1024)
|
||||
|
@ -2750,7 +2764,7 @@ static void rdp_setcolorimage()
|
|||
case ci_zcopy:
|
||||
if (g_settings->ucode != ucode_PerfectDark)
|
||||
{
|
||||
if (fb_hwfbe_enabled && !rdp.copy_ci_index && rdp.copy_zi_index == rdp.ci_count)
|
||||
if (g_settings->fb_hwfbe_enabled() && !rdp.copy_ci_index && rdp.copy_zi_index == rdp.ci_count)
|
||||
{
|
||||
CopyDepthBuffer();
|
||||
}
|
||||
|
@ -2761,8 +2775,10 @@ static void rdp_setcolorimage()
|
|||
rdp.skip_drawing = TRUE;
|
||||
break;
|
||||
case ci_copy_self:
|
||||
if (fb_hwfbe_enabled && (rdp.ci_count <= rdp.copy_ci_index) && (!SwapOK || g_settings->swapmode == 2))
|
||||
if (g_settings->fb_hwfbe_enabled() && (rdp.ci_count <= rdp.copy_ci_index) && (!SwapOK || g_settings->swapmode == 2))
|
||||
{
|
||||
OpenTextureBuffer(cur_fb);
|
||||
}
|
||||
rdp.skip_drawing = FALSE;
|
||||
break;
|
||||
default:
|
||||
|
@ -2771,19 +2787,19 @@ static void rdp_setcolorimage()
|
|||
|
||||
if ((rdp.ci_count > 0) && (prev_fb.status >= ci_aux)) //for Pokemon Stadium
|
||||
{
|
||||
if (!fb_hwfbe_enabled && prev_fb.format == 0)
|
||||
if (!g_settings->fb_hwfbe_enabled() && prev_fb.format == 0)
|
||||
CopyFrameBuffer();
|
||||
else if ((g_settings->hacks&hack_Knockout) && prev_fb.width < 100)
|
||||
CopyFrameBuffer(GR_BUFFER_TEXTUREBUFFER_EXT);
|
||||
}
|
||||
if (!fb_hwfbe_enabled && cur_fb.status == ci_copy)
|
||||
if (!g_settings->fb_hwfbe_enabled() && cur_fb.status == ci_copy)
|
||||
{
|
||||
if (!rdp.motionblur && (rdp.num_of_ci > rdp.ci_count + 1) && (next_fb.status != ci_aux))
|
||||
{
|
||||
RestoreScale();
|
||||
}
|
||||
}
|
||||
if (!fb_hwfbe_enabled && cur_fb.status == ci_aux)
|
||||
if (!g_settings->fb_hwfbe_enabled() && cur_fb.status == ci_aux)
|
||||
{
|
||||
if (cur_fb.format == 0)
|
||||
{
|
||||
|
@ -2840,10 +2856,10 @@ static void rdp_setcolorimage()
|
|||
WriteTrace(TraceRDP, TraceDebug, "return to original scale");
|
||||
rdp.scale_x = rdp.scale_x_bak;
|
||||
rdp.scale_y = rdp.scale_y_bak;
|
||||
if (fb_hwfbe_enabled && !rdp.read_whole_frame)
|
||||
if (g_settings->fb_hwfbe_enabled() && !rdp.read_whole_frame)
|
||||
CloseTextureBuffer();
|
||||
}
|
||||
if (fb_hwfbe_enabled && !rdp.read_whole_frame && (prev_fb.status >= ci_aux) && (rdp.ci_count > rdp.copy_ci_index))
|
||||
if (g_settings->fb_hwfbe_enabled() && !rdp.read_whole_frame && (prev_fb.status >= ci_aux) && (rdp.ci_count > rdp.copy_ci_index))
|
||||
CloseTextureBuffer();
|
||||
}
|
||||
rdp.ci_status = cur_fb.status;
|
||||
|
@ -2853,7 +2869,7 @@ static void rdp_setcolorimage()
|
|||
rdp.ocimg = rdp.cimg;
|
||||
rdp.cimg = segoffset(rdp.cmd1) & BMASK;
|
||||
rdp.ci_width = (rdp.cmd0 & 0xFFF) + 1;
|
||||
if (fb_emulation_enabled && rdp.ci_count > 0)
|
||||
if (g_settings->fb_emulation_enabled() && rdp.ci_count > 0)
|
||||
rdp.ci_height = rdp.frame_buffers[rdp.ci_count - 1].height;
|
||||
else if (rdp.ci_width == 32)
|
||||
rdp.ci_height = 32;
|
||||
|
@ -2875,7 +2891,7 @@ static void rdp_setcolorimage()
|
|||
{
|
||||
if (!rdp.cur_image)
|
||||
{
|
||||
if (fb_hwfbe_enabled && rdp.ci_width <= 64 && rdp.ci_count > 0)
|
||||
if (g_settings->fb_hwfbe_enabled() && rdp.ci_width <= 64 && rdp.ci_count > 0)
|
||||
OpenTextureBuffer(rdp.frame_buffers[rdp.ci_count - 1]);
|
||||
else if (format > 2)
|
||||
rdp.skip_drawing = TRUE;
|
||||
|
@ -2884,7 +2900,7 @@ static void rdp_setcolorimage()
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!fb_emulation_enabled)
|
||||
if (!g_settings->fb_emulation_enabled())
|
||||
rdp.skip_drawing = FALSE;
|
||||
}
|
||||
|
||||
|
@ -2897,16 +2913,20 @@ static void rdp_setcolorimage()
|
|||
int viSwapOK = ((g_settings->swapmode == 2) && (rdp.vi_org_reg == *gfx.VI_ORIGIN_REG)) ? FALSE : TRUE;
|
||||
if ((rdp.zimg != rdp.cimg) && (rdp.ocimg != rdp.cimg) && SwapOK && viSwapOK && !rdp.cur_image)
|
||||
{
|
||||
if (fb_emulation_enabled)
|
||||
if (g_settings->fb_emulation_enabled())
|
||||
{
|
||||
rdp.maincimg[0] = rdp.frame_buffers[rdp.main_ci_index];
|
||||
}
|
||||
else
|
||||
{
|
||||
rdp.maincimg[0].addr = rdp.cimg;
|
||||
}
|
||||
rdp.last_drawn_ci_addr = (g_settings->swapmode == 2) ? swapped_addr : rdp.maincimg[0].addr;
|
||||
swapped_addr = rdp.cimg;
|
||||
newSwapBuffers();
|
||||
rdp.vi_org_reg = *gfx.VI_ORIGIN_REG;
|
||||
SwapOK = FALSE;
|
||||
if (fb_hwfbe_enabled)
|
||||
if (g_settings->fb_hwfbe_enabled())
|
||||
{
|
||||
if (rdp.copy_ci_index && (rdp.frame_buffers[rdp.ci_count - 1].status != ci_zimg))
|
||||
{
|
||||
|
@ -3070,7 +3090,7 @@ EXPORT void CALL FBRead(uint32_t addr)
|
|||
{
|
||||
uint32_t cimg = rdp.cimg;
|
||||
rdp.cimg = rdp.maincimg[1].addr;
|
||||
if (fb_emulation_enabled)
|
||||
if (g_settings->fb_emulation_enabled())
|
||||
{
|
||||
rdp.ci_width = rdp.maincimg[1].width;
|
||||
rdp.ci_count = 0;
|
||||
|
@ -3171,11 +3191,13 @@ EXPORT void CALL FBGetFrameBufferInfo(void *p)
|
|||
WriteTrace(TraceGlide64, TraceDebug, "-");
|
||||
FrameBufferInfo * pinfo = (FrameBufferInfo *)p;
|
||||
memset(pinfo, 0, sizeof(FrameBufferInfo) * 6);
|
||||
if (!(g_settings->frame_buffer&fb_get_info))
|
||||
if (!g_settings->fb_get_info_enabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
WriteTrace(TraceRDP, TraceDebug, "FBGetFrameBufferInfo ()");
|
||||
//*
|
||||
if (fb_emulation_enabled)
|
||||
|
||||
if (g_settings->fb_emulation_enabled())
|
||||
{
|
||||
pinfo[0].addr = rdp.maincimg[1].addr;
|
||||
pinfo[0].size = rdp.maincimg[1].size;
|
||||
|
@ -3338,10 +3360,10 @@ void DetectFrameBufferUsage()
|
|||
rdp.num_of_ci = rdp.ci_count;
|
||||
if (rdp.read_previous_ci && previous_ci_was_read)
|
||||
{
|
||||
if (!fb_hwfbe_enabled || !rdp.copy_ci_index)
|
||||
if (!g_settings->fb_hwfbe_enabled() || !rdp.copy_ci_index)
|
||||
rdp.motionblur = TRUE;
|
||||
}
|
||||
if (rdp.motionblur || fb_hwfbe_enabled || (rdp.frame_buffers[rdp.copy_ci_index].status == ci_aux_copy))
|
||||
if (rdp.motionblur || g_settings->fb_hwfbe_enabled() || (rdp.frame_buffers[rdp.copy_ci_index].status == ci_aux_copy))
|
||||
{
|
||||
rdp.scale_x = rdp.scale_x_bak;
|
||||
rdp.scale_y = rdp.scale_y_bak;
|
||||
|
@ -3351,7 +3373,7 @@ void DetectFrameBufferUsage()
|
|||
rdp.read_whole_frame = TRUE;
|
||||
if (rdp.read_whole_frame)
|
||||
{
|
||||
if (fb_hwfbe_enabled)
|
||||
if (g_settings->fb_hwfbe_enabled())
|
||||
{
|
||||
if (rdp.read_previous_ci && !previous_ci_was_read && (g_settings->swapmode != 2) && (g_settings->ucode != ucode_PerfectDark))
|
||||
{
|
||||
|
@ -3371,11 +3393,15 @@ void DetectFrameBufferUsage()
|
|||
{
|
||||
if (rdp.motionblur)
|
||||
{
|
||||
if (g_settings->frame_buffer&fb_motionblur)
|
||||
if (g_settings->fb_motionblur_enabled())
|
||||
{
|
||||
CopyFrameBuffer();
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(gfx.RDRAM + rdp.cimg, 0, rdp.ci_width*rdp.ci_height*rdp.ci_size);
|
||||
}
|
||||
}
|
||||
else //if (ci_width == rdp.frame_buffers[rdp.main_ci_index].width)
|
||||
{
|
||||
if (rdp.maincimg[0].height > 65) //for 1080
|
||||
|
@ -3396,7 +3422,7 @@ void DetectFrameBufferUsage()
|
|||
}
|
||||
}
|
||||
|
||||
if (fb_hwfbe_enabled)
|
||||
if (g_settings->fb_hwfbe_enabled())
|
||||
{
|
||||
for (i = 0; i < voodoo.num_tmu; i++)
|
||||
{
|
||||
|
|
|
@ -246,12 +246,12 @@ void DrawHiresDepthImage(const DRAWIMAGE & d)
|
|||
|
||||
void DrawDepthImage(const DRAWIMAGE & d)
|
||||
{
|
||||
if (!fb_depth_render_enabled)
|
||||
if (!g_settings->fb_depth_render_enabled())
|
||||
return;
|
||||
if (d.imageH > d.imageW)
|
||||
return;
|
||||
WriteTrace(TraceRDP, TraceDebug, "Depth image write");
|
||||
if (fb_hwfbe_enabled)
|
||||
if (g_settings->fb_hwfbe_enabled())
|
||||
{
|
||||
DrawHiresDepthImage(d);
|
||||
return;
|
||||
|
@ -728,7 +728,7 @@ static void uc6_bg(bool bg_1cyc)
|
|||
DRAWIMAGE d;
|
||||
uc6_read_background_data(d, bg_1cyc);
|
||||
|
||||
if (fb_hwfbe_enabled && FindTextureBuffer(d.imagePtr, d.imageW))
|
||||
if (g_settings->fb_hwfbe_enabled() && FindTextureBuffer(d.imagePtr, d.imageW))
|
||||
{
|
||||
DrawHiresImage(d);
|
||||
return;
|
||||
|
|
|
@ -222,7 +222,7 @@ static void fb_settextureimage()
|
|||
rdp.scale_y = 1.0f;
|
||||
}
|
||||
}
|
||||
else if (!(g_settings->frame_buffer & fb_ignore_aux_copy) && cur_fb.width < rdp.frame_buffers[rdp.main_ci_index].width)
|
||||
else if (!g_settings->fb_ignore_aux_copy_enabled() && cur_fb.width < rdp.frame_buffers[rdp.main_ci_index].width)
|
||||
{
|
||||
rdp.copy_ci_index = rdp.ci_count - 1;
|
||||
cur_fb.status = ci_aux_copy;
|
||||
|
@ -268,7 +268,7 @@ static void fb_settextureimage()
|
|||
WriteTrace(TraceRDP, TraceDebug, "read_previous_ci = TRUE");
|
||||
}
|
||||
}
|
||||
else if (fb_hwfbe_enabled && (cur_fb.status == ci_main))
|
||||
else if (g_settings->fb_hwfbe_enabled() && (cur_fb.status == ci_main))
|
||||
{
|
||||
if ((addr >= rdp.main_ci) && (addr < rdp.main_ci_end)) //addr within main frame buffer
|
||||
{
|
||||
|
@ -407,7 +407,7 @@ static void fb_setcolorimage()
|
|||
}
|
||||
if (rdp.ci_count > 0 && rdp.frame_buffers[rdp.ci_count - 1].status == ci_unknown) //status of previous fb was not changed - it is useless
|
||||
{
|
||||
if (fb_hwfbe_enabled && !(g_settings->frame_buffer & fb_useless_is_useless))
|
||||
if (g_settings->fb_hwfbe_enabled() && !g_settings->fb_useless_is_useless_enabled())
|
||||
{
|
||||
rdp.frame_buffers[rdp.ci_count - 1].status = ci_aux;
|
||||
rdp.frame_buffers[rdp.ci_count - 1].changed = 0;
|
||||
|
|
|
@ -138,7 +138,6 @@ FullScreenResolutions::~FullScreenResolutions()
|
|||
|
||||
void FullScreenResolutions::init()
|
||||
{
|
||||
WriteTrace(TraceGlitch, TraceDebug, "executing");
|
||||
#ifdef _WIN32
|
||||
currentResolutions = -1;
|
||||
DEVMODE enumMode , currentMode;
|
||||
|
|
Loading…
Reference in New Issue