.fixed GX_REPEAT texture rendering

.added new default menu background
This commit is contained in:
ekeeke31 2010-07-06 14:03:50 +00:00
parent 670df571ea
commit 64c2278395
10 changed files with 117 additions and 132 deletions

View File

@ -21,6 +21,7 @@
* *
***************************************************************************/ ***************************************************************************/
#include "shared.h" #include "shared.h"
#include "menu.h"
void config_save(void) void config_save(void)
{ {
@ -123,7 +124,7 @@ void config_default(void)
#endif #endif
config.s_default = 1; config.s_default = 1;
config.s_device = 0; config.s_device = 0;
config.bg_color = 0; config.bg_type = 0;
config.bg_overlay = 0; config.bg_overlay = 0;
config.screen_w = 658; config.screen_w = 658;
config.bgm_volume = 100.0; config.bgm_volume = 100.0;
@ -140,5 +141,8 @@ void config_default(void)
/* restore from config file */ /* restore from config file */
config_load(); config_load();
io_init(); io_init();
/* default menu settings */
menu_configure();
} }

View File

@ -76,7 +76,7 @@ typedef struct
uint8 s_auto; uint8 s_auto;
uint8 s_default; uint8 s_default;
uint8 s_device; uint8 s_device;
int8 bg_color; int8 bg_type;
int8 bg_overlay; int8 bg_overlay;
int16 screen_w; int16 screen_w;
float bgm_volume; float bgm_volume;

View File

@ -93,7 +93,7 @@ static gui_image bg_filesel[10] =
{NULL,Banner_top_png,IMAGE_VISIBLE,0,0,640,108,255}, {NULL,Banner_top_png,IMAGE_VISIBLE,0,0,640,108,255},
{NULL,Banner_bottom_png,IMAGE_VISIBLE,0,380,640,100,255}, {NULL,Banner_bottom_png,IMAGE_VISIBLE,0,380,640,100,255},
{NULL,Main_logo_png,IMAGE_VISIBLE,466,40,152,44,255}, {NULL,Main_logo_png,IMAGE_VISIBLE,466,40,152,44,255},
{NULL,Frame_s1_png,IMAGE_VISIBLE,8,70,372,336,200}, {NULL,Frame_s1_png,IMAGE_VISIBLE,8,70,372,336,150},
{NULL,Frame_s2_png,0,384,264,248,140,200}, {NULL,Frame_s2_png,0,384,264,248,140,200},
{NULL,Snap_empty_png,IMAGE_VISIBLE,422,114,164,116,255}, {NULL,Snap_empty_png,IMAGE_VISIBLE,422,114,164,116,255},
{NULL,NULL,0,424,116,160,112,255}, {NULL,NULL,0,424,116,160,112,255},
@ -243,15 +243,30 @@ int FileSelector(unsigned char *buffer, bool useFAT)
gui_butn *button; gui_butn *button;
#endif #endif
/* Background Settings */ /* background type */
if (config.bg_color == 0) if (config.bg_type > 0)
bg_filesel[0].data = Bg_main_2_png; {
bg_filesel[0].state &= ~IMAGE_REPEAT;
if (config.bg_type > 1) bg_filesel[0].data = Bg_main_png;
else bg_filesel[0].data = Bg_main_2_png;
bg_filesel[0].x = 374;
bg_filesel[0].y = 140;
bg_filesel[0].w = 284;
bg_filesel[0].h = 288;
}
else else
bg_filesel[0].data = Bg_main_png; {
if (config.bg_overlay) bg_filesel[0].state |= IMAGE_REPEAT;
bg_filesel[1].state |= IMAGE_VISIBLE; bg_filesel[0].data = Bg_layer_png;
else bg_filesel[0].x = 0;
bg_filesel[1].state &= ~IMAGE_VISIBLE; bg_filesel[0].y = 0;
bg_filesel[0].w = 640;
bg_filesel[0].h = 480;
}
/* background overlay */
if (config.bg_overlay) bg_filesel[1].state |= IMAGE_VISIBLE;
else bg_filesel[1].state &= ~IMAGE_VISIBLE;
/* Initialize Menu */ /* Initialize Menu */
gui_menu *m = &menu_browser; gui_menu *m = &menu_browser;

