commit 351578b
chld
·
2026-10-27 22:47:36 +0000 UTC
parent bc7026f
screen mode????
M
uxn.c
+10,
-16
1@@ -768,27 +768,21 @@ static void set_screen_mode(int w,int h) {
2 picture_changed=size_changed=0;
3 free(bglayer);
4 if(screen) SDL_FreeSurface(screen);
5- if(w<1) w=1;
6- if(h<1) h=1;
7+ w=320; h=240;
8 scr_w=w;
9 scr_h=h;
10- screen=SDL_SetVideoMode(w*zoom,h*zoom,8,scrflags);
11- if(!screen) err(1,"Cannot set screen mode");
12- if(!bglayer) {
13- if(timer_rate) SDL_SetTimer(timer_rate,timer_callback);
14- if(audio_option) {
15- if(SDL_OpenAudio(&audiospec,0)) err(1,"Cannot initialize SDL audio");
16- SDL_PauseAudio(0);
17- }
18- SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY,SDL_DEFAULT_REPEAT_INTERVAL);
19- SDL_WM_SetCaption(rom_name,rom_name);
20- set_cursor();
21- SDL_EnableUNICODE(1);
22- }
23+
24+ int bpp = has_colors ? 16 : 8;
25+ // screen=SDL_SetVideoMode(w*zoom,h*zoom,8,scrflags);
26+ screen = SDL_SetVideoMode(w * zoom, h * zoom, bpp, SDL_SWSURFACE);
27+ if(!screen) { show_msgbox("Error", "Cannot set screen mode"); exit(1); }
28 SDL_SetColors(screen,colors+palet*8,0,8);
29 bglayer=calloc(w*h,2);
30- if(!bglayer) err(1,"Memory allocation error");
31+ if(!bglayer) { show_msgbox("Error", "Memory allocation error"); exit(1); }
32 fglayer=bglayer+w*h;
33+
34+ PUT16(device[2].d + 2, scr_w);
35+ PUT16(device[2].d + 4, scr_h);
36 }
37
38 static void screen_fill(Uint8*p,Uint8 v,Uint16 x0,Uint16 y0,Uint16 x1,Uint16 y1) {
M
uxn.o
+0,
-0
M
uxn2.elf
+0,
-0
M
uxn2.tns
+0,
-0