void main() { init_graph(); cleardevice(); game_pack_intro(); do { init_graph(); choice = 1; select_game(); switch(choice) { case 1 : game_snake(); break; case 2 : game_snake_war(); break; case 3 : game_tetris(); break; case 4 : game_tank_shot(); break; default: break; } delay(2000); }while(choice != 0); game_pack_outro(); getch(); closegraph(); }
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) { char options[1000]; int i; char gamename[255]; //create options string for later passing to runtime options[0] = '\0'; if(argc > 1) { for(i=1;i<argc;i++) { strcat(options, argv[i]); strcat(options, " "); } } frontend_init(); /* Initialize list of available games */ game_list_init_nocache(); while(1) { fe_S9xInitInputDevices(); //Initialise SDL input after each game run initSDL(); if (game_num_avail==0) { /* Draw background image */ draw_background(); fe_gamelist_text_out(35, 110, "ERROR: NO AVAILABLE GAMES FOUND",color16(255,255,255)); frontend_display(); sleep(5); fe_exit(); } /* Select Game */ select_game(playgame); //Quit SDL input before starting Game SDL_Quit(); //Run the actual game //Using system seems to work better with snes9x sprintf(gamename, "./snes9x %s \"roms/%s\"", options, playgame); system(gamename); usleep(500000); } }
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); }
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[]) { WINDOW *my_win, *score; WINDOW **car; game newGame, tmpGame; MEVENT event; int ch = 0, choosenCar = -1, soluce_move = 0; char message[1024]; bool quit = false; bool show_solution = false; gameStruct *resultSolv = NULL; //INIT setup(); //END INIT //Wait for good size wait_for_size(MINH, MINW); //Instruction show_instruction(MINH, MINW); while (!quit) { quit = false; show_solution = false; soluce_move = 0; strcpy(message, "Playing"); //Select game newGame = select_game(); //Check for level file if (handle_level(&tmpGame)) { delete_game(newGame); newGame = tmpGame; MAXCOL = game_width(newGame); MAXROW = game_height(newGame); MINH = MAXROW * SIZE + 2; MINW = MAXCOL * SIZE; } car = malloc(sizeof (WINDOW*) * game_nb_pieces(newGame)); //First draw draw_game(newGame, 0, 0, MAXROW, MAXCOL, &my_win, car, &score, choosenCar, message, gameOverRh); //Loop while the game is not finished while (!game_over(newGame)) { //Print on bottom of grid mvprintw(MAXROW * SIZE + 1, 0, "Please choose car :"); ch = getch(); if (ch == 's' && !show_solution) { show_solution = true; strcpy(message, "Solution"); resultSolv = solv(newGame, gameOverRh,true); if(!resultSolv){ strcpy(message, "No solution"); show_solution=false; } } if (show_solution) { newGame = play_solution(newGame, resultSolv, soluce_move++); } else { if (KEY_MOUSE == ch) { /* Mouse event. */ if (OK == getmouse(&event)) { choosenCar = get_car_with_mouse(event.y, event.x, car, game_nb_pieces(newGame)); } } else { if (ch == 'q') { quit = true; break; } play_input(newGame, ch, &choosenCar); } } wait_for_size(MINH, MINW); erase_game(newGame, my_win, car, score); draw_game(newGame, 0, 0, MAXROW, MAXCOL, &my_win, car, &score, choosenCar, message, gameOverRh); } if (!quit) { display_score(newGame); } for (int i = 0; i < game_nb_pieces(newGame); i++) { destroy_win(car[i]); } destroy_win(my_win); destroy_win(score); free(car); delete_game(newGame); if (resultSolv != NULL) { delete_game(resultSolv->current); free(resultSolv->move); free(resultSolv); resultSolv = NULL; } } endwin(); /* End curses mode */ return 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 */ }