Exemple #1
0
void Mega8Config::loadConfig(const wxString &profile)
{
    bool isNew;

    if (_config == NULL) {
        _config = new wxConfig(wxT("Mega8"), wxT("Ready4Next"));
        if (!readBool(wxT("FirstInit"))) {
            resetConfig();
            writeBool(wxT("FirstInit"), true);
            saveConfig(profile);
        }
    }
    _currentProfile = profile;
    isNew = loadKeyboard(profile);
    _LastFolder = readString(wxT("LastFolder"));

    _FullScreen = readBool(wxT("FullScreen"));
    _SpeedAuto = readBool(wxT("SpeedAuto"));
    _DisplayHUD = readBool(wxT("DisplayHUD"));
    _Filtered = readBool(wxT("Filtered"));
    _Sound = readBool(wxT("Sound"));
    _UseSleep = readBool(wxT("UseSleep"));
    _SyncClock = readBool(wxT("SyncClock"));
    _ColorTheme = (Chip8ColorTheme)readLong(wxT("ColorTheme"));
    _InverseColor = readBool(wxT("InverseColor"));
    for (int i = 0; i <= sizeof(Chip8Types); i++) {
        _FrequencyRatio[i] = (long)min((long)max((long)readLong(wxT("FrequencyRatio/") + getMachineTypeStr((Chip8Types) i)), (long)4), (long)9);

    }

    // Save this profile if new
    if (isNew) {
        saveConfig(profile);
    }
}
Exemple #2
0
void TouchManager::init()
{
    config.addListener("showScreenJoystick", this);
    config.addListener("showScreenButtons", this);
    config.addListener("showScreenKeyboard", this);
    config.addListener("screenButtonsSize", this);
    config.addListener("screenJoystickSize", this);
    config.addListener("screenButtonsFormat", this);

    mShowJoystick = config.getBoolValue("showScreenJoystick");
    mShowButtons = config.getBoolValue("showScreenButtons");
    mShowKeyboard = config.getBoolValue("showScreenKeyboard");
    mButtonsSize = config.getIntValue("screenButtonsSize");
    mJoystickSize = config.getIntValue("screenJoystickSize");
    mButtonsFormat = config.getIntValue("screenButtonsFormat");

    setHalfJoyPad(getPadSize() / 2);

    if (mShowKeyboard)
        loadKeyboard();
    if (mShowJoystick)
        loadPad();
    if (mShowButtons)
        loadButtons();
    mWidth = mainGraphics->mWidth;
    mHeight = mainGraphics->mHeight;
}