1 /* Mednafen - Multi-system Emulator
2  *
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16  */
17 
18 #include "mednafen.h"
19 #include <errno.h>
20 #include <string.h>
21 #include <string>
22 #include "settings.h"
23 
24 int setting_pce_arcadecard = 1;
25 int setting_pce_initial_scanline = 0;
26 int setting_pce_last_scanline = 242;
27 int setting_pce_h_overscan = 0;
28 int setting_pce_crop_h_overscan = 0;
29 int setting_pce_nospritelimit = 0;
30 int setting_pce_overclocked = 1;
31 int setting_pce_psgrevision = 2;
32 int setting_pce_cddavolume = 100;
33 int setting_pce_adpcmvolume = 100;
34 int setting_pce_cdpsgvolume = 100;
35 int setting_pce_adpcmextraprec = 0;
36 int setting_pce_resamp_quality = 3;
37 int setting_pce_multitap = 1;
38 int setting_pce_scaling = 0;
39 uint32_t setting_pce_cdspeed = 1;
40 std::string setting_pce_cdbios = "syscard3.pce";
41 std::string setting_pce_gecdbios = "gexpress.pce";
42 
MDFN_GetSettingUI(const char * name)43 uint64 MDFN_GetSettingUI(const char *name)
44 {
45    if (!strcmp("pce.cddavolume", name))
46       return setting_pce_cddavolume;
47    if (!strcmp("pce.adpcmvolume", name))
48       return setting_pce_adpcmvolume;
49    if (!strcmp("pce.cdpsgvolume", name))
50       return setting_pce_cdpsgvolume;
51    if (!strcmp("pce.cdspeed", name))
52       return setting_pce_cdspeed;
53    if (!strcmp("pce.ocmultiplier", name))
54       return setting_pce_overclocked;
55    if (!strcmp("pce.slstart", name))
56       return setting_pce_initial_scanline;
57    if (!strcmp("pce.slend", name))
58       return setting_pce_last_scanline;
59    if (!strcmp("pce.resamp_quality", name))
60       return setting_pce_resamp_quality;
61    if (!strcmp("pce.vramsize", name))
62       return 32768;
63    if (!strcmp("pce.scaling", name))
64       return setting_pce_scaling;
65 
66    fprintf(stderr, "unhandled setting UI: %s\n", name);
67    return 0;
68 }
69 
MDFN_GetSettingI(const char * name)70 int64 MDFN_GetSettingI(const char *name)
71 {
72    if (!strcmp("pce.psgrevision", name))
73       return setting_pce_psgrevision;
74 
75    fprintf(stderr, "unhandled setting I: %s\n", name);
76    return 0;
77 }
78 
MDFN_GetSettingF(const char * name)79 double MDFN_GetSettingF(const char *name)
80 {
81    if (!strcmp("pce.resamp_rate_error", name))
82       return 0.0000009;
83    if (!strcmp("pce.mouse_sensitivity", name))
84       return 1.0;
85 
86    fprintf(stderr, "unhandled setting F: %s\n", name);
87    return 0;
88 }
89 
MDFN_GetSettingB(const char * name)90 bool MDFN_GetSettingB(const char *name)
91 {
92    if (!strcmp("cheats", name))
93       return 0;
94    /* LIBRETRO */
95    if (!strcmp("libretro.cd_load_into_ram", name))
96       return 0;
97    if (!strcmp("pce.input.multitap", name))
98       return setting_pce_multitap;
99    if (!strcmp("pce.arcadecard", name))
100       return setting_pce_arcadecard;
101    if (!strcmp("pce.nospritelimit", name))
102       return setting_pce_nospritelimit;
103    if (!strcmp("pce.forcemono", name))
104       return 0;
105    if (!strcmp("pce.disable_softreset", name))
106       return 0;
107    if (!strcmp("pce.adpcmlp", name))
108       return 0;
109    if (!strcmp("pce.forcesgx", name))
110       return 0;
111    if (!strcmp("pce.h_overscan", name))
112       return setting_pce_h_overscan;
113    if (!strcmp("pce.crop_h_overscan", name))
114       return setting_pce_crop_h_overscan;
115    if (!strcmp("pce.disable_bram_hucard", name))
116       return 0;
117    if (!strcmp("pce.disable_bram_cd", name))
118       return 0;
119    if (!strcmp("pce.adpcmextraprec", name))
120       return setting_pce_adpcmextraprec;
121    /* CDROM */
122    if (!strcmp("cdrom.lec_eval", name))
123       return 1;
124    /* FILESYS */
125    if (!strcmp("filesys.untrusted_fip_check", name))
126       return 0;
127    if (!strcmp("filesys.disablesavegz", name))
128       return 1;
129    fprintf(stderr, "unhandled setting B: %s\n", name);
130    return 0;
131 }
132 
133 extern std::string retro_base_directory;
134 
MDFN_GetSettingS(const char * name)135 std::string MDFN_GetSettingS(const char *name)
136 {
137    if (!strcmp("pce.cdbios", name))
138       return setting_pce_cdbios;
139    if (!strcmp("pce.gecdbios", name))
140       return setting_pce_gecdbios;
141    /* FILESYS */
142    if (!strcmp("filesys.path_firmware", name))
143       return retro_base_directory;
144    if (!strcmp("filesys.path_palette", name))
145       return retro_base_directory;
146    if (!strcmp("filesys.path_sav", name))
147       return retro_base_directory;
148    if (!strcmp("filesys.path_state", name))
149       return retro_base_directory;
150    if (!strcmp("filesys.path_cheat", name))
151       return retro_base_directory;
152    fprintf(stderr, "unhandled setting S: %s\n", name);
153    return 0;
154 }
155