mirror of
https://github.com/libretro/FBNeo.git
synced 2024-11-27 02:50:29 +00:00
Add ability to configure live shader parameters (dx9 alt -> Hardfx -> settings).
see HardFXConfigs[] in src/intf/video/win32/vid_directx9.cpp float4 user_settings; in hlsl shader
This commit is contained in:
parent
9d9e52d0f6
commit
ddc5fde116
@ -325,6 +325,32 @@ BEGIN
|
||||
PUSHBUTTON "Cancel",IDCANCEL,105,40,50,14
|
||||
END
|
||||
|
||||
IDD_HARDFXSETTINGS DIALOGEX 0, 0, 214, 169
|
||||
STYLE DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "HardFX shader options"
|
||||
FONT 8, "MS Shell Dlg", 0, 0, 0x1
|
||||
BEGIN
|
||||
GROUPBOX "Option #1", IDC_SPRITE1, 3, 36*0, 208, 35
|
||||
CONTROL "Value",IDC_HARDFX_SLIDER1,"msctls_trackbar32", WS_TABSTOP, 5, 36*0+10, 160, 18
|
||||
EDITTEXT IDC_HARDFX_SLIDER_EDIT1,167,36*0+10,35,14,SS_CENTERIMAGE
|
||||
|
||||
GROUPBOX "Option #2", IDC_SPRITE2, 3, 36*1, 208, 35
|
||||
CONTROL "Value",IDC_HARDFX_SLIDER2,"msctls_trackbar32", WS_TABSTOP, 5, 36*1+10, 160, 18
|
||||
EDITTEXT IDC_HARDFX_SLIDER_EDIT2,167,36*1+10,35,14,SS_CENTERIMAGE
|
||||
|
||||
GROUPBOX "Option #3", IDC_SPRITE3, 3, 36*2, 208, 35
|
||||
CONTROL "Value",IDC_HARDFX_SLIDER3,"msctls_trackbar32", WS_TABSTOP, 5, 36*2+10, 160, 18
|
||||
EDITTEXT IDC_HARDFX_SLIDER_EDIT3,167,36*2+10,35,14,SS_CENTERIMAGE
|
||||
|
||||
GROUPBOX "Option #4", IDC_SPRITE4, 3, 36*3, 208, 35
|
||||
CONTROL "Value",IDC_HARDFX_SLIDER4,"msctls_trackbar32", WS_TABSTOP, 5, 36*3+10, 160, 18
|
||||
EDITTEXT IDC_HARDFX_SLIDER_EDIT4,167,36*3+10,35,14,SS_CENTERIMAGE
|
||||
|
||||
PUSHBUTTON "Defaults",IDRETRY,52,150,50,14
|
||||
DEFPUSHBUTTON "OK",IDOK,158,150,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,105,150,50,14
|
||||
END
|
||||
|
||||
IDD_SCANLINE DIALOGEX 0, 0, 214, 59
|
||||
STYLE DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Select desired scanline intensity"
|
||||
@ -1455,6 +1481,7 @@ BEGIN
|
||||
MENUITEM "CRT Bicubic", MENU_DX9_ALT_HARD_FX_CRT_BICUBIC
|
||||
MENUITEM "CRT Retro Scanlines", MENU_DX9_ALT_HARD_FX_CRT_RETROSL
|
||||
MENUITEM "CRT CGA", MENU_DX9_ALT_HARD_FX_CRT_CGA
|
||||
MENUITEM "Selected Shader's Settings", MENU_DX9_ALT_HARD_FX_SETTINGS
|
||||
END
|
||||
POPUP "SoftFX algorithm"
|
||||
BEGIN
|
||||
|
@ -422,6 +422,7 @@ int StatedSave(int nSlot);
|
||||
// numdial.cpp
|
||||
int NumDialCreate(int bDial);
|
||||
void GammaDialog();
|
||||
void HardFXShaderSettingsDialog();
|
||||
void ScanlineDialog();
|
||||
void PhosphorDialog();
|
||||
void ScreenAngleDialog();
|
||||
|
@ -23,6 +23,15 @@ struct VidPresetDataVer VidPresetVer[4] = {
|
||||
// last one set at desktop resolution
|
||||
};
|
||||
|
||||
static void HardFXLoadDefaults()
|
||||
{
|
||||
int totalHardFX = MENU_DX9_ALT_HARD_FX_LAST - MENU_DX9_ALT_HARD_FX_NONE;
|
||||
|
||||
for (int thfx = 0; thfx < totalHardFX; thfx++) {
|
||||
HardFXConfigs[thfx].hardfx_config_load_defaults();
|
||||
}
|
||||
}
|
||||
|
||||
static void CreateConfigName(TCHAR* szConfig)
|
||||
{
|
||||
_stprintf(szConfig, _T("config/%s.ini"), szAppExeName);
|
||||
@ -40,6 +49,8 @@ int ConfigAppLoad()
|
||||
setlocale(LC_ALL, "");
|
||||
#endif
|
||||
|
||||
HardFXLoadDefaults();
|
||||
|
||||
CreateConfigName(szConfig);
|
||||
|
||||
if ((h = _tfopen(szConfig, _T("rt"))) == NULL) {
|
||||
@ -165,6 +176,21 @@ int ConfigAppLoad()
|
||||
VAR(bVidMotionBlur);
|
||||
VAR(bVidForce16bitDx9Alt);
|
||||
|
||||
{
|
||||
int totalHardFX = MENU_DX9_ALT_HARD_FX_LAST - MENU_DX9_ALT_HARD_FX_NONE;
|
||||
|
||||
for (int thfx = 0; thfx < totalHardFX; thfx++) {
|
||||
// for each fx, check if it has settings that needs to be saved
|
||||
for (int thfx_option = 0; thfx_option < HardFXConfigs[thfx].nOptions; thfx_option++) {
|
||||
TCHAR szLabel[64];
|
||||
_stprintf(szLabel, _T("HardFXOption[%d][%d]"), thfx, thfx_option);
|
||||
|
||||
TCHAR* szValue = LabelCheck(szLine, szLabel);
|
||||
if (szValue) HardFXConfigs[thfx].fOptions[thfx_option] = _tcstod(szValue, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sound
|
||||
VAR(nAudSelect);
|
||||
VAR(nAudVolume);
|
||||
@ -519,6 +545,19 @@ int ConfigAppSave()
|
||||
_ftprintf(h, _T("\n// If non-zero, force 16 bit emulation even in 32-bit screenmodes\n"));
|
||||
VAR(bVidForce16bitDx9Alt);
|
||||
|
||||
_ftprintf(h, _T("\n// HardFX shader options\n"));
|
||||
|
||||
{
|
||||
int totalHardFX = MENU_DX9_ALT_HARD_FX_LAST - MENU_DX9_ALT_HARD_FX_NONE;
|
||||
|
||||
for (int thfx = 0; thfx < totalHardFX; thfx++) {
|
||||
// for each fx, check if it has settings that needs to be saved
|
||||
for (int thfx_option = 0; thfx_option < HardFXConfigs[thfx].nOptions; thfx_option++) {
|
||||
_ftprintf(h, _T("HardFXOption[%d][%d] %lf\n"), thfx, thfx_option, HardFXConfigs[thfx].fOptions[thfx_option]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_ftprintf(h, _T("\n\n\n"));
|
||||
_ftprintf(h, _T("// --- Sound ------------------------------------------------------------------\n"));
|
||||
_ftprintf(h, _T("\n// The selected audio plugin\n"));
|
||||
|
@ -789,6 +789,11 @@ void MenuUpdate()
|
||||
CheckMenuItem(hMenu, MENU_DX9_ALT_HARDWAREVERTEX, (bVidHardwareVertex) ? MF_CHECKED : MF_UNCHECKED);
|
||||
CheckMenuItem(hMenu, MENU_DX9_ALT_MOTIONBLUR, (bVidMotionBlur) ? MF_CHECKED : MF_UNCHECKED);
|
||||
CheckMenuRadioItem(hMenu, MENU_DX9_ALT_HARD_FX_NONE, MENU_DX9_ALT_HARD_FX_LAST, MENU_DX9_ALT_HARD_FX_NONE + nVidDX9HardFX, MF_BYCOMMAND);
|
||||
|
||||
// Enable HardFX Settings if we have options!
|
||||
bool hFXDisabled = (nVidDX9HardFX == 0) || (HardFXConfigs[nVidDX9HardFX].nOptions == 0);
|
||||
EnableMenuItem(hMenu, MENU_DX9_ALT_HARD_FX_SETTINGS, hFXDisabled ? (MF_GRAYED | MF_BYCOMMAND) : (MF_ENABLED | MF_BYCOMMAND));
|
||||
|
||||
CheckMenuItem(hMenu, MENU_DX9_ALT_FORCE_16BIT, bVidForce16bitDx9Alt ? MF_CHECKED : MF_UNCHECKED);
|
||||
break;
|
||||
}
|
||||
|
@ -7,6 +7,31 @@ const double RADTODEG = 57.29577951308232286465f; // Radians to Degrees
|
||||
|
||||
static int nExitStatus;
|
||||
|
||||
static bool bIsProperFloatString(TCHAR *szText)
|
||||
{
|
||||
bool bValid = 1;
|
||||
bool bPoint = 0;
|
||||
|
||||
if (_tcslen(szText) == 0) return 0;
|
||||
|
||||
// Scan string in the edit control for illegal characters
|
||||
for (int i = 0; szText[i]; i++) {
|
||||
if (szText[i] == _T('.')) {
|
||||
if (bPoint) {
|
||||
bValid = 0;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (!_istdigit(szText[i])) {
|
||||
bValid = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return bValid;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static INT_PTR CALLBACK DefInpProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM)
|
||||
@ -49,6 +74,201 @@ int NumDialCreate(int)
|
||||
return 1;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// HardFX Shader Settings dialog
|
||||
|
||||
static void HardFXUpdateValues(HWND hDlg)
|
||||
{
|
||||
for (int i = 0; i < 4; i++) { // 4 edit controls!
|
||||
TCHAR szText[18];
|
||||
int SLIDER_ID = IDC_HARDFX_SLIDER1 + i;
|
||||
int SLIDER_EDIT_ID = IDC_HARDFX_SLIDER_EDIT1 + i;
|
||||
int f2i = HardFXConfigs[nVidDX9HardFX].fOptions[i] * 10000;
|
||||
float temp = HardFXConfigs[nVidDX9HardFX].fOptions[i];
|
||||
|
||||
SendDlgItemMessage(hDlg, SLIDER_ID, TBM_SETPOS, (WPARAM)true, (LPARAM)f2i);
|
||||
|
||||
_stprintf(szText, _T("%0.2f"), temp);
|
||||
SendDlgItemMessage(hDlg, SLIDER_EDIT_ID, WM_SETTEXT, (WPARAM)0, (LPARAM)szText);
|
||||
}
|
||||
}
|
||||
|
||||
static INT_PTR CALLBACK HardFXShaderSettingsProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam) // LPARAM lParam
|
||||
{
|
||||
static float nPrevSettings[4]; // for the "Cancel" button
|
||||
int SLIDER_ID;
|
||||
int SLIDER_ID_RAW;
|
||||
int SLIDER_EDIT_ID;
|
||||
|
||||
switch (Msg) {
|
||||
case WM_INITDIALOG: {
|
||||
// back-up settings for "cancel" option
|
||||
nPrevSettings[0] = HardFXConfigs[nVidDX9HardFX].fOptions[0];
|
||||
nPrevSettings[1] = HardFXConfigs[nVidDX9HardFX].fOptions[1];
|
||||
nPrevSettings[2] = HardFXConfigs[nVidDX9HardFX].fOptions[2];
|
||||
nPrevSettings[3] = HardFXConfigs[nVidDX9HardFX].fOptions[3];
|
||||
|
||||
nExitStatus = 0;
|
||||
|
||||
WndInMid(hDlg, hScrnWnd);
|
||||
|
||||
for (int i = 0; i < 4; i++) { // 4 edit controls!
|
||||
// Initialise option
|
||||
SLIDER_ID = IDC_HARDFX_SLIDER1 + i;
|
||||
SLIDER_EDIT_ID = IDC_HARDFX_SLIDER_EDIT1 + i;
|
||||
|
||||
SendDlgItemMessage(hDlg, SLIDER_ID, TBM_SETRANGE, (WPARAM)0, (LPARAM)MAKELONG(1, 20000));
|
||||
SendDlgItemMessage(hDlg, SLIDER_ID, TBM_SETLINESIZE, (WPARAM)0, (LPARAM)200);
|
||||
SendDlgItemMessage(hDlg, SLIDER_ID, TBM_SETPAGESIZE, (WPARAM)0, (LPARAM)250);
|
||||
SendDlgItemMessage(hDlg, SLIDER_ID, TBM_SETTIC, (WPARAM)0, (LPARAM)7500);
|
||||
SendDlgItemMessage(hDlg, SLIDER_ID, TBM_SETTIC, (WPARAM)0, (LPARAM)10001);
|
||||
SendDlgItemMessage(hDlg, SLIDER_ID, TBM_SETTIC, (WPARAM)0, (LPARAM)12500);
|
||||
|
||||
// Set Controlbox heading
|
||||
TCHAR szHeading[255] = _T("Not Available");
|
||||
HWND hHeading = GetDlgItem(hDlg, IDC_SPRITE1 + i);
|
||||
SetWindowText(hHeading, (i < HardFXConfigs[nVidDX9HardFX].nOptions) ? ANSIToTCHAR(HardFXConfigs[nVidDX9HardFX].szOptions[i], NULL, 0) : szHeading);
|
||||
if (i >= HardFXConfigs[nVidDX9HardFX].nOptions) {
|
||||
EnableWindow(hHeading, FALSE);
|
||||
HWND hSlider = GetDlgItem(hDlg, SLIDER_ID);
|
||||
HWND hSliderEdit = GetDlgItem(hDlg, SLIDER_EDIT_ID);
|
||||
EnableWindow(hSlider, FALSE);
|
||||
EnableWindow(hSliderEdit, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
HardFXUpdateValues(hDlg);
|
||||
|
||||
// Update the screen
|
||||
if (bVidOkay) {
|
||||
VidRedraw();
|
||||
VidPaint(0);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
case WM_COMMAND: {
|
||||
switch (HIWORD(wParam)) {
|
||||
case BN_CLICKED: {
|
||||
if (LOWORD(wParam) == IDOK) {
|
||||
nExitStatus = 1;
|
||||
SendMessage(hDlg, WM_CLOSE, 0, 0);
|
||||
}
|
||||
if (LOWORD(wParam) == IDCANCEL) {
|
||||
nExitStatus = -1;
|
||||
SendMessage(hDlg, WM_CLOSE, 0, 0);
|
||||
}
|
||||
if (LOWORD(wParam) == IDRETRY) { // [Defaults] Button is here!
|
||||
HardFXConfigs[nVidDX9HardFX].hardfx_config_load_defaults();
|
||||
HardFXUpdateValues(hDlg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EN_UPDATE: {
|
||||
SLIDER_ID = -1;
|
||||
SLIDER_EDIT_ID = -1;
|
||||
switch (LOWORD(wParam)) {
|
||||
case IDC_HARDFX_SLIDER_EDIT1:
|
||||
case IDC_HARDFX_SLIDER_EDIT2:
|
||||
case IDC_HARDFX_SLIDER_EDIT3:
|
||||
case IDC_HARDFX_SLIDER_EDIT4:
|
||||
SLIDER_EDIT_ID = LOWORD(wParam);
|
||||
SLIDER_ID = IDC_HARDFX_SLIDER1 + (SLIDER_EDIT_ID - IDC_HARDFX_SLIDER_EDIT1);
|
||||
SLIDER_ID_RAW = SLIDER_ID - IDC_HARDFX_SLIDER1;
|
||||
break;
|
||||
}
|
||||
if (nExitStatus == 0 && SLIDER_ID != -1) {
|
||||
TCHAR szText[18] = _T("");
|
||||
bool bValid = 1;
|
||||
|
||||
if (SendDlgItemMessage(hDlg, SLIDER_EDIT_ID, WM_GETTEXTLENGTH, (WPARAM)0, (LPARAM)0) < 16) {
|
||||
SendDlgItemMessage(hDlg, SLIDER_EDIT_ID, WM_GETTEXT, (WPARAM)16, (LPARAM)szText);
|
||||
}
|
||||
|
||||
bValid = bIsProperFloatString(szText);
|
||||
|
||||
if (bValid) {
|
||||
float fTemp = _tcstod(szText, NULL);
|
||||
int nPos = fTemp * 10000;
|
||||
|
||||
HardFXConfigs[nVidDX9HardFX].fOptions[SLIDER_ID_RAW] = fTemp;
|
||||
|
||||
SendDlgItemMessage(hDlg, SLIDER_ID, TBM_SETPOS, (WPARAM)true, (LPARAM)nPos);
|
||||
|
||||
if (bVidOkay) {
|
||||
VidRedraw();
|
||||
VidPaint(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
case WM_HSCROLL: {
|
||||
switch (LOWORD(wParam)) {
|
||||
case TB_BOTTOM:
|
||||
case TB_ENDTRACK:
|
||||
case TB_LINEDOWN:
|
||||
case TB_LINEUP:
|
||||
case TB_PAGEDOWN:
|
||||
case TB_PAGEUP:
|
||||
case TB_THUMBPOSITION:
|
||||
case TB_THUMBTRACK:
|
||||
case TB_TOP: {
|
||||
if (nExitStatus == 0) {
|
||||
// Update the contents of the edit control
|
||||
SLIDER_ID = -1;
|
||||
SLIDER_EDIT_ID = -1;
|
||||
switch (GetDlgCtrlID((HWND)lParam)) {
|
||||
case IDC_HARDFX_SLIDER1:
|
||||
case IDC_HARDFX_SLIDER2:
|
||||
case IDC_HARDFX_SLIDER3:
|
||||
case IDC_HARDFX_SLIDER4:
|
||||
SLIDER_ID = GetDlgCtrlID((HWND)lParam);// - IDC_HARDFX_SLIDER1;
|
||||
SLIDER_EDIT_ID = IDC_HARDFX_SLIDER_EDIT1 + (SLIDER_ID - IDC_HARDFX_SLIDER1);
|
||||
SLIDER_ID_RAW = SLIDER_ID - IDC_HARDFX_SLIDER1;
|
||||
|
||||
// Update the contents of the edit control
|
||||
int nPos = SendDlgItemMessage(hDlg, SLIDER_ID, TBM_GETPOS, (WPARAM)0, (LPARAM)0);
|
||||
float fTemp = (float)nPos / 10000;
|
||||
HardFXConfigs[nVidDX9HardFX].fOptions[SLIDER_ID_RAW] = fTemp;
|
||||
|
||||
HardFXUpdateValues(hDlg);
|
||||
|
||||
if (bVidOkay) {
|
||||
VidRedraw();
|
||||
VidPaint(0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_CLOSE:
|
||||
if (nExitStatus != 1) {
|
||||
// cancel pressed, restore backed-up settings
|
||||
HardFXConfigs[nVidDX9HardFX].fOptions[0] = nPrevSettings[0];
|
||||
HardFXConfigs[nVidDX9HardFX].fOptions[1] = nPrevSettings[1];
|
||||
HardFXConfigs[nVidDX9HardFX].fOptions[2] = nPrevSettings[2];
|
||||
HardFXConfigs[nVidDX9HardFX].fOptions[3] = nPrevSettings[3];
|
||||
}
|
||||
EndDialog(hDlg, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void HardFXShaderSettingsDialog()
|
||||
{
|
||||
FBADialogBox(hAppInst, MAKEINTRESOURCE(IDD_HARDFXSETTINGS), hScrnWnd, (DLGPROC)HardFXShaderSettingsProc);
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
// Gamma dialog
|
||||
|
||||
|
@ -49,6 +49,7 @@
|
||||
#define IDD_GAMEINFO 81
|
||||
#define IDD_DOWNLOAD_LOCAL 82
|
||||
#define IDD_CHOOSEMONITOR 83
|
||||
#define IDD_HARDFXSETTINGS 84
|
||||
|
||||
#define IDR_MENU 100
|
||||
#define IDR_MENU_BLITTER_1 110
|
||||
@ -203,6 +204,16 @@
|
||||
#define IDC_CHOOSE_MONITOR_VER_LIST 20144
|
||||
#define IDC_CHOOSE_MONITOR_TEXT 20145
|
||||
#define IDC_LIST3 20146
|
||||
#define IDC_HARDFX_SLIDER1 20147
|
||||
#define IDC_HARDFX_SLIDER2 20148
|
||||
#define IDC_HARDFX_SLIDER3 20149
|
||||
#define IDC_HARDFX_SLIDER4 20150
|
||||
#define IDC_HARDFX_SLIDER5 20151
|
||||
#define IDC_HARDFX_SLIDER_EDIT1 20152
|
||||
#define IDC_HARDFX_SLIDER_EDIT2 20153
|
||||
#define IDC_HARDFX_SLIDER_EDIT3 20154
|
||||
#define IDC_HARDFX_SLIDER_EDIT4 20155
|
||||
#define IDC_HARDFX_SLIDER_EDIT5 20156
|
||||
|
||||
#define IDC_DRVCOUNT 20200
|
||||
#define IDC_TREE2 20201
|
||||
@ -897,7 +908,8 @@
|
||||
#define MENU_DX9_ALT_HARD_FX_CRT_BICUBIC 11456
|
||||
#define MENU_DX9_ALT_HARD_FX_CRT_RETROSL 11457
|
||||
#define MENU_DX9_ALT_HARD_FX_CRT_CGA 11458
|
||||
#define MENU_DX9_ALT_HARD_FX_LAST 11458 // last one
|
||||
#define MENU_DX9_ALT_HARD_FX_LAST 11458 // last one (same id as previous line!)
|
||||
#define MENU_DX9_ALT_HARD_FX_SETTINGS 11470
|
||||
#define MENU_DX9_ALT_SOFT_AUTOSIZE 11490
|
||||
#define MENU_DX9_ALT_FORCE_16BIT 11491
|
||||
|
||||
|
@ -1976,6 +1976,16 @@ static void OnCommand(HWND /*hDlg*/, int id, HWND /*hwndCtl*/, UINT codeNotify)
|
||||
}
|
||||
break;
|
||||
|
||||
case MENU_DX9_ALT_HARD_FX_SETTINGS: {
|
||||
if (UseDialogs()) {
|
||||
InputSetCooperativeLevel(false, bAlwaysProcessKeyboardInput);
|
||||
AudBlankSound();
|
||||
HardFXShaderSettingsDialog();
|
||||
GameInpCheckMouse(); //? dink?
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case MENU_GAMMA_OTHER: {
|
||||
if (UseDialogs()) {
|
||||
double nOldGamma = nGamma;
|
||||
|
@ -203,6 +203,22 @@ extern INT32 bVidCorrectAspect;
|
||||
extern INT32 bVidArcaderes;
|
||||
extern INT32 nVidDX9HardFX;
|
||||
|
||||
struct hardfx_config {
|
||||
char *szFileName;
|
||||
int nOptions;
|
||||
const float fDefaults[4];
|
||||
float fOptions[4];
|
||||
char *szOptions[4];
|
||||
|
||||
void hardfx_config_load_defaults() {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
fOptions[i] = fDefaults[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
extern hardfx_config HardFXConfigs[];
|
||||
|
||||
extern INT32 bVidArcaderesHor;
|
||||
extern INT32 bVidArcaderesVer;
|
||||
|
||||
|
@ -1790,15 +1790,27 @@ struct transp_vertex {
|
||||
float u, v;
|
||||
};
|
||||
|
||||
char *HardFXFilenames[] = {
|
||||
"support/shaders/crt_aperture.fx",
|
||||
"support/shaders/crt_caligari.fx",
|
||||
"support/shaders/crt_cgwg_fast.fx",
|
||||
"support/shaders/crt_easymode.fx",
|
||||
"support/shaders/crt_standard.fx",
|
||||
"support/shaders/crt_bicubic.fx",
|
||||
"support/shaders/crt_retrosl.fx",
|
||||
"support/shaders/crt_cga.fx"
|
||||
/*
|
||||
// in interface.h! for reference only.
|
||||
struct hardfx_config {
|
||||
char *szFileName;
|
||||
int nOptions;
|
||||
const float fDefaults[4];
|
||||
float fOptions[4];
|
||||
char *szOptions[4];
|
||||
};
|
||||
*/
|
||||
|
||||
hardfx_config HardFXConfigs[] = {
|
||||
{ "n/a", 0, }, // 0 (note: zero entry is "None")
|
||||
{ "support/shaders/crt_aperture.fx", 0, }, // 1
|
||||
{ "support/shaders/crt_caligari.fx", 0, }, // 2
|
||||
{ "support/shaders/crt_cgwg_fast.fx", 0, }, // 3
|
||||
{ "support/shaders/crt_easymode.fx", 0, }, // 4
|
||||
{ "support/shaders/crt_standard.fx", 0, }, // 5
|
||||
{ "support/shaders/crt_bicubic.fx", 0, }, // 6
|
||||
{ "support/shaders/crt_retrosl.fx", 1, { 0.0, 0.0, 0.0, 0.0 }, { 0, 0, 0, 0 }, "Animation (0 = disabled)", NULL, NULL, NULL }, // 7
|
||||
{ "support/shaders/crt_cga.fx", 0, }, // 8
|
||||
};
|
||||
|
||||
#undef D3DFVF_LVERTEX2
|
||||
@ -2045,17 +2057,26 @@ static int dx9AltSetVertex(unsigned int px, unsigned int py, unsigned int pw, un
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void UpdateShaderVariables()
|
||||
{
|
||||
if (pVidEffect && pVidEffect->IsValid()) {
|
||||
pVidEffect->SetParamFloat2("texture_size", nTextureWidth, nTextureHeight);
|
||||
pVidEffect->SetParamFloat2("video_size", (nRotateGame ? nGameHeight : nGameWidth) + 0.5f, nRotateGame ? nGameWidth : nGameHeight + 0.5f);
|
||||
pVidEffect->SetParamFloat2("video_time", nCurrentFrame, (float)nCurrentFrame / 60);
|
||||
pVidEffect->SetParamFloat4("user_settings", HardFXConfigs[nDX9HardFX].fOptions[0], HardFXConfigs[nDX9HardFX].fOptions[1], HardFXConfigs[nDX9HardFX].fOptions[2], HardFXConfigs[nDX9HardFX].fOptions[3]);
|
||||
}
|
||||
}
|
||||
|
||||
static int dx9AltSetHardFX(int nHardFX)
|
||||
{
|
||||
// cutre reload
|
||||
//static bool reload = true; if (GetAsyncKeyState(VK_CONTROL)) { if (reload) { nDX9HardFX = 0; reload = false; } } else reload = true;
|
||||
|
||||
|
||||
if (nHardFX == nDX9HardFX)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
nDX9HardFX = nHardFX;
|
||||
|
||||
if (pVidEffect) {
|
||||
@ -2070,19 +2091,16 @@ static int dx9AltSetHardFX(int nHardFX)
|
||||
|
||||
// HardFX
|
||||
pVidEffect = new VidEffect(pD3DDevice);
|
||||
int r = pVidEffect->Load(HardFXFilenames[nHardFX - 1]);
|
||||
int r = pVidEffect->Load(HardFXConfigs[nHardFX].szFileName);
|
||||
|
||||
if (r == 0)
|
||||
{
|
||||
bprintf(0, _T("HardFX ""%S"" loaded OK!\n"), HardFXFilenames[nHardFX - 1]);
|
||||
// common parameters
|
||||
pVidEffect->SetParamFloat2("texture_size", nTextureWidth, nTextureHeight);
|
||||
pVidEffect->SetParamFloat2("video_size", (nRotateGame ? nGameHeight : nGameWidth) + 0.5f, nRotateGame ? nGameWidth : nGameHeight + 0.5f);
|
||||
pVidEffect->SetParamFloat2("video_time", nCurrentFrame / 5, nCurrentFrame / 5);
|
||||
bprintf(0, _T("HardFX ""%S"" loaded OK!\n"), HardFXConfigs[nHardFX].szFileName);
|
||||
UpdateShaderVariables();
|
||||
}
|
||||
else
|
||||
{
|
||||
FBAPopupAddText(PUF_TEXT_DEFAULT, MAKEINTRESOURCE(IDS_ERR_UI_HARDFX_MODULE), HardFXFilenames[nHardFX - 1]);
|
||||
FBAPopupAddText(PUF_TEXT_DEFAULT, MAKEINTRESOURCE(IDS_ERR_UI_HARDFX_MODULE), HardFXConfigs[nHardFX].szFileName);
|
||||
FBAPopupDisplay(PUF_TYPE_ERROR);
|
||||
}
|
||||
|
||||
@ -2449,10 +2467,7 @@ static int dx9AltRender() // MemToSurf
|
||||
}
|
||||
}
|
||||
|
||||
if (pVidEffect && pVidEffect->IsValid()) {
|
||||
pVidEffect->SetParamFloat2("video_time", nCurrentFrame / 5, nCurrentFrame / 5);
|
||||
// pVidEffect->SetParamFloat2("user_settings", fDX9ShaderSettings[0], fDX9ShaderSettings[1]); // at some point!
|
||||
}
|
||||
UpdateShaderVariables(); // once per frame
|
||||
|
||||
pD3DDevice->BeginScene();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user