mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-06 07:38:05 -04:00
Merge branch 'dev'
This commit is contained in:
commit
9a1f192a14
89 changed files with 3226 additions and 4002 deletions
|
@ -30,6 +30,13 @@ SRCS_COMMON += $(R)cpu/debug.c
|
|||
LDFLAGS += -lreadline
|
||||
endif
|
||||
endif
|
||||
ifeq "$(cpu_cmp)" "1"
|
||||
ifdef cpu_cmp_w
|
||||
DEFINES += CPU_CMP_W
|
||||
else
|
||||
DEFINES += CPU_CMP_R
|
||||
endif # cpu_cmp_w
|
||||
endif
|
||||
ifeq "$(pprof)" "1"
|
||||
DEFINES += PPROF
|
||||
SRCS_COMMON += $(R)platform/linux/pprof.c
|
||||
|
@ -56,7 +63,7 @@ SRCS_COMMON += $(R)pico/cd/misc_arm.s
|
|||
endif
|
||||
ifeq "$(asm_cdpico)" "1"
|
||||
DEFINES += _ASM_CD_PICO_C
|
||||
SRCS_COMMON += $(R)pico/cd/pico_arm.s
|
||||
SRCS_COMMON += $(R)pico/cd/mcd_arm.s
|
||||
endif
|
||||
ifeq "$(asm_cdmemory)" "1"
|
||||
DEFINES += _ASM_CD_MEMORY_C
|
||||
|
@ -85,7 +92,7 @@ else
|
|||
DEFINES += NO_SMS
|
||||
endif
|
||||
# CD
|
||||
SRCS_COMMON += $(R)pico/cd/pico.c $(R)pico/cd/memory.c $(R)pico/cd/sek.c \
|
||||
SRCS_COMMON += $(R)pico/cd/mcd.c $(R)pico/cd/memory.c $(R)pico/cd/sek.c \
|
||||
$(R)pico/cd/LC89510.c $(R)pico/cd/cd_sys.c $(R)pico/cd/cd_file.c \
|
||||
$(R)pico/cd/cue.c $(R)pico/cd/gfx_cd.c $(R)pico/cd/misc.c \
|
||||
$(R)pico/cd/pcm.c $(R)pico/cd/buffering.c
|
||||
|
@ -157,15 +164,8 @@ SRCS_COMMON += $(R)cpu/sh2/mame/sh2dasm.c
|
|||
SRCS_COMMON += $(R)platform/libpicofe/linux/host_dasm.c
|
||||
LDFLAGS += -lbfd -lopcodes -liberty
|
||||
endif
|
||||
ifeq "$(drc_debug_interp)" "1"
|
||||
DEFINES += DRC_DEBUG_INTERP
|
||||
use_sh2mame = 1
|
||||
endif
|
||||
endif # use_sh2drc
|
||||
#
|
||||
ifeq "$(use_sh2mame)" "1"
|
||||
SRCS_COMMON += $(R)cpu/sh2/mame/sh2pico.c
|
||||
endif
|
||||
endif # !no_32x
|
||||
|
||||
OBJS_COMMON := $(SRCS_COMMON:.c=.o)
|
||||
|
@ -181,9 +181,11 @@ $(FR)cpu/cyclone/Cyclone.h:
|
|||
@echo "Cyclone submodule is missing, please run 'git submodule update --init'"
|
||||
@false
|
||||
|
||||
$(FR)cpu/cyclone/Cyclone.s:
|
||||
$(FR)cpu/cyclone/Cyclone.s: $(FR)cpu/cyclone_config.h
|
||||
@echo building Cyclone...
|
||||
@make -C $(R)cpu/cyclone/ CONFIG_FILE='\"../cyclone_config.h\"'
|
||||
@make -C $(R)cpu/cyclone/ CONFIG_FILE=../cyclone_config.h
|
||||
|
||||
$(FR)cpu/cyclone/Cyclone.s: $(FR)cpu/cyclone/*.cpp $(FR)cpu/cyclone/*.h
|
||||
|
||||
$(FR)cpu/musashi/m68kops.c:
|
||||
@make -C $(R)cpu/musashi
|
||||
|
|
|
@ -308,11 +308,6 @@ static int custom_read(menu_entry *me, const char *var, const char *val)
|
|||
return 0;
|
||||
return 1;
|
||||
|
||||
case MA_OPT2_GAMMA:
|
||||
if (strcasecmp(var, "Gamma correction") != 0) return 0;
|
||||
currentConfig.gamma = (int) (atof(val) * 100.0);
|
||||
return 1;
|
||||
|
||||
case MA_CDOPT_READAHEAD:
|
||||
if (strcasecmp(var, "ReadAhead buffer") != 0) return 0;
|
||||
PicoCDBuffers = atoi(val) / 2;
|
||||
|
|
|
@ -43,7 +43,7 @@ void *g_screen_ptr;
|
|||
int g_screen_width = 320;
|
||||
int g_screen_height = 240;
|
||||
|
||||
char *PicoConfigFile = "config.cfg";
|
||||
const char *PicoConfigFile = "config2.cfg";
|
||||
currentConfig_t currentConfig, defaultConfig;
|
||||
int state_slot = 0;
|
||||
int config_slot = 0, config_slot_current = 0;
|
||||
|
@ -444,6 +444,10 @@ int emu_reload_rom(const char *rom_fname_in)
|
|||
break;
|
||||
}
|
||||
|
||||
// make quirks visible in UI
|
||||
if (PicoQuirks & PQUIRK_FORCE_6BTN)
|
||||
currentConfig.input_dev0 = PICO_INPUT_PAD_6BTN;
|
||||
|
||||
menu_romload_end();
|
||||
menu_romload_started = 0;
|
||||
|
||||
|
@ -455,9 +459,11 @@ int emu_reload_rom(const char *rom_fname_in)
|
|||
// additional movie stuff
|
||||
if (movie_data)
|
||||
{
|
||||
if (movie_data[0x14] == '6')
|
||||
PicoOpt |= POPT_6BTN_PAD; // 6 button pad
|
||||
else PicoOpt &= ~POPT_6BTN_PAD;
|
||||
enum input_device indev = (movie_data[0x14] == '6') ?
|
||||
PICO_INPUT_PAD_6BTN : PICO_INPUT_PAD_3BTN;
|
||||
PicoSetInputDevice(0, indev);
|
||||
PicoSetInputDevice(1, indev);
|
||||
|
||||
PicoOpt |= POPT_DIS_VDP_FIFO; // no VDP fifo timing
|
||||
if (movie_data[0xF] >= 'A') {
|
||||
if (movie_data[0x16] & 0x80) {
|
||||
|
@ -484,6 +490,30 @@ int emu_reload_rom(const char *rom_fname_in)
|
|||
if (currentConfig.EmuOpt & EOPT_EN_SRAM)
|
||||
emu_save_load_game(1, 1);
|
||||
|
||||
// state autoload?
|
||||
if (g_autostateld_opt) {
|
||||
int time, newest = 0, newest_slot = -1;
|
||||
int slot;
|
||||
|
||||
for (slot = 0; slot < 10; slot++) {
|
||||
if (emu_check_save_file(slot, &time)) {
|
||||
if (time > newest) {
|
||||
newest = time;
|
||||
newest_slot = slot;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (newest_slot >= 0) {
|
||||
lprintf("autoload slot %d\n", newest_slot);
|
||||
state_slot = newest_slot;
|
||||
emu_save_load_game(1, 0);
|
||||
}
|
||||
else {
|
||||
lprintf("no save to autoload.\n");
|
||||
}
|
||||
}
|
||||
|
||||
retval = 1;
|
||||
out:
|
||||
if (menu_romload_started)
|
||||
|
@ -539,7 +569,7 @@ static void make_config_cfg(char *cfg_buff_512)
|
|||
void emu_prep_defconfig(void)
|
||||
{
|
||||
memset(&defaultConfig, 0, sizeof(defaultConfig));
|
||||
defaultConfig.EmuOpt = 0x9d | EOPT_RAM_TIMINGS|EOPT_EN_CD_LEDS;
|
||||
defaultConfig.EmuOpt = 0x9d | EOPT_EN_CD_LEDS;
|
||||
defaultConfig.s_PicoOpt = POPT_EN_STEREO|POPT_EN_FM|POPT_EN_PSG|POPT_EN_Z80 |
|
||||
POPT_EN_MCD_PCM|POPT_EN_MCD_CDDA|POPT_EN_MCD_GFX |
|
||||
POPT_EN_SVP_DRC|POPT_ACC_SPRITES |
|
||||
|
@ -550,6 +580,8 @@ void emu_prep_defconfig(void)
|
|||
defaultConfig.s_PicoCDBuffers = 0;
|
||||
defaultConfig.confirm_save = EOPT_CONFIRM_SAVE;
|
||||
defaultConfig.Frameskip = -1; // auto
|
||||
defaultConfig.input_dev0 = PICO_INPUT_PAD_3BTN;
|
||||
defaultConfig.input_dev1 = PICO_INPUT_PAD_3BTN;
|
||||
defaultConfig.volume = 50;
|
||||
defaultConfig.gamma = 100;
|
||||
defaultConfig.scaling = 0;
|
||||
|
@ -728,19 +760,25 @@ void update_movie(void)
|
|||
}
|
||||
}
|
||||
|
||||
static int try_ropen_file(const char *fname)
|
||||
static int try_ropen_file(const char *fname, int *time)
|
||||
{
|
||||
struct stat st;
|
||||
FILE *f;
|
||||
|
||||
f = fopen(fname, "rb");
|
||||
if (f) {
|
||||
if (time != NULL) {
|
||||
*time = 0;
|
||||
if (fstat(fileno(f), &st) == 0)
|
||||
*time = (int)st.st_mtime;
|
||||
}
|
||||
fclose(f);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *emu_get_save_fname(int load, int is_sram, int slot)
|
||||
char *emu_get_save_fname(int load, int is_sram, int slot, int *time)
|
||||
{
|
||||
char *saveFname = static_buff;
|
||||
char ext[16];
|
||||
|
@ -753,11 +791,11 @@ char *emu_get_save_fname(int load, int is_sram, int slot)
|
|||
if (!load)
|
||||
return saveFname;
|
||||
|
||||
if (try_ropen_file(saveFname))
|
||||
if (try_ropen_file(saveFname, time))
|
||||
return saveFname;
|
||||
|
||||
romfname_ext(saveFname, sizeof(static_buff), NULL, ext);
|
||||
if (try_ropen_file(saveFname))
|
||||
if (try_ropen_file(saveFname, time))
|
||||
return saveFname;
|
||||
}
|
||||
else
|
||||
|
@ -775,11 +813,11 @@ char *emu_get_save_fname(int load, int is_sram, int slot)
|
|||
}
|
||||
else {
|
||||
romfname_ext(saveFname, sizeof(static_buff), "mds" PATH_SEP, ext);
|
||||
if (try_ropen_file(saveFname))
|
||||
if (try_ropen_file(saveFname, time))
|
||||
return saveFname;
|
||||
|
||||
romfname_ext(saveFname, sizeof(static_buff), NULL, ext);
|
||||
if (try_ropen_file(saveFname))
|
||||
if (try_ropen_file(saveFname, time))
|
||||
return saveFname;
|
||||
|
||||
// try the other ext
|
||||
|
@ -789,7 +827,7 @@ char *emu_get_save_fname(int load, int is_sram, int slot)
|
|||
strcat(ext, ext_othr);
|
||||
|
||||
romfname_ext(saveFname, sizeof(static_buff), "mds"PATH_SEP, ext);
|
||||
if (try_ropen_file(saveFname))
|
||||
if (try_ropen_file(saveFname, time))
|
||||
return saveFname;
|
||||
}
|
||||
}
|
||||
|
@ -799,7 +837,7 @@ char *emu_get_save_fname(int load, int is_sram, int slot)
|
|||
|
||||
int emu_check_save_file(int slot, int *time)
|
||||
{
|
||||
return emu_get_save_fname(1, 0, slot) ? 1 : 0;
|
||||
return emu_get_save_fname(1, 0, slot, time) ? 1 : 0;
|
||||
}
|
||||
|
||||
int emu_save_load_game(int load, int sram)
|
||||
|
@ -808,7 +846,7 @@ int emu_save_load_game(int load, int sram)
|
|||
char *saveFname;
|
||||
|
||||
// make save filename
|
||||
saveFname = emu_get_save_fname(load, sram, state_slot);
|
||||
saveFname = emu_get_save_fname(load, sram, state_slot, NULL);
|
||||
if (saveFname == NULL) {
|
||||
if (!sram)
|
||||
emu_status_msg(load ? "LOAD FAILED (missing file)" : "SAVE FAILED");
|
||||
|
@ -1268,31 +1306,26 @@ static void emu_loop_prep(void)
|
|||
filter_old = currentConfig.filter;
|
||||
}
|
||||
|
||||
printf("-- gamma %d\n", currentConfig.gamma);
|
||||
plat_target_gamma_set(currentConfig.gamma, 0);
|
||||
|
||||
pemu_loop_prep();
|
||||
}
|
||||
|
||||
static void skip_frame(int do_audio)
|
||||
{
|
||||
PicoSkipFrame = do_audio ? 1 : 2;
|
||||
PicoFrame();
|
||||
PicoSkipFrame = 0;
|
||||
}
|
||||
|
||||
/* our tick here is 1 us right now */
|
||||
#define ms_to_ticks(x) (unsigned int)(x * 1000)
|
||||
#define get_ticks() plat_get_ticks_us()
|
||||
|
||||
void emu_loop(void)
|
||||
{
|
||||
int pframes_done; /* "period" frames, used for sync */
|
||||
int frames_done, frames_shown; /* actual frames for fps counter */
|
||||
int target_fps, target_frametime;
|
||||
unsigned int timestamp_base = 0, timestamp_fps;
|
||||
int target_frametime_x3;
|
||||
unsigned int timestamp_x3 = 0;
|
||||
unsigned int timestamp_aim_x3 = 0;
|
||||
unsigned int timestamp_fps_x3 = 0;
|
||||
char *notice_msg = NULL;
|
||||
char fpsbuff[24];
|
||||
int i;
|
||||
int fskip_cnt = 0;
|
||||
|
||||
fpsbuff[0] = 0;
|
||||
|
||||
|
@ -1307,45 +1340,47 @@ void emu_loop(void)
|
|||
pemu_sound_start();
|
||||
|
||||
/* number of ticks per frame */
|
||||
if (Pico.m.pal) {
|
||||
target_fps = 50;
|
||||
target_frametime = ms_to_ticks(1000) / 50;
|
||||
} else {
|
||||
target_fps = 60;
|
||||
target_frametime = ms_to_ticks(1000) / 60 + 1;
|
||||
}
|
||||
if (Pico.m.pal)
|
||||
target_frametime_x3 = 3 * ms_to_ticks(1000) / 50;
|
||||
else
|
||||
target_frametime_x3 = 3 * ms_to_ticks(1000) / 60;
|
||||
|
||||
timestamp_fps = get_ticks();
|
||||
reset_timing = 1;
|
||||
|
||||
frames_done = frames_shown = pframes_done = 0;
|
||||
|
||||
plat_video_wait_vsync();
|
||||
frames_done = frames_shown = 0;
|
||||
|
||||
/* loop with resync every 1 sec. */
|
||||
while (engineState == PGS_Running)
|
||||
{
|
||||
unsigned int timestamp;
|
||||
int diff, diff_lim;
|
||||
int skip = 0;
|
||||
int diff;
|
||||
|
||||
pprof_start(main);
|
||||
|
||||
timestamp = get_ticks();
|
||||
if (reset_timing) {
|
||||
reset_timing = 0;
|
||||
timestamp_base = timestamp;
|
||||
pframes_done = 0;
|
||||
plat_video_wait_vsync();
|
||||
timestamp_aim_x3 = get_ticks() * 3;
|
||||
timestamp_fps_x3 = timestamp_aim_x3;
|
||||
fskip_cnt = 0;
|
||||
}
|
||||
else if (currentConfig.EmuOpt & EOPT_NO_FRMLIMIT) {
|
||||
timestamp_aim_x3 = get_ticks() * 3;
|
||||
}
|
||||
|
||||
timestamp_x3 = get_ticks() * 3;
|
||||
|
||||
// show notice_msg message?
|
||||
if (notice_msg_time != 0)
|
||||
{
|
||||
static int noticeMsgSum;
|
||||
if (timestamp - ms_to_ticks(notice_msg_time) > ms_to_ticks(STATUS_MSG_TIMEOUT)) {
|
||||
if (timestamp_x3 - ms_to_ticks(notice_msg_time) * 3
|
||||
> ms_to_ticks(STATUS_MSG_TIMEOUT) * 3)
|
||||
{
|
||||
notice_msg_time = 0;
|
||||
plat_status_msg_clear();
|
||||
notice_msg = NULL;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
int sum = noticeMsg[0] + noticeMsg[1] + noticeMsg[2];
|
||||
if (sum != noticeMsgSum) {
|
||||
plat_status_msg_clear();
|
||||
|
@ -1356,7 +1391,7 @@ void emu_loop(void)
|
|||
}
|
||||
|
||||
// second changed?
|
||||
if (timestamp - timestamp_fps >= ms_to_ticks(1000))
|
||||
if (timestamp_x3 - timestamp_fps_x3 >= ms_to_ticks(1000) * 3)
|
||||
{
|
||||
#ifdef BENCHMARK
|
||||
static int bench = 0, bench_fps = 0, bench_fps_s = 0, bfp = 0, bf[4];
|
||||
|
@ -1370,92 +1405,83 @@ void emu_loop(void)
|
|||
sprintf(fpsbuff, "%02i/%02i/%02i", frames_shown, bench_fps_s, (bf[0]+bf[1]+bf[2]+bf[3])>>2);
|
||||
printf("%s\n", fpsbuff);
|
||||
#else
|
||||
if (currentConfig.EmuOpt & EOPT_SHOW_FPS) {
|
||||
sprintf(fpsbuff, "%02i/%02i", frames_shown, frames_done);
|
||||
if (fpsbuff[5] == 0) { fpsbuff[5] = fpsbuff[6] = ' '; fpsbuff[7] = 0; }
|
||||
}
|
||||
if (currentConfig.EmuOpt & EOPT_SHOW_FPS)
|
||||
sprintf(fpsbuff, "%02i/%02i ", frames_shown, frames_done);
|
||||
#endif
|
||||
frames_shown = frames_done = 0;
|
||||
timestamp_fps += ms_to_ticks(1000);
|
||||
timestamp_fps_x3 += ms_to_ticks(1000) * 3;
|
||||
}
|
||||
#ifdef PFRAMES
|
||||
sprintf(fpsbuff, "%i", Pico.m.frame_count);
|
||||
#endif
|
||||
|
||||
if (timestamp - timestamp_base >= ms_to_ticks(1000))
|
||||
diff = timestamp_aim_x3 - timestamp_x3;
|
||||
|
||||
if (currentConfig.Frameskip >= 0) // frameskip enabled (or 0)
|
||||
{
|
||||
if ((currentConfig.EmuOpt & EOPT_NO_FRMLIMIT) && currentConfig.Frameskip >= 0)
|
||||
pframes_done = 0;
|
||||
else
|
||||
pframes_done -= target_fps;
|
||||
if (pframes_done < -2) {
|
||||
/* don't drag more than 2 frames behind */
|
||||
pframes_done = -2;
|
||||
timestamp_base = timestamp - 2 * target_frametime;
|
||||
if (fskip_cnt < currentConfig.Frameskip) {
|
||||
fskip_cnt++;
|
||||
skip = 1;
|
||||
}
|
||||
else
|
||||
timestamp_base += ms_to_ticks(1000);
|
||||
}
|
||||
|
||||
diff = timestamp - timestamp_base;
|
||||
diff_lim = (pframes_done + 1) * target_frametime;
|
||||
|
||||
if (currentConfig.Frameskip >= 0) // frameskip enabled
|
||||
{
|
||||
for (i = 0; i < currentConfig.Frameskip; i++) {
|
||||
emu_update_input();
|
||||
skip_frame(1);
|
||||
pframes_done++; frames_done++;
|
||||
diff_lim += target_frametime;
|
||||
|
||||
if (!(currentConfig.EmuOpt & (EOPT_NO_FRMLIMIT|EOPT_EXT_FRMLIMIT))) {
|
||||
timestamp = get_ticks();
|
||||
diff = timestamp - timestamp_base;
|
||||
if (!reset_timing && diff < diff_lim) // we are too fast
|
||||
plat_wait_till_us(timestamp_base + diff_lim);
|
||||
}
|
||||
else {
|
||||
fskip_cnt = 0;
|
||||
}
|
||||
}
|
||||
else if (diff > diff_lim)
|
||||
else if (diff < -target_frametime_x3)
|
||||
{
|
||||
/* no time left for this frame - skip */
|
||||
/* limit auto frameskip to 8 */
|
||||
if (frames_done / 8 <= frames_shown) {
|
||||
emu_update_input();
|
||||
skip_frame(diff < diff_lim + target_frametime * 16);
|
||||
pframes_done++; frames_done++;
|
||||
continue;
|
||||
}
|
||||
if (frames_done / 8 <= frames_shown)
|
||||
skip = 1;
|
||||
}
|
||||
|
||||
// don't go in debt too much
|
||||
while (diff < -target_frametime_x3 * 3) {
|
||||
timestamp_aim_x3 += target_frametime_x3;
|
||||
diff = timestamp_aim_x3 - timestamp_x3;
|
||||
}
|
||||
|
||||
emu_update_input();
|
||||
PicoFrame();
|
||||
pemu_finalize_frame(fpsbuff, notice_msg);
|
||||
if (skip) {
|
||||
int do_audio = diff > -target_frametime_x3 * 2;
|
||||
PicoSkipFrame = do_audio ? 1 : 2;
|
||||
PicoFrame();
|
||||
PicoSkipFrame = 0;
|
||||
}
|
||||
else {
|
||||
PicoFrame();
|
||||
pemu_finalize_frame(fpsbuff, notice_msg);
|
||||
frames_shown++;
|
||||
}
|
||||
frames_done++;
|
||||
timestamp_aim_x3 += target_frametime_x3;
|
||||
|
||||
if (!flip_after_sync)
|
||||
if (!skip && !flip_after_sync)
|
||||
plat_video_flip();
|
||||
|
||||
/* frame limiter */
|
||||
if (!reset_timing && !(currentConfig.EmuOpt & (EOPT_NO_FRMLIMIT|EOPT_EXT_FRMLIMIT)))
|
||||
if (!skip && !reset_timing
|
||||
&& !(currentConfig.EmuOpt & (EOPT_NO_FRMLIMIT|EOPT_EXT_FRMLIMIT)))
|
||||
{
|
||||
timestamp = get_ticks();
|
||||
diff = timestamp - timestamp_base;
|
||||
unsigned int timestamp = get_ticks();
|
||||
diff = timestamp_aim_x3 - timestamp * 3;
|
||||
|
||||
// sleep or vsync if we are still too fast
|
||||
if (diff < diff_lim)
|
||||
{
|
||||
if (diff > target_frametime_x3 && (currentConfig.EmuOpt & EOPT_VSYNC)) {
|
||||
// we are too fast
|
||||
plat_wait_till_us(timestamp_base + diff_lim - target_frametime / 4);
|
||||
if (currentConfig.EmuOpt & EOPT_VSYNC)
|
||||
plat_video_wait_vsync();
|
||||
plat_video_wait_vsync();
|
||||
timestamp = get_ticks();
|
||||
diff = timestamp * 3 - timestamp_aim_x3;
|
||||
}
|
||||
if (diff > target_frametime_x3) {
|
||||
// still too fast
|
||||
plat_wait_till_us(timestamp + (diff - target_frametime_x3) / 3);
|
||||
}
|
||||
}
|
||||
|
||||
if (flip_after_sync)
|
||||
if (!skip && flip_after_sync)
|
||||
plat_video_flip();
|
||||
|
||||
pframes_done++; frames_done++; frames_shown++;
|
||||
|
||||
pprof_end(main);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,10 +21,8 @@ extern int g_screen_height;
|
|||
#define EOPT_SHOW_FPS (1<<1)
|
||||
#define EOPT_EN_SOUND (1<<2)
|
||||
#define EOPT_GZIP_SAVES (1<<3)
|
||||
#define EOPT_MMUHACK (1<<4)
|
||||
#define EOPT_NO_AUTOSVCFG (1<<5)
|
||||
#define EOPT_16BPP (1<<7) // depreceted for .renderer
|
||||
#define EOPT_RAM_TIMINGS (1<<8)
|
||||
#define EOPT_EN_CD_LEDS (1<<10)
|
||||
#define EOPT_A_SN_GAMMA (1<<12)
|
||||
#define EOPT_VSYNC (1<<13)
|
||||
|
@ -57,6 +55,8 @@ typedef struct _currentConfig_t {
|
|||
int s_PicoAutoRgnOrder;
|
||||
int s_PicoCDBuffers;
|
||||
int Frameskip;
|
||||
int input_dev0;
|
||||
int input_dev1;
|
||||
int confirm_save;
|
||||
int CPUclock;
|
||||
int volume;
|
||||
|
@ -77,7 +77,7 @@ typedef struct _currentConfig_t {
|
|||
} currentConfig_t;
|
||||
|
||||
extern currentConfig_t currentConfig, defaultConfig;
|
||||
extern char *PicoConfigFile;
|
||||
extern const char *PicoConfigFile;
|
||||
extern int state_slot;
|
||||
extern int config_slot, config_slot_current;
|
||||
extern unsigned char *movie_data;
|
||||
|
@ -121,7 +121,7 @@ void emu_set_defconfig(void);
|
|||
int emu_read_config(const char *rom_fname, int no_defaults);
|
||||
int emu_write_config(int game);
|
||||
|
||||
char *emu_get_save_fname(int load, int is_sram, int slot);
|
||||
char *emu_get_save_fname(int load, int is_sram, int slot, int *time);
|
||||
int emu_check_save_file(int slot, int *time);
|
||||
|
||||
void emu_text_out8 (int x, int y, const char *text);
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include <cpu/debug.h>
|
||||
|
||||
|
||||
extern char *PicoConfigFile;
|
||||
static int load_state_slot = -1;
|
||||
char **g_argv;
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "emu.h"
|
||||
#include "menu_pico.h"
|
||||
|
@ -66,7 +67,6 @@ static const char *men_dummy[] = { NULL };
|
|||
#else
|
||||
#define MENU_OPTIONS_GFX
|
||||
#define MENU_OPTIONS_ADV
|
||||
#define menu_main_plat_draw NULL
|
||||
#endif
|
||||
|
||||
static void make_bg(int no_scale)
|
||||
|
@ -135,7 +135,7 @@ static void draw_savestate_bg(int slot)
|
|||
const char *fname;
|
||||
void *tmp_state;
|
||||
|
||||
fname = emu_get_save_fname(1, 0, slot);
|
||||
fname = emu_get_save_fname(1, 0, slot, NULL);
|
||||
if (!fname)
|
||||
return;
|
||||
|
||||
|
@ -355,12 +355,15 @@ static const char *mgn_dev_name(int id, int *offs)
|
|||
static int mh_saveloadcfg(int id, int keys);
|
||||
static const char *mgn_saveloadcfg(int id, int *offs);
|
||||
|
||||
const char *indev_names[] = { "none", "3 button pad", "6 button pad", NULL };
|
||||
|
||||
static menu_entry e_menu_keyconfig[] =
|
||||
{
|
||||
mee_handler_id("Player 1", MA_CTRL_PLAYER1, key_config_loop_wrap),
|
||||
mee_handler_id("Player 2", MA_CTRL_PLAYER2, key_config_loop_wrap),
|
||||
mee_handler_id("Emulator controls", MA_CTRL_EMU, key_config_loop_wrap),
|
||||
mee_onoff ("6 button pad", MA_OPT_6BUTTON_PAD, PicoOpt, POPT_6BTN_PAD),
|
||||
mee_enum ("Input device 1", MA_OPT_INPUT_DEV0, currentConfig.input_dev0, indev_names),
|
||||
mee_enum ("Input device 2", MA_OPT_INPUT_DEV1, currentConfig.input_dev1, indev_names),
|
||||
mee_range ("Turbo rate", MA_CTRL_TURBO_RATE, currentConfig.turbo_rate, 1, 30),
|
||||
mee_range ("Analog deadzone", MA_CTRL_DEADZONE, currentConfig.analog_deadzone, 1, 99),
|
||||
mee_cust_nosave("Save global config", MA_OPT_SAVECFG, mh_saveloadcfg, mgn_saveloadcfg),
|
||||
|
@ -383,6 +386,10 @@ static int menu_loop_keyconfig(int id, int keys)
|
|||
|
||||
me_enable(e_menu_keyconfig, MA_OPT_SAVECFG_GAME, PicoGameLoaded);
|
||||
me_loop(e_menu_keyconfig, &sel);
|
||||
|
||||
PicoSetInputDevice(0, currentConfig.input_dev0);
|
||||
PicoSetInputDevice(1, currentConfig.input_dev1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -517,6 +524,8 @@ static menu_entry e_menu_adv_options[] =
|
|||
mee_onoff ("Don't save last used ROM", MA_OPT2_NO_LAST_ROM, currentConfig.EmuOpt, EOPT_NO_AUTOSVCFG),
|
||||
mee_onoff ("Disable idle loop patching",MA_OPT2_NO_IDLE_LOOPS,PicoOpt, POPT_DIS_IDLE_DET),
|
||||
mee_onoff ("Disable frame limiter", MA_OPT2_NO_FRAME_LIMIT,currentConfig.EmuOpt, EOPT_NO_FRMLIMIT),
|
||||
mee_onoff ("Enable dynarecs", MA_OPT2_SVP_DYNAREC, PicoOpt, POPT_EN_SVP_DRC),
|
||||
mee_onoff ("Status line in main menu", MA_OPT2_STATUS_LINE, currentConfig.EmuOpt, EOPT_SHOW_RTC),
|
||||
MENU_OPTIONS_ADV
|
||||
mee_end,
|
||||
};
|
||||
|
@ -530,14 +539,20 @@ static int menu_loop_adv_options(int id, int keys)
|
|||
|
||||
// ------------ gfx options menu ------------
|
||||
|
||||
static const char h_gamma[] = "Gamma/brightness adjustment (default 100)";
|
||||
static const char h_gamma[] = "Gamma/brightness adjustment (default 1.00)";
|
||||
|
||||
static const char *mgn_aopt_gamma(int id, int *offs)
|
||||
{
|
||||
sprintf(static_buff, "%i.%02i", currentConfig.gamma / 100, currentConfig.gamma % 100);
|
||||
return static_buff;
|
||||
}
|
||||
|
||||
static menu_entry e_menu_gfx_options[] =
|
||||
{
|
||||
mee_enum ("Video output mode", MA_OPT_VOUT_MODE, plat_target.vout_method, men_dummy),
|
||||
mee_enum ("Renderer", MA_OPT_RENDERER, currentConfig.renderer, renderer_names),
|
||||
mee_enum ("Filter", MA_OPT3_FILTERING, currentConfig.filter, men_dummy),
|
||||
mee_range_h("Gamma adjustment", MA_OPT3_GAMMA, currentConfig.gamma, 1, 200, h_gamma),
|
||||
mee_range_cust_h("Gamma correction", MA_OPT2_GAMMA, currentConfig.gamma, 1, 300, mgn_aopt_gamma, h_gamma),
|
||||
MENU_OPTIONS_GFX
|
||||
mee_end,
|
||||
};
|
||||
|
@ -746,10 +761,7 @@ static menu_entry e_menu_options[] =
|
|||
static int menu_loop_options(int id, int keys)
|
||||
{
|
||||
static int sel = 0;
|
||||
int i;
|
||||
|
||||
i = me_id2offset(e_menu_options, MA_OPT_CPU_CLOCKS);
|
||||
e_menu_options[i].enabled = e_menu_options[i].name[0] ? 1 : 0;
|
||||
me_enable(e_menu_options, MA_OPT_SAVECFG_GAME, PicoGameLoaded);
|
||||
me_enable(e_menu_options, MA_OPT_LOADCFG, config_slot != config_slot_current);
|
||||
|
||||
|
@ -915,7 +927,7 @@ static void debug_menu_loop(void)
|
|||
// ------------ main menu ------------
|
||||
|
||||
static const char credits[] =
|
||||
"PicoDrive v" VERSION " (c) notaz, 2006-2011\n\n\n"
|
||||
"PicoDrive v" VERSION " (c) notaz, 2006-2013\n\n\n"
|
||||
"Credits:\n"
|
||||
"fDave: Cyclone 68000 core,\n"
|
||||
" base code of PicoDrive\n"
|
||||
|
@ -923,7 +935,6 @@ static const char credits[] =
|
|||
"MAME devs: YM2612 and SN76496 cores\n"
|
||||
"Inder, ketchupgun: graphics\n"
|
||||
#ifdef __GP2X__
|
||||
"rlyeh and others: minimal SDK\n"
|
||||
"Squidge: mmuhack\n"
|
||||
"Dzz: ARM940 sample\n"
|
||||
#endif
|
||||
|
@ -932,7 +943,57 @@ static const char credits[] =
|
|||
" Charles MacDonald, Haze,\n"
|
||||
" Stephane Dallongeville,\n"
|
||||
" Lordus, Exophase, Rokas,\n"
|
||||
" Nemesis, Tasco Deluxe";
|
||||
" Eke, Nemesis, Tasco Deluxe";
|
||||
|
||||
static void menu_main_draw_status(void)
|
||||
{
|
||||
static time_t last_bat_read = 0;
|
||||
static int last_bat_val = -1;
|
||||
unsigned short *bp = g_screen_ptr;
|
||||
int bat_h = me_mfont_h * 2 / 3;
|
||||
int i, u, w, wfill, batt_val;
|
||||
struct tm *tmp;
|
||||
time_t ltime;
|
||||
char time_s[16];
|
||||
|
||||
if (!(currentConfig.EmuOpt & EOPT_SHOW_RTC))
|
||||
return;
|
||||
|
||||
ltime = time(NULL);
|
||||
tmp = gmtime(<ime);
|
||||
strftime(time_s, sizeof(time_s), "%H:%M", tmp);
|
||||
|
||||
text_out16(g_screen_width - me_mfont_w * 6, me_mfont_h + 2, time_s);
|
||||
|
||||
if (ltime - last_bat_read > 10) {
|
||||
last_bat_read = ltime;
|
||||
last_bat_val = batt_val = plat_target_bat_capacity_get();
|
||||
}
|
||||
else
|
||||
batt_val = last_bat_val;
|
||||
|
||||
if (batt_val < 0 || batt_val > 100)
|
||||
return;
|
||||
|
||||
/* battery info */
|
||||
bp += (me_mfont_h * 2 + 2) * g_screen_width + g_screen_width - me_mfont_w * 3 - 3;
|
||||
for (i = 0; i < me_mfont_w * 2; i++)
|
||||
bp[i] = menu_text_color;
|
||||
for (i = 0; i < me_mfont_w * 2; i++)
|
||||
bp[i + g_screen_width * bat_h] = menu_text_color;
|
||||
for (i = 0; i <= bat_h; i++)
|
||||
bp[i * g_screen_width] =
|
||||
bp[i * g_screen_width + me_mfont_w * 2] = menu_text_color;
|
||||
for (i = 2; i < bat_h - 1; i++)
|
||||
bp[i * g_screen_width - 1] =
|
||||
bp[i * g_screen_width - 2] = menu_text_color;
|
||||
|
||||
w = me_mfont_w * 2 - 1;
|
||||
wfill = batt_val * w / 100;
|
||||
for (u = 1; u < bat_h; u++)
|
||||
for (i = 0; i < wfill; i++)
|
||||
bp[(w - i) + g_screen_width * u] = menu_text_color;
|
||||
}
|
||||
|
||||
static int main_menu_handler(int id, int keys)
|
||||
{
|
||||
|
@ -1022,7 +1083,7 @@ void menu_loop(void)
|
|||
|
||||
menu_enter(PicoGameLoaded);
|
||||
in_set_config_int(0, IN_CFG_BLOCKING, 1);
|
||||
me_loop_d(e_menu_main, &sel, NULL, menu_main_plat_draw);
|
||||
me_loop_d(e_menu_main, &sel, NULL, menu_main_draw_status);
|
||||
|
||||
if (PicoGameLoaded) {
|
||||
if (engineState == PGS_Menu)
|
||||
|
@ -1105,6 +1166,7 @@ void menu_update_msg(const char *msg)
|
|||
static menu_entry e_menu_hidden[] =
|
||||
{
|
||||
mee_onoff("Accurate sprites", MA_OPT_ACC_SPRITES, PicoOpt, 0x080),
|
||||
mee_onoff("autoload savestates", MA_OPT_AUTOLOAD_SAVE, g_autostateld_opt, 1),
|
||||
mee_end,
|
||||
};
|
||||
|
||||
|
@ -1156,6 +1218,12 @@ void menu_init(void)
|
|||
|
||||
menu_init_base();
|
||||
|
||||
i = 0;
|
||||
#if defined(_SVP_DRC) || defined(DRC_SH2)
|
||||
i = 1;
|
||||
#endif
|
||||
me_enable(e_menu_adv_options, MA_OPT2_SVP_DYNAREC, i);
|
||||
|
||||
i = me_id2offset(e_menu_gfx_options, MA_OPT_VOUT_MODE);
|
||||
e_menu_gfx_options[i].data = plat_target.vout_methods;
|
||||
me_enable(e_menu_gfx_options, MA_OPT_VOUT_MODE,
|
||||
|
@ -1166,6 +1234,13 @@ void menu_init(void)
|
|||
me_enable(e_menu_gfx_options, MA_OPT3_FILTERING,
|
||||
plat_target.hwfilters != NULL);
|
||||
|
||||
me_enable(e_menu_gfx_options, MA_OPT3_GAMMA,
|
||||
me_enable(e_menu_gfx_options, MA_OPT2_GAMMA,
|
||||
plat_target.gamma_set != NULL);
|
||||
|
||||
i = me_id2offset(e_menu_options, MA_OPT_CPU_CLOCKS);
|
||||
e_menu_options[i].enabled = 0;
|
||||
if (plat_target.cpu_clock_set != NULL) {
|
||||
e_menu_options[i].name = "CPU clock";
|
||||
e_menu_options[i].enabled = 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,8 @@ typedef enum
|
|||
MA_OPT_ENABLE_SOUND,
|
||||
MA_OPT_SOUND_QUALITY,
|
||||
MA_OPT_ARM940_SOUND,
|
||||
MA_OPT_6BUTTON_PAD,
|
||||
MA_OPT_INPUT_DEV0,
|
||||
MA_OPT_INPUT_DEV1,
|
||||
MA_OPT_REGION,
|
||||
MA_OPT_SRAM_STATES,
|
||||
MA_OPT_CONFIRM_STATES,
|
||||
|
@ -40,6 +41,7 @@ typedef enum
|
|||
MA_OPT_ROTATION, /* uiq */
|
||||
MA_OPT_TEARING_FIX, /* wiz */
|
||||
MA_OPT_VOUT_MODE,
|
||||
MA_OPT_AUTOLOAD_SAVE,
|
||||
MA_OPT2_GAMMA,
|
||||
MA_OPT2_A_SN_GAMMA,
|
||||
MA_OPT2_DBLBUFF, /* giz */
|
||||
|
@ -50,7 +52,6 @@ typedef enum
|
|||
MA_OPT2_GZIP_STATES,
|
||||
MA_OPT2_NO_LAST_ROM,
|
||||
MA_OPT2_RAMTIMINGS, /* gp2x */
|
||||
MA_OPT2_SQUIDGEHACK, /* gp2x */
|
||||
MA_OPT2_STATUS_LINE, /* psp */
|
||||
MA_OPT2_NO_FRAME_LIMIT, /* psp */
|
||||
MA_OPT2_SVP_DYNAREC,
|
||||
|
@ -65,7 +66,6 @@ typedef enum
|
|||
MA_OPT3_PRES_FULLSCR,
|
||||
MA_OPT3_FILTERING,
|
||||
MA_OPT3_VSYNC,
|
||||
MA_OPT3_GAMMA,
|
||||
MA_OPT3_BLACKLVL,
|
||||
MA_OPT3_LAYER_X,
|
||||
MA_OPT3_LAYER_Y,
|
||||
|
|
|
@ -104,7 +104,7 @@ out:
|
|||
return retval;
|
||||
}
|
||||
|
||||
void mp3_start_play(void *f_, int pos)
|
||||
void mp3_start_play(void *f_, int pos1024)
|
||||
{
|
||||
unsigned char buf[2048];
|
||||
FILE *f = f_;
|
||||
|
@ -118,13 +118,6 @@ void mp3_start_play(void *f_, int pos)
|
|||
if (!(PicoOpt & POPT_EN_MCD_CDDA) || f == NULL) // cdda disabled or no file?
|
||||
return;
|
||||
|
||||
ret = mp3dec_start();
|
||||
if (ret != 0)
|
||||
return;
|
||||
|
||||
decoder_active = 1;
|
||||
|
||||
mp3_current_file = f;
|
||||
fseek(f, 0, SEEK_END);
|
||||
mp3_file_len = ftell(f);
|
||||
|
||||
|
@ -145,12 +138,20 @@ void mp3_start_play(void *f_, int pos)
|
|||
}
|
||||
|
||||
// seek..
|
||||
if (pos) {
|
||||
if (pos1024 != 0) {
|
||||
unsigned long long pos64 = mp3_file_len - mp3_file_pos;
|
||||
pos64 *= pos;
|
||||
pos64 *= pos1024;
|
||||
mp3_file_pos += pos64 >> 10;
|
||||
}
|
||||
|
||||
ret = mp3dec_start(f, mp3_file_pos);
|
||||
if (ret != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
mp3_current_file = f;
|
||||
decoder_active = 1;
|
||||
|
||||
mp3dec_decode(mp3_current_file, &mp3_file_pos, mp3_file_len);
|
||||
}
|
||||
|
||||
|
@ -183,8 +184,9 @@ void mp3_update(int *buffer, int length, int stereo)
|
|||
} else {
|
||||
int ret, left = 1152 - cdda_out_pos;
|
||||
|
||||
mix_samples(buffer, cdda_out_buffer + cdda_out_pos * 2,
|
||||
(left >> shr) * 2);
|
||||
if (left > 0)
|
||||
mix_samples(buffer, cdda_out_buffer + cdda_out_pos * 2,
|
||||
(left >> shr) * 2);
|
||||
|
||||
ret = mp3dec_decode(mp3_current_file, &mp3_file_pos,
|
||||
mp3_file_len);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
int mp3_find_sync_word(const unsigned char *buf, int size);
|
||||
|
||||
/* decoder */
|
||||
int mp3dec_start(void);
|
||||
int mp3dec_start(FILE *f, int fpos_start);
|
||||
int mp3dec_decode(FILE *f, int *file_pos, int file_len);
|
||||
|
||||
extern unsigned short mpeg1_l3_bitrates[16];
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include <stdio.h>
|
||||
#include "mp3.h"
|
||||
|
||||
int mp3dec_start(void)
|
||||
int mp3dec_start(FILE *f, int fpos_start)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ int mp3dec_decode(FILE *f, int *file_pos, int file_len)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int mp3dec_start(void)
|
||||
int mp3dec_start(FILE *f, int fpos_start)
|
||||
{
|
||||
// must re-init decoder for new track
|
||||
if (mp3dec)
|
||||
|
|
|
@ -91,7 +91,7 @@ int mp3dec_decode(FILE *f, int *file_pos, int file_len)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int mp3dec_start(void)
|
||||
int mp3dec_start(FILE *f, int fpos_start)
|
||||
{
|
||||
void (*avcodec_register_all)(void);
|
||||
AVCodec *(*avcodec_find_decoder)(enum CodecID id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue