diff options
Diffstat (limited to 'common/util.cpp')
-rw-r--r-- | common/util.cpp | 151 |
1 files changed, 0 insertions, 151 deletions
diff --git a/common/util.cpp b/common/util.cpp index 5911f9b1a4..371673d9f4 100644 --- a/common/util.cpp +++ b/common/util.cpp @@ -29,8 +29,6 @@ #include "common/util.h" -#include "common/translation.h" -#include "common/config-manager.h" #include "common/debug.h" namespace Common { @@ -280,155 +278,6 @@ const char *getPlatformDescription(Platform id) { #pragma mark - -const RenderModeDescription g_renderModes[] = { - // I18N: Hercules is graphics card name - { "hercGreen", _s("Hercules Green"), kRenderHercG }, - { "hercAmber", _s("Hercules Amber"), kRenderHercA }, - { "cga", "CGA", kRenderCGA }, - { "ega", "EGA", kRenderEGA }, - { "vga", "VGA", kRenderVGA }, - { "amiga", "Amiga", kRenderAmiga }, - { "fmtowns", "FM-Towns", kRenderFMTowns }, - { "pc9821", "PC-9821 (256 Colors)", kRenderPC9821 }, - { "pc9801", "PC-9801 (16 Colors)", kRenderPC9801 }, - {0, 0, kRenderDefault} -}; - -DECLARE_TRANSLATION_ADDITIONAL_CONTEXT("Hercules Green", "lowres") -DECLARE_TRANSLATION_ADDITIONAL_CONTEXT("Hercules Amber", "lowres") - -RenderMode parseRenderMode(const String &str) { - if (str.empty()) - return kRenderDefault; - - const RenderModeDescription *l = g_renderModes; - for (; l->code; ++l) { - if (str.equalsIgnoreCase(l->code)) - return l->id; - } - - return kRenderDefault; -} - -const char *getRenderModeCode(RenderMode id) { - const RenderModeDescription *l = g_renderModes; - for (; l->code; ++l) { - if (l->id == id) - return l->code; - } - return 0; -} - -const char *getRenderModeDescription(RenderMode id) { - const RenderModeDescription *l = g_renderModes; - for (; l->code; ++l) { - if (l->id == id) - return l->description; - } - return 0; -} - -const struct GameOpt { - const char *option; - const char *desc; -} g_gameOptions[] = { - { GUIO_NOSUBTITLES, "sndNoSubs" }, - { GUIO_NOMUSIC, "sndNoMusic" }, - { GUIO_NOSPEECH, "sndNoSpeech" }, - { GUIO_NOSFX, "sndNoSFX" }, - { GUIO_NOMIDI, "sndNoMIDI" }, - - { GUIO_NOLAUNCHLOAD, "launchNoLoad" }, - - { GUIO_MIDIPCSPK, "midiPCSpk" }, - { GUIO_MIDICMS, "midiCMS" }, - { GUIO_MIDIPCJR, "midiPCJr" }, - { GUIO_MIDIADLIB, "midiAdLib" }, - { GUIO_MIDIC64, "midiC64" }, - { GUIO_MIDIAMIGA, "midiAmiga" }, - { GUIO_MIDIAPPLEIIGS,"midiAppleIIgs" }, - { GUIO_MIDITOWNS, "midiTowns" }, - { GUIO_MIDIPC98, "midiPC98" }, - { GUIO_MIDIMT32, "midiMt32" }, - { GUIO_MIDIGM, "midiGM" }, - - { GUIO_NOASPECT, "noAspect" }, - { GUIO_EGAUNDITHER, "egaUndither" }, - - { GUIO_RENDERHERCGREEN, "hercGreen" }, - { GUIO_RENDERHERCAMBER, "hercAmber" }, - { GUIO_RENDERCGA, "cga" }, - { GUIO_RENDEREGA, "ega" }, - { GUIO_RENDERVGA, "vga" }, - { GUIO_RENDERAMIGA, "amiga" }, - { GUIO_RENDERFMTOWNS, "fmtowns" }, - { GUIO_RENDERPC9821, "pc9821" }, - { GUIO_RENDERPC9801, "pc9801" }, - - { GUIO_NONE, 0 } -}; - -bool checkGameGUIOption(const String &option, const String &str) { - for (int i = 0; g_gameOptions[i].desc; i++) { - if (option.contains(g_gameOptions[i].option)) { - if (str.contains(g_gameOptions[i].desc)) - return true; - else - return false; - } - } - return false; -} - -bool checkGameGUIOptionLanguage(Language lang, const String &str) { - if (!str.contains("lang_")) // If no languages are specified - return true; - - if (str.contains(getGameGUIOptionsDescriptionLanguage(lang))) - return true; - - return false; -} - -const String getGameGUIOptionsDescriptionLanguage(Language lang) { - if (lang == UNK_LANG) - return ""; - - return String(String("lang_") + getLanguageDescription(lang)); -} - -String parseGameGUIOptions(const String &str) { - Common::String res; - - for (int i = 0; g_gameOptions[i].desc; i++) - if (str.contains(g_gameOptions[i].desc)) - res += g_gameOptions[i].option; - - return res; -} - -const String getGameGUIOptionsDescription(const String &options) { - String res; - - for (int i = 0; g_gameOptions[i].desc; i++) - if (options.contains(g_gameOptions[i].option[0])) - res += String(g_gameOptions[i].desc) + " "; - - res.trim(); - - return res; -} - -void updateGameGUIOptions(const String &options, const String &langOption) { - const String newOptionString = getGameGUIOptionsDescription(options) + " " + langOption; - - if ((!options.empty() && !ConfMan.hasKey("guioptions")) || - (ConfMan.hasKey("guioptions") && ConfMan.get("guioptions") != newOptionString)) { - ConfMan.set("guioptions", newOptionString); - ConfMan.flushToDisk(); - } -} - #define ENSURE_ASCII_CHAR(c) \ if (c < 0 || c > 127) \ return false |