apply patch #159 from tracker to add hack for softrasterizer text rendering improvement in some games

This commit is contained in:
zeromus 2014-02-09 08:28:48 +00:00
parent fd3b89bac2
commit 443b24cac2
5 changed files with 47 additions and 16 deletions

View File

@ -499,6 +499,7 @@ extern struct TCommonSettings {
, GFX3D_LineHack(true)
, GFX3D_Zelda_Shadow_Depth_Hack(0)
, GFX3D_Renderer_Multisample(false)
, GFX3D_TXTHack(false)
, jit_max_block_size(100)
, loadToMemory(false)
, UseExtBIOS(false)
@ -557,6 +558,7 @@ extern struct TCommonSettings {
bool GFX3D_LineHack;
int GFX3D_Zelda_Shadow_Depth_Hack;
bool GFX3D_Renderer_Multisample;
bool GFX3D_TXTHack;
bool loadToMemory;

View File

@ -477,13 +477,34 @@ public:
//finally, we can use floor here. but, it is slower than we want.
//the best solution is probably to wait until the pipeline is full of fixed point
s32 iu = s32floor(u);
s32 iv = s32floor(v);
sampler.dowrap(iu,iv);
//add TXT Hack options - tkd3
if(CommonSettings.GFX3D_TXTHack==false)
{
s32 iu = s32floor(u);
s32 iv = s32floor(v);
sampler.dowrap(iu,iv);
FragmentColor color;
color.color = ((u32*)lastTexKey->decoded)[(iv<<sampler.wshift)+iu];
return color;
}else{
s32 iu = round_s(u);
s32 iv = round_s(v);
sampler.dowrap(iu,iv);
FragmentColor color;
color.color = ((u32*)lastTexKey->decoded)[(iv<<sampler.wshift)+iu];
return color;
}
FragmentColor color;
color.color = ((u32*)lastTexKey->decoded)[(iv<<sampler.wshift)+iu];
return color;
}
//round function - tkd3
float round_s(double val){
if (val > 0.0 ){
return floorf(val*256.0f+0.5f)/256.0f; //this value(256.0) is good result.(I think)
} else {
return -1.0*floorf(fabs(val)*256.0f+0.5f)/256.0f;
}
}
struct Shader

View File

@ -3335,6 +3335,7 @@ int _main()
CommonSettings.GFX3D_Fog = GetPrivateProfileBool("3D", "EnableFog", 1, IniName);
CommonSettings.GFX3D_Texture = GetPrivateProfileBool("3D", "EnableTexture", 1, IniName);
CommonSettings.GFX3D_LineHack = GetPrivateProfileBool("3D", "EnableLineHack", 1, IniName);
CommonSettings.GFX3D_TXTHack = GetPrivateProfileBool("3D", "EnableTXTHack", 0, IniName); //default is off.
Change3DCoreWithFallbackAndSave(cur3DCore);
#ifdef BETA_VERSION
@ -6320,6 +6321,7 @@ LRESULT CALLBACK GFX3DSettingsDlgProc(HWND hw, UINT msg, WPARAM wp, LPARAM lp)
CheckDlgButton(hw,IDC_3DSETTINGS_FOG,CommonSettings.GFX3D_Fog);
CheckDlgButton(hw,IDC_3DSETTINGS_TEXTURE,CommonSettings.GFX3D_Texture);
CheckDlgButton(hw,IDC_3DSETTINGS_LINEHACK, CommonSettings.GFX3D_LineHack);
CheckDlgButton(hw,IDC_TXTHACK, CommonSettings.GFX3D_TXTHack);
SetDlgItemInt (hw,IDC_ZELDA_SHADOW_DEPTH_HACK,CommonSettings.GFX3D_Zelda_Shadow_Depth_Hack,FALSE);
//CheckDlgButton(hw,IDC_ALTERNATEFLUSH,CommonSettings.gfx3d_flushMode);
@ -6343,6 +6345,7 @@ LRESULT CALLBACK GFX3DSettingsDlgProc(HWND hw, UINT msg, WPARAM wp, LPARAM lp)
CommonSettings.GFX3D_Texture = IsDlgCheckboxChecked(hw,IDC_3DSETTINGS_TEXTURE);
CommonSettings.GFX3D_LineHack = IsDlgCheckboxChecked(hw,IDC_3DSETTINGS_LINEHACK);
CommonSettings.GFX3D_Zelda_Shadow_Depth_Hack = GetDlgItemInt(hw,IDC_ZELDA_SHADOW_DEPTH_HACK,NULL,FALSE);
CommonSettings.GFX3D_TXTHack = IsDlgCheckboxChecked(hw,IDC_TXTHACK);
Change3DCoreWithFallbackAndSave(ComboBox_GetCurSel(GetDlgItem(hw, IDC_3DCORE)));
WritePrivateProfileBool("3D", "HighResolutionInterpolateColor", CommonSettings.GFX3D_HighResolutionInterpolateColor, IniName);
@ -6351,6 +6354,7 @@ LRESULT CALLBACK GFX3DSettingsDlgProc(HWND hw, UINT msg, WPARAM wp, LPARAM lp)
WritePrivateProfileBool("3D", "EnableTexture", CommonSettings.GFX3D_Texture, IniName);
WritePrivateProfileInt ("3D", "ZeldaShadowDepthHack", CommonSettings.GFX3D_Zelda_Shadow_Depth_Hack, IniName);
WritePrivateProfileInt ("3D", "EnableLineHack", CommonSettings.GFX3D_LineHack, IniName);
WritePrivateProfileInt ("3D", "EnableTXTHack", CommonSettings.GFX3D_TXTHack, IniName);
//WritePrivateProfileInt("3D", "AlternateFlush", CommonSettings.gfx3d_flushMode, IniName);
}
case IDCANCEL:

