Path: blob/master/libmupen64plus/mupen64plus-video-glide64/src/Config.cpp
2 views
/*1* Glide64 - Glide video plugin for Nintendo 64 emulators.2* Copyright (c) 2010 Jon Ring3* Copyright (c) 2002 Dave20014*5* This program is free software; you can redistribute it and/or modify6* it under the terms of the GNU General Public License as published by7* the Free Software Foundation; either version 2 of the License, or8* any later version.9*10* This program is distributed in the hope that it will be useful,11* but WITHOUT ANY WARRANTY; without even the implied warranty of12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13* GNU General Public License for more details.14*15* You should have received a copy of the GNU General Public16* Licence along with this program; if not, write to the Free17* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,18* Boston, MA 02110-1301, USA19*/20#include "Config.h"21#include "m64p.h"2223static m64p_handle video_general_section;24static m64p_handle video_glide64_section;252627BOOL Config_Open()28{29if (ConfigOpenSection("Video-General", &video_general_section) != M64ERR_SUCCESS ||30ConfigOpenSection("Video-Glide64", &video_glide64_section) != M64ERR_SUCCESS)31{32WriteLog(M64MSG_ERROR, "Could not open configuration");33return FALSE;34}35ConfigSetDefaultBool(video_general_section, "Fullscreen", false, "Use fullscreen mode if True, or windowed mode if False");36ConfigSetDefaultInt(video_general_section, "ScreenWidth", 640, "Width of output window or fullscreen width");37ConfigSetDefaultInt(video_general_section, "ScreenHeight", 480, "Height of output window or fullscreen height");3839return TRUE;40}4142PackedScreenResolution Config_ReadScreenSettings()43{44PackedScreenResolution packedResolution;4546packedResolution.width = ConfigGetParamInt(video_general_section, "ScreenWidth");47packedResolution.height = ConfigGetParamInt(video_general_section, "ScreenHeight");48packedResolution.fullscreen = ConfigGetParamBool(video_general_section, "Fullscreen");4950return packedResolution;51}5253int Config_ReadInt(const char *itemname, const char *desc, int def_value, BOOL create, BOOL isBoolean)54{55WriteLog(M64MSG_VERBOSE, "Getting value %s", itemname);56if (isBoolean)57{58ConfigSetDefaultBool(video_glide64_section, itemname, def_value, desc);59return ConfigGetParamBool(video_glide64_section, itemname);60}61else62{63ConfigSetDefaultInt(video_glide64_section, itemname, def_value, desc);64return ConfigGetParamInt(video_glide64_section, itemname);65}6667}686970