gfx3d: make 'alternate flush mode' emulation option. this option toggles between two methods, neither of which is entirely accurate such that under one of the modes, certain games are unplayable. if a game is fixed by alternate flush mode, please report it in the bug tracker under that category for data collecting purposes. also hooked up this option in windows.

This commit is contained in:
zeromus 2009-05-19 03:26:15 +00:00
parent 522ef7db4d
commit 133b9866b6
5 changed files with 24 additions and 6 deletions

View File

@ -357,6 +357,7 @@ extern struct TCommonSettings {
, wifiBridgeAdapterNum(0) , wifiBridgeAdapterNum(0)
, spuInterpolationMode(SPUInterpolation_Linear) , spuInterpolationMode(SPUInterpolation_Linear)
, spuAdpcmCache(false) , spuAdpcmCache(false)
, gfx3d_flushMode(0)
{ {
strcpy(ARM9BIOS, "biosnds9.bin"); strcpy(ARM9BIOS, "biosnds9.bin");
strcpy(ARM7BIOS, "biosnds7.bin"); strcpy(ARM7BIOS, "biosnds7.bin");
@ -376,6 +377,9 @@ extern struct TCommonSettings {
bool DebugConsole; bool DebugConsole;
int wifiBridgeAdapterNum; int wifiBridgeAdapterNum;
//this is a temporary hack until we straighten out the flushing logic and/or gxfifo
int gfx3d_flushMode;
SPUInterpolationMode spuInterpolationMode; SPUInterpolationMode spuInterpolationMode;
bool spuAdpcmCache; bool spuAdpcmCache;

View File

@ -39,6 +39,7 @@
#include "mem.h" #include "mem.h"
#include "types.h" #include "types.h"
#include "saves.h" #include "saves.h"
#include "NDSSystem.h"
#include "readwrite.h" #include "readwrite.h"
#include "FIFO.h" #include "FIFO.h"
@ -1397,8 +1398,10 @@ void gfx3d_glFlush(u32 v)
flushPending = TRUE; flushPending = TRUE;
gfx3d.sortmode = BIT0(v); gfx3d.sortmode = BIT0(v);
gfx3d.wbuffer = BIT1(v); gfx3d.wbuffer = BIT1(v);
//see discussion at top of file //see discussion at top of file
gfx3d_doFlush(); if(CommonSettings.gfx3d_flushMode == 0)
gfx3d_doFlush();
} }
static int _CDECL_ gfx3d_ysort_compare_old_qsort(const void * elem1, const void * elem2) static int _CDECL_ gfx3d_ysort_compare_old_qsort(const void * elem1, const void * elem2)
@ -1516,7 +1519,8 @@ void gfx3d_VBlankSignal()
} }
//see discussion at top of file //see discussion at top of file
//gfx3d_doFlush(); if(CommonSettings.gfx3d_flushMode == 1)
gfx3d_doFlush();
} }
void gfx3d_VBlankEndSignal(bool skipFrame) void gfx3d_VBlankEndSignal(bool skipFrame)

View File

@ -1829,6 +1829,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
cur3DCore = GetPrivateProfileInt("3D", "Renderer", GPU3D_OPENGL, IniName); cur3DCore = GetPrivateProfileInt("3D", "Renderer", GPU3D_OPENGL, IniName);
CommonSettings.HighResolutionInterpolateColor = GetPrivateProfileInt("3D", "HighResolutionInterpolateColor", 1, IniName); CommonSettings.HighResolutionInterpolateColor = GetPrivateProfileInt("3D", "HighResolutionInterpolateColor", 1, IniName);
CommonSettings.gfx3d_flushMode = GetPrivateProfileInt("3D", "AlternateFlush", 0, IniName);
NDS_3D_ChangeCore(cur3DCore); NDS_3D_ChangeCore(cur3DCore);
#ifdef BETA_VERSION #ifdef BETA_VERSION
@ -3589,6 +3590,7 @@ LRESULT CALLBACK GFX3DSettingsDlgProc(HWND hw, UINT msg, WPARAM wp, LPARAM lp)
int i; int i;
CheckDlgButton(hw,IDC_INTERPOLATECOLOR,CommonSettings.HighResolutionInterpolateColor?1:0); CheckDlgButton(hw,IDC_INTERPOLATECOLOR,CommonSettings.HighResolutionInterpolateColor?1:0);
CheckDlgButton(hw,IDC_ALTERNATEFLUSH,CommonSettings.gfx3d_flushMode);
for(i = 0; core3DList[i] != NULL; i++) for(i = 0; core3DList[i] != NULL; i++)
{ {
@ -3608,6 +3610,8 @@ LRESULT CALLBACK GFX3DSettingsDlgProc(HWND hw, UINT msg, WPARAM wp, LPARAM lp)
NDS_3D_ChangeCore(ComboBox_GetCurSel(GetDlgItem(hw, IDC_3DCORE))); NDS_3D_ChangeCore(ComboBox_GetCurSel(GetDlgItem(hw, IDC_3DCORE)));
WritePrivateProfileInt("3D", "Renderer", cur3DCore, IniName); WritePrivateProfileInt("3D", "Renderer", cur3DCore, IniName);
WritePrivateProfileInt("3D", "HighResolutionInterpolateColor", CommonSettings.HighResolutionInterpolateColor?1:0, IniName); WritePrivateProfileInt("3D", "HighResolutionInterpolateColor", CommonSettings.HighResolutionInterpolateColor?1:0, IniName);
CommonSettings.gfx3d_flushMode = (IsDlgButtonChecked(hw,IDC_ALTERNATEFLUSH) == BST_CHECKED)?1:0;
WritePrivateProfileInt("3D", "AlternateFlush", CommonSettings.gfx3d_flushMode, IniName);
} }
case IDCANCEL: case IDCANCEL:
{ {
@ -3620,6 +3624,8 @@ LRESULT CALLBACK GFX3DSettingsDlgProc(HWND hw, UINT msg, WPARAM wp, LPARAM lp)
NDS_3D_ChangeCore(GPU3D_OPENGL); NDS_3D_ChangeCore(GPU3D_OPENGL);
ComboBox_SetCurSel(GetDlgItem(hw, IDC_3DCORE), GPU3D_OPENGL); ComboBox_SetCurSel(GetDlgItem(hw, IDC_3DCORE), GPU3D_OPENGL);
WritePrivateProfileInt("3D", "Renderer", GPU3D_OPENGL, IniName); WritePrivateProfileInt("3D", "Renderer", GPU3D_OPENGL, IniName);
CommonSettings.gfx3d_flushMode = 0;
WritePrivateProfileInt("3D", "AlternateFlush", CommonSettings.gfx3d_flushMode, IniName);
} }
return TRUE; return TRUE;
} }

