mirror of
https://github.com/FunKey-Project/picodrive-irixxxx.git
synced 2026-03-30 16:52:52 +02:00
Merge branch 'FunKey' of fk:FunKey-Project/picodrive-irixxxx into FunKey
This commit is contained in:
@@ -210,7 +210,7 @@ static const char *find_bios(int *region, const char *cd_fname)
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
emu_make_path(static_buff, files[i], sizeof(static_buff) - 4);
|
||||
printf("static_buff: %s\n", static_buff);
|
||||
//printf("bios name static_buff: %s\n", static_buff);
|
||||
strcat(static_buff, ".bin");
|
||||
f = fopen(static_buff, "rb");
|
||||
if (f) break;
|
||||
@@ -1504,8 +1504,9 @@ void emu_cmn_forced_frame(int no_scale, int do_emu, void *buf)
|
||||
PicoIn.opt = po_old;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int emu_is_segaCD(){
|
||||
return (PicoIn.AHW & PAHW_MCD);
|
||||
}
|
||||
|
||||
/* Quick save and turn off the console */
|
||||
void quick_save_and_poweroff()
|
||||
@@ -1669,6 +1670,7 @@ static void emu_loop_prep(void)
|
||||
void emu_loop(void)
|
||||
{
|
||||
int frames_done, frames_shown; /* actual frames for fps counter */
|
||||
int frame_nb = 0;
|
||||
int target_frametime_x3;
|
||||
unsigned int timestamp_x3 = 0;
|
||||
unsigned int timestamp_aim_x3 = 0;
|
||||
@@ -1679,6 +1681,8 @@ void emu_loop(void)
|
||||
|
||||
fpsbuff[0] = 0;
|
||||
|
||||
printf("%s ------------------ \n", __func__);
|
||||
|
||||
PicoLoopPrepare();
|
||||
|
||||
plat_video_loop_prepare();
|
||||
@@ -1797,8 +1801,8 @@ void emu_loop(void)
|
||||
|
||||
/* Quick save and poweroff */
|
||||
if(mQuickSaveAndPoweroff){
|
||||
quick_save_and_poweroff();
|
||||
mQuickSaveAndPoweroff = 0;
|
||||
quick_save_and_poweroff();
|
||||
mQuickSaveAndPoweroff = 0;
|
||||
}
|
||||
|
||||
emu_update_input();
|
||||
@@ -1842,6 +1846,36 @@ void emu_loop(void)
|
||||
if (!skip && flip_after_sync)
|
||||
plat_video_flip();
|
||||
|
||||
|
||||
/* FOR SEGA CD */
|
||||
/* Leave some time for the bios to load before starting a quick load at boot */
|
||||
/* (Sega CD doesn't quick load at boot otherwise) */
|
||||
/* Should have a much cleaner implementation thant this fix */
|
||||
if((PicoIn.AHW & PAHW_MCD) && frame_nb >= 100){
|
||||
|
||||
/* Load slot */
|
||||
if(load_state_slot != -1){
|
||||
printf("LOADING FROM SLOT (SEGA CD) %d...\n", load_state_slot+1);
|
||||
char fname[1024];
|
||||
emu_save_load_game(1, 0);
|
||||
printf("LOADED FROM SLOT (SEGA CD) %d\n", load_state_slot+1);
|
||||
load_state_slot = -1;
|
||||
}
|
||||
if(need_quick_load != -1){
|
||||
load_state_file = quick_save_file;
|
||||
need_quick_load = -1;
|
||||
}
|
||||
/* Load file */
|
||||
if(load_state_file != NULL){
|
||||
printf("LOADING FROM FILE (SEGA CD) %s...\n", load_state_file);
|
||||
emu_save_load_game_from_file(1, load_state_file);
|
||||
printf("LOADED FROM SLOT (SEGA CD) %s\n", load_state_file);
|
||||
load_state_file = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
frame_nb++;
|
||||
|
||||
pprof_end(main);
|
||||
}
|
||||
|
||||
|
||||
@@ -90,6 +90,9 @@ extern int flip_after_sync;
|
||||
extern int show_fps_bypass;
|
||||
extern int need_screen_cleared;
|
||||
extern int mQuickSaveAndPoweroff;
|
||||
extern char *load_state_file;
|
||||
extern int load_state_slot;
|
||||
extern int need_quick_load;
|
||||
|
||||
extern char *prog_name;
|
||||
extern char *mRomName;
|
||||
@@ -150,6 +153,7 @@ void emu_update_input(void);
|
||||
void emu_get_game_name(char *str150);
|
||||
void emu_set_fastforward(int set_on);
|
||||
void emu_status_msg(const char *format, ...);
|
||||
int emu_is_segaCD();
|
||||
|
||||
/* default sound code */
|
||||
void emu_sound_start(void);
|
||||
|
||||
@@ -30,12 +30,13 @@
|
||||
|
||||
char **g_argv;
|
||||
char *prog_name;
|
||||
static char *load_state_file = NULL;
|
||||
static int load_state_slot = -1;
|
||||
char *load_state_file = NULL;
|
||||
int load_state_slot = -1;
|
||||
static char *quick_save_file_extension = "quicksave";
|
||||
char *mRomName = NULL;
|
||||
char *mRomPath = NULL;
|
||||
char *quick_save_file = NULL;
|
||||
int need_quick_load = -1;
|
||||
char *cfg_file_default = NULL;
|
||||
char *cfg_file_rom = NULL;
|
||||
static char *cfg_file_default_name = "default_config";
|
||||
@@ -204,29 +205,42 @@ int main(int argc, char *argv[])
|
||||
if (emu_reload_rom(rom_fname_reload)) {
|
||||
engineState = PGS_Running;
|
||||
|
||||
/* Load slot */
|
||||
/* Load slot (if NOT sega CD) */
|
||||
if(load_state_slot != -1){
|
||||
printf("LOADING FROM SLOT %d...\n", load_state_slot+1);
|
||||
char fname[1024];
|
||||
emu_save_load_game(1, 0);
|
||||
printf("LOADED FROM SLOT %d\n", load_state_slot+1);
|
||||
load_state_slot = -1;
|
||||
|
||||
/* DO NOT put this if in the previous one, we need this here not to enter the next else */
|
||||
if(!emu_is_segaCD()){
|
||||
printf("LOADING FROM SLOT %d...\n", load_state_slot+1);
|
||||
char fname[1024];
|
||||
emu_save_load_game(1, 0);
|
||||
printf("LOADED FROM SLOT %d\n", load_state_slot+1);
|
||||
load_state_slot = -1;
|
||||
}
|
||||
}
|
||||
/* Load file */
|
||||
/* Load file (if NOT sega CD) */
|
||||
else if(load_state_file != NULL){
|
||||
printf("LOADING FROM FILE %s...\n", load_state_file);
|
||||
emu_save_load_game_from_file(1, load_state_file);
|
||||
printf("LOADED FROM SLOT %s\n", load_state_file);
|
||||
load_state_file = NULL;
|
||||
|
||||
/* DO NOT put this if in the previous one, we need this here not to enter the next else */
|
||||
if(!emu_is_segaCD()){
|
||||
printf("LOADING FROM FILE %s...\n", load_state_file);
|
||||
emu_save_load_game_from_file(1, load_state_file);
|
||||
printf("LOADED FROM SLOT %s\n", load_state_file);
|
||||
load_state_file = NULL;
|
||||
}
|
||||
}
|
||||
/* Load quick save file */
|
||||
/* Load quick save file (if NOT sega CD) */
|
||||
else if(access( quick_save_file, F_OK ) != -1){
|
||||
printf("Found quick save file: %s\n", quick_save_file);
|
||||
|
||||
int resume = launch_resume_menu_loop();
|
||||
if(resume == RESUME_YES){
|
||||
printf("Resume game from quick save file: %s\n", quick_save_file);
|
||||
emu_save_load_game_from_file(1, quick_save_file);
|
||||
if(emu_is_segaCD()){
|
||||
need_quick_load = 1;
|
||||
}
|
||||
else{
|
||||
emu_save_load_game_from_file(1, quick_save_file);
|
||||
}
|
||||
}
|
||||
else{
|
||||
printf("Reset game\n");
|
||||
@@ -245,6 +259,13 @@ int main(int argc, char *argv[])
|
||||
|
||||
for (;;)
|
||||
{
|
||||
/** Debug */
|
||||
/*static int prev_engine_state = -1;
|
||||
if(prev_engine_state != engineState){
|
||||
printf("current engine state: %d, prev = %d\n", engineState, prev_engine_state);
|
||||
prev_engine_state = engineState;
|
||||
}*/
|
||||
|
||||
switch (engineState)
|
||||
{
|
||||
case PGS_Menu:
|
||||
|
||||
@@ -806,8 +806,8 @@ void run_menu_loop()
|
||||
if (fp == NULL) {
|
||||
MENU_ERROR_PRINTF("Failed to run command %s\n", shell_cmd);
|
||||
} else {
|
||||
pclose(fp);
|
||||
}
|
||||
pclose(fp);
|
||||
}
|
||||
|
||||
/// ------ Refresh screen ------
|
||||
screen_refresh = 1;
|
||||
@@ -824,7 +824,7 @@ void run_menu_loop()
|
||||
if (fp == NULL) {
|
||||
MENU_ERROR_PRINTF("Failed to run command %s\n", shell_cmd);
|
||||
} else {
|
||||
pclose(fp);
|
||||
pclose(fp);
|
||||
}
|
||||
/// ------ Refresh screen ------
|
||||
screen_refresh = 1;
|
||||
@@ -882,7 +882,7 @@ void run_menu_loop()
|
||||
if (fp == NULL) {
|
||||
MENU_ERROR_PRINTF("Failed to run command %s\n", shell_cmd);
|
||||
} else {
|
||||
pclose(fp);
|
||||
pclose(fp);
|
||||
}
|
||||
/// ------ Refresh screen ------
|
||||
screen_refresh = 1;
|
||||
@@ -899,7 +899,7 @@ void run_menu_loop()
|
||||
if (fp == NULL) {
|
||||
MENU_ERROR_PRINTF("Failed to run command %s\n", shell_cmd);
|
||||
} else {
|
||||
pclose(fp);
|
||||
pclose(fp);
|
||||
}
|
||||
/// ------ Refresh screen ------
|
||||
screen_refresh = 1;
|
||||
@@ -966,8 +966,8 @@ void run_menu_loop()
|
||||
fp = popen(shell_cmd, "r");
|
||||
if (fp == NULL) {
|
||||
MENU_ERROR_PRINTF("Failed to run command %s\n", shell_cmd);
|
||||
} else {
|
||||
pclose(fp);
|
||||
} else {
|
||||
pclose(fp);
|
||||
}
|
||||
|
||||
stop_menu_loop = 1;
|
||||
@@ -1013,8 +1013,8 @@ void run_menu_loop()
|
||||
fp = popen(shell_cmd, "r");
|
||||
if (fp == NULL) {
|
||||
MENU_ERROR_PRINTF("Failed to run command %s\n", shell_cmd);
|
||||
} else {
|
||||
pclose(fp);
|
||||
} else {
|
||||
pclose(fp);
|
||||
}
|
||||
|
||||
/*snprintf(hud_msg, sizeof(hud_msg), ret == 0 ? "LOADED" : "FAIL!");
|
||||
|
||||
Reference in New Issue
Block a user