int main (int argc, char **argv) { FILE *f; rompath = getenv("ROMPATH"); if( rompath && !*rompath ) rompath = NULL; samplepath = getenv("SAMPLEPATH"); if( samplepath && !*samplepath ) samplepath = NULL; printf("ROMS: %s\n", rompath?rompath:"<default>"); printf("Samples: %s\n", samplepath?samplepath:"<default>"); /* Nearest neighbour filter for front end */ pnd_fir_filter_set( PND_FIR_FILTER_NONE ); /* Initialization */ pnd_init(1000,8,22050,16,0,60); /* Show intro screen */ pnd_intro_screen(); /* Initialize list of available games */ game_list_init(argc); if (game_num_avail==0) { pnd_gamelist_text_out(35, 110, "ERROR: NO AVAILABLE GAMES FOUND"); pnd_video_flip(); pnd_joystick_press(0); pnd_exit(); } /* Read default configuration */ f=fopen("frontend/mame.cfg","r"); if (f) { fscanf(f,"%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",&pnd_freq,&pnd_video_depth,&pnd_video_aspect,&pnd_video_sync, &pnd_frameskip,&pnd_sound,&pnd_clock_cpu,&pnd_clock_sound,&pnd_cpu_cores,&pnd_ramtweaks,&last_game_selected, &pnd_cheat,&pnd_volume,&pnd_video_rotate,&pnd_video_filter); fclose(f); } /* Select Game */ select_game(playemu,playgame); /* Write default configuration */ f=fopen("frontend/mame.cfg","w"); if (f) { fprintf(f,"%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",pnd_freq,pnd_video_depth,pnd_video_aspect,pnd_video_sync, pnd_frameskip,pnd_sound,pnd_clock_cpu,pnd_clock_sound,pnd_cpu_cores,pnd_ramtweaks,last_game_selected, pnd_cheat,pnd_volume,pnd_video_rotate,pnd_video_filter); fclose(f); sync(); } /* Execute Game */ execute_game (playemu,playgame); exit (0); }
int main (int argc, char **argv) { FILE *f; /* WIZ Initialization */ wiz_init(8,22050,16,0); /* Show intro screen */ wiz_intro_screen(); /* Initialize list of available games */ game_list_init(argc); if (game_num_avail==0) { wiz_gamelist_text_out(35, 110, "ERROR: NO AVAILABLE GAMES FOUND"); wiz_video_flip(); wiz_joystick_press(0); wiz_exit(); } /* Read default configuration */ f=fopen("frontend/mame.cfg","r"); if (f) { fscanf(f,"%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",&wiz_freq,&wiz_video_depth,&wiz_video_aspect,&wiz_video_sync, &wiz_frameskip,&wiz_sound,&wiz_clock_cpu,&wiz_clock_sound,&wiz_cpu_cores,&wiz_ramtweaks,&last_game_selected,&wiz_cheat); fclose(f); } /* Select Game */ select_game(playemu,playgame); /* Write default configuration */ f=fopen("frontend/mame.cfg","w"); if (f) { fprintf(f,"%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",wiz_freq,wiz_video_depth,wiz_video_aspect,wiz_video_sync, wiz_frameskip,wiz_sound,wiz_clock_cpu,wiz_clock_sound,wiz_cpu_cores,wiz_ramtweaks,last_game_selected,wiz_cheat); fclose(f); sync(); } /* Execute Game */ execute_game (playemu,playgame); exit (0); }
void frontend_gui (char *gamename, int first_run) { FILE *f; /* GP2X Initialization */ gp2x_frontend_init(); gp2xmenu_bmp = (unsigned short*)calloc(1, 1000000); gp2xsplash_bmp = (unsigned short*)calloc(1, 1000000); /* Show load bitmaps and show intro screen */ gp2x_intro_screen(first_run); /* Initialize list of available games */ game_list_init(1); if (game_num_avail==0) { /* Draw background image */ load_bmp_16bpp(gp2x_screen15,gp2xmenu_bmp); gp2x_gamelist_text_out(35, 110, "ERROR: NO AVAILABLE GAMES FOUND",gp2x_color15(255,255,255)); FE_DisplayScreen(); sleep(5); gp2x_exit(); } /* Read default configuration */ f=fopen("frontend/mame.cfg","r"); if (f) { fscanf(f,"%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",&gp2x_freq,&gp2x_video_depth,&gp2x_video_aspect,&gp2x_video_sync, &gp2x_frameskip,&gp2x_sound,&gp2x_clock_cpu,&gp2x_clock_sound,&gp2x_cpu_cores,&gp2x_ramtweaks,&last_game_selected,&gp2x_cheat,&gp2x_volume); fclose(f); } //Read joystick configuration memset(pi_key, 0, NUMKEYS*2); memset(pi_joy, 0, NUMKEYS*2); open_config_file(); pi_key[START_1] = get_int("frontend", "K_START", NULL, KEY_ENTER); pi_key[SELECT_1] = get_int("frontend", "K_SELECT", NULL, KEY_5); pi_key[LEFT_1] = get_int("frontend", "K_LEFT", NULL, KEY_LEFT); pi_key[RIGHT_1] = get_int("frontend", "K_RIGHT", NULL, KEY_RIGHT); pi_key[UP_1] = get_int("frontend", "K_UP", NULL, KEY_UP); pi_key[DOWN_1] = get_int("frontend", "K_DOWN", NULL, KEY_DOWN); pi_key[A_1] = get_int("frontend", "K_A", NULL, KEY_LCONTROL); pi_key[QUIT] = get_int("frontend", "K_QUIT", NULL, KEY_ESC); pi_joy[START_1] = get_int("frontend", "J_START", NULL, 9); pi_joy[SELECT_1] = get_int("frontend", "J_SELECT", NULL, 8); pi_joy[A_1] = get_int("frontend", "J_A", NULL, 3); //Read joystick axis to use, default to 0 & 1 joyaxis_LR = get_int("frontend", "AXIS_LR", NULL, 0); joyaxis_UD = get_int("frontend", "AXIS_UD", NULL, 1); close_config_file(); /* Select Game */ select_game(playemu,playgame); /* Write default configuration */ f=fopen("frontend/mame.cfg","w"); if (f) { fprintf(f,"%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",gp2x_freq,gp2x_video_depth,gp2x_video_aspect,gp2x_video_sync, gp2x_frameskip,gp2x_sound,gp2x_clock_cpu,gp2x_clock_sound,gp2x_cpu_cores,gp2x_ramtweaks,last_game_selected,gp2x_cheat,gp2x_volume); fclose(f); sync(); } strcpy(gamename, playgame); gp2x_frontend_deinit(); free(gp2xmenu_bmp); free(gp2xsplash_bmp); }
extern "C" int android_main (int argc, char **argv) { FILE *f; __android_log_print(ANDROID_LOG_DEBUG, "libMAME4all.so", "init iOS frontend"); //printf("init iOS frontend\n"); /* mkdir(get_documents_path("iOS"), 0755); mkdir(get_documents_path("cfg"), 0755); mkdir(get_documents_path("hi"), 0755); */ __android_log_print(ANDROID_LOG_DEBUG, "libMAME4all.so", "creados directorios"); /* GP2X Initialization */ gp2x_init(1000,8,22050,16,0,60); //hack: por defecto lentos van a 11000 m4all_sound = 4; m4all_video_depth = 16; if(m4all_HiSpecs) { m4all_clock_cpu= 100; m4all_clock_sound= 100; m4all_buttons=2; m4all_sound=12; } /* Show intro screen */ gp2x_intro_screen(); /* Initialize list of available games */ game_list_init(argc); /* if (game_num_avail==0) { while(true){ gp2x_gamelist_text_out(35, 110, "ERROR: NO AVAILABLE GAMES FOUND"); gp2x_video_flip(); gp2x_joystick_press(0); //gp2x_exit(); sleep(1);} exit(0); } */ while(true) { /* Read default configuration */ f=fopen(get_documents_path("frontend/mame_v2.cfg"),"r"); if (f) { fscanf(f,"%d",&last_game_selected); fclose(f); } /* Select Game */ select_game(playemu,playgame); /* Write default configuration */ f=fopen(get_documents_path("frontend/mame_v2.cfg"),"w"); if (f) { fprintf(f,"%d",last_game_selected); fclose(f); sync(); } /* Execute Game */ execute_game (playemu,playgame); } exit (0); }
static void game_list_init(int argc) { game_list_init(); }
static void select_game(char *emu, char *game) { unsigned long ExKey=0; int keydelay=0; /* No Selected game */ strcpy(game,"builtinn"); /* Clean screen */ gp2x_video_flip(); if(!safe_render_path) while(ExKey=gp2x_joystick_read(0)&0x8c0ff55){usleep(1000);}; /* Wait until user selects a game */ while(1) { if(local_manufacturer != global_manufacturer || local_clones != global_clones || local_filter != global_filter || local_category != global_category || local_year != global_year || local_game_list_num != game_list_num) { game_list_init(); last_game_selected=0; local_manufacturer = global_manufacturer; local_clones = global_clones; local_filter = global_filter; local_category = global_category; local_year = global_year; } game_list_view(&last_game_selected); gp2x_video_flip(); if(keydelay) { usleep(400000); keydelay=0; } if(safe_render_path) { if( (gp2x_joystick_read(0)&0x8c0ff55)) { usleep(100000); } while(!(ExKey=gp2x_joystick_read(0)&0x8c0ff55) && local_manufacturer == global_manufacturer && local_clones == global_clones && local_filter == global_filter && local_category == global_category && local_year == global_year && local_game_list_num == game_list_num) { keydelay=1; usleep(1000); } } else { usleep(100000); ExKey=gp2x_joystick_read(0); } if (ExKey & GP2X_UP) last_game_selected--; else if (ExKey & GP2X_DOWN) last_game_selected++; else if ((ExKey & GP2X_L) || ExKey & GP2X_LEFT) last_game_selected-=21; else if ((ExKey & GP2X_R) || ExKey & GP2X_RIGHT) last_game_selected+=21; //if ((ExKey & GP2X_L) && (ExKey & GP2X_R)) gp2x_exit(); //Set or clear favorite setting for this game if (ExKey & GP2X_SELECT) { //Check if the game is already a favorite game_list_select(last_game_selected, game, emu); int foundfav=0; int counter=0; while(true) { if (favarray[counter][0] == '\0') break; //Null is the array terminator if (strcasecmp(favarray[counter], game) == 0) { foundfav=1; break; } counter++; } if(foundfav) { favorites_remove(game); } else { favorites_add(game); } } if (((ExKey & GP2X_A) || (ExKey & GP2X_B) || (ExKey & GP2X_PUSH) || (ExKey & GP2X_START)) && game_num_avail!=0) { /* Select the game */ game_list_select(last_game_selected, game, emu); /* Emulation Options */ //defaults! iOS_video_aspect=0; iOS_video_rotate=0; iOS_video_sync=0; iOS_frameskip=-1; iOS_cheat=0; iOS_waysStick = 8; if(!safe_render_path) { iOS_sound = global_sound; iOS_video_depth=8; } else { iOS_sound = global_sound; iOS_video_depth=16; } if(isIpad) { iOS_clock_cpu= 100; iOS_clock_sound= 100; iOS_buttons=2; iOS_sound=global_sound; } else { iOS_clock_cpu= 80; iOS_clock_sound= 80; iOS_buttons=2; } if(show_options(game)) { break; } } } }
extern "C" int mimain (int argc, char **argv) { FILE *f; printf("init iOS frontend\n"); /* GP2X Initialization */ gp2x_init(1000,8,22050,16,0,60); //hack: por defecto lentos van a 11000 if(!safe_render_path) { iOS_sound = global_sound; iOS_video_depth = 8; } else { iOS_sound = global_sound; iOS_video_depth = 16; } if(isIpad) { iOS_clock_cpu= 100; iOS_clock_sound= 100; iOS_buttons=2; iOS_sound=global_sound; } /* Show intro screen */ gp2x_intro_screen(); local_manufacturer = global_manufacturer; local_clones = global_clones; local_filter = global_filter; local_category = global_category; local_year = global_year; /* Initialize list of available games */ game_list_init(argc); /* if (game_num_avail==0) { while(true){ gp2x_gamelist_text_out(35, 110, "ERROR: NO AVAILABLE GAMES FOUND"); gp2x_video_flip(); gp2x_joystick_press(0); //gp2x_exit(); sleep(1);} exit(0); } */ while(true) { /* Read default configuration */ f=fopen(get_documents_path("iOS/mame_v2.cfg"),"r"); if (f) { fscanf(f,"%d",&last_game_selected); fclose(f); } /* Select Game */ select_game(playemu,playgame); /* Write default configuration */ f=fopen(get_documents_path("iOS/mame_v2.cfg"),"w"); if (f) { fprintf(f,"%d",last_game_selected); fclose(f); sync(); } /* Execute Game */ execute_game (playemu,playgame); } exit (0); }
int main(int argc,char **argv) { #ifdef PSP pspDebugScreenInit(); #ifdef PSP_USERMODE SetupCallbacks(); #endif #ifdef WIFI net_io_init(); #endif #endif char text[64]; int res, i, game_index; /* GP2X Video Init */ gp2x_video_init(); #ifdef GP2X { /* Border TV-Out */ #define BORDERTVOUTSTRUCTURE "--border_tvout %d --border_tvout_width %d --border_tvout_height %d" extern char gp2x_path_mame[24]; extern int gp2x_bordertvout; extern int gp2x_bordertvout_width; extern int gp2x_bordertvout_height; char name[256]; FILE *f; sprintf(name,"%scfg/mame_tvout.cfg",gp2x_path_mame); f=fopen(name,"rb"); if (f) { fscanf(f,BORDERTVOUTSTRUCTURE,&gp2x_bordertvout,&gp2x_bordertvout_width,&gp2x_bordertvout_height); fclose(f); if (gp2x_bordertvout) { printf("Border TV-Out Activated\r\n"); } else { printf("Border TV-Out Disabled\r\n"); } } } #endif /* Set Video Mode */ #ifdef PSP_RES SetVideoScaling(480,480,272); #else SetVideoScaling(320,320,240); #endif #ifdef GP2X /* Zaq121 07/05/2006 Alternative frontend support -> */ /* Check for command line arguments */ parse_cmdline (argc, argv, &options, game_index); if (no_selector==0) /* <- end mod */ #endif /* Intro screen */ gp2x_intro_screen(); /* Initialize Game Listings */ game_list_init(); while(1) { #ifdef GP2X /* Disable Scaling / Stretching */ { extern int gp2x_text_width; gp2x_text_width=320; } SetVideoScaling(320,320,240); gp2x_rotate=0; /* Mute Sound */ gp2x_sound_thread_mute(); #endif #ifdef GP2X /* Zaq121 07/05/2006 Alternative frontend support -> */ if (no_selector==0) /* <- end mod */ #endif /* Select Game */ select_game(playgame); #ifdef GP2X /* Zaq121 07/05/2006 Alternative frontend support -> */ else { extern int gp2x_freq; /* 9/5/06 Zaq, clock speed was never getting set */ int show_options(char *game); int set_last_game_selected(char *game); if(set_last_game_selected(playgame) == -1) break; /* game not available */ if(!show_options(playgame)) break; /* return back to external menu */ SetGP2XClock(gp2x_freq); /* 9/5/06 Zaq, clock speed was never getting set */ } /* <- end mod */ #endif /* Initialize the audio library */ msdos_init_seal(); /* Restore MAME Palette */ gp2x_mame_palette(); /* Set Log Messages start at row 0 */ gp2x_gamelist_zero(); /* Single Video Buffer for Log Messages */ gp2x_clear_screen(); game_index = -1; /* do we have a driver for this? */ for (i = 0; drivers[i] && (game_index == -1); i++) { if (strcasecmp(playgame,drivers[i]->name) == 0) { game_index = i; break; } } if (game_index == -1) { sprintf(text,"Game \"%s\" not supported\0",playgame); gp2x_text_log(text); while(1); /* MAME never ends xD */ } /* parse generic (os-independent) options */ parse_cmdline (argc, argv, &options, game_index); { /* Mish: I need sample rate initialised _before_ rom loading for optional rom regions */ extern int soundcard; if (soundcard == 0) { /* silence, this would be -1 if unknown in which case all roms are loaded */ Machine->sample_rate = 0; /* update the Machine structure to show that sound is disabled */ options.samplerate=0; } } sprintf(text,"Loading \"%s\"...",drivers[game_index]->description); gp2x_text_log(text); /* go for it */ filecache_init(); res = run_game (game_index , &options); #if !defined(GP2X) && defined(USE_FILECACHE) if ( res != 0) { gp2x_text_log("Retrying without filecache..."); filecache_disable(); res = run_game (game_index , &options); } #endif /* Error? */ if( res != 0 ) { #ifdef PSP gp2x_text_log("LOAD FAILED: Press [] button..."); #else gp2x_text_log("LOAD FAILED: Press A button..."); #endif while (!(gp2x_joystick_read()&GP2X_A)); while ((gp2x_joystick_read()&GP2X_A)); } #ifdef GP2X /* Zaq121 07/05/2006 Alternative frontend support -> */ if(no_selector) break; /* <- end mod */ #endif } /* MAME never ends xD */ }