Skip to content

Commit 83ece47

Browse files
committed
SMS full screen size
Signed-off-by: Vincent-FK <[email protected]>
1 parent f83873e commit 83ece47

File tree

2 files changed

+48
-14
lines changed

2 files changed

+48
-14
lines changed

platform/common/emu.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,8 @@ static void system_announce(void)
344344
fps = Pico.m.pal ? 50 : 60;
345345

346346
//emu_status_msg("%s %s / %dFPS%s", tv_standard, sys_name, fps, extra);
347-
printf("%s %s / %dFPS%s\n", tv_standard, sys_name, fps, extra);
347+
printf("\nSystem Announce: %s, %s / %dFPS%s\n", sys_name, tv_standard, fps, extra);
348+
printf("PicoIn.AHW = %d, Pico.m.hardware=%d\n", PicoIn.AHW, Pico.m.hardware);
348349
}
349350

350351
static void do_region_override(const char *media_fname)
@@ -1331,8 +1332,10 @@ void emu_update_input(void)
13311332

13321333
events &= ~prev_events;
13331334

1335+
/* SMS */
13341336
if (PicoIn.AHW == PAHW_PICO)
13351337
run_events_pico(events);
1338+
13361339
if (events)
13371340
run_events_ui(events);
13381341
if (movie_data)

platform/common/plat_sdl.c

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ static unsigned char yuv_u[32 * 2], yuv_v[32 * 2];
113113

114114
SDL_Surface * hw_screen = NULL;
115115
SDL_Surface * virtual_hw_screen = NULL;
116+
SDL_Surface * sms_game_screen = NULL;
116117

