screen ptr/size unification, major cleanups
[libpicofe.git] / gp2x / plat.c
1 #include <string.h>
2
3 #include "gp2x.h"
4 #include "../common/plat.h"
5 #include "../common/readpng.h"
6 #include "../common/menu.h"
7 #include "../common/emu.h"
8
9
10 void plat_video_menu_enter(int is_rom_loaded)
11 {
12         if (is_rom_loaded)
13         {
14                 // darken the active framebuffer
15                 memset(g_screen_ptr, 0, 320*8*2);
16                 menu_darken_bg((char *)g_screen_ptr + 320*8*2, 320*224, 1);
17                 memset((char *)g_screen_ptr + 320*232*2, 0, 320*8*2);
18         }
19         else
20         {
21                 // should really only happen once, on startup..
22                 readpng(g_screen_ptr, "skin/background.png", READPNG_BG);
23         }
24
25         // copy to buffer2
26         gp2x_memcpy_buffers((1<<2), g_screen_ptr, 0, 320*240*2);
27
28         // switch to 16bpp
29         gp2x_video_changemode2(16);
30         gp2x_video_RGB_setscaling(0, 320, 240);
31         gp2x_video_flip2();
32 }
33
34 void plat_video_menu_begin(void)
35 {
36         gp2x_pd_clone_buffer2();
37 }
38
39 void plat_video_menu_end(void)
40 {
41         gp2x_video_flush_cache();
42         gp2x_video_flip2();
43 }
44