lowercasing filenames, part1; makefile adjustments
[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
16int emu_getMainDir(char *dst, int len)
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");
37 emu_ReadConfig(0, 0);
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
71/* used by config engine only, not actual menus */
72menu_entry opt_entries[] =
73{
74 { NULL, MB_NONE, MA_OPT_RENDERER, NULL, 0, 0, 0, 1, 1 },
75 { "Scaling", MB_RANGE, MA_OPT_SCALING, &currentConfig.scaling, 0, 0, 2, 1, 1 },
76 { "Rotation", MB_RANGE, MA_OPT_ROTATION, &currentConfig.rotation, 0, 0, 3, 1, 1 },
77 { "Accurate sprites", MB_ONOFF, MA_OPT_ACC_SPRITES, &PicoOpt, 0x080, 0, 0, 0, 1 },
78 { "Show FPS", MB_ONOFF, MA_OPT_SHOW_FPS, &currentConfig.EmuOpt, 0x002, 0, 0, 1, 1 },
79 { NULL, MB_RANGE, MA_OPT_FRAMESKIP, &currentConfig.Frameskip, 0, -1, 16, 1, 1 },
80 { "Enable sound", MB_ONOFF, MA_OPT_ENABLE_SOUND, &currentConfig.EmuOpt, 0x004, 0, 0, 1, 1 },
81 { NULL, MB_NONE, MA_OPT_SOUND_QUALITY, NULL, 0, 0, 0, 1, 1 },
82 { NULL, MB_NONE, MA_OPT_REGION, NULL, 0, 0, 0, 1, 1 },
83 { "Use SRAM/BRAM savestates", MB_ONOFF, MA_OPT_SRAM_STATES, &currentConfig.EmuOpt, 0x001, 0, 0, 1, 1 },
84};
85
86#define OPT_ENTRY_COUNT (sizeof(opt_entries) / sizeof(opt_entries[0]))
87const int opt_entry_count = OPT_ENTRY_COUNT;
88
89menu_entry opt2_entries[] =
90{
91 { "Disable sprite limit", MB_ONOFF, MA_OPT2_NO_SPRITE_LIM, &PicoOpt, 0x40000, 0, 0, 1, 1 },
92 { "Emulate Z80", MB_ONOFF, MA_OPT2_ENABLE_Z80, &PicoOpt, 0x00004, 0, 0, 1, 1 },
93 { "Emulate YM2612 (FM)", MB_ONOFF, MA_OPT2_ENABLE_YM2612, &PicoOpt, 0x00001, 0, 0, 1, 1 },
94 { "Emulate SN76496 (PSG)", MB_ONOFF, MA_OPT2_ENABLE_SN76496,&PicoOpt, 0x00002, 0, 0, 1, 1 },
95 { "gzip savestates", MB_ONOFF, MA_OPT2_GZIP_STATES, &currentConfig.EmuOpt, 0x0008, 0, 0, 1, 1 },
96 { "SVP dynarec", MB_ONOFF, MA_OPT2_SVP_DYNAREC, &PicoOpt, 0x20000, 0, 0, 1, 1 },
97 { "Disable idle loop patching",MB_ONOFF, MA_OPT2_NO_IDLE_LOOPS, &PicoOpt, 0x80000, 0, 0, 1, 1 },
98};
99
100#define OPT2_ENTRY_COUNT (sizeof(opt2_entries) / sizeof(opt2_entries[0]))
101const int opt2_entry_count = OPT2_ENTRY_COUNT;
102
103menu_entry cdopt_entries[] =
104{
105 { "CD LEDs", MB_ONOFF, MA_CDOPT_LEDS, &currentConfig.EmuOpt, 0x0400, 0, 0, 1, 1 },
f8af9634 106 { "CDDA audio", MB_ONOFF, MA_CDOPT_CDDA, &PicoOpt, 0x0800, 0, 0, 1, 1 },
ca482e5d 107 { "PCM audio", MB_ONOFF, MA_CDOPT_PCM, &PicoOpt, 0x0400, 0, 0, 1, 1 },
108 { NULL, MB_NONE, MA_CDOPT_READAHEAD, NULL, 0, 0, 0, 1, 1 },
109 { "SaveRAM cart", MB_ONOFF, MA_CDOPT_SAVERAM, &PicoOpt, 0x8000, 0, 0, 1, 1 },
110 { "Scale/Rot. fx (slow)", MB_ONOFF, MA_CDOPT_SCALEROT_CHIP,&PicoOpt, 0x1000, 0, 0, 1, 1 },
111 { "Better sync (slow)", MB_ONOFF, MA_CDOPT_BETTER_SYNC, &PicoOpt, 0x2000, 0, 0, 1, 1 },
112};
113
114#define CDOPT_ENTRY_COUNT (sizeof(cdopt_entries) / sizeof(cdopt_entries[0]))
115const int cdopt_entry_count = CDOPT_ENTRY_COUNT;
116
117menu_entry ctrlopt_entries[] =
118{
119 { "6 button pad", MB_ONOFF, MA_OPT_6BUTTON_PAD, &PicoOpt, 0x020, 0, 0, 1, 1 },
120 { "Turbo rate", MB_RANGE, MA_CTRL_TURBO_RATE, &currentConfig.turbo_rate, 0, 1, 30, 1, 1 },
121};
122
123#define CTRLOPT_ENTRY_COUNT (sizeof(ctrlopt_entries) / sizeof(ctrlopt_entries[0]))
124const int ctrlopt_entry_count = CTRLOPT_ENTRY_COUNT;
125
126me_bind_action emuctrl_actions[] =
127{
128 { "Load State ", 1<<28 },
129 { "Save State ", 1<<27 },
130 { "Pause Emu ", 1<<26 },
131 { "Switch Renderer", 1<<25 },
132 { "Prev save slot ", 1<<23 },
133 { "Next save slot ", 1<<22 },
134 { "Volume down ", 1<<21 },
135 { "Volume up ", 1<<20 },
136 { NULL, 0 }
137};
138
139