View File

@ -153,6 +153,7 @@ extern gx_texture *w_pointer;
#endif #endif
/* Generic backgrounds */ /* Generic backgrounds */
extern const u8 Bg_layer_png[];
extern const u8 Bg_main_png[]; extern const u8 Bg_main_png[];
extern const u8 Bg_main_2_png[]; extern const u8 Bg_main_2_png[];
extern const u8 Bg_overlay_png[]; extern const u8 Bg_overlay_png[];

View File

@ -561,26 +561,17 @@ static void prefmenu ()
gui_item *items = m->items; gui_item *items = m->items;
sprintf (items[0].text, "Load ROM Auto: %s", config.autoload ? "ON":"OFF"); sprintf (items[0].text, "Load ROM Auto: %s", config.autoload ? "ON":"OFF");
if (config.s_auto == 3) if (config.s_auto == 3) sprintf (items[1].text, "Auto Saves: ALL");
sprintf (items[1].text, "Auto Saves: ALL"); else if (config.s_auto == 2) sprintf (items[1].text, "Auto Saves: STATE ONLY");
else if (config.s_auto == 2) else if (config.s_auto == 1) sprintf (items[1].text, "Auto Saves: SRAM ONLY");
sprintf (items[1].text, "Auto Saves: STATE ONLY"); else sprintf (items[1].text, "Auto Saves: NONE");
else if (config.s_auto == 1) if (config.s_device == 1) sprintf (items[2].text, "Saves Device: MCARD A");
sprintf (items[1].text, "Auto Saves: SRAM ONLY"); else if (config.s_device == 2) sprintf (items[2].text, "Saves Device: MCARD B");
else else sprintf (items[2].text, "Saves Device: FAT");
sprintf (items[1].text, "Auto Saves: NONE");
if (config.s_device == 1)
sprintf (items[2].text, "Saves Device: MCARD A");
else if (config.s_device == 2)
sprintf (items[2].text, "Saves Device: MCARD B");
else
sprintf (items[2].text, "Saves Device: FAT");
sprintf (items[3].text, "SFX Volume: %1.1f", config.sfx_volume); sprintf (items[3].text, "SFX Volume: %1.1f", config.sfx_volume);
sprintf (items[4].text, "BGM Volume: %1.1f", config.bgm_volume); sprintf (items[4].text, "BGM Volume: %1.1f", config.bgm_volume);
if (config.bg_color) if (config.bg_type) sprintf (items[5].text, "BG Type: COLOR %d", config.bg_type - 1);
sprintf (items[5].text, "BG Color: TYPE %d", config.bg_color); else sprintf (items[5].text, "BG Type: DEFAULT");
else
sprintf (items[5].text, "BG Color: DEFAULT");
sprintf (items[6].text, "BG Overlay: %s", config.bg_overlay ? "ON":"OFF"); sprintf (items[6].text, "BG Overlay: %s", config.bg_overlay ? "ON":"OFF");
sprintf (items[7].text, "Screen Width: %d", config.screen_w); sprintf (items[7].text, "Screen Width: %d", config.screen_w);
@ -600,24 +591,17 @@ static void prefmenu ()
case 1: /*** Auto load/save STATE & SRAM files ***/ case 1: /*** Auto load/save STATE & SRAM files ***/
config.s_auto = (config.s_auto + 1) % 4; config.s_auto = (config.s_auto + 1) % 4;
if (config.s_auto == 3) if (config.s_auto == 3) sprintf (items[ret].text, "Auto Saves: ALL");
sprintf (items[ret].text, "Auto Saves: ALL"); else if (config.s_auto == 2) sprintf (items[ret].text, "Auto Saves: STATE ONLY");
else if (config.s_auto == 2) else if (config.s_auto == 1) sprintf (items[ret].text, "Auto Saves: SRAM ONLY");
sprintf (items[ret].text, "Auto Saves: STATE ONLY"); else sprintf (items[ret].text, "Auto Saves: NONE");
else if (config.s_auto == 1)
sprintf (items[ret].text, "Auto Saves: SRAM ONLY");
else
sprintf (items[ret].text, "Auto Saves: NONE");
break; break;
case 2: /*** Default saves device ***/ case 2: /*** Default saves device ***/
config.s_device = (config.s_device + 1) % 3; config.s_device = (config.s_device + 1) % 3;
if (config.s_device == 1) if (config.s_device == 1) sprintf (items[ret].text, "Saves Device: MCARD A");
sprintf (items[ret].text, "Saves Device: MCARD A"); else if (config.s_device == 2) sprintf (items[ret].text, "Saves Device: MCARD B");
else if (config.s_device == 2) else sprintf (items[ret].text, "Saves Device: FAT");
sprintf (items[ret].text, "Saves Device: MCARD B");
else
sprintf (items[ret].text, "Saves Device: FAT");
break; break;
case 3: /*** Sound effects volume ***/ case 3: /*** Sound effects volume ***/
@ -630,64 +614,27 @@ static void prefmenu ()
sprintf (items[ret].text, "BGM Volume: %1.1f", config.bgm_volume); sprintf (items[ret].text, "BGM Volume: %1.1f", config.bgm_volume);
break; break;
case 5: /*** Background color ***/ case 5: /*** Background type ***/
if (ret < 0) if (ret < 0) config.bg_type --;
config.bg_color --; else config.bg_type++;
else if (config.bg_type < 0) config.bg_type = BG_COLOR_MAX;
config.bg_color ++; else if (config.bg_type > BG_COLOR_MAX) config.bg_type = 0;
if (config.bg_color < 0) if (config.bg_type) sprintf (items[5].text, "BG Type: COLOR %d", config.bg_type - 1);
config.bg_color = BG_COLOR_MAX - 1; else sprintf (items[5].text, "BG Type: DEFAULT");
else if (config.bg_color >= BG_COLOR_MAX)
config.bg_color = 0;
if (config.bg_color)
sprintf (items[ret].text, "BG Color: TYPE %d", config.bg_color);
else
sprintf (items[ret].text, "BG Color: DEFAULT");
GUI_SetBgColor((u8)config.bg_color);
GUI_DeleteMenu(m); GUI_DeleteMenu(m);
if (config.bg_color == 0) menu_configure();
{
bg_main[0].data = Bg_main_2_png;
bg_misc[0].data = Bg_main_2_png;
bg_ctrls[0].data = Bg_main_2_png;
bg_list[0].data = Bg_main_2_png;
bg_saves[1].data = Bg_main_2_png;
}
else
{
bg_main[0].data = Bg_main_png;
bg_misc[0].data = Bg_main_png;
bg_ctrls[0].data = Bg_main_png;
bg_list[0].data = Bg_main_png;
bg_saves[1].data = Bg_main_png;
}
GUI_InitMenu(m); GUI_InitMenu(m);
break; break;
case 6: /*** Background items ***/ case 6: /*** Background overlay ***/
config.bg_overlay ^= 1; config.bg_overlay ^= 1;
if (config.bg_overlay) sprintf (items[6].text, "BG Overlay: %s", config.bg_overlay ? "ON":"OFF");
{ menu_configure();
bg_main[1].state |= IMAGE_VISIBLE;
bg_misc[1].state |= IMAGE_VISIBLE;
bg_ctrls[1].state |= IMAGE_VISIBLE;
bg_list[1].state |= IMAGE_VISIBLE;
bg_saves[2].state |= IMAGE_VISIBLE;
}
else
{
bg_main[1].state &= ~IMAGE_VISIBLE;
bg_misc[1].state &= ~IMAGE_VISIBLE;
bg_ctrls[1].state &= ~IMAGE_VISIBLE;
bg_list[1].state &= ~IMAGE_VISIBLE;
bg_saves[2].state &= ~IMAGE_VISIBLE;
}
sprintf (items[ret].text, "BG Overlay: %s", config.bg_overlay ? "ON":"OFF");
break; break;
case 7: /*** Screen Width ***/ case 7: /*** Screen Width ***/
GUI_OptionBox(m,update_screen_w,"Screen Width",(void *)&config.screen_w,2,640,VI_MAX_WIDTH_NTSC,1); GUI_OptionBox(m,update_screen_w,"Screen Width",(void *)&config.screen_w,2,640,VI_MAX_WIDTH_NTSC,1);
sprintf (items[ret].text, "Screen Width: %d", config.screen_w); sprintf (items[7].text, "Screen Width: %d", config.screen_w);
break; break;
case -1: case -1:
@ -2838,7 +2785,7 @@ static void exitmenu(void)
* Main Menu * Main Menu
* *
****************************************************************************/ ****************************************************************************/
void MainMenu (void) void menu_execute(void)
{ {
char filename[MAXPATHLEN]; char filename[MAXPATHLEN];
int quit = 0; int quit = 0;
@ -2885,41 +2832,6 @@ void MainMenu (void)
m->buttons[8].state |= (BUTTON_VISIBLE | BUTTON_ACTIVE); m->buttons[8].state |= (BUTTON_VISIBLE | BUTTON_ACTIVE);
} }
/* Update background */
GUI_SetBgColor((u8)config.bg_color);
if (config.bg_color == 0)
{
bg_main[0].data = Bg_main_2_png;
bg_misc[0].data = Bg_main_2_png;
bg_ctrls[0].data = Bg_main_2_png;
bg_list[0].data = Bg_main_2_png;
bg_saves[1].data = Bg_main_2_png;
}
else
{
bg_main[0].data = Bg_main_png;
bg_misc[0].data = Bg_main_png;
bg_ctrls[0].data = Bg_main_png;
bg_list[0].data = Bg_main_png;
bg_saves[1].data = Bg_main_png;
}
if (config.bg_overlay)
{
bg_main[1].state |= IMAGE_VISIBLE;
bg_misc[1].state |= IMAGE_VISIBLE;
bg_ctrls[1].state |= IMAGE_VISIBLE;
bg_list[1].state |= IMAGE_VISIBLE;
bg_saves[2].state |= IMAGE_VISIBLE;
}
else
{
bg_main[1].state &= ~IMAGE_VISIBLE;
bg_misc[1].state &= ~IMAGE_VISIBLE;
bg_ctrls[1].state &= ~IMAGE_VISIBLE;
bg_list[1].state &= ~IMAGE_VISIBLE;
bg_saves[2].state &= ~IMAGE_VISIBLE;
}
GUI_InitMenu(m); GUI_InitMenu(m);
GUI_DrawMenuFX(m,10,0); GUI_DrawMenuFX(m,10,0);
@ -3033,3 +2945,55 @@ void MainMenu (void)
uselessinquiry (); uselessinquiry ();
#endif #endif
} }
void menu_configure(void)
{
/* background type */
if (config.bg_type > 0)
{
GUI_SetBgColor((u8)(config.bg_type - 1));
bg_main[0].state &= ~IMAGE_REPEAT;
bg_misc[0].state &= ~IMAGE_REPEAT;
bg_ctrls[0].state &= ~IMAGE_REPEAT;
bg_list[0].state &= ~IMAGE_REPEAT;
bg_saves[1].state &= ~IMAGE_REPEAT;
if (config.bg_type > 1) bg_main[0].data = bg_misc[0].data = bg_ctrls[0].data = bg_list[0].data = bg_saves[1].data = Bg_main_png;
else bg_main[0].data = bg_misc[0].data = bg_ctrls[0].data = bg_list[0].data = bg_saves[1].data = Bg_main_2_png;
bg_main[0].x = bg_misc[0].x = bg_ctrls[0].x = bg_list[0].x = bg_saves[1].x = 374;
bg_main[0].y = bg_misc[0].y = bg_ctrls[0].y = bg_list[0].y = bg_saves[1].y = 140;
bg_main[0].w = bg_misc[0].w = bg_ctrls[0].w = bg_list[0].w = bg_saves[1].w = 284;
bg_main[0].h = bg_misc[0].h = bg_ctrls[0].h = bg_list[0].h = bg_saves[1].h = 288;
}
else
{
GUI_SetBgColor(0);
bg_main[0].state |= IMAGE_REPEAT;
bg_misc[0].state |= IMAGE_REPEAT;
bg_ctrls[0].state |= IMAGE_REPEAT;
bg_list[0].state |= IMAGE_REPEAT;
bg_saves[1].state |= IMAGE_REPEAT;
bg_main[0].data = bg_misc[0].data = bg_ctrls[0].data = bg_list[0].data = bg_saves[1].data = Bg_layer_png;
bg_main[0].x = bg_misc[0].x = bg_ctrls[0].x = bg_list[0].x = bg_saves[1].x = 0;
bg_main[0].y = bg_misc[0].y = bg_ctrls[0].y = bg_list[0].y = bg_saves[1].y = 0;
bg_main[0].w = bg_misc[0].w = bg_ctrls[0].w = bg_list[0].w = bg_saves[1].w = 640;
bg_main[0].h = bg_misc[0].h = bg_ctrls[0].h = bg_list[0].h = bg_saves[1].h = 480;
}
/* background overlay */
if (config.bg_overlay)
{
bg_main[1].state |= IMAGE_VISIBLE;
bg_misc[1].state |= IMAGE_VISIBLE;
bg_ctrls[1].state |= IMAGE_VISIBLE;
bg_list[1].state |= IMAGE_VISIBLE;
bg_saves[2].state |= IMAGE_VISIBLE;
}
else
{
bg_main[1].state &= ~IMAGE_VISIBLE;
bg_misc[1].state &= ~IMAGE_VISIBLE;
bg_ctrls[1].state &= ~IMAGE_VISIBLE;
bg_list[1].state &= ~IMAGE_VISIBLE;
bg_saves[2].state &= ~IMAGE_VISIBLE;
}
}

