libretro: satisfy vita's dynarec needs in a cleaner way
[picodrive.git] / platform / pandora / menu.c
... / ...
CommitLineData
1#include "plat.h"
2
3static const char *men_scaler[] = { "1x1, 1x1", "2x2, 3x2", "2x2, 2x2", "fullscreen", "custom", NULL };
4static const char h_scaler[] = "Scalers for 40 and 32 column modes\n"
5 "(320 and 256 pixel wide horizontal)";
6static const char h_cscaler[] = "Displays the scaler layer, you can resize it\n"
7 "using d-pad or move it using R+d-pad";
8
9static int menu_loop_cscaler(int id, int keys)
10{
11 unsigned int inp;
12
13 currentConfig.scaling = SCALE_CUSTOM;
14
15 pnd_setup_layer(1, g_layer_cx, g_layer_cy, g_layer_cw, g_layer_ch);
16 pnd_restore_layer_data();
17
18 for (;;)
19 {
20 menu_draw_begin(0, 1);
21 memset(g_menuscreen_ptr, 0, g_menuscreen_w * g_menuscreen_h * 2);
22 text_out16(2, 480 - 18, "%dx%d | d-pad to resize, R+d-pad to move", g_layer_cw, g_layer_ch);
23 menu_draw_end();
24
25 inp = in_menu_wait(PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT
26 |PBTN_R|PBTN_MOK|PBTN_MBACK, NULL, 40);
27 if (inp & PBTN_UP) g_layer_cy--;
28 if (inp & PBTN_DOWN) g_layer_cy++;
29 if (inp & PBTN_LEFT) g_layer_cx--;
30 if (inp & PBTN_RIGHT) g_layer_cx++;
31 if (!(inp & PBTN_R)) {
32 if (inp & PBTN_UP) g_layer_ch += 2;
33 if (inp & PBTN_DOWN) g_layer_ch -= 2;
34 if (inp & PBTN_LEFT) g_layer_cw += 2;
35 if (inp & PBTN_RIGHT) g_layer_cw -= 2;
36 }
37 if (inp & (PBTN_MOK|PBTN_MBACK))
38 break;
39
40 if (inp & (PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT)) {
41 if (g_layer_cx < 0) g_layer_cx = 0;
42 if (g_layer_cx > 640) g_layer_cx = 640;
43 if (g_layer_cy < 0) g_layer_cy = 0;
44 if (g_layer_cy > 420) g_layer_cy = 420;
45 if (g_layer_cw < 160) g_layer_cw = 160;
46 if (g_layer_ch < 60) g_layer_ch = 60;
47 if (g_layer_cx + g_layer_cw > 800)
48 g_layer_cw = 800 - g_layer_cx;
49 if (g_layer_cy + g_layer_ch > 480)
50 g_layer_ch = 480 - g_layer_cy;
51 pnd_setup_layer(1, g_layer_cx, g_layer_cy, g_layer_cw, g_layer_ch);
52 }
53 }
54
55 pnd_setup_layer(0, g_layer_cx, g_layer_cy, g_layer_cw, g_layer_ch);
56
57 return 0;
58}
59
60#define MENU_OPTIONS_GFX \
61 mee_enum_h ("Scaler", MA_OPT_SCALING, currentConfig.scaling, \
62 men_scaler, h_scaler), \
63 mee_onoff ("Vsync", MA_OPT2_VSYNC, currentConfig.EmuOpt, EOPT_VSYNC), \
64 mee_cust_h ("Setup custom scaler", MA_NONE, menu_loop_cscaler, NULL, h_cscaler), \
65 mee_range_hide("layer_x", MA_OPT3_LAYER_X, g_layer_cx, 0, 640), \
66 mee_range_hide("layer_y", MA_OPT3_LAYER_Y, g_layer_cy, 0, 420), \
67 mee_range_hide("layer_w", MA_OPT3_LAYER_W, g_layer_cw, 160, 800), \
68 mee_range_hide("layer_h", MA_OPT3_LAYER_H, g_layer_ch, 60, 480), \
69
70#define MENU_OPTIONS_ADV
71
72static menu_entry e_menu_gfx_options[];
73static menu_entry e_menu_options[];
74static menu_entry e_menu_keyconfig[];
75
76void pnd_menu_init(void)
77{
78 me_enable(e_menu_keyconfig, MA_CTRL_DEADZONE, 0);
79}
80