|
124 | 124 |
|
125 | 125 | /// -------------- STATIC VARIABLES -------------- |
126 | 126 | extern SDL_Surface *screen; |
127 | | -SDL_Surface *virtual_hw_screen; // this one is not rotated |
128 | 127 | extern SDL_Surface *hw_screen; |
129 | 128 | SDL_Surface * draw_screen; |
130 | 129 | extern int volatile pumpWrap_disabled; |
@@ -158,6 +157,14 @@ static uint16_t y_brightness_bar = 0; |
158 | 157 | int volume_percentage = 0; |
159 | 158 | int brightness_percentage = 0; |
160 | 159 |
|
| 160 | +#undef X |
| 161 | +#define X(a, b) b, |
| 162 | +const char *aspect_ratio_name[] = {ASPECT_RATIOS}; |
| 163 | +int aspect_ratio = ASPECT_RATIOS_TYPE_STRETCHED; |
| 164 | +int aspect_ratio_factor_percent = 50; |
| 165 | +int aspect_ratio_factor_step = 10; |
| 166 | +int need_screen_cleared = 0; |
| 167 | + |
161 | 168 | #undef X |
162 | 169 | #define X(a, b) b, |
163 | 170 | const char *resume_options_str[] = {RESUME_OPTIONS}; |
@@ -191,15 +198,14 @@ void init_menu_SDL(){ |
191 | 198 | MENU_ERROR_PRINTF("ERROR in init_menu_SDL: Could not open menu font %s, %s\n", MENU_FONT_NAME_SMALL_INFO, SDL_GetError()); |
192 | 199 | } |
193 | 200 |
|
194 | | - /// ----- Copy virtual_hw_screen at init ------ |
195 | | - virtual_hw_screen = screen; |
| 201 | + /// ----- Create SDL surfaces ------ |
196 | 202 | backup_hw_screen = SDL_CreateRGBSurface(SDL_SWSURFACE, |
197 | | - virtual_hw_screen->w, virtual_hw_screen->h, 32, 0, 0, 0, 0); |
| 203 | + hw_screen->w, hw_screen->h, 32, 0, 0, 0, 0); |
198 | 204 | if(backup_hw_screen == NULL){ |
199 | 205 | MENU_ERROR_PRINTF("ERROR Could not create backup_hw_screen: %s\n", SDL_GetError()); |
200 | 206 | } |
201 | 207 | draw_screen = SDL_CreateRGBSurface(SDL_SWSURFACE, |
202 | | - virtual_hw_screen->w, virtual_hw_screen->h, 32, 0, 0, 0, 0); |
| 208 | + hw_screen->w, hw_screen->h, 32, 0, 0, 0, 0); |
203 | 209 | if(draw_screen == NULL){ |
204 | 210 | MENU_ERROR_PRINTF("ERROR Could not create draw_screen: %s\n", SDL_GetError()); |
205 | 211 | } |
@@ -411,7 +417,7 @@ void init_menu_zones(){ |
411 | 417 | /// Init Load Menu |
412 | 418 | add_menu_zone(MENU_TYPE_LOAD); |
413 | 419 | /// Init Aspect Ratio Menu |
414 | | - //add_menu_zone(MENU_TYPE_ASPECT_RATIO); |
| 420 | + add_menu_zone(MENU_TYPE_ASPECT_RATIO); |
415 | 421 | /// Init Exit Menu |
416 | 422 | add_menu_zone(MENU_TYPE_EXIT); |
417 | 423 | /// Init Powerdown Menu |
@@ -491,7 +497,7 @@ void menu_screen_refresh(int menuItem, int prevItem, int scroll, uint8_t menu_co |
491 | 497 | menu_blit_window.y = scroll; |
492 | 498 | menu_blit_window.h = SCREEN_VERTICAL_SIZE; |
493 | 499 | if(SDL_BlitSurface(menu_zone_surfaces[prevItem], &menu_blit_window, draw_screen, NULL)){ |
494 | | - MENU_ERROR_PRINTF("ERROR Could not Blit surface on virtual_hw_screen: %s\n", SDL_GetError()); |
| 500 | + MENU_ERROR_PRINTF("ERROR Could not Blit surface on draw_screen: %s\n", SDL_GetError()); |
495 | 501 | } |
496 | 502 |
|
497 | 503 | /// --------- Blit new menu Zone going in (only during animations) ---------- |
@@ -619,13 +625,13 @@ void menu_screen_refresh(int menuItem, int prevItem, int scroll, uint8_t menu_co |
619 | 625 | SDL_BlitSurface(text_surface, NULL, draw_screen, &text_pos); |
620 | 626 | break; |
621 | 627 |
|
622 | | - /*case MENU_TYPE_ASPECT_RATIO: |
| 628 | + case MENU_TYPE_ASPECT_RATIO: |
623 | 629 | sprintf(text_tmp, "< %s >", aspect_ratio_name[aspect_ratio]); |
624 | 630 | text_surface = TTF_RenderText_Blended(menu_info_font, text_tmp, text_color); |
625 | 631 | text_pos.x = (draw_screen->w - MENU_ZONE_WIDTH)/2 + (MENU_ZONE_WIDTH - text_surface->w)/2; |
626 | 632 | text_pos.y = draw_screen->h - MENU_ZONE_HEIGHT/2 - text_surface->h/2 + padding_y_from_center_menu_zone; |
627 | 633 | SDL_BlitSurface(text_surface, NULL, draw_screen, &text_pos); |
628 | | - break;*/ |
| 634 | + break; |
629 | 635 |
|
630 | 636 | case MENU_TYPE_EXIT: |
631 | 637 | case MENU_TYPE_POWERDOWN: |
@@ -693,8 +699,8 @@ void run_menu_loop() |
693 | 699 | int prevItem=menuItem; |
694 | 700 |
|
695 | 701 | /// ------ Copy currently displayed screen ------- |
696 | | - if(SDL_BlitSurface(virtual_hw_screen, NULL, backup_hw_screen, NULL)){ |
697 | | - MENU_ERROR_PRINTF("ERROR Could not copy virtual_hw_screen: %s\n", SDL_GetError()); |
| 702 | + if(SDL_BlitSurface(hw_screen, NULL, backup_hw_screen, NULL)){ |
| 703 | + MENU_ERROR_PRINTF("ERROR Could not copy hw_screen: %s\n", SDL_GetError()); |
698 | 704 | } |
699 | 705 | /*uint16_t *dst_virtual = (uint16_t*) sal_VirtualVideoGetBuffer(); |
700 | 706 | memcpy(backup_hw_screen->pixels, dst_virtual, |
@@ -826,12 +832,12 @@ void run_menu_loop() |
826 | 832 | /// ------ Refresh screen ------ |
827 | 833 | screen_refresh = 1; |
828 | 834 | } |
829 | | - /*else if(idx_menus[menuItem] == MENU_TYPE_ASPECT_RATIO){ |
| 835 | + else if(idx_menus[menuItem] == MENU_TYPE_ASPECT_RATIO){ |
830 | 836 | MENU_DEBUG_PRINTF("Aspect Ratio DOWN\n"); |
831 | 837 | aspect_ratio = (!aspect_ratio)?(NB_ASPECT_RATIOS_TYPES-1):(aspect_ratio-1); |
832 | 838 | /// ------ Refresh screen ------ |
833 | 839 | screen_refresh = 1; |
834 | | - }*/ |
| 840 | + } |
835 | 841 | break; |
836 | 842 |
|
837 | 843 | case SDLK_r: |
@@ -895,12 +901,12 @@ void run_menu_loop() |
895 | 901 | /// ------ Refresh screen ------ |
896 | 902 | screen_refresh = 1; |
897 | 903 | } |
898 | | - /*else if(idx_menus[menuItem] == MENU_TYPE_ASPECT_RATIO){ |
| 904 | + else if(idx_menus[menuItem] == MENU_TYPE_ASPECT_RATIO){ |
899 | 905 | MENU_DEBUG_PRINTF("Aspect Ratio UP\n"); |
900 | 906 | aspect_ratio = (aspect_ratio+1)%NB_ASPECT_RATIOS_TYPES; |
901 | 907 | /// ------ Refresh screen ------ |
902 | 908 | screen_refresh = 1; |
903 | | - }*/ |
| 909 | + } |
904 | 910 | break; |
905 | 911 |
|
906 | 912 | case SDLK_a: |
|
0 commit comments