int check_prefs_changed_gfx(void) { uint32_t w = (maxhpos - 46) * 4; // printf("check_prefs_changed_gfx ()\n"); gui_update_gfx (); if (!screen_is_picasso && (bm_height != NUMSCRLINES * 2 || bm_width != w)) { viewport_shutdown(); bm_format = glgfx_pixel_format_a4r4g4b4; bm_format = glgfx_pixel_format_a8b8g8r8; bm_width = w; bm_height = NUMSCRLINES*2; viewport_setup(); } notice_screen_contents_lost(); return 0; }
int check_prefs_changed_gfx (void) { if (changed_prefs.gfx_width_win != currprefs.gfx_width_win || changed_prefs.gfx_height_win != currprefs.gfx_height_win) fixup_prefs_dimensions (&changed_prefs); if (changed_prefs.gfx_width_win == currprefs.gfx_width_win && changed_prefs.gfx_height_win == currprefs.gfx_height_win && changed_prefs.gfx_lores == currprefs.gfx_lores && changed_prefs.gfx_linedbl == currprefs.gfx_linedbl && changed_prefs.gfx_correct_aspect == currprefs.gfx_correct_aspect && changed_prefs.gfx_xcenter == currprefs.gfx_xcenter && changed_prefs.gfx_ycenter == currprefs.gfx_ycenter && changed_prefs.gfx_afullscreen == currprefs.gfx_afullscreen && changed_prefs.gfx_pfullscreen == currprefs.gfx_pfullscreen) return 0; graphics_subshutdown (); currprefs.gfx_width_win = changed_prefs.gfx_width_win; currprefs.gfx_height_win = changed_prefs.gfx_height_win; currprefs.gfx_lores = changed_prefs.gfx_lores; currprefs.gfx_linedbl = changed_prefs.gfx_linedbl; currprefs.gfx_correct_aspect = changed_prefs.gfx_correct_aspect; currprefs.gfx_xcenter = changed_prefs.gfx_xcenter; currprefs.gfx_ycenter = changed_prefs.gfx_ycenter; currprefs.gfx_afullscreen = changed_prefs.gfx_afullscreen; currprefs.gfx_pfullscreen = changed_prefs.gfx_pfullscreen; graphics_subinit (); if (! inwindow) XWarpPointer (display, None, mywin, 0, 0, 0, 0, current_width / 2, current_height / 2); notice_screen_contents_lost (); init_row_map (); if (screen_is_picasso) picasso_enablescreen (1); return 0; }
void handle_events (void) { int button = mouse_getbutton (); gui_requested = 0; keyboard_update (); mouse_update (); lastmx += mouse_getx (); lastmy += mouse_gety (); mouse_setposition (0, 0); buttonstate[0] = button & 4; buttonstate[1] = button & 2; buttonstate[2] = button & 1; #ifdef PICASSO96 if (screen_is_picasso && !picasso_vidinfo.extra_mem) { int i; char *addr = gfxmemory + (picasso96_state.Address - gfxmem_start); for (i = 0; i < picasso_vidinfo.height; i++, addr += picasso96_state.BytesPerRow) { if (!picasso_invalid_lines[i]) continue; picasso_invalid_lines[i] = 0; vga_drawscanline (i, addr); } } #endif if (!screen_is_picasso && gui_requested) { leave_graphics_mode (); gui_changesettings (); enter_graphics_mode (vgamode); if (linear_mem != NULL && !need_dither) gfxvidinfo.bufmem = linear_mem; restore_vga_colors (); notice_screen_contents_lost (); } }
void flush_screen (void) #endif { uae4all_prof_start(13); #if defined(USE_RASTER_DRAW) && defined(DEBUG_GFX) dbgf("Function: flush_block %d %d\n", ystart, ystop); #endif #ifdef SCALING unsigned x,y,n,m; unsigned short *gfx_mem_p, *gfx_mem_line; unsigned short *surface_p, *surface_line; unsigned width_px = (prSDLScreen->pitch) / (prSDLScreen->format->BytesPerPixel); #endif #ifndef DINGOO #ifndef DREAMCAST if (SDL_MUSTLOCK(prSDLScreen)) SDL_UnlockSurface (prSDLScreen); #endif #ifdef SCALING #if !defined(DREAMCAST) && !defined(DINGOO) if (SDL_MUSTLOCK(prSDLScreen)) SDL_LockSurface(prSDLScreen); #endif surface_line = (uae_u16 *)prSDLScreen->pixels; gfx_mem_p = (uae_u16 *)gfx_mem; for(y = 0; y < current_height; y++) { gfx_mem_line = gfx_mem_p; for(n = 0; n < uae4all_scalefactor; n++) { gfx_mem_p = gfx_mem_line; surface_p = surface_line; surface_line += width_px; for(x = 0; x < current_width; x++) { for(m = 0; m < uae4all_scalefactor; m++) { *surface_p = *gfx_mem_p; surface_p++; } gfx_mem_p++; } } } #if !defined(DREAMCAST) && !defined(DINGOO) if (SDL_MUSTLOCK(prSDLScreen)) SDL_UnlockSurface(prSDLScreen); #endif #endif #ifndef DOUBLEBUFFER #ifdef USE_RASTER_DRAW SDL_UpdateRect(prSDLScreen, 0, ystart, current_width, ystop-ystart+1); #else #ifdef SCALING SDL_UpdateRect(prSDLScreen, 0, 0, uae4all_scalefactor*320, uae4all_scalefactor*240); #else SDL_UpdateRect(prSDLScreen, 0, 0, 320, 240); #endif #endif #endif #endif #ifdef USE_RASTER_DRAW if (drawfinished) { drawfinished=0; #endif if (show_message) { show_message--; if (!show_message) { notice_screen_contents_lost(); } else { _write_text_inv_n(prSDLScreen,0,29,30,show_message_str); } } if (emulated_mouse) vkbd_mouse(); if (vkbd_mode) vkbd_key=vkbd_process(); #if defined(DOUBLEBUFFER) || defined(DINGOO) SDL_Flip(prSDLScreen); #endif #ifdef USE_RASTER_DRAW } #endif #if !defined(DREAMCAST) && !defined(DINGOO) if (SDL_MUSTLOCK(prSDLScreen)) SDL_LockSurface (prSDLScreen); #endif uae4all_prof_end(13); }
//pnd_nubstate_t t; void gui_handle_events (void) { printf("gui_handle_events\n"); /*if(blubb<0) { test = pnd_evdev_open(pnd_evdev_nub1); printf("nub1 open: %d\n", test); test = pnd_evdev_open(pnd_evdev_nub2); printf("nub2 open: %d\n", test); t.x=1; t.y=1; printf("nubstate 1: x=%d y=%d\n", t.x, t.y); } blubb++; if(blubb>100 && blubb<0) { pnd_evdev_catchup(1); blubb=0; } test = pnd_evdev_nub_state(pnd_evdev_nub1, &t); printf("nubstate 1: x=%d y=%d, returnvalue=%d\n", t.x, t.y, test); pnd_evdev_nub_state(pnd_evdev_nub2, &t); printf("nubstate 2: x=%d y=%d\n", t.x, t.y); */ #if ! defined (DREAMCAST) && ! defined (GP2X) && ! defined (PSP) && ! defined (GIZMONDO) Uint8 *keystate = SDL_GetKeyState(NULL); if ( keystate[SDLK_F12] ) SDL_WM_ToggleFullScreen(prSDLScreen); else if ( keystate[SDLK_F11] ) #else #ifdef DREAMCAST if (SDL_JoystickGetButton(uae4all_joy0,3) ) #endif #ifdef GP2X if (SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_SELECT)) #endif #ifdef PSP if (SDL_JoystickGetButton(uae4all_joy0, PSP_BUTTON_SELECT)) #endif #ifdef GIZMONDO Uint8 *keystate = SDL_GetKeyState(NULL); if ( keystate[SDLK_F1] ) #endif #endif #ifdef GP2X { // hack: always use SDL_SWSURFACE in menus //switch_to_sw_sdl(); goMenu(); //switch_to_hw_sdl(0); } #else goMenu(); #endif #ifndef PANDORA #if defined (DREAMCAST) || defined (GP2X) || defined (PSP) || defined (GIZMONDO) #ifdef DREAMCAST if (SDL_JoystickGetAxis (uae4all_joy0, 2)) if (vkbd_mode) { vkbd_mode=0; notice_screen_contents_lost(); } if (SDL_JoystickGetAxis (uae4all_joy0, 3)) vkbd_mode=1; #else if (!gp2xMouseEmuOn && !gp2xButtonRemappingOn) { #ifdef GP2X if (SDL_JoystickGetButton (uae4all_joy0, GP2X_BUTTON_L)) #else #ifdef GIZMONDO if (SDL_JoystickGetButton (uae4all_joy0, GIZ_LTRIG)) #else if (SDL_JoystickGetButton (uae4all_joy0, PSP_BUTTON_L)) #endif #endif { /*if (vkbd_mode) { vkbd_mode = 0; goingVkbd=0; notice_screen_contents_lost(); } else*/ goingSuperThrottle=1; } else { if (!nowSuperThrottle) goingSuperThrottle=0; /*else goingVkbd=0;*/ } #ifdef GP2X if (SDL_JoystickGetButton (uae4all_joy0, GP2X_BUTTON_R)) #else #ifdef GIZMONDO if (SDL_JoystickGetButton (uae4all_joy0, GIZ_RTRIG)) #else if (SDL_JoystickGetButton (uae4all_joy0, PSP_BUTTON_R)) #endif #endif { if (goingSuperThrottle) goSuperThrottle(); /*else { if (goingVkbd>4) vkbd_mode=1; else goingVkbd++; }*/ } else { if (nowSuperThrottle) leftSuperThrottle(); /*else goingVkbd=0;*/ } } #endif #endif /*if (vkbd_key) { if (vkbd_keysave==-1234567) { SDL_keysym ks; ks.sym=vkbd_key; vkbd_keysave=keycode2amiga(&ks); if (vkbd_keysave >= 0) { if (!uae4all_keystate[vkbd_keysave]) { uae4all_keystate[vkbd_keysave]=1; record_key(vkbd_keysave<<1); } } } } else if (vkbd_keysave!=-1234567) { if (vkbd_keysave >= 0) { uae4all_keystate[vkbd_keysave]=0; record_key((vkbd_keysave << 1) | 1); } vkbd_keysave=-1234567; }*/ #endif #ifdef PANDORA Uint8 *keystate = SDL_GetKeyState(NULL); if(keystate[SDLK_F12]) { if(hwScaled) SDL_WM_ToggleFullScreen(prSDLScreen); else SDL_WM_ToggleFullScreen(prSDLScaleScreen); } if(!vkbd_mode) { //L + R if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_L) && SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_R)) { //up if(SDL_JoystickGetAxis(uae4all_joy0, 1) < 0) { moveVertical(1); moved_y += 2; } //down else if(SDL_JoystickGetAxis(uae4all_joy0, 1) > 0) { moveVertical(-1); moved_y -= 2; } //left else if(SDL_JoystickGetAxis(uae4all_joy0, 0) < 0) { screenWidth -=10; if(screenWidth<200) screenWidth = 200; update_display(); } //right else if(SDL_JoystickGetAxis(uae4all_joy0, 0) > 0) { screenWidth +=10; if(screenWidth>800) screenWidth = 800; update_display(); } //1 else if(keystate[SDLK_1]) { mainMenu_displayedLines = 200; screenWidth = 768; presetModeId = 0; strcpy(presetMode, "320x200 upscaled"); update_display(); } //2 else if(keystate[SDLK_2]) { mainMenu_displayedLines = 216; screenWidth = 716; presetModeId = 1; strcpy(presetMode, "320x216 upscaled"); update_display(); } //3 else if(keystate[SDLK_3]) { mainMenu_displayedLines = 240; screenWidth = 640; presetModeId = 2; strcpy(presetMode, "320x240 upscaled"); update_display(); } //4 else if(keystate[SDLK_4]) { mainMenu_displayedLines = 256; screenWidth = 600; presetModeId = 3; strcpy(presetMode, "320x256 upscaled"); update_display(); } //5 else if(keystate[SDLK_5]) { mainMenu_displayedLines = 262; screenWidth = 588; presetModeId = 4; strcpy(presetMode, "320x262 upscaled"); update_display(); } //6 else if(keystate[SDLK_6]) { mainMenu_displayedLines = 270; screenWidth = 570; presetModeId = 5; strcpy(presetMode, "320x270 upscaled"); update_display(); } //7 else if(keystate[SDLK_7]) { mainMenu_displayedLines = 200; screenWidth = 640; presetModeId = 6; strcpy(presetMode, "320x200 NTSC"); update_display(); } //8 else if(keystate[SDLK_8]) { mainMenu_displayedLines = 200; screenWidth = 800; presetModeId = 7; strcpy(presetMode, "320x200 fullscreen"); update_display(); } } //autofire on/off if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_R)) { //(Y) button if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_Y)) { if(!justPressedY) { //autofire on/off switch_autofire = !switch_autofire; justPressedY=1; } } else if(justPressedY) justPressedY=0; } if (mainMenu_customControls && !gp2xMouseEmuOn && !gp2xButtonRemappingOn) { if(mainMenu_custom_dpad == 0) { //UP if(SDL_JoystickGetAxis(uae4all_joy0, 1) < 0) { if(!justMovedUp) { if(mainMenu_custom_up == -1) buttonstate[0]=1; else if(mainMenu_custom_up == -2) buttonstate[2]=1; else if(mainMenu_custom_up > 0) { getMapping(mainMenu_custom_up); uae4all_keystate[customKey] = 1; record_key(customKey << 1); } justMovedUp=1; } } else if(justMovedUp) { if(mainMenu_custom_up == -1) buttonstate[0]=0; else if(mainMenu_custom_up == -2) buttonstate[2]=0; else if(mainMenu_custom_up > 0) { getMapping(mainMenu_custom_up); uae4all_keystate[customKey] = 0; record_key((customKey << 1) | 1); } justMovedUp=0; } //DOWN if(SDL_JoystickGetAxis(uae4all_joy0, 1) > 0) { if(!justMovedDown) { if(mainMenu_custom_down == -1) buttonstate[0]=1; else if(mainMenu_custom_down == -2) buttonstate[2]=1; else if(mainMenu_custom_down > 0) { getMapping(mainMenu_custom_down); uae4all_keystate[customKey] = 1; record_key(customKey << 1); } justMovedDown=1; } } else if(justMovedDown) { if(mainMenu_custom_down == -1) buttonstate[0]=0; else if(mainMenu_custom_down == -2) buttonstate[2]=0; else if(mainMenu_custom_down > 0) { getMapping(mainMenu_custom_down); uae4all_keystate[customKey] = 0; record_key((customKey << 1) | 1); } justMovedDown=0; } //LEFT if(SDL_JoystickGetAxis(uae4all_joy0, 0) < 0) { if(!justMovedLeft) { if(mainMenu_custom_left == -1) buttonstate[0]=1; else if(mainMenu_custom_left == -2) buttonstate[2]=1; else if(mainMenu_custom_left > 0) { getMapping(mainMenu_custom_left); uae4all_keystate[customKey] = 1; record_key(customKey << 1); } justMovedLeft=1; } } else if(justMovedLeft) { if(mainMenu_custom_left == -1) buttonstate[0]=0; else if(mainMenu_custom_left == -2) buttonstate[2]=0; else if(mainMenu_custom_left > 0) { getMapping(mainMenu_custom_left); uae4all_keystate[customKey] = 0; record_key((customKey << 1) | 1); } justMovedLeft=0; } //RIGHT if(SDL_JoystickGetAxis(uae4all_joy0, 0) > 0) { if(!justMovedRight) { if(mainMenu_custom_right == -1) buttonstate[0]=1; else if(mainMenu_custom_right == -2) buttonstate[2]=1; else if(mainMenu_custom_right > 0) { getMapping(mainMenu_custom_right); uae4all_keystate[customKey] = 1; record_key(customKey << 1); } justMovedRight=1; } } else if(justMovedRight) { if(mainMenu_custom_right == -1) buttonstate[0]=0; else if(mainMenu_custom_right == -2) buttonstate[2]=0; else if(mainMenu_custom_right > 0) { getMapping(mainMenu_custom_right); uae4all_keystate[customKey] = 0; record_key((customKey << 1) | 1); } justMovedRight=0; } } //(A) if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_B)) { if(!justPressedA) { if(mainMenu_custom_A == -1) buttonstate[0]=1; else if(mainMenu_custom_A == -2) buttonstate[2]=1; else if(mainMenu_custom_A > 0) { getMapping(mainMenu_custom_A); uae4all_keystate[customKey] = 1; record_key(customKey << 1); } justPressedA=1; } } else if(justPressedA) { if(mainMenu_custom_A == -1) buttonstate[0]=0; else if(mainMenu_custom_A == -2) buttonstate[2]=0; else if(mainMenu_custom_A > 0) { getMapping(mainMenu_custom_A); uae4all_keystate[customKey] = 0; record_key((customKey << 1) | 1); } justPressedA=0; } //(B) if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_A)) { if(!justPressedB) { if(mainMenu_custom_B == -1) buttonstate[0]=1; else if(mainMenu_custom_B == -2) buttonstate[2]=1; else if(mainMenu_custom_B > 0) { getMapping(mainMenu_custom_B); uae4all_keystate[customKey] = 1; record_key(customKey << 1); } justPressedB=1; } } else if(justPressedB) { if(mainMenu_custom_B == -1) buttonstate[0]=0; else if(mainMenu_custom_B == -2) buttonstate[2]=0; else if(mainMenu_custom_B > 0) { getMapping(mainMenu_custom_B); uae4all_keystate[customKey] = 0; record_key((customKey << 1) | 1); } justPressedB=0; } //(X) if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_X)) { if(!justPressedX) { if(mainMenu_custom_X == -1) buttonstate[0]=1; else if(mainMenu_custom_X == -2) buttonstate[2]=1; else if(mainMenu_custom_X > 0) { getMapping(mainMenu_custom_X); uae4all_keystate[customKey] = 1; record_key(customKey << 1); } justPressedX=1; } } else if(justPressedX) { if(mainMenu_custom_X == -1) buttonstate[0]=0; else if(mainMenu_custom_X == -2) buttonstate[2]=0; else if(mainMenu_custom_X > 0) { getMapping(mainMenu_custom_X); uae4all_keystate[customKey] = 0; record_key((customKey << 1) | 1); } justPressedX=0; } //(Y) if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_Y)) { if(!justPressedY) { if(mainMenu_custom_Y == -1) buttonstate[0]=1; else if(mainMenu_custom_Y == -2) buttonstate[2]=1; else if(mainMenu_custom_Y > 0) { getMapping(mainMenu_custom_Y); uae4all_keystate[customKey] = 1; record_key(customKey << 1); } justPressedY=1; } } else if(justPressedY) { if(mainMenu_custom_Y == -1) buttonstate[0]=0; else if(mainMenu_custom_Y == -2) buttonstate[2]=0; else if(mainMenu_custom_Y > 0) { getMapping(mainMenu_custom_Y); uae4all_keystate[customKey] = 0; record_key((customKey << 1) | 1); } justPressedY=0; } //(L) if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_L)) { if(!justPressedL) { if(mainMenu_custom_L == -1) buttonstate[0]=1; else if(mainMenu_custom_L == -2) buttonstate[2]=1; else if(mainMenu_custom_L > 0) { getMapping(mainMenu_custom_L); uae4all_keystate[customKey] = 1; record_key(customKey << 1); } justPressedL=1; } } else if(justPressedL) { if(mainMenu_custom_L == -1) buttonstate[0]=0; else if(mainMenu_custom_L == -2) buttonstate[2]=0; else if(mainMenu_custom_L > 0) { getMapping(mainMenu_custom_L); uae4all_keystate[customKey] = 0; record_key((customKey << 1) | 1); } justPressedL=0; } //(R) if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_R)) { if(!justPressedR) { if(mainMenu_custom_R == -1) buttonstate[0]=1; else if(mainMenu_custom_R == -2) buttonstate[2]=1; else if(mainMenu_custom_R > 0) { getMapping(mainMenu_custom_R); uae4all_keystate[customKey] = 1; record_key(customKey << 1); } justPressedR=1; } } else if(justPressedR) { if(mainMenu_custom_R == -1) buttonstate[0]=0; else if(mainMenu_custom_R == -2) buttonstate[2]=0; else if(mainMenu_custom_R > 0) { getMapping(mainMenu_custom_R); uae4all_keystate[customKey] = 0; record_key((customKey << 1) | 1); } justPressedR=0; } } else if(!gp2xMouseEmuOn) { //DPad = arrow keys in stylus-mode if(gp2xButtonRemappingOn) { //dpad up if (SDL_JoystickGetAxis(uae4all_joy0, 1) < 0) { if(!justMovedUp) { //left and right mouse-buttons down buttonstate[0] = 1; buttonstate[2] = 1; stylusClickOverride = 1; justMovedUp=1; } } else if(justMovedUp) { //left and right mouse-buttons up buttonstate[0] = 0; buttonstate[2] = 0; stylusClickOverride = 0; justMovedUp=0; } //dpad down if (SDL_JoystickGetAxis(uae4all_joy0, 1) > 0) { if(!justMovedDown) { //no clicks with stylus now stylusClickOverride=1; justMovedDown=1; } } else if(justMovedDown) { //clicks active again stylusClickOverride=0; justMovedDown=0; } //dpad left if (SDL_JoystickGetAxis(uae4all_joy0, 0) < 0) { if(!justMovedLeft) { //left mouse-button down buttonstate[0] = 1; stylusClickOverride = 1; justMovedLeft=1; } } else if(justMovedLeft) { //left mouse-button up buttonstate[0] = 0; stylusClickOverride = 0; justMovedLeft=0; } //dpad right if (SDL_JoystickGetAxis(uae4all_joy0, 0) > 0) { if(!justMovedRight) { //right mouse-button down buttonstate[2] = 1; stylusClickOverride = 1; justMovedRight=1; } } else if(justMovedRight) { //right mouse-button up buttonstate[2] = 0; stylusClickOverride = 0; justMovedRight=0; } //L + up if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_L) && SDL_JoystickGetAxis(uae4all_joy0, 1) < 0) stylusAdjustY-=2; //L + down if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_L) && SDL_JoystickGetAxis(uae4all_joy0, 1) > 0) stylusAdjustY+=2; //L + left if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_L) && SDL_JoystickGetAxis(uae4all_joy0, 0) < 0) stylusAdjustX-=2; //L + right if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_L) && SDL_JoystickGetAxis(uae4all_joy0, 0) > 0) stylusAdjustX+=2; } //R-trigger in joystick mode else if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_R)) { //(A) button if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_A)) { if(!justPressedA) { //CTRL uae4all_keystate[AK_CTRL] = 1; record_key(AK_CTRL << 1); justPressedA=1; } } else if(justPressedA) { uae4all_keystate[AK_CTRL] = 0; record_key((AK_CTRL << 1) | 1); justPressedA=0; } //(B) button if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_B)) { if(!justPressedB) { //left ALT uae4all_keystate[AK_LALT] = 1; record_key(AK_LALT << 1); justPressedB=1; } } else if(justPressedB) { uae4all_keystate[AK_LALT] = 0; record_key((AK_LALT << 1) | 1); justPressedB=0; } //(X) button if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_X)) { if(!justPressedX) { //HELP uae4all_keystate[AK_HELP] = 1; record_key(AK_HELP << 1); justPressedX=1; } } else if(justPressedX) { //HELP uae4all_keystate[AK_HELP] = 0; record_key((AK_HELP << 1) | 1); justPressedX=0; } } else if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_L)) { //(A) button if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_A)) { if(!justPressedA) { //right mouse-button down buttonstate[2] = 1; justPressedA=1; } } else if(justPressedA) { //right mouse-button up buttonstate[2] = 0; justPressedA=0; } //(B) button if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_B)) { if(!justPressedB) { //left mouse-button down buttonstate[0] = 1; justPressedB=1; } } else if(justPressedB) { //left mouse-button up buttonstate[0] = 0; justPressedB=0; } } else { if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_Y)) { if(!justPressedY) { //SPACE uae4all_keystate[AK_SPC] = 1; record_key(AK_SPC << 1); justPressedY=1; } } else if(justPressedY) { //SPACE uae4all_keystate[AK_SPC] = 0; record_key((AK_SPC << 1) | 1); justPressedY=0; } } } else { if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_A)) { if(!justPressedA) { //right mouse-button down buttonstate[2] = 1; justPressedA=1; } } else if(justPressedA) { //right mouse-button up buttonstate[2] = 0; justPressedA=0; } //(B) button if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_B)) { if(!justPressedB) { //left mouse-button down buttonstate[0] = 1; justPressedB=1; } } else if(justPressedB) { //left mouse-button up buttonstate[0] = 0; justPressedB=0; } if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_Y)) { if(!justPressedY) { //SPACE uae4all_keystate[AK_SPC] = 1; record_key(AK_SPC << 1); justPressedY=1; } } else if(justPressedY) { //SPACE uae4all_keystate[AK_SPC] = 0; record_key((AK_SPC << 1) | 1); justPressedY=0; } if (SDL_JoystickGetAxis(uae4all_joy0, 0) < 0) { if(!justMovedLeft) { //left ALT uae4all_keystate[0x64] = 1; record_key(0x64 << 1); justMovedLeft=1; } } else if(justMovedLeft) { //left ALT uae4all_keystate[0x64] = 0; record_key((0x64 << 1) | 1); justMovedLeft=0; } if (SDL_JoystickGetAxis(uae4all_joy0, 0) > 0) { if(!justMovedRight) { //left ALT uae4all_keystate[0x64] = 1; record_key(0x64 << 1); justMovedRight=1; } } else if(justMovedRight) { //left ALT uae4all_keystate[0x64] = 0; record_key((0x64 << 1) | 1); justMovedRight=0; } } if(!mainMenu_customControls && SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_R)) { //R+dpad = arrow keys in joystick mode //dpad up if (SDL_JoystickGetAxis(uae4all_joy0, 1) < 0) { if(!justMovedUp) { //arrow up uae4all_keystate[0x4C] = 1; record_key(0x4C << 1); justMovedUp=1; } } else if(justMovedUp) { //arrow up uae4all_keystate[0x4C] = 0; record_key((0x4C << 1) | 1); justMovedUp=0; } //dpad down if (SDL_JoystickGetAxis(uae4all_joy0, 1) > 0) { if(!justMovedDown) { //arrow down uae4all_keystate[0x4D] = 1; record_key(0x4D << 1); justMovedDown=1; } } else if(justMovedDown) { //arrow down uae4all_keystate[0x4D] = 0; record_key((0x4D << 1) | 1); justMovedDown=0; } //dpad left if (SDL_JoystickGetAxis(uae4all_joy0, 0) < 0) { if(!justMovedLeft) { //arrow left uae4all_keystate[0x4F] = 1; record_key(0x4F << 1); justMovedLeft=1; } } else if(justMovedLeft) { //arrow left uae4all_keystate[0x4F] = 0; record_key((0x4F << 1) | 1); justMovedLeft=0; } //dpad right if (SDL_JoystickGetAxis(uae4all_joy0, 0) > 0) { if(!justMovedRight) { //arrow right uae4all_keystate[0x4E] = 1; record_key(0x4E << 1); justMovedRight=1; } } else if(justMovedRight) { //arrow right uae4all_keystate[0x4E] = 0; record_key((0x4E << 1) | 1); justMovedRight=0; } } //L+D: show/hide status ln if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_L) && keystate[SDLK_d]) { keystate[SDLK_d]=0; mainMenu_showStatus = !mainMenu_showStatus; } } //L+K: virtual keyboard if (SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_L) && keystate[SDLK_k]) { if(!justLK) { vkbd_mode = !vkbd_mode; justLK=1; } } else if(justLK) justLK=0; #ifndef CYCLONE if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_L) && keystate[SDLK_s]) { keystate[SDLK_s]=0; savestate_state = STATE_DOSAVE; } if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_L) && keystate[SDLK_l]) { extern char *savestate_filename; FILE *f=fopen(savestate_filename, "rb"); keystate[SDLK_l]=0; if(f) { fclose(f); savestate_state = STATE_DORESTORE; } else gui_set_message("Failed: Savestate not found", 100); } #endif //if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_L) && keystate[SDLK_1]) //{ // resChange = 1; // gfxHeight = 256; // prSDLScreen = SDL_SetVideoMode(320, 256, 16, VIDEO_FLAGS); // system("export SDL_OMAP_LAYER_SIZE=800x480"); //} #endif if (vkbd_key) { if (vkbd_keysave==-1234567) { SDL_keysym ks; ks.sym=vkbd_key; vkbd_keysave=keycode2amiga(&ks); if (vkbd_keysave >= 0) { if (!uae4all_keystate[vkbd_keysave]) { uae4all_keystate[vkbd_keysave]=1; record_key(vkbd_keysave<<1); } } } } else if (vkbd_keysave!=-1234567) { if (vkbd_keysave >= 0) { uae4all_keystate[vkbd_keysave]=0; record_key((vkbd_keysave << 1) | 1); } vkbd_keysave=-1234567; } }
static void goMenu(void) { int exitmode=0; int autosave=mainMenu_autosave; if (quit_program != 0) return; #ifdef PROFILER_UAE4ALL uae4all_prof_show(); #endif #ifdef DEBUG_FRAMERATE uae4all_show_time(); #endif emulating=1; vkbd_quit(); init_text(0); pause_sound(); menu_raise(); exitmode=run_mainMenu(); notice_screen_contents_lost(); resume_sound(); if ((!(strcmp(prefs_df[0],uae4all_image_file0))) || ((!(strcmp(prefs_df[1],uae4all_image_file1))))) menu_unraise(); quit_text(); vkbd_init(); #ifdef DREAMCAST SDL_DC_EmulateKeyboard(SDL_FALSE); #endif getChanges(); vkbd_init_button2(); if (exitmode==1 || exitmode==2) { extern char *savestate_filename; extern int saveMenu_n_savestate; for(int i=0;i<mainMenu_drives;i++) { if (i==0 && strcmp(changed_df[0],uae4all_image_file0)) { strcpy(changed_df[0],uae4all_image_file0); real_changed_df[0]=1; } else if (i==1 && strcmp(changed_df[1],uae4all_image_file1)) { strcpy(changed_df[1],uae4all_image_file1); real_changed_df[1]=1; } else if (i==2 && strcmp(changed_df[2],uae4all_image_file2)) { strcpy(changed_df[2],uae4all_image_file2); real_changed_df[2]=1; } else if (i==3 && strcmp(changed_df[3],uae4all_image_file3)) { strcpy(changed_df[3],uae4all_image_file3); real_changed_df[3]=1; } } strcpy(savestate_filename,uae4all_image_file0); switch(saveMenu_n_savestate) { case 1: strcat(savestate_filename,"-1.asf"); break; case 2: strcat(savestate_filename,"-2.asf"); break; case 3: strcat(savestate_filename,"-3.asf"); break; default: strcat(savestate_filename,".asf"); } } if (exitmode==3) { extern char *savestate_filename; extern int saveMenu_n_savestate; for(int i=0;i<mainMenu_drives;i++) { changed_df[i][0]=0; if (i==0) { uae4all_image_file0[0]=0; if (strcmp(changed_df[0],uae4all_image_file0)) { strcpy(changed_df[0],uae4all_image_file0); real_changed_df[0]=1; } } else if (i==1) { uae4all_image_file1[0]=0; if (strcmp(changed_df[1],uae4all_image_file1)) { strcpy(changed_df[1],uae4all_image_file1); real_changed_df[1]=1; } } else if (i==2) { uae4all_image_file2[0]=0; if (strcmp(changed_df[2],uae4all_image_file2)) { strcpy(changed_df[2],uae4all_image_file2); real_changed_df[2]=1; } } else if (i==3) { uae4all_image_file3[0]=0; if (strcmp(changed_df[3],uae4all_image_file3)) { strcpy(changed_df[3],uae4all_image_file3); real_changed_df[3]=1; } } disk_eject(i); } strcpy(savestate_filename,uae4all_image_file0); switch(saveMenu_n_savestate) { case 1: strcat(savestate_filename,"-1.asf"); break; case 2: strcat(savestate_filename,"-2.asf"); break; case 3: strcat(savestate_filename,"-3.asf"); break; default: strcat(savestate_filename,".asf"); } } if (exitmode==2) { if (autosave!=mainMenu_autosave) { prefs_df[0][0]=0; prefs_df[1][0]=0; prefs_df[2][0]=0; prefs_df[3][0]=0; } if(gp2xButtonRemappingOn) togglemouse(); int gp2xMouseEmuOn=0; int gp2xButtonRemappingOn=0; uae_reset (); } check_all_prefs(); gui_purge_events(); notice_screen_contents_lost(); #ifdef DEBUG_FRAMERATE uae4all_update_time(); #endif #ifdef PROFILER_UAE4ALL uae4all_prof_init(); #endif }
static bool render_frame(bool immediate) { // FIXME: immediate is a new parameter //write_log("render_screen line: %d block %d screen %d\n", // g_has_flushed_line, g_has_flushed_block, g_has_flushed_screen); int flushed = g_has_flushed_line || g_has_flushed_block || g_has_flushed_screen; g_renderdata.bpp = g_amiga_video_bpp; // printf("%d %d %d\n", g_amiga_video_bpp, AMIGA_WIDTH, AMIGA_HEIGHT); static int cx, cy, cw, ch, crealh; //printf("g_picasso_enabled %d\n", g_picasso_enabled); if (g_picasso_enabled) { g_renderdata.width = g_picasso_width; g_renderdata.height = g_picasso_height; g_renderdata.limit_x = 0; g_renderdata.limit_y = 0; g_renderdata.limit_w = g_picasso_width; g_renderdata.limit_h = g_picasso_height; //g_renderdata.updated = g_screen_updated; g_renderdata.flags |= AMIGA_VIDEO_RTG_MODE; #ifdef USE_BUFMEM //memcpy(g_renderdata.pixels, g_bufmem, g_picasso_width * g_picasso_height * g_amiga_video_bpp); #endif // FIXME memset(g_renderdata.line, 0, AMIGA_MAX_LINES); } else { if (gfxvidinfo.outbuffer) { // if gfxvidinfo.outbuffer is not set, get_custom_limits will // crash if (flushed) { get_custom_limits(&cw, &ch, &cx, &cy, &crealh); // FIXME: crealh is new - find out what it does } else { // reuse last custom limits } } if (cx < 0) { //write_log("WARNING: custom limit x (%d) is < 0 - clamping\n", cx); cx = 0; } if (cy < 0) { //write_log("WARNING: custom limit y (%d) is < 0 - clamping\n", cy); cy = 0; } if (cx + cw > AMIGA_WIDTH) { //write_log("WARNING: custom limit x (%d) + w (%d) is > " // "AMIGA_WIDTH (%d) - clamping\n", cx, cw, AMIGA_WIDTH); cw = AMIGA_WIDTH - cx; } if (cy + ch > AMIGA_HEIGHT) { //write_log("WARNING: custom limit y (%d) + h (%d) is > " // "AMIGA_HEIGHT (%d) - clamping\n", cy, ch, AMIGA_HEIGHT); ch = AMIGA_HEIGHT - cy; } g_renderdata.width = AMIGA_WIDTH; g_renderdata.height = AMIGA_HEIGHT; g_renderdata.limit_x = cx; g_renderdata.limit_y = cy; g_renderdata.limit_w = cw; g_renderdata.limit_h = ch; //g_renderdata.updated = g_screen_updated; CLEAR_FLAG(g_renderdata.flags, AMIGA_VIDEO_RTG_MODE); SET_OR_CLEAR_FLAG(g_renderdata.flags, AMIGA_VIDEO_LOW_RESOLUTION, currprefs.gfx_resolution == 0); SET_OR_CLEAR_FLAG(g_renderdata.flags, AMIGA_VIDEO_LINE_DOUBLING, currprefs.gfx_vresolution == 1); #ifdef USE_BUFMEM //printf("g_renderdata.pixels %p %p", g_renderdata.pixels, g_bufmem); memcpy(g_renderdata.pixels, g_bufmem, AMIGA_WIDTH * AMIGA_HEIGHT * g_amiga_video_bpp); #endif } //g_renderdata.line[first_line] = 0; //g_renderdata.line[first_line + 1] = 0; //for (int y = first_line; y <= last_line; y++) { // g_renderdata.line[y] = 0; //} g_screen_updated = 0; //printf("flush_screen (%d -> %d) %d %d %d %d\n", first_line, last_line, // cx, cy, cw, ch); od_fs_update_leds(); if (currprefs.turbo_emulation) { g_renderdata.refresh_rate = -1; } else { g_renderdata.refresh_rate = currprefs.chipset_refreshrate; } #if 0 printf("%0.2f\n", g_renderdata.refresh_rate); #endif if (g_libamiga_callbacks.render) { g_libamiga_callbacks.render(&g_renderdata); } g_has_flushed_line = 0; g_has_flushed_block = 0; g_has_flushed_screen = 0; #ifdef FS_EMU_DRIVERS notice_screen_contents_lost(); #endif return 1; }