1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-02 09:03:37 +00:00

Create frameBufferEmulation section in Config.

This commit is contained in:
Sergey Lipskiy 2014-04-05 22:36:20 +07:00
parent 338f1f1fb6
commit 28133f2387
9 changed files with 22 additions and 19 deletions

View File

@ -83,7 +83,7 @@ void Config_LoadConfig()
cache.maxBytes = value * 1048576;
RegQueryValueEx( hKey, "Hardware Frame Buffer Textures", 0, NULL, (BYTE*)&value, &size );
config.frameBufferEmulation = value ? TRUE : FALSE;
config.frameBufferEmulation.enable = value ? TRUE : FALSE;
RegQueryValueEx( hKey, "Hardware lighting", 0, NULL, (BYTE*)&value, &size );
config.enableHWLighting = value ? TRUE : FALSE;
@ -104,7 +104,7 @@ void Config_LoadConfig()
config.video.fullscreenRefresh = 60;
config.texture.forceBilinear = FALSE;
cache.maxBytes = 32 * 1048576;
config.frameBufferEmulation = FALSE;
config.frameBufferEmulation.enable = FALSE;
config.texture.enable2xSaI = FALSE;
config.texture.textureBitDepth = 1;
config.enableHWLighting = FALSE;
@ -137,7 +137,7 @@ void Config_SaveConfig()
value = cache.maxBytes / 1048576;
RegSetValueEx( hKey, "Texture Cache Size", 0, REG_DWORD, (BYTE*)&value, 4 );
value = config.frameBufferEmulation ? 1 : 0;
value = config.frameBufferEmulation.enable ? 1 : 0;
RegSetValueEx( hKey, "Hardware Frame Buffer Textures", 0, REG_DWORD, (BYTE*)&value, 4 );
value = config.enableHWLighting ? 1 : 0;
@ -175,7 +175,7 @@ void Config_ApplyDlgConfig( HWND hWndDlg )
config.video.windowedWidth = windowedModes[i].width;
config.video.windowedHeight = windowedModes[i].height;
config.frameBufferEmulation = (SendDlgItemMessage( hWndDlg, IDC_FRAMEBUFFER, BM_GETCHECK, NULL, NULL ) == BST_CHECKED);
config.frameBufferEmulation.enable = (SendDlgItemMessage( hWndDlg, IDC_FRAMEBUFFER, BM_GETCHECK, NULL, NULL ) == BST_CHECKED);
config.enableHWLighting = (SendDlgItemMessage( hWndDlg, IDC_HWLIGHT, BM_GETCHECK, NULL, NULL ) == BST_CHECKED);
if (!OGL.fullscreen)
@ -329,7 +329,7 @@ BOOL CALLBACK ConfigDlgProc( HWND hWndDlg, UINT message, WPARAM wParam, LPARAM l
SendDlgItemMessage( hWndDlg, IDC_TEXTUREBPP, CB_SETCURSEL, config.texture.textureBitDepth, 0 );
// Enable/disable fog
SendDlgItemMessage( hWndDlg, IDC_FOG, BM_SETCHECK, config.enableFog ? (LPARAM)BST_CHECKED : (LPARAM)BST_UNCHECKED, NULL );
SendDlgItemMessage( hWndDlg, IDC_FRAMEBUFFER, BM_SETCHECK, config.frameBufferEmulation ? (LPARAM)BST_CHECKED : (LPARAM)BST_UNCHECKED, NULL );
SendDlgItemMessage( hWndDlg, IDC_FRAMEBUFFER, BM_SETCHECK, config.frameBufferEmulation.enable ? (LPARAM)BST_CHECKED : (LPARAM)BST_UNCHECKED, NULL );
SendDlgItemMessage( hWndDlg, IDC_HWLIGHT, BM_SETCHECK, config.enableHWLighting ? (LPARAM)BST_CHECKED : (LPARAM)BST_UNCHECKED, NULL );

View File

@ -23,7 +23,10 @@ struct Config
u32 pow2;
} texture;
u32 frameBufferEmulation;
struct {
u32 enable;
} frameBufferEmulation;
u32 enableFog;
u32 enableNoise;
u32 enableHWLighting;

View File

