static void initSDL(void) { //SDL initialisation if (SDL_Init(SDL_INIT_JOYSTICK) < 0 ) { printf("Could not initialize SDL(%s)\n", SDL_GetError()); fe_exit(); } atexit(SDL_Quit); keyssnes = SDL_GetKeyState(NULL); SDL_SetVideoMode(0, 0, 16, SDL_SWSURFACE); SDL_EventState(SDL_ACTIVEEVENT,SDL_IGNORE); SDL_EventState(SDL_SYSWMEVENT,SDL_IGNORE); SDL_EventState(SDL_VIDEORESIZE,SDL_IGNORE); SDL_EventState(SDL_USEREVENT,SDL_IGNORE); SDL_ShowCursor(SDL_DISABLE); joy[0] = SDL_JoystickOpen(0); if(joy[0]) { if(SDL_JoystickEventState(SDL_ENABLE) != SDL_ENABLE) { printf("Could not set joystick event state: %s\n", SDL_GetError()); fe_exit(); } } }
static uint32 fe_ReadJoypad (int which1) { uint32 val=0x80000000; if (keyssnes[sfc_key[A_1]] == SDL_PRESSED || joy_buttons[sfc_joy[A_1]]) val |= SNES_A_MASK; if (keyssnes[sfc_key[B_1]] == SDL_PRESSED || joy_buttons[sfc_joy[B_1]]) val |= SNES_B_MASK; if (keyssnes[sfc_key[START_1]] == SDL_PRESSED || joy_buttons[sfc_joy[START_1]]) val |= SNES_START_MASK; if (keyssnes[sfc_key[SELECT_1]] == SDL_PRESSED || joy_buttons[sfc_joy[SELECT_1]]) val |= SNES_SELECT_MASK; if (keyssnes[sfc_key[UP_1]] == SDL_PRESSED || joy_axes[0][JOYUD] == UP) val |= SNES_UP_MASK; if (keyssnes[sfc_key[DOWN_1]] == SDL_PRESSED || joy_axes[0][JOYUD] == DOWN) val |= SNES_DOWN_MASK; if (keyssnes[sfc_key[LEFT_1]] == SDL_PRESSED || joy_axes[0][JOYLR] == LEFT) val |= SNES_LEFT_MASK; if (keyssnes[sfc_key[RIGHT_1]] == SDL_PRESSED || joy_axes[0][JOYLR] == RIGHT) val |= SNES_RIGHT_MASK; if (keyssnes[sfc_key[QUIT]] == SDL_PRESSED || joy_buttons[sfc_joy[QUIT]]) fe_exit(); if (val&SNES_SELECT_MASK && val&SNES_START_MASK) fe_exit(); return(val); }
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); } }
void xchat_exit (void) { xchat_is_quitting = TRUE; in_xchat_exit = TRUE; plugin_kill_all (); fe_cleanup (); if (prefs.autosave) { save_config (); pevent_save (NULL); } if (prefs.autosave_url) url_autosave (); notify_save (); ignore_save (); free_sessions (); fe_exit (); }
void hexchat_exit (void) { hexchat_is_quitting = TRUE; in_hexchat_exit = TRUE; plugin_kill_all (); fe_cleanup (); save_config (); if (prefs.save_pevents) { pevent_save (NULL); } sound_save (); notify_save (); ignore_save (); free_sessions (); chanopt_save_all (); servlist_cleanup (); fe_exit (); }
void xchat_exit (void) { xchat_is_quitting = TRUE; in_xchat_exit = TRUE; #if 0 plugin_shutdown(); #endif fe_cleanup (); if (prefs.autosave) { save_config (); if (prefs.save_pevents) pevent_save (NULL); } if (prefs.autosave_url) url_autosave (); notify_save (); ignore_save (); free_sessions (); fe_exit (); }