Added support for Kega Fusion RPI filter files

This commit is contained in:
mudlord 2007-11-17 07:09:40 +00:00
parent daed30411b
commit e7bd7c4933
12 changed files with 485 additions and 2 deletions

View File

@ -466,6 +466,10 @@
RelativePath=".\src\pixel.cpp" RelativePath=".\src\pixel.cpp"
> >
</File> </File>
<File
RelativePath=".\src\win32\rpi.cpp"
>
</File>
<File <File
RelativePath=".\src\scanline.cpp" RelativePath=".\src\scanline.cpp"
> >
@ -998,6 +1002,10 @@
RelativePath=".\src\win32\RomInfo.cpp" RelativePath=".\src\win32\RomInfo.cpp"
> >
</File> </File>
<File
RelativePath=".\src\win32\SelectPlugin.cpp"
>
</File>
<File <File
RelativePath=".\src\win32\skin.cpp" RelativePath=".\src\win32\skin.cpp"
> >
@ -1220,6 +1228,10 @@
<Filter <Filter
Name="Filters" Name="Filters"
> >
<File
RelativePath=".\src\win32\rpi.h"
>
</File>
<Filter <Filter
Name="HQ" Name="HQ"
> >
@ -1512,6 +1524,10 @@
RelativePath=".\src\win32\RomInfo.h" RelativePath=".\src\win32\RomInfo.h"
> >
</File> </File>
<File
RelativePath=".\src\win32\SelectPlugin.h"
>
</File>
<File <File
RelativePath=".\src\win32\StringTokenizer.h" RelativePath=".\src\win32\StringTokenizer.h"
> >

View File