@ -78,7 +78,7 @@ static void okButton_clicked( GtkWidget *widget, void *data )
config.texture.forceBilinear = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(forceBilinearCheck) );
config.texture.enable2xSaI = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(enable2xSAICheck) );
config.enableFog = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(enableFogCheck) );
config.frameBufferEmulation = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(enableHardwareFBCheck) );
config.frameBufferEmulation.enable = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(enableHardwareFBCheck) );
config.enableHWLighting = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(enableHardwareLighting) );
const char *depth = gtk_entry_get_text( GTK_ENTRY(GTK_COMBO(textureDepthCombo)->entry) );
config.texture.textureBitDepth = 1;
@ -113,7 +113,7 @@ static void okButton_clicked( GtkWidget *widget, void *data )
fprintf( f, "force bilinear=%d\n", config.texture.forceBilinear );
fprintf( f, "enable 2xSAI=%d\n", config.texture.enable2xSaI );
fprintf( f, "enable fog=%d\n", config.enableFog );
fprintf( f, "enable HardwareFB=%d\n", config.frameBufferEmulation );
fprintf( f, "enable HardwareFB=%d\n", config.frameBufferEmulation.enable );
fprintf( f, "enable hardware lighting=%d\n", config.enableHWLighting );
fprintf( f, "texture depth=%d\n", config.texture.textureBitDepth );
fprintf( f, "cache size=%d\n", cache.maxBytes / 1048576 );
@ -155,7 +155,7 @@ static void configWindow_show( GtkWidget *widget, void *data )
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(enableHardwareLighting), (config.enableHWLighting) );
// textures
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(enableHardwareFBCheck), (config.frameBufferEmulation) );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(enableHardwareFBCheck), (config.frameBufferEmulation.enable) );
gtk_entry_set_text( GTK_ENTRY(GTK_COMBO(textureDepthCombo)->entry), textureBitDepth[config.texture.textureBitDepth] );
sprintf( text, "%d", cache.maxBytes / 1048576 );
gtk_entry_set_text( GTK_ENTRY(textureCacheEntry), text );
@ -374,7 +374,7 @@ void Config_LoadConfig()
config.texture.enable2xSaI = 0;
config.enableFog = 1;
config.texture.textureBitDepth = 1; // normal (16 & 32 bits)
config.frameBufferEmulation = 0;
config.frameBufferEmulation.enable = 0;
config.enableHWLighting = 0;
cache.maxBytes = 32 * 1048576;
@ -450,7 +450,7 @@ void Config_LoadConfig()
}
else if (!strcasecmp( line, "enable HardwareFB" ))
{
config.frameBufferEmulation = atoi( val );
config.frameBufferEmulation.enable = atoi( val );
}
else if (!strcasecmp( line, "enable hardware lighting" ))
{

View File

@ -34,7 +34,7 @@ Option configOptions[] =
{"texture depth", &config.texture.textureBitDepth, 1},
{"#Emulation Settings:", NULL, 0},
{"enable fog", &config.enableFog, 1},
{"enable HardwareFB", &config.frameBufferEmulation, 0}
{"enable HardwareFB", &config.frameBufferEmulation.enable, 0}
};
const int configOptionsSize = sizeof(configOptions) / sizeof(Option);

View File

@ -180,7 +180,7 @@ void DepthBuffer_SetBuffer( u32 address )
current->address = address;
current->width = pFrameBuffer != NULL ? pFrameBuffer->width : VI.width;
current->depth_texture = NULL;
if (config.frameBufferEmulation) {
if (config.frameBufferEmulation.enable) {
glGenRenderbuffers(1, &current->renderbuf);
glBindRenderbuffer(GL_RENDERBUFFER, current->renderbuf);
if (pFrameBuffer != NULL)
@ -190,7 +190,7 @@ void DepthBuffer_SetBuffer( u32 address )
}
}
if (config.frameBufferEmulation) {
if (config.frameBufferEmulation.enable) {
FrameBuffer_AttachDepthBuffer();
#ifdef DEBUG

View File

@ -1041,7 +1041,7 @@ void OGL_DrawTexturedRect( float ulx, float uly, float lrx, float lry, float uls
void OGL_ClearDepthBuffer()
{
if (config.frameBufferEmulation && frameBuffer.top == NULL)
if (config.frameBufferEmulation.enable && frameBuffer.top == NULL)
return;
DepthBuffer_ClearBuffer();

2
VI.cpp
View File

@ -56,7 +56,7 @@ void VI_UpdateScreen()
if (((*REG.VI_STATUS)&3) == 0)
VI.vStart = VI.vEnd = 0;
if (config.frameBufferEmulation) {
if (config.frameBufferEmulation.enable) {
const bool bCFB = !g_bIgnoreCFB && (gSP.changed&CHANGED_CPU_FB_WRITE) == CHANGED_CPU_FB_WRITE;
const bool bNeedUpdate = bCFB ? true : (*REG.VI_ORIGIN != VI.lastOrigin);// && gDP.colorImage.changed;

View File

@ -269,7 +269,7 @@ void gDPSetColorImage( u32 format, u32 size, u32 width, u32 address )
else
height = gSP.viewport.height;
if (config.frameBufferEmulation)// && address != gDP.depthImageAddress)
if (config.frameBufferEmulation.enable)// && address != gDP.depthImageAddress)
{
//if (gDP.colorImage.changed)
FrameBuffer_SaveBuffer( address, (u16)format, (u16)size, (u16)width, height );
@ -497,7 +497,7 @@ bool CheckForFrameBufferTexture(u32 _address, u32 _bytes)
gDP.loadTile->textureMode = TEXTUREMODE_NORMAL;
gDP.loadTile->frameBuffer = NULL;
gDP.changed |= CHANGED_TMEM;
if (!config.frameBufferEmulation)
if (!config.frameBufferEmulation.enable)
return false;
FrameBuffer *pBuffer = FrameBuffer_FindBuffer( _address );

View File

@ -1729,7 +1729,7 @@ void loadBGImage(const uObjScaleBg * _bgInfo, bool _loadScale)
} else
gSP.bgImage.scaleW = gSP.bgImage.scaleH = 1.0f;
if (config.frameBufferEmulation)
if (config.frameBufferEmulation.enable)
{
FrameBuffer *buffer;
if (((buffer = FrameBuffer_FindBuffer( gSP.bgImage.address )) != NULL) &&