Cleaned up the loading of the config file (vbam.ini)

This commit is contained in:
skidau 2015-04-20 10:28:01 +00:00
parent 32fa4b20cf
commit da127b798e
6 changed files with 198 additions and 229 deletions

View File

@ -158,7 +158,7 @@ int dsoundDisableHardwareAcceleration;
int filterHeight; int filterHeight;
int filterMagnification; int filterMagnification;
int filterMT; // enable multi-threading for pixel filters int filterMT; // enable multi-threading for pixel filters
int filterType; int filter = kStretch2x;
int filterWidth; int filterWidth;
int frameSkip = 1; int frameSkip = 1;
int frameskipadjust; int frameskipadjust;
@ -173,6 +173,7 @@ int fullScreenStretch;
int gdbBreakOnLoad; int gdbBreakOnLoad;
int gdbPort; int gdbPort;
int glFilter; int glFilter;
int ifbType = kIFBNone;
int joypadDefault; int joypadDefault;
int languageOption; int languageOption;
int layerEnable = 0xff00; int layerEnable = 0xff00;
@ -244,10 +245,8 @@ unsigned short throttle;
const char* preparedCheatCodes[MAX_CHEATS]; const char* preparedCheatCodes[MAX_CHEATS];
Filter filter = kStretch2x;
FilterFunc filterFunction = 0; FilterFunc filterFunction = 0;
IFBFilterFunc ifbFunction = 0; IFBFilterFunc ifbFunction = 0;
int ifbType = kIFBNone;
// allow up to 100 IPS/UPS/PPF patches given on commandline // allow up to 100 IPS/UPS/PPF patches given on commandline
int patchNum = 0; int patchNum = 0;
@ -420,150 +419,126 @@ void OpenPreferences(const char *name)
preferences = iniparser_load(name); preferences = iniparser_load(name);
} }
void LoadConfig() void ValidateConfig()
{ {
openGL = ReadPrefHex("openGL");
fullScreen = ReadPrefHex("fullScreen") ? 1 : 0;
useBios = ReadPrefHex("useBiosGBA") ? true : false;
skipBios = ReadPrefHex("skipBios") ? true : false;
disableStatusMessages = ReadPrefHex("disableStatus") ? true : false;
gbBorderOn = ReadPrefHex("borderOn") ? true : false;
gbBorderAutomatic = ReadPrefHex("borderAutomatic") ? true : false;
gbColorOption = ReadPrefHex("colorOption") ? true : false;
captureFormat = ReadPrefHex("captureFormat");
gbSoundSetDeclicking(ReadPrefHex("declicking") != 0);
showSpeedTransparent = ReadPrefHex("showSpeedTransparent");
autoFrameSkip = ReadPrefHex("autoFrameSkip");
pauseWhenInactive = ReadPrefHex("pauseWhenInactive") ? true : false;
agbPrint = ReadPrefHex("agbPrint");
rtcEnabled = ReadPrefHex("rtcEnabled");
synchronize = ReadPrefHex("synchronize");
videoOption = ReadPrefHex("video");
languageOption = ReadPref("language", 1);
frameSkip = ReadPref("frameSkip", 0);
gbFrameSkip = ReadPref("gbFrameSkip", 0);
autoFrameSkip = ReadPref("autoFrameSkip", 0) ? 1 : 0;
vsync = ReadPref("vsync", false) ? true : false;
synchronize = ReadPref("synchronize", 1) ? true : false;
fullScreenStretch = ReadPref("stretch", 0) ? true : false;
videoOption = ReadPref("video", 2); // VIDEO_3X = 2
fsAdapter = ReadPref("fsAdapter", 0);
throttle = ReadPref("throttle", 0);
fsWidth = ReadPref("fsWidth", 800);
fsHeight = ReadPref("fsHeight", 600);
fsColorDepth = ReadPref("fsColorDepth", 32);
fsFrequency = ReadPref("fsFrequency", 60);
windowPositionX = ReadPref("windowX", 0);
windowPositionY = ReadPref("windowY", 0);
useBiosFileGBA = (ReadPref("useBiosGBA", 0) == 1) ? true : false;
useBiosFileGBC = (ReadPref("useBiosGBC", 0) == 1) ? true : false;
useBiosFileGB = (ReadPref("useBiosGB", 0) == 1) ? true : false;
skipBios = ReadPref("skipBios", 0) ? true : false;
soundSetVolume((float)(ReadPref("soundVolume", 100)) / 100.0f);
gb_effects_config.enabled = 1 == ReadPref("gbSoundEffectsEnabled", 0);
gb_effects_config.surround = 1 == ReadPref("gbSoundEffectsSurround", 0);
gb_effects_config.echo = (float)ReadPref("gbSoundEffectsEcho", 20) / 100.0f;
gb_effects_config.stereo = (float)ReadPref("gbSoundEffectsStereo", 15) / 100.0f;
gbSoundSetDeclicking(1 == ReadPref("gbSoundDeclicking", 1));
soundInterpolation = 1 == ReadPref("gbaSoundInterpolation", 1);
soundFiltering = (float)ReadPref("gbaSoundFiltering", 50) / 100.0f;
tripleBuffering = ReadPref("tripleBuffering", false) ? true : false;
glFilter = ReadPref("glFilter", 1);
filterType = ReadPref("filter", 0);
filterMT = (1 == ReadPref("filterEnableMultiThreading", 0));
disableMMX = ReadPref("disableMMX", false) ? true : false;
showSpeed = ReadPref("showSpeed", 0);
showSpeedTransparent = ReadPref("showSpeedTransparent", 1) ? true : false;
winGbPrinterEnabled = ReadPref("gbPrinter", false) ? true : false;
pauseWhenInactive = ReadPref("pauseWhenInactive", 1) ? true : false;
captureFormat = ReadPref("captureFormat", 0);
recentFreeze = ReadPref("recentFreeze", false) ? true : false;
autoPatch = ReadPref("autoPatch", 1) == 1 ? true : false;
cpuDisableSfx = ReadPref("disableSfx", 0) ? true : false;
ifbType = ReadPref("ifbType", 0);
winFlashSize = ReadPref("flashSize", 0x10000);
agbPrintEnable(ReadPref("agbPrint", 0) ? true : false);
rtcEnabled = ReadPref("rtcEnabled", 0) ? true : false;
winGbBorderOn = ReadPref("borderOn", 0);
gbBorderAutomatic = ReadPref("borderAutomatic", 0);
gbEmulatorType = ReadPref("emulatorType", 1);
gbColorOption = ReadPref("colorOption", 0);
threadPriority = ReadPref("priority", 2);
autoSaveLoadCheatList = (1 == ReadPref("autoSaveCheatList", 1)) ? true : false;
gbPaletteOption = ReadPref("gbPaletteOption", 0);
rewindTimer = ReadPref("rewindTimer", 0);
joypadDefault = ReadPref("joypadDefault", 0);
autoLoadMostRecent = (1 == ReadPref("autoLoadMostRecent", 0)) ? true : false;
skipSaveGameBattery = (1 == ReadPref("skipSaveGameBattery", 0)) ? true : false;
skipSaveGameCheats = (1 == ReadPref("skipSaveGameCheats", 0)) ? true : false;
cheatsEnabled = ReadPref("cheatsEnabled", false) ? true : false;
maxScale = ReadPref("maxScale", 0);
linkTimeout = ReadPref("LinkTimeout", 1000);
linkMode = ReadPref("LinkMode", 0); // LINK_DISCONNECTED = 0
linkAuto = ReadPref("LinkAuto", true);
linkHacks = ReadPref("LinkHacks", false);
linkNumPlayers = ReadPref("LinkNumPlayers", 2);
gdbPort = ReadPref("gdbPort", 55555);
gdbBreakOnLoad = ReadPref("gdbBreakOnLoad", false) ? true : false;
//valueType = ReadPref("gbCheatsValueType", 0);
//searchType = ReadPref("gbCheatsSearchType",
//numberType = ReadPref("gbCheatsNumberType", 2);
//sizeType = ReadPref("gbCheatsSizeType", 0);
//updateValues = ReadPref("gbCheatsUpdate", 0);
//numberType = ReadPref("gbCheatsNumberType", 2);
//sizeType = ReadPref("gbCheatsSizeType", 0);
//int s = ReadPref("mapViewStretch", 0);
//m_size = ReadPref("memViewerDataSize", 0);
//m_stretch = ReadPref("GBOamViewStretch", 0);
//scale = ReadPref("printerScale", 0);
//m_stretch = ReadPref("tileViewStretch", 0);
//valueType = ReadPref("cheatsValueType", 0);
//searchType = ReadPref("cheatsSearchType", SEARCH_EQ);
//numberType = ReadPref("cheatsNumberType", 2);
//sizeType = ReadPref("cheatsSizeType", 0);
//updateValues = ReadPref("cheatsUpdate", 0);
//numberType = ReadPref("cheatsNumberType", 2);
//sizeType = ReadPref("cheatsSizeType", 0);
//restoreValues = ReadPref("cheatsRestore", 0) ?
//selectedFilter = ReadPref(("selectedFilter"), 0);
//int s = ReadPref("mapViewStretch", 0);
//m_size = ReadPref("memViewerDataSize", 0);
//m_stretch = ReadPref("tileViewStretch", 0);
gbEmulatorType = (ReadPrefHex("emulatorType"));
if (gbEmulatorType < 0 || gbEmulatorType > 5) if (gbEmulatorType < 0 || gbEmulatorType > 5)
gbEmulatorType = 1; gbEmulatorType = 1;
frameSkip = (ReadPrefHex("frameSkip"));
if (frameSkip < 0 || frameSkip > 9) if (frameSkip < 0 || frameSkip > 9)
frameSkip = 2; frameSkip = 2;
gbFrameSkip = (ReadPrefHex("gbFrameSkip"));
if (gbFrameSkip < 0 || gbFrameSkip > 9) if (gbFrameSkip < 0 || gbFrameSkip > 9)
gbFrameSkip = 0; gbFrameSkip = 0;
filter = (Filter)fromDec(ReadPrefString("filter"));
if (filter < kStretch1x || filter >= kInvalidFilter) if (filter < kStretch1x || filter >= kInvalidFilter)
filter = kStretch2x; filter = kStretch2x;
if (cpuSaveType < 0 || cpuSaveType > 5)
cpuSaveType = 0;
if (optFlashSize != 0 && optFlashSize != 1)
optFlashSize = 0;
if (ifbType < kIFBNone || ifbType >= kInvalidIFBFilter)
ifbType = kIFBNone;
if (showSpeed < 0 || showSpeed > 2)
showSpeed = 1;
if (rewindTimer < 0 || rewindTimer > 600)
rewindTimer = 0;
if (autoFireMaxCount < 1)
autoFireMaxCount = 1;
if (rewindTimer) {
rewindMemory = (char *)malloc(REWIND_NUM*REWIND_SIZE);
rewindSerials = (int *)calloc(REWIND_NUM, sizeof(int)); // init to zeroes
}
}
void LoadConfig()
{
agbPrint = ReadPrefHex("agbPrint");
autoFireMaxCount = fromDec(ReadPrefString("autoFireMaxCount"));
autoFrameSkip = ReadPref("autoFrameSkip", 0);
autoLoadMostRecent = ReadPref("autoLoadMostRecent", 0);
autoPatch = ReadPref("autoPatch", 1);
autoSaveLoadCheatList = ReadPref("autoSaveCheatList", 1);
aviRecordDir = ReadPrefString("aviRecordDir");
batteryDir = ReadPrefString("batteryDir");
biosFileNameGB = ReadPrefString("biosFileGB"); biosFileNameGB = ReadPrefString("biosFileGB");
biosFileNameGBA = ReadPrefString("biosFileGBA"); biosFileNameGBA = ReadPrefString("biosFileGBA");
biosFileNameGBC = ReadPrefString("biosFileGBC"); biosFileNameGBC = ReadPrefString("biosFileGBC");
captureFormat = ReadPref("captureFormat", 0);
cheatsEnabled = ReadPref("cheatsEnabled", 0);
cpuDisableSfx = ReadPref("disableSfx", 0);
cpuSaveType = ReadPrefHex("saveType");
disableMMX = ReadPref("disableMMX", 0);
disableStatusMessages = ReadPrefHex("disableStatus");
filterMT = ReadPref("filterEnableMultiThreading", 0);
filter = ReadPref("filter", 0);
frameSkip = ReadPref("frameSkip", 0);
fsAdapter = ReadPref("fsAdapter", 0);
fsColorDepth = ReadPref("fsColorDepth", 32);
fsFrequency = ReadPref("fsFrequency", 60);
fsHeight = ReadPref("fsHeight", 600);
fsWidth = ReadPref("fsWidth", 800);
fullScreen = ReadPrefHex("fullScreen");
fullScreenStretch = ReadPref("stretch", 0);
gbBorderAutomatic = ReadPref("borderAutomatic", 0);
gbBorderOn = ReadPrefHex("borderOn");
gbColorOption = ReadPref("colorOption", 0);
gbEmulatorType = ReadPref("emulatorType", 1);
gbFrameSkip = ReadPref("gbFrameSkip", 0);
gbPaletteOption = ReadPref("gbPaletteOption", 0);
gbSoundSetDeclicking(ReadPref("gbSoundDeclicking", 1));
gb_effects_config.echo = (float)ReadPref("gbSoundEffectsEcho", 20) / 100.0f;
gb_effects_config.enabled = ReadPref("gbSoundEffectsEnabled", 0);
gb_effects_config.stereo = (float)ReadPref("gbSoundEffectsStereo", 15) / 100.0f;
gb_effects_config.surround = ReadPref("gbSoundEffectsSurround", 0);
gdbBreakOnLoad = ReadPref("gdbBreakOnLoad", 0);
gdbPort = ReadPref("gdbPort", 55555);
glFilter = ReadPref("glFilter", 1);
ifbType = ReadPref("ifbType", 0);
joypadDefault = ReadPref("joypadDefault", 0);
languageOption = ReadPref("language", 1);
linkAuto = ReadPref("LinkAuto", 1);
linkHacks = ReadPref("LinkHacks", 0);
linkHostAddr = ReadPrefString("LinkHostAddr", "localhost");
linkMode = ReadPref("LinkMode", 0); // LINK_DISCONNECTED = 0
linkNumPlayers = ReadPref("LinkNumPlayers", 2);
linkTimeout = ReadPref("LinkTimeout", 1000);
loadDotCodeFile = ReadPrefString("loadDotCodeFile"); loadDotCodeFile = ReadPrefString("loadDotCodeFile");
saveDotCodeFile = ReadPrefString("saveDotCodeFile"); maxScale = ReadPref("maxScale", 0);
aviRecordDir = ReadPrefString("aviRecordDir");
movieRecordDir = ReadPrefString("movieRecordDir"); movieRecordDir = ReadPrefString("movieRecordDir");
soundRecordDir = ReadPrefString("soundRecordDir"); openGL = ReadPrefHex("openGL");
screenShotDir = ReadPrefString("screenShotDir"); optFlashSize = ReadPrefHex("flashSize");
saveDir = ReadPrefString("saveDir"); pauseWhenInactive = ReadPref("pauseWhenInactive", 1);
batteryDir = ReadPrefString("batteryDir"); recentFreeze = ReadPref("recentFreeze", 0);
rewindTimer = ReadPref("rewindTimer", 0);
romDirGBC = ReadPrefString("romDirGBC");
romDirGB = ReadPrefString("romDirGB"); romDirGB = ReadPrefString("romDirGB");
romDirGBA = ReadPrefString("romDirGBA"); romDirGBA = ReadPrefString("romDirGBA");
romDirGBC = ReadPrefString("romDirGBC");
linkHostAddr = ReadPrefString("LinkHostAddr", "localhost"); rtcEnabled = ReadPref("rtcEnabled", 0);
saveDir = ReadPrefString("saveDir");
saveDotCodeFile = ReadPrefString("saveDotCodeFile");
screenShotDir = ReadPrefString("screenShotDir");
showSpeed = ReadPref("showSpeed", 0);
showSpeedTransparent = ReadPref("showSpeedTransparent", 1);
skipBios = ReadPref("skipBios", 0);
skipSaveGameBattery = ReadPref("skipSaveGameBattery", 0);
skipSaveGameCheats = ReadPref("skipSaveGameCheats", 0);
soundFiltering = (float)ReadPref("gbaSoundFiltering", 50) / 100.0f;
soundInterpolation = ReadPref("gbaSoundInterpolation", 1);
soundRecordDir = ReadPrefString("soundRecordDir");
synchronize = ReadPref("synchronize", 1);
threadPriority = ReadPref("priority", 2);
throttle = ReadPref("throttle", 0);
tripleBuffering = ReadPref("tripleBuffering", 0);
useBios = ReadPrefHex("useBiosGBA");
useBiosFileGB = ReadPref("useBiosGB", 0);
useBiosFileGBA = ReadPref("useBiosGBA", 0);
useBiosFileGBC = ReadPref("useBiosGBC", 0);
videoOption = ReadPref("video", 2); // VIDEO_3X = 2
vsync = ReadPref("vsync", false);
windowPositionX = ReadPref("windowX", 0);
windowPositionY = ReadPref("windowY", 0);
winFlashSize = ReadPref("flashSize", 0x10000);
winGbBorderOn = ReadPref("borderOn", 0);
winGbPrinterEnabled = ReadPref("gbPrinter", 0);
int soundQuality = (ReadPrefHex("soundQuality")); int soundQuality = (ReadPrefHex("soundQuality"));
switch (soundQuality) { switch (soundQuality) {
@ -572,54 +547,28 @@ void LoadConfig()
case 4: case 4:
break; break;
default: default:
fprintf(stdout, "Unknown sound quality %d. Defaulting to 22Khz\n", log("Unknown sound quality %d. Defaulting to 22Khz\n", soundQuality);
soundQuality);
soundQuality = 2; soundQuality = 2;
break; break;
} }
soundSetSampleRate(44100 / soundQuality); soundSetSampleRate(44100 / soundQuality);
int res = (ReadPrefHex("soundEnable")) & 0x30f; int volume = ReadPref("soundVolume", 100);
soundSetEnable(res); float volume_percent = volume / 100.0f;
if (volume_percent < 0.0 || volume_percent > SOUND_MAX_VOLUME)
volume_percent = 1.0;
soundSetVolume(volume_percent);
soundSetEnable((ReadPrefHex("soundEnable")) & 0x30f);
if ((ReadPrefHex("soundStereo"))) { if ((ReadPrefHex("soundStereo"))) {
gb_effects_config.stereo = SOUND_STEREO;
gb_effects_config.enabled = true; gb_effects_config.enabled = true;
} }
if ((ReadPrefHex("soundEcho"))) { if ((ReadPrefHex("soundEcho"))) {
gb_effects_config.echo = SOUND_ECHO;
gb_effects_config.enabled = true; gb_effects_config.enabled = true;
} }
if ((ReadPrefHex("soundSurround"))) { if ((ReadPrefHex("soundSurround"))) {
gb_effects_config.surround = true; gb_effects_config.surround = true;
gb_effects_config.enabled = true; gb_effects_config.enabled = true;
} }
float volume = fromDec(ReadPrefString("soundVolume")) / 100.0;
if (volume < 0.0 || volume > SOUND_MAX_VOLUME)
volume = 1.0;
soundSetVolume(volume);
cpuSaveType = (ReadPrefHex("saveType"));
if (cpuSaveType < 0 || cpuSaveType > 5)
cpuSaveType = 0;
optFlashSize = (ReadPrefHex("flashSize"));
if (optFlashSize != 0 && optFlashSize != 1)
optFlashSize = 0;
ifbType = (IFBFilter)(ReadPrefHex("ifbType"));
if (ifbType < kIFBNone || ifbType >= kInvalidIFBFilter)
ifbType = kIFBNone;
showSpeed = (ReadPrefHex("showSpeed"));
if (showSpeed < 0 || showSpeed > 2)
showSpeed = 1;
rewindTimer = (ReadPrefHex("rewindTimer"));
if (rewindTimer < 0 || rewindTimer > 600)
rewindTimer = 0;
rewindTimer *= 6; // convert ReadPref("rewindTimer") to 10 frames multiple
autoFireMaxCount = fromDec(ReadPrefString("autoFireMaxCount"));
if (autoFireMaxCount < 1)
autoFireMaxCount = 1;
if (rewindTimer) {
rewindMemory = (char *)malloc(REWIND_NUM*REWIND_SIZE);
rewindSerials = (int *)calloc(REWIND_NUM, sizeof(int)); // init to zeroes
}
if (optFlashSize == 0) if (optFlashSize == 0)
flashSetSize(0x10000); flashSetSize(0x10000);
@ -639,6 +588,27 @@ void LoadConfig()
systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED;
optPrintUsage = 0; optPrintUsage = 0;
// TODO
//int s = ReadPref("mapViewStretch", 0);
//m_size = ReadPref("memViewerDataSize", 0);
//m_stretch = ReadPref("GBOamViewStretch", 0);
//m_stretch = ReadPref("tileViewStretch", 0);
//numberType = ReadPref("cheatsNumberType", 2);
//numberType = ReadPref("gbCheatsNumberType", 2);
//restoreValues = ReadPref("cheatsRestore", 0) ?
//scale = ReadPref("printerScale", 0);
//searchType = ReadPref("cheatsSearchType", SEARCH_EQ);
//searchType = ReadPref("gbCheatsSearchType",
//selectedFilter = ReadPref(("selectedFilter"), 0);
//sizeType = ReadPref("cheatsSizeType", 0);
//sizeType = ReadPref("gbCheatsSizeType", 0);
//updateValues = ReadPref("cheatsUpdate", 0);
//updateValues = ReadPref("gbCheatsUpdate", 0);
//valueType = ReadPref("cheatsValueType", 0);
//valueType = ReadPref("gbCheatsValueType", 0);
ValidateConfig();
} }
void CloseConfig() void CloseConfig()