View File

@ -1054,6 +1054,8 @@
#define IDM_RENDER_LQ2XS 60083
#define IDC_SAVETYPE 64000
#define IDC_AUTOLOADLUA 64001
#define IDC_TXTHACK 64002
#define ID_LABEL_TXTHACK1 64003
// Next default values for new objects
//

View File

@ -112,26 +112,28 @@ BEGIN
PUSHBUTTON "&Cancel",IDCANCEL,127,94,50,16
END
IDD_3DSETTINGS DIALOGEX 0, 0, 190, 210
IDD_3DSETTINGS DIALOGEX 0, 0, 190, 225
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "3D settings"
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
DEFPUSHBUTTON "OK",IDOK,67,188,50,14
PUSHBUTTON "Cancel",IDCANCEL,121,188,50,14
PUSHBUTTON "Default",IDC_DEFAULT,11,188,50,14
DEFPUSHBUTTON "OK",IDOK,80,203,50,14
PUSHBUTTON "Cancel",IDCANCEL,135,203,50,14
PUSHBUTTON "Default",IDC_DEFAULT,8,203,50,14
GROUPBOX "Renderer:",IDC_STATIC,7,7,174,39
COMBOBOX IDC_3DCORE,15,23,153,138,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Unrealistically High-Precision Color Interpolation",IDC_INTERPOLATECOLOR,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,64,165,10
GROUPBOX "SoftRasterizer Options",IDC_STATIC,7,52,176,97
GROUPBOX "SoftRasterizer Options",IDC_STATIC,7,52,176,114
CONTROL "Enable Edge Marking",IDC_3DSETTINGS_EDGEMARK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,76,84,10
CONTROL "Enable Fog",IDC_3DSETTINGS_FOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,88,52,10
CONTROL "Enable Textures",IDC_3DSETTINGS_TEXTURE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,100,67,10
LTEXT "Depth Comparison Threshold : \n -0=normal behavior (recommended) \n -bigger value can help Zelda PH/ST shadow issue\n -works only in SoftRasterizer mode ",ID_LABEL_ZELDA_SHADOW_DEPTH_HACK,14,112,165,35
EDITTEXT IDC_ZELDA_SHADOW_DEPTH_HACK,109,111,44,12
LTEXT "Fixes some graphical bugs involving lines, but causes some other bugs. Not many games use lines.",ID_LABEL_ZELDA_SHADOW_DEPTH_HACK2,7,164,169,19
CONTROL "Enable Line Hack",IDC_3DSETTINGS_LINEHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,154,73,10
LTEXT "Depth Comparison Threshold : \n -0=normal behavior (recommended) \n -bigger value can help Zelda PH/ST shadow issue",ID_LABEL_ZELDA_SHADOW_DEPTH_HACK,15,113,165,35
EDITTEXT IDC_ZELDA_SHADOW_DEPTH_HACK,109,109,44,12
LTEXT "Fixes some graphical bugs involving lines, but causes some other bugs. Not many games use lines.",ID_LABEL_ZELDA_SHADOW_DEPTH_HACK2,17,182,170,19
CONTROL "Enable Line Hack",IDC_3DSETTINGS_LINEHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,170,73,10
LTEXT "Fixes text bugs in some games.(e.g. Etrian Odyssey)",ID_LABEL_TXTHACK1,15,153,165,11
CONTROL "Enable TXT Hack",IDC_TXTHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,141,73,10
END
IDD_ABOUT_BOX DIALOGEX 0, 0, 268, 198
@ -1836,7 +1838,7 @@ BEGIN
IDD_3DSETTINGS, DIALOG
BEGIN
BOTTOMMARGIN, 202
BOTTOMMARGIN, 217
END
IDD_CHEAT_ADD, DIALOG