View File

@ -104,7 +104,8 @@ extern const u8 ctrl_nunchuk_png[];
extern const u8 ctrl_wiimote_png[]; extern const u8 ctrl_wiimote_png[];
#endif #endif
extern void MainMenu (void); extern void menu_execute(void);
extern void menu_configure(void);
#endif #endif

View File

@ -747,7 +747,7 @@ void gxDrawTextureRepeat(gx_texture *texture, s32 x, s32 y, s32 w, s32 h, u8 alp
{ {
/* load texture object */ /* load texture object */
GXTexObj texObj; GXTexObj texObj;
GX_InitTexObj(&texObj, texture->data, texture->width, texture->height, GX_TF_RGBA8, GX_MIRROR, GX_MIRROR, GX_FALSE); GX_InitTexObj(&texObj, texture->data, texture->width, texture->height, GX_TF_RGBA8, GX_REPEAT, GX_REPEAT, GX_FALSE);
GX_LoadTexObj(&texObj, GX_TEXMAP0); GX_LoadTexObj(&texObj, GX_TEXMAP0);
GX_InvalidateTexAll(); GX_InvalidateTexAll();

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 B

View File

@ -25,6 +25,7 @@
#include "shared.h" #include "shared.h"
#include "font.h" #include "font.h"
#include "gui.h" #include "gui.h"
#include "menu.h"
#include "aram.h" #include "aram.h"
#include "dvd.h" #include "dvd.h"
#include "history.h" #include "history.h"
@ -168,7 +169,7 @@ static void run_emulation(void)
gx_video_Stop(); gx_video_Stop();
/* show menu */ /* show menu */
MainMenu (); menu_execute();
ConfigRequested = 0; ConfigRequested = 0;
/* start video & audio */ /* start video & audio */

View File

@ -44,7 +44,6 @@
extern void error(char *format, ...); extern void error(char *format, ...);
extern void ClearGGCodes(); extern void ClearGGCodes();
extern void GetGGEntries(); extern void GetGGEntries();
extern void MainMenu(void);
extern void legal(); extern void legal();
extern void reloadrom (int size, char *name); extern void reloadrom (int size, char *name);
extern void shutdown(); extern void shutdown();