diff --git a/src/filters/filters.hpp b/src/filters/filters.hpp index 40a260cd..735f3bcd 100644 --- a/src/filters/filters.hpp +++ b/src/filters/filters.hpp @@ -19,12 +19,12 @@ enum wx_filtfunc { FF_NONE, FF_2XSAI, FF_SUPER2XSAI, FF_SUPEREAGLE, FF_PIXELATE, FF_ADVMAME, FF_BILINEAR, FF_BILINEARPLUS, FF_SCANLINES, FF_TV, FF_HQ2X, FF_LQ2X, FF_SIMPLE2X, FF_SIMPLE3X, FF_HQ3X, FF_SIMPLE4X, - FF_HQ4X, FF_PLUGIN // plugin must always be last + FF_HQ4X }; #define builtin_ff_scale(x) \ ((x == FF_HQ4X || x == FF_SIMPLE4X) ? 4 : \ (x == FF_HQ3X || x == FF_SIMPLE3X) ? 3 : \ - x == FF_PLUGIN ? 0 : x == FF_NONE ? 1 : 2) + x == FF_NONE ? 1 : 2) enum ifbfunc { // this order must match order of option enum and selector widget IFB_NONE, IFB_SMART, IFB_MOTION_BLUR diff --git a/src/wx/cmdevents.cpp b/src/wx/cmdevents.cpp index 13cbcb0b..cda17031 100644 --- a/src/wx/cmdevents.cpp +++ b/src/wx/cmdevents.cpp @@ -1999,13 +1999,6 @@ EVT_HANDLER_MASK(DisplayConfigure, "Display options...", CMDEN_NREC_ANY) EVT_HANDLER_MASK(ChangeFilter, "Change Pixel Filter", CMDEN_NREC_ANY) { - int filt = gopts.filter; - if(filt == FF_PLUGIN || - ++gopts.filter == FF_PLUGIN && gopts.filter_plugin.empty()) - { - gopts.filter = 0; - } - update_opts(); if(panel->panel) { panel->panel->Delete(); panel->panel = NULL; diff --git a/src/wx/guiinit.cpp b/src/wx/guiinit.cpp index 027e1d3a..0ba77547 100644 --- a/src/wx/guiinit.cpp +++ b/src/wx/guiinit.cpp @@ -1547,144 +1547,6 @@ private: wxArrayVideoModes vm; }; -// enable plugin-related iff filter choice is plugin -class PluginEnabler : public wxValidator -{ -public: - PluginEnabler() : wxValidator() {} - PluginEnabler(const PluginEnabler &e) : wxValidator() {} - wxObject *Clone() const { return new PluginEnabler(*this); } - bool TransferFromWindow() { return true; } - bool Validate(wxWindow *p) { return true; } - bool TransferToWindow() - { - GetWindow()->Enable(gopts.filter == FF_PLUGIN); - return true; - } -}; - -// The same, but as an event handler -static class PluginEnable_t : public wxEvtHandler -{ -public: - wxWindow *lab, *ch; - void ToggleChoice(wxCommandEvent &ev) - { - bool en = ev.GetSelection() == FF_PLUGIN; - lab->Enable(en); - ch->Enable(en); - } -} PluginEnableHandler; - -// fill in plugin list -class PluginListFiller : public PluginEnabler -{ -public: - PluginListFiller(wxDialog *parent, wxControl *lab, wxChoice *ch) : - PluginEnabler(), txt(lab), dlg(parent), plugins(), filtch(ch) {} - PluginListFiller(const PluginListFiller &e) : - PluginEnabler(), txt(e.txt), dlg(e.dlg), plugins(e.plugins), - filtch(e.filtch) {} - wxObject *Clone() const { return new PluginListFiller(*this); } - bool Validate(wxWindow *p) { return true; } - bool TransferToWindow() - { - PluginEnabler::TransferToWindow(); - wxChoice *ch = wxStaticCast(GetWindow(), wxChoice); - ch->Clear(); - ch->Append(_("None")); - plugins.clear(); - const wxString &plpath = wxStandardPaths::Get().GetPluginsDir(); - wxDir::GetAllFiles(plpath, &plugins, wxT("*.rpi")); - for(int i = 0; i < plugins.size(); i++) { - wxDynamicLibrary dl(plugins[i], wxDL_VERBATIM|wxDL_NOW); - RENDPLUG_GetInfo GetInfo; - const RENDER_PLUGIN_INFO *rpi; - if(dl.IsLoaded() && - (GetInfo = (RENDPLUG_GetInfo)dl.GetSymbol(wxT("RenderPluginGetInfo"))) && - // note that in actual kega fusion plugins, rpi->Output is - // unused (as is rpi->Handle) - dl.GetSymbol(wxT("RenderPluginOutput")) && - (rpi = GetInfo()) && - // FIXME: maybe this should be >= RPI_VERISON - (rpi->Flags & 0xff) == RPI_VERSION && - // RPI_565_SUPP is not supported - // although it would be possible - // and it would make Cairo more efficient - (rpi->Flags & (RPI_555_SUPP|RPI_888_SUPP))) { - wxFileName fn(plugins[i]); - wxString s = fn.GetName(); - s += wxT(": "); - s += wxString(rpi->Name, wxConvUTF8, sizeof(rpi->Name)); - fn.MakeRelativeTo(plpath); - plugins[i] = fn.GetFullName(); - ch->Append(s); - if(plugins[i] == gopts.filter_plugin) - ch->SetSelection(i + 1); - } else - plugins.RemoveAt(i--); - } - if(ch->GetCount() == 1) { - // this is probably the only place the user can find out where - // to put the plugins... it depends on where program was - // installed, and of course OS - wxString msg; - msg.Printf(_("No usable rpi plugins found in %s"), plpath.c_str()); - systemScreenMessage(msg); - ch->Hide(); - txt->Hide(); - int cursel = filtch->GetSelection(); - if(cursel == FF_PLUGIN) - cursel = 0; - if(filtch->GetCount() == FF_PLUGIN + 1) { - filtch->Delete(FF_PLUGIN); - // apparently wxgtk loses selection after this, even - // if selection was not FF_PLUGIN - filtch->SetSelection(cursel); - } - } else { - ch->Show(); - txt->Show(); - if(filtch->GetCount() < FF_PLUGIN + 1) - filtch->Append(_("Plugin")); - } - // FIXME: this isn't enough. It only resizes 2nd time around - dlg->Fit(); - return true; - } - bool TransferFromWindow() - { - wxChoice *ch = wxStaticCast(GetWindow(), wxChoice); - if(ch->GetCount() == 1) { - gopts.filter_plugin = wxEmptyString; - // this happens if "Plugin" was selected and the entry was - // subsequently removed - if(ch->GetSelection() < 0) - ch->SetSelection(0); - if(gopts.filter < 0) - gopts.filter = 0; - } else { - int n = ch->GetSelection(); - if(n > 0) - gopts.filter_plugin = plugins[n - 1]; - else { - if(filtch->GetSelection() == FF_PLUGIN) { - wxMessageBox(_("Please select a plugin or a different filter"), - _("Plugin selection error"), wxOK|wxICON_ERROR); - return false; - } - gopts.filter_plugin = wxEmptyString; - } - } - return true; - } -private: - wxDialog *dlg; - wxControl *txt; - wxChoice *filtch; - wxArrayString plugins; -}; - // this is the cmd table index for the accel tree ctrl // one of the "benefits" of using TreeItemData is that we have to // malloc them all, because treectrl destructor will free them all @@ -2959,18 +2821,6 @@ bool MainFrame::InitMore(void) cb->Hide(); #endif ch=GetValidatedChild(d, "Filter",wxGenericValidator(& gopts.filter)); - // these two are filled and/or hidden at dialog load time - wxControl *pll; - wxChoice *pl; - pll=SafeXRCCTRL(d, "PluginLab"); - pl=SafeXRCCTRL(d, "Plugin"); - pll->SetValidator(PluginEnabler()); - pl->SetValidator(PluginListFiller(d, pll, ch)); - PluginEnableHandler.lab = pll; - PluginEnableHandler.ch = pl; - ch->Connect(wxEVT_COMMAND_CHOICE_SELECTED, - wxCommandEventHandler(PluginEnable_t::ToggleChoice), - NULL, &PluginEnableHandler); ch=GetValidatedChild(d, "IFB",wxGenericValidator(& gopts.ifb)); d->Fit(); } diff --git a/src/wx/opts.cpp b/src/wx/opts.cpp index fe7d4434..2775fcf0 100644 --- a/src/wx/opts.cpp +++ b/src/wx/opts.cpp @@ -136,8 +136,7 @@ opt_desc opts[] = { ENUMOPT("Display/Filter", wxTRANSLATE("Full-screen filter to apply"), gopts.filter, wxTRANSLATE("none|2xsai|super2xsai|supereagle|pixelate|advmame|" "bilinear|bilinearplus|scanlines|tvmode|hq2x|lq2x|" - "simple2x|simple3x|hq3x|simple4x|hq4x|plugin")), - STROPT ("Display/FilterPlugin", wxTRANSLATE("Filter plugin library"), gopts.filter_plugin), + "simple2x|simple3x|hq3x|simple4x|hq4x")), BOOLOPT("Display/Fullscreen", wxTRANSLATE("Enter fullscreen mode at startup"), gopts.fullscreen), INTOPT ("Display/FullscreenDepth", wxTRANSLATE("Fullscreen mode color depth (0 = any)"), gopts.fs_mode.bpp, 0, 999), INTOPT ("Display/FullscreenFreq", wxTRANSLATE("Fullscreen mode frequency (0 = any)"), gopts.fs_mode.refresh, 0, 999), diff --git a/src/wx/opts.h b/src/wx/opts.h index 66fcd418..a2a8aada 100644 --- a/src/wx/opts.h +++ b/src/wx/opts.h @@ -15,7 +15,6 @@ extern struct opts_t { bool cpu_mmx; bool no_osd_status; int filter; - wxString filter_plugin; int ifb; bool fullscreen; wxVideoMode fs_mode; diff --git a/src/wx/panel.cpp b/src/wx/panel.cpp index 55125920..f8e1085f 100644 --- a/src/wx/panel.cpp +++ b/src/wx/panel.cpp @@ -985,57 +985,20 @@ DrawingPanel::DrawingPanel(int _width, int _height) : pixbuf1(0), pixbuf2(0), rpi(0), nthreads(0) { memset(delta, 0xff, sizeof(delta)); - if(gopts.filter == FF_PLUGIN) { - do { // do { } while(0) so break; exits entire block - // could've also just used goto & a label, I guess - gopts.filter = FF_NONE; // preemptive in case of errors - systemColorDepth = 32; - if(gopts.filter_plugin.empty()) - break; - wxFileName fpn(gopts.filter_plugin); - fpn.MakeAbsolute(wxStandardPaths::Get().GetPluginsDir()); - if(!filt_plugin.Load(fpn.GetFullPath(), wxDL_VERBATIM|wxDL_NOW)) - break; - RENDPLUG_GetInfo gi = (RENDPLUG_GetInfo)filt_plugin.GetSymbol(wxT("RenderPluginGetInfo")); - if(!gi) - break; - // need to be able to write to _rpi to set Output() and Flags - RENDER_PLUGIN_INFO *_rpi = gi(); - // FIXME: maybe < RPI_VERSION, assuming future vers. back compat? - if(!_rpi || (_rpi->Flags & 0xff) != RPI_VERSION || - !(_rpi->Flags & (RPI_555_SUPP|RPI_888_SUPP))) - break; - _rpi->Flags &= ~RPI_565_SUPP; - if(_rpi->Flags & RPI_888_SUPP) { - _rpi->Flags &= ~RPI_555_SUPP; - // FIXME: should this be 32 or 24? No docs or sample source - systemColorDepth = 32; - } else - systemColorDepth = 16; - if(!_rpi->Output) - // note that in actual kega fusion plugins, rpi->Output is - // unused (as is rpi->Handle) - _rpi->Output = (RENDPLUG_Output)filt_plugin.GetSymbol(wxT("RenderPluginOutput")); - scale = (_rpi->Flags & RPI_OUT_SCLMSK) >> RPI_OUT_SCLSH; - rpi = _rpi; - gopts.filter = FF_PLUGIN; // now that there is a valid plugin - } while(0); - } else { - scale = builtin_ff_scale(gopts.filter); + + scale = builtin_ff_scale(gopts.filter); #ifndef NO_ASM - // while there is a 32->16 frontend for these, it's probably more - // efficient to just use 16 to start with - // unfortunately, this also means that the 32-bit output needs to - // be sensed in lower code -#define out_16 (systemColorDepth == 16 && gopts.filter == FF_PLUGIN) - if(gopts.filter == FF_HQ3X || gopts.filter == FF_HQ4X) - systemColorDepth = 16; - else -#else -#define out_16 (systemColorDepth == 16) + // while there is a 32->16 frontend for these, it's probably more + // efficient to just use 16 to start with + // unfortunately, this also means that the 32-bit output needs to + // be sensed in lower code + if(gopts.filter == FF_HQ3X || gopts.filter == FF_HQ4X) + systemColorDepth = 16; + else #endif - systemColorDepth = 32; - } +#define out_16 (systemColorDepth == 16) + systemColorDepth = 32; + // Intialize color tables if(systemColorDepth == 32) { #if wxBYTE_ORDER == wxLITTLE_ENDIAN @@ -1223,34 +1186,13 @@ public: case FF_HQ4X: hq4x32(src, instride, delta, dst, outstride, width, height); break; - case FF_PLUGIN: - // MFC interface did not do plugins in parallel - // Probably because it's almost certain they carry state or do - // other non-thread-safe things - // But the user can always turn mt off of it's not working.. - RENDER_PLUGIN_OUTP outdesc; - outdesc.Size = sizeof(outdesc); - outdesc.Flags = rpi->Flags; - outdesc.SrcPtr = src; - outdesc.SrcPitch = instride; - outdesc.SrcW = width; - // FIXME: win32 code adds to H, saying that frame isn't fully - // rendered otherwise - // I need to verify that statement before I go adding stuff that - // may make it crash. - outdesc.SrcH = height; // + scale / 2 - outdesc.DstPtr = dst; - outdesc.DstPitch = outstride; - outdesc.DstW = width * scale; - // on the other hand, there is at least 1 line below, so I'll add - // that to dest in case safety checks in plugin use < instead of <= - outdesc.DstH = height * scale + 1; // + scale * (scale / 2) - rpi->Output(&outdesc); - } - if(nthreads == 1) - return 0; - done->Post(); - continue; + default: + break; + } + if(nthreads == 1) + return 0; + done->Post(); + continue; } } }; diff --git a/src/wx/wxvbam.h b/src/wx/wxvbam.h index 706bb307..20711ce4 100644 --- a/src/wx/wxvbam.h +++ b/src/wx/wxvbam.h @@ -479,7 +479,6 @@ protected: FilterThread *threads; int nthreads; wxSemaphore filt_done; - wxDynamicLibrary filt_plugin; const RENDER_PLUGIN_INFO *rpi; // also flag indicating plugin loaded // largest buffer required is 32-bit * (max width + 1) * (max height + 2) u8 delta[257 * 4 * 226]; diff --git a/src/wx/wxvbam.xrc b/src/wx/wxvbam.xrc index ba8619b1..9b42d2ae 100644 --- a/src/wx/wxvbam.xrc +++ b/src/wx/wxvbam.xrc @@ -2663,24 +2663,11 @@ HQ 3x Simple 4x HQ 4x - Plugin wxALL|wxEXPAND 5 - - - - - wxALL|wxALIGN_RIGHT|wxALIGN_CENTRE_VERTICAL - 5 - - - - wxALL|wxEXPAND - 5 -