unified menu wip and some reorganization for it
[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
8
9 void plat_video_menu_enter(int is_rom_loaded)
10 {
11         if (is_rom_loaded)
12         {
13                 // darken the active framebuffer
14                 memset(gp2x_screen, 0, 320*8*2);
15                 menu_darken_bg((char *)gp2x_screen + 320*8*2, 320*224, 1);
16                 memset((char *)gp2x_screen + 320*232*2, 0, 320*8*2);
17         }
18         else
19         {
20                 // should really only happen once, on startup..
21                 readpng(gp2x_screen, "skin/background.png", READPNG_BG);
22         }
23
24         // copy to buffer2
25         gp2x_memcpy_buffers((1<<2), gp2x_screen, 0, 320*240*2);
26
27         // switch to 16bpp
28         gp2x_video_changemode2(16);
29         gp2x_video_RGB_setscaling(0, 320, 240);
30         gp2x_video_flip2();
31 }
32
33 void plat_video_menu_begin(void)
34 {
35         gp2x_pd_clone_buffer2();
36 }
37
38 void plat_video_menu_end(void)
39 {
40         gp2x_video_flush_cache();
41         gp2x_video_flip2();
42 }
43