View File

@ -54,7 +54,7 @@ extern int dsoundDisableHardwareAcceleration;
extern int filterHeight; extern int filterHeight;
extern int filterMagnification; extern int filterMagnification;
extern int filterMT; // enable multi-threading for pixel filters extern int filterMT; // enable multi-threading for pixel filters
extern int filterType; extern int filter;
extern int filterWidth; extern int filterWidth;
extern int frameSkip; extern int frameSkip;
extern int frameskipadjust; extern int frameskipadjust;
@ -69,6 +69,7 @@ extern int fullScreenStretch;
extern int gdbBreakOnLoad; extern int gdbBreakOnLoad;
extern int gdbPort; extern int gdbPort;
extern int glFilter; extern int glFilter;
extern int ifbType;
extern int joypadDefault; extern int joypadDefault;
extern int languageOption; extern int languageOption;
extern int layerEnable; extern int layerEnable;
@ -149,10 +150,8 @@ extern char *(patchNames[PATCH_MAX_NUM]); // and so on
extern int mouseCounter; extern int mouseCounter;
extern Filter filter;
extern FilterFunc filterFunction; extern FilterFunc filterFunction;
extern IFBFilterFunc ifbFunction; extern IFBFilterFunc ifbFunction;
extern int ifbType;
extern char* homeDir; extern char* homeDir;