@ -182,6 +182,7 @@ BEGIN_MESSAGE_MAP(MainWnd, CWnd)
ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_RENDEROPTIONS_GLQUADS, OnUpdateOptionsVideoRenderoptionsGlquads) ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_RENDEROPTIONS_GLQUADS, OnUpdateOptionsVideoRenderoptionsGlquads)
ON_COMMAND(ID_OPTIONS_VIDEO_RENDEROPTIONS_GLPOLYGONS, OnOptionsVideoRenderoptionsGlpolygons) ON_COMMAND(ID_OPTIONS_VIDEO_RENDEROPTIONS_GLPOLYGONS, OnOptionsVideoRenderoptionsGlpolygons)
ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_RENDEROPTIONS_GLPOLYGONS, OnUpdateOptionsVideoRenderoptionsGlpolygons) ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_RENDEROPTIONS_GLPOLYGONS, OnUpdateOptionsVideoRenderoptionsGlpolygons)
ON_COMMAND(ID_OPTIONS_VIDEO_RENDEROPTIONS_SELECTSKIN, OnOptionsVideoRenderoptionsSelectskin) ON_COMMAND(ID_OPTIONS_VIDEO_RENDEROPTIONS_SELECTSKIN, OnOptionsVideoRenderoptionsSelectskin)
ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_RENDEROPTIONS_SELECTSKIN, OnUpdateOptionsVideoRenderoptionsSelectskin) ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_RENDEROPTIONS_SELECTSKIN, OnUpdateOptionsVideoRenderoptionsSelectskin)
ON_COMMAND(ID_OPTIONS_VIDEO_RENDEROPTIONS_SKIN, OnOptionsVideoRenderoptionsSkin) ON_COMMAND(ID_OPTIONS_VIDEO_RENDEROPTIONS_SKIN, OnOptionsVideoRenderoptionsSkin)
@ -382,6 +383,7 @@ BEGIN_MESSAGE_MAP(MainWnd, CWnd)
ON_UPDATE_COMMAND_UI(ID_CHEATS_DISABLECHEATS, OnUpdateCheatsDisablecheats) ON_UPDATE_COMMAND_UI(ID_CHEATS_DISABLECHEATS, OnUpdateCheatsDisablecheats)
ON_COMMAND(ID_OPTIONS_VIDEO_FULLSCREENMAXSCALE, OnOptionsVideoFullscreenmaxscale) ON_COMMAND(ID_OPTIONS_VIDEO_FULLSCREENMAXSCALE, OnOptionsVideoFullscreenmaxscale)
ON_COMMAND(ID_OPTIONS_EMULATOR_GAMEOVERRIDES, OnOptionsEmulatorGameoverrides) ON_COMMAND(ID_OPTIONS_EMULATOR_GAMEOVERRIDES, OnOptionsEmulatorGameoverrides)
ON_COMMAND(ID_OPTIONS_SELECT_PLUGIN, OnOptionsSelectPlugin)
ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_GAMEOVERRIDES, OnUpdateOptionsEmulatorGameoverrides) ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_GAMEOVERRIDES, OnUpdateOptionsEmulatorGameoverrides)
ON_COMMAND(ID_HELP_GNUPUBLICLICENSE, OnHelpGnupubliclicense) ON_COMMAND(ID_HELP_GNUPUBLICLICENSE, OnHelpGnupubliclicense)
ON_COMMAND(ID_OPTIONS_LINK_OPTIONS, OnLinkOptions) ON_COMMAND(ID_OPTIONS_LINK_OPTIONS, OnLinkOptions)
@ -416,6 +418,8 @@ BEGIN_MESSAGE_MAP(MainWnd, CWnd)
ON_COMMAND_EX_RANGE(ID_OPTIONS_FILTER_BILINEAR, ID_OPTIONS_FILTER_BILINEARPLUS, OnOptionsFilter) ON_COMMAND_EX_RANGE(ID_OPTIONS_FILTER_BILINEAR, ID_OPTIONS_FILTER_BILINEARPLUS, OnOptionsFilter)
ON_COMMAND_EX_RANGE(ID_OPTIONS_FILTER_SCANLINES, ID_OPTIONS_FILTER_SCANLINES, OnOptionsFilter) ON_COMMAND_EX_RANGE(ID_OPTIONS_FILTER_SCANLINES, ID_OPTIONS_FILTER_SCANLINES, OnOptionsFilter)
ON_COMMAND_EX_RANGE(ID_OPTIONS_FILTER_HQ2X, ID_OPTIONS_FILTER_LQ2X, OnOptionsFilter) ON_COMMAND_EX_RANGE(ID_OPTIONS_FILTER_HQ2X, ID_OPTIONS_FILTER_LQ2X, OnOptionsFilter)
ON_COMMAND_EX_RANGE(ID_OPTIONS_FILTER_PLUGIN, ID_OPTIONS_FILTER_PLUGIN, OnOptionsFilter)
ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_FILTER_PLUGIN, ID_OPTIONS_FILTER_PLUGIN, OnUpdateOptionsFilter)
ON_COMMAND_EX(ID_OPTIONS_FILTER_HQ3X, OnOptionsFilter) ON_COMMAND_EX(ID_OPTIONS_FILTER_HQ3X, OnOptionsFilter)
ON_COMMAND_EX(ID_OPTIONS_FILTER_HQ4X, OnOptionsFilter) ON_COMMAND_EX(ID_OPTIONS_FILTER_HQ4X, OnOptionsFilter)
ON_COMMAND_EX(ID_OPTIONS_FILTER_SIMPLE3X, OnOptionsFilter) ON_COMMAND_EX(ID_OPTIONS_FILTER_SIMPLE3X, OnOptionsFilter)

View File

