get rid of some CamelCase names
[picodrive.git] / platform / uiq3 / emu.c
CommitLineData
ca482e5d 1#include <string.h>
2#include <sys/stat.h>
3#include <sys/types.h>
4#include "../common/emu.h"
5#include "../common/config.h"
6#include "../common/menu.h"
efcba75f 7#include "pico/pico_int.h"
ca482e5d 8
9const char * const keyNames[] = {
10 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
11 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
12 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
13 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
14};
15
f2cf8472 16int plat_get_root_dir(char *dst, int len)
ca482e5d 17{
18 strcpy(dst, "D:\\other\\PicoDrive\\");
19 return strlen(dst);
20}
21
22void emu_Init(void)
23{
24 int ret;
25
26 // make dirs for saves, cfgs, etc.
27 ret = mkdir("D:\\other\\PicoDrive", 0777);
28 if (ret == 0)
29 {
30 mkdir("D:\\other\\PicoDrive\\mds", 0777);
31 mkdir("D:\\other\\PicoDrive\\srm", 0777);
32 mkdir("D:\\other\\PicoDrive\\brm", 0777);
33 }
34
35 emu_prepareDefaultConfig();
36 config_readlrom("D:\\other\\PicoDrive\\config.cfg");
a47dd663 37 emu_read_config(0, 0);
ca482e5d 38 //PicoInit();
39}
40
41void emu_Deinit(void)
42{
43 // saves volume and last ROM
44 emu_WriteConfig(0);
45 //PicoExit();
46}
47
48void menu_romload_prepare(const char *rom_name)
49{
50}
51
52void menu_romload_end(void)
53{
54}
55
56void emu_prepareDefaultConfig(void)
57{
58 memset(&defaultConfig, 0, sizeof(defaultConfig));
59 defaultConfig.EmuOpt = 0x1d | 0x680; // | confirm_save, cd_leds, 16bit rend
60 defaultConfig.s_PicoOpt = 0x0f | POPT_EN_MCD_PCM|POPT_EN_MCD_CDDA|POPT_EN_SVP_DRC|POPT_ACC_SPRITES;
61 defaultConfig.s_PsndRate = 22050;
62 defaultConfig.s_PicoRegion = 0; // auto
63 defaultConfig.s_PicoAutoRgnOrder = 0x184; // US, EU, JP
64 defaultConfig.s_PicoCDBuffers = 0;
65 defaultConfig.Frameskip = -1; // auto
66 defaultConfig.volume = 80;
67 defaultConfig.scaling = 0;
f8af9634 68 defaultConfig.KeyBinds[0xd5] = 1<<26; // back
ca482e5d 69}
70
a47dd663 71void emu_pack_config(void)
72{
73 currentConfig.s_PicoOpt = PicoOpt;
74 currentConfig.s_PsndRate = PsndRate;
75 currentConfig.s_PicoRegion = PicoRegionOverride;
76 currentConfig.s_PicoAutoRgnOrder = PicoAutoRgnOrder;
77 currentConfig.s_PicoCDBuffers = PicoCDBuffers;
78}
79
80void emu_unpack_config(void)
81{
82 PicoOpt = currentConfig.s_PicoOpt;
83 PsndRate = currentConfig.s_PsndRate;
84 PicoRegionOverride = currentConfig.s_PicoRegion;
85 PicoAutoRgnOrder = currentConfig.s_PicoAutoRgnOrder;
86 PicoCDBuffers = currentConfig.s_PicoCDBuffers;
87}
88
ca482e5d 89/* used by config engine only, not actual menus */
90menu_entry opt_entries[] =
91{
92 { NULL, MB_NONE, MA_OPT_RENDERER, NULL, 0, 0, 0, 1, 1 },
93 { "Scaling", MB_RANGE, MA_OPT_SCALING, &currentConfig.scaling, 0, 0, 2, 1, 1 },
94 { "Rotation", MB_RANGE, MA_OPT_ROTATION, &currentConfig.rotation, 0, 0, 3, 1, 1 },
95 { "Accurate sprites", MB_ONOFF, MA_OPT_ACC_SPRITES, &PicoOpt, 0x080, 0, 0, 0, 1 },
96 { "Show FPS", MB_ONOFF, MA_OPT_SHOW_FPS, &currentConfig.EmuOpt, 0x002, 0, 0, 1, 1 },
97 { NULL, MB_RANGE, MA_OPT_FRAMESKIP, &currentConfig.Frameskip, 0, -1, 16, 1, 1 },
98 { "Enable sound", MB_ONOFF, MA_OPT_ENABLE_SOUND, &currentConfig.EmuOpt, 0x004, 0, 0, 1, 1 },
99 { NULL, MB_NONE, MA_OPT_SOUND_QUALITY, NULL, 0, 0, 0, 1, 1 },
100 { NULL, MB_NONE, MA_OPT_REGION, NULL, 0, 0, 0, 1, 1 },
101 { "Use SRAM/BRAM savestates", MB_ONOFF, MA_OPT_SRAM_STATES, &currentConfig.EmuOpt, 0x001, 0, 0, 1, 1 },
102};
103
104#define OPT_ENTRY_COUNT (sizeof(opt_entries) / sizeof(opt_entries[0]))
105const int opt_entry_count = OPT_ENTRY_COUNT;
106
107menu_entry opt2_entries[] =
108{
109 { "Disable sprite limit", MB_ONOFF, MA_OPT2_NO_SPRITE_LIM, &PicoOpt, 0x40000, 0, 0, 1, 1 },
110 { "Emulate Z80", MB_ONOFF, MA_OPT2_ENABLE_Z80, &PicoOpt, 0x00004, 0, 0, 1, 1 },
111 { "Emulate YM2612 (FM)", MB_ONOFF, MA_OPT2_ENABLE_YM2612, &PicoOpt, 0x00001, 0, 0, 1, 1 },
112 { "Emulate SN76496 (PSG)", MB_ONOFF, MA_OPT2_ENABLE_SN76496,&PicoOpt, 0x00002, 0, 0, 1, 1 },
113 { "gzip savestates", MB_ONOFF, MA_OPT2_GZIP_STATES, &currentConfig.EmuOpt, 0x0008, 0, 0, 1, 1 },
114 { "SVP dynarec", MB_ONOFF, MA_OPT2_SVP_DYNAREC, &PicoOpt, 0x20000, 0, 0, 1, 1 },
115 { "Disable idle loop patching",MB_ONOFF, MA_OPT2_NO_IDLE_LOOPS, &PicoOpt, 0x80000, 0, 0, 1, 1 },
116};
117
118#define OPT2_ENTRY_COUNT (sizeof(opt2_entries) / sizeof(opt2_entries[0]))
119const int opt2_entry_count = OPT2_ENTRY_COUNT;
120
121menu_entry cdopt_entries[] =
122{
123 { "CD LEDs", MB_ONOFF, MA_CDOPT_LEDS, &currentConfig.EmuOpt, 0x0400, 0, 0, 1, 1 },
f8af9634 124 { "CDDA audio", MB_ONOFF, MA_CDOPT_CDDA, &PicoOpt, 0x0800, 0, 0, 1, 1 },
ca482e5d 125 { "PCM audio", MB_ONOFF, MA_CDOPT_PCM, &PicoOpt, 0x0400, 0, 0, 1, 1 },
126 { NULL, MB_NONE, MA_CDOPT_READAHEAD, NULL, 0, 0, 0, 1, 1 },
127 { "SaveRAM cart", MB_ONOFF, MA_CDOPT_SAVERAM, &PicoOpt, 0x8000, 0, 0, 1, 1 },
128 { "Scale/Rot. fx (slow)", MB_ONOFF, MA_CDOPT_SCALEROT_CHIP,&PicoOpt, 0x1000, 0, 0, 1, 1 },
129 { "Better sync (slow)", MB_ONOFF, MA_CDOPT_BETTER_SYNC, &PicoOpt, 0x2000, 0, 0, 1, 1 },
130};
131
132#define CDOPT_ENTRY_COUNT (sizeof(cdopt_entries) / sizeof(cdopt_entries[0]))
133const int cdopt_entry_count = CDOPT_ENTRY_COUNT;
134
135menu_entry ctrlopt_entries[] =
136{
137 { "6 button pad", MB_ONOFF, MA_OPT_6BUTTON_PAD, &PicoOpt, 0x020, 0, 0, 1, 1 },
138 { "Turbo rate", MB_RANGE, MA_CTRL_TURBO_RATE, &currentConfig.turbo_rate, 0, 1, 30, 1, 1 },
139};
140
141#define CTRLOPT_ENTRY_COUNT (sizeof(ctrlopt_entries) / sizeof(ctrlopt_entries[0]))
142const int ctrlopt_entry_count = CTRLOPT_ENTRY_COUNT;
143
144me_bind_action emuctrl_actions[] =
145{
146 { "Load State ", 1<<28 },
147 { "Save State ", 1<<27 },
148 { "Pause Emu ", 1<<26 },
149 { "Switch Renderer", 1<<25 },
150 { "Prev save slot ", 1<<23 },
151 { "Next save slot ", 1<<22 },
152 { "Volume down ", 1<<21 },
153 { "Volume up ", 1<<20 },
154 { NULL, 0 }
155};
156
157