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 <stdint.h>
19 #include <string.h>
20 #include <errno.h>
21 
22 #include <libretro.h>
23 
24 #include "mednafen.h"
25 #include "settings.h"
26 
27 int setting_initial_scanline = 0;
28 int setting_initial_scanline_pal = 0;
29 int setting_last_scanline = 239;
30 int setting_last_scanline_pal = 287;
31 
32 uint32_t setting_psx_multitap_port_1 = 0;
33 uint32_t setting_psx_multitap_port_2 = 0;
34 uint32_t setting_psx_analog_toggle = 0;
35 uint32_t setting_psx_fastboot = 1;
36 
MDFN_GetSettingUI(const char * name)37 uint64_t MDFN_GetSettingUI(const char *name)
38 {
39    if (!strcmp("psx.spu.resamp_quality", name)) /* make configurable */
40       return 4;
41 
42    MDFN_DispMessage(3, RETRO_LOG_WARN,
43          RETRO_MESSAGE_TARGET_LOG, RETRO_MESSAGE_TYPE_NOTIFICATION,
44          "unhandled setting UI: %s\n", name);
45    return 0;
46 }
47 
MDFN_GetSettingI(const char * name)48 int64_t MDFN_GetSettingI(const char *name)
49 {
50    if (!strcmp("psx.region_default", name)) /* make configurable */
51       return 1; /* REGION_JP = 0, REGION_NA = 1, REGION_EU = 2 */
52    if (!strcmp("psx.slstart", name))
53       return setting_initial_scanline;
54    if (!strcmp("psx.slstartp", name))
55       return setting_initial_scanline_pal;
56    if (!strcmp("psx.slend", name))
57       return setting_last_scanline;
58    if (!strcmp("psx.slendp", name))
59       return setting_last_scanline_pal;
60    MDFN_DispMessage(3, RETRO_LOG_WARN,
61          RETRO_MESSAGE_TARGET_LOG, RETRO_MESSAGE_TYPE_NOTIFICATION,
62          "unhandled setting I: %s\n", name);
63    return 0;
64 }
65 
MDFN_GetSettingB(const char * name)66 bool MDFN_GetSettingB(const char *name)
67 {
68    if (!strcmp("cheats", name))
69       return 1;
70    /* LIBRETRO */
71    if (!strcmp("libretro.cd_load_into_ram", name))
72       return 0;
73    if (!strcmp("psx.input.port1.memcard", name))
74       return 1;
75    if (!strcmp("psx.input.port2.memcard", name))
76       return 1;
77    if (!strcmp("psx.input.port3.memcard", name))
78       return 1;
79    if (!strcmp("psx.input.port4.memcard", name))
80       return 1;
81    if (!strcmp("psx.input.port5.memcard", name))
82       return 1;
83    if (!strcmp("psx.input.port6.memcard", name))
84       return 1;
85    if (!strcmp("psx.input.port7.memcard", name))
86       return 1;
87    if (!strcmp("psx.input.port8.memcard", name))
88       return 1;
89    if (!strcmp("psx.input.pport1.multitap", name)) /* make configurable */
90       return setting_psx_multitap_port_1;
91    if (!strcmp("psx.input.pport2.multitap", name)) /* make configurable */
92       return setting_psx_multitap_port_2;
93    if (!strcmp("psx.region_autodetect", name)) /* make configurable */
94       return 1;
95    if (!strcmp("psx.input.analog_mode_ct", name)) /* make configurable */
96       return setting_psx_analog_toggle;
97    if (!strcmp("psx.fastboot", name))
98       return setting_psx_fastboot;
99    /* CDROM */
100    if (!strcmp("cdrom.lec_eval", name))
101       return 1;
102    /* FILESYS */
103    if (!strcmp("filesys.untrusted_fip_check", name))
104       return 0;
105    MDFN_DispMessage(3, RETRO_LOG_WARN,
106          RETRO_MESSAGE_TARGET_LOG, RETRO_MESSAGE_TYPE_NOTIFICATION,
107          "unhandled setting B: %s\n", name);
108    return 0;
109 }
110 
MDFN_GetSettingS(const char * name)111 const char *MDFN_GetSettingS(const char *name)
112 {
113    if (!strcmp("psx.bios_eu", name))
114       return "scph5502.bin";
115    if (!strcmp("psx.bios_jp", name))
116       return "scph5500.bin";
117    if (!strcmp("psx.bios_na", name))
118       return "scph5501.bin";
119    if (!strcmp("psx.region_default", name)) /* make configurable */
120       return "na";
121    MDFN_DispMessage(3, RETRO_LOG_WARN,
122          RETRO_MESSAGE_TARGET_LOG, RETRO_MESSAGE_TYPE_NOTIFICATION,
123          "unhandled setting S: %s\n", name);
124    return 0;
125 }
126