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); }
//main function that starts the program //program to execute the game of Connect-4, except the user can define the size of the board and how many pieces are needed to win int main(int argc, char** argv){ int num_rows = 0; //initialize variables that will be entered by the user int num_columns = 0; int plays_to_win = 0; int turn_count = 1; read_args(argc, argv, &num_rows, &num_columns, &plays_to_win); //pass the variables as pointers so that their values can be updated char** board = create_board(num_rows, num_columns); execute_game(board, num_rows, num_columns, plays_to_win, turn_count); destroy_board(board, num_rows); //when the game is over, the board can be destroyed return 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); }
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); }