@ -211,6 +211,13 @@ class MainWnd : public CWnd
afx_msg void OnUpdateOptionsVideoRenderoptionsGlquads(CCmdUI* pCmdUI); afx_msg void OnUpdateOptionsVideoRenderoptionsGlquads(CCmdUI* pCmdUI);
afx_msg void OnOptionsVideoRenderoptionsGlpolygons(); afx_msg void OnOptionsVideoRenderoptionsGlpolygons();
afx_msg void OnUpdateOptionsVideoRenderoptionsGlpolygons(CCmdUI* pCmdUI); afx_msg void OnUpdateOptionsVideoRenderoptionsGlpolygons(CCmdUI* pCmdUI);
afx_msg void OnOptionsVideoRenderoptionsGlACID();
afx_msg void OnUpdateOptionsVideoRenderoptionsGlACID(CCmdUI* pCmdUI);
afx_msg void OnOptionsVideoRenderoptionsGlPulsation();
afx_msg void OnUpdateOptionsVideoRenderoptionsGlPulsation(CCmdUI* pCmdUI);
afx_msg void OnOptionsVideoRenderoptionsGlNone();
afx_msg void OnUpdateOptionsVideoRenderoptionsGlNone(CCmdUI* pCmdUI);
afx_msg void OnOptionsVideoRenderoptionsSelectskin(); afx_msg void OnOptionsVideoRenderoptionsSelectskin();
afx_msg void OnUpdateOptionsVideoRenderoptionsSelectskin(CCmdUI* pCmdUI); afx_msg void OnUpdateOptionsVideoRenderoptionsSelectskin(CCmdUI* pCmdUI);
afx_msg void OnOptionsVideoRenderoptionsSkin(); afx_msg void OnOptionsVideoRenderoptionsSkin();
@ -414,6 +421,7 @@ class MainWnd : public CWnd
afx_msg void OnCheatsDisablecheats(); afx_msg void OnCheatsDisablecheats();
afx_msg void OnUpdateCheatsDisablecheats(CCmdUI* pCmdUI); afx_msg void OnUpdateCheatsDisablecheats(CCmdUI* pCmdUI);
afx_msg void OnOptionsVideoFullscreenmaxscale(); afx_msg void OnOptionsVideoFullscreenmaxscale();
afx_msg void OnOptionsSelectPlugin();
afx_msg void OnOptionsEmulatorGameoverrides(); afx_msg void OnOptionsEmulatorGameoverrides();
afx_msg void OnUpdateOptionsEmulatorGameoverrides(CCmdUI* pCmdUI); afx_msg void OnUpdateOptionsEmulatorGameoverrides(CCmdUI* pCmdUI);
afx_msg void OnHelpGnupubliclicense(); afx_msg void OnHelpGnupubliclicense();

View File