117118
void clear_screen(SDL_Surface *surface, uint16_t color)
118119
{
@@ -1345,6 +1346,29 @@ void plat_video_flip(void)
13451346
if (SDL_MUSTLOCK(plat_sdl_screen))
13461347
SDL_UnlockSurface(plat_sdl_screen);
13471348

1349+
/* Surface with game data */
1350+
SDL_Surface *game_surface;
1351+
1352+
/* Sega Master System -> 256*192 res in 320*240 surface */
1353+
if (PicoIn.AHW & PAHW_SMS){
1354+
1355+
/* Copy sms game pixels */
1356+
int offset_y = (plat_sdl_screen->h - sms_game_screen->h)/2;
1357+
int offset_x = (plat_sdl_screen->w - sms_game_screen->w)/2 + 6;
1358+
int y;
1359+
for(y=0; y<192; y++){
1360+
memcpy((uint16_t*)sms_game_screen->pixels + sms_game_screen->w*y,
1361+
(uint16_t*)plat_sdl_screen->pixels + plat_sdl_screen->w*(y+offset_y) + offset_x,
1362+
sms_game_screen->w*sizeof(uint16_t));
1363+
}
1364+
1365+
game_surface = sms_game_screen;
1366+
}
1367+
else{
1368+
game_surface = plat_sdl_screen;
1369+
}
1370+
1371+
13481372
/// --------------Optimized Flip depending on aspect ratio -------------
13491373
static int prev_aspect_ratio;
13501374
if(prev_aspect_ratio != aspect_ratio || need_screen_cleared){
@@ -1356,36 +1380,37 @@ void plat_video_flip(void)
13561380

13571381
switch(aspect_ratio){
13581382
case ASPECT_RATIOS_TYPE_STRECHED:
1359-
flip_NNOptimized_LeftAndRightBilinear(plat_sdl_screen, virtual_hw_screen,
1383+
flip_NNOptimized_LeftAndRightBilinear(game_surface, virtual_hw_screen,
13601384
RES_HW_SCREEN_HORIZONTAL, RES_HW_SCREEN_VERTICAL);
13611385
break;
13621386
case ASPECT_RATIOS_TYPE_MANUAL:
1363-
;uint32_t h_scaled = MIN(plat_sdl_screen->h*RES_HW_SCREEN_HORIZONTAL/plat_sdl_screen->w,
1387+
;uint32_t h_scaled = MIN(game_surface->h*RES_HW_SCREEN_HORIZONTAL/game_surface->w,
13641388
RES_HW_SCREEN_VERTICAL);
13651389
uint32_t h_zoomed = MIN(h_scaled + aspect_ratio_factor_percent*(RES_HW_SCREEN_VERTICAL - h_scaled)/100,
13661390
RES_HW_SCREEN_VERTICAL);
1367-
flip_NNOptimized_LeftRightUpDownBilinear_Optimized8(plat_sdl_screen, virtual_hw_screen,
1368-
MAX(plat_sdl_screen->w*h_zoomed/plat_sdl_screen->h, RES_HW_SCREEN_HORIZONTAL),
1391+
flip_NNOptimized_LeftRightUpDownBilinear_Optimized8(game_surface, virtual_hw_screen,
1392+
MAX(game_surface->w*h_zoomed/game_surface->h, RES_HW_SCREEN_HORIZONTAL),
13691393
MIN(h_zoomed, RES_HW_SCREEN_VERTICAL));
13701394
break;
1371-
case ASPECT_RATIOS_TYPE_CROPPED:
1372-
flip_NNOptimized_AllowOutOfScreen(plat_sdl_screen, virtual_hw_screen,
1373-
MAX(plat_sdl_screen->w*RES_HW_SCREEN_VERTICAL/plat_sdl_screen->h, RES_HW_SCREEN_HORIZONTAL),
1395+
case ASPECT_RATIOS_TYPE_CROPPED:
1396+
flip_NNOptimized_AllowOutOfScreen(game_surface, virtual_hw_screen,
1397+
MAX(game_surface->w*RES_HW_SCREEN_VERTICAL/game_surface->h, RES_HW_SCREEN_HORIZONTAL),
13741398
RES_HW_SCREEN_VERTICAL);
13751399
break;
13761400
case ASPECT_RATIOS_TYPE_SCALED:
1377-
flip_NNOptimized_LeftRightUpDownBilinear_Optimized8(plat_sdl_screen, virtual_hw_screen,
1401+
flip_NNOptimized_LeftRightUpDownBilinear_Optimized8(game_surface, virtual_hw_screen,
13781402
RES_HW_SCREEN_HORIZONTAL,
1379-
MIN(plat_sdl_screen->h*RES_HW_SCREEN_HORIZONTAL/plat_sdl_screen->w, RES_HW_SCREEN_VERTICAL));
1403+
MIN(game_surface->h*RES_HW_SCREEN_HORIZONTAL/game_surface->w, RES_HW_SCREEN_VERTICAL));
13801404
break;
13811405
default:
13821406
printf("Wrong aspect ratio value: %d\n", aspect_ratio);
13831407
aspect_ratio = ASPECT_RATIOS_TYPE_STRECHED;
1384-
flip_NNOptimized_LeftRightUpDownBilinear_Optimized8(plat_sdl_screen, virtual_hw_screen,
1408+
flip_NNOptimized_LeftRightUpDownBilinear_Optimized8(game_surface, virtual_hw_screen,
13851409
RES_HW_SCREEN_HORIZONTAL, RES_HW_SCREEN_VERTICAL);
13861410
break;
13871411
}
13881412

1413+
13891414
// Rotate
13901415
//SDL_Rotate_270(hw_screen, virtual_hw_screen);
13911416
//SDL_BlitSurface(virtual_hw_screen, NULL, hw_screen, NULL);
@@ -1508,9 +1533,15 @@ void plat_init(void)
15081533

15091534
virtual_hw_screen = SDL_CreateRGBSurface(SDL_SWSURFACE,
15101535
RES_HW_SCREEN_HORIZONTAL, RES_HW_SCREEN_VERTICAL, 16, 0xFFFF, 0xFFFF, 0xFFFF, 0);
1511-
if (virtual_hw_screen == NULL) {
1512-
fprintf(stderr, "virtual_hw_screen failed: %s\n", SDL_GetError());
1513-
}
1536+
if (virtual_hw_screen == NULL) {
1537+
fprintf(stderr, "virtual_hw_screen failed: %s\n", SDL_GetError());
1538+
}
1539+
1540+
sms_game_screen = SDL_CreateRGBSurface(SDL_SWSURFACE,
1541+
256, 192, 16, 0xFFFF, 0xFFFF, 0xFFFF, 0);
1542+
if (sms_game_screen == NULL) {
1543+
fprintf(stderr, "sms_game_screen failed: %s\n", SDL_GetError());
1544+
}
15141545

15151546
g_menuscreen_w = plat_sdl_screen->w;
15161547
g_menuscreen_h = plat_sdl_screen->h;

0 commit comments

Comments
 (0)