Path: blob/master/libmupen64plus/mupen64plus-video-glide64mk2/src/Glide64/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 "Gfx_1.3.h"21#include "Config.h"22#include "m64p.h"23#include "rdp.h"2425#ifndef OLDAPI2627static m64p_handle video_general_section;28static m64p_handle video_glide64_section;293031BOOL Config_Open()32{33if (ConfigOpenSection("Video-General", &video_general_section) != M64ERR_SUCCESS ||34ConfigOpenSection("Video-Glide64mk2", &video_glide64_section) != M64ERR_SUCCESS)35{36ERRLOG("Could not open configuration");37return FALSE;38}39ConfigSetDefaultBool(video_general_section, "Fullscreen", false, "Use fullscreen mode if True, or windowed mode if False");40ConfigSetDefaultInt(video_general_section, "ScreenWidth", 640, "Width of output window or fullscreen width");41ConfigSetDefaultInt(video_general_section, "ScreenHeight", 480, "Height of output window or fullscreen height");4243return TRUE;44}4546int Config_ReadScreenInt(const char *itemname)47{48return ConfigGetParamInt(video_general_section, itemname);49}5051PackedScreenResolution Config_ReadScreenSettings()52{53PackedScreenResolution packedResolution;5455packedResolution.width = ConfigGetParamInt(video_general_section, "ScreenWidth");56packedResolution.height = ConfigGetParamInt(video_general_section, "ScreenHeight");57packedResolution.fullscreen = ConfigGetParamBool(video_general_section, "Fullscreen");5859return packedResolution;60}6162BOOL Config_ReadInt(const char *itemname, const char *desc, int def_value, int create, int isBoolean)63{64VLOG("Getting value %s", itemname);65if (isBoolean)66{67ConfigSetDefaultBool(video_glide64_section, itemname, def_value, desc);68return ConfigGetParamBool(video_glide64_section, itemname);69}70else71{72ConfigSetDefaultInt(video_glide64_section, itemname, def_value, desc);73return ConfigGetParamInt(video_glide64_section, itemname);74}7576}77#else7879// Resolutions, MUST be in the correct order (SST1VID.H)80wxUint32 resolutions[0x18][2] = {81{ 320, 200 },82{ 320, 240 },83{ 400, 256 },84{ 512, 384 },85{ 640, 200 },86{ 640, 350 },87{ 640, 400 },88{ 640, 480 },89{ 800, 600 },90{ 960, 720 },91{ 856, 480 },92{ 512, 256 },93{ 1024, 768 },94{ 1280, 1024 },95{ 1600, 1200 },96{ 400, 300 },9798// 0x1099{ 1152, 864 },100{ 1280, 960 },101{ 1600, 1024 },102{ 1792, 1344 },103{ 1856, 1392 },104{ 1920, 1440 },105{ 2048, 1536 },106{ 2048, 2048 }107};108109110BOOL Config_Open()111{112INI_Open();113if(INI_FindSection("SETTINGS",FALSE) == FALSE) {114INI_Close();115ERRLOG("Could not open configuration");116return FALSE;117}118return TRUE;119}120121int Config_ReadScreenInt(const char *itemname) {122int res_data = Config_ReadInt("resolution", NULL, 7, FALSE, FALSE);123if(!strcmp("ScreenWidth", itemname))124return resolutions[res_data][0];125else if(!strcmp("ScreenHeight", itemname))126return resolutions[res_data][1];127else return FALSE;128}129130BOOL Config_ReadInt(const char *itemname, const char *desc, int def_value, int create, int isBoolean) {131VLOG("Getting value %s", itemname);132int z = INI_ReadInt(itemname, def_value, FALSE);133if(isBoolean) z=(z && 1);134return z;135}136137#endif138139#ifdef TEXTURE_FILTER140wxUint32 texfltr[] = {141NO_FILTER, //"None"142SMOOTH_FILTER_1, //"Smooth filtering 1"143SMOOTH_FILTER_2, //"Smooth filtering 2"144SMOOTH_FILTER_3, //"Smooth filtering 3"145SMOOTH_FILTER_4, //"Smooth filtering 4"146SHARP_FILTER_1, //"Sharp filtering 1"147SHARP_FILTER_2, //"Sharp filtering 2"148};149150wxUint32 texenht[] = {151NO_ENHANCEMENT, //"None"152NO_ENHANCEMENT, //"Store"153X2_ENHANCEMENT, //"X2"154X2SAI_ENHANCEMENT, //"X2SAI"155HQ2X_ENHANCEMENT, //"HQ2X"156HQ2XS_ENHANCEMENT, //"HQ2XS"157LQ2X_ENHANCEMENT, //"LQ2X"158LQ2XS_ENHANCEMENT, //"LQ2XS"159HQ4X_ENHANCEMENT, //"HQ4X"160};161162wxUint32 texcmpr[] = {163//NO_COMPRESSION, //"None"164// NCC_COMPRESSION, //"NCC"165S3TC_COMPRESSION, //"S3TC"166FXT1_COMPRESSION, //"FXT1"167};168169wxUint32 texhirs[] = {170NO_HIRESTEXTURES, //"Do not use"171RICE_HIRESTEXTURES, //"Rice format"172// GHQ_HIRESTEXTURES, //"GlideHQ format"173// JABO_HIRESTEXTURES, //"Jabo format"174};175#endif176177178179180