@ -33,6 +33,7 @@
#include "skin.h" #include "skin.h"
#include "Throttle.h" #include "Throttle.h"
#include "WinResUtil.h" #include "WinResUtil.h"
#include "SelectPlugin.h"
#include "../System.h" #include "../System.h"
#include "../agbprint.h" #include "../agbprint.h"
@ -628,6 +629,7 @@ void MainWnd::OnUpdateOptionsVideoRenderoptionsGlpolygons(CCmdUI* pCmdUI)
pCmdUI->SetCheck(theApp.glType == 2); pCmdUI->SetCheck(theApp.glType == 2);
} }
void MainWnd::OnOptionsVideoRenderoptionsSelectskin() void MainWnd::OnOptionsVideoRenderoptionsSelectskin()
{ {
#ifndef NOSKINS #ifndef NOSKINS
@ -1507,6 +1509,9 @@ BOOL MainWnd::OnOptionsFilter(UINT nID)
case ID_OPTIONS_FILTER_TVMODE: case ID_OPTIONS_FILTER_TVMODE:
theApp.filterType = FILTER_TVMODE; theApp.filterType = FILTER_TVMODE;
break; break;
case ID_OPTIONS_FILTER_PLUGIN:
theApp.filterType = FILTER_PLUGIN;
break;
case ID_OPTIONS_FILTER_2XSAI: case ID_OPTIONS_FILTER_2XSAI:
theApp.filterType = FILTER_2XSAI; theApp.filterType = FILTER_2XSAI;
break; break;
@ -1576,6 +1581,9 @@ void MainWnd::OnUpdateOptionsFilter(CCmdUI *pCmdUI)
case ID_OPTIONS_FILTER_SUPER2XSAI: case ID_OPTIONS_FILTER_SUPER2XSAI:
pCmdUI->SetCheck(theApp.filterType == FILTER_SUPER2XSAI); pCmdUI->SetCheck(theApp.filterType == FILTER_SUPER2XSAI);
break; break;
case ID_OPTIONS_FILTER_PLUGIN:
pCmdUI->SetCheck(theApp.filterType == FILTER_PLUGIN);
break;
case ID_OPTIONS_FILTER_SUPEREAGLE: case ID_OPTIONS_FILTER_SUPEREAGLE:
pCmdUI->SetCheck(theApp.filterType == FILTER_SUPEREAGLE); pCmdUI->SetCheck(theApp.filterType == FILTER_SUPEREAGLE);
break; break;
@ -1959,3 +1967,13 @@ void MainWnd::OnUpdateOptionsSoundHardwareacceleration(CCmdUI *pCmdUI)
{ {
pCmdUI->SetCheck(!theApp.dsoundDisableHardwareAcceleration); pCmdUI->SetCheck(!theApp.dsoundDisableHardwareAcceleration);
} }
void MainWnd::OnOptionsSelectPlugin()
{
SelectPlugin dlg;
if (dlg.DoModal() == IDOK && theApp.filterType == FILTER_PLUGIN)
{
theApp.updateFilter();
}
}

176
src/win32/SelectPlugin.cpp Normal file
View File

@ -0,0 +1,176 @@
// SelectPlugin.cpp : implementation file
//
#include "stdafx.h"
#include "vba.h"
#include "SelectPlugin.h"
#include "rpi.h"
#include "reg.h"
#include <vector>
#include <string>
using namespace std;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
vector<PluginDesc> rpiPool;
/////////////////////////////////////////////////////////////////////////////
// SelectPlugin dialog
SelectPlugin::SelectPlugin(CWnd* pParent /*=NULL*/)
: CDialog(SelectPlugin::IDD, pParent)
{
//{{AFX_DATA_INIT(SelectPlugin)
//}}AFX_DATA_INIT
}
void SelectPlugin::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(SelectPlugin)
DDX_Control(pDX, IDC_COMBO_PLUGIN, m_comboPlugin);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(SelectPlugin, CDialog)
//{{AFX_MSG_MAP(SelectPlugin)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// SelectPlugin message handlers
void SelectPlugin::OnOK()
{
// TODO: Add extra validation here
if (m_comboPlugin.GetCount() > 0)
{
int nSel = m_comboPlugin.GetCurSel();
if (nSel >= 0 && nSel < rpiPool.size())
strcpy(theApp.pluginName, rpiPool[nSel].sFile);
}
CDialog::OnOK();
}
void SelectPlugin::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
}
BOOL SelectPlugin::OnInitDialog()
{
CDialog::OnInitDialog();
m_comboPlugin.ResetContent();
int nPluginCnt = EnumPlugins();
if (nPluginCnt > 0)
{
for (int i = 0; i < rpiPool.size(); i++)
m_comboPlugin.AddString(rpiPool[i].sDesc);
for (int ii = 0; ii < rpiPool.size(); ii++)
{
if (stricmp(theApp.pluginName, rpiPool[ii].sFile) == 0)
{
m_comboPlugin.SetCurSel(ii);
break;
}
}
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
int SelectPlugin::EnumPlugins()
{
rpiPool.clear();
char sFindFile[MAX_PATH];
char *ptr;
GetModuleFileName(NULL, sFindFile, sizeof(sFindFile));
ptr = strrchr(sFindFile, '\\');
if (ptr)
*ptr = '\0';
strcat(sFindFile, "\\plugins\\*.rpi");
PluginDesc plugDesc;
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
memset(&FindFileData, 0, sizeof(FindFileData));
hFind = FindFirstFile(sFindFile, &FindFileData);
if (hFind != INVALID_HANDLE_VALUE)
{
if (GetPluginDesc(FindFileData.cFileName, &plugDesc))
rpiPool.push_back(plugDesc);
while (true)
{
memset(&FindFileData, 0, sizeof(FindFileData));
if (!FindNextFile(hFind, &FindFileData))
break;
if (GetPluginDesc(FindFileData.cFileName, &plugDesc))
rpiPool.push_back(plugDesc);
}
FindClose(hFind);
}
return rpiPool.size();
}
bool SelectPlugin::GetPluginDesc(const char *sRpi, PluginDesc *pDesc)
{
HINSTANCE rpiDLL = NULL;
char sFile[MAX_PATH];
char *ptr;
GetModuleFileName(NULL, sFile, sizeof(sFile));
ptr = strrchr(sFile, '\\');
if (ptr)
*ptr = '\0';
strcat(sFile, "\\plugins\\");
strcat(sFile, sRpi);
rpiDLL = LoadLibrary(sFile);
if (!rpiDLL)
return false;
RENDPLUG_GetInfo fnGetInfo = (RENDPLUG_GetInfo) GetProcAddress(rpiDLL, "RenderPluginGetInfo");
RENDPLUG_Output fnOutput = (RENDPLUG_Output) GetProcAddress(rpiDLL, "RenderPluginOutput");
if (fnGetInfo == NULL || fnOutput == NULL)
{
FreeLibrary(rpiDLL);
rpiDLL = NULL;
return false;
}
RENDER_PLUGIN_INFO *pRPI = fnGetInfo();
if (pRPI == NULL)
{
FreeLibrary(rpiDLL);
return false;
}
memset(pDesc, 0, sizeof(PluginDesc));
strcpy(pDesc->sFile, sRpi);
strcpy(pDesc->sDesc, pRPI->Name);
FreeLibrary(rpiDLL);
return true;
}

55
src/win32/SelectPlugin.h Normal file
View File

@ -0,0 +1,55 @@
#if !defined(AFX_SELECTPLUGIN_H__A097B9D0_7C23_4C1A_A2D3_1AEC07501BBC__INCLUDED_)
#define AFX_SELECTPLUGIN_H__A097B9D0_7C23_4C1A_A2D3_1AEC07501BBC__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// SelectPlugin.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// SelectPlugin dialog
struct PluginDesc
{
char sFile[MAX_PATH];
char sDesc[60];
};
class SelectPlugin : public CDialog
{
// Construction
public:
SelectPlugin(CWnd* pParent = NULL); // standard constructor
int EnumPlugins();
bool GetPluginDesc(const char *sRpi, PluginDesc *pDesc);
// Dialog Data
//{{AFX_DATA(SelectPlugin)
enum { IDD = IDD_SELECT_PLUGIN };
CComboBox m_comboPlugin;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(SelectPlugin)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(SelectPlugin)
virtual void OnOK();
virtual void OnCancel();
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_SELECTPLUGIN_H__A097B9D0_7C23_4C1A_A2D3_1AEC07501BBC__INCLUDED_)

View File

@ -29,6 +29,7 @@
#include "skin.h" #include "skin.h"
#include "WavWriter.h" #include "WavWriter.h"
#include "WinResUtil.h" #include "WinResUtil.h"
#include "rpi.h"
#include "../System.h" #include "../System.h"
#include "../agbprint.h" #include "../agbprint.h"
@ -341,6 +342,7 @@ VBA::VBA()
VBA::~VBA() VBA::~VBA()
{ {
rpiCleanup();
InterframeCleanup(); InterframeCleanup();
char winBuffer[2048]; char winBuffer[2048];
@ -708,6 +710,10 @@ void VBA::updateFilter()
filterFunction = NULL; filterFunction = NULL;
filterMagnification = 1; filterMagnification = 1;
break; break;
case FILTER_PLUGIN:
if (rpiInit(pluginName))
filterFunction = rpiFilter;
break;
case FILTER_TVMODE: case FILTER_TVMODE:
filterFunction = ScanlinesTV; filterFunction = ScanlinesTV;
filterMagnification = 2; filterMagnification = 2;
@ -784,6 +790,10 @@ void VBA::updateFilter()
filterFunction = NULL; filterFunction = NULL;
filterMagnification = 1; filterMagnification = 1;
break; break;
case FILTER_PLUGIN:
if (rpiInit(pluginName))
filterFunction = rpiFilter;
break;
case FILTER_TVMODE: case FILTER_TVMODE:
filterFunction = ScanlinesTV32; filterFunction = ScanlinesTV32;
filterMagnification = 2; filterMagnification = 2;
@ -854,8 +864,16 @@ void VBA::updateFilter()
} }
} }
if (filterType == FILTER_PLUGIN)
{
rect.right = sizeX * rpiScaleFactor();
rect.bottom = sizeY * rpiScaleFactor();
}
else
{
rect.right = sizeX * filterMagnification; rect.right = sizeX * filterMagnification;
rect.bottom = sizeY * filterMagnification; rect.bottom = sizeY * filterMagnification;
}
if( filterType != FILTER_NONE ) if( filterType != FILTER_NONE )
memset(delta, 0xFF, sizeof(delta)); memset(delta, 0xFF, sizeof(delta));
@ -1329,6 +1347,8 @@ void VBA::loadSettings()
videoOption = regQueryDwordValue("video", VIDEO_3X); videoOption = regQueryDwordValue("video", VIDEO_3X);
strcpy(pluginName, regQueryStringValue("pluginName", "Scale2x.rpi"));
if(videoOption < VIDEO_1X || videoOption > VIDEO_OTHER) if(videoOption < VIDEO_1X || videoOption > VIDEO_OTHER)
videoOption = VIDEO_3X; videoOption = VIDEO_3X;
@ -1420,7 +1440,7 @@ void VBA::loadSettings()
glType = 0; glType = 0;
filterType = regQueryDwordValue("filter", 0); filterType = regQueryDwordValue("filter", 0);
if(filterType < 0 || filterType > 16) if(filterType < 0 || filterType > 17)
filterType = 0; filterType = 0;
disableMMX = regQueryDwordValue("disableMMX", false) ? true: false; disableMMX = regQueryDwordValue("disableMMX", false) ? true: false;
@ -2425,7 +2445,7 @@ void VBA::saveSettings()
regSetDwordValue("cheatsEnabled", cheatsEnabled); regSetDwordValue("cheatsEnabled", cheatsEnabled);
regSetDwordValue("fsMaxScale", fsMaxScale); regSetDwordValue("fsMaxScale", fsMaxScale);
regSetDwordValue("throttle", throttle); regSetDwordValue("throttle", throttle);
regSetStringValue("pluginName", pluginName);
regSetDwordValue("saveMoreCPU", Sm60FPS::bSaveMoreCPU); regSetDwordValue("saveMoreCPU", Sm60FPS::bSaveMoreCPU);
regSetDwordValue("LinkTimeout", linktimeout); regSetDwordValue("LinkTimeout", linktimeout);
regSetDwordValue("Linklog", linklog); regSetDwordValue("Linklog", linklog);

View File

@ -54,6 +54,7 @@ enum pixelFilterType
FILTER_NONE, FILTER_NONE,
FILTER_SIMPLE2X, FILTER_PIXELATE, FILTER_TVMODE, FILTER_SCANLINES, FILTER_SIMPLE2X, FILTER_PIXELATE, FILTER_TVMODE, FILTER_SCANLINES,
FILTER_PLUGIN,
FILTER_BILINEAR, FILTER_BILINEARPLUS, FILTER_MAMESCALE2X, FILTER_BILINEAR, FILTER_BILINEARPLUS, FILTER_MAMESCALE2X,
FILTER_2XSAI, FILTER_SUPER2XSAI, FILTER_SUPEREAGLE, FILTER_LQ2X, FILTER_HQ2X, FILTER_2XSAI, FILTER_SUPER2XSAI, FILTER_SUPEREAGLE, FILTER_LQ2X, FILTER_HQ2X,
@ -85,6 +86,7 @@ class VBA : public CWinApp
void (*ifbFunction)(u8*,u32,int,int); void (*ifbFunction)(u8*,u32,int,int);
int ifbType; int ifbType;
int filterType; int filterType;
char pluginName[MAX_PATH];
int filterWidth; int filterWidth;
int filterHeight; int filterHeight;
int filterMagnification; int filterMagnification;

View File

@ -51,6 +51,17 @@ END
// Dialog // Dialog
// //
IDD_SELECT_PLUGIN DIALOG 0, 0, 201, 120
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Select Filter Plugin"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,39,89,50,14
PUSHBUTTON "Cancel",IDCANCEL,103,89,50,14
COMBOBOX IDC_COMBO_PLUGIN,20,28,163,58,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
LTEXT "Filter Plugin:",IDC_STATIC,18,15,66,8
END
IDD_LINKTAB DIALOGEX 0, 0, 254, 203 IDD_LINKTAB DIALOGEX 0, 0, 254, 203
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Link Options" CAPTION "Link Options"
@ -1615,6 +1626,8 @@ BEGIN
END END
POPUP "&Pixel Filter" POPUP "&Pixel Filter"
BEGIN BEGIN
MENUITEM "Filter Plugin", ID_OPTIONS_FILTER_PLUGIN
MENUITEM "Select Filter Plugin ...", ID_OPTIONS_SELECT_PLUGIN
POPUP "Magnification" POPUP "Magnification"
BEGIN BEGIN
MENUITEM "&None", ID_OPTIONS_FILTER_NORMAL MENUITEM "&None", ID_OPTIONS_FILTER_NORMAL

View File

@ -96,6 +96,8 @@
#define IDD_MAX_SCALE 154 #define IDD_MAX_SCALE 154
#define IDD_BUG_REPORT 155 #define IDD_BUG_REPORT 155
#define IDD_GAME_OVERRIDES 156 #define IDD_GAME_OVERRIDES 156
#define IDD_SELECT 159
#define IDD_SELECT_PLUGIN 159
#define IDC_R0 1000 #define IDC_R0 1000
#define IDC_EDIT_UP 1000 #define IDC_EDIT_UP 1000
#define IDC_R1 1001 #define IDC_R1 1001
@ -800,6 +802,10 @@
#define ID_RENDERAPI_VERTEX 40336 #define ID_RENDERAPI_VERTEX 40336
#define ID_OPTIONS_VIDEO_RENDEROPTIONS_GLPOLYGONS 40337 #define ID_OPTIONS_VIDEO_RENDEROPTIONS_GLPOLYGONS 40337
#define ID_OPTIONS_FILTER_PLUGIN 40343
#define ID_OPTIONS_SELECT_PLUGIN 40344
#define IDC_COMBO_PLUGIN 40345
// Next default values for new objects // Next default values for new objects
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED

102
src/win32/rpi.cpp Normal file
View File

@ -0,0 +1,102 @@
#include "stdafx.h"
#include "rpi.h"
extern void SuperEagle(u8*,u32,u8*,u8*,u32,int,int);
static HINSTANCE rpiDLL = NULL;
static RENDPLUG_Output fnOutput = NULL;
static RENDPLUG_GetInfo fnGetInfo = NULL;
static RENDER_PLUGIN_INFO MyPlugInfo;
static RENDER_PLUGIN_OUTP MyPlugOutput;
static int nScaleFactor;
bool rpiInit(const char *sPluginName)
{
rpiCleanup();
char sBuffer[256];
char *ptr;
GetModuleFileName(NULL, sBuffer, sizeof(sBuffer));
ptr = strrchr(sBuffer, '\\');
if (ptr)
*ptr = '\0';
strcat(sBuffer, "\\plugins\\");
strcat(sBuffer, sPluginName);
rpiDLL = LoadLibrary(sBuffer);
if (!rpiDLL)
return false;
fnGetInfo = (RENDPLUG_GetInfo) GetProcAddress(rpiDLL, "RenderPluginGetInfo");
fnOutput = (RENDPLUG_Output) GetProcAddress(rpiDLL, "RenderPluginOutput");
if (fnGetInfo == NULL || fnOutput == NULL)
{
FreeLibrary(rpiDLL);
rpiDLL = NULL;
return false;
}
RENDER_PLUGIN_INFO *pRPI = fnGetInfo();
if (pRPI == NULL)
{
FreeLibrary(rpiDLL);
rpiDLL = NULL;
return false;
}
memcpy(&MyPlugInfo, pRPI, sizeof(MyPlugInfo));
unsigned long Flags = MyPlugInfo.Flags & 0x0000F0000;
if (Flags == RPI_OUT_SCL2)
{
nScaleFactor = 2;
}
else if (Flags == RPI_OUT_SCL3)
{
nScaleFactor = 3;
}
else if (Flags == RPI_OUT_SCL4)
{
nScaleFactor = 4;
}
else
{
nScaleFactor = 2;
}
return true;
}
void rpiFilter(u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, u8 *dstPtr, u32 dstPitch, int width, int height)
{
MyPlugOutput.Size = sizeof(MyPlugOutput);
MyPlugOutput.Flags = MyPlugInfo.Flags;
MyPlugOutput.SrcPtr = srcPtr;
MyPlugOutput.SrcPitch = srcPitch;
MyPlugOutput.SrcW = width;
MyPlugOutput.SrcH = height;
MyPlugOutput.DstPtr = dstPtr;
MyPlugOutput.DstPitch = dstPitch;
MyPlugOutput.DstW = width * nScaleFactor;
MyPlugOutput.DstH = height * nScaleFactor;
MyPlugOutput.OutW = width * nScaleFactor;
MyPlugOutput.OutH = height * nScaleFactor;
fnOutput(&MyPlugOutput);
}
int rpiScaleFactor()
{
return nScaleFactor;
}
void rpiCleanup()
{
if (rpiDLL != NULL)
{
FreeLibrary(rpiDLL);
rpiDLL = NULL;
}
}

63
src/win32/rpi.h Normal file
View File

@ -0,0 +1,63 @@
//---------------------------------------------------------------------------------------------------------------------------
// hq2x plugin example - Steve Snake 2004.
// This plugin uses (modified) code by Maxim Stepin - see "hq2x16.asm" for info
// The original code and description of the algorithm can be found at:
// http://www.hiend3d.com/hq2x.html
//---------------------------------------------------------------------------------------------------------------------------
#include <windows.h>
//---------------------------------------------------------------------------------------------------------------------------
typedef struct
{
unsigned long Size;
unsigned long Flags;
void *SrcPtr;
unsigned long SrcPitch;
unsigned long SrcW;
unsigned long SrcH;
void *DstPtr;
unsigned long DstPitch;
unsigned long DstW;
unsigned long DstH;
unsigned long OutW;
unsigned long OutH;
} RENDER_PLUGIN_OUTP;
//---------------------------------------------------------------------------------------------------------------------------
typedef void (*RENDPLUG_Output)(RENDER_PLUGIN_OUTP *);
//---------------------------------------------------------------------------------------------------------------------------
typedef struct
{
char Name[60];
unsigned long Flags;
HMODULE Handle;
RENDPLUG_Output Output;
} RENDER_PLUGIN_INFO;
//---------------------------------------------------------------------------------------------------------------------------
typedef RENDER_PLUGIN_INFO *(*RENDPLUG_GetInfo)(void);
//---------------------------------------------------------------------------------------------------------------------------
#define RPI_VERSION 0x02
#define RPI_MMX_USED 0x000000100
#define RPI_MMX_REQD 0x000000200
#define RPI_555_SUPP 0x000000400
#define RPI_565_SUPP 0x000000800
#define RPI_888_SUPP 0x000001000
#define RPI_OUT_SCL2 0x000020000
#define RPI_OUT_SCL3 0x000030000
#define RPI_OUT_SCL4 0x000040000
//---------------------------------------------------------------------------------------------------------------------------
int rpiScaleFactor();
bool rpiInit(const char *sPluginName);
void rpiFilter(u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, u8 *dstPtr, u32 dstPitch, int width, int height);
void rpiCleanup();