Glide Plugin GLES2 port from mupen64plus-ae, but with special FrameSkip code
[mupen64plus-pandora.git] / source / gles2glide64 / src / Glide64 / Config.cpp
CommitLineData
98e75f2d 1/*
2* Glide64 - Glide video plugin for Nintendo 64 emulators.
3* Copyright (c) 2010 Jon Ring
4* Copyright (c) 2002 Dave2001
5*
6* This program is free software; you can redistribute it and/or modify
7* it under the terms of the GNU General Public License as published by
8* the Free Software Foundation; either version 2 of the License, or
9* any later version.
10*
11* This program is distributed in the hope that it will be useful,
12* but WITHOUT ANY WARRANTY; without even the implied warranty of
13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14* GNU General Public License for more details.
15*
16* You should have received a copy of the GNU General Public
17* Licence along with this program; if not, write to the Free
18* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19* Boston, MA 02110-1301, USA
20*/
21#include "Gfx_1.3.h"
22#include "Config.h"
23#include "m64p.h"
24#include "rdp.h"
25
26#ifndef OLDAPI
27
28static m64p_handle video_general_section;
29static m64p_handle video_glide64_section;
30
31
32BOOL Config_Open()
33{
34 if (ConfigOpenSection("Video-General", &video_general_section) != M64ERR_SUCCESS ||
35 ConfigOpenSection("Video-Glide64mk2", &video_glide64_section) != M64ERR_SUCCESS)
36 {
37 ERRLOG("Could not open configuration");
38 return FALSE;
39 }
40 ConfigSetDefaultBool(video_general_section, "Fullscreen", false, "Use fullscreen mode if True, or windowed mode if False");
41 ConfigSetDefaultInt(video_general_section, "ScreenWidth", 640, "Width of output window or fullscreen width");
42 ConfigSetDefaultInt(video_general_section, "ScreenHeight", 480, "Height of output window or fullscreen height");
43
44 return TRUE;
45}
46
47int Config_ReadScreenInt(const char *itemname)
48{
49 return ConfigGetParamInt(video_general_section, itemname);
50}
51
52PackedScreenResolution Config_ReadScreenSettings()
53{
54 PackedScreenResolution packedResolution;
55
56 packedResolution.width = ConfigGetParamInt(video_general_section, "ScreenWidth");
57 packedResolution.height = ConfigGetParamInt(video_general_section, "ScreenHeight");
58 packedResolution.fullscreen = ConfigGetParamBool(video_general_section, "Fullscreen");
59
60 return packedResolution;
61}
62
63BOOL Config_ReadInt(const char *itemname, const char *desc, int def_value, int create, int isBoolean)
64{
65 VLOG("Getting value %s", itemname);
66 if (isBoolean)
67 {
68 ConfigSetDefaultBool(video_glide64_section, itemname, def_value, desc);
69 return ConfigGetParamBool(video_glide64_section, itemname);
70 }
71 else
72 {
73 ConfigSetDefaultInt(video_glide64_section, itemname, def_value, desc);
74 return ConfigGetParamInt(video_glide64_section, itemname);
75 }
76
77}
78#else
79
80// Resolutions, MUST be in the correct order (SST1VID.H)
81wxUint32 resolutions[0x18][2] = {
82 { 320, 200 },
83 { 320, 240 },
84 { 400, 256 },
85 { 512, 384 },
86 { 640, 200 },
87 { 640, 350 },
88 { 640, 400 },
89 { 640, 480 },
90 { 800, 600 },
91 { 960, 720 },
92 { 800, 480 },
93 { 512, 256 },
94 { 1024, 768 },
95 { 1280, 1024 },
96 { 1600, 1200 },
97 { 400, 300 },
98
99 // 0x10
100 { 1152, 864 },
101 { 1280, 960 },
102 { 1600, 1024 },
103 { 1792, 1344 },
104 { 1856, 1392 },
105 { 1920, 1440 },
106 { 2048, 1536 },
107 { 2048, 2048 }
108};
109
110
111BOOL Config_Open()
112{
113 INI_Open();
114 if(INI_FindSection("SETTINGS",FALSE) == FALSE) {
115 INI_Close();
116 ERRLOG("Could not open configuration");
117 return FALSE;
118 }
119 return TRUE;
120}
121
122int Config_ReadScreenInt(const char *itemname) {
123 int res_data = Config_ReadInt("resolution", NULL, 7, FALSE, FALSE);
124 if(!strcmp("ScreenWidth", itemname))
125 return resolutions[res_data][0];
126 else if(!strcmp("ScreenHeight", itemname))
127 return resolutions[res_data][1];
128 else return FALSE;
129}
130
131BOOL Config_ReadInt(const char *itemname, const char *desc, int def_value, int create, int isBoolean) {
132 VLOG("Getting value %s", itemname);
133 int z = INI_ReadInt(itemname, def_value, FALSE);
134 if(isBoolean) z=(z && 1);
135 return z;
136}
137
138#endif
139
140#ifdef TEXTURE_FILTER
141wxUint32 texfltr[] = {
142 NO_FILTER, //"None"
143 SMOOTH_FILTER_1, //"Smooth filtering 1"
144 SMOOTH_FILTER_2, //"Smooth filtering 2"
145 SMOOTH_FILTER_3, //"Smooth filtering 3"
146 SMOOTH_FILTER_4, //"Smooth filtering 4"
147 SHARP_FILTER_1, //"Sharp filtering 1"
148 SHARP_FILTER_2, //"Sharp filtering 2"
149};
150
151wxUint32 texenht[] = {
152 NO_ENHANCEMENT, //"None"
153 NO_ENHANCEMENT, //"Store"
154 X2_ENHANCEMENT, //"X2"
155 X2SAI_ENHANCEMENT, //"X2SAI"
156 HQ2X_ENHANCEMENT, //"HQ2X"
157 HQ2XS_ENHANCEMENT, //"HQ2XS"
158 LQ2X_ENHANCEMENT, //"LQ2X"
159 LQ2XS_ENHANCEMENT, //"LQ2XS"
160 HQ4X_ENHANCEMENT, //"HQ4X"
161};
162
163wxUint32 texcmpr[] = {
164 //NO_COMPRESSION, //"None"
165 // NCC_COMPRESSION, //"NCC"
166 S3TC_COMPRESSION, //"S3TC"
167 FXT1_COMPRESSION, //"FXT1"
168};
169
170wxUint32 texhirs[] = {
171 NO_HIRESTEXTURES, //"Do not use"
172 RICE_HIRESTEXTURES, //"Rice format"
173 // GHQ_HIRESTEXTURES, //"GlideHQ format"
174 // JABO_HIRESTEXTURES, //"Jabo format"
175};
176#endif
177
178