relicense common/menu.* to suit this project
[pcsx_rearmed.git] / frontend / common / menu.c
index a571ddd..22a66ea 100644 (file)
@@ -1,7 +1,12 @@
-// (c) Copyright 2006-2010 notaz, All rights reserved.\r
-// Free for non-commercial use.\r
-\r
-// For commercial use, separate licencing terms must be obtained.\r
+/*\r
+ * (C) GraÅžvydas "notaz" Ignotas, 2006-2010\r
+ *\r
+ * This work is licensed under the terms of any of these licenses\r
+ * (at your option):\r
+ *  - GNU GPL, version 2 or later.\r
+ *  - GNU LGPL, version 2.1 or later.\r
+ * See the COPYING file in the top-level directory.\r
+ */\r
 \r
 #include <stdio.h>\r
 #include <string.h>\r
@@ -341,26 +346,6 @@ static void menu_darken_bg(void *dst, void *src, int pixels, int darker)
        }\r
 }\r
 \r
-static void menu_enter(int is_rom_loaded)\r
-{\r
-       if (is_rom_loaded)\r
-       {\r
-               // darken the active framebuffer\r
-               menu_darken_bg(g_menubg_ptr, g_menubg_src_ptr, g_menuscreen_w * g_menuscreen_h, 1);\r
-       }\r
-       else\r
-       {\r
-               char buff[256];\r
-\r
-               // should really only happen once, on startup..\r
-               emu_make_path(buff, "skin/background.png", sizeof(buff));\r
-               if (readpng(g_menubg_ptr, buff, READPNG_BG, g_menuscreen_w, g_menuscreen_h) < 0)\r
-                       memset(g_menubg_ptr, 0, g_menuscreen_w * g_menuscreen_h * 2);\r
-       }\r
-\r
-       plat_video_menu_enter(is_rom_loaded);\r
-}\r
-\r
 static int me_id2offset(const menu_entry *ent, menu_id id)\r
 {\r
        int i;\r
@@ -461,8 +446,11 @@ static void me_draw(const menu_entry *entries, int sel, void (*draw_more)(void))
                h = g_menuscreen_h;\r
        }\r
 \r
-       x = g_menuscreen_w  / 2 - w / 2;\r
+       x = g_menuscreen_w / 2 - w / 2;\r
        y = g_menuscreen_h / 2 - h / 2;\r
+#ifdef MENU_ALIGN_LEFT\r
+       if (x > 12) x = 12;\r
+#endif\r
 \r
        /* draw */\r
        menu_draw_begin(1);\r
@@ -511,7 +499,7 @@ static void me_draw(const menu_entry *entries, int sel, void (*draw_more)(void))
                                len = strlen(names[i]);\r
                                if (len > 10)\r
                                        offs = 10 - len - 2;\r
-                               if (i == *(int *)ent->var) {\r
+                               if (i == *(unsigned char *)ent->var) {\r
                                        text_out16(x + col2_offs + offs * me_mfont_w, y, "%s", names[i]);\r
                                        break;\r
                                }\r
@@ -670,7 +658,7 @@ static void draw_menu_credits(void (*draw_more)(void))
                p++;\r
        }\r
 \r
-       x = g_menuscreen_w  / 2 - w * me_mfont_w / 2;\r
+       x = g_menuscreen_w / 2 - w * me_mfont_w / 2;\r
        y = g_menuscreen_h / 2 - h * me_mfont_h / 2;\r
        if (x < 0) x = 0;\r
        if (y < 0) y = 0;\r
@@ -966,6 +954,10 @@ static void draw_savestate_menu(int menu_sel, int is_loading)
        if (x < 0) x = 0;\r
        y = g_menuscreen_h / 2 - h / 2;\r
        if (y < 0) y = 0;\r
+#ifdef MENU_ALIGN_LEFT\r
+       if (x > 12 + me_mfont_w * 2)\r
+               x = 12 + me_mfont_w * 2;\r
+#endif\r
 \r
        menu_draw_begin(1);\r
 \r