void de_init(void) { extern Uint32 average_loop_time; cleanup_video(); cleanup_music(); cleanup_audio(); uninit_plugins(); gui_quit(); /* close the main eaf archive file */ if (eaf_close_file(epiar_eaf) != 0) { printf("Couldn't close epiar.eaf file.\n"); } else { epiar_eaf = NULL; } if (eaf_close_file(main_eaf) != 0) { printf("Couldn't close main.eaf file.\n"); } else { main_eaf = NULL; } assert(game_path != NULL); free(game_path); game_path = NULL; if (average_loop_time == 0) average_loop_time = 18; /* in case they quit on menu */ #ifndef NDEBUG fprintf(stdout, "Average fps: %f\n", average_session_fps); #endif }
int main(int argc, const char * argv[]) { int list = 0; int i; const char * port = "4575"; const char * device = NULL; for (i=1; i<=argc; i++) { if (!argv[i]) continue; if ((strcmp(argv[i],"-h")==0)||(strcmp(argv[i],"--help")==0)||(strcmp(argv[i],"-?")==0)) usage(); if (strncmp(argv[i],"-p=",3)==0) { port = argv[i]+3; continue; } if (strncmp(argv[i],"--port=",7)==0) { port = argv[i]+7; continue; } if (strcmp(argv[i],"-v")==0) { verbose = 1; continue; } if (strcmp(argv[i],"-l")==0) { list = 1; continue; } if (strcmp(argv[i],"--list")==0) { list = 1; continue; } if (strncmp(argv[i],"--dev=",6)==0) { device = argv[i]+6; continue; } printf("Unknown option: %s\n",argv[i]); usage(); } if (init_audio()!=0) return 1; if ((dev=device_for_string(device))==-1) { fprintf(stderr,"Unknown device \"%s\"\n",device?device:""); cleanup_audio(); return 1; } else { fprintf(stderr,"Using device \"%s\"\n",Pa_GetDeviceInfo(dev)->name); } if (list) { list_devices(); cleanup_audio(); return 0; } if (start_listening(port)!=0) { cleanup_audio(); return 1; } cleanup_audio(); return 0; }