View File

@ -97,17 +97,17 @@ const FilterDesc Filters[] = {
{ "xbrz5x", 5, 0, 0, xbrz5x32 } { "xbrz5x", 5, 0, 0, xbrz5x32 }
}; };
int getFilterEnlargeFactor(const Filter f) int getFilterEnlargeFactor(const int f)
{ {
return Filters[f].enlargeFactor; return Filters[f].enlargeFactor;
} }
char* getFilterName(const Filter f) char* getFilterName(const int f)
{ {
return (char*)Filters[f].name; return (char*)Filters[f].name;
} }
FilterFunc initFilter(const Filter f, const int colorDepth, const int srcWidth) FilterFunc initFilter(const int f, const int colorDepth, const int srcWidth)
{ {
FilterFunc func; FilterFunc func;

View File

@ -34,13 +34,13 @@ enum Filter { kStretch1x, kStretch2x, k2xSaI, kSuper2xSaI, kSuperEagle, kPixelat
typedef void(*FilterFunc)(u8*, u32, u8*, u8*, u32, int, int); typedef void(*FilterFunc)(u8*, u32, u8*, u8*, u32, int, int);
// Initialize a filter and get the corresponding filter function pointer // Initialize a filter and get the corresponding filter function pointer
FilterFunc initFilter(const Filter f, const int colorDepth, const int srcWidth); FilterFunc initFilter(const int f, const int colorDepth, const int srcWidth);
// Get the enlarge factor of a filter // Get the enlarge factor of a filter
int getFilterEnlargeFactor(const Filter f); int getFilterEnlargeFactor(const int f);
// Get the display name for a filter // Get the display name for a filter
char* getFilterName(const Filter f); char* getFilterName(const int f);
// //
// Interframe filters // Interframe filters

View File

@ -1180,74 +1180,74 @@ BOOL MainWnd::OnOptionsFilter(UINT nID)
switch(nID) switch(nID)
{ {
case ID_OPTIONS_FILTER_NORMAL: case ID_OPTIONS_FILTER_NORMAL:
filterType = FILTER_NONE; filter = FILTER_NONE;
break; break;
case ID_OPTIONS_FILTER_TVMODE: case ID_OPTIONS_FILTER_TVMODE:
filterType = FILTER_TVMODE; filter = FILTER_TVMODE;
break; break;
case ID_OPTIONS_FILTER_PLUGIN: case ID_OPTIONS_FILTER_PLUGIN:
filterType = FILTER_PLUGIN; filter = FILTER_PLUGIN;
if( strcmp( theApp.pluginName, "" ) == 0 ) { if( strcmp( theApp.pluginName, "" ) == 0 ) {
// open select plugin dialog when none selected // open select plugin dialog when none selected
OnOptionsSelectPlugin(); OnOptionsSelectPlugin();
} }
break; break;
case ID_OPTIONS_FILTER_2XSAI: case ID_OPTIONS_FILTER_2XSAI:
filterType = FILTER_2XSAI; filter = FILTER_2XSAI;
break; break;
case ID_OPTIONS_FILTER_SUPER2XSAI: case ID_OPTIONS_FILTER_SUPER2XSAI:
filterType = FILTER_SUPER2XSAI; filter = FILTER_SUPER2XSAI;
break; break;
case ID_OPTIONS_FILTER_SUPEREAGLE: case ID_OPTIONS_FILTER_SUPEREAGLE:
filterType = FILTER_SUPEREAGLE; filter = FILTER_SUPEREAGLE;
break; break;
case ID_OPTIONS_FILTER16BIT_PIXELATEEXPERIMENTAL: case ID_OPTIONS_FILTER16BIT_PIXELATEEXPERIMENTAL:
filterType = FILTER_PIXELATE; filter = FILTER_PIXELATE;
break; break;
case ID_OPTIONS_FILTER16BIT_ADVANCEMAMESCALE2X: case ID_OPTIONS_FILTER16BIT_ADVANCEMAMESCALE2X:
filterType = FILTER_MAMESCALE2X; filter = FILTER_MAMESCALE2X;
break; break;
case ID_OPTIONS_FILTER16BIT_SIMPLE2X: case ID_OPTIONS_FILTER16BIT_SIMPLE2X:
filterType = FILTER_SIMPLE2X; filter = FILTER_SIMPLE2X;
break; break;
case ID_OPTIONS_FILTER_BILINEAR: case ID_OPTIONS_FILTER_BILINEAR:
filterType = FILTER_BILINEAR; filter = FILTER_BILINEAR;
break; break;
case ID_OPTIONS_FILTER_BILINEARPLUS: case ID_OPTIONS_FILTER_BILINEARPLUS:
filterType = FILTER_BILINEARPLUS; filter = FILTER_BILINEARPLUS;
break; break;
case ID_OPTIONS_FILTER_SCANLINES: case ID_OPTIONS_FILTER_SCANLINES:
filterType = FILTER_SCANLINES; filter = FILTER_SCANLINES;
break; break;
case ID_OPTIONS_FILTER_HQ2X: case ID_OPTIONS_FILTER_HQ2X:
filterType = FILTER_HQ2X; filter = FILTER_HQ2X;
break; break;
case ID_OPTIONS_FILTER_LQ2X: case ID_OPTIONS_FILTER_LQ2X:
filterType = FILTER_LQ2X; filter = FILTER_LQ2X;
break; break;
case ID_OPTIONS_FILTER_SIMPLE3X: case ID_OPTIONS_FILTER_SIMPLE3X:
filterType = FILTER_SIMPLE3X; filter = FILTER_SIMPLE3X;
break; break;
case ID_OPTIONS_FILTER_SIMPLE4X: case ID_OPTIONS_FILTER_SIMPLE4X:
filterType = FILTER_SIMPLE4X; filter = FILTER_SIMPLE4X;
break; break;
case ID_OPTIONS_FILTER_HQ3X: case ID_OPTIONS_FILTER_HQ3X:
filterType = FILTER_HQ3X; filter = FILTER_HQ3X;
break; break;
case ID_OPTIONS_FILTER_HQ4X: case ID_OPTIONS_FILTER_HQ4X:
filterType = FILTER_HQ4X; filter = FILTER_HQ4X;
break; break;
case ID_OPTIONS_FILTER_XBRZ2X: case ID_OPTIONS_FILTER_XBRZ2X:
filterType = FILTER_XBRZ2X; filter = FILTER_XBRZ2X;
break; break;
case ID_OPTIONS_FILTER_XBRZ3X: case ID_OPTIONS_FILTER_XBRZ3X:
filterType = FILTER_XBRZ3X; filter = FILTER_XBRZ3X;
break; break;
case ID_OPTIONS_FILTER_XBRZ4X: case ID_OPTIONS_FILTER_XBRZ4X:
filterType = FILTER_XBRZ4X; filter = FILTER_XBRZ4X;
break; break;
case ID_OPTIONS_FILTER_XBRZ5X: case ID_OPTIONS_FILTER_XBRZ5X:
filterType = FILTER_XBRZ5X; filter = FILTER_XBRZ5X;
break; break;
default: default:
return FALSE; return FALSE;
@ -1262,71 +1262,71 @@ void MainWnd::OnUpdateOptionsFilter(CCmdUI *pCmdUI)
switch(pCmdUI->m_nID) { switch(pCmdUI->m_nID) {
case ID_OPTIONS_FILTER_NORMAL: case ID_OPTIONS_FILTER_NORMAL:
pCmdUI->SetCheck(filterType == FILTER_NONE); pCmdUI->SetCheck(filter == FILTER_NONE);
break; break;
case ID_OPTIONS_FILTER_TVMODE: case ID_OPTIONS_FILTER_TVMODE:
pCmdUI->SetCheck(filterType == FILTER_TVMODE); pCmdUI->SetCheck(filter == FILTER_TVMODE);
break; break;
case ID_OPTIONS_FILTER_2XSAI: case ID_OPTIONS_FILTER_2XSAI:
pCmdUI->SetCheck(filterType == FILTER_2XSAI); pCmdUI->SetCheck(filter == FILTER_2XSAI);
break; break;
case ID_OPTIONS_FILTER_SUPER2XSAI: case ID_OPTIONS_FILTER_SUPER2XSAI:
pCmdUI->SetCheck(filterType == FILTER_SUPER2XSAI); pCmdUI->SetCheck(filter == FILTER_SUPER2XSAI);
break; break;
case ID_OPTIONS_FILTER_PLUGIN: case ID_OPTIONS_FILTER_PLUGIN:
pCmdUI->Enable( !filterMT ); pCmdUI->Enable( !filterMT );
pCmdUI->SetCheck(filterType == FILTER_PLUGIN); pCmdUI->SetCheck(filter == FILTER_PLUGIN);
break; break;
case ID_OPTIONS_FILTER_SUPEREAGLE: case ID_OPTIONS_FILTER_SUPEREAGLE:
pCmdUI->SetCheck(filterType == FILTER_SUPEREAGLE); pCmdUI->SetCheck(filter == FILTER_SUPEREAGLE);
break; break;
case ID_OPTIONS_FILTER16BIT_PIXELATEEXPERIMENTAL: case ID_OPTIONS_FILTER16BIT_PIXELATEEXPERIMENTAL:
pCmdUI->SetCheck(filterType == FILTER_PIXELATE); pCmdUI->SetCheck(filter == FILTER_PIXELATE);
break; break;
case ID_OPTIONS_FILTER16BIT_ADVANCEMAMESCALE2X: case ID_OPTIONS_FILTER16BIT_ADVANCEMAMESCALE2X:
pCmdUI->SetCheck(filterType == FILTER_MAMESCALE2X); pCmdUI->SetCheck(filter == FILTER_MAMESCALE2X);
break; break;
case ID_OPTIONS_FILTER16BIT_SIMPLE2X: case ID_OPTIONS_FILTER16BIT_SIMPLE2X:
pCmdUI->SetCheck(filterType == FILTER_SIMPLE2X); pCmdUI->SetCheck(filter == FILTER_SIMPLE2X);
break; break;
case ID_OPTIONS_FILTER_BILINEAR: case ID_OPTIONS_FILTER_BILINEAR:
pCmdUI->SetCheck(filterType == FILTER_BILINEAR); pCmdUI->SetCheck(filter == FILTER_BILINEAR);
break; break;
case ID_OPTIONS_FILTER_BILINEARPLUS: case ID_OPTIONS_FILTER_BILINEARPLUS:
pCmdUI->SetCheck(filterType == FILTER_BILINEARPLUS); pCmdUI->SetCheck(filter == FILTER_BILINEARPLUS);
break; break;
case ID_OPTIONS_FILTER_SCANLINES: case ID_OPTIONS_FILTER_SCANLINES:
pCmdUI->SetCheck(filterType == FILTER_SCANLINES); pCmdUI->SetCheck(filter == FILTER_SCANLINES);
break; break;
case ID_OPTIONS_FILTER_HQ2X: case ID_OPTIONS_FILTER_HQ2X:
pCmdUI->SetCheck(filterType == FILTER_HQ2X); pCmdUI->SetCheck(filter == FILTER_HQ2X);
break; break;
case ID_OPTIONS_FILTER_LQ2X: case ID_OPTIONS_FILTER_LQ2X:
pCmdUI->SetCheck(filterType == FILTER_LQ2X); pCmdUI->SetCheck(filter == FILTER_LQ2X);
break; break;
case ID_OPTIONS_FILTER_SIMPLE3X: case ID_OPTIONS_FILTER_SIMPLE3X:
pCmdUI->SetCheck(filterType == FILTER_SIMPLE3X); pCmdUI->SetCheck(filter == FILTER_SIMPLE3X);
break; break;
case ID_OPTIONS_FILTER_SIMPLE4X: case ID_OPTIONS_FILTER_SIMPLE4X:
pCmdUI->SetCheck(filterType == FILTER_SIMPLE4X); pCmdUI->SetCheck(filter == FILTER_SIMPLE4X);
break; break;
case ID_OPTIONS_FILTER_HQ3X: case ID_OPTIONS_FILTER_HQ3X:
pCmdUI->SetCheck(filterType == FILTER_HQ3X); pCmdUI->SetCheck(filter == FILTER_HQ3X);
break; break;
case ID_OPTIONS_FILTER_HQ4X: case ID_OPTIONS_FILTER_HQ4X:
pCmdUI->SetCheck(filterType == FILTER_HQ4X); pCmdUI->SetCheck(filter == FILTER_HQ4X);
break; break;
case ID_OPTIONS_FILTER_XBRZ2X: case ID_OPTIONS_FILTER_XBRZ2X:
pCmdUI->SetCheck(filterType == FILTER_XBRZ2X); pCmdUI->SetCheck(filter == FILTER_XBRZ2X);
break; break;
case ID_OPTIONS_FILTER_XBRZ3X: case ID_OPTIONS_FILTER_XBRZ3X:
pCmdUI->SetCheck(filterType == FILTER_XBRZ3X); pCmdUI->SetCheck(filter == FILTER_XBRZ3X);
break; break;
case ID_OPTIONS_FILTER_XBRZ4X: case ID_OPTIONS_FILTER_XBRZ4X:
pCmdUI->SetCheck(filterType == FILTER_XBRZ4X); pCmdUI->SetCheck(filter == FILTER_XBRZ4X);
break; break;
case ID_OPTIONS_FILTER_XBRZ5X: case ID_OPTIONS_FILTER_XBRZ5X:
pCmdUI->SetCheck(filterType == FILTER_XBRZ5X); pCmdUI->SetCheck(filter == FILTER_XBRZ5X);
break; break;
} }
} }
@ -1605,7 +1605,7 @@ void MainWnd::OnOptionsSelectPlugin()
if (dlg.DoModal() == IDOK) if (dlg.DoModal() == IDOK)
{ {
filterType = FILTER_PLUGIN; filter = FILTER_PLUGIN;
theApp.updateFilter(); theApp.updateFilter();
} }
} }
@ -1782,6 +1782,6 @@ void MainWnd::OnPixelfilterMultiThreading()
void MainWnd::OnUpdatePixelfilterMultiThreading(CCmdUI *pCmdUI) void MainWnd::OnUpdatePixelfilterMultiThreading(CCmdUI *pCmdUI)
{ {
pCmdUI->Enable( filterType != FILTER_PLUGIN ); pCmdUI->Enable( filter != FILTER_PLUGIN );
pCmdUI->SetCheck( filterMT ? 1 : 0 ); pCmdUI->SetCheck( filterMT ? 1 : 0 );
} }

View File

@ -205,7 +205,7 @@ VBA::VBA()
filterFunction = NULL; filterFunction = NULL;
ifbFunction = NULL; ifbFunction = NULL;
ifbType = kIFBNone; ifbType = kIFBNone;
filterType = FILTER_NONE; filter = FILTER_NONE;
filterWidth = 0; filterWidth = 0;
filterHeight = 0; filterHeight = 0;
filterMT = false; filterMT = false;
@ -624,7 +624,7 @@ void VBA::updateFilter()
{ {
if ( systemColorDepth == 16 ) if ( systemColorDepth == 16 )
{ {
switch(filterType) switch(filter)
{ {
default: default:
case FILTER_NONE: case FILTER_NONE:
@ -636,7 +636,7 @@ void VBA::updateFilter()
filterFunction = rpiFilter; filterFunction = rpiFilter;
filterMagnification = rpiScaleFactor(); filterMagnification = rpiScaleFactor();
} else { } else {
filterType = FILTER_NONE; filter = FILTER_NONE;
updateFilter(); updateFilter();
return; return;
} }
@ -712,7 +712,7 @@ void VBA::updateFilter()
if ( systemColorDepth == 32 ) if ( systemColorDepth == 32 )
{ {
switch(filterType) switch(filter)
{ {
default: default:
case FILTER_NONE: case FILTER_NONE:
@ -725,7 +725,7 @@ void VBA::updateFilter()
filterMagnification = rpiScaleFactor(); filterMagnification = rpiScaleFactor();
b16to32Video=true; b16to32Video=true;
} else { } else {
filterType = FILTER_NONE; filter = FILTER_NONE;
updateFilter(); updateFilter();
return; return;
} }
@ -826,7 +826,7 @@ void VBA::updateFilter()
rect.bottom = sizeY * filterMagnification; rect.bottom = sizeY * filterMagnification;
if( filterType != FILTER_NONE ) if( filter != FILTER_NONE )
memset(delta, 0xFF, sizeof(delta)); memset(delta, 0xFF, sizeof(delta));
if( display ) if( display )
@ -1534,9 +1534,9 @@ void VBA::loadSettings()
glFilter = 1; glFilter = 1;
filterType = regQueryDwordValue("filter", 0); filter = regQueryDwordValue("filter", 0);
if(filterType < FILTER_NONE || filterType > FILTER_LAST) if(filter < FILTER_NONE || filter > FILTER_LAST)
filterType = FILTER_NONE; filter = FILTER_NONE;
filterMT = ( 1 == regQueryDwordValue("filterEnableMultiThreading", 0) ); filterMT = ( 1 == regQueryDwordValue("filterEnableMultiThreading", 0) );
@ -2554,7 +2554,7 @@ void VBA::saveSettings()
regSetDwordValue("glFilter", glFilter); regSetDwordValue("glFilter", glFilter);
regSetDwordValue("filter", filterType); regSetDwordValue("filter", filter);
regSetDwordValue("filterEnableMultiThreading", filterMT ? 1 : 0); regSetDwordValue("filterEnableMultiThreading", filterMT ? 1 : 0);