diff --git a/src/cores/main.cpp b/src/cores/main.cpp index c7730d96..716dadf6 100644 --- a/src/cores/main.cpp +++ b/src/cores/main.cpp @@ -26,7 +26,7 @@ int main(int argc, char **argv) { auto cfg = new PEMUConfig(io, pemu_version); // create main ui/renderer - auto fs = cfg->get(PEMUConfig::Id::GUI_FULLSCREEN); + auto fs = cfg->get(PEMUConfig::OptId::UI_FULLSCREEN); pemu_ui = new PEMUUiMain(io, (fs && !fs->getInteger()) ? Vector2f{1280, 720} : Vector2f{0, 0}); pemu_ui->setConfig(cfg); diff --git a/src/cores/pfbneo/sources/fbneo/drv.cpp b/src/cores/pfbneo/sources/fbneo/drv.cpp index cbeedf19..7e428bd1 100644 --- a/src/cores/pfbneo/sources/fbneo/drv.cpp +++ b/src/cores/pfbneo/sources/fbneo/drv.cpp @@ -78,7 +78,7 @@ static int DoLibInit() { return 1; } - NeoSystem = NeoSystemList[pemu_ui->getConfig()->get(PEMUConfig::Id::ROM_NEOBIOS, true)->getArrayIndex()]; + NeoSystem = NeoSystemList[pemu_ui->getConfig()->get(PEMUConfig::OptId::EMU_NEOBIOS, true)->getArrayIndex()]; nRet = BurnDrvInit(); printf("DoLibInit: BurnDrvInit = %i\n", nRet); diff --git a/src/cores/pfbneo/sources/pfbneo_config.cpp b/src/cores/pfbneo/sources/pfbneo_config.cpp index 11d2b4c5..06169553 100644 --- a/src/cores/pfbneo/sources/pfbneo_config.cpp +++ b/src/cores/pfbneo/sources/pfbneo_config.cpp @@ -20,27 +20,27 @@ PFBAConfig::PFBAConfig(c2d::Io *io, int version) : PEMUConfig(io, "PFBNEO", vers } /// MAIN OPTIONS - get(PEMUConfig::Id::GUI_SHOW_ZIP_NAMES)->setArrayIndex(0); + get(PEMUConfig::OptId::UI_SHOW_ZIP_NAMES)->setArrayIndex(0); /// ROMS OPTIONS - auto group = getGroup(PEMUConfig::Id::MENU_ROM_OPTIONS); + auto group = getGroup(PEMUConfig::OptId::MENU_ROM_OPTIONS); if (!group) { printf("PFBNConfig: error, group not found (MENU_ROM_OPTIONS)\n"); return; } - group->addOption({"FORCE_60HZ", {"OFF", "ON"}, 1, PEMUConfig::Id::ROM_FORCE_60HZ, C2D_CONFIG_RESTART_EMU_NEEDED}); + group->addOption({"FORCE_60HZ", {"OFF", "ON"}, 1, PEMUConfig::OptId::EMU_FORCE_60HZ, C2D_CONFIG_RESTART_EMU_NEEDED}); group->addOption({"AUDIO_FREQUENCY", {"11025", "22050", "32000", "44100", "48000"}, - 3, PEMUConfig::Id::ROM_AUDIO_FREQ, C2D_CONFIG_RESTART_EMU_NEEDED}); + 3, PEMUConfig::OptId::EMU_AUDIO_FREQ, C2D_CONFIG_RESTART_EMU_NEEDED}); group->addOption({"AUDIO_INTERPOLATION", {"0", "1", "3"}, - 2, PEMUConfig::Id::ROM_AUDIO_INTERPOLATION, C2D_CONFIG_RESTART_EMU_NEEDED}); + 2, PEMUConfig::OptId::EMU_AUDIO_INTERPOLATION, C2D_CONFIG_RESTART_EMU_NEEDED}); group->addOption({"AUDIO_FM_INTERPOLATION", {"0", "1", "3"}, - 2, PEMUConfig::Id::ROM_AUDIO_FMINTERPOLATION, C2D_CONFIG_RESTART_EMU_NEEDED}); + 2, PEMUConfig::OptId::EMU_AUDIO_FMINTERPOLATION, C2D_CONFIG_RESTART_EMU_NEEDED}); #ifdef __VITA__ group->addOption({"ROTATION", {"OFF", "ON", "FLIP", "CAB MODE"}, 1, PEMUConfig::Id::ROM_ROTATION, C2D_CONFIG_RESTART_EMU_NEEDED}); #else group->addOption({"ROTATION", {"OFF", "ON", "FLIP"}, - 1, PEMUConfig::Id::ROM_ROTATION, C2D_CONFIG_RESTART_EMU_NEEDED}); + 1, PEMUConfig::OptId::EMU_ROTATION, C2D_CONFIG_RESTART_EMU_NEEDED}); #endif group->addOption( {"NEOBIOS", {"UNIBIOS_4_0", "UNIBIOS_3_3", "UNIBIOS_3_2", "UNIBIOS_3_1", @@ -48,7 +48,7 @@ PFBAConfig::PFBAConfig(c2d::Io *io, int version) : PEMUConfig(io, "PFBNEO", vers "MVS_USA_V5S2", "MVS_USA_V5S4", "MVS_USA_V5S6", "MVS_JPN_V6", "MVS_JPN_V5", "MVS_JPN_V3S4", "MVS_JPN_J3", "AES_ASIA", "AES_JAPAN", "NEO_MVH_MV1CA", "NEO_MVH_MV1CJ", "DECK_V6", "DEVKIT"}, - 0, PEMUConfig::Id::ROM_NEOBIOS, C2D_CONFIG_RESTART_EMU_NEEDED}); + 0, PEMUConfig::OptId::EMU_NEOBIOS, C2D_CONFIG_RESTART_EMU_NEEDED}); #ifdef __PFBA_ARM__ // do not use unibios as default on vita for cyclone asm compatibility group->getOption(PEMUConfig::Id::ROM_NEOBIOS)->setArrayIndex(4); diff --git a/src/cores/pfbneo/sources/pfbneo_config.h b/src/cores/pfbneo/sources/pfbneo_config.h index bdee9d99..4feb31bb 100644 --- a/src/cores/pfbneo/sources/pfbneo_config.h +++ b/src/cores/pfbneo/sources/pfbneo_config.h @@ -34,10 +34,10 @@ class PFBAConfig : public pemu::PEMUConfig { std::vector getCoreHiddenOptionToEnable() override { return { - PEMUConfig::Id::GUI_FILTER_CLONES, - PEMUConfig::Id::GUI_FILTER_SYSTEM, - PEMUConfig::Id::GUI_FILTER_ROTATION, - PEMUConfig::Id::GUI_FILTER_RESOLUTION + PEMUConfig::OptId::UI_FILTER_CLONES, + PEMUConfig::OptId::UI_FILTER_SYSTEM, + PEMUConfig::OptId::UI_FILTER_ROTATION, + PEMUConfig::OptId::UI_FILTER_RESOLUTION }; } diff --git a/src/cores/pfbneo/sources/pfbneo_ui_emu.cpp b/src/cores/pfbneo/sources/pfbneo_ui_emu.cpp index 3a576e6b..7a79536f 100644 --- a/src/cores/pfbneo/sources/pfbneo_ui_emu.cpp +++ b/src/cores/pfbneo/sources/pfbneo_ui_emu.cpp @@ -157,10 +157,10 @@ int PFBAUiEmu::load(const ss_api::Game &game) { printf("nSekCpuCore: %s\n", nSekCpuCore > 0 ? "M68K" : "C68K (ASM)"); #endif - int audio_freq = pMain->getConfig()->get(PEMUConfig::Id::ROM_AUDIO_FREQ, true)->getInteger(); - nInterpolation = pMain->getConfig()->get(PEMUConfig::Id::ROM_AUDIO_INTERPOLATION, true)->getInteger(); - nFMInterpolation = pMain->getConfig()->get(PEMUConfig::Id::ROM_AUDIO_FMINTERPOLATION, true)->getInteger(); - bForce60Hz = pMain->getConfig()->get(PEMUConfig::Id::ROM_FORCE_60HZ, true)->getInteger(); + int audio_freq = pMain->getConfig()->get(PEMUConfig::OptId::EMU_AUDIO_FREQ, true)->getInteger(); + nInterpolation = pMain->getConfig()->get(PEMUConfig::OptId::EMU_AUDIO_INTERPOLATION, true)->getInteger(); + nFMInterpolation = pMain->getConfig()->get(PEMUConfig::OptId::EMU_AUDIO_FMINTERPOLATION, true)->getInteger(); + bForce60Hz = pMain->getConfig()->get(PEMUConfig::OptId::EMU_FORCE_60HZ, true)->getInteger(); if (bForce60Hz) { nBurnFPS = 6000; } @@ -264,7 +264,7 @@ bool PFBAUiEmu::onInput(c2d::Input::Player *players) { // 1 > "ON" // 2 > "FLIP" // 3 > "CAB" (vita/switch) - int rotation = getUi()->getConfig()->get(PEMUConfig::Id::ROM_ROTATION, true)->getArrayIndex(); + int rotation = getUi()->getConfig()->get(PEMUConfig::OptId::EMU_ROTATION, true)->getArrayIndex(); if (BurnDrvGetFlags() & BDF_ORIENTATION_VERTICAL) { if (rotation == 0) { pMain->getInput()->setRotation(Input::Rotation::R90, Input::Rotation::R0); diff --git a/src/cores/pfbneo/sources/pfbneo_ui_menu.cpp b/src/cores/pfbneo/sources/pfbneo_ui_menu.cpp index a95ec05b..daec0bb2 100644 --- a/src/cores/pfbneo/sources/pfbneo_ui_menu.cpp +++ b/src/cores/pfbneo/sources/pfbneo_ui_menu.cpp @@ -8,12 +8,12 @@ bool PFBAGuiMenu::isOptionHidden(c2d::config::Option *option) { ss_api::Game game = getUi()->getUiRomList()->getSelection(); - if (isRom() && option->getId() == PEMUConfig::Id::ROM_ROTATION && game.id > 0 && game.rotation == 0) { + if (isRom() && option->getId() == PEMUConfig::OptId::EMU_ROTATION && game.id > 0 && game.rotation == 0) { return true; } // Neo-Geo system id == 142 - if (isRom() && option->getId() == PEMUConfig::Id::ROM_NEOBIOS && game.id > 0 && game.system.id != 142) { + if (isRom() && option->getId() == PEMUConfig::OptId::EMU_NEOBIOS && game.id > 0 && game.system.id != 142) { return true; } diff --git a/src/cores/pgba/sources/pgba_config.cpp b/src/cores/pgba/sources/pgba_config.cpp index f7be2ef5..f131b09a 100644 --- a/src/cores/pgba/sources/pgba_config.cpp +++ b/src/cores/pgba/sources/pgba_config.cpp @@ -15,7 +15,7 @@ PGBAConfig::PGBAConfig(c2d::Io *io, int version) : PEMUConfig(io, "PGBA", versio } // no need for auto-scaling mode - getOption(PEMUConfig::Id::ROM_SCALING_MODE)->setArray({"ASPECT", "INTEGER"}, 0); + getOption(PEMUConfig::OptId::EMU_SCALING_MODE)->setArray({"ASPECT", "INTEGER"}, 0); // "c2dui_romlist" will also reload config, but we need new roms paths load(); diff --git a/src/cores/pgen/sources/pgen_config.cpp b/src/cores/pgen/sources/pgen_config.cpp index c1e188ca..f1b7bf30 100644 --- a/src/cores/pgen/sources/pgen_config.cpp +++ b/src/cores/pgen/sources/pgen_config.cpp @@ -15,7 +15,7 @@ PGENConfig::PGENConfig(c2d::Io *io, int version) : PEMUConfig(io, "PGEN", versio } // no need for auto-scaling mode - getOption(PEMUConfig::Id::ROM_SCALING_MODE)->setArray({"ASPECT", "INTEGER"}, 0); + getOption(PEMUConfig::OptId::EMU_SCALING_MODE)->setArray({"ASPECT", "INTEGER"}, 0); // "c2dui_romlist" will also reload config, but we need new roms paths load(); diff --git a/src/cores/pgen/sources/pgen_config.h b/src/cores/pgen/sources/pgen_config.h index 3c2059e9..364fe42a 100644 --- a/src/cores/pgen/sources/pgen_config.h +++ b/src/cores/pgen/sources/pgen_config.h @@ -27,7 +27,7 @@ class PGENConfig : public pemu::PEMUConfig { } std::vector getCoreHiddenOptionToEnable() override { - return {PEMUConfig::Id::GUI_FILTER_SYSTEM}; + return {PEMUConfig::OptId::UI_FILTER_SYSTEM}; } std::string getCoreVersion() override { diff --git a/src/cores/pnes/sources/pnes_config.cpp b/src/cores/pnes/sources/pnes_config.cpp index 373f60e1..6d548db6 100644 --- a/src/cores/pnes/sources/pnes_config.cpp +++ b/src/cores/pnes/sources/pnes_config.cpp @@ -17,7 +17,7 @@ PNESConfig::PNESConfig(c2d::Io *io, int version) : PEMUConfig(io, "PNES", versio } // no need for auto-scaling mode on pnes - getOption(PEMUConfig::Id::ROM_SCALING_MODE)->setArray({"ASPECT", "INTEGER"}, 0); + getOption(PEMUConfig::OptId::EMU_SCALING_MODE)->setArray({"ASPECT", "INTEGER"}, 0); #ifdef __SWITCH__ // on nintendo switch invert A/B buttons diff --git a/src/cores/psnes/sources/psnes_config.cpp b/src/cores/psnes/sources/psnes_config.cpp index 15d31fa1..4fccf1c8 100644 --- a/src/cores/psnes/sources/psnes_config.cpp +++ b/src/cores/psnes/sources/psnes_config.cpp @@ -16,32 +16,32 @@ PSNESConfig::PSNESConfig(c2d::Io *io, int version) : PEMUConfig(io, "PSNES", ver getGroup(CFG_ID_ROMS)->addOption({gl.cfg_name, io->getDataPath() + gl.rom_path + "/"}); } - auto group = getGroup(PEMUConfig::Id::MENU_ROM_OPTIONS); + auto group = getGroup(PEMUConfig::OptId::MENU_ROM_OPTIONS); if (!group) { printf("PSNESConfig: error, group not found (MENU_ROM_OPTIONS)\n"); return; } - group->addOption({"AUDIO_SYNC", {"OFF", "ON"}, 0, PEMUConfig::Id::ROM_AUDIO_SYNC, + group->addOption({"AUDIO_SYNC", {"OFF", "ON"}, 0, PEMUConfig::OptId::EMU_AUDIO_SYNC, "ON: PERFECT AUDIO - OFF: MINOR AUDIO STUTTERING (FAVOR FPS)"}); - group->addOption({"CHEATS", {"OFF", "ON"}, 1, PEMUConfig::Id::ROM_PSNES_CHEATS}); - group->addOption({"BLOCk_INVALID_VRAM", {"OFF", "ON"}, 1, PEMUConfig::Id::ROM_PSNES_BLOCK_VRAM}); - group->addOption({"TRANSPARENCY", {"OFF", "ON"}, 1, PEMUConfig::Id::ROM_PSNES_TRANSPARENCY}); - group->addOption({"DISPLAY_MESSAGES", {"OFF", "ON"}, 1, PEMUConfig::Id::ROM_PSNES_DISPLAY_MESSAGES}); + group->addOption({"CHEATS", {"OFF", "ON"}, 1, PEMUConfig::OptId::EMU_PSNES_CHEATS}); + group->addOption({"BLOCk_INVALID_VRAM", {"OFF", "ON"}, 1, PEMUConfig::OptId::EMU_PSNES_BLOCK_VRAM}); + group->addOption({"TRANSPARENCY", {"OFF", "ON"}, 1, PEMUConfig::OptId::EMU_PSNES_TRANSPARENCY}); + group->addOption({"DISPLAY_MESSAGES", {"OFF", "ON"}, 1, PEMUConfig::OptId::EMU_PSNES_DISPLAY_MESSAGES}); group->addOption({"FRAMESKIP", {"OFF", "AUTO", "1", "2", "3", "4", "5", "6", "7", "8", "9"}, - 0, PEMUConfig::Id::ROM_PSNES_FRAMESKIP}); + 0, PEMUConfig::OptId::EMU_PSNES_FRAMESKIP}); #ifdef __VITA__ get(PEMUConfig::Id::ROM_PSNES_FRAMESKIP)->setArrayIndex(3); #endif - group->addOption({"TURBO_MODE", {"OFF", "ON"}, 0, PEMUConfig::Id::ROM_PSNES_TURBO_MODE}); + group->addOption({"TURBO_MODE", {"OFF", "ON"}, 0, PEMUConfig::OptId::EMU_PSNES_TURBO_MODE}); group->addOption({"TURBO_FRAMESKIP", {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25"}, - 15, PEMUConfig::Id::ROM_PSNES_TURBO_FRAMESKIP}); + 15, PEMUConfig::OptId::EMU_PSNES_TURBO_FRAMESKIP}); // no need for auto-scaling mode - getOption(PEMUConfig::Id::ROM_SCALING_MODE)->setArray({"ASPECT", "INTEGER"}, 0); + getOption(PEMUConfig::OptId::EMU_SCALING_MODE)->setArray({"ASPECT", "INTEGER"}, 0); // "c2dui_romlist" will also reload config, but we need new roms paths load(); diff --git a/src/cores/psnes/sources/psnes_ui_emu.cpp b/src/cores/psnes/sources/psnes_ui_emu.cpp index ba267d21..ffe09ff9 100644 --- a/src/cores/psnes/sources/psnes_ui_emu.cpp +++ b/src/cores/psnes/sources/psnes_ui_emu.cpp @@ -91,13 +91,13 @@ int PSNESUiEmu::load(const ss_api::Game &game) { // audio Settings.Transparency = - pMain->getConfig()->get(PEMUConfig::Id::ROM_PSNES_TRANSPARENCY, true)->getInteger(); + pMain->getConfig()->get(PEMUConfig::OptId::EMU_PSNES_TRANSPARENCY, true)->getInteger(); Settings.AutoDisplayMessages = - pMain->getConfig()->get(PEMUConfig::Id::ROM_PSNES_DISPLAY_MESSAGES, true)->getInteger(); + pMain->getConfig()->get(PEMUConfig::OptId::EMU_PSNES_DISPLAY_MESSAGES, true)->getInteger(); Settings.InitialInfoStringTimeout = 120; Settings.HDMATimingHack = 100; Settings.BlockInvalidVRAMAccessMaster = - pMain->getConfig()->get(PEMUConfig::Id::ROM_PSNES_BLOCK_VRAM, true)->getInteger(); + pMain->getConfig()->get(PEMUConfig::OptId::EMU_PSNES_BLOCK_VRAM, true)->getInteger(); Settings.StopEmulation = TRUE; Settings.WrongMovieStateProtection = TRUE; Settings.DumpStreamsMaxFrames = -1; @@ -107,7 +107,7 @@ int PSNESUiEmu::load(const ss_api::Game &game) { Settings.FastSavestates = TRUE; Settings.SeparateEchoBuffer = FALSE; - int skipFramesCfg = pMain->getConfig()->get(PEMUConfig::Id::ROM_PSNES_FRAMESKIP, true)->getArrayIndex(); + int skipFramesCfg = pMain->getConfig()->get(PEMUConfig::OptId::EMU_PSNES_FRAMESKIP, true)->getArrayIndex(); if (skipFramesCfg == 0) { Settings.SkipFrames = 0; } else if (skipFramesCfg == 1) { @@ -116,8 +116,8 @@ int PSNESUiEmu::load(const ss_api::Game &game) { Settings.SkipFrames = skipFramesCfg - 1; } printf("Settings.SkipFrames: %i\n", Settings.SkipFrames); - Settings.TurboMode = pMain->getConfig()->get(PEMUConfig::Id::ROM_PSNES_TURBO_MODE, true)->getInteger(); - Settings.TurboSkipFrames = pMain->getConfig()->get(PEMUConfig::Id::ROM_PSNES_TURBO_FRAMESKIP, + Settings.TurboMode = pMain->getConfig()->get(PEMUConfig::OptId::EMU_PSNES_TURBO_MODE, true)->getInteger(); + Settings.TurboSkipFrames = pMain->getConfig()->get(PEMUConfig::OptId::EMU_PSNES_TURBO_FRAMESKIP, true)->getArrayIndex(); Settings.CartAName[0] = 0; Settings.CartBName[0] = 0; @@ -172,7 +172,7 @@ int PSNESUiEmu::load(const ss_api::Game &game) { Memory.LoadSRAM(S9xGetFilename(".srm", SRAM_DIR).c_str()); - Settings.ApplyCheats = pMain->getConfig()->get(PEMUConfig::Id::ROM_PSNES_CHEATS, true)->getInteger(); + Settings.ApplyCheats = pMain->getConfig()->get(PEMUConfig::OptId::EMU_PSNES_CHEATS, true)->getInteger(); S9xDeleteCheats(); S9xCheatsEnable(); if (Settings.ApplyCheats) { @@ -188,7 +188,7 @@ int PSNESUiEmu::load(const ss_api::Game &game) { (float) Memory.ROMFramesPerSecond); addAudio((int) Settings.SoundPlaybackRate, samples * 2); audio_buffer = malloc(getAudio()->getSamplesSize() * getAudio()->getChannels() * 5); - optionAudioSync = pMain->getConfig()->get(PEMUConfig::Id::ROM_AUDIO_SYNC, true); + optionAudioSync = pMain->getConfig()->get(PEMUConfig::OptId::EMU_AUDIO_SYNC, true); // video S9xGraphicsInit(); diff --git a/src/skeleton/pemu_config.cpp b/src/skeleton/pemu_config.cpp index f29c9565..137eb5f3 100644 --- a/src/skeleton/pemu_config.cpp +++ b/src/skeleton/pemu_config.cpp @@ -18,24 +18,26 @@ PEMUConfig::PEMUConfig(c2d::Io *io, const std::string &name, int version) Group roms("ROMS", CFG_ID_ROMS); addGroup(roms); - /* - * UI - */ - Group main("UI", Id::MENU_MAIN); - main.addOption({"SHOW_FAVORITES", {"OFF", "ON"}, 0, Id::GUI_SHOW_FAVORITES}); - main.addOption({"SHOW_AVAILABLE", {"OFF", "ON"}, 0, Id::GUI_SHOW_AVAILABLE}); - main.addOption({"SHOW_CLONES", {"OFF", "ON"}, 0, Id::GUI_FILTER_CLONES})->setFlags(Flags::HIDDEN); - main.addOption({"SHOW_ZIP_NAMES", {"OFF", "ON"}, 1, Id::GUI_SHOW_ZIP_NAMES}); + /// UI_FILTERING + Group ui_filtering("UI_FILTERING", GrpId::UI_FILTERING); + ui_filtering.addOption({"FILTER_FAVORITES", {"OFF", "ON"}, 0, OptId::UI_FILTER_FAVORITES}); + ui_filtering.addOption({"FILTER_AVAILABLE", {"OFF", "ON"}, 0, OptId::UI_FILTER_AVAILABLE}); + ui_filtering.addOption({"FILTER_CLONES", {"OFF", "ON"}, 1, OptId::UI_FILTER_CLONES})->setFlags(Flags::HIDDEN); + addGroup(ui_filtering); + + /// UI_OPTIONS + Group main("UI_OPTIONS", GrpId::UI_OPTIONS); + main.addOption({"SHOW_ZIP_NAMES", {"OFF", "ON"}, 1, OptId::UI_SHOW_ZIP_NAMES}); #ifdef __FULLSCREEN__ - main.addOption({"FULLSCREEN", {"OFF", "ON"}, 1, Id::GUI_FULLSCREEN, C2D_CONFIG_RESTART_NEEDED}); + main.addOption({"FULLSCREEN", {"OFF", "ON"}, 1, OptId::UI_FULLSCREEN, PEMU_CONFIG_RESTART_NEEDED}); #endif Vector2i displaySize = C2DDevice::getDisplaySize(); int aspect_index = (float) displaySize.x / (float) displaySize.y > 1.33f ? 0 : 1; main.addOption({"SKIN_ASPECT", {"16/9", "4/3"}, aspect_index, - Id::GUI_SKIN_ASPECT, C2D_CONFIG_RESTART_NEEDED}); + OptId::UI_SKIN_ASPECT, PEMU_CONFIG_RESTART_NEEDED}); main.addOption({"FONT_SCALING", {"0", "1", "2", "3", "4", "5"}, 0, - Id::GUI_FONT_SCALING, C2D_CONFIG_RESTART_NEEDED}); - main.addOption({"VIDEO_SNAP_DELAY", {"3", "5", "7", "10"}, 1, Id::GUI_VIDEO_SNAP_DELAY}); + OptId::UI_FONT_SCALING, PEMU_CONFIG_RESTART_NEEDED}); + main.addOption({"VIDEO_SNAP_DELAY", {"3", "5", "7", "10"}, 1, OptId::UI_VIDEO_SNAP_DELAY}); // build skin list std::vector skins; @@ -72,81 +74,82 @@ PEMUConfig::PEMUConfig(c2d::Io *io, const std::string &name, int version) index = (int) i; } } - main.addOption({"SKIN", skins, index, PEMUConfig::Id::GUI_SKIN}); + main.addOption({"SKIN", skins, index, PEMUConfig::OptId::UI_SKIN}); addGroup(main); /* * Emulators options */ - Group emu_grp("EMULATION", Id::MENU_ROM_OPTIONS); + Group emu_grp("EMULATION", GrpId::EMULATION); if (displaySize.y > 1080) { emu_grp.addOption( {"SCALING", {"NONE", "2X", "3X", "4X", "5X", "6X", "7X", "8X", "9X", "FIT", "FULL"}, 6, - Id::ROM_SCALING}); + OptId::EMU_SCALING}); } else if (displaySize.y > 720) { - emu_grp.addOption({"SCALING", {"NONE", "2X", "3X", "4X", "FIT", "FULL"}, 4, Id::ROM_SCALING}); + emu_grp.addOption({"SCALING", {"NONE", "2X", "3X", "4X", "FIT", "FULL"}, 4, OptId::EMU_SCALING}); } else if (displaySize.y > 544) { - emu_grp.addOption({"SCALING", {"NONE", "2X", "3X", "FIT", "FULL"}, 3, Id::ROM_SCALING}); + emu_grp.addOption({"SCALING", {"NONE", "2X", "3X", "FIT", "FULL"}, 3, OptId::EMU_SCALING}); } else if (displaySize.y > 240) { - emu_grp.addOption({"SCALING", {"NONE", "2X", "FIT", "FULL"}, 2, Id::ROM_SCALING}); + emu_grp.addOption({"SCALING", {"NONE", "2X", "FIT", "FULL"}, 2, OptId::EMU_SCALING}); } else { - emu_grp.addOption({"SCALING", {"NONE", "FIT", "FULL"}, 1, Id::ROM_SCALING}); + emu_grp.addOption({"SCALING", {"NONE", "FIT", "FULL"}, 1, OptId::EMU_SCALING}); } - emu_grp.addOption({"SCALING_MODE", {"AUTO", "ASPECT", "INTEGER"}, 1, Id::ROM_SCALING_MODE}); - emu_grp.addOption({"FILTER", {std::string("POINT"), std::string("LINEAR")}, 1, Id::ROM_FILTER}); + emu_grp.addOption({"SCALING_MODE", {"AUTO", "ASPECT", "INTEGER"}, 1, OptId::EMU_SCALING_MODE}); + emu_grp.addOption({"FILTER", {std::string("POINT"), std::string("LINEAR")}, 1, OptId::EMU_FILTER}); + emu_grp.addOption({"EFFECT", {"NONE"}, 0, PEMUConfig::OptId::EMU_SHADER})->setFlags(Flags::HIDDEN); #ifdef __VITA__ emu_grp.addOption({"WAIT_RENDERING", {"OFF", "ON"}, 1, Id::ROM_WAIT_RENDERING}); #endif - emu_grp.addOption({"SHOW_FPS", {"OFF", "ON"}, 0, Id::ROM_SHOW_FPS}); + emu_grp.addOption({"SHOW_FPS", {"OFF", "ON"}, 0, OptId::EMU_SHOW_FPS}); addGroup(emu_grp); /* * Inputs options */ - Group joy_grp("GAMEPAD", Id::MENU_JOYPAD); - joy_grp.addOption({"JOY_UP", KEY_JOY_UP_DEFAULT, Id::JOY_UP})->setFlags(Flags::INPUT); - joy_grp.addOption({"JOY_DOWN", KEY_JOY_DOWN_DEFAULT, Id::JOY_DOWN})->setFlags(Flags::INPUT); - joy_grp.addOption({"JOY_LEFT", KEY_JOY_LEFT_DEFAULT, Id::JOY_LEFT})->setFlags(Flags::INPUT); - joy_grp.addOption({"JOY_RIGHT", KEY_JOY_RIGHT_DEFAULT, Id::JOY_RIGHT})->setFlags(Flags::INPUT); - joy_grp.addOption({"JOY_A", KEY_JOY_A_DEFAULT, Id::JOY_A})->setFlags(Flags::INPUT); - joy_grp.addOption({"JOY_B", KEY_JOY_B_DEFAULT, Id::JOY_B})->setFlags(Flags::INPUT); - joy_grp.addOption({"JOY_X", KEY_JOY_X_DEFAULT, Id::JOY_X})->setFlags(Flags::INPUT); - joy_grp.addOption({"JOY_Y", KEY_JOY_Y_DEFAULT, Id::JOY_Y})->setFlags(Flags::INPUT); - joy_grp.addOption({"JOY_LT", KEY_JOY_LT_DEFAULT, Id::JOY_LT})->setFlags(Flags::INPUT); - joy_grp.addOption({"JOY_RT", KEY_JOY_RT_DEFAULT, Id::JOY_RT})->setFlags(Flags::INPUT); - joy_grp.addOption({"JOY_LB", KEY_JOY_LB_DEFAULT, Id::JOY_LB})->setFlags(Flags::INPUT); - joy_grp.addOption({"JOY_RB", KEY_JOY_RB_DEFAULT, Id::JOY_RB})->setFlags(Flags::INPUT); - joy_grp.addOption({"JOY_SELECT", KEY_JOY_SELECT_DEFAULT, Id::JOY_SELECT})->setFlags(Flags::INPUT); - joy_grp.addOption({"JOY_START", KEY_JOY_START_DEFAULT, Id::JOY_START})->setFlags(Flags::INPUT); - joy_grp.addOption({"JOY_MENU1", KEY_JOY_MENU1_DEFAULT, Id::JOY_MENU1})->setFlags(Flags::INPUT); - joy_grp.addOption({"JOY_MENU2", KEY_JOY_MENU2_DEFAULT, Id::JOY_MENU2})->setFlags(Flags::INPUT); - joy_grp.addOption({"JOY_AXIS_LX", KEY_JOY_AXIS_LX, Id::JOY_AXIS_LX})->setFlags(Flags::INPUT | Flags::HIDDEN); - joy_grp.addOption({"JOY_AXIS_LY", KEY_JOY_AXIS_LY, Id::JOY_AXIS_LY})->setFlags(Flags::INPUT | Flags::HIDDEN); - joy_grp.addOption({"JOY_AXIS_RX", KEY_JOY_AXIS_RX, Id::JOY_AXIS_RX})->setFlags(Flags::INPUT | Flags::HIDDEN); - joy_grp.addOption({"JOY_AXIS_RY", KEY_JOY_AXIS_RY, Id::JOY_AXIS_RY})->setFlags(Flags::INPUT | Flags::HIDDEN); + Group joy_grp("GAMEPAD", GrpId::GAMEPAD); + joy_grp.addOption({"JOY_UP", KEY_JOY_UP_DEFAULT, OptId::JOY_UP})->setFlags(Flags::INPUT); + joy_grp.addOption({"JOY_DOWN", KEY_JOY_DOWN_DEFAULT, OptId::JOY_DOWN})->setFlags(Flags::INPUT); + joy_grp.addOption({"JOY_LEFT", KEY_JOY_LEFT_DEFAULT, OptId::JOY_LEFT})->setFlags(Flags::INPUT); + joy_grp.addOption({"JOY_RIGHT", KEY_JOY_RIGHT_DEFAULT, OptId::JOY_RIGHT})->setFlags(Flags::INPUT); + joy_grp.addOption({"JOY_A", KEY_JOY_A_DEFAULT, OptId::JOY_A})->setFlags(Flags::INPUT); + joy_grp.addOption({"JOY_B", KEY_JOY_B_DEFAULT, OptId::JOY_B})->setFlags(Flags::INPUT); + joy_grp.addOption({"JOY_X", KEY_JOY_X_DEFAULT, OptId::JOY_X})->setFlags(Flags::INPUT); + joy_grp.addOption({"JOY_Y", KEY_JOY_Y_DEFAULT, OptId::JOY_Y})->setFlags(Flags::INPUT); + joy_grp.addOption({"JOY_LT", KEY_JOY_LT_DEFAULT, OptId::JOY_LT})->setFlags(Flags::INPUT); + joy_grp.addOption({"JOY_RT", KEY_JOY_RT_DEFAULT, OptId::JOY_RT})->setFlags(Flags::INPUT); + joy_grp.addOption({"JOY_LB", KEY_JOY_LB_DEFAULT, OptId::JOY_LB})->setFlags(Flags::INPUT); + joy_grp.addOption({"JOY_RB", KEY_JOY_RB_DEFAULT, OptId::JOY_RB})->setFlags(Flags::INPUT); + joy_grp.addOption({"JOY_SELECT", KEY_JOY_SELECT_DEFAULT, OptId::JOY_SELECT})->setFlags(Flags::INPUT); + joy_grp.addOption({"JOY_START", KEY_JOY_START_DEFAULT, OptId::JOY_START})->setFlags(Flags::INPUT); + joy_grp.addOption({"JOY_MENU1", KEY_JOY_MENU1_DEFAULT, OptId::JOY_MENU1})->setFlags(Flags::INPUT); + joy_grp.addOption({"JOY_MENU2", KEY_JOY_MENU2_DEFAULT, OptId::JOY_MENU2})->setFlags(Flags::INPUT); + joy_grp.addOption({"JOY_AXIS_LX", KEY_JOY_AXIS_LX, OptId::JOY_AXIS_LX})->setFlags(Flags::INPUT | Flags::HIDDEN); + joy_grp.addOption({"JOY_AXIS_LY", KEY_JOY_AXIS_LY, OptId::JOY_AXIS_LY})->setFlags(Flags::INPUT | Flags::HIDDEN); + joy_grp.addOption({"JOY_AXIS_RX", KEY_JOY_AXIS_RX, OptId::JOY_AXIS_RX})->setFlags(Flags::INPUT | Flags::HIDDEN); + joy_grp.addOption({"JOY_AXIS_RY", KEY_JOY_AXIS_RY, OptId::JOY_AXIS_RY})->setFlags(Flags::INPUT | Flags::HIDDEN); joy_grp.addOption({"JOY_DEADZONE", {"2000", "4000", "6000", "8000", "10000", "12000", "14000", "16000", "18000", "20000", "22000", "24000", "26000", "28000", "30000"}, - 3, Id::JOY_DEADZONE}); + 3, OptId::JOY_DEADZONE}); addGroup(joy_grp); #ifndef NO_KEYBOARD - Group kb_grp("KEYBOARD", Id::MENU_KEYBOARD); - kb_grp.addOption({"KEY_UP", KEY_KB_UP_DEFAULT, Id::KEY_UP})->setFlags(Flags::INPUT); - kb_grp.addOption({"KEY_DOWN", KEY_KB_DOWN_DEFAULT, Id::KEY_DOWN})->setFlags(Flags::INPUT); - kb_grp.addOption({"KEY_LEFT", KEY_KB_LEFT_DEFAULT, Id::KEY_LEFT})->setFlags(Flags::INPUT); - kb_grp.addOption({"KEY_RIGHT", KEY_KB_RIGHT_DEFAULT, Id::KEY_RIGHT})->setFlags(Flags::INPUT); - kb_grp.addOption({"KEY_A", KEY_KB_A_DEFAULT, Id::KEY_A})->setFlags(Flags::INPUT); - kb_grp.addOption({"KEY_B", KEY_KB_B_DEFAULT, Id::KEY_B})->setFlags(Flags::INPUT); - kb_grp.addOption({"KEY_X", KEY_KB_X_DEFAULT, Id::KEY_X})->setFlags(Flags::INPUT); - kb_grp.addOption({"KEY_Y", KEY_KB_Y_DEFAULT, Id::KEY_Y})->setFlags(Flags::INPUT); - kb_grp.addOption({"KEY_LT", KEY_KB_LT_DEFAULT, Id::KEY_LT})->setFlags(Flags::INPUT); - kb_grp.addOption({"KEY_RT", KEY_KB_RT_DEFAULT, Id::KEY_RT})->setFlags(Flags::INPUT); - kb_grp.addOption({"KEY_LB", KEY_KB_LB_DEFAULT, Id::KEY_LB})->setFlags(Flags::INPUT); - kb_grp.addOption({"KEY_RB", KEY_KB_RB_DEFAULT, Id::KEY_RB})->setFlags(Flags::INPUT); - kb_grp.addOption({"KEY_SELECT", KEY_KB_SELECT_DEFAULT, Id::KEY_SELECT})->setFlags(Flags::INPUT); - kb_grp.addOption({"KEY_START", KEY_KB_START_DEFAULT, Id::KEY_START})->setFlags(Flags::INPUT); - kb_grp.addOption({"KEY_MENU1", KEY_KB_MENU1_DEFAULT, Id::KEY_MENU1})->setFlags(Flags::INPUT); - kb_grp.addOption({"KEY_MENU2", KEY_KB_MENU2_DEFAULT, Id::KEY_MENU2})->setFlags(Flags::INPUT); + Group kb_grp("KEYBOARD", GrpId::KEYBOARD); + kb_grp.addOption({"KEY_UP", KEY_KB_UP_DEFAULT, OptId::KEY_UP})->setFlags(Flags::INPUT); + kb_grp.addOption({"KEY_DOWN", KEY_KB_DOWN_DEFAULT, OptId::KEY_DOWN})->setFlags(Flags::INPUT); + kb_grp.addOption({"KEY_LEFT", KEY_KB_LEFT_DEFAULT, OptId::KEY_LEFT})->setFlags(Flags::INPUT); + kb_grp.addOption({"KEY_RIGHT", KEY_KB_RIGHT_DEFAULT, OptId::KEY_RIGHT})->setFlags(Flags::INPUT); + kb_grp.addOption({"KEY_A", KEY_KB_A_DEFAULT, OptId::KEY_A})->setFlags(Flags::INPUT); + kb_grp.addOption({"KEY_B", KEY_KB_B_DEFAULT, OptId::KEY_B})->setFlags(Flags::INPUT); + kb_grp.addOption({"KEY_X", KEY_KB_X_DEFAULT, OptId::KEY_X})->setFlags(Flags::INPUT); + kb_grp.addOption({"KEY_Y", KEY_KB_Y_DEFAULT, OptId::KEY_Y})->setFlags(Flags::INPUT); + kb_grp.addOption({"KEY_LT", KEY_KB_LT_DEFAULT, OptId::KEY_LT})->setFlags(Flags::INPUT); + kb_grp.addOption({"KEY_RT", KEY_KB_RT_DEFAULT, OptId::KEY_RT})->setFlags(Flags::INPUT); + kb_grp.addOption({"KEY_LB", KEY_KB_LB_DEFAULT, OptId::KEY_LB})->setFlags(Flags::INPUT); + kb_grp.addOption({"KEY_RB", KEY_KB_RB_DEFAULT, OptId::KEY_RB})->setFlags(Flags::INPUT); + kb_grp.addOption({"KEY_SELECT", KEY_KB_SELECT_DEFAULT, OptId::KEY_SELECT})->setFlags(Flags::INPUT); + kb_grp.addOption({"KEY_START", KEY_KB_START_DEFAULT, OptId::KEY_START})->setFlags(Flags::INPUT); + kb_grp.addOption({"KEY_MENU1", KEY_KB_MENU1_DEFAULT, OptId::KEY_MENU1})->setFlags(Flags::INPUT); + kb_grp.addOption({"KEY_MENU2", KEY_KB_MENU2_DEFAULT, OptId::KEY_MENU2})->setFlags(Flags::INPUT); addGroup(kb_grp); #endif } @@ -162,16 +165,16 @@ bool PEMUConfig::loadGame(const Game &game) { p_game_config = new Config(getName() + "_GAME", path, getAppVersion()); // copy game emulation config section from main config for default options - getGroup(Id::MENU_ROM_OPTIONS)->copy(&group); + getGroup(GrpId::EMULATION)->copy(&group); p_game_config->addGroup(group); // copy game gamepad config from main config for default options - getGroup(Id::MENU_JOYPAD)->copy(&group); + getGroup(GrpId::GAMEPAD)->copy(&group); p_game_config->addGroup(group); #ifndef NO_KEYBOARD // copy game keyboard config from main config for default options - getGroup(Id::MENU_KEYBOARD)->copy(&group); + getGroup(GrpId::KEYBOARD)->copy(&group); p_game_config->addGroup(group); #endif @@ -213,22 +216,22 @@ std::string PEMUConfig::getRomPath(const std::string &name) { std::vector PEMUConfig::getKeyboardMapping(int player, bool isGame) { #ifndef NO_KEYBOARD return { - {Input::Button::Up, getOption(Id::KEY_UP, isGame)->getInteger()}, - {Input::Button::Down, getOption(Id::KEY_DOWN, isGame)->getInteger()}, - {Input::Button::Left, getOption(Id::KEY_LEFT, isGame)->getInteger()}, - {Input::Button::Right, getOption(Id::KEY_RIGHT, isGame)->getInteger()}, - {Input::Button::Select, getOption(Id::KEY_SELECT, isGame)->getInteger()}, - {Input::Button::Start, getOption(Id::KEY_START, isGame)->getInteger()}, - {Input::Button::A, getOption(Id::KEY_A, isGame)->getInteger()}, - {Input::Button::B, getOption(Id::KEY_B, isGame)->getInteger()}, - {Input::Button::X, getOption(Id::KEY_X, isGame)->getInteger()}, - {Input::Button::Y, getOption(Id::KEY_Y, isGame)->getInteger()}, - {Input::Button::LT, getOption(Id::KEY_LT, isGame)->getInteger()}, - {Input::Button::RT, getOption(Id::KEY_RT, isGame)->getInteger()}, - {Input::Button::LB, getOption(Id::KEY_LB, isGame)->getInteger()}, - {Input::Button::RB, getOption(Id::KEY_RB, isGame)->getInteger()}, - {Input::Button::Menu1, getOption(Id::KEY_MENU1, isGame)->getInteger()}, - {Input::Button::Menu2, getOption(Id::KEY_MENU2, isGame)->getInteger()} + {Input::Button::Up, getOption(OptId::KEY_UP, isGame)->getInteger()}, + {Input::Button::Down, getOption(OptId::KEY_DOWN, isGame)->getInteger()}, + {Input::Button::Left, getOption(OptId::KEY_LEFT, isGame)->getInteger()}, + {Input::Button::Right, getOption(OptId::KEY_RIGHT, isGame)->getInteger()}, + {Input::Button::Select, getOption(OptId::KEY_SELECT, isGame)->getInteger()}, + {Input::Button::Start, getOption(OptId::KEY_START, isGame)->getInteger()}, + {Input::Button::A, getOption(OptId::KEY_A, isGame)->getInteger()}, + {Input::Button::B, getOption(OptId::KEY_B, isGame)->getInteger()}, + {Input::Button::X, getOption(OptId::KEY_X, isGame)->getInteger()}, + {Input::Button::Y, getOption(OptId::KEY_Y, isGame)->getInteger()}, + {Input::Button::LT, getOption(OptId::KEY_LT, isGame)->getInteger()}, + {Input::Button::RT, getOption(OptId::KEY_RT, isGame)->getInteger()}, + {Input::Button::LB, getOption(OptId::KEY_LB, isGame)->getInteger()}, + {Input::Button::RB, getOption(OptId::KEY_RB, isGame)->getInteger()}, + {Input::Button::Menu1, getOption(OptId::KEY_MENU1, isGame)->getInteger()}, + {Input::Button::Menu2, getOption(OptId::KEY_MENU2, isGame)->getInteger()} }; #else return {}; @@ -238,41 +241,41 @@ std::vector PEMUConfig::getKeyboardMapping(int player std::vector PEMUConfig::getJoystickMapping(int player, bool isGame) { // TODO: allow per player config return { - {Input::Button::Up, getOption(Id::JOY_UP, isGame)->getInteger()}, - {Input::Button::Down, getOption(Id::JOY_DOWN, isGame)->getInteger()}, - {Input::Button::Left, getOption(Id::JOY_LEFT, isGame)->getInteger()}, - {Input::Button::Right, getOption(Id::JOY_RIGHT, isGame)->getInteger()}, - {Input::Button::Select, getOption(Id::JOY_SELECT, isGame)->getInteger()}, - {Input::Button::Start, getOption(Id::JOY_START, isGame)->getInteger()}, - {Input::Button::A, getOption(Id::JOY_A, isGame)->getInteger()}, - {Input::Button::B, getOption(Id::JOY_B, isGame)->getInteger()}, - {Input::Button::X, getOption(Id::JOY_X, isGame)->getInteger()}, - {Input::Button::Y, getOption(Id::JOY_Y, isGame)->getInteger()}, - {Input::Button::LT, getOption(Id::JOY_LT, isGame)->getInteger()}, - {Input::Button::RT, getOption(Id::JOY_RT, isGame)->getInteger()}, - {Input::Button::LB, getOption(Id::JOY_LB, isGame)->getInteger()}, - {Input::Button::RB, getOption(Id::JOY_RB, isGame)->getInteger()}, - {Input::Button::Menu1, getOption(Id::JOY_MENU1, isGame)->getInteger()}, - {Input::Button::Menu2, getOption(Id::JOY_MENU2, isGame)->getInteger()} + {Input::Button::Up, getOption(OptId::JOY_UP, isGame)->getInteger()}, + {Input::Button::Down, getOption(OptId::JOY_DOWN, isGame)->getInteger()}, + {Input::Button::Left, getOption(OptId::JOY_LEFT, isGame)->getInteger()}, + {Input::Button::Right, getOption(OptId::JOY_RIGHT, isGame)->getInteger()}, + {Input::Button::Select, getOption(OptId::JOY_SELECT, isGame)->getInteger()}, + {Input::Button::Start, getOption(OptId::JOY_START, isGame)->getInteger()}, + {Input::Button::A, getOption(OptId::JOY_A, isGame)->getInteger()}, + {Input::Button::B, getOption(OptId::JOY_B, isGame)->getInteger()}, + {Input::Button::X, getOption(OptId::JOY_X, isGame)->getInteger()}, + {Input::Button::Y, getOption(OptId::JOY_Y, isGame)->getInteger()}, + {Input::Button::LT, getOption(OptId::JOY_LT, isGame)->getInteger()}, + {Input::Button::RT, getOption(OptId::JOY_RT, isGame)->getInteger()}, + {Input::Button::LB, getOption(OptId::JOY_LB, isGame)->getInteger()}, + {Input::Button::RB, getOption(OptId::JOY_RB, isGame)->getInteger()}, + {Input::Button::Menu1, getOption(OptId::JOY_MENU1, isGame)->getInteger()}, + {Input::Button::Menu2, getOption(OptId::JOY_MENU2, isGame)->getInteger()} }; } c2d::Vector2i PEMUConfig::getJoystickAxisLeftMapping(int player, bool isGame) { return { - getOption(Id::JOY_AXIS_LX, isGame)->getInteger(), - getOption(Id::JOY_AXIS_LY, isGame)->getInteger() + getOption(OptId::JOY_AXIS_LX, isGame)->getInteger(), + getOption(OptId::JOY_AXIS_LY, isGame)->getInteger() }; } c2d::Vector2i PEMUConfig::getJoystickAxisRightMapping(int player, bool isGame) { return { - getOption(Id::JOY_AXIS_RX, isGame)->getInteger(), - getOption(Id::JOY_AXIS_RY, isGame)->getInteger() + getOption(OptId::JOY_AXIS_RX, isGame)->getInteger(), + getOption(OptId::JOY_AXIS_RY, isGame)->getInteger() }; } int PEMUConfig::getJoystickDeadZone(int player, bool isGame) { - return getOption(Id::JOY_DEADZONE, isGame)->getInteger(); + return getOption(OptId::JOY_DEADZONE, isGame)->getInteger(); } PEMUConfig::~PEMUConfig() { diff --git a/src/skeleton/pemu_config.h b/src/skeleton/pemu_config.h index 00f03811..1324f770 100644 --- a/src/skeleton/pemu_config.h +++ b/src/skeleton/pemu_config.h @@ -2,10 +2,10 @@ // Created by cpasjuste on 13/09/23. // -#ifndef C2DUI_CONFIG_NEW_H -#define C2DUI_CONFIG_NEW_H +#ifndef PEMU_CONFIG_H +#define PEMU_CONFIG_H -#define C2D_CONFIG_RESTART_NEEDED "YOU NEED TO RESTART THE APPLICATION AFTER CHANGING THIS OPTION" +#define PEMU_CONFIG_RESTART_NEEDED "YOU NEED TO RESTART THE APPLICATION AFTER CHANGING THIS OPTION" namespace pemu { class PEMUConfig : public c2d::config::Config { @@ -15,54 +15,56 @@ namespace pemu { HIDDEN = BIT(2) }; - enum Id { - MENU_MAIN = 0, - GUI_SHOW_FAVORITES, - GUI_SHOW_AVAILABLE, - GUI_SHOW_ZIP_NAMES, - GUI_FILTER_CLONES, - GUI_FILTER_SYSTEM, - GUI_FILTER_EDITOR, - GUI_FILTER_DEVELOPER, - GUI_FILTER_PLAYERS, - GUI_FILTER_RATING, - GUI_FILTER_ROTATION, - GUI_FILTER_RESOLUTION, - GUI_FILTER_DATE, - GUI_FILTER_GENRE, - GUI_SHOW_ICONS, - GUI_SCREEN_WIDTH, - GUI_SCREEN_HEIGHT, - GUI_FULLSCREEN, - GUI_SKIN, - GUI_SKIN_ASPECT, - GUI_FONT_SCALING, - GUI_VIDEO_SNAP_DELAY, - MENU_ROM_OPTIONS, - ROM_SCALING, - ROM_SCALING_MODE, - ROM_FILTER, - ROM_SHADER, + enum GrpId { + UI_FILTERING = 0, + UI_OPTIONS, + EMULATION, + GAMEPAD, + KEYBOARD + }; + + enum OptId { + UI_SHOW_ZIP_NAMES = 0, + UI_FULLSCREEN, + UI_SKIN, + UI_SKIN_ASPECT, + UI_FONT_SCALING, + UI_VIDEO_SNAP_DELAY, + UI_FILTER_FAVORITES, + UI_FILTER_AVAILABLE, + UI_FILTER_CLONES, + UI_FILTER_SYSTEM, + UI_FILTER_EDITOR, + UI_FILTER_DEVELOPER, + UI_FILTER_PLAYERS, + UI_FILTER_RATING, + UI_FILTER_ROTATION, + UI_FILTER_RESOLUTION, + UI_FILTER_DATE, + UI_FILTER_GENRE, + EMU_SCALING, + EMU_SCALING_MODE, + EMU_FILTER, + EMU_SHADER, #ifdef __VITA__ - ROM_WAIT_RENDERING, + EMU_WAIT_RENDERING, #endif - ROM_FORCE_60HZ, - ROM_AUDIO_SYNC, - ROM_AUDIO_FREQ, - ROM_AUDIO_INTERPOLATION, - ROM_AUDIO_FMINTERPOLATION, - ROM_ROTATION, - ROM_SHOW_FPS, - ROM_FRAMESKIP, - ROM_NEOBIOS, - ROM_PSNES_CHEATS, - ROM_PSNES_BLOCK_VRAM, - ROM_PSNES_TRANSPARENCY, - ROM_PSNES_DISPLAY_MESSAGES, - ROM_PSNES_FRAMESKIP, - ROM_PSNES_TURBO_MODE, - ROM_PSNES_TURBO_FRAMESKIP, - MENU_JOYPAD, + EMU_FORCE_60HZ, + EMU_AUDIO_SYNC, + EMU_AUDIO_FREQ, + EMU_AUDIO_INTERPOLATION, + EMU_AUDIO_FMINTERPOLATION, + EMU_ROTATION, + EMU_SHOW_FPS, + EMU_FRAMESKIP, + EMU_NEOBIOS, + EMU_PSNES_CHEATS, + EMU_PSNES_BLOCK_VRAM, + EMU_PSNES_TRANSPARENCY, + EMU_PSNES_DISPLAY_MESSAGES, + EMU_PSNES_FRAMESKIP, + EMU_PSNES_TURBO_MODE, + EMU_PSNES_TURBO_FRAMESKIP, JOY_UP, JOY_DOWN, JOY_LEFT, @@ -85,7 +87,6 @@ namespace pemu { JOY_AXIS_RY, JOY_DEADZONE, #ifndef NO_KEYBOARD - MENU_KEYBOARD, KEY_UP, KEY_DOWN, KEY_LEFT, @@ -152,6 +153,6 @@ namespace pemu { }; } -#define CFG_ID_ROMS (PEMUConfig::Id::END + 1) +#define CFG_ID_ROMS (PEMUConfig::OptId::END + 1) -#endif //C2DUI_CONFIG_NEW_H +#endif //PEMU_CONFIG_H diff --git a/src/skeleton/romlist.cpp b/src/skeleton/romlist.cpp index b7e8bc9a..1b8c427d 100644 --- a/src/skeleton/romlist.cpp +++ b/src/skeleton/romlist.cpp @@ -85,26 +85,26 @@ void RomList::build(const ss_api::System &system) { std::sort(gameList->dates.begin(), gameList->dates.end(), Api::sortByName); // add filtering options - ui->getConfig()->getGroup(PEMUConfig::Id::MENU_MAIN)->addOption( - {"FILTER_SYSTEM", gameList->systemList.getNames(), 0, PEMUConfig::Id::GUI_FILTER_SYSTEM})->setFlags( + ui->getConfig()->getGroup(PEMUConfig::GrpId::UI_FILTERING)->addOption( + {"FILTER_SYSTEM", gameList->systemList.getNames(), 0, PEMUConfig::OptId::UI_FILTER_SYSTEM})->setFlags( PEMUConfig::Flags::HIDDEN); - ui->getConfig()->getGroup(PEMUConfig::Id::MENU_MAIN)->addOption( - {"FILTER_GENRE", gameList->getGenreNames(), 0, PEMUConfig::Id::GUI_FILTER_GENRE}); - ui->getConfig()->getGroup(PEMUConfig::Id::MENU_MAIN)->addOption( - {"FILTER_DATE", gameList->getDates(), 0, PEMUConfig::Id::GUI_FILTER_DATE}); - ui->getConfig()->getGroup(PEMUConfig::Id::MENU_MAIN)->addOption( - {"FILTER_EDITOR", gameList->getEditorNames(), 0, PEMUConfig::Id::GUI_FILTER_EDITOR}); - ui->getConfig()->getGroup(PEMUConfig::Id::MENU_MAIN)->addOption( - {"FILTER_DEVELOPER", gameList->getDeveloperNames(), 0, PEMUConfig::Id::GUI_FILTER_DEVELOPER}); - ui->getConfig()->getGroup(PEMUConfig::Id::MENU_MAIN)->addOption( - {"FILTER_PLAYERS", gameList->getPlayersNames(), 0, PEMUConfig::Id::GUI_FILTER_PLAYERS}); - ui->getConfig()->getGroup(PEMUConfig::Id::MENU_MAIN)->addOption( - {"FILTER_RATING", gameList->getRatingNames(), 0, PEMUConfig::Id::GUI_FILTER_RATING}); - ui->getConfig()->getGroup(PEMUConfig::Id::MENU_MAIN)->addOption( - {"FILTER_ROTATION", gameList->getRotationNames(), 0, PEMUConfig::Id::GUI_FILTER_ROTATION})->setFlags( + ui->getConfig()->getGroup(PEMUConfig::GrpId::UI_FILTERING)->addOption( + {"FILTER_GENRE", gameList->getGenreNames(), 0, PEMUConfig::OptId::UI_FILTER_GENRE}); + ui->getConfig()->getGroup(PEMUConfig::GrpId::UI_FILTERING)->addOption( + {"FILTER_DATE", gameList->getDates(), 0, PEMUConfig::OptId::UI_FILTER_DATE}); + ui->getConfig()->getGroup(PEMUConfig::GrpId::UI_FILTERING)->addOption( + {"FILTER_EDITOR", gameList->getEditorNames(), 0, PEMUConfig::OptId::UI_FILTER_EDITOR}); + ui->getConfig()->getGroup(PEMUConfig::GrpId::UI_FILTERING)->addOption( + {"FILTER_DEVELOPER", gameList->getDeveloperNames(), 0, PEMUConfig::OptId::UI_FILTER_DEVELOPER}); + ui->getConfig()->getGroup(PEMUConfig::GrpId::UI_FILTERING)->addOption( + {"FILTER_PLAYERS", gameList->getPlayersNames(), 0, PEMUConfig::OptId::UI_FILTER_PLAYERS}); + ui->getConfig()->getGroup(PEMUConfig::GrpId::UI_FILTERING)->addOption( + {"FILTER_RATING", gameList->getRatingNames(), 0, PEMUConfig::OptId::UI_FILTER_RATING}); + ui->getConfig()->getGroup(PEMUConfig::GrpId::UI_FILTERING)->addOption( + {"FILTER_ROTATION", gameList->getRotationNames(), 0, PEMUConfig::OptId::UI_FILTER_ROTATION})->setFlags( PEMUConfig::Flags::HIDDEN); - ui->getConfig()->getGroup(PEMUConfig::Id::MENU_MAIN)->addOption( - {"FILTER_RESOLUTION", gameList->getResolutions(), 0, PEMUConfig::Id::GUI_FILTER_RESOLUTION})->setFlags( + ui->getConfig()->getGroup(PEMUConfig::GrpId::UI_FILTERING)->addOption( + {"FILTER_RESOLUTION", gameList->getResolutions(), 0, PEMUConfig::OptId::UI_FILTER_RESOLUTION})->setFlags( PEMUConfig::Flags::HIDDEN); // custom core hide/show flags diff --git a/src/skeleton/skin.cpp b/src/skeleton/skin.cpp index 803d0d82..cbb171c7 100644 --- a/src/skeleton/skin.cpp +++ b/src/skeleton/skin.cpp @@ -10,9 +10,9 @@ Skin::Skin(UiMain *u) { // setup skin paths (data path first then romfs path) mSkinPath[0] = pMain->getIo()->getDataPath() + "skins/" - + pMain->getConfig()->get(PEMUConfig::Id::GUI_SKIN)->getString() + "/"; + + pMain->getConfig()->get(PEMUConfig::OptId::UI_SKIN)->getString() + "/"; mSkinPath[1] = pMain->getIo()->getRomFsPath() + "skins/" + - pMain->getConfig()->get(PEMUConfig::Id::GUI_SKIN)->getString() + "/"; + pMain->getConfig()->get(PEMUConfig::OptId::UI_SKIN)->getString() + "/"; // try to load skin from data directory first if (pMain->getIo()->exist(mSkinPath[0] + "config.cfg")) { @@ -23,7 +23,7 @@ Skin::Skin(UiMain *u) { printf("Skin: config loaded from romfs (%s)\n", (mSkinPath[1] + "config.cfg").c_str()); } else { // restore defaults - pMain->getConfig()->get(PEMUConfig::Id::GUI_SKIN)->setString("default"); + pMain->getConfig()->get(PEMUConfig::OptId::UI_SKIN)->setString("default"); mSkinPath[0] = mSkinPath[1] = pMain->getIo()->getRomFsPath() + "skins/default/"; printf("Skin: config file not found, reverted to default skin (%s)\n", (mSkinPath[0] + "config.cfg").c_str()); @@ -31,7 +31,7 @@ Skin::Skin(UiMain *u) { } // get default font scaling - mFontScaling = (float) pMain->getConfig()->get(PEMUConfig::Id::GUI_FONT_SCALING)->getInteger(); + mFontScaling = (float) pMain->getConfig()->get(PEMUConfig::OptId::UI_FONT_SCALING)->getInteger(); mFontScaling = mFontScaling > 0 ? 1 + (mFontScaling / 10) : 1; // load buttons textures @@ -190,7 +190,7 @@ Skin::Skin(UiMain *u) { } // load 4/3 skin config override if needed - if (pMain->getConfig()->get(PEMUConfig::Id::GUI_SKIN_ASPECT)->getArrayIndex() == 1) { + if (pMain->getConfig()->get(PEMUConfig::OptId::UI_SKIN_ASPECT)->getArrayIndex() == 1) { for (const auto &path: mSkinPath) { std::string cfgPath = path + "config.cfg.override.43"; if (pMain->getIo()->exist(cfgPath)) { diff --git a/src/skeleton/ui_emu.cpp b/src/skeleton/ui_emu.cpp index 8b9bc973..1c11bc15 100644 --- a/src/skeleton/ui_emu.cpp +++ b/src/skeleton/ui_emu.cpp @@ -35,8 +35,8 @@ void UiEmu::addAudio(int rate, int samples, Audio::C2DAudioCallback cb) { void UiEmu::addVideo(C2DUIVideo *v) { delete (video); video = v; - video->setShader(pMain->getConfig()->get(PEMUConfig::Id::ROM_SHADER, true)->getArrayIndex()); - video->setFilter((Texture::Filter) pMain->getConfig()->get(PEMUConfig::Id::ROM_FILTER, true)->getArrayIndex()); + video->setShader(pMain->getConfig()->get(PEMUConfig::OptId::EMU_SHADER, true)->getArrayIndex()); + video->setFilter((Texture::Filter) pMain->getConfig()->get(PEMUConfig::OptId::EMU_FILTER, true)->getArrayIndex()); video->updateScaling(); add(video); } @@ -144,7 +144,7 @@ void UiEmu::onUpdate() { if (!isPaused()) { // fps - bool showFps = pMain->getConfig()->get(PEMUConfig::Id::ROM_SHOW_FPS, true)->getInteger(); + bool showFps = pMain->getConfig()->get(PEMUConfig::OptId::EMU_SHOW_FPS, true)->getInteger(); if (showFps) { if (!fpsText->isVisible()) { fpsText->setVisibility(c2d::Visibility::Visible); diff --git a/src/skeleton/ui_help.cpp b/src/skeleton/ui_help.cpp index 47f78b04..3ce6d108 100644 --- a/src/skeleton/ui_help.cpp +++ b/src/skeleton/ui_help.cpp @@ -12,11 +12,11 @@ UiHelp::UiHelp(UiMain *ui) : SkinnedRectangle(ui, {"MAIN", "HELP"}) { float pos = addItem(true, font, {ui->getSkin()->getButton(100)}, "NAVIGATION", {4, getSize().y / 2}); // run - button1 = ui->getConfig()->getOption(PEMUConfig::Id::JOY_A)->getInteger(); + button1 = ui->getConfig()->getOption(PEMUConfig::OptId::JOY_A)->getInteger(); pos = addItem(true, font, {ui->getSkin()->getButton(button1)}, "RUN", {pos + 12, getSize().y / 2}); // favorite - button1 = ui->getConfig()->getOption(PEMUConfig::Id::JOY_X)->getInteger(); + button1 = ui->getConfig()->getOption(PEMUConfig::OptId::JOY_X)->getInteger(); if (ui->getSize().x > 640) { pos = addItem(true, font, {ui->getSkin()->getButton(button1)}, "ADD / REMOVE FAVORITE", {pos + 12, getSize().y / 2}); @@ -26,10 +26,10 @@ UiHelp::UiHelp(UiMain *ui) : SkinnedRectangle(ui, {"MAIN", "HELP"}) { } if (ui->getSize().x > 640) { - if (!(ui->getConfig()->get(PEMUConfig::Id::GUI_FILTER_SYSTEM)->getFlags() & PEMUConfig::Flags::HIDDEN)) { + if (!(ui->getConfig()->get(PEMUConfig::OptId::UI_FILTER_SYSTEM)->getFlags() & PEMUConfig::Flags::HIDDEN)) { // system - button1 = ui->getConfig()->getOption(PEMUConfig::Id::JOY_LT)->getInteger(); - button2 = ui->getConfig()->getOption(PEMUConfig::Id::JOY_RT)->getInteger(); + button1 = ui->getConfig()->getOption(PEMUConfig::OptId::JOY_LT)->getInteger(); + button2 = ui->getConfig()->getOption(PEMUConfig::OptId::JOY_RT)->getInteger(); addItem(true, font, {ui->getSkin()->getButton(button1), ui->getSkin()->getButton(button2)}, "SWITCH SYSTEM", {pos + 12, getSize().y / 2}); @@ -37,11 +37,11 @@ UiHelp::UiHelp(UiMain *ui) : SkinnedRectangle(ui, {"MAIN", "HELP"}) { } // main menu - button1 = ui->getConfig()->getOption(PEMUConfig::Id::JOY_MENU1)->getInteger(); + button1 = ui->getConfig()->getOption(PEMUConfig::OptId::JOY_MENU1)->getInteger(); pos = addItem(false, font, {ui->getSkin()->getButton(button1)}, "MAIN MENU", {getSize().x - 4, getSize().y / 2}); - button1 = ui->getConfig()->getOption(PEMUConfig::Id::JOY_MENU2)->getInteger(); + button1 = ui->getConfig()->getOption(PEMUConfig::OptId::JOY_MENU2)->getInteger(); addItem(false, font, {ui->getSkin()->getButton(button1)}, "ROM MENU", {pos - 12, getSize().y / 2}); } diff --git a/src/skeleton/ui_listbox.cpp b/src/skeleton/ui_listbox.cpp index b15126de..dbf4cc8b 100644 --- a/src/skeleton/ui_listbox.cpp +++ b/src/skeleton/ui_listbox.cpp @@ -139,7 +139,7 @@ void UIListBox::init(Font *font, int fontSize) { } void UIListBox::updateLines() { - bool useZipName = ui->getConfig()->getOption(PEMUConfig::Id::GUI_SHOW_ZIP_NAMES)->getInteger(); + bool useZipName = ui->getConfig()->getOption(PEMUConfig::OptId::UI_SHOW_ZIP_NAMES)->getInteger(); for (unsigned int i = 0; i < (unsigned int) max_lines; i++) { if (file_index + i >= games.size()) { diff --git a/src/skeleton/ui_main.cpp b/src/skeleton/ui_main.cpp index ddc90a8c..2fa68d2e 100644 --- a/src/skeleton/ui_main.cpp +++ b/src/skeleton/ui_main.cpp @@ -9,6 +9,7 @@ #ifdef __SWITCH__ UiMain::UiMain(c2d::Io *io, const c2d::Vector2f &size) : C2DRenderer({1280, 720}) { #else + UiMain::UiMain(c2d::Io *io, const c2d::Vector2f &size) : C2DRenderer(size) { #endif printf("UiMain(%ix%i)\n", (int) UiMain::getSize().x, (int) UiMain::getSize().y); @@ -92,11 +93,8 @@ void UiMain::setConfig(PEMUConfig *cfg) { // add shaders, if any auto shaderList = getShaderList(); if (shaderList) { - pConfig->getGroup(PEMUConfig::Id::MENU_ROM_OPTIONS)->addOption( - {"EFFECT", shaderList->getNames(), 0, PEMUConfig::Id::ROM_SHADER}); - } else { - pConfig->getGroup(PEMUConfig::Id::MENU_ROM_OPTIONS)->addOption( - {"EFFECT", {"NONE"}, 0, PEMUConfig::Id::ROM_SHADER})->setFlags(PEMUConfig::Flags::HIDDEN); + pConfig->get(PEMUConfig::OptId::EMU_SHADER)->setArray(shaderList->getNames(), 0); + pConfig->get(PEMUConfig::OptId::EMU_SHADER)->setFlags(0); } } @@ -118,9 +116,9 @@ void UiMain::updateInputMapping(bool isRomConfig) { // keep custom config for menus keys for (unsigned int i = 0; i < keyMapping.size(); i++) { if (keyMapping.at(i).button == Input::Button::Menu1) { - keyMapping.at(i).value = pConfig->get(PEMUConfig::Id::KEY_MENU1, false)->getInteger(); + keyMapping.at(i).value = pConfig->get(PEMUConfig::OptId::KEY_MENU1, false)->getInteger(); } else if (keyMapping.at(i).button == Input::Button::Menu2) { - keyMapping.at(i).value = pConfig->get(PEMUConfig::Id::KEY_MENU2, false)->getInteger(); + keyMapping.at(i).value = pConfig->get(PEMUConfig::OptId::KEY_MENU2, false)->getInteger(); } } getInput()->setKeyboardMapping(keyMapping); @@ -129,9 +127,9 @@ void UiMain::updateInputMapping(bool isRomConfig) { // keep custom config for menus keys for (unsigned int i = 0; i < joyMapping.size(); i++) { if (joyMapping.at(i).button == Input::Button::Menu1) { - joyMapping.at(i).value = pConfig->get(PEMUConfig::Id::JOY_MENU1, false)->getInteger(); + joyMapping.at(i).value = pConfig->get(PEMUConfig::OptId::JOY_MENU1, false)->getInteger(); } else if (joyMapping.at(i).button == Input::Button::Menu2) { - joyMapping.at(i).value = pConfig->get(PEMUConfig::Id::JOY_MENU2, false)->getInteger(); + joyMapping.at(i).value = pConfig->get(PEMUConfig::OptId::JOY_MENU2, false)->getInteger(); } } for (int i = 0; i < PLAYER_MAX; i++) { diff --git a/src/skeleton/ui_menu.cpp b/src/skeleton/ui_menu.cpp index d254508f..58b282b6 100644 --- a/src/skeleton/ui_menu.cpp +++ b/src/skeleton/ui_menu.cpp @@ -67,7 +67,7 @@ class MenuLine : public c2d::RectangleShape { // this is an option if (option->getFlags() & PEMUConfig::Flags::INPUT) { Skin::Button *button = pMain->getSkin()->getButton(option->getInteger()); - if (button && option->getId() < PEMUConfig::Id::JOY_DEADZONE) { + if (button && option->getId() < PEMUConfig::OptId::JOY_DEADZONE) { if (button->texture) { p_sprite->setTexture(button->texture, true); p_sprite->setVisibility(Visibility::Visible); @@ -154,7 +154,7 @@ void UiMenu::load(bool isGame) { if (isRomMenu) { ui->getConfig()->loadGame(game); - bool useZipName = ui->getConfig()->getOption(PEMUConfig::Id::GUI_SHOW_ZIP_NAMES)->getInteger(); + bool useZipName = ui->getConfig()->getOption(PEMUConfig::OptId::UI_SHOW_ZIP_NAMES)->getInteger(); title->setString(useZipName ? Utility::removeExt(game.path) : game.name); } else { title->setString("MAIN OPTIONS"); @@ -167,7 +167,7 @@ void UiMenu::load(bool isGame) { for (auto &group: *groups) { // skip some options if needed if (group.getName() == "ROMS") continue; - if (isRomMenu && group.getName() == "UI") continue; + if (isRomMenu && (group.getName() == "UI_OPTIONS" || group.getName() == "UI_FILTERING")) continue; // push group title menu_options.push_back({group.getName(), nullptr}); auto options = group.getOptions(); @@ -298,34 +298,34 @@ bool UiMenu::onInput(c2d::Input::Player *players) { } switch (option->getId()) { - case PEMUConfig::Id::GUI_SHOW_FAVORITES: - case PEMUConfig::Id::GUI_SHOW_AVAILABLE: - case PEMUConfig::Id::GUI_SHOW_ZIP_NAMES: - case PEMUConfig::Id::GUI_FILTER_CLONES: - case PEMUConfig::Id::GUI_FILTER_SYSTEM: - case PEMUConfig::Id::GUI_FILTER_EDITOR: - case PEMUConfig::Id::GUI_FILTER_DEVELOPER: - case PEMUConfig::Id::GUI_FILTER_PLAYERS: - case PEMUConfig::Id::GUI_FILTER_RATING: - case PEMUConfig::Id::GUI_FILTER_ROTATION: - case PEMUConfig::Id::GUI_FILTER_RESOLUTION: - case PEMUConfig::Id::GUI_FILTER_DATE: - case PEMUConfig::Id::GUI_FILTER_GENRE: { + case PEMUConfig::OptId::UI_FILTER_FAVORITES: + case PEMUConfig::OptId::UI_FILTER_AVAILABLE: + case PEMUConfig::OptId::UI_SHOW_ZIP_NAMES: + case PEMUConfig::OptId::UI_FILTER_CLONES: + case PEMUConfig::OptId::UI_FILTER_SYSTEM: + case PEMUConfig::OptId::UI_FILTER_EDITOR: + case PEMUConfig::OptId::UI_FILTER_DEVELOPER: + case PEMUConfig::OptId::UI_FILTER_PLAYERS: + case PEMUConfig::OptId::UI_FILTER_RATING: + case PEMUConfig::OptId::UI_FILTER_ROTATION: + case PEMUConfig::OptId::UI_FILTER_RESOLUTION: + case PEMUConfig::OptId::UI_FILTER_DATE: + case PEMUConfig::OptId::UI_FILTER_GENRE: { std::string name = Utility::toUpper(option->getName()); std::string value = Utility::toUpper(option->getString()); if (option->getComment().empty()) { ui->getUiStatusBox()->show("%s: %s", name.c_str(), value.c_str()); } // if we want to show only available games, be sure we revert back to "ALL" system filter - if (option->getId() == PEMUConfig::Id::GUI_SHOW_AVAILABLE) { - ui->getConfig()->get(PEMUConfig::Id::GUI_FILTER_SYSTEM)->setArrayIndex("ALL"); + if (option->getId() == PEMUConfig::OptId::UI_FILTER_AVAILABLE) { + ui->getConfig()->get(PEMUConfig::OptId::UI_FILTER_SYSTEM)->setArrayIndex("ALL"); } ui->getUiRomList()->updateRomList(); break; } - case PEMUConfig::Id::ROM_ROTATION: - case PEMUConfig::Id::ROM_SCALING: + case PEMUConfig::OptId::EMU_ROTATION: + case PEMUConfig::OptId::EMU_SCALING: if (isEmuRunning) { ui->getUiEmu()->getVideo()->updateScaling(); auto gw = (float) ui->getUiEmu()->getVideo()->getTextureRect().width; @@ -344,7 +344,7 @@ bool UiMenu::onInput(c2d::Input::Player *players) { ui->getUiEmu()->getVideo()->getScale().x, ui->getUiEmu()->getVideo()->getScale().y); } break; - case PEMUConfig::Id::ROM_SCALING_MODE: + case PEMUConfig::OptId::EMU_SCALING_MODE: if (option->getString() == "AUTO") { ui->getUiStatusBox()->show("TRY TO KEEP INTEGER SCALING IF ASPECT RATIO IS NOT TOO DIVERGENT"); } else if (option->getString() == "ASPECT") { @@ -357,12 +357,12 @@ bool UiMenu::onInput(c2d::Input::Player *players) { ui->getUiEmu()->getVideo()->updateScaling(); } break; - case PEMUConfig::Id::ROM_FILTER: + case PEMUConfig::OptId::EMU_FILTER: if (isEmuRunning) { ui->getUiEmu()->getVideo()->setFilter((Texture::Filter) option->getArrayIndex()); } break; - case PEMUConfig::Id::ROM_SHADER: + case PEMUConfig::OptId::EMU_SHADER: if (isEmuRunning) { ui->getUiEmu()->getVideo()->setShader(option->getArrayIndex()); ui->getUiStatusBox()->show(option->getString()); @@ -375,7 +375,7 @@ bool UiMenu::onInput(c2d::Input::Player *players) { } break; #endif - case PEMUConfig::Id::GUI_VIDEO_SNAP_DELAY: + case PEMUConfig::OptId::UI_VIDEO_SNAP_DELAY: ui->getUiRomList()->setVideoSnapDelay(option->getInteger()); break; diff --git a/src/skeleton/ui_romlist.cpp b/src/skeleton/ui_romlist.cpp index f98df630..92ee433b 100644 --- a/src/skeleton/ui_romlist.cpp +++ b/src/skeleton/ui_romlist.cpp @@ -30,7 +30,7 @@ UIRomList::UIRomList(UiMain *main, RomList *romList, const c2d::Vector2f &size) UIRomList::add(pRomInfo); // add rom list title (system text) - if (!(pMain->getConfig()->getOption(PEMUConfig::Id::GUI_FILTER_SYSTEM)->getFlags() & PEMUConfig::Flags::HIDDEN)) { + if (!(pMain->getConfig()->getOption(PEMUConfig::OptId::UI_FILTER_SYSTEM)->getFlags() & PEMUConfig::Flags::HIDDEN)) { pTitleText = new SkinnedText(pMain, {"SKIN_CONFIG", "MAIN", "ROM_LIST", "SYSTEM_TEXT"}); if (pTitleText->available) { UIRomList::add(pTitleText); @@ -83,7 +83,7 @@ UIRomList::UIRomList(UiMain *main, RomList *romList, const c2d::Vector2f &size) pBlur->setVisibility(Visibility::Hidden); UIRomList::add(pBlur); - int delay = pMain->getConfig()->get(PEMUConfig::Id::GUI_VIDEO_SNAP_DELAY)->getInteger(); + int delay = pMain->getConfig()->get(PEMUConfig::OptId::UI_VIDEO_SNAP_DELAY)->getInteger(); UIRomList::setVideoSnapDelay(delay); // filter roms (done in UiMain::init) @@ -138,7 +138,7 @@ void UIRomList::updateRomList() { sortRomList(); if (pTitleText && pTitleText->available) { - std::string sys = pMain->getConfig()->get(PEMUConfig::Id::GUI_FILTER_SYSTEM)->getString(); + std::string sys = pMain->getConfig()->get(PEMUConfig::OptId::UI_FILTER_SYSTEM)->getString(); pTitleText->setString(sys); } @@ -157,44 +157,44 @@ void UIRomList::updateRomList() { void UIRomList::filterRomList() { auto cfg = pMain->getConfig(); - ss_api::GameList *list = cfg->get(PEMUConfig::Id::GUI_SHOW_FAVORITES)->getInteger() ? + ss_api::GameList *list = cfg->get(PEMUConfig::OptId::UI_FILTER_FAVORITES)->getInteger() ? pRomList->gameListFav : pRomList->gameList; - std::string system = cfg->get(PEMUConfig::Id::GUI_FILTER_SYSTEM)->getString(); + std::string system = cfg->get(PEMUConfig::OptId::UI_FILTER_SYSTEM)->getString(); int systemId = system == "ALL" ? -1 : list->systemList.findByName(system).id; - std::string editor = cfg->get(PEMUConfig::Id::GUI_FILTER_EDITOR)->getString(); + std::string editor = cfg->get(PEMUConfig::OptId::UI_FILTER_EDITOR)->getString(); int editorId = editor == "ALL" ? -1 : list->findEditorByName(editor).id; - std::string dev = cfg->get(PEMUConfig::Id::GUI_FILTER_DEVELOPER)->getString(); + std::string dev = cfg->get(PEMUConfig::OptId::UI_FILTER_DEVELOPER)->getString(); int devId = dev == "ALL" ? -1 : list->findDeveloperByName(dev).id; - int players = Utility::parseInt(cfg->get(PEMUConfig::Id::GUI_FILTER_PLAYERS)->getString(), -1); - int rating = Utility::parseInt(cfg->get(PEMUConfig::Id::GUI_FILTER_RATING)->getString(), -1); - int rotation = Utility::parseInt(cfg->get(PEMUConfig::Id::GUI_FILTER_ROTATION)->getString(), -1); - std::string genre = cfg->get(PEMUConfig::Id::GUI_FILTER_GENRE)->getString(); + int players = Utility::parseInt(cfg->get(PEMUConfig::OptId::UI_FILTER_PLAYERS)->getString(), -1); + int rating = Utility::parseInt(cfg->get(PEMUConfig::OptId::UI_FILTER_RATING)->getString(), -1); + int rotation = Utility::parseInt(cfg->get(PEMUConfig::OptId::UI_FILTER_ROTATION)->getString(), -1); + std::string genre = cfg->get(PEMUConfig::OptId::UI_FILTER_GENRE)->getString(); int genreId = genre == "ALL" ? -1 : list->findGenreByName(genre).id; printf("UIRomList::filterRomList: system: %s (%i)\n", system.c_str(), systemId); mGameList = list->filter( - cfg->get(PEMUConfig::Id::GUI_SHOW_AVAILABLE)->getInteger(), - cfg->get(PEMUConfig::Id::GUI_FILTER_CLONES)->getInteger(), + cfg->get(PEMUConfig::OptId::UI_FILTER_AVAILABLE)->getInteger(), + !cfg->get(PEMUConfig::OptId::UI_FILTER_CLONES)->getInteger(), systemId == 9999 ? -1 : systemId, systemId == 9999 ? 75 : -1, editorId, devId, players, rating, rotation, genreId, - cfg->get(PEMUConfig::Id::GUI_FILTER_RESOLUTION)->getString(), - cfg->get(PEMUConfig::Id::GUI_FILTER_DATE)->getString() + cfg->get(PEMUConfig::OptId::UI_FILTER_RESOLUTION)->getString(), + cfg->get(PEMUConfig::OptId::UI_FILTER_DATE)->getString() ); - cfg->get(PEMUConfig::Id::GUI_FILTER_SYSTEM)->setArray(mGameList.systemList.getNames()); - cfg->get(PEMUConfig::Id::GUI_FILTER_GENRE)->setArray(mGameList.getGenreNames()); - cfg->get(PEMUConfig::Id::GUI_FILTER_DATE)->setArray(mGameList.getDates()); - cfg->get(PEMUConfig::Id::GUI_FILTER_EDITOR)->setArray(mGameList.getEditorNames()); - cfg->get(PEMUConfig::Id::GUI_FILTER_DEVELOPER)->setArray(mGameList.getDeveloperNames()); - cfg->get(PEMUConfig::Id::GUI_FILTER_PLAYERS)->setArray(mGameList.getPlayersNames()); - cfg->get(PEMUConfig::Id::GUI_FILTER_RATING)->setArray(mGameList.getRatingNames()); - cfg->get(PEMUConfig::Id::GUI_FILTER_ROTATION)->setArray(mGameList.getRotationNames()); - cfg->get(PEMUConfig::Id::GUI_FILTER_RESOLUTION)->setArray(mGameList.getResolutions()); + cfg->get(PEMUConfig::OptId::UI_FILTER_SYSTEM)->setArray(mGameList.systemList.getNames()); + cfg->get(PEMUConfig::OptId::UI_FILTER_GENRE)->setArray(mGameList.getGenreNames()); + cfg->get(PEMUConfig::OptId::UI_FILTER_DATE)->setArray(mGameList.getDates()); + cfg->get(PEMUConfig::OptId::UI_FILTER_EDITOR)->setArray(mGameList.getEditorNames()); + cfg->get(PEMUConfig::OptId::UI_FILTER_DEVELOPER)->setArray(mGameList.getDeveloperNames()); + cfg->get(PEMUConfig::OptId::UI_FILTER_PLAYERS)->setArray(mGameList.getPlayersNames()); + cfg->get(PEMUConfig::OptId::UI_FILTER_RATING)->setArray(mGameList.getRatingNames()); + cfg->get(PEMUConfig::OptId::UI_FILTER_ROTATION)->setArray(mGameList.getRotationNames()); + cfg->get(PEMUConfig::OptId::UI_FILTER_RESOLUTION)->setArray(mGameList.getResolutions()); } void UIRomList::sortRomList() { - bool byZipName = pMain->getConfig()->get(PEMUConfig::Id::GUI_SHOW_ZIP_NAMES)->getInteger(); + bool byZipName = pMain->getConfig()->get(PEMUConfig::OptId::UI_SHOW_ZIP_NAMES)->getInteger(); mGameList.sortAlpha(byZipName); } @@ -276,7 +276,7 @@ bool UIRomList::onInput(c2d::Input::Player *players) { "FAVORITES", "Remove from favorites ?", "OK", "CANCEL"); if (res == MessageBox::LEFT) { pRomList->removeFav(game); - if (pMain->getConfig()->get(PEMUConfig::Id::GUI_SHOW_FAVORITES)->getInteger()) { + if (pMain->getConfig()->get(PEMUConfig::OptId::UI_FILTER_FAVORITES)->getInteger()) { // update list if we are in favorites updateRomList(); } @@ -293,14 +293,14 @@ bool UIRomList::onInput(c2d::Input::Player *players) { // only allow system switch if skin contains romlist title if (pTitleText && pTitleText->available) { if (buttons & Input::Button::LT) { - Option *sysOpt = pMain->getConfig()->get(PEMUConfig::Id::GUI_FILTER_SYSTEM); + Option *sysOpt = pMain->getConfig()->get(PEMUConfig::OptId::UI_FILTER_SYSTEM); size_t sysCount = sysOpt->getArray().size(); if (sysCount > 1) { sysOpt->setArrayMovePrev(); updateRomList(); } } else if (buttons & Input::Button::RT) { - Option *sysOpt = pMain->getConfig()->get(PEMUConfig::Id::GUI_FILTER_SYSTEM); + Option *sysOpt = pMain->getConfig()->get(PEMUConfig::OptId::UI_FILTER_SYSTEM); size_t sysCount = sysOpt->getArray().size(); if (sysCount > 1) { sysOpt->setArrayMoveNext(); diff --git a/src/skeleton/ui_video.cpp b/src/skeleton/ui_video.cpp index 2255a0f5..1635fab6 100644 --- a/src/skeleton/ui_video.cpp +++ b/src/skeleton/ui_video.cpp @@ -20,12 +20,12 @@ void C2DUIVideo::updateScaling(bool vertical, bool flip) { bool rotated = false; float rotation = 0; int rotation_cfg = 0; - std::string scale_value = ui->getConfig()->get(PEMUConfig::Id::ROM_SCALING, true)->getString(); - float scale_value_float = (float) ui->getConfig()->get(PEMUConfig::Id::ROM_SCALING, true)->getArrayIndex() + 1; - std::string scaling_mode = ui->getConfig()->get(PEMUConfig::Id::ROM_SCALING_MODE, true)->getString(); + std::string scale_value = ui->getConfig()->get(PEMUConfig::OptId::EMU_SCALING, true)->getString(); + float scale_value_float = (float) ui->getConfig()->get(PEMUConfig::OptId::EMU_SCALING, true)->getArrayIndex() + 1; + std::string scaling_mode = ui->getConfig()->get(PEMUConfig::OptId::EMU_SCALING_MODE, true)->getString(); float game_aspect_ratio = vertical ? (float) aspect.y / (float) aspect.x : (float) aspect.x / (float) aspect.y; - c2d::config::Option *rotationOpt = ui->getConfig()->get(PEMUConfig::Id::ROM_ROTATION, true); + c2d::config::Option *rotationOpt = ui->getConfig()->get(PEMUConfig::OptId::EMU_ROTATION, true); if (rotationOpt) { rotation_cfg = rotationOpt->getArrayIndex(); }