View File

@ -225,6 +225,7 @@
#define IDC_SOUNDCORECB 1000 #define IDC_SOUNDCORECB 1000
#define IDC_USEEXTBIOS 1000 #define IDC_USEEXTBIOS 1000
#define ID_BROWSE 1000 #define ID_BROWSE 1000
#define IDC_ALTERNATEFLUSH 1001
#define IDC_BGMAP_BGXCNT 1001 #define IDC_BGMAP_BGXCNT 1001
#define IDC_CHECKBOX_DEBUGGERMODE 1001 #define IDC_CHECKBOX_DEBUGGERMODE 1001
#define IDC_EDIT01 1001 #define IDC_EDIT01 1001

View File

@ -638,19 +638,22 @@ FONT 8, "MS Sans Serif"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
IDD_3DSETTINGS DIALOGEX 0, 0, 174, 120 IDD_3DSETTINGS DIALOGEX 0, 0, 174, 136
STYLE DS_MODALFRAME | DS_SETFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP | WS_SYSMENU STYLE DS_MODALFRAME | DS_SETFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP | WS_SYSMENU
CAPTION "3D settings" CAPTION "3D settings"
FONT 8, "MS Sans Serif", 0, 0, 0 FONT 8, "MS Sans Serif", 0, 0, 0
{ {
DEFPUSHBUTTON "OK", IDOK, 62, 92, 50, 14, BS_DEFPUSHBUTTON DEFPUSHBUTTON "OK", IDOK, 62, 111, 50, 14, BS_DEFPUSHBUTTON
PUSHBUTTON "Cancel", IDCANCEL, 117, 92, 50, 14, BS_PUSHBUTTON PUSHBUTTON "Cancel", IDCANCEL, 117, 111, 50, 14, BS_PUSHBUTTON
PUSHBUTTON "Default", IDC_DEFAULT, 7, 92, 50, 14, BS_PUSHBUTTON PUSHBUTTON "Default", IDC_DEFAULT, 7, 111, 50, 14, BS_PUSHBUTTON
GROUPBOX "Renderer:", IDC_STATIC, 7, 7, 160, 39 GROUPBOX "Renderer:", IDC_STATIC, 7, 7, 160, 39
COMBOBOX IDC_3DCORE, 15, 23, 146, 138, WS_TABSTOP | WS_VSCROLL | WS_TABSTOP | CBS_DROPDOWNLIST COMBOBOX IDC_3DCORE, 15, 23, 146, 138, WS_TABSTOP | WS_VSCROLL | WS_TABSTOP | CBS_DROPDOWNLIST
AUTOCHECKBOX "Unrealistically High-Precision Color Interpolation", IDC_INTERPOLATECOLOR, 9, 55, 165, 10, BS_AUTOCHECKBOX AUTOCHECKBOX "Unrealistically High-Precision Color Interpolation", IDC_INTERPOLATECOLOR, 9, 55, 165, 10, BS_AUTOCHECKBOX
LTEXT "(Presently only effective for SoftRasterizer)", IDC_STATIC, 21, 65, 134, 8, SS_LEFT LTEXT "(Presently only effective for SoftRasterizer)", IDC_STATIC, 21, 65, 134, 8, SS_LEFT
AUTOCHECKBOX "Alternate Flush Mode", IDC_ALTERNATEFLUSH, 9, 79, 83, 10, BS_AUTOCHECKBOX
LTEXT "(Fixes some games with flickering graphics)", IDC_STATIC, 21, 89, 136, 8, SS_LEFT
} }