diff --git a/source/ngc/fileio/filesel.c b/source/ngc/fileio/filesel.c index 6f51a16..35cd799 100644 --- a/source/ngc/fileio/filesel.c +++ b/source/ngc/fileio/filesel.c @@ -112,7 +112,7 @@ int FileSelector(unsigned char *buffer) { if (redraw) ShowFiles (offset, selection); redraw = 0; - p = ogc_input__getMenuButtons(); + p = ogc_input__getMenuButtons(0); /* scroll displayed filename */ if (p & PAD_BUTTON_LEFT) diff --git a/source/ngc/gui/font.c b/source/ngc/gui/font.c index c363fd4..ced5181 100644 --- a/source/ngc/gui/font.c +++ b/source/ngc/gui/font.c @@ -87,7 +87,7 @@ int FONT_Init(void) return 0; } -static void DrawChar(unsigned char c, u32 xpos, u32 ypos, u32 size) +static void DrawChar(unsigned char c, int xpos, int ypos, int size) { s32 width; @@ -152,10 +152,10 @@ void WriteCentre_HL( int y, char *string) DrawTexture(&texture, 0, y-fheight, 640, fheight); } -void FONT_WriteLeft(char *string, u16 size, u16 x, u16 y) +void FONT_WriteLeft(char *string, int size, int x, int y) { - x -= (vmode->fbWidth/2); - y -= (vmode->efbHeight/2); + x -= (vmode->fbWidth / 2); + y -= (vmode->efbHeight / 2); while (*string) { @@ -164,7 +164,7 @@ void FONT_WriteLeft(char *string, u16 size, u16 x, u16 y) } } -void FONT_WriteRight(char *string, u16 size, u16 x, u16 y) +void FONT_WriteRight(char *string, int size, int x, int y) { int i; u16 width = 0; @@ -182,7 +182,7 @@ void FONT_WriteRight(char *string, u16 size, u16 x, u16 y) } } -void FONT_WriteCenter(char *string, u16 size, u16 x1, u16 x2, u16 y) +void FONT_WriteCenter(char *string, int size, int x1, int x2, int y) { int i; u16 width = 0; @@ -417,7 +417,7 @@ void OpenPNGFromMemory(png_texture *texture, const u8 *buffer) DCFlushRange(texture->data, height * stride); } -void DrawTexture(png_texture *texture, u32 xOrigin, u32 yOrigin, u32 w, u32 h) +void DrawTexture(png_texture *texture, int x, int y, int w, int h) { if (texture->data) { @@ -429,19 +429,19 @@ void DrawTexture(png_texture *texture, u32 xOrigin, u32 yOrigin, u32 w, u32 h) GX_InvalidateTexAll(); DCFlushRange(texture->data, texture->width * texture->height * 4); - /* current coordinate system */ - xOrigin -= (vmode->fbWidth/2); - yOrigin -= (vmode->efbHeight/2); + /* adjust coordinate system */ + x -= (vmode->fbWidth/2); + y -= (vmode->efbHeight/2); /* Draw textured quad */ GX_Begin(GX_QUADS, GX_VTXFMT0, 4); - GX_Position2s16(xOrigin,yOrigin+h); + GX_Position2s16(x,y+h); GX_TexCoord2f32(0.0, 1.0); - GX_Position2s16(xOrigin+w,yOrigin+h); + GX_Position2s16(x+w,y+h); GX_TexCoord2f32(1.0, 1.0); - GX_Position2s16(xOrigin+w,yOrigin); + GX_Position2s16(x+w,y); GX_TexCoord2f32(1.0, 0.0); - GX_Position2s16(xOrigin,yOrigin); + GX_Position2s16(x,y); GX_TexCoord2f32(0.0, 0.0); GX_End (); GX_DrawDone(); @@ -476,9 +476,9 @@ void ClearScreen (GXColor color) void WaitButtonA () { - s16 p = ogc_input__getMenuButtons(); - while (p & PAD_BUTTON_A) p = ogc_input__getMenuButtons(); - while (!(p & PAD_BUTTON_A)) p = ogc_input__getMenuButtons(); + s16 p = ogc_input__getMenuButtons(0); + while (p & PAD_BUTTON_A) p = ogc_input__getMenuButtons(0); + while (!(p & PAD_BUTTON_A)) p = ogc_input__getMenuButtons(0); } void WaitPrompt (char *msg) diff --git a/source/ngc/gui/font.h b/source/ngc/gui/font.h index 797b630..abf3355 100644 --- a/source/ngc/gui/font.h +++ b/source/ngc/gui/font.h @@ -37,18 +37,18 @@ typedef struct } png_texture; extern void OpenPNGFromMemory(png_texture *texture, const u8 *buffer); -extern void DrawTexture(png_texture *texture, u32 xOrigin, u32 yOrigin, u32 w, u32 h); +extern void DrawTexture(png_texture *texture, int x, int y, int w, int h); -extern int FONT_Init(void); -void FONT_WriteLeft(char *string, u16 size, u16 x, u16 y); -void FONT_WriteRight(char *string, u16 size, u16 x, u16 y); -void FONT_WriteCenter(char *string, u16 size, u16 x1, u16 x2, u16 y); +extern int FONT_Init(void); +extern void FONT_WriteLeft(char *string, int size, int x, int y); +extern void FONT_WriteRight(char *string, int size, int x, int y); +extern void FONT_WriteCenter(char *string, int size, int x1, int x2, int y); extern void WriteCentre_HL( int y, char *string); extern void WriteCentre (int y, char *string); extern void write_font (int x, int y, char *string); -extern void WriteText(char *text, u16 size, u16 x, u16 y); +extern void WriteText(char *text, int size, int x, int y); extern void WaitPrompt (char *msg); extern void ShowAction (char *msg); extern void WaitButtonA (); diff --git a/source/ngc/gui/ggentry.c b/source/ngc/gui/ggentry.c index 3d984c2..62424f8 100644 --- a/source/ngc/gui/ggentry.c +++ b/source/ngc/gui/ggentry.c @@ -220,7 +220,7 @@ void GGEditLine () redraw = 0; } - p = ogc_input__getMenuButtons(); + p = ogc_input__getMenuButtons(0); if (p & PAD_BUTTON_UP) { @@ -293,7 +293,7 @@ void GGSelectLine () redraw = 0; } - j = ogc_input__getMenuButtons(); + j = ogc_input__getMenuButtons(0); if (j & PAD_BUTTON_UP) { diff --git a/source/ngc/gui/legal.c b/source/ngc/gui/legal.c index a278a27..7b38052 100644 --- a/source/ngc/gui/legal.c +++ b/source/ngc/gui/legal.c @@ -73,7 +73,7 @@ void legal () WriteCentre (ypos, "Press A to skip intro"); SetScreen (); sleep (2); - if (ogc_input__getMenuButtons() & PAD_BUTTON_A) return; + if (ogc_input__getMenuButtons(0) & PAD_BUTTON_A) return; ClearScreen((GXColor)BLACK); diff --git a/source/ngc/gui/menu.c b/source/ngc/gui/menu.c index 431c661..cf3c2f2 100644 --- a/source/ngc/gui/menu.c +++ b/source/ngc/gui/menu.c @@ -50,9 +50,6 @@ #include "Load_recent.h" #include "Load_sd.h" #include "Load_dvd.h" -#ifdef HW_RVL -#include "Load_usb.h" -#endif #include "Button_text.h" #include "Button_text_over.h" @@ -60,10 +57,14 @@ #include "Button_icon_over.h" #include "Button_up.h" #include "Button_down.h" +#include "Button_up_over.h" +#include "Button_down_over.h" #ifdef HW_RVL +#include "Load_usb.h" #include "Key_A_wii.h" #include "Key_B_wii.h" +#include "generic_point.h" #else #include "Key_A_gcn.h" #include "Key_B_gcn.h" @@ -79,405 +80,767 @@ /* Generic GUI structures */ /*****************************************************************************/ +/* Controller inputs structure */ +typedef struct +{ + u16 keys; +#ifdef HW_RVL + struct ir_t ir; +} gui_input; + /* Item descriptor*/ typedef struct { - const u8 *data; /* pointer to button image data (items icon only) */ - char text[32]; /* item string (items list only) */ - char comment[64]; /* item comment */ - u16 x; /* button image or text X position (upper left corner) */ - u16 y; /* button image or text Y position (upper left corner) */ - u16 w; /* button image or text width */ - u16 h; /* button image or text height */ + png_texture *texture; /* temporary texture data */ + const u8 *data; /* pointer to png image data (items icon only) */ + const char *text; /* item string (items list only) */ + char *comment; /* item comment */ + u16 x; /* button image or text X position (upper left corner) */ + u16 y; /* button image or text Y position (upper left corner) */ + u16 w; /* button image or text width */ + u16 h; /* button image or text height */ } gui_item; -/* Button descriptor*/ +/* Button descriptor */ typedef struct { - const u8 *img_norm; /* pointer to button image data (default) */ - const u8 *img_over; /* pointer to button image data (selected) */ - u16 x; /* button image X position (upper left corner) */ - u16 y; /* button image Y position (upper left corner) */ - u16 w; /* button image pixels width */ - u16 h; /* button image pixels height */ + png_texture *texture[2]; /* temporary texture datas */ + const u8 *image[2]; /* pointer to png image datas (default) */ +} butn_data; + +/* Button descriptor */ +typedef struct +{ + butn_data *data; /* pointer to button image/texture data */ + u16 x; /* button image X position (upper left corner) */ + u16 y; /* button image Y position (upper left corner) */ + u16 w; /* button image pixels width */ + u16 h; /* button image pixels height */ } gui_butn; +/* Image descriptor */ +typedef struct +{ + png_texture *texture; /* temporary texture data */ + const u8 *data; /* pointer to png image data */ + u16 x; /* button image or text X position (upper left corner) */ + u16 y; /* button image or text Y position (upper left corner) */ + u16 w; /* button image or text width */ + u16 h; /* button image or text height */ +} gui_image; /* Menu descriptor */ typedef struct { - s8 selected; /* index of selected item */ - u8 shift; /* number of items by line */ - u8 offset; /* items list offset */ - u8 max_items; /* total number of items */ - u8 max_buttons; /* total number of buttons (not necessary identical) */ - gui_item *items; /* pointer to the menu items table */ - gui_butn *buttons; /* pointer to the menu buttons table */ - char *title; - const u8 *banner_bottom; - const u8 *banner_top; - const u8 *back_image; - u16 back_x; - u16 back_y; - gui_item *helper[2]; - s32 (*callback)(int num); /* selection callback */ + char *title; /* menu title */ + s8 selected; /* index of selected item */ + u8 shift; /* number of items by line */ + u8 offset; /* items list offset */ + u8 max_items; /* total number of items */ + u8 max_buttons; /* total number of buttons (not necessary identical) */ + gui_item *items; /* menu items table */ + gui_butn *buttons; /* menu buttons table */ + gui_image *frames[2]; /* top and bottom frames */ + gui_image *background; /* background image */ + gui_image *logo; /* logo image */ + gui_item *helper[2]; /* key helpers */ + gui_butn *arrows[2]; /* items list arrows */ } gui_menu; +#ifdef HW_RVL +static png_texture w_pointer = {0,0,0,0}; +#endif + +static gui_input m_input; /*****************************************************************************/ -/* Menu Items description */ +/* Generic Images */ +/*****************************************************************************/ +static gui_image logo_main = +{ + NULL,Main_logo,204,372,232,56 +}; + +static gui_image logo_small = +{ + NULL,Main_logo,466,40,152,44 +}; + +static gui_image top_frame = +{ + NULL,Banner_top,0,0,640,108 +}; + +static gui_image bottom_frame = +{ + NULL,Banner_top,0,388,640,92 +}; + +static gui_image main_frame = +{ + NULL,Banner_top,0,356,640,124 +}; + +static gui_image background_center = +{ + NULL,Background_main,146,74,348,288 +}; + +static gui_image background_right = +{ + NULL,Background_main,368,132,348,288 +}; + +/*****************************************************************************/ +/* Shared buttons data */ +/*****************************************************************************/ +static butn_data arrow_up_data = +{ + {NULL,NULL}, + {Button_up,Button_up_over} +}; + +static butn_data arrow_down_data = +{ + {NULL,NULL}, + {Button_down,Button_down_over} +}; + +static butn_data button_text_data = +{ + {NULL,NULL}, + {Button_text,Button_text_over} +}; + +static butn_data button_icon_data = +{ + {NULL,NULL}, + {Button_icon,Button_icon_over} +}; + +/*****************************************************************************/ +/* Generic Arrow Buttons */ +/*****************************************************************************/ +static gui_butn arrow_up = +{ + &arrow_up_data,172,82,36,36 +}; + +static gui_butn arrow_down = +{ + &arrow_down_data,172,360,36,36 +}; + +/*****************************************************************************/ +/* Generic Items */ /*****************************************************************************/ static gui_item action_cancel = { #ifdef HW_RVL - Key_B_wii, + NULL,Key_B_wii,NULL,"Back to previous",10,422,28,28 #else - Key_B_gcn, + NULL,Key_B_gcn,NULL,"Back to previous",10,422,28,28 #endif - "", - "Back to previous", - 10,422,28,28 }; static gui_item action_select = { #ifdef HW_RVL - Key_A_wii, + NULL,Key_A_wii,NULL,"Select",602,422,28,28 #else - Key_A_gcn, + NULL,Key_A_gcn,NULL,"Select",602,422,28,28 #endif - "", - "Select", - 602,422,28,28 }; static gui_item action_exit = { - Key_home, - "", - "Exit", - 10,388,24,24 + NULL,Key_home,NULL,"Exit",10,388,24,24 }; + +/*****************************************************************************/ +/* Menu Items description */ +/*****************************************************************************/ + +/* Audio options menu */ static gui_item items_audio[5] = { - {NULL,"PSG Volume: 2.50", "Adjust PSG output level", 0,0,0,0}, - {NULL,"FM Volume: 1.00", "Adjust FM output level", 0,0,0,0}, - {NULL,"Volume Boost: 1X", "Adjust general output level", 0,0,0,0}, - {NULL,"LowPass Filter: ON", "Enable/disable sound filtering", 0,0,0,0}, - {NULL,"HQ YM2612: SINC", "Adjust FM emulation accuracy level", 0,0,0,0} + {NULL,NULL,"PSG Volume:", "Adjust PSG output level", 0,0,0,0}, + {NULL,NULL,"FM Volume:", "Adjust FM output level", 0,0,0,0}, + {NULL,NULL,"Volume Boost:", "Adjust general output level", 0,0,0,0}, + {NULL,NULL,"LowPass Filter:","Enable/disable sound filtering", 0,0,0,0}, + {NULL,NULL,"HQ YM2612:", "Adjust FM emulation accuracy level",0,0,0,0} }; +/* System options menu */ static gui_item items_system[6] = { - {NULL,"Console Region: AUTO", "Set system region", 0,0,0,0}, - {NULL,"System Lockups: OFF", "Enable/disable original system lock-ups",0,0,0,0}, - {NULL,"System BIOS: OFF", "Enable/disable TMSS BIOS support", 0,0,0,0}, - {NULL,"SVP Cycles: 950", "Adjust SVP chip emulation speed", 0,0,0,0}, - {NULL,"Auto SRAM: FAT", "Enable/disable automatic SRAM", 0,0,0,0}, - {NULL,"Auto STATE: FAT", "Enable/disable automatic Freeze State", 0,0,0,0} + {NULL,NULL,"Console Region:","Select system region", 0,0,0,0}, + {NULL,NULL,"System Lockups:","Enable/disable original system lock-ups",0,0,0,0}, + {NULL,NULL,"System BIOS:", "Enable/disable TMSS BIOS support", 0,0,0,0}, + {NULL,NULL,"SVP Cycles", "Adjust SVP chip emulation speed", 0,0,0,0}, + {NULL,NULL,"Auto SRAM", "Enable/disable automatic SRAM", 0,0,0,0}, + {NULL,NULL,"Auto STATE", "Enable/disable automatic Freeze State", 0,0,0,0} }; +/* Video options menu */ static gui_item items_video[8] = { - {NULL,"Aspect Ratio: ORIGINAL", "Set display aspect ratio", 0,0,0,0}, - {NULL,"Display: PROGRESSIVE", "Set video mode type", 0,0,0,0}, - {NULL,"TV mode: AUTO", "Set video refresh rate", 0,0,0,0}, - {NULL,"Bilinear Filter: OFF", "Enable/disable hardware filtering", 0,0,0,0}, - {NULL,"NTSC Filter: OFF", "Enable/disable NTSC software filtering", 0,0,0,0}, - {NULL,"Borders: ON", "Enable/disable original overscan emulation", 0,0,0,0}, - {NULL,"DISPLAY POSITION", "Adjust display position", 0,0,0,0}, - {NULL,"DISPLAY SIZE", "Adjust display size", 0,0,0,0} + {NULL,NULL,"Aspect Ratio:", "Select display aspect ratio", 0,0,0,0}, + {NULL,NULL,"Display:", "Select video mode type", 0,0,0,0}, + {NULL,NULL,"TV mode:", "Select video refresh rate", 0,0,0,0}, + {NULL,NULL,"Bilinear Filter:","Enable/disable hardware filtering", 0,0,0,0}, + {NULL,NULL,"NTSC Filter:", "Enable/disable NTSC software filtering", 0,0,0,0}, + {NULL,NULL,"Borders:", "Enable/disable original overscan emulation",0,0,0,0}, + {NULL,NULL,"DISPLAY POSITION","Adjust display position", 0,0,0,0}, + {NULL,NULL,"DISPLAY SIZE", "Adjust display size", 0,0,0,0} }; +/* Main menu */ static gui_item items_main[6] = { - {&Main_play[0] , "", "", 108, 76, 92, 88}, - {&Main_load[0] , "", "", 280, 72, 80, 92}, - {&Main_options[0], "", "", 456, 76, 60, 88}, - {&Main_file[0] , "", "", 114, 216, 80, 92}, - {&Main_reset[0] , "", "", 282, 224, 76, 84}, - {&Main_info[0] , "", "", 446, 212, 88, 96} + {NULL,Main_play ,NULL,NULL,108, 76,92,88}, + {NULL,Main_load ,NULL,NULL,280, 72,80,92}, + {NULL,Main_options,NULL,NULL,456, 76,60,88}, + {NULL,Main_file ,NULL,NULL,114,216,80,92}, + {NULL,Main_reset ,NULL,NULL,282,224,76,84}, + {NULL,Main_info ,NULL,NULL,446,212,88,96} }; #ifdef HW_RVL static gui_item items_load[4] = { - {&Load_recent[0], "", "Load recent files", 276, 120, 88, 96}, - {&Load_sd[0] , "", "Load ROM files from SDCARD device",110, 266, 88, 96}, - {&Load_usb[0] , "", "Load ROM files from USB device", 276, 266, 88, 96}, - {&Load_dvd[0] , "", "Load ROM files from DVD", 442, 266, 88, 96}, + {NULL,Load_recent,NULL,"Load recent files", 276,120,88,96}, + {NULL,Load_sd ,NULL,"Load ROM files from SDCARD", 110,266,88,96}, + {NULL,Load_usb ,NULL,"Load ROM files from USB device",276,266,88,96}, + {NULL,Load_dvd ,NULL,"Load ROM files from DVD", 442,266,88,96} }; #else static gui_item items_load[3] = { - {&Load_recent[0], "", "Load recent files", 110, 198, 88, 96}, - {&Load_sd[0] , "", "Load ROM files from SDCARD device", 276, 198, 88, 96}, - {&Load_dvd[0] , "", "Load ROM files from DVD", 442, 198, 88, 96}, + {NULL,Load_recent,NULL,"Load recent files", 110,198,88,96}, + {NULL,Load_sd ,NULL,"Load ROM files from SDCARD",276,198,88,96}, + {NULL,Load_dvd ,NULL,"Load ROM files from DVD", 442,198,88,96} }; #endif static gui_item items_options[5] = { - {&Option_system[0], "", "Configure System settings", 114, 142, 80, 92}, - {&Option_video[0] , "", "Configure Video settings", 288, 150, 64, 84}, - {&Option_sound[0] , "", "Configure Audio settings", 464, 154, 44, 80}, - {&Option_ctrl[0] , "", "Configure Input settings", 192, 286, 88, 92}, - {&Option_ggenie[0], "", "Configure Game Genie Codes", 360, 282, 88, 96}, + {NULL,Option_system,NULL,"Configure System settings", 114,142,80,92}, + {NULL,Option_video ,NULL,"Configure Video settings", 288,150,64,84}, + {NULL,Option_sound ,NULL,"Configure Audio settings", 464,154,44,80}, + {NULL,Option_ctrl ,NULL,"Configure Input settings", 192,286,88,92}, + {NULL,Option_ggenie,NULL,"Configure Game Genie Codes",360,282,88,96} }; - /*****************************************************************************/ /* Menu Buttons description */ /*****************************************************************************/ +/* Generic list menu */ static gui_butn buttons_generic[4] = { - {&Button_text[0], &Button_text_over[0], 52, 132, 276, 48}, - {&Button_text[0], &Button_text_over[0], 52, 188, 276, 48}, - {&Button_text[0], &Button_text_over[0], 52, 244, 276, 48}, - {&Button_text[0], &Button_text_over[0], 52, 300, 276, 48} + &button_text_data,52,132,276,48}, + &button_text_data,52,188,276,48}, + &button_text_data,52,244,276,48}, + &button_text_data,52,300,276,48}, }; +/* Main menu */ static gui_butn buttons_main[6] = { - {&Button_icon[0], &Button_icon_over[0], 80, 50, 148, 132}, - {&Button_icon[0], &Button_icon_over[0], 246, 50, 148, 132}, - {&Button_icon[0], &Button_icon_over[0], 412, 50, 148, 132}, - {&Button_icon[0], &Button_icon_over[0], 80, 194, 148, 132}, - {&Button_icon[0], &Button_icon_over[0], 246, 194, 148, 132}, - {&Button_icon[0], &Button_icon_over[0], 412, 194, 148, 132} + &button_icon_data, 80, 50,148,132}, + &button_icon_data,246, 50,148,132}, + &button_icon_data,412, 50,148,132}, + &button_icon_data, 80,194,148,132}, + &button_icon_data,246,194,148,132}, + &button_icon_data,412,194,148,132} }; +/* Load Game menu */ #ifdef HW_RVL static gui_butn buttons_load[4] = { - {&Button_icon[0], &Button_icon_over[0], 246, 102, 148, 132}, - {&Button_icon[0], &Button_icon_over[0], 80, 248, 148, 132}, - {&Button_icon[0], &Button_icon_over[0], 246, 248, 148, 132}, - {&Button_icon[0], &Button_icon_over[0], 412, 248, 148, 132} -}; + &button_icon_data,246,102,148,132}, + &button_icon_data, 80,248,148,132}, + &button_icon_data,246,248,148,132}, + &button_icon_data,412,248,148,132} #else static gui_butn buttons_load[3] = { - {&Button_icon[0], &Button_icon_over[0], 80, 180, 148, 132}, - {&Button_icon[0], &Button_icon_over[0], 246, 180, 148, 132}, - {&Button_icon[0], &Button_icon_over[0], 412, 180, 148, 132} + &button_icon_data, 80,180,148,132}, + &button_icon_data,246,180,148,132}, + &button_icon_data,412,180,148,132} }; #endif +/* Options menu */ static gui_butn buttons_options[5] = { - {&Button_icon[0], &Button_icon_over[0], 80, 120, 148, 132}, - {&Button_icon[0], &Button_icon_over[0], 246, 120, 148, 132}, - {&Button_icon[0], &Button_icon_over[0], 412, 120, 148, 132}, - {&Button_icon[0], &Button_icon_over[0], 162, 264, 148, 132}, - {&Button_icon[0], &Button_icon_over[0], 330, 264, 148, 132} + &button_icon_data, 80,120,148,132}, + &button_icon_data,246,120,148,132}, + &button_icon_data,412,120,148,132}, + &button_icon_data,162,264,148,132}, + &button_icon_data,330,264,148,132} }; /*****************************************************************************/ -/* Menus description */ +/* Menu descriptions */ /*****************************************************************************/ -gui_menu menu_main = + +/* Main menu */ +static gui_menu menu_main = { - 0,3,0,6,6, + NULL, + 0,0,6,6,3, items_main, buttons_main, NULL, - Banner_main, - NULL, - Background_main,146,24, - {&action_exit, NULL}, - NULL + &logo_main, + {NULL,&main_frame}, + {&action_exit,NULL}, + {NULL,NULL} }; -gui_menu menu_load = +/* Load Game menu */ +static gui_menu menu_load = { + "Load Game", #ifdef HW_RVL - 0,3,0,4,4, + 0,0,4,4,3, #else - 0,0,0,3,3, + 0,0,3,3,0, #endif items_load, buttons_load, - "Load Game", - Banner_bottom, - Banner_top, - Background_main,146,74, + &background_center, + &logo_small, + {&top_frame,&bottom_frame}, {&action_cancel, &action_select}, - NULL + {NULL, NULL} }; -gui_menu menu_options = +/* Options menu */ +static gui_menu menu_options = { - 0,3,0,5,5, + "Emulator Settings", + 0,0,5,5,3, items_options, buttons_options, - "Emulator Options", - Banner_bottom, - Banner_top, - Background_main,146,74, + &background_center, + &logo_small, + {&top_frame,&bottom_frame}, {&action_cancel, &action_select}, - NULL + {NULL, NULL} }; -gui_menu menu_system = +/* System Options menu */ +static gui_menu menu_system = { - 0,1,0,6,4, + "System Options", + 0,0,6,4,1, items_system, buttons_generic, - "System Options", - Banner_bottom, - Banner_top, - Background_main,368,132, + &background_right, + &logo_small, + {&top_frame,&bottom_frame}, {&action_cancel, &action_select}, - NULL + {NULL, NULL} }; -gui_menu menu_video = +/* Video Options menu */ +static gui_menu menu_video = { - 0,1,0,8,4, + "Video Options", + 0,0,8,4,1, items_video, buttons_generic, - "Video Options", - Banner_bottom, - Banner_top, - Background_main,368,132, + &background_right, + &logo_small, + {&top_frame,&bottom_frame}, {&action_cancel, &action_select}, - NULL + {NULL, NULL} }; -gui_menu menu_audio = +/* Sound Options menu */ +static gui_menu menu_audio = { - 0,1,0,5,4, + "Sound Options", + 0,0,5,4,1, items_audio, buttons_generic, - "Sound Options", - Banner_bottom, - Banner_top, - Background_main,368,132, + &background_right, + &logo_small, + {&top_frame,&bottom_frame}, {&action_cancel, &action_select}, - NULL + {NULL, NULL} }; /*****************************************************************************/ /* Generic GUI routines */ /*****************************************************************************/ -void MenuDraw(gui_menu *menu) +static void menu_initialize(gui_menu *menu) +{ + int i,j; + png_texture *texture; + gui_item *item; + gui_butn *button; + gui_image *image; + butn_data *button_data; + +#ifdef HW_RVL + /* allocate wiimote pointer data (only done once) */ + if (w_pointer.data == NULL) + { + OpenPNGFromMemory(&w_pointer, generic_point); + } +#endif + + /* allocate background image texture */ + if (menu->background) + { + texture = (png_texture *)malloc(sizeof(png_texture)); + if (texture) + { + image = menu->background; + OpenPNGFromMemory(texture, image->data); + image->texture = texture; + } + } + + /* allocate logo texture */ + if (menu->logo) + { + texture = (png_texture *)malloc(sizeof(png_texture)); + if (texture) + { + image = menu->logo; + OpenPNGFromMemory(texture, image->data); + image->texture = texture; + } + } + + /* allocate background elements textures */ + for (i=0; i<2; i++) + { + /* frames */ + if (menu->frames[i]) + { + texture = (png_texture *)malloc(sizeof(png_texture)); + if (texture) + { + image = menu->frames[i]; + OpenPNGFromMemory(texture, image->data); + image->texture = texture; + } + } + + /* key helpers */ + if (menu->helpers[i]) + { + texture = (png_texture *)malloc(sizeof(png_texture)); + if (texture) + { + image = menu->helpers[i]; + OpenPNGFromMemory(texture, image->data); + image->texture = texture; + } + } + + /* up/down buttons */ + if (menu->arrows[i]) + { + button_data = menu->arrows[i]->data; + texture = (png_texture *)malloc(sizeof(png_texture)); + if (texture) + { + OpenPNGFromMemory(texture, button_data->image); + button_data->texture = texture; + } + } + + /* menu buttons */ + for (j=0; jmax_buttons; j++) + { + button_data = menu->buttons[j]->data; + if (!button_data->texture[i]) + { + texture = (png_texture *)malloc(sizeof(png_texture)); + if (texture) + { + OpenPNGFromMemory(texture, buttons_data->image[i]); + buttons_data->texture[i] = texture; + } + } + } + } + + /* allocate item textures */ + for (i=0; imax_items; i++) + { + item = menu->items[i]; + if (item->data) + { + texture = (png_texture *)malloc(sizeof(png_texture)); + if (texture) + { + OpenPNGFromMemory(texture, item->data); + items->texture = texture; + } + } + } +} + +static void menu_delete(gui_menu *menu) +{ + int i,j; + png_texture *texture; + gui_item *item; + gui_butn *button; + gui_image *image; + butn_data *button_data; + + /* free background image texture */ + if (menu->background) + { + texture = menu->background->texture; + if (texture) + { + if (texture->data) free(texture.data); + free(texture); + } + } + + /* allocate logo texture */ + if (menu->logo) + { + texture = menu->logo->texture; + if (texture) + { + if (texture->data) free(texture.data); + free(texture); + } + } + + /* allocate background elements textures */ + for (i=0; i<2; i++) + { + /* frames */ + if (menu->frames[i]) + { + texture = menu->frames[i]->texture; + if (texture) + { + if (texture->data) free(texture.data); + free(texture); + texture = NULL; + } + } + + /* key helpers */ + if (menu->helpers[i]) + { + texture = menu->helpers[i]->texture; + if (texture) + { + if (texture->data) free(texture.data); + free(texture); + texture = NULL; + } + } + + /* up/down buttons */ + if (menu->arrows[i]) + { + texture = menu->arrows[i]->texture; + if (texture) + { + if (texture->data) free(texture.data); + free(texture); + texture = NULL; + } + } + + /* menu buttons */ + for (j=0; jmax_buttons; j++) + { + button_data = menu->buttons[j]->data; + texture = button_data->texture[i]; + if (texture) + { + if (texture->data) free(texture.data); + free(texture); + texture = NULL; + } + } + } + + /* allocate item textures */ + for (i=0; imax_items; i++) + { + texture = menu->items[i]->texture; + if (texture) + { + if (texture->data) free(texture.data); + free(texture); + texture = NULL; + } + } +} + +static void menu_draw(gui_menu *menu) { int i; gui_item *item; gui_butn *button; - - /* texture data */ - png_texture texture; - memset(&texture,0,sizeof(png_texture)); + gui_image *image; + /* clear EFB */ ClearScreen ((GXColor)BLACK); - /* background image */ - if (menu->back_image) + /* draw background image */ + image = menu->background; + if (image) DrawTexture(image->texture,image->x,image->y,image->w,image->h); + + /* draw logo */ + image = menu->logo; + if (image) DrawTexture(image->texture,image->x,image->y,image->w,image->h); + + /* draw title */ + if (menu->title) FONT_alignLeft(menu->title, 22,10,56); + + /* draw background frames */ + for (i=0; i<2; i++) { - OpenPNGFromMemory(&texture, menu->back_image); - DrawTexture(&texture, menu->back_x, menu->back_y, texture.width, texture.height); + image = menu->frames[i]; + if (image) DrawTexture(image->texture,image->x,image->y,image->w,image->h); } - /* bottom banner */ - if (menu->banner_bottom) + /* draw left helper */ + item = menu->helper[0]; + if (item) { - OpenPNGFromMemory(&texture, menu->banner_bottom); - DrawTexture(&texture, 0, 480-texture.height, texture.width, texture.height); + DrawTexture(item->texture, item->x, item->y, item->w, item->h); + FONT_alignLeft(item->comment, 16, item->x+item->w+6,item->y+(item->h-16)/2 + 16); } - /* top banner (incl. sub-menu title and logo) */ - if (menu->banner_top) + /* draw right helper */ + item = menu->helper[1]; + if (item) { - OpenPNGFromMemory(&texture, menu->banner_top); - DrawTexture(&texture, 0, 0, texture.width, texture.height); - OpenPNGFromMemory(&texture, Main_logo); - DrawTexture(&texture, 466, 40, 152, 44); - FONT_WriteLeft(menu->title, 22,10,56); - } - else - { - /* main logo */ - OpenPNGFromMemory(&texture, Main_logo); - DrawTexture(&texture, 204, 372, texture.width, texture.height); + DrawTexture(item->texture, item->x, item->y, item->w, item->h); + FONT_alignRight(item->comment, 16, item->x - 6, item->y+(item->h-16)/2 + 16); } - /* helpers */ - if (menu->helper[0]) - { - item = menu->helper[0]; - OpenPNGFromMemory(&texture, item->data); - DrawTexture(&texture, item->x, item->y, item->w, item->h); - FONT_WriteLeft(item->comment, 16, item->x+item->w+6,item->y+(item->h-16)/2 + 16); - } - - if (menu->helper[1]) - { - item = menu->helper[1]; - OpenPNGFromMemory(&texture, item->data); - DrawTexture(&texture, item->x, item->y, item->w, item->h); - FONT_WriteRight(item->comment, 16, item->x - 6, item->y+(item->h-16)/2 + 16); - } - - /* buttons + items */ + /* draw buttons + items */ for (i=0; imax_buttons; i++) { /* draw button */ button = &menu->buttons[i]; - if (i == menu->selected) OpenPNGFromMemory(&texture, button->img_over); - else OpenPNGFromMemory(&texture, button->img_norm); - DrawTexture(&texture, button->x, button->y, button->w, button->h); + DrawTexture(button->texture[i == menu->selected], button->x, button->y, button->w, button->h); /* draw item */ item = &menu->items[menu->offset +i]; - if (item->data) + if (item->texture) DrawTexture(item->texture, item->x, item->y, item->w, item->h); + else FONT_writeCenter(item->text, 18, button->x, button->x + button->w, button->y + (button->h - 18)/2 + 18); + } + + /* Arrows (Items list only) */ + for (i=0; i<2; i++) + { + button = menu->arrows[i]; + if (button) { - OpenPNGFromMemory(&texture, item->data); - DrawTexture(&texture, item->x, item->y, item->w, item->h); - } - else - { - FONT_WriteCenter(item->text, 18, button->x, button->x + button->w, button->y + (button->h - 18)/2 + 18); + if (menu->selected == menu->max_buttons + i) + { + DrawTexture(button->texture[1], button->x-2, button->y-2, button->w+4, button->h+4); + } + else + { + DrawTexture(button->texture[0], button->x, button->y, button->w, button->h); + } } } - /* draw arrows */ - if (menu->offset > 0) +#ifdef HW_RVL + if (m_input.ir.valid) { - OpenPNGFromMemory(&texture, Button_up); - DrawTexture(&texture, 172, 82, texture.width, texture.height); - } - if (menu->offset + menu->max_buttons < menu->max_items) - { - OpenPNGFromMemory(&texture, Button_down); - DrawTexture(&texture, 172, 362, texture.width, texture.height); + /* draw wiimote pointer */ + gxResetCamera(m_input.ir.angle); + DrawTexture(&w_pointer, m_input.ir.x, m_input.ir.y, w_pointer.width, w_pointer.height); + gxResetCamera(0.0); } +#endif + /* copy EFB to XFB */ SetScreen (); } -int MenuCall (gui_menu *menu) +static int menu_callback(gui_menu *menu) { - int redraw = 1; - short p; + u16 p; + +#ifdef HW_RVL + int i,x,y; + gui_butn *button; +#endif for(;;) { - if (redraw) - { - MenuDraw(menu); - redraw = 0; - } + menu_draw(menu); - p = ogc_input__getMenuButtons(); - - if (p & PAD_BUTTON_UP) + p = m_input.keys; + +#ifdef HW_RVL + if (Shutdown) + { + /* autosave SRAM/State */ + memfile_autosave(); + + /* shutdown Wii */ + DI_Close(); + SYS_ResetSystem(SYS_POWEROFF, 0, 0); + } + else if (m_input.ir.valid) + { + /* get cursor position */ + x = m_input.ir.x; + y = m_input.ir.y; + + /* check for valid buttons */ + for (i=0; imax_buttons; i++) + { + button = &menu->buttons[i]; + if ((x >= button->x) && (x <= (button->x + button->w)) && (y >= button->y) && (y <= (button->y + button->h))) + { + menu->selected = i; + break; + } + } + + /* no valid buttons */ + if (i == menu->max_buttons) + { + menu->selected = i + 2; + + /* check for arrow buttons */ + if (menu->arrows[0]) + { + button = menu->arrows[0]; + if ((x >= button->x) && (x <= (button->x + button->w)) && (y >= button->y) && (y <= (button->y + button->h))) + menu->selected = i; + } + if (menu->arrows[1]) + { + button = menu->arrows[1]; + if ((x >= button->x) && (x <= (button->x + button->w)) && (y >= button->y) && (y <= (button->y + button->h))) + menu->selected = i +1; + } + } + } + else if (p & PAD_BUTTON_UP) { - redraw = 1; if (menu->selected == 0) { if (menu->offset) menu->offset --; @@ -489,7 +852,6 @@ int MenuCall (gui_menu *menu) } else if (p & PAD_BUTTON_DOWN) { - redraw = 1; if (menu->selected == (menu->max_buttons -1)) { if ((menu->offset + menu->selected < (menu->max_items - 1))) menu->offset ++; @@ -499,9 +861,32 @@ int MenuCall (gui_menu *menu) menu->selected += menu->shift; } } +#else + if (p & PAD_BUTTON_UP) + { + if (menu->selected == 0) + { + if (menu->offset) menu->offset --; + } + else if (menu->selected >= menu->shift) + { + menu->selected -= menu->shift; + } + } + else if (p & PAD_BUTTON_DOWN) + { + if (menu->selected == (menu->max_buttons -1)) + { + if ((menu->offset + menu->selected < (menu->max_items - 1))) menu->offset ++; + } + else if ((menu->selected + menu->shift) < menu->max_buttons) + { + menu->selected += menu->shift; + } + } + #endif else if (p & PAD_BUTTON_LEFT) { - redraw = 1; if (menu->shift > 1) { menu->selected --; @@ -514,7 +899,6 @@ int MenuCall (gui_menu *menu) } else if (p & PAD_BUTTON_RIGHT) { - redraw = 1; if (menu->shift > 1) { menu->selected ++; @@ -528,15 +912,106 @@ int MenuCall (gui_menu *menu) if (p & PAD_BUTTON_A) { - return menu->selected; + if (menu->selected == menu->max_buttons) menu->offset --; + else if (menu->selected == menu->max_buttons + 1) menu->offset ++; + else if (menu->selected < menu->max_buttons) return (menu->offset + menu->selected); } else if (p & PAD_BUTTON_B) { return -1; } + + /* update arrows status (items list) */ + if (menu->offset > 0) + menu->arrows[0] = &arrow_up; + else + menu->arrows[0] = NULL; + + if (menu->offset + menu->max_buttons < menu->max_items) + menu->arrows[1] = &arrow_down; + else + menu->arrows[1] = NULL; + + /* update comment */ + if (menu->helper[1]) + { + gui_item *item = &menu->items[menu->offset + menu->selected]; + strcpy(menu->helper[1]->comment,item->comment); + } } } +void menu_update_inputs(u32 cnt) +{ + /* get gamepad inputs */ + PAD_ScanPads(); + u16 p = PAD_ButtonsDown(0); + s8 x = PAD_StickX(0); + s8 y = PAD_StickY(0); + if (x > 70) p |= PAD_BUTTON_RIGHT; + else if (x < -70) p |= PAD_BUTTON_LEFT; + if (y > 60) p |= PAD_BUTTON_UP; + else if (y < -60) p |= PAD_BUTTON_DOWN; + +#ifdef HW_RVL + /* get wiimote + expansions inputs */ + WPAD_ScanPads(); + u32 q = WPAD_ButtonsDown(0); + u32 h = WPAD_ButtonsHeld(0); + x = WPAD_StickX(0, 0); + y = WPAD_StickY(0, 0); + + /* Wiimote orientation */ + WPAD_IR(0, &M_inputs.ir); + + /* wiimote directions */ + if (m_inputs.ir.valid) + { + if (q & WPAD_BUTTON_UP) p |= PAD_BUTTON_UP; + else if (q & WPAD_BUTTON_DOWN) p |= PAD_BUTTON_DOWN; + else if (q & WPAD_BUTTON_LEFT) p |= PAD_BUTTON_LEFT; + else if (q & WPAD_BUTTON_RIGHT) p |= PAD_BUTTON_RIGHT; + } + else + { + if (q & WPAD_BUTTON_UP) p |= PAD_BUTTON_LEFT; + else if (q & WPAD_BUTTON_DOWN) p |= PAD_BUTTON_RIGHT; + else if (q & WPAD_BUTTON_LEFT) p |= PAD_BUTTON_DOWN; + else if (q & WPAD_BUTTON_RIGHT) p |= PAD_BUTTON_UP; + } + + /* analog sticks */ + if (y > 70) p |= PAD_BUTTON_UP; + else if (y < -70) p |= PAD_BUTTON_DOWN; + if (x < -60) p |= PAD_BUTTON_LEFT; + else if (x > 60) p |= PAD_BUTTON_RIGHT; + + /* classic controller directions */ + if (q & WPAD_CLASSIC_BUTTON_UP) p |= PAD_BUTTON_UP; + else if (q & WPAD_CLASSIC_BUTTON_DOWN) p |= PAD_BUTTON_DOWN; + if (q & WPAD_CLASSIC_BUTTON_LEFT) p |= PAD_BUTTON_LEFT; + else if (q & WPAD_CLASSIC_BUTTON_RIGHT) p |= PAD_BUTTON_RIGHT; + + /* wiimote keys */ + if (q & WPAD_BUTTON_MINUS) p |= PAD_TRIGGER_L; + if (q & WPAD_BUTTON_PLUS) p |= PAD_TRIGGER_R; + if (q & WPAD_BUTTON_A) p |= PAD_BUTTON_A; + if (q & WPAD_BUTTON_B) p |= PAD_BUTTON_B; + if (q & WPAD_BUTTON_2) p |= PAD_BUTTON_A; + if (q & WPAD_BUTTON_1) p |= PAD_BUTTON_B; + if (q & WPAD_BUTTON_HOME) p |= PAD_TRIGGER_Z; + + /* classic controller keys */ + if (q & WPAD_CLASSIC_BUTTON_FULL_L) p |= PAD_TRIGGER_L; + if (q & WPAD_CLASSIC_BUTTON_FULL_R) p |= PAD_TRIGGER_R; + if (q & WPAD_CLASSIC_BUTTON_A) p |= PAD_BUTTON_A; + if (q & WPAD_CLASSIC_BUTTON_B) p |= PAD_BUTTON_B; + if (q & WPAD_CLASSIC_BUTTON_HOME) p |= PAD_TRIGGER_Z; +#endif + + m_input.keys = p; +} + /*************************************************************************** * drawmenu * @@ -597,7 +1072,7 @@ int domenu (char items[][25], int maxitems, u8 fastmove) redraw = 0; } - p = ogc_input__getMenuButtons(); + p = ogc_input__getMenuButtons(0); if (p & PAD_BUTTON_UP) { @@ -1539,7 +2014,7 @@ void showrominfo () SetScreen (); } - p = ogc_input__getMenuButtons(); + p = ogc_input__getMenuButtons(0); redraw = 0; if ((j<(max-8)) && (p & PAD_BUTTON_DOWN)) {redraw = 1; j++;} @@ -1572,7 +2047,8 @@ void MainMenu (u32 fps) if (genromsize && (crccheck != sram.crc)) strcpy (menutitle, "*** SRAM has been modified ***"); else if (genromsize) sprintf (menutitle, "%d FPS",fps); - ret = MenuCall(&menu_main); + menu_initialize(&menu_main); + ret = menu_callback(&menu_main); switch (ret) { case -1: /*** Button B ***/ @@ -1606,6 +2082,7 @@ void MainMenu (u32 fps) case 6: /*** SD/PSO/TP Reload ***/ + menu_delete(&menu_main); memfile_autosave(); system_shutdown(); audio_shutdown(); @@ -1619,6 +2096,7 @@ void MainMenu (u32 fps) break; case 7: /*** Return to Wii System Menu ***/ + menu_delete(&menu_main); memfile_autosave(); system_shutdown(); audio_shutdown(); @@ -1635,6 +2113,8 @@ void MainMenu (u32 fps) } } + menu_delete(&menu_main); + /*** Remove any still held buttons ***/ while (PAD_ButtonsHeld(0)) PAD_ScanPads(); #ifdef HW_RVL diff --git a/source/ngc/ogc_input.c b/source/ngc/ogc_input.c index 16d0fc7..3cf07b1 100644 --- a/source/ngc/ogc_input.c +++ b/source/ngc/ogc_input.c @@ -74,9 +74,6 @@ static const u16 pad_keys[8] = #define PAD_LEFT 2 #define PAD_RIGHT 3 -#define MAX_HELD_CNT 15 -static int held_cnt = 0; - static u32 wpad_dirmap[3][4] = { {WPAD_BUTTON_RIGHT, WPAD_BUTTON_LEFT, WPAD_BUTTON_UP, WPAD_BUTTON_DOWN}, /* WIIMOTE only */ @@ -249,7 +246,7 @@ static void pad_update(s8 num, u8 i) #define PI 3.14159265f -static s8 WPAD_StickX(u8 chan,u8 right) +s8 WPAD_StickX(u8 chan,u8 right) { float mag = 0.0; float ang = 0.0; @@ -292,7 +289,7 @@ static s8 WPAD_StickX(u8 chan,u8 right) } -static s8 WPAD_StickY(u8 chan, u8 right) +s8 WPAD_StickY(u8 chan, u8 right) { float mag = 0.0; float ang = 0.0; @@ -739,124 +736,3 @@ void ogc_input__config(u8 num, u8 type, u8 padtype) break; } } - -u16 ogc_input__getMenuButtons(void) -{ - -#ifdef HW_RVL - extern u8 Shutdown; - if (Shutdown) - { - /* autosave SRAM/State */ - memfile_autosave(); - - /* shutdown Wii */ - DI_Close(); - SYS_ResetSystem(SYS_POWEROFF, 0, 0); - } -#endif - -/* slowdown input updates */ - VIDEO_WaitVSync(); - - /* get gamepad inputs */ - PAD_ScanPads(); - u16 p = PAD_ButtonsDown(0); - s8 x = PAD_StickX(0); - s8 y = PAD_StickY(0); - if (x > 70) p |= PAD_BUTTON_RIGHT; - else if (x < -70) p |= PAD_BUTTON_LEFT; - if (y > 60) p |= PAD_BUTTON_UP; - else if (y < -60) p |= PAD_BUTTON_DOWN; - -#ifdef HW_RVL - /* get wiimote + expansions inputs */ - WPAD_ScanPads(); - u32 q = WPAD_ButtonsDown(0); - u32 h = WPAD_ButtonsHeld(0); - x = WPAD_StickX(0, 0); - y = WPAD_StickY(0, 0); - - /* is Wiimote directed toward screen (horizontal/vertical orientation) ? */ - struct ir_t ir; - WPAD_IR(0, &ir); - - /* wiimote directions */ - if (q & WPAD_BUTTON_UP) p |= ir.valid ? PAD_BUTTON_UP : PAD_BUTTON_LEFT; - else if (q & WPAD_BUTTON_DOWN) p |= ir.valid ? PAD_BUTTON_DOWN : PAD_BUTTON_RIGHT; - else if (q & WPAD_BUTTON_LEFT) p |= ir.valid ? PAD_BUTTON_LEFT : PAD_BUTTON_DOWN; - else if (q & WPAD_BUTTON_RIGHT) p |= ir.valid ? PAD_BUTTON_RIGHT : PAD_BUTTON_UP; - - if (h & WPAD_BUTTON_UP) - { - held_cnt ++; - if (held_cnt == MAX_HELD_CNT) - { - held_cnt = MAX_HELD_CNT - 2; - p |= ir.valid ? PAD_BUTTON_UP : PAD_BUTTON_LEFT; - } - } - else if (h & WPAD_BUTTON_DOWN) - { - held_cnt ++; - if (held_cnt == MAX_HELD_CNT) - { - held_cnt = MAX_HELD_CNT - 2; - p |= ir.valid ? PAD_BUTTON_DOWN : PAD_BUTTON_RIGHT; - } - } - else if (h & WPAD_BUTTON_LEFT) - { - held_cnt ++; - if (held_cnt == MAX_HELD_CNT) - { - held_cnt = MAX_HELD_CNT - 2; - p |= ir.valid ? PAD_BUTTON_LEFT : PAD_BUTTON_DOWN; - } - } - else if (h & WPAD_BUTTON_RIGHT) - { - held_cnt ++; - if (held_cnt == MAX_HELD_CNT) - { - held_cnt = MAX_HELD_CNT - 2; - p |= ir.valid ? PAD_BUTTON_RIGHT : PAD_BUTTON_UP; - } - } - else - { - held_cnt = 0; - } - - /* analog sticks */ - if (y > 70) p |= PAD_BUTTON_UP; - else if (y < -70) p |= PAD_BUTTON_DOWN; - if (x < -60) p |= PAD_BUTTON_LEFT; - else if (x > 60) p |= PAD_BUTTON_RIGHT; - - /* classic controller directions */ - if (q & WPAD_CLASSIC_BUTTON_UP) p |= PAD_BUTTON_UP; - else if (q & WPAD_CLASSIC_BUTTON_DOWN) p |= PAD_BUTTON_DOWN; - if (q & WPAD_CLASSIC_BUTTON_LEFT) p |= PAD_BUTTON_LEFT; - else if (q & WPAD_CLASSIC_BUTTON_RIGHT) p |= PAD_BUTTON_RIGHT; - - /* wiimote keys */ - if (q & WPAD_BUTTON_MINUS) p |= PAD_TRIGGER_L; - if (q & WPAD_BUTTON_PLUS) p |= PAD_TRIGGER_R; - if (q & WPAD_BUTTON_A) p |= PAD_BUTTON_A; - if (q & WPAD_BUTTON_B) p |= PAD_BUTTON_B; - if (q & WPAD_BUTTON_2) p |= PAD_BUTTON_A; - if (q & WPAD_BUTTON_1) p |= PAD_BUTTON_B; - if (q & WPAD_BUTTON_HOME) p |= PAD_TRIGGER_Z; - - /* classic controller keys */ - if (q & WPAD_CLASSIC_BUTTON_FULL_L) p |= PAD_TRIGGER_L; - if (q & WPAD_CLASSIC_BUTTON_FULL_R) p |= PAD_TRIGGER_R; - if (q & WPAD_CLASSIC_BUTTON_A) p |= PAD_BUTTON_A; - if (q & WPAD_CLASSIC_BUTTON_B) p |= PAD_BUTTON_B; - if (q & WPAD_CLASSIC_BUTTON_HOME) p |= PAD_TRIGGER_Z; - -#endif - - return p; -} diff --git a/source/ngc/ogc_input.h b/source/ngc/ogc_input.h index e540715..27fe0f6 100644 --- a/source/ngc/ogc_input.h +++ b/source/ngc/ogc_input.h @@ -49,6 +49,8 @@ extern void ogc_input__init(void); extern void ogc_input__set_defaults(void); extern void ogc_input__update(void); extern void ogc_input__config(u8 num, u8 type, u8 padtype); -extern u16 ogc_input__getMenuButtons(void); + +extern s8 WPAD_StickX(u8 chan,u8 right); +extern s8 WPAD_StickY(u8 chan,u8 right); #endif diff --git a/source/ngc/ogc_video.c b/source/ngc/ogc_video.c index 0aeda3f..7806436 100644 --- a/source/ngc/ogc_video.c +++ b/source/ngc/ogc_video.c @@ -386,6 +386,7 @@ static void gxResetVtx(bool isMenu) GX_Flush(); } + /* Reset GX 2D rendering */ static void gxResetView(GXRModeObj *tvmode) { @@ -515,6 +516,28 @@ static void VSyncCallback(u32 cnt) frameticker++; } +void gxResetCamera(f32 angle) +{ + Mtx view; + + if (angle) + { + Mtx m,m1; + Vector axis = (Vector) {0,0,1}; + guLookAt(m, &cam.pos, &cam.up, &cam.view); + guMtxRotAxisDeg (m1, &axis, angle); + guMtxConcat(m,m1,view); + } + else + { + guLookAt(view, &cam.pos, &cam.up, &cam.view); + } + + GX_LoadPosMtxImm(view, GX_PNMTX0); + GX_Flush(); +} + + /* Restore Menu Video mode */ void ogc_video__stop(void) { @@ -591,6 +614,18 @@ void ogc_video__start(void) } +static GXTexObj texobj; + +void ogc_video_caption(void) +{ + gxResetVtx(0); + GX_LoadTexObj(&texobj, GX_TEXMAP0); + GX_InvalidateTexAll(); + draw_square(); + GX_DrawDone(); + gxResetVtx(1); +} + /* GX render update */ void ogc_video__update(void) { @@ -612,7 +647,6 @@ void ogc_video__update(void) vheight = (vheight >> 2) << 2; /* initialize texture object */ - GXTexObj texobj; GX_InitTexObj(&texobj, texturemem, vwidth, vheight, GX_TF_RGB565, GX_CLAMP, GX_CLAMP, GX_FALSE); /* configure texture filtering */ diff --git a/source/ngc/ogc_video.h b/source/ngc/ogc_video.h index ecb08ad..4a8bc2b 100644 --- a/source/ngc/ogc_video.h +++ b/source/ngc/ogc_video.h @@ -34,5 +34,9 @@ extern void ogc_video__init(void); extern void ogc_video__start(void); extern void ogc_video__stop(void); extern void ogc_video__update(void); +extern void ogc_video_caption(void); +extern void gxResetCamera(f32 angle); + + #endif diff --git a/source/ngc/osd.h b/source/ngc/osd.h index 21677d3..417433e 100644 --- a/source/ngc/osd.h +++ b/source/ngc/osd.h @@ -34,4 +34,8 @@ extern void memfile_autoload(); extern u8 fat_enabled; extern u32 frameticker; +#ifdef HW_RVL +extern u8 Shutdown; +#endif + #endif /* _OSD_H_ */ diff --git a/source/ngc/png/generic_point.c b/source/ngc/png/generic_point.c new file mode 100644 index 0000000..0505e39 --- /dev/null +++ b/source/ngc/png/generic_point.c @@ -0,0 +1,146 @@ +/* + This file was autogenerated by raw2c. +Visit http://www.devkitpro.org +*/ + +const unsigned char generic_point[] = { + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x08, 0x06, 0x00, 0x00, 0x00, 0xe2, 0x98, 0x77, + 0x38, 0x00, 0x00, 0x00, 0x19, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, + 0x65, 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x61, + 0x64, 0x79, 0x71, 0xc9, 0x65, 0x3c, 0x00, 0x00, 0x08, 0x3a, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, + 0xec, 0x5c, 0x6b, 0x6c, 0x14, 0x55, 0x14, 0x3e, 0x33, 0xdb, 0x6e, 0xdb, 0xd0, 0xf2, 0xa8, 0x14, + 0x0a, 0x85, 0x2a, 0x52, 0x02, 0x2d, 0xa1, 0x40, 0x53, 0x53, 0x4d, 0xad, 0x40, 0x81, 0xd0, 0x10, + 0xfc, 0x51, 0x02, 0x84, 0xa4, 0x51, 0x52, 0xa2, 0x55, 0xc3, 0xc3, 0x84, 0x7f, 0xfa, 0xa7, 0x24, + 0x44, 0x7e, 0x90, 0x68, 0x54, 0x14, 0x15, 0x4d, 0x8d, 0x68, 0x0c, 0x8a, 0x69, 0x34, 0x8a, 0x14, + 0x7e, 0x50, 0x24, 0x68, 0x21, 0xa0, 0x28, 0x1a, 0xc1, 0x20, 0x44, 0x08, 0xa0, 0x48, 0xe4, 0x91, + 0xbe, 0x68, 0x77, 0x67, 0xae, 0xe7, 0xdc, 0xb9, 0xb3, 0x9d, 0xd9, 0x4e, 0xd7, 0x52, 0x77, 0xcb, + 0x2e, 0x73, 0x4e, 0xf2, 0xed, 0xde, 0xb9, 0x77, 0x5e, 0x7b, 0xbe, 0x7b, 0xce, 0x3d, 0xf7, 0xcc, + 0x9d, 0xd5, 0x84, 0x10, 0xc0, 0x72, 0xf7, 0x44, 0x67, 0x15, 0x30, 0x01, 0x4c, 0x00, 0x0b, 0x13, + 0xc0, 0x04, 0xb0, 0x30, 0x01, 0x4c, 0x00, 0x0b, 0x13, 0xc0, 0x04, 0xb0, 0x30, 0x01, 0x4c, 0x00, + 0x0b, 0x13, 0xc0, 0x04, 0xb0, 0x30, 0x01, 0x4c, 0x00, 0x0b, 0x13, 0xc0, 0x04, 0xb0, 0x30, 0x01, + 0x4c, 0x00, 0x0b, 0x13, 0xc0, 0x04, 0xb0, 0x30, 0x01, 0x4c, 0x00, 0x0b, 0x13, 0xc0, 0x04, 0xb0, + 0x30, 0x01, 0x4c, 0x00, 0x0b, 0x13, 0xc0, 0x04, 0xb0, 0x30, 0x01, 0x4c, 0x00, 0x0b, 0x13, 0xc0, + 0x04, 0xb0, 0x30, 0x01, 0x4c, 0x00, 0x0b, 0x13, 0xc0, 0x04, 0xb0, 0x30, 0x01, 0x4c, 0x00, 0x0b, + 0x13, 0xc0, 0x04, 0xb0, 0xdc, 0x99, 0xa4, 0x25, 0xe3, 0x4d, 0x69, 0x9a, 0xf6, 0x5f, 0xbb, 0xd4, + 0x22, 0xea, 0x11, 0xb3, 0x10, 0x41, 0xc4, 0x15, 0x44, 0x0b, 0xe2, 0x2d, 0x55, 0x8e, 0xbb, 0x24, + 0xec, 0x1f, 0x05, 0xe8, 0xc4, 0xc9, 0x86, 0x18, 0x92, 0x8e, 0x78, 0x83, 0x6e, 0x7b, 0x00, 0x9c, + 0x41, 0x94, 0xa5, 0x92, 0x9e, 0xb4, 0x64, 0xfc, 0xaf, 0x88, 0x18, 0x16, 0xd0, 0x88, 0xd8, 0x4c, + 0x85, 0x71, 0xe3, 0xc6, 0xc1, 0xb2, 0x65, 0xcb, 0x20, 0x37, 0x37, 0x17, 0x8e, 0x1e, 0x3d, 0x0a, + 0x47, 0x8e, 0x1c, 0xb1, 0xf7, 0x39, 0x87, 0x78, 0x14, 0xf1, 0x17, 0x5b, 0x40, 0x7c, 0x2d, 0x60, + 0x1a, 0xa2, 0x83, 0x6e, 0xb9, 0xb4, 0xb4, 0x54, 0x9c, 0x3e, 0x7d, 0x5a, 0xd8, 0x12, 0x0a, 0x85, + 0x44, 0x63, 0x63, 0xa3, 0xd3, 0x12, 0xb6, 0xa6, 0x8a, 0x9e, 0x52, 0x89, 0x80, 0x8d, 0xa4, 0x87, + 0xf4, 0xf4, 0x74, 0xd1, 0xda, 0xda, 0x2a, 0xbc, 0xa4, 0xba, 0xba, 0xda, 0x26, 0xe0, 0x67, 0x44, + 0x46, 0x2a, 0x10, 0x90, 0x4a, 0x51, 0xd0, 0x74, 0xfa, 0x28, 0x2c, 0x2c, 0x84, 0x8a, 0x8a, 0x0a, + 0xcf, 0x1d, 0x16, 0x2d, 0x5a, 0x64, 0x17, 0x0b, 0x10, 0x63, 0x39, 0x0c, 0x4d, 0x40, 0xc4, 0x96, + 0x99, 0x99, 0x09, 0xba, 0xee, 0x7d, 0xdb, 0x59, 0x59, 0x59, 0x76, 0x31, 0xa0, 0x06, 0x6c, 0x26, + 0x20, 0x9e, 0x5e, 0xc0, 0xe9, 0x0a, 0xbc, 0xc4, 0x34, 0x4d, 0xe7, 0xbe, 0x82, 0x09, 0x60, 0x61, + 0x02, 0x98, 0x00, 0x16, 0x26, 0x80, 0x09, 0x60, 0xf1, 0x1d, 0x01, 0x14, 0x01, 0x75, 0xa7, 0x4c, + 0x6c, 0x7d, 0x0f, 0x0a, 0x4d, 0x08, 0x5e, 0x41, 0xdc, 0x40, 0x9c, 0x42, 0xec, 0x85, 0x04, 0x65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bf, 0xa8, 0x7d, 0x97, 0xe5, + 0x5f, 0x01, 0x06, 0x00, 0xa9, 0x1c, 0xbb, 0x9e, 0xdd, 0x6f, 0x6d, 0x94, 0x00, 0x00, 0x00, 0x00, + 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 +}; +const int generic_point_size = sizeof(generic_point); diff --git a/source/ngc/png/generic_point.h b/source/ngc/png/generic_point.h new file mode 100644 index 0000000..461bb21 --- /dev/null +++ b/source/ngc/png/generic_point.h @@ -0,0 +1,14 @@ +/* + This file was autogenerated by raw2c. +Visit http://www.devkitpro.org +*/ + +//--------------------------------------------------------------------------------- +#ifndef _generic_point_h_ +#define _generic_point_h_ +//--------------------------------------------------------------------------------- +extern const unsigned char generic_point[]; +extern const int generic_point_size; +//--------------------------------------------------------------------------------- +#endif //_generic_point_h_ +//--------------------------------------------------------------------------------- diff --git a/source/ngc/png/generic_point.png b/source/ngc/png/generic_point.png new file mode 100644 index 0000000..eb79fbd Binary files /dev/null and b/source/ngc/png/generic_point.png differ diff --git a/source/render.c b/source/render.c index 9bcadd5..f0eb37e 100644 --- a/source/render.c +++ b/source/render.c @@ -1653,7 +1653,6 @@ static void render_obj(uint32 line, uint8 *buf, uint8 *table) int height; int v_line; int column; - int sol_flag = 0; int left = 0x80; int right = 0x80 + bitmap.viewport.w; @@ -1667,9 +1666,8 @@ static void render_obj(uint32 line, uint8 *buf, uint8 *table) { xpos = object_info[count].xpos & 0x1ff; - /* sprite masking */ - if(xpos != 0) sol_flag = 1; - else if(xpos == 0 && sol_flag) return; + /* sprite masking (low priority sprite only) */ + if(!xpos && count) return; size = object_info[count].size & 0x0f; width = sizetab[(size >> 2) & 3]; @@ -1730,7 +1728,6 @@ static void render_obj_im2(uint32 line, uint32 odd, uint8 *buf, uint8 *table) int height; int v_line; int column; - int sol_flag = 0; int left = 0x80; int right = 0x80 + bitmap.viewport.w; @@ -1745,9 +1742,8 @@ static void render_obj_im2(uint32 line, uint32 odd, uint8 *buf, uint8 *table) { xpos = object_info[count].xpos & 0x1ff; - /* sprite masking */ - if(xpos != 0) sol_flag = 1; - else if(xpos == 0 && sol_flag) return; + /* sprite masking (low priority sprite only) */ + if(!xpos && count) return; size = object_info[count].size & 0x0f; width = sizetab[(size >> 2) & 3];