int main (int argc, char **argv) { FILE *f; /* GP2X Initialization */ gp2x_init(1000,8,22050,16,0,60); /* Show intro screen */ gp2x_intro_screen(); /* Initialize list of available games */ game_list_init(argc); if (game_num_avail==0) { gp2x_gamelist_text_out(35, 110, "ERROR: NO AVAILABLE GAMES FOUND"); gp2x_video_flip(); gp2x_joystick_press(0); 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); } /* 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(); } /* 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); }
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 */ }