X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=video.c;h=ada3feaaf27dc566d8f13b90ce6274779c214b57;hb=5cc8854bc94b22e52d747e67cc9b7ca310711181;hp=5a1181fa29f8b3c4011df330f2dd89f84dfc2384;hpb=4742480dcabcbd9d23fd8cb9a655fc8c9c314513;p=gpsp.git diff --git a/video.c b/video.c index 5a1181f..ada3fea 100644 --- a/video.c +++ b/video.c @@ -79,6 +79,18 @@ static void Ge_Finish_Callback(int id, void *arg) { } +#define get_screen_pixels() \ + screen_pixels \ + +#define get_screen_pitch() \ + screen_pitch \ + +#elif defined(WIZ_BUILD) + +static u32 screen_offset = 0; +static u16 *screen_pixels = NULL; +const u32 screen_pitch = 320; + #define get_screen_pixels() \ screen_pixels \ @@ -88,17 +100,11 @@ static void Ge_Finish_Callback(int id, void *arg) #else #ifdef GP2X_BUILD - #ifdef WIZ_BUILD - static void SDL_GP2X_AllowGfxMemory() {} - #include - #else - #include "SDL_gp2x.h" - #endif - SDL_Surface *hw_screen; +#include "SDL_gp2x.h" +SDL_Surface *hw_screen; #endif SDL_Surface *screen; const u32 video_scale = 1; -extern void gp2x_flush_cache(void *beginning_addr, void *end_addr, int flags); #define get_screen_pixels() \ ((u16 *)screen->pixels) \ @@ -3328,6 +3334,20 @@ void flip_screen() } } +#elif defined(WIZ_BUILD) + +void flip_screen() +{ + if((screen_scale == scaled_aspect) && + (resolution_width == small_resolution_width) && + (resolution_height == small_resolution_height)) + { + upscale_aspect(gpsp_gp2x_screen, screen_pixels); + } + pollux_video_flip(); + screen_pixels = (u16 *)gpsp_gp2x_screen + screen_offset; +} + #else #define integer_scale_copy_2() \ @@ -3422,9 +3442,7 @@ void flip_screen() { SDL_BlitSurface(screen, NULL, hw_screen, NULL); } - /* it is unclear if this syscall takes virtual or physical addresses, - * but using virtual seems to work for me. */ - gp2x_flush_cache(hw_screen->pixels, hw_screen->pixels + 320*240, 0); + warm_cache_op_all(WOP_D_CLEAN); } #else SDL_Flip(screen); @@ -3528,6 +3546,12 @@ void init_video() GE_CMD(NOP, 0); } +#elif defined(WIZ_BUILD) + +void init_video() +{ +} + #else void init_video() @@ -3543,7 +3567,7 @@ void init_video() screen = SDL_CreateRGBSurface(SDL_HWSURFACE, 240 * video_scale, 160 * video_scale, 16, 0xFFFF, 0xFFFF, 0xFFFF, 0); - gp2x_load_mmuhack(); + warm_change_cb_upper(WCB_C_BIT|WCB_B_BIT, 1); #else screen = SDL_SetVideoMode(240 * video_scale, 160 * video_scale, 16, 0); #endif @@ -3656,6 +3680,47 @@ void clear_screen(u16 color) sceGuSync(0, 0); */ } +#elif defined(WIZ_BUILD) + +void video_resolution_large() +{ + screen_offset = 0; + resolution_width = 320; + resolution_height = 240; + + fb_use_buffers(1); + flip_screen(); + clear_screen(0); +} + +void video_resolution_small() +{ + if(screen_scale == scaled_aspect) + screen_offset = 320*(80 - 14) + 80; + else + screen_offset = 320*40 + 40; + resolution_width = 240; + resolution_height = 160; + + fb_use_buffers(4); + flip_screen(); + clear_screen(0); +} + +void set_gba_resolution(video_scale_type scale) +{ + screen_scale = scale; +} + +void clear_screen(u16 color) +{ + u32 col = ((u32)color << 16) | color; + u32 *p = gpsp_gp2x_screen; + int c = 320*240/2; + while (c-- > 0) + *p++ = col; +} + #else void video_resolution_large() @@ -3672,7 +3737,7 @@ void video_resolution_large() resolution_height = 240; SDL_ShowCursor(0); - gp2x_load_mmuhack(); + warm_change_cb_upper(WCB_C_BIT|WCB_B_BIT, 1); #else screen = SDL_SetVideoMode(480, 272, 16, 0); resolution_width = 480; @@ -3704,7 +3769,7 @@ void video_resolution_small() SDL_ShowCursor(0); - gp2x_load_mmuhack(); + warm_change_cb_upper(WCB_C_BIT|WCB_B_BIT, 1); #else screen = SDL_SetVideoMode(small_resolution_width * video_scale, small_resolution_height * video_scale, 16, 0);