mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-12-24 18:21:50 +01:00
~ fixed Makefiles, Gamecube Z trigger image
+ improved menu helpers behaviour + added some memory allocation checks + implemented basic ROM file selection menu (still missing filename scrolling & snapshot/gameinfo support)
This commit is contained in:
parent
588661e050
commit
a01bd4f375
33
Makefile.gc
33
Makefile.gc
@ -18,9 +18,9 @@ include $(DEVKITPPC)/gamecube_rules
|
||||
TARGET := genplus_cube
|
||||
BUILD := build_cube
|
||||
SOURCES := source source/m68k source/z80 source/sound source/sound/SRC source/ntsc source/cart_hw source/cart_hw/svp \
|
||||
source/gx source/gx/gui source/gx/fileio source/gx/png source/gx/sounds
|
||||
source/gx source/gx/gui source/gx/fileio source/gx/images source/gx/sounds
|
||||
INCLUDES := source source/m68k source/z80 source/sound source/sound/SRC source/ntsc source/cart_hw source/cart_hw/svp \
|
||||
source/gx source/gx/gui source/gx/fileio source/gx/png source/gx/sounds
|
||||
source/gx source/gx/gui source/gx/fileio source/gx/images source/gx/sounds
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
@ -64,6 +64,8 @@ CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
PNGFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.png)))
|
||||
PCMFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.pcm)))
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
@ -75,22 +77,23 @@ else
|
||||
endif
|
||||
|
||||
export OFILES := $(addsuffix .o,$(BINFILES)) \
|
||||
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
|
||||
$(sFILES:.s=.o) $(SFILES:.S=.o)
|
||||
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
|
||||
$(PNGFILES:.png=.png.o) $(PCMFILES:.pcm=.pcm.o) \
|
||||
$(sFILES:.s=.o) $(SFILES:.S=.o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of include paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD) \
|
||||
-I$(LIBOGC_INC)
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD) \
|
||||
-I$(LIBOGC_INC)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of library paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
|
||||
-L$(LIBOGC_LIB)
|
||||
-L$(LIBOGC_LIB)
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
.PHONY: $(BUILD) clean
|
||||
@ -117,6 +120,20 @@ DEPENDS := $(OFILES:.o=.d)
|
||||
$(OUTPUT).dol: $(OUTPUT).elf
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# This rule links in binary data with the various extension
|
||||
#---------------------------------------------------------------------------------
|
||||
%.jpg.o : %.jpg
|
||||
@echo $(notdir $<)
|
||||
$(bin2o)
|
||||
|
||||
%.png.o : %.png
|
||||
@echo $(notdir $<)
|
||||
$(bin2o)
|
||||
|
||||
%.pcm.o : %.pcm
|
||||
@echo $(notdir $<)
|
||||
$(bin2o)
|
||||
|
||||
-include $(DEPENDS)
|
||||
|
||||
|
36
Makefile.wii
36
Makefile.wii
@ -18,9 +18,9 @@ include $(DEVKITPPC)/wii_rules
|
||||
TARGET := genplus_wii
|
||||
BUILD := build_wii
|
||||
SOURCES := source source/m68k source/z80 source/sound source/sound/SRC source/ntsc source/cart_hw source/cart_hw/svp \
|
||||
source/gx source/gx/gui source/gx/fileio source/gx/png source/gx/sounds
|
||||
source/gx source/gx/gui source/gx/fileio source/gx/images source/gx/sounds
|
||||
INCLUDES := source source/m68k source/z80 source/sound source/sound/SRC source/ntsc source/cart_hw source/cart_hw/svp \
|
||||
source/gx source/gx/gui source/gx/fileio source/gx/png source/gx/sounds
|
||||
source/gx source/gx/gui source/gx/fileio source/gx/images source/gx/sounds
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
@ -64,6 +64,8 @@ CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
PNGFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.png)))
|
||||
PCMFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.pcm)))
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
@ -75,16 +77,17 @@ else
|
||||
endif
|
||||
|
||||
export OFILES := $(addsuffix .o,$(BINFILES)) \
|
||||
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
|
||||
$(sFILES:.s=.o) $(SFILES:.S=.o)
|
||||
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
|
||||
$(PNGFILES:.png=.png.o) $(PCMFILES:.pcm=.pcm.o) \
|
||||
$(sFILES:.s=.o) $(SFILES:.S=.o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of include paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD) \
|
||||
-I$(LIBOGC_INC)
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD) \
|
||||
-I$(LIBOGC_INC)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of library paths
|
||||
@ -105,14 +108,6 @@ clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
run:
|
||||
psoload $(TARGET).dol
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
reload:
|
||||
psoload -r $(TARGET).dol
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
@ -126,10 +121,17 @@ $(OUTPUT).dol: $(OUTPUT).elf
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# This rule links in binary data with the .jpg extension
|
||||
# This rule links in binary data with the various extension
|
||||
#---------------------------------------------------------------------------------
|
||||
%.jpg.o : %.jpg
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
$(bin2o)
|
||||
|
||||
%.png.o : %.png
|
||||
@echo $(notdir $<)
|
||||
$(bin2o)
|
||||
|
||||
%.pcm.o : %.pcm
|
||||
@echo $(notdir $<)
|
||||
$(bin2o)
|
||||
|
||||
|
@ -33,8 +33,8 @@
|
||||
#endif
|
||||
|
||||
/* this is emulator specific ! */
|
||||
#define PAGESIZE 14
|
||||
//#define PAGEOFFSET 120
|
||||
#define PAGESIZE 13
|
||||
#define PAGEOFFSET 86
|
||||
|
||||
|
||||
/* Global Variables */
|
||||
@ -44,37 +44,11 @@ int selection = 0;
|
||||
int old_selection = 0;
|
||||
int old_offset = 0;
|
||||
int useFAT = 0;
|
||||
int useHistory = 0;
|
||||
int haveDVDdir = 0;
|
||||
int haveFATdir = 0;
|
||||
|
||||
FILEENTRIES filelist[MAXFILES];
|
||||
|
||||
/***************************************************************************
|
||||
* ShowFiles
|
||||
*
|
||||
* Show filenames list in current directory
|
||||
***************************************************************************/
|
||||
/*static void ShowFiles (int offset, int selection)
|
||||
{
|
||||
int i, j;
|
||||
char text[MAXJOLIET+2];
|
||||
|
||||
gxClearScreen ((GXColor)BLACK);
|
||||
j = 0;
|
||||
|
||||
for (i = offset; i < (offset + PAGESIZE) && (i < maxfiles); i++)
|
||||
{
|
||||
memset(text,0,MAXJOLIET+2);
|
||||
if (filelist[i].flags) sprintf(text, "[%s]", filelist[i].filename + filelist[i].filename_offset);
|
||||
else sprintf (text, "%s", filelist[i].filename + filelist[i].filename_offset);
|
||||
if (j == (selection - offset)) WriteCentre_HL ((j * fheight) + PAGEOFFSET, text);
|
||||
else WriteCentre ((j * fheight) + PAGEOFFSET, text);
|
||||
j++;
|
||||
}
|
||||
gxSetScreen ();
|
||||
}*/
|
||||
|
||||
/***************************************************************************
|
||||
* FileSortCallback (Marty Disibio)
|
||||
*
|
||||
@ -119,16 +93,15 @@ int FileSelector(unsigned char *buffer)
|
||||
int quit =0;
|
||||
int ret;
|
||||
int i,size;
|
||||
int yoffset = 86;
|
||||
|
||||
char comment[2][30] = {"Back","Load ROM File"};
|
||||
char fname[MAXPATHLEN];
|
||||
int yoffset;
|
||||
char text[MAXJOLIET+2];
|
||||
FILE *xml;
|
||||
FILE *snap;
|
||||
|
||||
#ifdef HW_RVL
|
||||
/* allocate wiimote pointer data (only done once) */
|
||||
gx_texture *pointer = gxTextureOpenPNG(generic_point_png);
|
||||
// gx_texture *pointer = gxTextureOpenPNG(generic_point_png);
|
||||
#endif
|
||||
|
||||
/* allocate background overlay texture */
|
||||
@ -143,11 +116,15 @@ int FileSelector(unsigned char *buffer)
|
||||
gui_image *logo = &logo_small;
|
||||
if (!logo->texture) logo->texture = gxTextureOpenPNG(logo->data);
|
||||
|
||||
/* allocate background elements textures */
|
||||
/* allocate generic elements textures */
|
||||
gui_image *frames[2] = {&left_frame,&right_frame};
|
||||
gui_image *banners[2] = {&top_banner,&bottom_banner};
|
||||
gui_item *helpers[2] = {&action_cancel, &action_select};
|
||||
for (i=0; i<2; i++)
|
||||
{
|
||||
/* frames */
|
||||
if (!frames[i]->texture) frames[i]->texture = gxTextureOpenPNG(frames[i]->data);
|
||||
|
||||
/* banners */
|
||||
if (!banners[i]->texture) banners[i]->texture = gxTextureOpenPNG(banners[i]->data);
|
||||
|
||||
@ -155,15 +132,9 @@ int FileSelector(unsigned char *buffer)
|
||||
if (!helpers[i]->texture) helpers[i]->texture = gxTextureOpenPNG(helpers[i]->data);
|
||||
}
|
||||
|
||||
/* frames */
|
||||
gx_texture *frame_left = gxTextureOpenPNG(Frame_s1_png);
|
||||
gx_texture *frame_right = gxTextureOpenPNG(Frame_s2_png);
|
||||
|
||||
/* arrows */
|
||||
gx_texture *arrow_up = gxTextureOpenPNG(Button_up_png);
|
||||
gx_texture *arrow_up_over = gxTextureOpenPNG(Button_up_over_png);
|
||||
gx_texture *arrow_down = gxTextureOpenPNG(Button_down_png);
|
||||
gx_texture *arrow_down_over = gxTextureOpenPNG(Button_down_over_png);
|
||||
/* snapshots */
|
||||
gx_texture *snap_frame = gxTextureOpenPNG(Snap_frame_png);
|
||||
gx_texture *snap_empty = gxTextureOpenPNG(Snap_empty_png);
|
||||
|
||||
/* selection bar */
|
||||
gx_texture *bar_over = gxTextureOpenPNG(Overlay_bar_png);
|
||||
@ -171,18 +142,23 @@ int FileSelector(unsigned char *buffer)
|
||||
/* directory icon */
|
||||
gx_texture *dir_icon = gxTextureOpenPNG(Browser_dir_png);
|
||||
|
||||
#ifdef NEW_GUI
|
||||
|
||||
/* arrows */
|
||||
gx_texture *arrow_up = gxTextureOpenPNG(Button_up_png);
|
||||
gx_texture *arrow_up_over = gxTextureOpenPNG(Button_up_over_png);
|
||||
gx_texture *arrow_down = gxTextureOpenPNG(Button_down_png);
|
||||
gx_texture *arrow_down_over = gxTextureOpenPNG(Button_down_over_png);
|
||||
|
||||
/* stars */
|
||||
gx_texture *star_full = gxTextureOpenPNG(Star_full_png);
|
||||
gx_texture *star_empty = gxTextureOpenPNG(Star_empty_png);
|
||||
|
||||
/* snapshots */
|
||||
gx_texture *snap_frame = gxTextureOpenPNG(Snap_frame_png);
|
||||
gx_texture *snap_empty = gxTextureOpenPNG(Snap_empty_png);
|
||||
|
||||
#endif
|
||||
while (!quit)
|
||||
{
|
||||
/* Draw menu*/
|
||||
gxClearScreen ((GXColor)BACKGROUND);
|
||||
|
||||
gxDrawRepeat(overlay->texture,overlay->x,overlay->y,overlay->w,overlay->h);
|
||||
gxDrawTexture(bg->texture,bg->x,bg->y,bg->w,bg->h,255);
|
||||
gxDrawTexture(banners[0]->texture,banners[0]->x,banners[0]->y,banners[0]->w,banners[0]->h,255);
|
||||
@ -192,23 +168,27 @@ int FileSelector(unsigned char *buffer)
|
||||
gxDrawTexture(logo->texture,logo->x,logo->y,logo->w,logo->h,255);
|
||||
|
||||
/* Draw title & helps */
|
||||
FONT_alignLeft("ROM Files Selection", 22,10,56, (GXColor)WHITE);
|
||||
FONT_alignLeft(comment[0], 16, helpers[0]->x+helpers[0]->w+6,helpers[0]->y+(helpers[0]->h-16)/2 + 16, (GXColor)WHITE);
|
||||
FONT_alignRight(comment[1], 16, helpers[1]->x - 6, helpers[1]->y+(helpers[1]->h-16)/2 + 16, (GXColor)WHITE);
|
||||
FONT_alignLeft("ROM Selection", 22,10,56, (GXColor)WHITE);
|
||||
FONT_alignLeft("Back", 16, helpers[0]->x+helpers[0]->w+6,helpers[0]->y+(helpers[0]->h-16)/2 + 16, (GXColor)WHITE);
|
||||
FONT_alignRight("Load ROM File", 16, helpers[1]->x - 6, helpers[1]->y+(helpers[1]->h-16)/2 + 16, (GXColor)WHITE);
|
||||
|
||||
gxDrawTexture(snap_empty,422,114,snap_empty->width,snap_empty->height,255);
|
||||
gxDrawTexture(frames[0]->texture,frames[0]->x,frames[0]->y,frames[0]->w,frames[0]->h,200);
|
||||
|
||||
#ifdef NEW_GUI
|
||||
/* ROM database informations */
|
||||
strncpy(fname, filelist[selection].filename, strlen(filelist[selection].filename) - 4);
|
||||
sprintf(fname, "%s%s.xml","/genplus/db/",fname);
|
||||
sprintf(fname, "%s/db/%s.xml",DEFAULT_PATH,fname);
|
||||
xml = fopen(fname, "rb");
|
||||
if (xml)
|
||||
{
|
||||
gxDrawTexture(frame_right,384,264,frame_right->width,frame_right->height,204);
|
||||
gxDrawTexture(frames[1]->texture,frames[1]->x,frames[1]->y,frames[1]->w,frames[1]->h,200);
|
||||
fclose(xml); /* TODO */
|
||||
}
|
||||
|
||||
/* ROM snapshot */
|
||||
strncpy(fname, filelist[selection].filename, strlen(filelist[selection].filename) - 4);
|
||||
sprintf(fname, "%s%s.png","/genplus/snap/",fname);
|
||||
sprintf(fname, "%s/snap/%s.png",DEFAULT_PATH,fname);
|
||||
snap = fopen(fname, "rb");
|
||||
if (snap)
|
||||
{
|
||||
@ -218,14 +198,18 @@ int FileSelector(unsigned char *buffer)
|
||||
{
|
||||
gxDrawTexture(snap_empty,422,114,snap_empty->width,snap_empty->height,255);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Cartridge picture */
|
||||
gxDrawTexture(snap_frame,388,112,snap_frame->width,snap_frame->height,255);
|
||||
|
||||
/* File list */
|
||||
gxDrawTexture(frame_left,14,76,frame_left->width,frame_left->height,204);
|
||||
gxDrawTexture(frames[0]->texture,frames[0]->x,frames[0]->y,frames[0]->w,frames[0]->h,200);
|
||||
|
||||
yoffset = 86;
|
||||
for (i = offset; i < (offset + PAGESIZE) && (i < maxfiles); i++)
|
||||
{
|
||||
sprintf (text, "%s", filelist[i].filename + filelist[i].filename_offset);
|
||||
if (i == selection)
|
||||
{
|
||||
gxDrawTexture(bar_over,22,yoffset - ((bar_over->height - dir_icon->height)/2), bar_over->width,bar_over->height,255);
|
||||
@ -235,21 +219,19 @@ int FileSelector(unsigned char *buffer)
|
||||
{
|
||||
/* directory icon */
|
||||
gxDrawTexture(dir_icon,26,yoffset,dir_icon->width,dir_icon->height,255);
|
||||
FONT_alignLeft(filelist[i].filename + filelist[i].filename_offset, 12,26+dir_icon->width+6,yoffset+(dir_icon->height-12)/2 + 12, (GXColor)WHITE);
|
||||
FONT_alignLeft(text, 16,26+dir_icon->width+6,yoffset + 16, (GXColor)WHITE);
|
||||
}
|
||||
else
|
||||
{
|
||||
FONT_alignLeft(filelist[i].filename + filelist[i].filename_offset, 12,26,yoffset+(dir_icon->height-12)/2 + 12, (GXColor)WHITE);
|
||||
FONT_alignLeft(text, 16,26,yoffset+16, (GXColor)WHITE);
|
||||
}
|
||||
|
||||
yoffset += 22;
|
||||
yoffset += 20;
|
||||
}
|
||||
|
||||
/* copy EFB to XFB */
|
||||
gxSetScreen ();
|
||||
|
||||
/* if (redraw) ShowFiles (offset, selection);
|
||||
redraw = 0;*/
|
||||
p = m_input.keys;
|
||||
|
||||
/* scroll displayed filename */
|
||||
@ -328,7 +310,7 @@ int FileSelector(unsigned char *buffer)
|
||||
if (p & PAD_TRIGGER_Z)
|
||||
{
|
||||
filelist[selection].filename_offset = 0;
|
||||
return 0;
|
||||
quit = 2;
|
||||
}
|
||||
|
||||
/* open selected file or directory */
|
||||
@ -376,7 +358,7 @@ int FileSelector(unsigned char *buffer)
|
||||
|
||||
#ifdef HW_RVL
|
||||
/* allocate wiimote pointer data (only done once) */
|
||||
gxTextureClose(&pointer);
|
||||
// gxTextureClose(&pointer);
|
||||
#endif
|
||||
|
||||
gxTextureClose(&overlay->texture);
|
||||
@ -384,21 +366,22 @@ int FileSelector(unsigned char *buffer)
|
||||
gxTextureClose(&logo->texture);
|
||||
for (i=0; i<2; i++)
|
||||
{
|
||||
gxTextureClose(&frames[i]->texture);
|
||||
gxTextureClose(&banners[i]->texture);
|
||||
gxTextureClose(&helpers[i]->texture);
|
||||
}
|
||||
gxTextureClose(&frame_left);
|
||||
gxTextureClose(&frame_right);
|
||||
gxTextureClose(&snap_frame);
|
||||
gxTextureClose(&snap_empty);
|
||||
gxTextureClose(&bar_over);
|
||||
gxTextureClose(&dir_icon);
|
||||
#ifdef NEW_GUI
|
||||
gxTextureClose(&arrow_up);
|
||||
gxTextureClose(&arrow_up_over);
|
||||
gxTextureClose(&arrow_down);
|
||||
gxTextureClose(&arrow_down_over);
|
||||
gxTextureClose(&bar_over);
|
||||
gxTextureClose(&dir_icon);
|
||||
gxTextureClose(&star_full);
|
||||
gxTextureClose(&star_empty);
|
||||
gxTextureClose(&snap_frame);
|
||||
gxTextureClose(&snap_empty);
|
||||
#endif
|
||||
|
||||
if (quit == 2) return 0;
|
||||
else if (useFAT) return FAT_LoadFile(buffer);
|
||||
|
@ -51,33 +51,6 @@ gui_image bg_overlay_line = {NULL,Bg_overlay_png,0,0,640,480};
|
||||
gui_image left_frame = {NULL,Frame_s1_png,8,70,372,336};
|
||||
gui_image right_frame = {NULL,Frame_s2_png,384,264,248,140};
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Common GUI buttons data */
|
||||
/*****************************************************************************/
|
||||
butn_data arrow_up_data =
|
||||
{
|
||||
{NULL,NULL},
|
||||
{Button_up_png,Button_up_over_png}
|
||||
};
|
||||
|
||||
butn_data arrow_down_data =
|
||||
{
|
||||
{NULL,NULL},
|
||||
{Button_down_png,Button_down_over_png}
|
||||
};
|
||||
|
||||
butn_data button_text_data =
|
||||
{
|
||||
{NULL,NULL},
|
||||
{Button_text_png,Button_text_over_png}
|
||||
};
|
||||
|
||||
butn_data button_icon_data =
|
||||
{
|
||||
{NULL,NULL},
|
||||
{Button_icon_png,Button_icon_over_png}
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Common GUI items */
|
||||
/*****************************************************************************/
|
||||
@ -108,6 +81,33 @@ gui_item action_exit =
|
||||
#endif
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Buttons data */
|
||||
/*****************************************************************************/
|
||||
static butn_data arrow_up_data =
|
||||
{
|
||||
{NULL,NULL},
|
||||
{Button_up_png,Button_up_over_png}
|
||||
};
|
||||
|
||||
static butn_data arrow_down_data =
|
||||
{
|
||||
{NULL,NULL},
|
||||
{Button_down_png,Button_down_over_png}
|
||||
};
|
||||
|
||||
static butn_data button_text_data =
|
||||
{
|
||||
{NULL,NULL},
|
||||
{Button_text_png,Button_text_over_png}
|
||||
};
|
||||
|
||||
static butn_data button_icon_data =
|
||||
{
|
||||
{NULL,NULL},
|
||||
{Button_icon_png,Button_icon_over_png}
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Arrow Buttons for items list menu */
|
||||
/*****************************************************************************/
|
||||
@ -508,10 +508,6 @@ static void menu_draw(gui_menu *menu)
|
||||
/* draw frames */
|
||||
image = menu->frames[i];
|
||||
if (image) gxDrawTexture(image->texture,image->x,image->y,image->w,image->h, 128);
|
||||
|
||||
/* draw top&bottom banners */
|
||||
image = menu->banners[i];
|
||||
if (image) gxDrawTexture(image->texture,image->x,image->y,image->w,image->h,255);
|
||||
}
|
||||
|
||||
/* draw logo */
|
||||
@ -521,7 +517,7 @@ static void menu_draw(gui_menu *menu)
|
||||
/* draw title */
|
||||
FONT_alignLeft(menu->title, 22,10,56, (GXColor)WHITE);
|
||||
|
||||
/* draw left helper */
|
||||
/* draw left comment */
|
||||
item = menu->helpers[0];
|
||||
if (item)
|
||||
{
|
||||
@ -529,14 +525,6 @@ static void menu_draw(gui_menu *menu)
|
||||
FONT_alignLeft(item->comment,16,item->x+item->w+6,item->y+(item->h-16)/2 + 16,(GXColor)WHITE);
|
||||
}
|
||||
|
||||
/* draw right helper */
|
||||
item = menu->helpers[1];
|
||||
if (item)
|
||||
{
|
||||
gxDrawTexture(item->texture,item->x,item->y,item->w,item->h,255);
|
||||
FONT_alignRight(item->comment,16,item->x-6,item->y+(item->h-16)/2+16,(GXColor)WHITE);
|
||||
}
|
||||
|
||||
/* draw buttons + items */
|
||||
for (i=0; i<menu->max_buttons; i++)
|
||||
{
|
||||
@ -558,6 +546,7 @@ static void menu_draw(gui_menu *menu)
|
||||
{
|
||||
strcpy(menu->helpers[1]->comment,item->comment);
|
||||
item = menu->helpers[1];
|
||||
gxDrawTexture(item->texture,item->x,item->y,item->w,item->h,255);
|
||||
FONT_alignRight(item->comment,16,item->x-6,item->y+(item->h-16)/2+16,(GXColor)WHITE);
|
||||
}
|
||||
}
|
||||
@ -637,7 +626,7 @@ static int menu_prompt(gui_menu *parent, char *title, char *items[], u8 nb_items
|
||||
menu_draw(parent);
|
||||
|
||||
/* draw window */
|
||||
gxDrawTexture(window,xwindow,ywindow-yoffset,window->width,window->height,210);
|
||||
gxDrawTexture(window,xwindow,ywindow-yoffset,window->width,window->height,208);
|
||||
gxDrawTexture(top,xwindow,ywindow-yoffset,top->width,top->height,255);
|
||||
|
||||
/* draw title */
|
||||
@ -664,7 +653,7 @@ static int menu_prompt(gui_menu *parent, char *title, char *items[], u8 nb_items
|
||||
menu_draw(parent);
|
||||
|
||||
/* draw window */
|
||||
gxDrawTexture(window,xwindow,ywindow,window->width,window->height,210);
|
||||
gxDrawTexture(window,xwindow,ywindow,window->width,window->height,208);
|
||||
gxDrawTexture(top,xwindow,ywindow,top->width,top->height,255);
|
||||
|
||||
/* draw title */
|
||||
@ -765,7 +754,7 @@ static int menu_prompt(gui_menu *parent, char *title, char *items[], u8 nb_items
|
||||
menu_draw(parent);
|
||||
|
||||
/* draw window + header */
|
||||
gxDrawTexture(window,xwindow,ywindow-yoffset,window->width,window->height,210);
|
||||
gxDrawTexture(window,xwindow,ywindow-yoffset,window->width,window->height,208);
|
||||
gxDrawTexture(top,xwindow,ywindow-yoffset,top->width,top->height,255);
|
||||
|
||||
/* draw title */
|
||||
@ -795,14 +784,14 @@ static int menu_prompt(gui_menu *parent, char *title, char *items[], u8 nb_items
|
||||
/* when a game is displayed in background, it is faded accordingly */
|
||||
static void menu_slide(gui_menu *menu, u8 speed, u8 out)
|
||||
{
|
||||
int offset;
|
||||
int yoffset;
|
||||
int yfinal[3];
|
||||
gui_image *image[3];
|
||||
gui_image *temp;
|
||||
|
||||
menu_initialize(menu);
|
||||
|
||||
offset = 0;
|
||||
yoffset = 0;
|
||||
yfinal[0] = 0;
|
||||
yfinal[1] = 0;
|
||||
yfinal[2] = 0;
|
||||
@ -815,11 +804,11 @@ static void menu_slide(gui_menu *menu, u8 speed, u8 out)
|
||||
if (image[0])
|
||||
{
|
||||
/* intial offset */
|
||||
offset = image[0]->y + image[0]->h;
|
||||
yoffset = image[0]->y + image[0]->h;
|
||||
|
||||
/* final ypos */
|
||||
yfinal[0] = out ? (-image[0]->h) : (image[0]->y);
|
||||
if (image[2] && !image[1]) yfinal[2] = out ? (image[2]->y - offset) : image[2]->y;
|
||||
if (image[2] && !image[1]) yfinal[2] = out ? (image[2]->y - yoffset) : image[2]->y;
|
||||
}
|
||||
|
||||
/* Bottom banner */
|
||||
@ -829,17 +818,17 @@ static void menu_slide(gui_menu *menu, u8 speed, u8 out)
|
||||
if ((480 + image[1]->h - image[1]->y) > offset)
|
||||
{
|
||||
/* intial offset */
|
||||
offset = 480 - image[1]->y;
|
||||
yoffset = 480 - image[1]->y;
|
||||
|
||||
/* final ypos */
|
||||
yfinal[1] = out ? 480 : (image[1]->y);
|
||||
if (image[2] && !image[0]) yfinal[2] = out ? (image[2]->y + offset) : image[2]->y;
|
||||
if (image[2] && !image[0]) yfinal[2] = out ? (image[2]->y + yoffset) : image[2]->y;
|
||||
}
|
||||
}
|
||||
|
||||
/* Alpha steps */
|
||||
u16 alpha = out ? 128 : 255;
|
||||
s16 alpha_step = (127 * speed) /offset;
|
||||
s16 alpha_step = (127 * speed) / yoffset;
|
||||
if (!out) alpha_step = -alpha_step;
|
||||
|
||||
/* Let's loop until final position has been reached */
|
||||
@ -862,18 +851,18 @@ static void menu_slide(gui_menu *menu, u8 speed, u8 out)
|
||||
/* draw top banner + logo */
|
||||
if (image[out])
|
||||
{
|
||||
gxDrawTexture(image[out]->texture,image[out]->x,yfinal[out]-offset,image[out]->w,image[out]->h,255);
|
||||
if (image[2] && !image[out^1]) gxDrawTexture(image[2]->texture,image[2]->x,yfinal[2]-offset,image[2]->w,image[2]->h,255);
|
||||
gxDrawTexture(image[out]->texture,image[out]->x,yfinal[out]-yoffset,image[out]->w,image[out]->h,255);
|
||||
if (image[2] && !image[out^1]) gxDrawTexture(image[2]->texture,image[2]->x,yfinal[2]-yoffset,image[2]->w,image[2]->h,255);
|
||||
}
|
||||
/* draw bottom banner + logo */
|
||||
if (image[out^1])
|
||||
{
|
||||
gxDrawTexture(image[out^1]->texture,image[out^1]->x,yfinal[out^1]+offset,image[out^1]->w,image[out^1]->h,255);
|
||||
if (image[2] && !image[out]) gxDrawTexture(image[2]->texture,image[2]->x,image[2]->y+offset,image[2]->w,image[2]->h,255);
|
||||
gxDrawTexture(image[out^1]->texture,image[out^1]->x,yfinal[out^1]+yoffset,image[out^1]->w,image[out^1]->h,255);
|
||||
if (image[2] && !image[out]) gxDrawTexture(image[2]->texture,image[2]->x,image[2]->y+yoffset,image[2]->w,image[2]->h,255);
|
||||
}
|
||||
|
||||
/* update offset */
|
||||
offset -= speed;
|
||||
yoffset -= speed;
|
||||
|
||||
/* update alpha */
|
||||
alpha += alpha_step;
|
||||
|
@ -197,14 +197,6 @@ extern gui_image bg_overlay_line;
|
||||
extern gui_image left_frame;
|
||||
extern gui_image right_frame;
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Common GUI buttons data */
|
||||
/*****************************************************************************/
|
||||
extern butn_data arrow_up_data;
|
||||
extern butn_data arrow_down_data;
|
||||
extern butn_data button_text_data;
|
||||
extern butn_data button_icon_data;
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Common GUI items */
|
||||
/*****************************************************************************/
|
||||
|
@ -833,6 +833,7 @@ void gxDrawScreenshot(u8 alpha)
|
||||
|
||||
void gxDrawTexture(gx_texture *texture, int x, int y, int w, int h, u8 alpha)
|
||||
{
|
||||
if (!texture) return;
|
||||
if (texture->data)
|
||||
{
|
||||
/* load texture object */
|
||||
@ -867,6 +868,7 @@ void gxDrawTexture(gx_texture *texture, int x, int y, int w, int h, u8 alpha)
|
||||
|
||||
void gxDrawRepeat(gx_texture *texture, int x, int y, int w, int h)
|
||||
{
|
||||
if (!texture) return;
|
||||
if (texture->data)
|
||||
{
|
||||
/* load texture object */
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.3 KiB |
Loading…
Reference in New Issue
Block a user