*Removed ramdisk

*Lot's of changes in image processing
*Added use of libgd and ImageData class from WiiXplorer. No more crashes with corrupted images and no more restriction to images sizes that are devidable by 4 :).
*Added a recource file manager for better access of all files/images for internal files and theme files. Some themes will have to adjust some filenames because we want to use the same filenames for themes and internal source files.
This commit is contained in:
dimok321 2010-09-26 08:33:43 +00:00
parent 48a40172d0
commit 8bec876889
62 changed files with 3047 additions and 3358 deletions

View File

@ -2,8 +2,8 @@
<app version="1"> <app version="1">
<name> USB Loader GX</name> <name> USB Loader GX</name>
<coder>USB Loader GX Team</coder> <coder>USB Loader GX Team</coder>
<version>1.0 r975</version> <version>1.0 r976</version>
<release_date>201009250708</release_date> <release_date>201009251926</release_date>
<short_description>Loads games from USB-devices</short_description> <short_description>Loads games from USB-devices</short_description>
<long_description>USB Loader GX is a libwiigui based USB iso loader with a wii-like GUI. You can install games to your HDDs and boot them with shorter loading times. <long_description>USB Loader GX is a libwiigui based USB iso loader with a wii-like GUI. You can install games to your HDDs and boot them with shorter loading times.
The interactive GUI is completely controllable with WiiMote, Classic Controller or GC Controller. The interactive GUI is completely controllable with WiiMote, Classic Controller or GC Controller.

View File

@ -25,7 +25,6 @@ SOURCES := source \
source/libwbfs \ source/libwbfs \
source/language \ source/language \
source/mload \ source/mload \
source/ramdisk \
source/patches \ source/patches \
source/usbloader \ source/usbloader \
source/xml \ source/xml \
@ -42,6 +41,7 @@ SOURCES := source \
source/memory \ source/memory \
source/libntfs \ source/libntfs \
source/FileOperations \ source/FileOperations \
source/ImageOperations \
source/utils \ source/utils \
source/utils/minizip \ source/utils/minizip \
source/usbloader/wbfs source/usbloader/wbfs
@ -60,7 +60,7 @@ LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map,--section-start,.init=0x80B00
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project # any extra libraries we wish to link with the project
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
LIBS := -lpngu -lpng -lm -lz -lwiiuse -lbte -lasnd -logc -lfreetype -lvorbisidec -lmad -lmxml -ljpeg -lunzip LIBS := -lpngu -lpng -lgd -lm -lz -lwiiuse -lbte -lasnd -logc -lfreetype -lvorbisidec -lmad -lmxml -ljpeg -lunzip
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing # list of directories containing libraries, this must be the top level containing
# include and lib # include and lib

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
<pd><ViewState><e p="gui\source\mload" x="false"></e><e p="gui\source\settings" x="false"></e><e p="gui\source\utils" x="false"></e><e p="gui\source\images" x="false"></e><e p="gui\source\libfat" x="false"></e><e p="gui\source\prompts" x="false"></e><e p="gui\source\banner" x="false"></e><e p="gui\source\cheats" x="false"></e><e p="gui\source\libntfs" x="false"></e><e p="gui\source\network" x="true"></e><e p="gui\source\fonts" x="false"></e><e p="gui\source\menu" x="false"></e><e p="gui\source\ramdisk" x="false"></e><e p="gui\source\sounds" x="false"></e><e p="gui\source\system" x="false"></e><e p="gui\source\wad" x="false"></e><e p="gui" x="true"></e><e p="gui\source\FileOperations" x="false"></e><e p="gui\source\homebrewboot" x="false"></e><e p="gui\source\language" x="false"></e><e p="gui\source" x="true"></e><e p="gui\source\libwbfs" x="false"></e><e p="gui\source\libwiigui" x="false"></e><e p="gui\source\patches" x="false"></e><e p="gui\source\themes" x="false"></e><e p="gui\source\memory" x="false"></e><e p="gui\source\usbloader" x="false"></e><e p="gui\source\xml" x="false"></e></ViewState></pd> <pd><ViewState><e p="gui\source\mload" x="false"></e><e p="gui\source\settings" x="false"></e><e p="gui\source\utils" x="false"></e><e p="gui\source\images" x="false"></e><e p="gui\source\libfat" x="false"></e><e p="gui\source\prompts" x="false"></e><e p="gui\source\banner" x="false"></e><e p="gui\source\cheats" x="false"></e><e p="gui\source\libntfs" x="false"></e><e p="gui\source\network" x="true"></e><e p="gui\source\fonts" x="false"></e><e p="gui\source\menu" x="false"></e><e p="gui\source\sounds" x="false"></e><e p="gui\source\system" x="false"></e><e p="gui\source\wad" x="false"></e><e p="gui" x="true"></e><e p="gui\source\FileOperations" x="false"></e><e p="gui\source\homebrewboot" x="false"></e><e p="gui\source\language" x="false"></e><e p="gui\source" x="true"></e><e p="gui\source\libwbfs" x="false"></e><e p="gui\source\libwiigui" x="false"></e><e p="gui\source\patches" x="false"></e><e p="gui\source\themes" x="false"></e><e p="gui\source\ImageOperations" x="false"></e><e p="gui\source\memory" x="false"></e><e p="gui\source\usbloader" x="false"></e><e p="gui\source\xml" x="false"></e></ViewState></pd>

View File

@ -0,0 +1,616 @@
/***************************************************************************
* Copyright (C) 2010
* Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*
* TextureConverter.cpp
*
* for WiiXplorer 2010
***************************************************************************/
#include <gccore.h>
#include <malloc.h>
#include "TextureConverter.h"
#define cut_bounds(x, min, max) ( (x < min) ? min : (x > max) ? max : x )
#define ALIGN(x) (((x) + 3) & ~3)
#define ALIGN32(x) (((x) + 31) & ~31)
#define coordsRGBA8(x, y, w) (((((y >> 2) * (w >> 2) + (x >> 2)) << 5) + ((y & 3) << 2) + (x & 3)) << 1)
#define datasizeRGBA8(w, h) ALIGN32(((w+3)>>2)*((h+3)>>2)*32*2)
#define MAXWIDTH 1024.0f
#define MAXHEIGHT 768.0f
static u16 avg(u16 w0, u16 w1, u16 c0, u16 c1)
{
u16 a0, a1;
u16 a, c;
a0 = c0 >> 11;
a1 = c1 >> 11;
a = (w0*a0 + w1*a1) / (w0 + w1);
c = a << 11;
a0 = (c0 >> 5) & 63;
a1 = (c1 >> 5) & 63;
a = (w0*a0 + w1*a1) / (w0 + w1);
c |= a << 5;
a0 = c0 & 31;
a1 = c1 & 31;
a = (w0*a0 + w1*a1) / (w0 + w1);
c |= a;
return c;
}
bool I4ToGD(const u8 * buffer, u32 width, u32 height, gdImagePtr * im)
{
u32 x, y;
u32 x1, y1;
u32 iv;
if(!buffer)
return false;
*im = gdImageCreateTrueColor(width, height);
if(*im == 0)
return false;
gdImageAlphaBlending(*im, 0);
gdImageSaveAlpha(*im, 1);
for(iv = 0, y1 = 0; y1 < height; y1 += 8)
{
for(x1 = 0; x1 < width; x1 += 8)
{
for(y = y1; y < (y1 + 8); y++)
{
for(x = x1; x < (x1 + 8); x += 2, iv++)
{
if((x >= width) || (y >= height))
continue;
u8 oldpixel = buffer[iv];
u8 b = (oldpixel >> 4) * 255 / 15;
u8 g = (oldpixel >> 4) * 255 / 15;
u8 r = (oldpixel >> 4) * 255 / 15;
u8 a = gdAlphaOpaque;
gdImageSetPixel(*im, x, y, gdTrueColorAlpha(r, g, b, a));
r = (oldpixel & 0xF) * 255 / 15;
g = (oldpixel & 0xF) * 255 / 15;
b = (oldpixel & 0xF) * 255 / 15;
a = gdAlphaOpaque;
gdImageSetPixel(*im, x+1, y, gdTrueColorAlpha(r, g, b, a));
}
}
}
}
return true;
}
bool IA4ToGD(const u8 * buffer, u32 width, u32 height, gdImagePtr * im)
{
u32 x, y;
u32 x1, y1;
u32 iv;
if(!buffer)
return false;
*im = gdImageCreateTrueColor(width, height);
if(*im == 0)
return false;
gdImageAlphaBlending(*im, 0);
gdImageSaveAlpha(*im, 1);
for(iv = 0, y1 = 0; y1 < height; y1 += 4)
{
for(x1 = 0; x1 < width; x1 += 8)
{
for(y = y1; y < (y1 + 4); y++)
{
for(x = x1; x < (x1 + 8); x++)
{
u8 oldpixel = *(u8*)(buffer + (iv++));
oldpixel = ~oldpixel;
if((x >= width) || (y >= height))
continue;
u8 r = ((oldpixel & 0xF) * 255) / 15;
u8 g = ((oldpixel & 0xF) * 255) / 15;
u8 b = ((oldpixel & 0xF) * 255) / 15;
u8 a = ((oldpixel >> 4) * 255) / 15;
a = 127-127*a/255;
gdImageSetPixel(*im, x+1, y, gdTrueColorAlpha(r, g, b, a));
}
}
}
}
return true;
}
bool I8ToGD(const u8 * buffer, u32 width, u32 height, gdImagePtr * im)
{
u32 x, y;
u32 x1, y1;
u32 iv;
if(!buffer)
return false;
*im = gdImageCreateTrueColor(width, height);
if(*im == 0)
return false;
gdImageAlphaBlending(*im, 0);
gdImageSaveAlpha(*im, 1);
for(iv = 0, y1 = 0; y1 < height; y1 += 4)
{
for(x1 = 0; x1 < width; x1 += 8)
{
for(y = y1; y < (y1 + 4); y++)
{
for(x = x1; x < (x1 + 8); x++)
{
u8 pixel = *(u8*)(buffer + ((iv++) * 1));
if((x >= width) || (y >= height))
continue;
u8 r = pixel;
u8 g = pixel;
u8 b = pixel;
u8 a = gdAlphaOpaque;
gdImageSetPixel(*im, x, y, gdTrueColorAlpha(r, g, b, a));
}
}
}
}
return true;
}
bool IA8ToGD(const u8 * buffer, u32 width, u32 height, gdImagePtr * im)
{
u32 x, y;
u32 x1, y1;
u32 iv;
if(!buffer)
return false;
*im = gdImageCreateTrueColor(width, height);
if(*im == 0)
return false;
gdImageAlphaBlending(*im, 0);
gdImageSaveAlpha(*im, 1);
for(iv = 0, y1 = 0; y1 < height; y1 += 4)
{
for(x1 = 0; x1 < width; x1 += 4)
{
for(y = y1; y < (y1 + 4); y++)
{
for(x = x1; x < (x1 + 4); x++)
{
u16 oldpixel = *(u16*)(buffer + ((iv++) * 2));
if((x >= width) || (y >= height))
continue;
u8 r = oldpixel >> 8;
u8 g = oldpixel >> 8;
u8 b = oldpixel >> 8;
u8 a = oldpixel & 0xFF;
a = 127-127*a/255;
gdImageSetPixel(*im, x+1, y, gdTrueColorAlpha(r, g, b, a));
}
}
}
}
return true;
}
bool CMPToGD(const u8* buffer, u32 width, u32 height, gdImagePtr * im)
{
u32 x, y;
u8 r, g, b, a;
u16 raw;
u16 c[4];
int x0, x1, x2, y0, y1, y2, off;
int ww = (-(-(width) & -(8)));
int ix;
u32 px;
if(!buffer)
return false;
*im = gdImageCreateTrueColor(width, height);
if(*im == 0)
return false;
gdImageAlphaBlending(*im, 0);
gdImageSaveAlpha(*im, 1);
for (y = 0; y < height; y++)
{
for (x = 0; x < width; x++)
{
x0 = x & 3;
x1 = (x >> 2) & 1;
x2 = x >> 3;
y0 = y & 3;
y1 = (y >> 2) & 1;
y2 = y >> 3;
off = (8 * x1) + (16 * y1) + (32 * x2) + (4 * ww * y2);
c[0] = *(u16*)(buffer + off);
c[1] = *(u16*)(buffer + off + 2);
if (c[0] > c[1]) {
c[2] = avg(2, 1, c[0], c[1]);
c[3] = avg(1, 2, c[0], c[1]);
} else {
c[2] = avg(1, 1, c[0], c[1]);
c[3] = 0;
}
px = *(u32*)(buffer + off + 4);
ix = x0 + (4 * y0);
raw = c[(px >> (30 - (2 * ix))) & 3];
r = (raw >> 8) & 0xf8;
g = (raw >> 3) & 0xf8;
b = (raw << 3) & 0xf8;
a = gdAlphaOpaque;
gdImageSetPixel(*im, x, y, gdTrueColorAlpha(r, g, b, a));
}
}
return true;
}
bool RGB565ToGD(const u8* buffer, u32 width, u32 height, gdImagePtr * im)
{
u32 x, y;
u32 x1, y1;
u32 iv;
if(!buffer)
return false;
*im = gdImageCreateTrueColor(width, height);
if(*im == 0)
return false;
gdImageAlphaBlending(*im, 0);
gdImageSaveAlpha(*im, 1);
for(iv = 0, y1 = 0; y1 < height; y1 += 4)
{
for(x1 = 0; x1 < width; x1 += 4)
{
for(y = y1; y < (y1 + 4); y++)
{
for(x = x1; x < (x1 + 4); x++)
{
if((x >= width) || (y >= height))
continue;
u16 pixel = *(u16*)(buffer + ((iv++) * 2));
u8 r = ((pixel >> 11) & 0x1F) << 3;
u8 g = ((pixel >> 5) & 0x3F) << 2;
u8 b = ((pixel >> 0) & 0x1F) << 3;
u8 a = gdAlphaOpaque;
gdImageSetPixel(*im, x, y, gdTrueColorAlpha(r, g, b, a));
}
}
}
}
return true;
}
bool RGB565A3ToGD(const u8* buffer, u32 width, u32 height, gdImagePtr * im)
{
u32 x, y;
u32 x1, y1;
u32 iv;
if(!buffer)
return false;
*im = gdImageCreateTrueColor(width, height);
if(*im == 0)
return false;
gdImageAlphaBlending(*im, 0);
gdImageSaveAlpha(*im, 1);
for(iv = 0, y1 = 0; y1 < height; y1 += 4)
{
for(x1 = 0; x1 < width; x1 += 4)
{
for(y = y1; y < (y1 + 4); y++)
{
for(x = x1; x < (x1 + 4); x++)
{
u16 pixel = *(u16*)(buffer + ((iv++) * 2));
if((x >= width) || (y >= height))
continue;
if(pixel & (1 << 15))
{
// RGB5
u8 r = (((pixel >> 10) & 0x1F) * 255) / 31;
u8 g = (((pixel >> 5) & 0x1F) * 255) / 31;
u8 b = (((pixel >> 0) & 0x1F) * 255) / 31;
u8 a = gdAlphaOpaque;
gdImageSetPixel(*im, x, y, gdTrueColorAlpha(r, g, b, a));
}
else
{
// RGB4A3
u8 r = (((pixel >> 12) & 0xF) * 255) / 15;
u8 g = (((pixel >> 8) & 0xF) * 255) / 15;
u8 b = (((pixel >> 4) & 0xF) * 255) / 15;
u8 a = (((pixel >> 0) & 0x7) * 64) / 7;
a = 127-127*a/255;
gdImageSetPixel(*im, x, y, gdTrueColorAlpha(r, g, b, a));
}
}
}
}
}
return true;
}
bool RGBA8ToGD(const u8* buffer, u32 width, u32 height, gdImagePtr * im)
{
u32 x, y, offset;
u8 r, g, b, a;
if(!buffer)
return false;
*im = gdImageCreateTrueColor(width, height);
if(*im == 0)
return false;
gdImageAlphaBlending(*im, 0);
gdImageSaveAlpha(*im, 1);
for(y = 0; y < height; y++)
{
for(x = 0; x < width; x++)
{
offset = coordsRGBA8(x, y, width);
a = *(buffer+offset);
r = *(buffer+offset+1);
g = *(buffer+offset+32);
b = *(buffer+offset+33);
a = 127-127*a/255;
gdImageSetPixel(*im, x, y, gdTrueColorAlpha(r, g, b, a));
}
}
return true;
}
bool YCbYCrToGD(const u8* buffer, u32 width, u32 height, gdImagePtr * im)
{
u32 x, y, x1, YCbYCr;
int r, g, b;
u8 r1, g1, b1;
if(!buffer)
return false;
*im = gdImageCreateTrueColor(width, height);
if(*im == 0)
return false;
gdImageAlphaBlending(*im, 0);
gdImageSaveAlpha(*im, 1);
for(y = 0; y < height; y++)
{
for (x = 0, x1 = 0; x < (width / 2); x++, x1++)
{
YCbYCr = ((u32 *) buffer)[y*width/2+x];
u8 * val = (u8 *) &YCbYCr;
r = (int) (1.371f * (val[3] - 128));
g = (int) (- 0.698f * (val[3] - 128) - 0.336f * (val[1] - 128));
b = (int) (1.732f * (val[1] - 128));
r1 = cut_bounds(val[0] + r, 0, 255);
g1 = cut_bounds(val[0] + g, 0, 255);
b1 = cut_bounds(val[0] + b, 0, 255);
gdImageSetPixel(*im, x1, y, gdTrueColorAlpha(r1, g1, b1, gdAlphaOpaque));
x1++;
r1 = cut_bounds(val[2] + r, 0, 255);
g1 = cut_bounds(val[2] + g, 0, 255);
b1 = cut_bounds(val[2] + b, 0, 255);
gdImageSetPixel(*im, x1, y, gdTrueColorAlpha(r1, g1, b1, gdAlphaOpaque));
}
}
return true;
}
u8 * GDImageToRGBA8(gdImagePtr * gdImg, int * w, int * h)
{
int width = gdImageSX(*gdImg);
int height = gdImageSY(*gdImg);
float scale = 1.0f;
int retries = 100; //shouldn't need that long but to be sure
gdImageAlphaBlending(*gdImg, 0);
gdImageSaveAlpha(*gdImg, 1);
while(width*scale > MAXWIDTH || height*scale > MAXHEIGHT)
{
if(width*scale > MAXWIDTH)
scale = MAXWIDTH/width;
if(height*scale > MAXHEIGHT)
scale = MAXHEIGHT/height;
retries--;
if(!retries)
{
while(width*scale > MAXWIDTH || height*scale > MAXHEIGHT)
scale -= 0.02;
break;
}
}
width = ALIGN((int) (width * scale));
height = ALIGN((int) (height * scale));
if(width != gdImageSX(*gdImg) || height != gdImageSY(*gdImg))
{
gdImagePtr dst = gdImageCreateTrueColor(width, height);
gdImageAlphaBlending(dst, 0);
gdImageSaveAlpha(dst, 1);
gdImageCopyResized(dst, *gdImg, 0, 0, 0, 0, width, height, gdImageSX(*gdImg), gdImageSY(*gdImg));
gdImageDestroy(*gdImg);
*gdImg = dst;
width = gdImageSX(*gdImg);
height = gdImageSY(*gdImg);
}
int len = datasizeRGBA8(width, height);
u8 * data = (u8 *) memalign(32, len);
if(!data)
return NULL;
u8 a;
u32 x, y, pixel, offset;
for(y = 0; y < height; ++y)
{
for(x = 0; x < width; ++x)
{
pixel = gdImageGetPixel(*gdImg, x, y);
a = 254 - 2*((u8)gdImageAlpha(*gdImg, pixel));
if(a == 254) a++;
offset = coordsRGBA8(x, y, width);
data[offset] = a;
data[offset+1] = (u8)gdImageRed(*gdImg, pixel);
data[offset+32] = (u8)gdImageGreen(*gdImg, pixel);
data[offset+33] = (u8)gdImageBlue(*gdImg, pixel);
}
}
DCFlushRange(data, len);
if(w)
*w = width;
if(h)
*h = height;
return data;
}
u8 * FlipRGBAImage(const u8 *src, u32 width, u32 height)
{
int x, y;
int len = datasizeRGBA8(width, height);
u8 * data = memalign(32, len);
if(!data)
return NULL;
for (y = 0; y < height; y++)
{
for (x = 0; x < width; x++)
{
u32 offset = coordsRGBA8(x, y, width);
u8 a = src[offset];
u8 r = src[offset+1];
u8 g = src[offset+32];
u8 b = src[offset+33];
u32 offset2 = coordsRGBA8((width-x-1), (height-y-1), width);
data[offset2] = a;
data[offset2+1] = r;
data[offset2+32] = g;
data[offset2+33] = b;
}
}
DCFlushRange(data, len);
return data;
}
u8 * RGB8ToRGBA8(const u8 *src, u32 width, u32 height)
{
u32 x, y, offset;
int len = datasizeRGBA8(width, height);
u8 * dst = (u8 *) memalign(32, len);
if(!dst)
return NULL;
for (y = 0; y < height; ++y)
{
for (x = 0; x < width; ++x)
{
offset = coordsRGBA8(x, y, width);
dst[offset] = 0xFF;
dst[offset+1] = src[(y*width+x)*3];
dst[offset+32] = src[(y*width+x)*3+1];
dst[offset+33] = src[(y*width+x)*3+2];
}
}
DCFlushRange(dst, len);
return dst;
}

View File

@ -0,0 +1,57 @@
/***************************************************************************
* Copyright (C) 2010
* Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*
* TextureConverter.h
*
* A texture to GD image converter.
* for WiiXplorer 2010
***************************************************************************/
#ifndef __TEXTURE_CONVERTER_H_
#define __TEXTURE_CONVERTER_H_
#ifdef __cplusplus
extern "C"
{
#endif
#include <gccore.h>
#include <gd.h>
bool I4ToGD(const u8 * buffer, u32 width, u32 height, gdImagePtr * im);
bool IA4ToGD(const u8 * buffer, u32 width, u32 height, gdImagePtr * im);
bool I8ToGD(const u8 * buffer, u32 width, u32 height, gdImagePtr * im);
bool IA8ToGD(const u8 * buffer, u32 width, u32 height, gdImagePtr * im);
bool CMPToGD(const u8* buffer, u32 width, u32 height, gdImagePtr * im);
bool RGB565ToGD(const u8* buffer, u32 width, u32 height, gdImagePtr * im);
bool RGB565A3ToGD(const u8* buffer, u32 width, u32 height, gdImagePtr * im);
bool RGBA8ToGD(const u8* buffer, u32 width, u32 height, gdImagePtr * im);
bool YCbYCrToGD(const u8* buffer, u32 width, u32 height, gdImagePtr * im);
u8 * GDImageToRGBA8(gdImagePtr * gdImg, int * w, int * h);
u8 * FlipRGBAImage(const u8 *src, u32 width, u32 height);
u8 * RGB8ToRGBA8(const u8 *src, u32 width, u32 height);
#ifdef __cplusplus
}
#endif
#endif //__TEXTURE_CONVERTER_H_

View File

@ -0,0 +1,244 @@
/***************************************************************************
* Copyright (C) 2010
* Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*
* TplImage.cpp
*
* for WiiXplorer 2010
***************************************************************************/
#include <gccore.h>
#include <malloc.h>
#include <string.h>
#include "FileOperations/fileops.h"
#include "TextureConverter.h"
#include "TplImage.h"
TplImage::TplImage(const char * filepath)
{
TPLBuffer = NULL;
TPLSize = 0;
u8 * buffer = NULL;
u64 filesize = 0;
LoadFileToMem(filepath, &buffer, &filesize);
if(buffer)
{
LoadImage(buffer, filesize);
free(buffer);
}
}
TplImage::TplImage(const u8 * imgBuffer, u32 imgSize)
{
TPLBuffer = NULL;
TPLSize = 0;
if(imgBuffer)
{
LoadImage(imgBuffer, imgSize);
}
}
TplImage::~TplImage()
{
if(TPLBuffer)
free(TPLBuffer);
Texture.clear();
TextureHeader.clear();
TplTextureBuffer.clear();
}
bool TplImage::LoadImage(const u8 * imgBuffer, u32 imgSize)
{
if(TPLBuffer)
free(TPLBuffer);
TPLBuffer = NULL;
TPLSize = 0;
if(!imgBuffer)
return false;
TPLBuffer = (u8 *) malloc(imgSize);
if(!TPLBuffer)
return false;
TPLSize = imgSize;
memcpy(TPLBuffer, imgBuffer, imgSize);
return ParseTplFile();
}
bool TplImage::ParseTplFile()
{
if(!TPLBuffer)
return false;
TPLHeader = (const TPL_Header *) TPLBuffer;
if(TPLHeader->magic != 0x0020AF30)
return false;
if(TPLHeader->head_size != 12)
return false;
const TPL_Texture * curTexture = (const TPL_Texture *) (TPLHeader+1);
for(u32 i = 0; i < TPLHeader->num_textures; i++)
{
Texture.resize(i+1);
TextureHeader.resize(i+1);
TplTextureBuffer.resize(i+1);
Texture[i] = curTexture;
TextureHeader[i] = (const TPL_Texture_Header *) ((const u8 *) TPLBuffer+Texture[i]->text_header_offset);
TplTextureBuffer[i] = TPLBuffer + TextureHeader[i]->offset;
curTexture++;
}
return true;
}
int TplImage::GetWidth(int pos)
{
if(pos < 0 || pos >= (int) Texture.size())
{
return 0;
}
return TextureHeader[pos]->width;
}
int TplImage::GetHeight(int pos)
{
if(pos < 0 || pos >= (int) TextureHeader.size())
{
return 0;
}
return TextureHeader[pos]->height;
}
u32 TplImage::GetFormat(int pos)
{
if(pos < 0 || pos >= (int) TextureHeader.size())
{
return 0;
}
return TextureHeader[pos]->format;
}
const u8 * TplImage::GetTextureBuffer(int pos)
{
if(pos < 0 || pos >= (int) TplTextureBuffer.size())
{
return 0;
}
return TplTextureBuffer[pos];
}
int TplImage::GetTextureSize(int pos)
{
int width = GetWidth(pos);
int height = GetHeight(pos);
int len = 0;
switch(GetFormat(pos))
{
case GX_TF_I4:
case GX_TF_CI4:
case GX_TF_CMPR:
len = ((width+7)>>3)*((height+7)>>3)*32;
break;
case GX_TF_I8:
case GX_TF_IA4:
case GX_TF_CI8:
len = ((width+7)>>3)*((height+7)>>2)*32;
break;
case GX_TF_IA8:
case GX_TF_CI14:
case GX_TF_RGB565:
case GX_TF_RGB5A3:
len = ((width+3)>>2)*((height+3)>>2)*32;
break;
case GX_TF_RGBA8:
len = ((width+3)>>2)*((height+3)>>2)*32*2;
break;
default:
len = ((width+3)>>2)*((height+3)>>2)*32*2;
break;
}
return len;
}
gdImagePtr TplImage::ConvertToGD(int pos)
{
if(pos < 0 || pos >= (int) Texture.size())
{
return 0;
}
gdImagePtr gdImg = 0;
switch(TextureHeader[pos]->format)
{
case GX_TF_RGB565:
RGB565ToGD(TplTextureBuffer[pos], TextureHeader[pos]->width, TextureHeader[pos]->height, &gdImg);
break;
case GX_TF_RGB5A3:
RGB565A3ToGD(TplTextureBuffer[pos], TextureHeader[pos]->width, TextureHeader[pos]->height, &gdImg);
break;
case GX_TF_RGBA8:
RGBA8ToGD(TplTextureBuffer[pos], TextureHeader[pos]->width, TextureHeader[pos]->height, &gdImg);
break;
case GX_TF_I4:
I4ToGD(TplTextureBuffer[pos], TextureHeader[pos]->width, TextureHeader[pos]->height, &gdImg);
break;
case GX_TF_I8:
I8ToGD(TplTextureBuffer[pos], TextureHeader[pos]->width, TextureHeader[pos]->height, &gdImg);
break;
case GX_TF_IA4:
IA4ToGD(TplTextureBuffer[pos], TextureHeader[pos]->width, TextureHeader[pos]->height, &gdImg);
break;
case GX_TF_IA8:
IA8ToGD(TplTextureBuffer[pos], TextureHeader[pos]->width, TextureHeader[pos]->height, &gdImg);
break;
case GX_TF_CMPR:
CMPToGD(TplTextureBuffer[pos], TextureHeader[pos]->width, TextureHeader[pos]->height, &gdImg);
break;
default:
gdImg = 0;
break;
}
return gdImg;
}

View File

@ -0,0 +1,98 @@
/***************************************************************************
* Copyright (C) 2010
* Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*
* TplImage.h
*
* for WiiXplorer 2010
***************************************************************************/
#ifndef TPL_IMAGE_H_
#define TPL_IMAGE_H_
#include <gccore.h>
#include <gd.h>
#include <vector>
typedef struct
{
u32 magic;
u32 num_textures;
u32 head_size;
} TPL_Header;
typedef struct
{
u32 text_header_offset;
u32 text_palette_offset;
} TPL_Texture;
typedef struct
{
u16 height;
u16 width;
u32 format;
u32 offset;
u32 wrap_s;
u32 wrap_t;
u32 min;
u32 mag;
f32 lod_bias;
u8 edge_lod;
u8 min_lod;
u8 max_lod;
u8 unpacked;
} TPL_Texture_Header;
typedef struct
{
u16 num_items;
u8 unpacked;
u8 pad;
u32 format;
u32 offset;
} TPL_Palette_Header;
class TplImage
{
public:
TplImage(const char * filepath);
TplImage(const u8 * imgBuffer, u32 imgSize);
~TplImage();
bool LoadImage(const u8 * imgBuffer, u32 imgSize);
int GetWidth(int Texture);
int GetHeight(int Texture);
u32 GetFormat(int Texture);
const u8 * GetTextureBuffer(int Texture);
int GetTextureSize(int Texture);
gdImagePtr ConvertToGD(int Texture);
private:
bool ParseTplFile();
u8 * TPLBuffer;
u32 TPLSize;
const TPL_Header * TPLHeader;
std::vector<const TPL_Texture *> Texture;
std::vector<const TPL_Texture_Header *> TextureHeader;
std::vector<const u8 *> TplTextureBuffer;
};
#endif

View File

@ -25,7 +25,6 @@
#include "MD5.h" #include "MD5.h"
#include "banner.h" #include "banner.h"
#include "openingbnr.h" #include "openingbnr.h"
#include "../ramdisk/ramdisk.h"
#include "FileOperations/fileops.h" #include "FileOperations/fileops.h"
u16 be16(const u8 *p) u16 be16(const u8 *p)
@ -480,6 +479,8 @@ int unpackBin(const char * filename, const char * outdir)
return 0; return 0;
} }
#if 0
#define TMP_PATH(s) "BANNER:/dump"s #define TMP_PATH(s) "BANNER:/dump"s
//#define TMP_PATH(s) "SD:/dump"s //#define TMP_PATH(s) "SD:/dump"s
@ -559,3 +560,4 @@ int unpackBanner(const u8 *gameid, int what, const char *outdir)
error2: if (ret < 0) return ret; error2: if (ret < 0) return ret;
return 1; return 1;
} }
#endif

View File

@ -33,7 +33,7 @@ extern "C"
#define UNPACK_ICON_BIN 2 /* extract icon.bin to outdir/icon/ */ #define UNPACK_ICON_BIN 2 /* extract icon.bin to outdir/icon/ */
#define UNPACK_SOUND_BIN 4 /* copies sound.bin to outdir/sound.bin */ #define UNPACK_SOUND_BIN 4 /* copies sound.bin to outdir/sound.bin */
#define UNPACK_ALL (UNPACK_SOUND_BIN | UNPACK_ICON_BIN | UNPACK_BANNER_BIN) #define UNPACK_ALL (UNPACK_SOUND_BIN | UNPACK_ICON_BIN | UNPACK_BANNER_BIN)
int unpackBanner(const u8 * gameid, int what, const char *outdir); //int unpackBanner(const u8 * gameid, int what, const char *outdir);
//! Extract the lz77 compressed banner, icon and sound .bin //! Extract the lz77 compressed banner, icon and sound .bin
u8* decompress_lz77(u8 *data, size_t data_size, size_t* decompressed_size); u8* decompress_lz77(u8 *data, size_t data_size, size_t* decompressed_size);

View File

@ -34,11 +34,8 @@ int CheatMenu(const char * gameID)
if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
// GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
char imgPath[100]; GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png"));
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", Settings.theme_path); GuiImageData settingsbg(Resources::GetFile("settings_background.png"), Resources::GetFileSize("settings_background.png"));
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
snprintf(imgPath, sizeof(imgPath), "%ssettings_background.png", Settings.theme_path);
GuiImageData settingsbg(imgPath, settings_background_png);
GuiImage settingsbackground(&settingsbg); GuiImage settingsbackground(&settingsbg);
GuiTrigger trigA; GuiTrigger trigA;
@ -83,8 +80,7 @@ int CheatMenu(const char * gameID)
case 1: case 1:
int cntcheats = c.getCnt(); int cntcheats = c.getCnt();
customOptionList cheatslst(cntcheats); customOptionList cheatslst(cntcheats);
GuiCustomOptionBrowser chtBrowser(400, 280, &cheatslst, Settings.theme_path, "bg_options_settings.png", GuiCustomOptionBrowser chtBrowser(400, 280, &cheatslst, "bg_options_settings.png", 1, 90);
bg_options_settings_png, 1, 90);
chtBrowser.SetPosition(0, 90); chtBrowser.SetPosition(0, 90);
chtBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); chtBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
chtBrowser.SetClickable(true); chtBrowser.SetClickable(true);

File diff suppressed because it is too large Load Diff

View File

@ -90,30 +90,21 @@ int MenuHomebrewBrowse()
GuiSound btnClick1(button_click_pcm, button_click_pcm_size, Settings.sfxvolume); GuiSound btnClick1(button_click_pcm, button_click_pcm_size, Settings.sfxvolume);
/*** Image Variables ***/ /*** Image Variables ***/
char imgPath[150]; GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png"));
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", Settings.theme_path);
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
snprintf(imgPath, sizeof(imgPath), "%ssettings_background.png", Settings.theme_path); GuiImageData bgData(Resources::GetFile("settings_background.png"), Resources::GetFileSize("settings_background.png"));
GuiImageData bgData(imgPath, settings_background_png);
snprintf(imgPath, sizeof(imgPath), "%ssettings_title.png", Settings.theme_path); GuiImageData MainButtonImgData(Resources::GetFile("settings_title.png"), Resources::GetFileSize("settings_title.png"));
GuiImageData MainButtonImgData(imgPath, settings_title_png);
snprintf(imgPath, sizeof(imgPath), "%ssettings_title_over.png", Settings.theme_path); GuiImageData MainButtonImgOverData(Resources::GetFile("settings_title_over.png"), Resources::GetFileSize("settings_title_over.png"));
GuiImageData MainButtonImgOverData(imgPath, settings_title_over_png);
snprintf(imgPath, sizeof(imgPath), "%sstartgame_arrow_left.png", Settings.theme_path); GuiImageData arrow_left(Resources::GetFile("startgame_arrow_left.png"), Resources::GetFileSize("startgame_arrow_left.png"));
GuiImageData arrow_left(imgPath, startgame_arrow_left_png);
snprintf(imgPath, sizeof(imgPath), "%sstartgame_arrow_right.png", Settings.theme_path); GuiImageData arrow_right(Resources::GetFile("startgame_arrow_right.png"), Resources::GetFileSize("startgame_arrow_right.png"));
GuiImageData arrow_right(imgPath, startgame_arrow_right_png);
snprintf(imgPath, sizeof(imgPath), "%sWifi_btn.png", Settings.theme_path); GuiImageData wifiImgData(Resources::GetFile("Wifi_btn.png"), Resources::GetFileSize("Wifi_btn.png"));
GuiImageData wifiImgData(imgPath, Wifi_btn_png);
snprintf(imgPath, sizeof(imgPath), "%sChannel_btn.png", Settings.theme_path); GuiImageData channelImgData(Resources::GetFile("Channel_btn.png"), Resources::GetFileSize("Channel_btn.png"));
GuiImageData channelImgData(imgPath, Channel_btn_png);
GuiImage background(&bgData); GuiImage background(&bgData);
@ -400,7 +391,7 @@ int MenuHomebrewBrowse()
{ {
char iconpath[200]; char iconpath[200];
snprintf(iconpath, sizeof(iconpath), "%sicon.png", HomebrewFiles.GetFilepath(fileoffset + i)); snprintf(iconpath, sizeof(iconpath), "%sicon.png", HomebrewFiles.GetFilepath(fileoffset + i));
IconData[i] = new GuiImageData(iconpath, 0); IconData[i] = new GuiImageData(iconpath);
if (IconData[i]->GetImage()) if (IconData[i]->GetImage())
{ {
IconImg[i] = new GuiImage(IconData[i]); IconImg[i] = new GuiImage(IconData[i]);

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 989 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1014 B

BIN
source/images/dvd_gray.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
source/images/lock_gray.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1023 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -40,7 +40,7 @@
#include <math.h> #include <math.h>
#include <asndlib.h> #include <asndlib.h>
#include <wiiuse/wpad.h> #include <wiiuse/wpad.h>
#include "pngu/pngu.h" #include "gui_imagedata.h"
#include "FreeTypeGX.h" #include "FreeTypeGX.h"
#include "video.h" #include "video.h"
#include "filelist.h" #include "filelist.h"
@ -558,41 +558,6 @@ class GuiWindow: public GuiElement
std::vector<GuiElement*> _elements; //!< Contains all elements within the GuiWindow std::vector<GuiElement*> _elements; //!< Contains all elements within the GuiWindow
}; };
//!Converts image data into GX-useable RGBA8. Currently designed for use only with PNG files
class GuiImageData
{
public:
//!Constructor
//!Converts the image data to RGBA8 - expects PNG format
//!\param i Image data
GuiImageData(const u8 * i);
GuiImageData(const char * imgPath, const u8 * buffer);
GuiImageData(const u8 * img, int imgSize);
GuiImageData(const char *path, const char *file, const u8 * buffer, bool force_widescreen = false,
const u8 * wbuffer = NULL);
//!Destructor
~GuiImageData();
//!Gets a pointer to the image data
//!\return pointer to image data
u8 * GetImage();
//!Gets the image width
//!\return image width
int GetWidth();
//!Gets the image height
//!\return image height
int GetHeight();
//!LoadJpeg file
void LoadJpeg(const u8 *img, int imgSize);
//!RawTo4x4RGBA
void RawTo4x4RGBA(const unsigned char *src, void *dst, const unsigned int width, const unsigned int height);
//!Sets the image to grayscale
void SetGrayscale(void);
protected:
u8 * data; //!< Image data
int height; //!< Height of image
int width; //!< Width of image
};
//!Display, manage, and manipulate images in the GUI //!Display, manage, and manipulate images in the GUI
class GuiImage: public GuiElement class GuiImage: public GuiElement
{ {
@ -1078,9 +1043,8 @@ typedef struct _optionlist
class GuiOptionBrowser: public GuiElement class GuiOptionBrowser: public GuiElement
{ {
public: public:
GuiOptionBrowser(int w, int h, OptionList * l, const u8 *imagebg, int scrollbar); GuiOptionBrowser(int w, int h, OptionList * l, const char *imagebg, int scrollbar);
GuiOptionBrowser(int w, int h, OptionList * l, const char * themePath, const u8 *imagebg, int scrollbar, GuiOptionBrowser(int w, int h, OptionList * l, const char *imagebg, int scrollbar, int start);
int start);
~GuiOptionBrowser(); ~GuiOptionBrowser();
void SetCol2Position(int x); void SetCol2Position(int x);
int FindMenuItem(int c, int d); int FindMenuItem(int c, int d);

View File

@ -141,8 +141,7 @@ void customOptionList::Clear(bool OnlyValue/*=false*/)
/** /**
* Constructor for the GuiCustomOptionBrowser class. * Constructor for the GuiCustomOptionBrowser class.
*/ */
GuiCustomOptionBrowser::GuiCustomOptionBrowser(int w, int h, customOptionList * l, const char *themePath, GuiCustomOptionBrowser::GuiCustomOptionBrowser(int w, int h, customOptionList * l, const char * custombg, int scrollon, int col2)
const char *custombg, const u8 *imagebg, int scrollon, int col2)
{ {
width = w; width = w;
height = h; height = h;
@ -154,7 +153,6 @@ GuiCustomOptionBrowser::GuiCustomOptionBrowser(int w, int h, customOptionList *
selectedItem = 0; selectedItem = 0;
focus = 1; // allow focus focus = 1; // allow focus
coL2 = col2; coL2 = col2;
char imgPath[100];
trigA = new GuiTrigger; trigA = new GuiTrigger;
trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
@ -162,37 +160,31 @@ GuiCustomOptionBrowser::GuiCustomOptionBrowser(int w, int h, customOptionList *
trigHeldA->SetHeldTrigger(-1, WPAD_BUTTON_A, PAD_BUTTON_A); trigHeldA->SetHeldTrigger(-1, WPAD_BUTTON_A, PAD_BUTTON_A);
btnSoundClick = new GuiSound(button_click_pcm, button_click_pcm_size, Settings.sfxvolume); btnSoundClick = new GuiSound(button_click_pcm, button_click_pcm_size, Settings.sfxvolume);
snprintf(imgPath, sizeof(imgPath), "%s%s", themePath, custombg); bgOptions = Resources::GetImageData(custombg);
bgOptions = new GuiImageData(imgPath, imagebg);
bgOptionsImg = new GuiImage(bgOptions); bgOptionsImg = new GuiImage(bgOptions);
bgOptionsImg->SetParent(this); bgOptionsImg->SetParent(this);
bgOptionsImg->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); bgOptionsImg->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
snprintf(imgPath, sizeof(imgPath), "%sbg_options_entry.png", themePath); bgOptionsEntry = Resources::GetImageData("bg_options_entry.png");
bgOptionsEntry = new GuiImageData(imgPath, bg_options_entry_png);
snprintf(imgPath, sizeof(imgPath), "%sscrollbar.png", themePath); scrollbar = Resources::GetImageData("scrollbar.png");
scrollbar = new GuiImageData(imgPath, scrollbar_png);
scrollbarImg = new GuiImage(scrollbar); scrollbarImg = new GuiImage(scrollbar);
scrollbarImg->SetParent(this); scrollbarImg->SetParent(this);
scrollbarImg->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); scrollbarImg->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
scrollbarImg->SetPosition(0, 4); scrollbarImg->SetPosition(0, 4);
snprintf(imgPath, sizeof(imgPath), "%sscrollbar_arrowdown.png", themePath); arrowDown = Resources::GetImageData("scrollbar_arrowdown.png");
arrowDown = new GuiImageData(imgPath, scrollbar_arrowdown_png);
arrowDownImg = new GuiImage(arrowDown); arrowDownImg = new GuiImage(arrowDown);
arrowDownOver = new GuiImageData(imgPath, scrollbar_arrowdown_png); arrowDownOver = Resources::GetImageData("scrollbar_arrowdown.png");
arrowDownOverImg = new GuiImage(arrowDownOver); arrowDownOverImg = new GuiImage(arrowDownOver);
snprintf(imgPath, sizeof(imgPath), "%sscrollbar_arrowup.png", themePath); arrowUp = Resources::GetImageData("scrollbar_arrowup.png");
arrowUp = new GuiImageData(imgPath, scrollbar_arrowup_png);
arrowUpImg = new GuiImage(arrowUp); arrowUpImg = new GuiImage(arrowUp);
arrowUpOver = new GuiImageData(imgPath, scrollbar_arrowup_png); arrowUpOver = Resources::GetImageData("scrollbar_arrowup.png");
arrowUpOverImg = new GuiImage(arrowUpOver); arrowUpOverImg = new GuiImage(arrowUpOver);
snprintf(imgPath, sizeof(imgPath), "%sscrollbar_box.png", themePath); scrollbarBox = Resources::GetImageData("scrollbar_box.png");
scrollbarBox = new GuiImageData(imgPath, scrollbar_box_png);
scrollbarBoxImg = new GuiImage(scrollbarBox); scrollbarBoxImg = new GuiImage(scrollbarBox);
scrollbarBoxOver = new GuiImageData(imgPath, scrollbar_box_png); scrollbarBoxOver = Resources::GetImageData("scrollbar_box.png");
scrollbarBoxOverImg = new GuiImage(scrollbarBoxOver); scrollbarBoxOverImg = new GuiImage(scrollbarBoxOver);
arrowUpBtn = new GuiButton(arrowUpImg->GetWidth(), arrowUpImg->GetHeight()); arrowUpBtn = new GuiButton(arrowUpImg->GetWidth(), arrowUpImg->GetHeight());

View File

@ -44,8 +44,7 @@ class customOptionList
class GuiCustomOptionBrowser: public GuiElement class GuiCustomOptionBrowser: public GuiElement
{ {
public: public:
GuiCustomOptionBrowser(int w, int h, customOptionList * l, const char * themePath, const char *custombg, GuiCustomOptionBrowser(int w, int h, customOptionList * l, const char * background, int scrollbar, int col2);
const u8 *imagebg, int scrollbar, int col2);
~GuiCustomOptionBrowser(); ~GuiCustomOptionBrowser();
int FindMenuItem(int c, int d); int FindMenuItem(int c, int d);
int GetClickedOption(); int GetClickedOption();

View File

@ -11,6 +11,7 @@
#include "gui.h" #include "gui.h"
#include "prompts/filebrowser.h" #include "prompts/filebrowser.h"
#include "settings/CSettings.h" #include "settings/CSettings.h"
#include "themes/CTheme.h"
/** /**
* Constructor for the GuiFileBrowser class. * Constructor for the GuiFileBrowser class.
@ -34,40 +35,27 @@ GuiFileBrowser::GuiFileBrowser(int w, int h)
btnSoundOver = new GuiSound(button_over_pcm, button_over_pcm_size, Settings.sfxvolume); btnSoundOver = new GuiSound(button_over_pcm, button_over_pcm_size, Settings.sfxvolume);
btnSoundClick = new GuiSound(button_click_pcm, button_click_pcm_size, Settings.sfxvolume); btnSoundClick = new GuiSound(button_click_pcm, button_click_pcm_size, Settings.sfxvolume);
char imgPath[100]; bgFileSelection = new GuiImageData(Resources::GetFile("bg_browser.png"), Resources::GetFileSize("bg_browser.png"));
snprintf(imgPath, sizeof(imgPath), "%sbg_browser.png", Settings.theme_path);
bgFileSelection = new GuiImageData(imgPath, bg_browser_png);
bgFileSelectionImg = new GuiImage(bgFileSelection); bgFileSelectionImg = new GuiImage(bgFileSelection);
bgFileSelectionImg->SetParent(this); bgFileSelectionImg->SetParent(this);
bgFileSelectionImg->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); bgFileSelectionImg->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
snprintf(imgPath, sizeof(imgPath), "%sbg_browser_selection.png", Settings.theme_path); bgFileSelectionEntry = Resources::GetImageData("bg_browser_selection.png");
bgFileSelectionEntry = new GuiImageData(imgPath, bg_browser_selection_png);
// fileArchives = new GuiImageData(icon_archives_png); fileFolder = Resources::GetImageData("icon_folder.png");
// fileDefault = new GuiImageData(icon_default_png);
fileFolder = new GuiImageData(icon_folder_png); scrollbar = Resources::GetImageData("scrollbar.png");
// fileGFX = new GuiImageData(icon_gfx_png);
// filePLS = new GuiImageData(icon_pls_png);
// fileSFX = new GuiImageData(icon_sfx_png);
// fileTXT = new GuiImageData(icon_txt_png);
// fileXML = new GuiImageData(icon_xml_png);
snprintf(imgPath, sizeof(imgPath), "%sscrollbar.png", Settings.theme_path);
scrollbar = new GuiImageData(imgPath, scrollbar_png);
scrollbarImg = new GuiImage(scrollbar); scrollbarImg = new GuiImage(scrollbar);
scrollbarImg->SetParent(this); scrollbarImg->SetParent(this);
scrollbarImg->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); scrollbarImg->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
scrollbarImg->SetPosition(0, 2); scrollbarImg->SetPosition(0, 2);
scrollbarImg->SetSkew(0, 0, 0, 0, 0, -30, 0, -30); scrollbarImg->SetSkew(0, 0, 0, 0, 0, -30, 0, -30);
snprintf(imgPath, sizeof(imgPath), "%sscrollbar_arrowdown.png", Settings.theme_path); arrowDown = Resources::GetImageData("scrollbar_arrowdown.png");
arrowDown = new GuiImageData(imgPath, scrollbar_arrowdown_png);
arrowDownImg = new GuiImage(arrowDown); arrowDownImg = new GuiImage(arrowDown);
snprintf(imgPath, sizeof(imgPath), "%sscrollbar_arrowup.png", Settings.theme_path); arrowUp = Resources::GetImageData("scrollbar_arrowup.png");
arrowUp = new GuiImageData(imgPath, scrollbar_arrowup_png);
arrowUpImg = new GuiImage(arrowUp); arrowUpImg = new GuiImage(arrowUp);
snprintf(imgPath, sizeof(imgPath), "%sscrollbar_box.png", Settings.theme_path); scrollbarBox = Resources::GetImageData("scrollbar_box.png");
scrollbarBox = new GuiImageData(imgPath, scrollbar_box_png);
scrollbarBoxImg = new GuiImage(scrollbarBox); scrollbarBoxImg = new GuiImage(scrollbarBox);
arrowUpBtn = new GuiButton(arrowUpImg->GetWidth(), arrowUpImg->GetHeight()); arrowUpBtn = new GuiButton(arrowUpImg->GetWidth(), arrowUpImg->GetHeight());

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@
class GuiGameBrowser: public GuiElement class GuiGameBrowser: public GuiElement
{ {
public: public:
GuiGameBrowser(int w, int h, const char *themePath, const u8 *imagebg, int selected = 0, int offset = 0); GuiGameBrowser(int w, int h, int selected = 0, int offset = 0);
~GuiGameBrowser(); ~GuiGameBrowser();
int FindMenuItem(int c, int d); int FindMenuItem(int c, int d);
int GetClickedOption(); int GetClickedOption();

View File

@ -44,8 +44,8 @@ static GuiImageData *GameCarouselLoadCoverImage(void * Arg)
/** /**
* Constructor for the GuiGameCarousel class. * Constructor for the GuiGameCarousel class.
*/ */
GuiGameCarousel::GuiGameCarousel(int w, int h, const char *themePath, const u8 *imagebg, int selected, int offset) : GuiGameCarousel::GuiGameCarousel(int w, int h, const char *themePath, const u8 *imagebg, int imagebgsize, int selected, int offset) :
noCover(nocover_png) noCover(nocover_png, nocover_png_size)
{ {
width = w; width = w;
height = h; height = h;
@ -57,7 +57,6 @@ GuiGameCarousel::GuiGameCarousel(int w, int h, const char *themePath, const u8 *
clickedItem = -1; clickedItem = -1;
speed = 0; speed = 0;
char imgPath[100];
trigA = new GuiTrigger; trigA = new GuiTrigger;
trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
@ -73,10 +72,8 @@ GuiGameCarousel::GuiGameCarousel(int w, int h, const char *themePath, const u8 *
btnSoundClick = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); btnSoundClick = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
btnSoundOver = new GuiSound(button_over_pcm, button_over_pcm_size, Settings.sfxvolume); btnSoundOver = new GuiSound(button_over_pcm, button_over_pcm_size, Settings.sfxvolume);
snprintf(imgPath, sizeof(imgPath), "%sstartgame_arrow_left.png", Settings.theme_path); imgLeft = Resources::GetImageData("startgame_arrow_left.png");
imgLeft = new GuiImageData(imgPath, startgame_arrow_left_png); imgRight = Resources::GetImageData("startgame_arrow_right.png");
snprintf(imgPath, sizeof(imgPath), "%sstartgame_arrow_right.png", Settings.theme_path);
imgRight = new GuiImageData(imgPath, startgame_arrow_right_png);
int btnHeight = (int) lround(sqrt(RADIUS * RADIUS - 90000) - RADIUS - 50); int btnHeight = (int) lround(sqrt(RADIUS * RADIUS - 90000) - RADIUS - 50);

View File

@ -7,7 +7,7 @@ class GuiImageAsync;
class GuiGameCarousel: public GuiElement class GuiGameCarousel: public GuiElement
{ {
public: public:
GuiGameCarousel(int w, int h, const char *themePath, const u8 *imagebg, int selected = 0, int offset = 0); GuiGameCarousel(int w, int h, const char *themePath, const u8 *imagebg, int imagebgsize, int selected = 0, int offset = 0);
~GuiGameCarousel(); ~GuiGameCarousel();
int FindMenuItem(int c, int d); int FindMenuItem(int c, int d);
int GetClickedOption(); int GetClickedOption();

View File

@ -201,7 +201,7 @@ static GuiImageData *GameGridLoadCoverImage(void * Arg)
* Constructor for the GuiGamegrid class. * Constructor for the GuiGamegrid class.
*/ */
GuiGameGrid::GuiGameGrid(int w, int h, const char *themePath, const u8 *imagebg, int selected, int offset) : GuiGameGrid::GuiGameGrid(int w, int h, const char *themePath, const u8 *imagebg, int selected, int offset) :
noCover(nocoverFlat_png) noCover(nocoverFlat_png, nocoverFlat_png_size)
{ {
width = w; width = w;
height = h; height = h;

View File

@ -160,7 +160,7 @@ static void GuiImageAsyncThread_RemoveImage(GuiImageAsync* Image)
*/ */
GuiImageData *StdImageLoaderCallback(void *arg) GuiImageData *StdImageLoaderCallback(void *arg)
{ {
return new GuiImageData((char*) arg, NULL); return new GuiImageData((char*) arg);
} }
GuiImageAsync::GuiImageAsync(const char *Filename, GuiImageData * PreloadImg) : GuiImageAsync::GuiImageAsync(const char *Filename, GuiImageData * PreloadImg) :

View File

@ -1,292 +1,65 @@
/**************************************************************************** /***************************************************************************
* libwiigui * Copyright (C) 2010
* by Dimok
* *
* Tantric 2009 * This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
* *
* gui_imagedata.cpp * Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
* *
* LoadJpeg copyright by r-win for WiiXplorer * 1. The origin of this software must not be misrepresented; you
* check WiiXplorer source for license conditions * must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
* *
* GUI class definitions * 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*
* for WiiXplorer 2010
***************************************************************************/ ***************************************************************************/
#include "gui.h" #include "gui.h"
#include "ImageOperations/TextureConverter.h"
#include "ImageOperations/TplImage.h"
#include "FileOperations/fileops.h"
#ifdef __cplusplus #define ALIGN32(x) (((x) + 31) & ~31)
extern "C"
{
#endif
#include <jpeglib.h>
#ifdef __cplusplus
}
#endif
#define new_width 640
#define new_height 480
/** /**
* Constructor for the GuiImageData class. * Constructor for the GuiImageData class.
*/ */
GuiImageData::GuiImageData(const char * filepath)
extern int idiotFlag;
extern char idiotChar[50];
GuiImageData::GuiImageData(const u8 * img)
{ {
data = NULL; data = NULL;
width = 0; width = 0;
height = 0; height = 0;
format = GX_TF_RGBA8;
if (img) u8 *buffer = NULL;
{ u64 size = 0;
PNGUPROP imgProp;
IMGCTX ctx = PNGU_SelectImageFromBuffer(img);
if (!ctx) return; if(LoadFileToMem(filepath, &buffer, &size) < 0)
return;
int res = PNGU_GetImageProperties(ctx, &imgProp); LoadImage(buffer, size);
//if (((4%imgProp.imgWidth)!=0)||((4%imgProp.imgHeight)!=0))idiotFlag=1;
if (res == PNGU_OK) if(buffer)
{ free(buffer);
int len = imgProp.imgWidth * imgProp.imgHeight * 4;
if (len % 32) len += (32 - len % 32);
data = (u8 *) memalign(32, len);
if (data)
{
res = PNGU_DecodeTo4x4RGBA8(ctx, imgProp.imgWidth, imgProp.imgHeight, data, 255);
if (res == PNGU_OK)
{
width = imgProp.imgWidth;
height = imgProp.imgHeight;
DCFlushRange(data, len);
}
else
{
free(data);
data = NULL;
idiotFlag = 1;
snprintf(idiotChar, sizeof(idiotChar), "%s", img);
}
}
}
PNGU_ReleaseImageContext(ctx);
}
} }
GuiImageData::GuiImageData(const u8 * img, int imgSize) GuiImageData::GuiImageData(const u8 * img, int imgSize)
{ {
data = NULL; data = NULL;
width = 0; width = 0;
height = 0; height = 0;
format = GX_TF_RGBA8;
if (img) LoadImage(img, imgSize);
{
if (img[0] == 0xFF && img[1] == 0xD8) // IMAGE_JPEG
{
LoadJpeg(img, imgSize);
}
}
}
/**
* Constructor for the GuiImageData class.
*/
GuiImageData::GuiImageData(const char * imgPath, const u8 * buffer)
{
data = NULL;
width = 0;
height = 0;
if (imgPath)
{
PNGUPROP imgProp;
IMGCTX ctx = PNGU_SelectImageFromDevice(imgPath);
//if (((4%imgProp.imgWidth)!=0)||((4%imgProp.imgHeight)!=0))idiotFlag=1;
if (ctx)
{
int res = PNGU_GetImageProperties(ctx, &imgProp);
if (res == PNGU_OK)
{
int len = imgProp.imgWidth * imgProp.imgHeight * 4;
if (len % 32) len += (32 - len % 32);
data = (u8 *) memalign(32, len);
if (data)
{
res = PNGU_DecodeTo4x4RGBA8(ctx, imgProp.imgWidth, imgProp.imgHeight, data, 255);
if (res == PNGU_OK)
{
width = imgProp.imgWidth;
height = imgProp.imgHeight;
DCFlushRange(data, len);
}
else
{
free(data);
data = NULL;
idiotFlag = 1;
snprintf(idiotChar, sizeof(idiotChar), "%s", imgPath);
}
}
}
PNGU_ReleaseImageContext(ctx);
}
}
if (!data) //use buffer data instead
{
width = 0;
height = 0;
if (buffer)
{
PNGUPROP imgProp;
IMGCTX ctx = PNGU_SelectImageFromBuffer(buffer);
if (!ctx) return;
int res = PNGU_GetImageProperties(ctx, &imgProp);
if (res == PNGU_OK)
{
int len = imgProp.imgWidth * imgProp.imgHeight * 4;
if (len % 32) len += (32 - len % 32);
data = (u8 *) memalign(32, len);
if (data)
{
res = PNGU_DecodeTo4x4RGBA8(ctx, imgProp.imgWidth, imgProp.imgHeight, data, 255);
if (res == PNGU_OK)
{
width = imgProp.imgWidth;
height = imgProp.imgHeight;
DCFlushRange(data, len);
}
else
{
free(data);
data = NULL;
}
}
}
PNGU_ReleaseImageContext(ctx);
}
}
}
/**
* Constructor for the GuiImageData class.
*/
GuiImageData::GuiImageData(const char *path, const char *file, const u8 *buffer, bool force_widescreen/*=false*/,
const u8 *wbuffer/*=NULL*/)
{
data = NULL;
width = 0;
height = 0;
char path_4_3[100];
char path_16_9[100];
char *imgPath;
snprintf(path_4_3, sizeof(path_4_3), "%s%s", path, file);
if (force_widescreen)
{
snprintf(path_16_9, sizeof(path_16_9), "%sw%s", path, file);
imgPath = path_16_9;
if (wbuffer) buffer = wbuffer;
}
else imgPath = path_4_3;
for (;;)
{
if (imgPath)
{
PNGUPROP imgProp;
IMGCTX ctx = PNGU_SelectImageFromDevice(imgPath);
//if (((4%imgProp.imgWidth)!=0)||((4%imgProp.imgHeight)!=0))idiotFlag=1;
if (ctx)
{
int res = PNGU_GetImageProperties(ctx, &imgProp);
if (res == PNGU_OK)
{
int len = imgProp.imgWidth * imgProp.imgHeight * 4;
if (len % 32) len += (32 - len % 32);
data = (u8 *) memalign(32, len);
if (data)
{
res = PNGU_DecodeTo4x4RGBA8(ctx, imgProp.imgWidth, imgProp.imgHeight, data, 255);
if (res == PNGU_OK)
{
width = imgProp.imgWidth;
height = imgProp.imgHeight;
DCFlushRange(data, len);
}
else
{
free(data);
data = NULL;
idiotFlag = 1;
snprintf(idiotChar, sizeof(idiotChar), "%s", imgPath);
}
}
}
PNGU_ReleaseImageContext(ctx);
}
}
if (data || imgPath == path_4_3) break;
imgPath = path_4_3;
}
if (!data) //use buffer data instead
{
width = 0;
height = 0;
if (buffer)
{
PNGUPROP imgProp;
IMGCTX ctx = PNGU_SelectImageFromBuffer(buffer);
if (!ctx) return;
int res = PNGU_GetImageProperties(ctx, &imgProp);
if (res == PNGU_OK)
{
int len = imgProp.imgWidth * imgProp.imgHeight * 4;
if (len % 32) len += (32 - len % 32);
data = (u8 *) memalign(32, len);
if (data)
{
res = PNGU_DecodeTo4x4RGBA8(ctx, imgProp.imgWidth, imgProp.imgHeight, data, 255);
if (res == PNGU_OK)
{
width = imgProp.imgWidth;
height = imgProp.imgHeight;
DCFlushRange(data, len);
}
else
{
free(data);
data = NULL;
}
}
}
PNGU_ReleaseImageContext(ctx);
}
}
} }
/** /**
@ -294,162 +67,114 @@ GuiImageData::GuiImageData(const char *path, const char *file, const u8 *buffer,
*/ */
GuiImageData::~GuiImageData() GuiImageData::~GuiImageData()
{ {
if (data) if(data)
{
free(data);
data = NULL;
}
}
void GuiImageData::LoadImage(const u8 * img, int imgSize)
{
if(!img)
return;
if(data)
{ {
free(data); free(data);
data = NULL; data = NULL;
} }
}
u8 * GuiImageData::GetImage() if (imgSize < 8)
{
return data;
}
int GuiImageData::GetWidth()
{
return width;
}
int GuiImageData::GetHeight()
{
return height;
}
void GuiImageData::SetGrayscale(void)
{
GXColor color;
u32 offset, gray;
for (int x = 0; x < width; x++)
{ {
for (int y = 0; y < height; y++) return;
{ }
offset = (((y >> 2) << 4) * width) + ((x >> 2) << 6) + (((y % 4 << 2) + x % 4) << 1); else if (img[0] == 0x89 && img[1] == 'P' && img[2] == 'N' && img[3] == 'G')
color.r = *(data + offset + 1); {
color.g = *(data + offset + 32); // IMAGE_PNG
color.b = *(data + offset + 33); LoadPNG(img, imgSize);
}
gray = (77 * color.r + 150 * color.g + 28 * color.b) / 255; else if (img[0] == 0xFF && img[1] == 0xD8)
{
*(data + offset + 1) = gray; // IMAGE_JPEG
*(data + offset + 32) = gray; LoadJpeg(img, imgSize);
*(data + offset + 33) = gray; }
} else if (img[0] == 'B' && img[1] == 'M')
{
// IMAGE_BMP
LoadBMP(img, imgSize);
}
else if (img[0] == 'G' && img[1] == 'I' && img[2] == 'F')
{
// IMAGE_GIF
LoadGIF(img, imgSize);
}
else if (img[0] == 0x00 && img[1] == 0x20 && img[2] == 0xAF && img[3] == 0x30)
{
// IMAGE_TPL
LoadTPL(img, imgSize);
} }
} }
// This function finds it's origin in GRRLIB, which can be found here: http://code.google.com/p/grrlib/ void GuiImageData::LoadPNG(const u8 *img, int imgSize)
{
gdImagePtr gdImg = gdImageCreateFromPngPtr(imgSize, (u8*) img);
if(gdImg == 0)
return;
data = GDImageToRGBA8(&gdImg, &width, &height);
gdImageDestroy(gdImg);
}
void GuiImageData::LoadJpeg(const u8 *img, int imgSize) void GuiImageData::LoadJpeg(const u8 *img, int imgSize)
{ {
struct jpeg_decompress_struct cinfo; gdImagePtr gdImg = gdImageCreateFromJpegPtr(imgSize, (u8*) img);
struct jpeg_error_mgr jerr; if(gdImg == 0)
return;
int n = imgSize; data = GDImageToRGBA8(&gdImg, &width, &height);
gdImageDestroy(gdImg);
while (n > 1)
{
if (img[n - 1] == 0xff && img[n] == 0xd9)
{
break;
}
n--;
}
jpeg_create_decompress( &cinfo );
cinfo.err = jpeg_std_error(&jerr);
cinfo.progress = NULL;
jpeg_mem_src(&cinfo, (u8 *) img, n);
jpeg_read_header(&cinfo, TRUE);
jpeg_calc_output_dimensions(&cinfo);
if (cinfo.output_width > new_width || cinfo.output_height > new_height)
{
float factor = (cinfo.output_width > cinfo.output_height) ? (1.0 * cinfo.output_width) / new_width : (1.0
* cinfo.output_height) / new_height;
cinfo.scale_num = 1;
cinfo.scale_denom = factor;
cinfo.do_fancy_upsampling = true;
cinfo.do_block_smoothing = false;
cinfo.dct_method = JDCT_IFAST;
}
jpeg_start_decompress(&cinfo);
int rowsize = cinfo.output_width * cinfo.num_components;
unsigned char *tempBuffer = (unsigned char *) malloc(rowsize * cinfo.output_height);
JSAMPROW row_pointer[1];
row_pointer[0] = (unsigned char*) malloc(rowsize);
size_t location = 0;
while (cinfo.output_scanline < cinfo.output_height)
{
jpeg_read_scanlines(&cinfo, row_pointer, 1);
memcpy(tempBuffer + location, row_pointer[0], rowsize);
location += rowsize;
}
int len = ((cinfo.output_width + 3) >> 2) * ((cinfo.output_height + 3) >> 2) * 32 * 2;
data = (u8 *) memalign(32, len);
RawTo4x4RGBA(tempBuffer, data, cinfo.output_width, cinfo.output_height);
DCFlushRange(data, len);
width = cinfo.output_width;
height = cinfo.output_height;
jpeg_finish_decompress(&cinfo);
jpeg_destroy_decompress(&cinfo);
free(row_pointer[0]);
free(tempBuffer);
} }
/** void GuiImageData::LoadGIF(const u8 *img, int imgSize)
* Convert a raw bmp (RGB, no alpha) to 4x4RGBA.
* @author DragonMinded
* @param src
* @param dst
* @param width
* @param height
*/
void GuiImageData::RawTo4x4RGBA(const unsigned char *src, void *dst, const unsigned int width,
const unsigned int height)
{ {
unsigned int block; gdImagePtr gdImg = gdImageCreateFromGifPtr(imgSize, (u8*) img);
unsigned int i; if(gdImg == 0)
unsigned int c; return;
unsigned int ar;
unsigned int gb;
unsigned char *p = (unsigned char*) dst;
for (block = 0; block < height; block += 4) data = GDImageToRGBA8(&gdImg, &width, &height);
{ gdImageDestroy(gdImg);
for (i = 0; i < width; i += 4) }
{
/* Alpha and Red */ void GuiImageData::LoadBMP(const u8 *img, int imgSize)
for (c = 0; c < 4; ++c) {
{ gdImagePtr gdImg = gdImageCreateFromBmpPtr(imgSize, (u8*) img);
for (ar = 0; ar < 4; ++ar) if(gdImg == 0)
{ return;
/* Alpha pixels */
*p++ = 255; data = GDImageToRGBA8(&gdImg, &width, &height);
/* Red pixels */ gdImageDestroy(gdImg);
*p++ = src[((i + ar) + ((block + c) * width)) * 3]; }
}
} void GuiImageData::LoadTPL(const u8 *img, int imgSize)
{
/* Green and Blue */ TplImage TplFile(img, imgSize);
for (c = 0; c < 4; ++c)
{ width = TplFile.GetWidth(0);
for (gb = 0; gb < 4; ++gb) height = TplFile.GetHeight(0);
{ format = (u8) TplFile.GetFormat(0);
/* Green pixels */
*p++ = src[(((i + gb) + ((block + c) * width)) * 3) + 1]; const u8 * ImgPtr = TplFile.GetTextureBuffer(0);
/* Blue pixels */
*p++ = src[(((i + gb) + ((block + c) * width)) * 3) + 2]; if(ImgPtr)
} {
} int len = ALIGN32(TplFile.GetTextureSize(0));
} /* i */
} /* block */ data = (u8 *) memalign(32, len);
if(!data)
return;
memcpy(data, ImgPtr, len);
DCFlushRange(data, len);
}
} }

View File

@ -0,0 +1,69 @@
/****************************************************************************
* Copyright (C) 2010
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*
* for WiiXplorer 2010
***************************************************************************/
#ifndef GUI_IMAGEDATA_H_
#define GUI_IMAGEDATA_H_
#include <gctypes.h>
#include <gd.h>
class GuiImageData
{
public:
//!Constructor
//!\param img Image data
//!\param imgSize The image size
GuiImageData(const u8 * img, int imgSize);
//!Overload
GuiImageData(const char * filepath);
//!Destructor
~GuiImageData();
//!Gets a pointer to the image data
//!\return pointer to image data
u8 * GetImage() { return data; };
//!Gets the image width
//!\return image width
int GetWidth() { return width; };
//!Gets the image height
//!\return image height
int GetHeight() { return height; };
//!Gets the texture format
u8 GetTextureFormat() { return format; };
//!Load a new image into this GuiImageData
void LoadImage(const u8 * img, int imgSize);
protected:
void LoadPNG(const u8 *img, int imgSize);
void LoadBMP(const u8 *img, int imgSize);
void LoadJpeg(const u8 *img, int imgSize);
void LoadGIF(const u8 *img, int imgSize);
void LoadTPL(const u8 *img, int imgSize);
u8 * data; //!< Image data
int height; //!< Height of image
int width; //!< Width of image
u8 format; //!< Texture format
};
#endif

View File

@ -117,7 +117,7 @@ GuiKeyboard::GuiKeyboard(char * t, u32 max, int min, int lang)
memcpy(keys, thekeys, sizeof(thekeys)); memcpy(keys, thekeys, sizeof(thekeys));
} }
keyTextbox = new GuiImageData(keyboard_textbox_png); keyTextbox = new GuiImageData(keyboard_textbox_png, keyboard_textbox_png_size);
keyTextboxImg = new GuiImage(keyTextbox); keyTextboxImg = new GuiImage(keyTextbox);
keyTextboxImg->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); keyTextboxImg->SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
keyTextboxImg->SetPosition(0, 40);//(0,0); keyTextboxImg->SetPosition(0, 40);//(0,0);
@ -129,12 +129,12 @@ GuiKeyboard::GuiKeyboard(char * t, u32 max, int min, int lang)
kbText->SetPosition(0, 53);//(0, 13); kbText->SetPosition(0, 53);//(0, 13);
this->Append(kbText); this->Append(kbText);
key = new GuiImageData(keyboard_key_png); key = new GuiImageData(keyboard_key_png, keyboard_key_png_size);
keyOver = new GuiImageData(keyboard_key_over_png); keyOver = new GuiImageData(keyboard_key_over_png, keyboard_key_over_png_size);
keyMedium = new GuiImageData(keyboard_mediumkey_over_png); keyMedium = new GuiImageData(keyboard_mediumkey_over_png, keyboard_mediumkey_over_png_size);
keyMediumOver = new GuiImageData(keyboard_mediumkey_over_png); keyMediumOver = new GuiImageData(keyboard_mediumkey_over_png, keyboard_mediumkey_over_png_size);
keyLarge = new GuiImageData(keyboard_largekey_over_png); keyLarge = new GuiImageData(keyboard_largekey_over_png, keyboard_largekey_over_png_size);
keyLargeOver = new GuiImageData(keyboard_largekey_over_png); keyLargeOver = new GuiImageData(keyboard_largekey_over_png, keyboard_largekey_over_png_size);
keySoundOver = new GuiSound(button_over_pcm, button_over_pcm_size, Settings.sfxvolume); keySoundOver = new GuiSound(button_over_pcm, button_over_pcm_size, Settings.sfxvolume);
keySoundClick = new GuiSound(button_click_pcm, button_click_pcm_size, Settings.sfxvolume); keySoundClick = new GuiSound(button_click_pcm, button_click_pcm_size, Settings.sfxvolume);

View File

@ -35,7 +35,7 @@ GuiNumpad::GuiNumpad(char * t, u32 max)
char thekeys[11] = { '1', '2', '3', '4', '5', '6', '7', '8', '9', '\0', '0' }; char thekeys[11] = { '1', '2', '3', '4', '5', '6', '7', '8', '9', '\0', '0' };
memcpy(keys, thekeys, sizeof(thekeys)); memcpy(keys, thekeys, sizeof(thekeys));
keyTextbox = new GuiImageData(keyboard_textbox_png); keyTextbox = new GuiImageData(keyboard_textbox_png, keyboard_textbox_png_size);
keyTextboxImg = new GuiImage(keyTextbox); keyTextboxImg = new GuiImage(keyTextbox);
keyTextboxImg->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); keyTextboxImg->SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
keyTextboxImg->SetPosition(0, 40);//(0,0); keyTextboxImg->SetPosition(0, 40);//(0,0);
@ -48,8 +48,8 @@ GuiNumpad::GuiNumpad(char * t, u32 max)
kbText->SetPassChar('*'); kbText->SetPassChar('*');
this->Append(kbText); this->Append(kbText);
keyMedium = new GuiImageData(keyboard_mediumkey_over_png); keyMedium = new GuiImageData(keyboard_mediumkey_over_png, keyboard_mediumkey_over_png_size);
keyMediumOver = new GuiImageData(keyboard_mediumkey_over_png); keyMediumOver = new GuiImageData(keyboard_mediumkey_over_png, keyboard_mediumkey_over_png_size);
keySoundOver = new GuiSound(button_over_pcm, button_over_pcm_size, Settings.sfxvolume); keySoundOver = new GuiSound(button_over_pcm, button_over_pcm_size, Settings.sfxvolume);
keySoundClick = new GuiSound(button_click_pcm, button_click_pcm_size, Settings.sfxvolume); keySoundClick = new GuiSound(button_click_pcm, button_click_pcm_size, Settings.sfxvolume);

View File

@ -11,6 +11,7 @@
#include "gui.h" #include "gui.h"
#include "../wpad.h" #include "../wpad.h"
#include "settings/CSettings.h" #include "settings/CSettings.h"
#include "themes/CTheme.h"
#include <unistd.h> #include <unistd.h>
@ -20,7 +21,7 @@ static int scrollbaron = 0, startat = 0, loaded = 0;
/** /**
* Constructor for the GuiOptionBrowser class. * Constructor for the GuiOptionBrowser class.
*/ */
GuiOptionBrowser::GuiOptionBrowser(int w, int h, OptionList * l, const u8 *imagebg, int scrollon) GuiOptionBrowser::GuiOptionBrowser(int w, int h, OptionList * l, const char *imagebg, int scrollon)
{ {
width = w; width = w;
height = h; height = h;
@ -39,31 +40,31 @@ GuiOptionBrowser::GuiOptionBrowser(int w, int h, OptionList * l, const u8 *image
btnSoundClick = new GuiSound(button_click_pcm, button_click_pcm_size, Settings.sfxvolume); btnSoundClick = new GuiSound(button_click_pcm, button_click_pcm_size, Settings.sfxvolume);
bgOptions = new GuiImageData(imagebg); bgOptions = Resources::GetImageData(imagebg);
bgOptionsImg = new GuiImage(bgOptions); bgOptionsImg = new GuiImage(bgOptions);
bgOptionsImg->SetParent(this); bgOptionsImg->SetParent(this);
bgOptionsImg->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); bgOptionsImg->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
bgOptionsEntry = new GuiImageData(bg_options_entry_png); bgOptionsEntry = Resources::GetImageData("bg_options_entry.png");
if (scrollbaron == 1) if (scrollbaron == 1)
{ {
scrollbar = new GuiImageData(scrollbar_png); scrollbar = Resources::GetImageData("scrollbar.png");
scrollbarImg = new GuiImage(scrollbar); scrollbarImg = new GuiImage(scrollbar);
scrollbarImg->SetParent(this); scrollbarImg->SetParent(this);
scrollbarImg->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); scrollbarImg->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
scrollbarImg->SetPosition(0, 4); scrollbarImg->SetPosition(0, 4);
arrowDown = new GuiImageData(scrollbar_arrowdown_png); arrowDown = Resources::GetImageData("scrollbar_arrowdown.png");
arrowDownImg = new GuiImage(arrowDown); arrowDownImg = new GuiImage(arrowDown);
arrowDownOver = new GuiImageData(scrollbar_arrowdown_png); arrowDownOver = Resources::GetImageData("scrollbar_arrowdown.png");
arrowDownOverImg = new GuiImage(arrowDownOver); arrowDownOverImg = new GuiImage(arrowDownOver);
arrowUp = new GuiImageData(scrollbar_arrowup_png); arrowUp = Resources::GetImageData("scrollbar_arrowup.png");
arrowUpImg = new GuiImage(arrowUp); arrowUpImg = new GuiImage(arrowUp);
arrowUpOver = new GuiImageData(scrollbar_arrowup_png); arrowUpOver = Resources::GetImageData("scrollbar_arrowup.png");
arrowUpOverImg = new GuiImage(arrowUpOver); arrowUpOverImg = new GuiImage(arrowUpOver);
scrollbarBox = new GuiImageData(scrollbar_box_png); scrollbarBox = Resources::GetImageData("scrollbar_box.png");
scrollbarBoxImg = new GuiImage(scrollbarBox); scrollbarBoxImg = new GuiImage(scrollbarBox);
scrollbarBoxOver = new GuiImageData(scrollbar_box_png); scrollbarBoxOver = Resources::GetImageData("scrollbar_box.png");
scrollbarBoxOverImg = new GuiImage(scrollbarBoxOver); scrollbarBoxOverImg = new GuiImage(scrollbarBoxOver);
arrowUpBtn = new GuiButton(arrowUpImg->GetWidth(), arrowUpImg->GetHeight()); arrowUpBtn = new GuiButton(arrowUpImg->GetWidth(), arrowUpImg->GetHeight());
@ -134,8 +135,7 @@ GuiOptionBrowser::GuiOptionBrowser(int w, int h, OptionList * l, const u8 *image
/** /**
* Constructor for the GuiOptionBrowser class. * Constructor for the GuiOptionBrowser class.
*/ */
GuiOptionBrowser::GuiOptionBrowser(int w, int h, OptionList * l, const char *themePath, const u8 *imagebg, GuiOptionBrowser::GuiOptionBrowser(int w, int h, OptionList * l, const char *imagebg, int scrollon, int start)
int scrollon, int start)
{ {
width = w; width = w;
height = h; height = h;
@ -147,7 +147,6 @@ GuiOptionBrowser::GuiOptionBrowser(int w, int h, OptionList * l, const char *the
listOffset = this->FindMenuItem(-1, 1); listOffset = this->FindMenuItem(-1, 1);
selectedItem = 0; selectedItem = 0;
focus = 1; // allow focus focus = 1; // allow focus
char imgPath[100];
trigA = new GuiTrigger; trigA = new GuiTrigger;
trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
@ -155,38 +154,32 @@ GuiOptionBrowser::GuiOptionBrowser(int w, int h, OptionList * l, const char *the
trigHeldA->SetHeldTrigger(-1, WPAD_BUTTON_A, PAD_BUTTON_A); trigHeldA->SetHeldTrigger(-1, WPAD_BUTTON_A, PAD_BUTTON_A);
btnSoundClick = new GuiSound(button_click_pcm, button_click_pcm_size, Settings.sfxvolume); btnSoundClick = new GuiSound(button_click_pcm, button_click_pcm_size, Settings.sfxvolume);
snprintf(imgPath, sizeof(imgPath), "%sbg_options.png", themePath); bgOptions = Resources::GetImageData(imagebg);
bgOptions = new GuiImageData(imgPath, imagebg);
bgOptionsImg = new GuiImage(bgOptions); bgOptionsImg = new GuiImage(bgOptions);
bgOptionsImg->SetParent(this); bgOptionsImg->SetParent(this);
bgOptionsImg->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); bgOptionsImg->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
snprintf(imgPath, sizeof(imgPath), "%sbg_options_entry.png", themePath); bgOptionsEntry = Resources::GetImageData("bg_options_entry.png");
bgOptionsEntry = new GuiImageData(imgPath, bg_options_entry_png);
if (scrollbaron == 1) if (scrollbaron == 1)
{ {
snprintf(imgPath, sizeof(imgPath), "%sscrollbar.png", themePath); scrollbar = Resources::GetImageData("scrollbar.png");
scrollbar = new GuiImageData(imgPath, scrollbar_png);
scrollbarImg = new GuiImage(scrollbar); scrollbarImg = new GuiImage(scrollbar);
scrollbarImg->SetParent(this); scrollbarImg->SetParent(this);
scrollbarImg->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); scrollbarImg->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
scrollbarImg->SetPosition(0, 4); scrollbarImg->SetPosition(0, 4);
snprintf(imgPath, sizeof(imgPath), "%sscrollbar_arrowdown.png", themePath); arrowDown = Resources::GetImageData("scrollbar_arrowdown.png");
arrowDown = new GuiImageData(imgPath, scrollbar_arrowdown_png);
arrowDownImg = new GuiImage(arrowDown); arrowDownImg = new GuiImage(arrowDown);
arrowDownOver = new GuiImageData(imgPath, scrollbar_arrowdown_png); arrowDownOver = Resources::GetImageData("scrollbar_arrowdown.png");
arrowDownOverImg = new GuiImage(arrowDownOver); arrowDownOverImg = new GuiImage(arrowDownOver);
snprintf(imgPath, sizeof(imgPath), "%sscrollbar_arrowup.png", themePath); arrowUp = Resources::GetImageData("scrollbar_arrowup.png");
arrowUp = new GuiImageData(imgPath, scrollbar_arrowup_png);
arrowUpImg = new GuiImage(arrowUp); arrowUpImg = new GuiImage(arrowUp);
arrowUpOver = new GuiImageData(imgPath, scrollbar_arrowup_png); arrowUpOver = Resources::GetImageData("scrollbar_arrowup.png");
arrowUpOverImg = new GuiImage(arrowUpOver); arrowUpOverImg = new GuiImage(arrowUpOver);
snprintf(imgPath, sizeof(imgPath), "%sscrollbar_box.png", themePath); scrollbarBox = Resources::GetImageData("scrollbar_box.png");
scrollbarBox = new GuiImageData(imgPath, scrollbar_box_png);
scrollbarBoxImg = new GuiImage(scrollbarBox); scrollbarBoxImg = new GuiImage(scrollbarBox);
scrollbarBoxOver = new GuiImageData(imgPath, scrollbar_box_png); scrollbarBoxOver = Resources::GetImageData("scrollbar_box.png");
scrollbarBoxOverImg = new GuiImage(scrollbarBoxOver); scrollbarBoxOverImg = new GuiImage(scrollbarBoxOver);
arrowUpBtn = new GuiButton(arrowUpImg->GetWidth(), arrowUpImg->GetHeight()); arrowUpBtn = new GuiButton(arrowUpImg->GetWidth(), arrowUpImg->GetHeight());

View File

@ -4,6 +4,7 @@
#include "../wpad.h" #include "../wpad.h"
#include "../main.h" #include "../main.h"
#include "../settings/CSettings.h" #include "../settings/CSettings.h"
#include "../themes/CTheme.h"
#include "../usbloader/GameList.h" #include "../usbloader/GameList.h"
extern GuiWindow * mainWindow; extern GuiWindow * mainWindow;
@ -30,11 +31,10 @@ class cSearchButton
GuiSearchBar::GuiSearchBar(const wchar_t *SearchChars) : GuiSearchBar::GuiSearchBar(const wchar_t *SearchChars) :
inSide(0), text((char *) NULL, 22, ( GXColor ) inSide(0), text((char *) NULL, 22, ( GXColor )
{ 0, 0, 0, 255}), buttons(0), keyImageData(keyboard_key_png), keyOverImageData(keyboard_key_over_png), sndOver( { 0, 0, 0, 255}), buttons(0), keyImageData(keyboard_key_png, keyboard_key_png_size), keyOverImageData(keyboard_key_over_png, keyboard_key_over_png_size), sndOver(
button_over_pcm, button_over_pcm_size, Settings.sfxvolume), sndClick(button_click_pcm, button_over_pcm, button_over_pcm_size, Settings.sfxvolume), sndClick(button_click_pcm,
button_click_pcm_size, Settings.sfxvolume) button_click_pcm_size, Settings.sfxvolume)
{ {
char imgPath[100];
trig.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); trig.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
@ -69,8 +69,7 @@ GuiSearchBar::GuiSearchBar(const wchar_t *SearchChars) :
text.SetMaxWidth(width - (10 + 2 * 42 + 10), SCROLL_HORIZONTAL); text.SetMaxWidth(width - (10 + 2 * 42 + 10), SCROLL_HORIZONTAL);
this->Append(&text); this->Append(&text);
snprintf(imgPath, sizeof(imgPath), "%skeyboard_backspace_over.png", Settings.theme_path); imgBacspaceBtn = Resources::GetImageData("keyboard_backspace_over.png");
imgBacspaceBtn = new GuiImageData(imgPath, keyboard_backspace_over_png);
BacspaceBtnImg_Over = new GuiImage(imgBacspaceBtn); BacspaceBtnImg_Over = new GuiImage(imgBacspaceBtn);
BacspaceBtnImg = new GuiImage(BacspaceBtnImg_Over); BacspaceBtnImg = new GuiImage(BacspaceBtnImg_Over);
BacspaceBtnImg->SetGrayscale(); BacspaceBtnImg->SetGrayscale();
@ -78,8 +77,7 @@ GuiSearchBar::GuiSearchBar(const wchar_t *SearchChars) :
&sndClick, 1); &sndClick, 1);
this->Append(BacspaceBtn); this->Append(BacspaceBtn);
snprintf(imgPath, sizeof(imgPath), "%skeyboard_clear_over.png", Settings.theme_path); imgClearBtn = Resources::GetImageData("keyboard_clear_over.png");
imgClearBtn = new GuiImageData(imgPath, keyboard_clear_over_png);
ClearBtnImg_Over = new GuiImage(imgClearBtn); ClearBtnImg_Over = new GuiImage(imgClearBtn);
ClearBtnImg = new GuiImage(ClearBtnImg_Over); ClearBtnImg = new GuiImage(ClearBtnImg_Over);
ClearBtnImg->SetGrayscale(); ClearBtnImg->SetGrayscale();

View File

@ -10,9 +10,9 @@
#include "gui.h" #include "gui.h"
static GuiImageData tooltipLeft(tooltip_left_png); static GuiImageData tooltipLeft(tooltip_left_png, tooltip_left_png_size);
static GuiImageData tooltipTile(tooltip_tile_png); static GuiImageData tooltipTile(tooltip_tile_png, tooltip_left_png_size);
static GuiImageData tooltipRight(tooltip_right_png); static GuiImageData tooltipRight(tooltip_right_png, tooltip_right_png_size);
/** /**
* Constructor for the GuiTooltip class. * Constructor for the GuiTooltip class.

View File

@ -218,13 +218,13 @@ GuiImageData *LoadCoverImage(struct discHdr *header, bool Prefere3D, bool noCove
//Load full id image //Load full id image
snprintf(Path, sizeof(Path), "%s%s.png", coverPath, IDfull); snprintf(Path, sizeof(Path), "%s%s.png", coverPath, IDfull);
delete Cover; delete Cover;
Cover = new (std::nothrow) GuiImageData(Path, NULL); Cover = new (std::nothrow) GuiImageData(Path);
//Load short id image //Load short id image
if (!Cover || !Cover->GetImage()) if (!Cover || !Cover->GetImage())
{ {
snprintf(Path, sizeof(Path), "%s%s.png", coverPath, ID); snprintf(Path, sizeof(Path), "%s%s.png", coverPath, ID);
delete Cover; delete Cover;
Cover = new (std::nothrow) GuiImageData(Path, NULL); Cover = new (std::nothrow) GuiImageData(Path);
} }
if (Cover && Cover->GetImage()) break; if (Cover && Cover->GetImage()) break;
} }
@ -234,11 +234,9 @@ GuiImageData *LoadCoverImage(struct discHdr *header, bool Prefere3D, bool noCove
flag = Prefere3D; flag = Prefere3D;
for (int i = 0; i < 2; ++i) for (int i = 0; i < 2; ++i)
{ {
const char *nocoverPath = (flag ? "%snoimage.png" : "%snoimage2d.png");
flag = !flag; flag = !flag;
snprintf(Path, sizeof(Path), nocoverPath, Settings.theme_path);
delete Cover; delete Cover;
Cover = new (std::nothrow) GuiImageData(Path, (Prefere3D ? nocover_png : nocoverFlat_png)); Cover = new (std::nothrow) GuiImageData(Resources::GetFile(Prefere3D ? "nocover.png" : "nocoverFlat.png"), Resources::GetFileSize(Prefere3D ? "nocover.png" : "nocoverFlat.png"));
if (Cover && Cover->GetImage()) break; if (Cover && Cover->GetImage()) break;
} }
} }
@ -257,27 +255,20 @@ int MainMenu(int menu)
{ {
currentMenu = menu; currentMenu = menu;
char imgPath[100];
//if (strcmp(headlessID,"")!=0)HaltGui(); //if (strcmp(headlessID,"")!=0)HaltGui();
//WindowPrompt("Can you see me now",0,"ok"); //WindowPrompt("Can you see me now",0,"ok");
snprintf(imgPath, sizeof(imgPath), "%splayer1_point.png", Settings.theme_path); pointer[0] = new GuiImageData(Resources::GetFile("player1_point.png"), Resources::GetFileSize("player1_point.png"));
pointer[0] = new GuiImageData(imgPath, player1_point_png); pointer[1] = new GuiImageData(Resources::GetFile("player2_point.png"), Resources::GetFileSize("player2_point.png"));
snprintf(imgPath, sizeof(imgPath), "%splayer2_point.png", Settings.theme_path); pointer[2] = new GuiImageData(Resources::GetFile("player3_point.png"), Resources::GetFileSize("player3_point.png"));
pointer[1] = new GuiImageData(imgPath, player2_point_png); pointer[3] = new GuiImageData(Resources::GetFile("player4_point.png"), Resources::GetFileSize("player4_point.png"));
snprintf(imgPath, sizeof(imgPath), "%splayer3_point.png", Settings.theme_path);
pointer[2] = new GuiImageData(imgPath, player3_point_png);
snprintf(imgPath, sizeof(imgPath), "%splayer4_point.png", Settings.theme_path);
pointer[3] = new GuiImageData(imgPath, player4_point_png);
mainWindow = new GuiWindow(screenwidth, screenheight); mainWindow = new GuiWindow(screenwidth, screenheight);
const char * image = Settings.widescreen ? "wbackground.png" : "background.png";
if (Settings.widescreen) background = new GuiImageData(Resources::GetFile(image), Resources::GetFileSize(image));
snprintf(imgPath, sizeof(imgPath), "%swbackground.png", Settings.theme_path);
else snprintf(imgPath, sizeof(imgPath), "%sbackground.png", Settings.theme_path);
background = new GuiImageData(imgPath, Settings.widescreen ? wbackground_png : background_png);
bgImg = new GuiImage(background); bgImg = new GuiImage(background);
mainWindow->Append(bgImg); mainWindow->Append(bgImg);

View File

@ -63,7 +63,6 @@ int MenuDiscList()
char ID[4]; char ID[4];
char IDfull[7]; char IDfull[7];
u32 covert = 0; u32 covert = 0;
char imgPath[100];
if (!dvdheader) dvdheader = new struct discHdr; if (!dvdheader) dvdheader = new struct discHdr;
u8 mountMethodOLD = 0; u8 mountMethodOLD = 0;
@ -103,80 +102,46 @@ int MenuDiscList()
if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
// GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
snprintf(imgPath, sizeof(imgPath), "%sbutton_install.png", Settings.theme_path); GuiImageData btnInstall(Resources::GetFile("button_install.png"), Resources::GetFileSize("button_install.png"));
GuiImageData btnInstall(imgPath, button_install_png); GuiImageData btnInstallOver(Resources::GetFile("button_install_over.png"), Resources::GetFileSize("button_install_over.png"));
snprintf(imgPath, sizeof(imgPath), "%sbutton_install_over.png", Settings.theme_path);
GuiImageData btnInstallOver(imgPath, button_install_over_png);
snprintf(imgPath, sizeof(imgPath), "%ssettings_button.png", Settings.theme_path); GuiImageData btnSettings(Resources::GetFile("settings_button.png"), Resources::GetFileSize("settings_button.png"));
GuiImageData btnSettings(imgPath, settings_button_png); GuiImageData btnSettingsOver(Resources::GetFile("settings_button_over.png"), Resources::GetFileSize("settings_button_over.png"));
snprintf(imgPath, sizeof(imgPath), "%ssettings_button_over.png", Settings.theme_path);
GuiImageData btnSettingsOver(imgPath, settings_button_over_png);
snprintf(imgPath, sizeof(imgPath), "%swiimote_poweroff.png", Settings.theme_path); GuiImageData btnpwroff(Resources::GetFile("wiimote_poweroff.png"), Resources::GetFileSize("wiimote_poweroff.png"));
GuiImageData btnpwroff(imgPath, wiimote_poweroff_png); GuiImageData btnpwroffOver(Resources::GetFile("wiimote_poweroff_over.png"), Resources::GetFileSize("wiimote_poweroff_over.png"));
snprintf(imgPath, sizeof(imgPath), "%swiimote_poweroff_over.png", Settings.theme_path); GuiImageData btnhome(Resources::GetFile("menu_button.png"), Resources::GetFileSize("menu_button.png"));
GuiImageData btnpwroffOver(imgPath, wiimote_poweroff_over_png); GuiImageData btnhomeOver(Resources::GetFile("menu_button_over.png"), Resources::GetFileSize("menu_button_over.png"));
snprintf(imgPath, sizeof(imgPath), "%smenu_button.png", Settings.theme_path); GuiImageData btnsdcardOver(Resources::GetFile("sdcard_over.png"), Resources::GetFileSize("sdcard_over.png"));
GuiImageData btnhome(imgPath, menu_button_png); GuiImageData btnsdcard(Resources::GetFile("sdcard.png"), Resources::GetFileSize("sdcard.png"));
snprintf(imgPath, sizeof(imgPath), "%smenu_button_over.png", Settings.theme_path);
GuiImageData btnhomeOver(imgPath, menu_button_over_png);
snprintf(imgPath, sizeof(imgPath), "%sSDcard_over.png", Settings.theme_path);
GuiImageData btnsdcardOver(imgPath, sdcard_over_png);
snprintf(imgPath, sizeof(imgPath), "%sSDcard.png", Settings.theme_path);
GuiImageData btnsdcard(imgPath, sdcard_png);
snprintf(imgPath, sizeof(imgPath), "%sfavIcon.png", Settings.theme_path); GuiImageData imgfavIcon(Resources::GetFile("favIcon.png"), Resources::GetFileSize("favIcon.png"));
GuiImageData imgfavIcon(imgPath, favIcon_png); GuiImageData imgfavIcon_gray(Resources::GetFile("favIcon_gray.png"), Resources::GetFileSize("favIcon_gray.png"));
snprintf(imgPath, sizeof(imgPath), "%sfavIcon_gray.png", Settings.theme_path); GuiImageData imgsearchIcon(Resources::GetFile("searchIcon.png"), Resources::GetFileSize("searchIcon.png"));
GuiImageData imgfavIcon_gray(imgPath, NULL); GuiImageData imgsearchIcon_gray(Resources::GetFile("searchIcon_gray.png"), Resources::GetFileSize("searchIcon_gray.png"));
snprintf(imgPath, sizeof(imgPath), "%ssearchIcon.png", Settings.theme_path); GuiImageData imgabcIcon(Resources::GetFile("abcIcon.png"), Resources::GetFileSize("abcIcon.png"));
GuiImageData imgsearchIcon(imgPath, searchIcon_png); GuiImageData imgabcIcon_gray(Resources::GetFile("abcIcon_gray.png"), Resources::GetFileSize("abcIcon_gray.png"));
snprintf(imgPath, sizeof(imgPath), "%ssearchIcon_gray.png", Settings.theme_path); GuiImageData imgrankIcon(Resources::GetFile("rankIcon.png"), Resources::GetFileSize("rankIcon.png"));
GuiImageData imgsearchIcon_gray(imgPath, NULL); GuiImageData imgrankIcon_gray(Resources::GetFile("rankIcon_gray.png"), Resources::GetFileSize("rankIcon_gray.png"));
snprintf(imgPath, sizeof(imgPath), "%sabcIcon.png", Settings.theme_path); GuiImageData imgplayCountIcon(Resources::GetFile("playCountIcon.png"), Resources::GetFileSize("playCountIcon.png"));
GuiImageData imgabcIcon(imgPath, abcIcon_png); GuiImageData imgplayCountIcon_gray(Resources::GetFile("playCountIcon_gray.png"), Resources::GetFileSize("playCountIcon_gray.png"));
snprintf(imgPath, sizeof(imgPath), "%sabcIcon_gray.png", Settings.theme_path); GuiImageData imgarrangeGrid(Resources::GetFile("arrangeGrid.png"), Resources::GetFileSize("arrangeGrid.png"));
GuiImageData imgabcIcon_gray(imgPath, NULL); GuiImageData imgarrangeGrid_gray(Resources::GetFile("arrangeGrid_gray.png"), Resources::GetFileSize("arrangeGrid_gray.png"));
snprintf(imgPath, sizeof(imgPath), "%srankIcon.png", Settings.theme_path); GuiImageData imgarrangeList(Resources::GetFile("arrangeList.png"), Resources::GetFileSize("arrangeList.png"));
GuiImageData imgrankIcon(imgPath, rankIcon_png); GuiImageData imgarrangeList_gray(Resources::GetFile("arrangeList_gray.png"), Resources::GetFileSize("arrangeList_gray.png"));
snprintf(imgPath, sizeof(imgPath), "%srankIcon_gray.png", Settings.theme_path); GuiImageData imgarrangeCarousel(Resources::GetFile("arrangeCarousel.png"), Resources::GetFileSize("arrangeCarousel.png"));
GuiImageData imgrankIcon_gray(imgPath, NULL); GuiImageData imgarrangeCarousel_gray(Resources::GetFile("arrangeCarousel_gray.png"), Resources::GetFileSize("arrangeCarousel_gray.png"));
snprintf(imgPath, sizeof(imgPath), "%splayCountIcon.png", Settings.theme_path);
GuiImageData imgplayCountIcon(imgPath, playCountIcon_png);
snprintf(imgPath, sizeof(imgPath), "%splayCountIcon_gray.png", Settings.theme_path);
GuiImageData imgplayCountIcon_gray(imgPath, NULL);
snprintf(imgPath, sizeof(imgPath), "%sarrangeGrid.png", Settings.theme_path);
GuiImageData imgarrangeGrid(imgPath, arrangeGrid_png);
snprintf(imgPath, sizeof(imgPath), "%sarrangeGrid_gray.png", Settings.theme_path);
GuiImageData imgarrangeGrid_gray(imgPath, NULL);
snprintf(imgPath, sizeof(imgPath), "%sarrangeList.png", Settings.theme_path);
GuiImageData imgarrangeList(imgPath, arrangeList_png);
snprintf(imgPath, sizeof(imgPath), "%sarrangeList_gray.png", Settings.theme_path);
GuiImageData imgarrangeList_gray(imgPath, NULL);
snprintf(imgPath, sizeof(imgPath), "%sarrangeCarousel.png", Settings.theme_path);
GuiImageData imgarrangeCarousel(imgPath, arrangeCarousel_png);
snprintf(imgPath, sizeof(imgPath), "%sarrangeCarousel_gray.png", Settings.theme_path);
GuiImageData imgarrangeCarousel_gray(imgPath, NULL);
snprintf(imgPath, sizeof(imgPath), "%slock.png", Settings.theme_path); GuiImageData imgLock(Resources::GetFile("lock.png"), Resources::GetFileSize("lock.png"));
GuiImageData imgLock(imgPath, lock_png); GuiImageData imgLock_gray(Resources::GetFile("lock_gray.png"), Resources::GetFileSize("lock_gray.png"));
snprintf(imgPath, sizeof(imgPath), "%slock_gray.png", Settings.theme_path); GuiImageData imgUnlock(Resources::GetFile("lock_gray.png"), Resources::GetFileSize("lock_gray.png"));
GuiImageData imgLock_gray(imgPath, NULL); GuiImageData imgUnlock_gray(Resources::GetFile("unlock_gray.png"), Resources::GetFileSize("unlock_gray.png"));
snprintf(imgPath, sizeof(imgPath), "%sunlock.png", Settings.theme_path);
GuiImageData imgUnlock(imgPath, unlock_png);
snprintf(imgPath, sizeof(imgPath), "%sunlock_gray.png", Settings.theme_path);
GuiImageData imgUnlock_gray(imgPath, NULL);
snprintf(imgPath, sizeof(imgPath), "%sdvd.png", Settings.theme_path); GuiImageData imgdvd(Resources::GetFile("dvd.png"), Resources::GetFileSize("dvd.png"));
GuiImageData imgdvd(imgPath, dvd_png); GuiImageData imgdvd_gray(Resources::GetFile("dvd_gray.png"), Resources::GetFileSize("dvd_gray.png"));
snprintf(imgPath, sizeof(imgPath), "%sdvd_gray.png", Settings.theme_path);
GuiImageData imgdvd_gray(imgPath, NULL);
snprintf(imgPath, sizeof(imgPath), "%sbrowser.png", Settings.theme_path); GuiImageData homebrewImgData(Resources::GetFile("browser.png"), Resources::GetFileSize("browser.png"));
GuiImageData homebrewImgData(imgPath, browser_png); GuiImageData homebrewImgDataOver(Resources::GetFile("browser_over.png"), Resources::GetFileSize("browser_over.png"));
snprintf(imgPath, sizeof(imgPath), "%sbrowser_over.png", Settings.theme_path);
GuiImageData homebrewImgDataOver(imgPath, browser_over_png);
GuiTrigger trigA; GuiTrigger trigA;
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
@ -290,11 +255,6 @@ int MenuDiscList()
GuiImage favoriteBtnImg(&imgfavIcon); GuiImage favoriteBtnImg(&imgfavIcon);
favoriteBtnImg.SetWidescreen(Settings.widescreen); favoriteBtnImg.SetWidescreen(Settings.widescreen);
GuiImage favoriteBtnImg_g(&imgfavIcon_gray); GuiImage favoriteBtnImg_g(&imgfavIcon_gray);
if (favoriteBtnImg_g.GetImage() == NULL)
{
favoriteBtnImg_g = favoriteBtnImg;
favoriteBtnImg_g.SetGrayscale();
}
favoriteBtnImg_g.SetWidescreen(Settings.widescreen); favoriteBtnImg_g.SetWidescreen(Settings.widescreen);
GuiButton favoriteBtn(&favoriteBtnImg_g, &favoriteBtnImg_g, ALIGN_LEFT, ALIGN_TOP, Theme.gamelist_favorite_x, GuiButton favoriteBtn(&favoriteBtnImg_g, &favoriteBtnImg_g, ALIGN_LEFT, ALIGN_TOP, Theme.gamelist_favorite_x,
Theme.gamelist_favorite_y, &trigA, &btnSoundOver, btnClick2, 1, &favoriteBtnTT, -15, 52, 0, 3); Theme.gamelist_favorite_y, &trigA, &btnSoundOver, btnClick2, 1, &favoriteBtnTT, -15, 52, 0, 3);
@ -306,11 +266,6 @@ int MenuDiscList()
GuiImage searchBtnImg(&imgsearchIcon); GuiImage searchBtnImg(&imgsearchIcon);
searchBtnImg.SetWidescreen(Settings.widescreen); searchBtnImg.SetWidescreen(Settings.widescreen);
GuiImage searchBtnImg_g(&imgsearchIcon_gray); GuiImage searchBtnImg_g(&imgsearchIcon_gray);
if (searchBtnImg_g.GetImage() == NULL)
{
searchBtnImg_g = searchBtnImg;
searchBtnImg_g.SetGrayscale();
}
searchBtnImg_g.SetWidescreen(Settings.widescreen); searchBtnImg_g.SetWidescreen(Settings.widescreen);
GuiButton searchBtn(&searchBtnImg_g, &searchBtnImg_g, ALIGN_LEFT, ALIGN_TOP, Theme.gamelist_search_x, GuiButton searchBtn(&searchBtnImg_g, &searchBtnImg_g, ALIGN_LEFT, ALIGN_TOP, Theme.gamelist_search_x,
Theme.gamelist_search_y, &trigA, &btnSoundOver, btnClick2, 1, &searchBtnTT, -15, 52, 0, 3); Theme.gamelist_search_y, &trigA, &btnSoundOver, btnClick2, 1, &searchBtnTT, -15, 52, 0, 3);
@ -322,11 +277,6 @@ int MenuDiscList()
GuiImage abcBtnImg(Settings.fave ? &imgrankIcon : &imgabcIcon); GuiImage abcBtnImg(Settings.fave ? &imgrankIcon : &imgabcIcon);
abcBtnImg.SetWidescreen(Settings.widescreen); abcBtnImg.SetWidescreen(Settings.widescreen);
GuiImage abcBtnImg_g(Settings.fave ? &imgrankIcon_gray : &imgabcIcon_gray); GuiImage abcBtnImg_g(Settings.fave ? &imgrankIcon_gray : &imgabcIcon_gray);
if (abcBtnImg_g.GetImage() == NULL)
{
abcBtnImg_g = abcBtnImg;
abcBtnImg_g.SetGrayscale();
}
abcBtnImg_g.SetWidescreen(Settings.widescreen); abcBtnImg_g.SetWidescreen(Settings.widescreen);
GuiButton abcBtn(&abcBtnImg_g, &abcBtnImg_g, ALIGN_LEFT, ALIGN_TOP, Theme.gamelist_abc_x, Theme.gamelist_abc_y, GuiButton abcBtn(&abcBtnImg_g, &abcBtnImg_g, ALIGN_LEFT, ALIGN_TOP, Theme.gamelist_abc_x, Theme.gamelist_abc_y,
&trigA, &btnSoundOver, btnClick2, 1, &abcBtnTT, -15, 52, 0, 3); &trigA, &btnSoundOver, btnClick2, 1, &abcBtnTT, -15, 52, 0, 3);
@ -338,11 +288,6 @@ int MenuDiscList()
GuiImage countBtnImg(&imgplayCountIcon); GuiImage countBtnImg(&imgplayCountIcon);
countBtnImg.SetWidescreen(Settings.widescreen); countBtnImg.SetWidescreen(Settings.widescreen);
GuiImage countBtnImg_g(&imgplayCountIcon_gray); GuiImage countBtnImg_g(&imgplayCountIcon_gray);
if (countBtnImg_g.GetImage() == NULL)
{
countBtnImg_g = countBtnImg;
countBtnImg_g.SetGrayscale();
}
countBtnImg_g.SetWidescreen(Settings.widescreen); countBtnImg_g.SetWidescreen(Settings.widescreen);
GuiButton countBtn(&countBtnImg_g, &countBtnImg_g, ALIGN_LEFT, ALIGN_TOP, Theme.gamelist_count_x, GuiButton countBtn(&countBtnImg_g, &countBtnImg_g, ALIGN_LEFT, ALIGN_TOP, Theme.gamelist_count_x,
Theme.gamelist_count_y, &trigA, &btnSoundOver, btnClick2, 1, &countBtnTT, -15, 52, 0, 3); Theme.gamelist_count_y, &trigA, &btnSoundOver, btnClick2, 1, &countBtnTT, -15, 52, 0, 3);
@ -354,11 +299,6 @@ int MenuDiscList()
GuiImage listBtnImg(&imgarrangeList); GuiImage listBtnImg(&imgarrangeList);
listBtnImg.SetWidescreen(Settings.widescreen); listBtnImg.SetWidescreen(Settings.widescreen);
GuiImage listBtnImg_g(&imgarrangeList_gray); GuiImage listBtnImg_g(&imgarrangeList_gray);
if (listBtnImg_g.GetImage() == NULL)
{
listBtnImg_g = listBtnImg;
listBtnImg_g.SetGrayscale();
}
listBtnImg_g.SetWidescreen(Settings.widescreen); listBtnImg_g.SetWidescreen(Settings.widescreen);
GuiButton listBtn(&listBtnImg_g, &listBtnImg_g, ALIGN_LEFT, ALIGN_TOP, Theme.gamelist_list_x, GuiButton listBtn(&listBtnImg_g, &listBtnImg_g, ALIGN_LEFT, ALIGN_TOP, Theme.gamelist_list_x,
Theme.gamelist_list_y, &trigA, &btnSoundOver, btnClick2, 1, &listBtnTT, 15, 52, 1, 3); Theme.gamelist_list_y, &trigA, &btnSoundOver, btnClick2, 1, &listBtnTT, 15, 52, 1, 3);
@ -370,11 +310,6 @@ int MenuDiscList()
GuiImage gridBtnImg(&imgarrangeGrid); GuiImage gridBtnImg(&imgarrangeGrid);
gridBtnImg.SetWidescreen(Settings.widescreen); gridBtnImg.SetWidescreen(Settings.widescreen);
GuiImage gridBtnImg_g(&imgarrangeGrid_gray); GuiImage gridBtnImg_g(&imgarrangeGrid_gray);
if (gridBtnImg_g.GetImage() == NULL)
{
gridBtnImg_g = gridBtnImg;
gridBtnImg_g.SetGrayscale();
}
gridBtnImg_g.SetWidescreen(Settings.widescreen); gridBtnImg_g.SetWidescreen(Settings.widescreen);
GuiButton gridBtn(&gridBtnImg_g, &gridBtnImg_g, ALIGN_LEFT, ALIGN_TOP, Theme.gamelist_grid_x, GuiButton gridBtn(&gridBtnImg_g, &gridBtnImg_g, ALIGN_LEFT, ALIGN_TOP, Theme.gamelist_grid_x,
Theme.gamelist_grid_y, &trigA, &btnSoundOver, btnClick2, 1, &gridBtnTT, 15, 52, 1, 3); Theme.gamelist_grid_y, &trigA, &btnSoundOver, btnClick2, 1, &gridBtnTT, 15, 52, 1, 3);
@ -386,11 +321,6 @@ int MenuDiscList()
GuiImage carouselBtnImg(&imgarrangeCarousel); GuiImage carouselBtnImg(&imgarrangeCarousel);
carouselBtnImg.SetWidescreen(Settings.widescreen); carouselBtnImg.SetWidescreen(Settings.widescreen);
GuiImage carouselBtnImg_g(&imgarrangeCarousel_gray); GuiImage carouselBtnImg_g(&imgarrangeCarousel_gray);
if (carouselBtnImg_g.GetImage() == NULL)
{
carouselBtnImg_g = carouselBtnImg;
carouselBtnImg_g.SetGrayscale();
}
carouselBtnImg_g.SetWidescreen(Settings.widescreen); carouselBtnImg_g.SetWidescreen(Settings.widescreen);
GuiButton carouselBtn(&carouselBtnImg_g, &carouselBtnImg_g, ALIGN_LEFT, ALIGN_TOP, Theme.gamelist_carousel_x, GuiButton carouselBtn(&carouselBtnImg_g, &carouselBtnImg_g, ALIGN_LEFT, ALIGN_TOP, Theme.gamelist_carousel_x,
Theme.gamelist_carousel_y, &trigA, &btnSoundOver, btnClick2, 1, &carouselBtnTT, 15, 52, 1, 3); Theme.gamelist_carousel_y, &trigA, &btnSoundOver, btnClick2, 1, &carouselBtnTT, 15, 52, 1, 3);
@ -404,11 +334,6 @@ int MenuDiscList()
GuiImage lockBtnImg(&imgLock); GuiImage lockBtnImg(&imgLock);
lockBtnImg.SetWidescreen(Settings.widescreen); lockBtnImg.SetWidescreen(Settings.widescreen);
GuiImage lockBtnImg_g(&imgLock_gray); GuiImage lockBtnImg_g(&imgLock_gray);
if (lockBtnImg_g.GetImage() == NULL)
{
lockBtnImg_g = lockBtnImg;
lockBtnImg_g.SetGrayscale();
}
lockBtnImg_g.SetWidescreen(Settings.widescreen); lockBtnImg_g.SetWidescreen(Settings.widescreen);
GuiButton lockBtn(&lockBtnImg_g, &lockBtnImg_g, ALIGN_LEFT, ALIGN_TOP, Theme.gamelist_lock_x, GuiButton lockBtn(&lockBtnImg_g, &lockBtnImg_g, ALIGN_LEFT, ALIGN_TOP, Theme.gamelist_lock_x,
Theme.gamelist_lock_y, &trigA, &btnSoundOver, btnClick2, 1, &lockBtnTT, 15, 52, 1, 3); Theme.gamelist_lock_y, &trigA, &btnSoundOver, btnClick2, 1, &lockBtnTT, 15, 52, 1, 3);
@ -420,11 +345,6 @@ int MenuDiscList()
GuiImage unlockBtnImg(&imgUnlock); GuiImage unlockBtnImg(&imgUnlock);
unlockBtnImg.SetWidescreen(Settings.widescreen); unlockBtnImg.SetWidescreen(Settings.widescreen);
GuiImage unlockBtnImg_g(&imgUnlock_gray); GuiImage unlockBtnImg_g(&imgUnlock_gray);
if (unlockBtnImg_g.GetImage() == NULL)
{
unlockBtnImg_g = unlockBtnImg;
unlockBtnImg_g.SetGrayscale();
}
unlockBtnImg_g.SetWidescreen(Settings.widescreen); unlockBtnImg_g.SetWidescreen(Settings.widescreen);
if (canUnlock && Settings.godmode) if (canUnlock && Settings.godmode)
@ -581,8 +501,7 @@ int MenuDiscList()
GuiGameCarousel * gameCarousel = NULL; GuiGameCarousel * gameCarousel = NULL;
if (Settings.gameDisplay == list) if (Settings.gameDisplay == list)
{ {
gameBrowser = new GuiGameBrowser(Theme.gamelist_w, Theme.gamelist_h, Settings.theme_path, bg_options_png, gameBrowser = new GuiGameBrowser(Theme.gamelist_w, Theme.gamelist_h, startat, offset);
startat, offset);
gameBrowser->SetPosition(Theme.gamelist_x, Theme.gamelist_y); gameBrowser->SetPosition(Theme.gamelist_x, Theme.gamelist_y);
gameBrowser->SetAlignment(ALIGN_LEFT, ALIGN_CENTRE); gameBrowser->SetAlignment(ALIGN_LEFT, ALIGN_CENTRE);
} }
@ -1765,35 +1684,26 @@ void rockout(int f)
{ {
HaltGui(); HaltGui();
char imgPath[100];
if (gameSelected >= 0 && gameSelected < gameList.size() && (strcasestr(get_title(gameList[gameSelected]), "guitar") if (gameSelected >= 0 && gameSelected < gameList.size() && (strcasestr(get_title(gameList[gameSelected]), "guitar")
|| strcasestr(get_title(gameList[gameSelected]), "band") || strcasestr(get_title(gameList[gameSelected]), || strcasestr(get_title(gameList[gameSelected]), "band") || strcasestr(get_title(gameList[gameSelected]),
"rock"))) "rock")))
{ {
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
delete pointer[i]; delete pointer[i];
snprintf(imgPath, sizeof(imgPath), "%srplayer1_point.png", Settings.theme_path); pointer[0] = Resources::GetImageData("rplayer1_point.png");
pointer[0] = new GuiImageData(imgPath, rplayer1_point_png); pointer[1] = Resources::GetImageData("rplayer2_point.png");
snprintf(imgPath, sizeof(imgPath), "%srplayer2_point.png", Settings.theme_path); pointer[2] = Resources::GetImageData("rplayer3_point.png");
pointer[1] = new GuiImageData(imgPath, rplayer2_point_png); pointer[3] = Resources::GetImageData("rplayer4_point.png");
snprintf(imgPath, sizeof(imgPath), "%srplayer3_point.png", Settings.theme_path);
pointer[2] = new GuiImageData(imgPath, rplayer3_point_png);
snprintf(imgPath, sizeof(imgPath), "%srplayer4_point.png", Settings.theme_path);
pointer[3] = new GuiImageData(imgPath, rplayer4_point_png);
} }
else else
{ {
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
delete pointer[i]; delete pointer[i];
snprintf(imgPath, sizeof(imgPath), "%splayer1_point.png", Settings.theme_path); pointer[0] = Resources::GetImageData("player1_point.png");
pointer[0] = new GuiImageData(imgPath, player1_point_png); pointer[1] = Resources::GetImageData("player2_point.png");
snprintf(imgPath, sizeof(imgPath), "%splayer2_point.png", Settings.theme_path); pointer[2] = Resources::GetImageData("player3_point.png");
pointer[1] = new GuiImageData(imgPath, player2_point_png); pointer[3] = Resources::GetImageData("player4_point.png");
snprintf(imgPath, sizeof(imgPath), "%splayer3_point.png", Settings.theme_path);
pointer[2] = new GuiImageData(imgPath, player3_point_png);
snprintf(imgPath, sizeof(imgPath), "%splayer4_point.png", Settings.theme_path);
pointer[3] = new GuiImageData(imgPath, player4_point_png);
} }
ResumeGui(); ResumeGui();
} }

View File

@ -23,7 +23,6 @@ int MenuFormat()
USBStorage2_Init(); USBStorage2_Init();
int menu = MENU_NONE; int menu = MENU_NONE;
char imgPath[100];
customOptionList options(MAX_PARTITIONS_EX); customOptionList options(MAX_PARTITIONS_EX);
extern PartList partitions; extern PartList partitions;
@ -56,19 +55,15 @@ int MenuFormat()
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, Settings.sfxvolume); GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, Settings.sfxvolume);
// because destroy GuiSound must wait while sound playing is finished, we use a global sound // because destroy GuiSound must wait while sound playing is finished, we use a global sound
if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
// GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
snprintf(imgPath, sizeof(imgPath), "%swiimote_poweroff.png", Settings.theme_path); GuiImageData btnpwroff(Resources::GetFile("wiimote_poweroff.png"), Resources::GetFileSize("wiimote_poweroff.png"));
GuiImageData btnpwroff(imgPath, wiimote_poweroff_png); GuiImageData btnpwroffOver(Resources::GetFile("wiimote_poweroff_over.png"), Resources::GetFileSize("wiimote_poweroff_over.png"));
snprintf(imgPath, sizeof(imgPath), "%swiimote_poweroff_over.png", Settings.theme_path); GuiImageData btnhome(Resources::GetFile("menu_button.png"), Resources::GetFileSize("menu_button.png"));
GuiImageData btnpwroffOver(imgPath, wiimote_poweroff_over_png); GuiImageData btnhomeOver(Resources::GetFile("menu_button_over.png"), Resources::GetFileSize("menu_button_over.png"));
snprintf(imgPath, sizeof(imgPath), "%smenu_button.png", Settings.theme_path); GuiImageData battery(Resources::GetFile("battery.png"), Resources::GetFileSize("battery.png"));
GuiImageData btnhome(imgPath, menu_button_png); GuiImageData batteryBar(Resources::GetFile("battery_bar.png"), Resources::GetFileSize("battery_bar.png"));
snprintf(imgPath, sizeof(imgPath), "%smenu_button_over.png", Settings.theme_path); GuiImageData batteryRed(Resources::GetFile("battery_red.png"), Resources::GetFileSize("battery_red.png"));
GuiImageData btnhomeOver(imgPath, menu_button_over_png); GuiImageData batteryBarRed(Resources::GetFile("battery_bar_red.png"), Resources::GetFileSize("battery_bar_red.png"));
GuiImageData battery(battery_png);
GuiImageData batteryBar(battery_bar_png);
GuiImageData batteryRed(battery_red_png);
GuiImageData batteryBarRed(battery_bar_red_png);
GuiTrigger trigA; GuiTrigger trigA;
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
@ -89,8 +84,7 @@ int MenuFormat()
1); 1);
exitBtn.SetTrigger(&trigHome); exitBtn.SetTrigger(&trigHome);
GuiCustomOptionBrowser optionBrowser(396, 280, &options, Settings.theme_path, "bg_options_settings.png", GuiCustomOptionBrowser optionBrowser(396, 280, &options, "bg_options_settings.png", 0, 10);
bg_options_settings_png, 0, 10);
optionBrowser.SetPosition(0, 40); optionBrowser.SetPosition(0, 40);
optionBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); optionBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);

View File

@ -5,6 +5,7 @@
#include "usbloader/utils.h" #include "usbloader/utils.h"
#include "usbloader/GameList.h" #include "usbloader/GameList.h"
#include "prompts/ProgressWindow.h" #include "prompts/ProgressWindow.h"
#include "themes/CTheme.h"
float gamesize; float gamesize;
@ -26,16 +27,10 @@ int MenuInstall()
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, Settings.sfxvolume); GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, Settings.sfxvolume);
char imgPath[100]; GuiImageData battery(Resources::GetFile("battery.png"), Resources::GetFileSize("battery.png"));
GuiImageData batteryBar(Resources::GetFile("battery_bar.png"), Resources::GetFileSize("battery_bar.png"));
snprintf(imgPath, sizeof(imgPath), "%sbattery.png", Settings.theme_path); GuiImageData batteryRed(Resources::GetFile("battery_red.png"), Resources::GetFileSize("battery_red.png"));
GuiImageData battery(imgPath, battery_png); GuiImageData batteryBarRed(Resources::GetFile("battery_bar_red.png"), Resources::GetFileSize("battery_bar_red.png"));
snprintf(imgPath, sizeof(imgPath), "%sbattery_bar.png", Settings.theme_path);
GuiImageData batteryBar(imgPath, battery_bar_png);
snprintf(imgPath, sizeof(imgPath), "%sbattery_red.png", Settings.theme_path);
GuiImageData batteryRed(imgPath, battery_red_png);
snprintf(imgPath, sizeof(imgPath), "%sbattery_bar_red.png", Settings.theme_path);
GuiImageData batteryBarRed(imgPath, battery_bar_red_png);
HaltGui(); HaltGui();
GuiWindow w(screenwidth, screenheight); GuiWindow w(screenwidth, screenheight);

View File

@ -156,12 +156,8 @@ int DiscBrowse(struct discHdr * header)
if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
// GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
char imgPath[100]; GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png"));
GuiImageData settingsbg(Resources::GetFile("settings_background.png"), Resources::GetFileSize("settings_background.png"));
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", Settings.theme_path);
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
snprintf(imgPath, sizeof(imgPath), "%sgamesettings_background.png", Settings.theme_path);
GuiImageData settingsbg(imgPath, settings_background_png);
GuiTrigger trigA; GuiTrigger trigA;
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
@ -198,8 +194,7 @@ int DiscBrowse(struct discHdr * header)
u8 scrollbaron = 0; u8 scrollbaron = 0;
if (dolfilecount > 9) scrollbaron = 1; if (dolfilecount > 9) scrollbaron = 1;
GuiCustomOptionBrowser optionBrowser3(396, 280, &options3, Settings.theme_path, "bg_options_gamesettings.png", GuiCustomOptionBrowser optionBrowser3(396, 280, &options3, "bg_options_gamesettings.png", dolfilecount > 9 ? 1 : 0, 200);
bg_options_settings_png, dolfilecount > 9 ? 1 : 0, 200);
optionBrowser3.SetPosition(0, 90); optionBrowser3.SetPosition(0, 90);
optionBrowser3.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); optionBrowser3.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);

View File

@ -128,11 +128,8 @@ static void ProgressWindow(const char *title, const char *msg1, const char *msg2
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
promptWindow.SetPosition(0, -10); promptWindow.SetPosition(0, -10);
char imgPath[100]; GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png"));
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", Settings.theme_path); GuiImageData dialogBox(Resources::GetFile("dialogue_box.png"), Resources::GetFileSize("dialogue_box.png"));
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
snprintf(imgPath, sizeof(imgPath), "%sdialogue_box.png", Settings.theme_path);
GuiImageData dialogBox(imgPath, dialogue_box_png);
GuiTrigger trigA; GuiTrigger trigA;
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
@ -143,8 +140,7 @@ static void ProgressWindow(const char *title, const char *msg1, const char *msg2
dialogBoxImg.SetWidescreen(Settings.widescreen); dialogBoxImg.SetWidescreen(Settings.widescreen);
} }
snprintf(imgPath, sizeof(imgPath), "%sprogressbar_outline.png", Settings.theme_path); GuiImageData progressbarOutline(Resources::GetFile("progressbar_outline.png"), Resources::GetFileSize("progressbar_outline.png"));
GuiImageData progressbarOutline(imgPath, progressbar_outline_png);
GuiImage progressbarOutlineImg(&progressbarOutline); GuiImage progressbarOutlineImg(&progressbarOutline);
if (Settings.wsprompt == yes) if (Settings.wsprompt == yes)
@ -154,15 +150,13 @@ static void ProgressWindow(const char *title, const char *msg1, const char *msg2
progressbarOutlineImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); progressbarOutlineImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
progressbarOutlineImg.SetPosition(25, 40); progressbarOutlineImg.SetPosition(25, 40);
snprintf(imgPath, sizeof(imgPath), "%sprogressbar_empty.png", Settings.theme_path); GuiImageData progressbarEmpty(Resources::GetFile("progressbar_empty.png"), Resources::GetFileSize("button_dialogue_box.png"));
GuiImageData progressbarEmpty(imgPath, progressbar_empty_png);
GuiImage progressbarEmptyImg(&progressbarEmpty); GuiImage progressbarEmptyImg(&progressbarEmpty);
progressbarEmptyImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); progressbarEmptyImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
progressbarEmptyImg.SetPosition(25, 40); progressbarEmptyImg.SetPosition(25, 40);
progressbarEmptyImg.SetTile(100); progressbarEmptyImg.SetTile(100);
snprintf(imgPath, sizeof(imgPath), "%sprogressbar.png", Settings.theme_path); GuiImageData progressbar(Resources::GetFile("progressbar.png"), Resources::GetFileSize("progressbar.png"));
GuiImageData progressbar(imgPath, progressbar_png);
GuiImage progressbarImg(&progressbar); GuiImage progressbarImg(&progressbar);
progressbarImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); progressbarImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
progressbarImg.SetPosition(25, 40); progressbarImg.SetPosition(25, 40);

View File

@ -78,9 +78,7 @@ int OnScreenNumpad(char * var, u32 maxlen)
// because destroy GuiSound must wait while sound playing is finished, we use a global sound // because destroy GuiSound must wait while sound playing is finished, we use a global sound
if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
char imgPath[100]; GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png"));
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", Settings.theme_path);
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
GuiTrigger trigA; GuiTrigger trigA;
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
@ -168,9 +166,7 @@ int OnScreenKeyboard(char * var, u32 maxlen, int min)
if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
// GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
char imgPath[100]; GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png"));
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", Settings.theme_path);
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
GuiTrigger trigA; GuiTrigger trigA;
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
@ -254,12 +250,12 @@ void WindowCredits()
GuiWindow creditsWindowBox(580, 448); GuiWindow creditsWindowBox(580, 448);
creditsWindowBox.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); creditsWindowBox.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
GuiImageData creditsBox(credits_bg_png); GuiImageData creditsBox(credits_bg_png, credits_bg_png_size);
GuiImage creditsBoxImg(&creditsBox); GuiImage creditsBoxImg(&creditsBox);
creditsBoxImg.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); creditsBoxImg.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
creditsWindowBox.Append(&creditsBoxImg); creditsWindowBox.Append(&creditsBoxImg);
GuiImageData star(little_star_png); GuiImageData star(little_star_png, little_star_png_size);
GuiImage starImg(&star); GuiImage starImg(&star);
starImg.SetWidescreen(Settings.widescreen); //added starImg.SetWidescreen(Settings.widescreen); //added
starImg.SetAlignment(ALIGN_LEFT, ALIGN_TOP); starImg.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
@ -471,13 +467,11 @@ int WindowScreensaver()
gprintf("WindowScreenSaver()\n"); gprintf("WindowScreenSaver()\n");
int i = 0; int i = 0;
bool exit = false; bool exit = false;
char imgPath[100];//uncomment for themable screensaver
/* initialize random seed: */ /* initialize random seed: */
srand(time(NULL)); srand(time(NULL));
snprintf(imgPath, sizeof(imgPath), "%sscreensaver.png", Settings.theme_path);//uncomment for themable screensaver GuiImageData GXlogo(Resources::GetFile("gxlogo.png"), Resources::GetFileSize("gxlogo.png"));//uncomment for themable screensaver
GuiImageData GXlogo(imgPath, gxlogo_png);//uncomment for themable screensaver
//GuiImageData GXlogo(gxlogo_png);//comment for themable screensaver //GuiImageData GXlogo(gxlogo_png);//comment for themable screensaver
GuiImage GXlogoImg(&GXlogo); GuiImage GXlogoImg(&GXlogo);
GXlogoImg.SetPosition(172, 152); GXlogoImg.SetPosition(172, 152);
@ -545,12 +539,9 @@ int WindowPrompt(const char *title, const char *msg, const char *btn1Label, cons
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, Settings.sfxvolume); GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, Settings.sfxvolume);
// because destroy GuiSound must wait while sound playing is finished, we use a global sound // because destroy GuiSound must wait while sound playing is finished, we use a global sound
if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
// GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
char imgPath[100]; GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png"));
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", Settings.theme_path); GuiImageData dialogBox(Resources::GetFile("dialogue_box.png"), Resources::GetFileSize("dialogue_box.png"));
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
snprintf(imgPath, sizeof(imgPath), "%sdialogue_box.png", Settings.theme_path);
GuiImageData dialogBox(imgPath, dialogue_box_png);
GuiTrigger trigA; GuiTrigger trigA;
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
@ -837,7 +828,6 @@ int WindowExitPrompt()
homeout->SetLoop(0); homeout->SetLoop(0);
int choice = -1; int choice = -1;
char imgPath[100];
u64 oldstub = getStubDest(); u64 oldstub = getStubDest();
loadStub(); loadStub();
@ -851,22 +841,18 @@ int WindowExitPrompt()
if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
// GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
GuiImageData top(exit_top_png); GuiImageData top(exit_top_png, exit_top_png_size);
GuiImageData topOver(exit_top_over_png); GuiImageData topOver(exit_top_over_png, exit_top_over_png_size);
GuiImageData bottom(exit_bottom_png); GuiImageData bottom(exit_bottom_png, exit_bottom_png_size);
GuiImageData bottomOver(exit_bottom_over_png); GuiImageData bottomOver(exit_bottom_over_png, exit_bottom_over_png_size);
GuiImageData button(exit_button_png); GuiImageData button(exit_button_png, exit_button_png_size);
GuiImageData wiimote(wiimote_png); GuiImageData wiimote(wiimote_png, wiimote_png_size);
GuiImageData close(closebutton_png); GuiImageData close(closebutton_png, closebutton_png_size);
snprintf(imgPath, sizeof(imgPath), "%sbattery_white.png", Settings.theme_path); GuiImageData battery(Resources::GetFile("battery_white.png"), Resources::GetFileSize("battery_white.png"));
GuiImageData battery(imgPath, battery_white_png); GuiImageData batteryBar(Resources::GetFile("battery_bar_white.png"), Resources::GetFileSize("battery_bar_white.png"));
snprintf(imgPath, sizeof(imgPath), "%sbattery_bar_white.png", Settings.theme_path); GuiImageData batteryRed(Resources::GetFile("battery_red.png"), Resources::GetFileSize("battery_red.png"));
GuiImageData batteryBar(imgPath, battery_bar_white_png); GuiImageData batteryBarRed(Resources::GetFile("battery_bar_red.png"), Resources::GetFileSize("battery_bar_red.png"));
snprintf(imgPath, sizeof(imgPath), "%sbattery_red.png", Settings.theme_path);
GuiImageData batteryRed(imgPath, battery_red_png);
snprintf(imgPath, sizeof(imgPath), "%sbattery_bar_red.png", Settings.theme_path);
GuiImageData batteryBarRed(imgPath, battery_bar_red_png);
int i = 0, ret = 0, level; int i = 0, ret = 0, level;
char txt[3]; char txt[3];
@ -1188,19 +1174,13 @@ int GameWindowPrompt()
if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
// GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
char imgPath[100]; GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png"));
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", Settings.theme_path);
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
snprintf(imgPath, sizeof(imgPath), "%sfavorite.png", Settings.theme_path); GuiImageData imgFavorite(Resources::GetFile("favorite.png"), Resources::GetFileSize("favorite.png"));
GuiImageData imgFavorite(imgPath, favorite_png); GuiImageData imgNotFavorite(Resources::GetFile("not_favorite.png"), Resources::GetFileSize("not_favorite.png"));
snprintf(imgPath, sizeof(imgPath), "%snot_favorite.png", Settings.theme_path);
GuiImageData imgNotFavorite(imgPath, not_favorite_png);
snprintf(imgPath, sizeof(imgPath), "%sstartgame_arrow_left.png", Settings.theme_path); GuiImageData imgLeft(Resources::GetFile("startgame_arrow_left.png"), Resources::GetFileSize("startgame_arrow_left.png"));
GuiImageData imgLeft(imgPath, startgame_arrow_left_png); GuiImageData imgRight(Resources::GetFile("startgame_arrow_right.png"), Resources::GetFileSize("startgame_arrow_right.png"));
snprintf(imgPath, sizeof(imgPath), "%sstartgame_arrow_right.png", Settings.theme_path);
GuiImageData imgRight(imgPath, startgame_arrow_right_png);
GuiTrigger trigA; GuiTrigger trigA;
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
@ -1220,12 +1200,13 @@ int GameWindowPrompt()
GuiButton screenShotBtn(0, 0); GuiButton screenShotBtn(0, 0);
screenShotBtn.SetPosition(0, 0); screenShotBtn.SetPosition(0, 0);
screenShotBtn.SetTrigger(&trigZ); screenShotBtn.SetTrigger(&trigZ);
const char * image = "dialogue_box_startgame.png";
if (Settings.widescreen) if (Settings.widescreen)
snprintf(imgPath, sizeof(imgPath), "%swdialogue_box_startgame.png", Settings.theme_path); image = "wdialogue_box_startgame.png";
else snprintf(imgPath, sizeof(imgPath), "%sdialogue_box_startgame.png", Settings.theme_path);
GuiImageData dialogBox(imgPath, Settings.widescreen ? wdialogue_box_startgame_png : dialogue_box_startgame_png); GuiImageData dialogBox(Resources::GetFile(image), Resources::GetFileSize(image));
GuiImage dialogBoxImg(&dialogBox); GuiImage dialogBoxImg(&dialogBox);
GuiTooltip nameBtnTT(tr( "Rename Game on WBFS" )); GuiTooltip nameBtnTT(tr( "Rename Game on WBFS" ));
@ -1428,15 +1409,15 @@ int GameWindowPrompt()
gprintf("\t%s\n", IDFull); gprintf("\t%s\n", IDFull);
if (diskCover) delete diskCover; if (diskCover) delete diskCover;
char imgPath[150];
snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.disc_path, IDFull); //changed to current full id snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.disc_path, IDFull); //changed to current full id
diskCover = new GuiImageData(imgPath, 0); diskCover = new GuiImageData(imgPath);
if (!diskCover->GetImage()) if (!diskCover->GetImage())
{ {
delete diskCover; delete diskCover;
snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.disc_path, ID); //changed to current id snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.disc_path, ID); //changed to current id
diskCover = new GuiImageData(imgPath, 0); diskCover = new GuiImageData(imgPath);
if (!diskCover->GetImage()) if (!diskCover->GetImage())
{ {
@ -1444,12 +1425,11 @@ int GameWindowPrompt()
delete diskCover; delete diskCover;
snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.disc_path, ID); //changed to current id snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.disc_path, ID); //changed to current id
diskCover = new GuiImageData(imgPath, 0); diskCover = new GuiImageData(imgPath);
if (!diskCover->GetImage()) if (!diskCover->GetImage())
{ {
delete diskCover; delete diskCover;
snprintf(imgPath, sizeof(imgPath), "%snodisc.png", Settings.theme_path); //changed to nodisc.png diskCover = Resources::GetImageData("nodisc.png");
diskCover = new GuiImageData(imgPath, nodisc_png);
} }
} }
} }
@ -1787,11 +1767,8 @@ int DiscWait(const char *title, const char *msg, const char *btn1Label, const ch
if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
// GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
char imgPath[100]; GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png"));
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", Settings.theme_path); GuiImageData dialogBox(Resources::GetFile("dialogue_box.png"), Resources::GetFileSize("dialogue_box.png"));
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
snprintf(imgPath, sizeof(imgPath), "%sdialogue_box.png", Settings.theme_path);
GuiImageData dialogBox(imgPath, dialogue_box_png);
GuiTrigger trigA; GuiTrigger trigA;
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
GuiTrigger trigB; GuiTrigger trigB;
@ -1938,11 +1915,8 @@ int FormatingPartition(const char *title, partitionEntry *entry)
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
promptWindow.SetPosition(0, -10); promptWindow.SetPosition(0, -10);
char imgPath[100]; GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png"));
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", Settings.theme_path); GuiImageData dialogBox(Resources::GetFile("dialogue_box.png"), Resources::GetFileSize("dialogue_box.png"));
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
snprintf(imgPath, sizeof(imgPath), "%sdialogue_box.png", Settings.theme_path);
GuiImageData dialogBox(imgPath, dialogue_box_png);
GuiTrigger trigA; GuiTrigger trigA;
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
@ -1996,11 +1970,8 @@ bool SearchMissingImages(int choice2)
if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
// GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
char imgPath[100]; GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png"));
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", Settings.theme_path); GuiImageData dialogBox(Resources::GetFile("dialogue_box.png"), Resources::GetFileSize("dialogue_box.png"));
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
snprintf(imgPath, sizeof(imgPath), "%sdialogue_box.png", Settings.theme_path);
GuiImageData dialogBox(imgPath, dialogue_box_png);
GuiTrigger trigA; GuiTrigger trigA;
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
@ -2131,11 +2102,8 @@ bool NetworkInitPrompt()
if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
// GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
char imgPath[100]; GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png"));
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", Settings.theme_path); GuiImageData dialogBox(Resources::GetFile("dialogue_box.png"), Resources::GetFileSize("dialogue_box.png"));
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
snprintf(imgPath, sizeof(imgPath), "%sdialogue_box.png", Settings.theme_path);
GuiImageData dialogBox(imgPath, dialogue_box_png);
GuiTrigger trigA; GuiTrigger trigA;
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
@ -2240,11 +2208,8 @@ int ProgressDownloadWindow(int choice2)
if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
// GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
char imgPath[100]; GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png"));
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", Settings.theme_path); GuiImageData dialogBox(Resources::GetFile("dialogue_box.png"), Resources::GetFileSize("dialogue_box.png"));
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
snprintf(imgPath, sizeof(imgPath), "%sdialogue_box.png", Settings.theme_path);
GuiImageData dialogBox(imgPath, dialogue_box_png);
GuiTrigger trigA; GuiTrigger trigA;
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
@ -2254,8 +2219,7 @@ int ProgressDownloadWindow(int choice2)
dialogBoxImg.SetWidescreen(Settings.widescreen); dialogBoxImg.SetWidescreen(Settings.widescreen);
} }
snprintf(imgPath, sizeof(imgPath), "%sprogressbar_outline.png", Settings.theme_path); GuiImageData progressbarOutline(Resources::GetFile("progressbar_outline.png"), Resources::GetFileSize("progressbar_outline.png"));
GuiImageData progressbarOutline(imgPath, progressbar_outline_png);
GuiImage progressbarOutlineImg(&progressbarOutline); GuiImage progressbarOutlineImg(&progressbarOutline);
if (Settings.wsprompt == yes) if (Settings.wsprompt == yes)
{ {
@ -2264,15 +2228,13 @@ int ProgressDownloadWindow(int choice2)
progressbarOutlineImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); progressbarOutlineImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
progressbarOutlineImg.SetPosition(25, 40); progressbarOutlineImg.SetPosition(25, 40);
snprintf(imgPath, sizeof(imgPath), "%sprogressbar_empty.png", Settings.theme_path); GuiImageData progressbarEmpty(Resources::GetFile("progressbar_empty.png"), Resources::GetFileSize("progressbar_empty.png"));
GuiImageData progressbarEmpty(imgPath, progressbar_empty_png);
GuiImage progressbarEmptyImg(&progressbarEmpty); GuiImage progressbarEmptyImg(&progressbarEmpty);
progressbarEmptyImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); progressbarEmptyImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
progressbarEmptyImg.SetPosition(25, 40); progressbarEmptyImg.SetPosition(25, 40);
progressbarEmptyImg.SetTile(100); progressbarEmptyImg.SetTile(100);
snprintf(imgPath, sizeof(imgPath), "%sprogressbar.png", Settings.theme_path); GuiImageData progressbar(Resources::GetFile("progressbar.png"), Resources::GetFileSize("progressbar.png"));
GuiImageData progressbar(imgPath, progressbar_png);
GuiImage progressbarImg(&progressbar); GuiImage progressbarImg(&progressbar);
progressbarImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); progressbarImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
progressbarImg.SetPosition(25, 40); progressbarImg.SetPosition(25, 40);
@ -3215,11 +3177,8 @@ int ProgressUpdateWindow()
if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
// GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
char imgPath[100]; GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png"));
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", Settings.theme_path); GuiImageData dialogBox(Resources::GetFile("dialogue_box.png"), Resources::GetFileSize("dialogue_box.png"));
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
snprintf(imgPath, sizeof(imgPath), "%sdialogue_box.png", Settings.theme_path);
GuiImageData dialogBox(imgPath, dialogue_box_png);
GuiTrigger trigA; GuiTrigger trigA;
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
@ -3229,8 +3188,7 @@ int ProgressUpdateWindow()
dialogBoxImg.SetWidescreen(Settings.widescreen); dialogBoxImg.SetWidescreen(Settings.widescreen);
} }
snprintf(imgPath, sizeof(imgPath), "%sprogressbar_outline.png", Settings.theme_path); GuiImageData progressbarOutline(Resources::GetFile("progressbar_outline.png"), Resources::GetFileSize("progressbar_outline.png"));
GuiImageData progressbarOutline(imgPath, progressbar_outline_png);
GuiImage progressbarOutlineImg(&progressbarOutline); GuiImage progressbarOutlineImg(&progressbarOutline);
if (Settings.wsprompt == yes) if (Settings.wsprompt == yes)
{ {
@ -3239,15 +3197,13 @@ int ProgressUpdateWindow()
progressbarOutlineImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); progressbarOutlineImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
progressbarOutlineImg.SetPosition(25, 7); progressbarOutlineImg.SetPosition(25, 7);
snprintf(imgPath, sizeof(imgPath), "%sprogressbar_empty.png", Settings.theme_path); GuiImageData progressbarEmpty(Resources::GetFile("progressbar_empty.png"), Resources::GetFileSize("progressbar_empty.png"));
GuiImageData progressbarEmpty(imgPath, progressbar_empty_png);
GuiImage progressbarEmptyImg(&progressbarEmpty); GuiImage progressbarEmptyImg(&progressbarEmpty);
progressbarEmptyImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); progressbarEmptyImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
progressbarEmptyImg.SetPosition(25, 7); progressbarEmptyImg.SetPosition(25, 7);
progressbarEmptyImg.SetTile(100); progressbarEmptyImg.SetTile(100);
snprintf(imgPath, sizeof(imgPath), "%sprogressbar.png", Settings.theme_path); GuiImageData progressbar(Resources::GetFile("progressbar.png"), Resources::GetFileSize("progressbar.png"));
GuiImageData progressbar(imgPath, progressbar_png);
GuiImage progressbarImg(&progressbar); GuiImage progressbarImg(&progressbar);
progressbarImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); progressbarImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
progressbarImg.SetPosition(25, 7); progressbarImg.SetPosition(25, 7);
@ -3614,11 +3570,8 @@ int CodeDownload(const char *id)
if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
// GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
char imgPath[100]; GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png"));
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", Settings.theme_path); GuiImageData dialogBox(Resources::GetFile("dialogue_box.png"), Resources::GetFileSize("dialogue_box.png"));
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
snprintf(imgPath, sizeof(imgPath), "%sdialogue_box.png", Settings.theme_path);
GuiImageData dialogBox(imgPath, dialogue_box_png);
GuiTrigger trigA; GuiTrigger trigA;
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
@ -3801,28 +3754,22 @@ int HBCWindowPrompt(const char *name, const char *coder, const char *version, co
// because destroy GuiSound must wait while sound playing is finished, we use a global sound // because destroy GuiSound must wait while sound playing is finished, we use a global sound
if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
// GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
char imgPath[100];
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", Settings.theme_path); GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png"));
GuiImageData btnOutline(imgPath, button_dialogue_box_png); GuiImageData dialogBox(Resources::GetFile("dialogue_box.png"), Resources::GetFileSize("dialogue_box.png"));
snprintf(imgPath, sizeof(imgPath), "%sdialogue_box.png", Settings.theme_path); GuiImageData whiteBox(Resources::GetFile("bg_options.png"), Resources::GetFileSize("bg_options.png"));
GuiImageData dialogBox(imgPath, dialogue_box_png);
snprintf(imgPath, sizeof(imgPath), "%sbg_options.png", Settings.theme_path);
GuiImageData whiteBox(imgPath, bg_options_png);
snprintf(imgPath, sizeof(imgPath), "%sscrollbar.png", Settings.theme_path); GuiImageData scrollbar(Resources::GetFile("scrollbar.png"), Resources::GetFileSize("scrollbar.png"));
GuiImageData scrollbar(imgPath, scrollbar_png);
GuiImage scrollbarImg(&scrollbar); GuiImage scrollbarImg(&scrollbar);
scrollbarImg.SetAlignment(ALIGN_RIGHT, ALIGN_TOP); scrollbarImg.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
scrollbarImg.SetPosition(-40, 114); scrollbarImg.SetPosition(-40, 114);
scrollbarImg.SetSkew(0, 0, 0, 0, 0, -120, 0, -120); scrollbarImg.SetSkew(0, 0, 0, 0, 0, -120, 0, -120);
snprintf(imgPath, sizeof(imgPath), "%sscrollbar_arrowdown.png", Settings.theme_path); GuiImageData arrowDown(Resources::GetFile("scrollbar_arrowdown.png"), Resources::GetFileSize("scrollbar_arrowdown.png"));
GuiImageData arrowDown(imgPath, scrollbar_arrowdown_png);
GuiImage arrowDownImg(&arrowDown); GuiImage arrowDownImg(&arrowDown);
arrowDownImg.SetScale(.8); arrowDownImg.SetScale(.8);
snprintf(imgPath, sizeof(imgPath), "%sscrollbar_arrowup.png", Settings.theme_path); GuiImageData arrowUp(Resources::GetFile("scrollbar_arrowup.png"), Resources::GetFileSize("scrollbar_arrowup.png"));
GuiImageData arrowUp(imgPath, scrollbar_arrowup_png);
GuiImage arrowUpImg(&arrowUp); GuiImage arrowUpImg(&arrowUp);
arrowUpImg.SetScale(.8); arrowUpImg.SetScale(.8);
@ -3846,13 +3793,20 @@ int HBCWindowPrompt(const char *name, const char *coder, const char *version, co
GuiImageData *iconData = NULL; GuiImageData *iconData = NULL;
GuiImage *iconImg = NULL; GuiImage *iconImg = NULL;
char imgPath[150];
snprintf(imgPath, sizeof(imgPath), "%s", iconPath); snprintf(imgPath, sizeof(imgPath), "%s", iconPath);
bool iconExist = CheckFile(imgPath); bool iconExist = CheckFile(imgPath);
if (iconExist) if (iconExist)
{ {
iconData = new GuiImageData(iconPath, dialogue_box_png); iconData = new GuiImageData(imgPath);
iconImg = new GuiImage(iconData); if(!iconData->GetImage())
{
delete iconData;
iconData = new GuiImageData(Resources::GetFile("dialogue_box.png"), Resources::GetFileSize("dialogue_box.png"));
}
iconImg = new GuiImage(iconData);
iconImg->SetAlignment(ALIGN_LEFT, ALIGN_TOP); iconImg->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
iconImg->SetPosition(45, 10); iconImg->SetPosition(45, 10);
} }

View File

@ -130,12 +130,8 @@ bool TitleSelector(char output[])
// because destroy GuiSound must wait while sound playing is finished, we use a global sound // because destroy GuiSound must wait while sound playing is finished, we use a global sound
if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
char imgPath[100]; GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png"));
GuiImageData settingsbg(Resources::GetFile("settings_background.png"), Resources::GetFileSize("settings_background.png"));
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", Settings.theme_path);
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
snprintf(imgPath, sizeof(imgPath), "%sgamesettings_background.png", Settings.theme_path);
GuiImageData settingsbg(imgPath, settings_background_png);
GuiImage settingsbackground(&settingsbg); GuiImage settingsbackground(&settingsbg);
GuiButton settingsbackgroundbtn(settingsbackground.GetWidth(), settingsbackground.GetHeight()); GuiButton settingsbackgroundbtn(settingsbackground.GetWidth(), settingsbackground.GetHeight());
@ -163,8 +159,7 @@ bool TitleSelector(char output[])
u8 scrollbaron = 0; u8 scrollbaron = 0;
if (num_titles + 1 > 9) scrollbaron = 1; if (num_titles + 1 > 9) scrollbaron = 1;
GuiCustomOptionBrowser optionBrowser4(396, 280, &options4, Settings.theme_path, "bg_options_gamesettings.png", GuiCustomOptionBrowser optionBrowser4(396, 280, &options4, "bg_options_gamesettings.png", scrollbaron, 200);
bg_options_settings_png, scrollbaron, 200);
optionBrowser4.SetPosition(0, 90); optionBrowser4.SetPosition(0, 90);
optionBrowser4.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); optionBrowser4.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
@ -362,12 +357,8 @@ int TitleBrowser()
if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
// GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
char imgPath[100]; GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png"));
GuiImageData settingsbg(Resources::GetFile("settings_background.png"), Resources::GetFileSize("settings_background.png"));
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", Settings.theme_path);
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
snprintf(imgPath, sizeof(imgPath), "%sgamesettings_background.png", Settings.theme_path);
GuiImageData settingsbg(imgPath, settings_background_png);
GuiTrigger trigA; GuiTrigger trigA;
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
@ -404,13 +395,11 @@ int TitleBrowser()
u8 scrollbaron = 0; u8 scrollbaron = 0;
if (total + 1 > 9) scrollbaron = 1; if (total + 1 > 9) scrollbaron = 1;
GuiCustomOptionBrowser optionBrowser3(396, 280, &options3, Settings.theme_path, "bg_options_gamesettings.png", GuiCustomOptionBrowser optionBrowser3(396, 280, &options3, "bg_options_gamesettings.png", scrollbaron, 200);
bg_options_settings_png, scrollbaron, 200);
optionBrowser3.SetPosition(0, 90); optionBrowser3.SetPosition(0, 90);
optionBrowser3.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); optionBrowser3.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
snprintf(imgPath, sizeof(imgPath), "%sWifi_btn.png", Settings.theme_path); GuiImageData wifiImgData(Resources::GetFile("Wifi_btn.png"), Resources::GetFileSize("Wifi_btn.png"));
GuiImageData wifiImgData(imgPath, Wifi_btn_png);
GuiImage wifiImg(&wifiImgData); GuiImage wifiImg(&wifiImgData);
if (Settings.wsprompt == yes) if (Settings.wsprompt == yes)
{ {

View File

@ -310,7 +310,7 @@ int BrowseDevice(char * Path, int Path_size, int Flags, FILTERCASCADE *Filter/*=
if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
// GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
GuiImageData folderImgData(icon_folder_png); GuiImageData folderImgData(Resources::GetFile("icon_folder.png"), Resources::GetFileSize("icon_folder.png"));
GuiImage folderImg(&folderImgData); GuiImage folderImg(&folderImgData);
GuiButton folderBtn(folderImg.GetWidth(), folderImg.GetHeight()); GuiButton folderBtn(folderImg.GetWidth(), folderImg.GetHeight());
folderBtn.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); folderBtn.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
@ -319,9 +319,7 @@ int BrowseDevice(char * Path, int Path_size, int Flags, FILTERCASCADE *Filter/*=
folderBtn.SetTrigger(&trigA); folderBtn.SetTrigger(&trigA);
folderBtn.SetEffectGrow(); folderBtn.SetEffectGrow();
char imgPath[100]; GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png"));
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", Settings.theme_path);
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
GuiText ExitBtnTxt(tr( "Cancel" ), 24, ( GXColor ) GuiText ExitBtnTxt(tr( "Cancel" ), 24, ( GXColor )
{ 0, 0, 0, 255}); { 0, 0, 0, 255});
GuiImage ExitBtnImg(&btnOutline); GuiImage ExitBtnImg(&btnOutline);
@ -369,7 +367,7 @@ int BrowseDevice(char * Path, int Path_size, int Flags, FILTERCASCADE *Filter/*=
fileBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); fileBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
fileBrowser.SetPosition(0, 120); fileBrowser.SetPosition(0, 120);
GuiImageData Address(addressbar_textbox_png); GuiImageData Address(Resources::GetFile("addressbar_textbox.png"), Resources::GetFileSize("addressbar_textbox.png"));
GuiText AdressText((char*) NULL, 20, ( GXColor ) GuiText AdressText((char*) NULL, 20, ( GXColor )
{ 0, 0, 0, 255}); { 0, 0, 0, 255});
AdressText.SetTextf("%s%s", browser->rootdir, browser->dir); AdressText.SetTextf("%s%s", browser->rootdir, browser->dir);

View File

@ -18,6 +18,7 @@
#include "fatmounter.h" #include "fatmounter.h"
#include "FileOperations/fileops.h" #include "FileOperations/fileops.h"
#include "prompts/PromptWindows.h" #include "prompts/PromptWindows.h"
#include "themes/CTheme.h"
#include "gameinfo.h" #include "gameinfo.h"
#include "usbloader/GameList.h" #include "usbloader/GameList.h"
#include "../gecko.h" #include "../gecko.h"
@ -137,17 +138,12 @@ int showGameInfo(char *ID)
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, Settings.sfxvolume); GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, Settings.sfxvolume);
GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
char imgPath[100];
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", Settings.theme_path); GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png"));
GuiImageData btnOutline(imgPath, button_dialogue_box_png); GuiImageData dialogBox1(Resources::GetFile("gameinfo1.png"), Resources::GetFileSize("gameinfo1.png"));
snprintf(imgPath, sizeof(imgPath), "%sgameinfo1_png.png", Settings.theme_path); GuiImageData dialogBox2(Resources::GetFile("gameinfo1a.png"), Resources::GetFileSize("gameinfo1a.png"));
GuiImageData dialogBox1(imgPath, gameinfo1_png); GuiImageData dialogBox3(Resources::GetFile("gameinfo2.png"), Resources::GetFileSize("gameinfo2.png"));
snprintf(imgPath, sizeof(imgPath), "%sgameinfo1a_png.png", Settings.theme_path); GuiImageData dialogBox4(Resources::GetFile("gameinfo2a.png"), Resources::GetFileSize("gameinfo2a.png"));
GuiImageData dialogBox2(imgPath, gameinfo1a_png);
snprintf(imgPath, sizeof(imgPath), "%sgameinfo2_png.png", Settings.theme_path);
GuiImageData dialogBox3(imgPath, gameinfo2_png);
snprintf(imgPath, sizeof(imgPath), "%sgameinfo2a_png.png", Settings.theme_path);
GuiImageData dialogBox4(imgPath, gameinfo2a_png);
GuiTrigger trig1; GuiTrigger trig1;
trig1.SetButtonOnlyTrigger(-1, WPAD_BUTTON_1 | WPAD_CLASSIC_BUTTON_X, 0); trig1.SetButtonOnlyTrigger(-1, WPAD_BUTTON_1 | WPAD_CLASSIC_BUTTON_X, 0);
@ -217,59 +213,56 @@ int showGameInfo(char *ID)
// switch icons // switch icons
if (nunchuk) if (nunchuk)
nunchukImgData = new GuiImageData(nunchukR_png); nunchukImgData = Resources::GetImageData("nunchukR.png");
else nunchukImgData = new GuiImageData(nunchuk_png); else nunchukImgData = Resources::GetImageData("nunchuk.png");
if (classiccontroller) if (classiccontroller)
classiccontrollerImgData = new GuiImageData(classiccontrollerR_png); classiccontrollerImgData = Resources::GetImageData("classiccontrollerR.png");
else classiccontrollerImgData = new GuiImageData(classiccontroller_png); else classiccontrollerImgData = Resources::GetImageData("classiccontroller.png");
if (guitar) if (guitar)
guitarImgData = new GuiImageData(guitarR_png); guitarImgData = Resources::GetImageData("guitarR.png");
else guitarImgData = new GuiImageData(guitar_png); else guitarImgData = Resources::GetImageData("guitar.png");
if (gamecube) if (gamecube)
gamecubeImgData = new GuiImageData(gcncontrollerR_png); gamecubeImgData = Resources::GetImageData("gcncontrollerR.png");
else gamecubeImgData = new GuiImageData(gcncontroller_png); else gamecubeImgData = Resources::GetImageData("gcncontroller.png");
if (wheel) if (wheel)
wheelImgData = new GuiImageData(wheelR_png); wheelImgData = Resources::GetImageData("wheelR.png");
else wheelImgData = new GuiImageData(wheel_png); else wheelImgData = Resources::GetImageData("wheel.png");
if (motionplus) if (motionplus)
motionplusImgData = new GuiImageData(motionplusR_png); motionplusImgData = Resources::GetImageData("motionplusR.png");
else motionplusImgData = new GuiImageData(motionplus_png); else motionplusImgData = Resources::GetImageData("motionplus.png");
if (drums) if (drums)
drumsImgData = new GuiImageData(drumsR_png); drumsImgData = Resources::GetImageData("drumsR.png");
else drumsImgData = new GuiImageData(drums_png); else drumsImgData = Resources::GetImageData("drums.png");
if (microphone) if (microphone)
microphoneImgData = new GuiImageData(microphoneR_png); microphoneImgData = Resources::GetImageData("microphoneR.png");
else microphoneImgData = new GuiImageData(microphone_png); else microphoneImgData = Resources::GetImageData("microphone.png");
if (zapper) if (zapper)
zapperImgData = new GuiImageData(zapperR_png); zapperImgData = Resources::GetImageData("zapperR.png");
else zapperImgData = new GuiImageData(zapper_png); else zapperImgData = Resources::GetImageData("zapper.png");
if (wiispeak) if (wiispeak)
wiispeakImgData = new GuiImageData(wiispeakR_png); wiispeakImgData = Resources::GetImageData("wiispeakR.png");
else wiispeakImgData = new GuiImageData(wiispeak_png); else wiispeakImgData = Resources::GetImageData("wiispeak.png");
if (nintendods) if (nintendods)
nintendodsImgData = new GuiImageData(nintendodsR_png); nintendodsImgData = Resources::GetImageData("nintendodsR.png");
else nintendodsImgData = new GuiImageData(nintendods_png); else nintendodsImgData = Resources::GetImageData("nintendods.png");
//if (vitalitysensor) vitalitysensorImgData = new GuiImageData(vitalitysensorR_png);
//else vitalitysensorImgData = new GuiImageData(vitalitysensor_png);
if (balanceboard) if (balanceboard)
balanceboardImgData = new GuiImageData(balanceboardR_png); balanceboardImgData = Resources::GetImageData("balanceboardR.png");
else balanceboardImgData = new GuiImageData(balanceboard_png); else balanceboardImgData = Resources::GetImageData("balanceboard.png");
if (dancepad) if (dancepad)
dancepadImgData = new GuiImageData(dancepadR_png); dancepadImgData = Resources::GetImageData("dancepadR.png");
else dancepadImgData = new GuiImageData(dancepad_png); else dancepadImgData = Resources::GetImageData("dancepad.png");
// look for optional accessories // look for optional accessories
for (int i = 1; i <= XML_ELEMMAX; i++) for (int i = 1; i <= XML_ELEMMAX; i++)
@ -311,14 +304,14 @@ int showGameInfo(char *ID)
gameinfoWindow.Append(dialogBoxImg2); gameinfoWindow.Append(dialogBoxImg2);
gameinfoWindow.Append(dialogBoxImg3); gameinfoWindow.Append(dialogBoxImg3);
gameinfoWindow.Append(dialogBoxImg4); gameinfoWindow.Append(dialogBoxImg4);
char imgPath[150];
snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, ID); snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, ID);
cover = new GuiImageData(imgPath, 0); //load full id image cover = new GuiImageData(imgPath); //load full id image
if (!cover->GetImage()) if (!cover->GetImage())
{ {
delete cover; delete cover;
snprintf(imgPath, sizeof(imgPath), "%snoimage.png", Settings.covers_path); cover = Resources::GetImageData("nocover.png");
cover = new GuiImageData(imgPath, nocover_png); //load no image
} }
delete coverImg; delete coverImg;
coverImg = NULL; coverImg = NULL;
@ -331,14 +324,14 @@ int showGameInfo(char *ID)
// # of players // # of players
if (strcmp(gameinfo.players, "") != 0) if (strcmp(gameinfo.players, "") != 0)
{ {
playersImgData = new GuiImageData(Wiimote1_png); playersImgData = Resources::GetImageData("wiimote1.png");
if (atoi(gameinfo.players) > 1) if (atoi(gameinfo.players) > 1)
{ {
playersImgData = new GuiImageData(Wiimote2_png); playersImgData = Resources::GetImageData("wiimote2.png");
} }
if (atoi(gameinfo.players) > 2) if (atoi(gameinfo.players) > 2)
{ {
playersImgData = new GuiImageData(Wiimote4_png); playersImgData = Resources::GetImageData("wiimote4.png");
} }
playersImg = new GuiImage(playersImgData); playersImg = new GuiImage(playersImgData);
@ -450,16 +443,6 @@ int showGameInfo(char *ID)
gameinfoWindow.Append(nintendodsImg); gameinfoWindow.Append(nintendodsImg);
intputX += (Settings.widescreen ? nintendodsImg->GetWidth() * .8 : nintendodsImg->GetWidth()) + 5; intputX += (Settings.widescreen ? nintendodsImg->GetWidth() * .8 : nintendodsImg->GetWidth()) + 5;
} }
/*
if (vitalitysensor==1) {
vitalitysensorImg = new GuiImage(vitalitysensorImgData);
vitalitysensorImg->SetWidescreen(Settings.widescreen);
vitalitysensorImg->SetPosition(intputX , inputY);
vitalitysensorImg->SetAlignment(0,4);
gameinfoWindow.Append(vitalitysensorImg);
intputX += (Settings.widescreen ? vitalitysensorImg->GetWidth() * .8 : vitalitysensorImg->GetWidth())+5;
}
*/
if (dancepad == 1) if (dancepad == 1)
{ {
dancepadImg = new GuiImage(dancepadImgData); dancepadImg = new GuiImage(dancepadImgData);
@ -482,36 +465,30 @@ int showGameInfo(char *ID)
// # online players // # online players
if ((strcmp(gameinfo.wifiplayers, "") != 0) && (strcmp(gameinfo.wifiplayers, "0") != 0)) if ((strcmp(gameinfo.wifiplayers, "") != 0) && (strcmp(gameinfo.wifiplayers, "0") != 0))
{ {
wifiplayersImgData = new GuiImageData(wifi1_png); wifiplayersImgData = Resources::GetImageData("wifi1.png");
if (atoi(gameinfo.wifiplayers) > 1) if (atoi(gameinfo.wifiplayers) > 1)
{ {
wifiplayersImgData = new GuiImageData(wifi2_png); wifiplayersImgData = Resources::GetImageData("wifi2.png");
} }
if (atoi(gameinfo.wifiplayers) > 2) if (atoi(gameinfo.wifiplayers) > 2)
{ {
wifiplayersImgData = new GuiImageData(wifi4_png); wifiplayersImgData = Resources::GetImageData("wifi4.png");
} }
if (atoi(gameinfo.wifiplayers) > 4) if (atoi(gameinfo.wifiplayers) > 4)
{ {
//wifiplayersImgData= new GuiImageData(wifi6_png); wifiplayersImgData =Resources::GetImageData("wifi8.png");
wifiplayersImgData = new GuiImageData(wifi8_png);
} }
/*
if (atoi(gameinfo.wifiplayers)>6) {
wifiplayersImgData= new GuiImageData(wifi8_png);
}
*/
if (atoi(gameinfo.wifiplayers) > 8) if (atoi(gameinfo.wifiplayers) > 8)
{ {
wifiplayersImgData = new GuiImageData(wifi12_png); wifiplayersImgData = Resources::GetImageData("wifi12.png");
} }
if (atoi(gameinfo.wifiplayers) > 12) if (atoi(gameinfo.wifiplayers) > 12)
{ {
wifiplayersImgData = new GuiImageData(wifi16_png); wifiplayersImgData = Resources::GetImageData("wifi16.png");
} }
if (atoi(gameinfo.wifiplayers) > 16) if (atoi(gameinfo.wifiplayers) > 16)
{ {
wifiplayersImgData = new GuiImageData(wifi32_png); wifiplayersImgData = Resources::GetImageData("wifi32.png");
} }
wifiplayersImg = new GuiImage(wifiplayersImgData); wifiplayersImg = new GuiImage(wifiplayersImgData);
wifiplayersImg->SetWidescreen(Settings.widescreen); wifiplayersImg->SetWidescreen(Settings.widescreen);
@ -527,60 +504,60 @@ int showGameInfo(char *ID)
if (strcmp(gameinfo.ratingtype, "ESRB") == 0) if (strcmp(gameinfo.ratingtype, "ESRB") == 0)
{ {
if (strcmp(gameinfo.ratingvalueESRB, "EC") == 0) if (strcmp(gameinfo.ratingvalueESRB, "EC") == 0)
ratingImgData = new GuiImageData(esrb_ec_png); ratingImgData = Resources::GetImageData("esrb_ec.png");
else if (strcmp(gameinfo.ratingvalueESRB, "E") == 0) else if (strcmp(gameinfo.ratingvalueESRB, "E") == 0)
ratingImgData = new GuiImageData(esrb_e_png); ratingImgData = Resources::GetImageData("esrb_e.png");
else if (strcmp(gameinfo.ratingvalueESRB, "E10+") == 0) else if (strcmp(gameinfo.ratingvalueESRB, "E10+") == 0)
ratingImgData = new GuiImageData(esrb_eten_png); ratingImgData = Resources::GetImageData("esrb_eten.png");
else if (strcmp(gameinfo.ratingvalueESRB, "T") == 0) else if (strcmp(gameinfo.ratingvalueESRB, "T") == 0)
ratingImgData = new GuiImageData(esrb_t_png); ratingImgData = Resources::GetImageData("esrb_t.png");
else if (strcmp(gameinfo.ratingvalueESRB, "M") == 0) else if (strcmp(gameinfo.ratingvalueESRB, "M") == 0)
ratingImgData = new GuiImageData(esrb_m_png); ratingImgData = Resources::GetImageData("esrb_m.png");
else if (strcmp(gameinfo.ratingvalueESRB, "AO") == 0) else if (strcmp(gameinfo.ratingvalueESRB, "AO") == 0)
ratingImgData = new GuiImageData(esrb_ao_png); ratingImgData = Resources::GetImageData("esrb_ao.png");
else else
{ {
ratingImgData = new GuiImageData(norating_png); ratingImgData = Resources::GetImageData("norating.png");
} }
} //there are 2 values here cause some countries are stupid and } //there are 2 values here cause some countries are stupid and
else if (strcmp(gameinfo.ratingtype, "PEGI") == 0) //can't use the same as everybody else else if (strcmp(gameinfo.ratingtype, "PEGI") == 0) //can't use the same as everybody else
{ {
if ((strcmp(gameinfo.ratingvaluePEGI, "3") == 0) || (strcmp(gameinfo.ratingvaluePEGI, "4") == 0)) if ((strcmp(gameinfo.ratingvaluePEGI, "3") == 0) || (strcmp(gameinfo.ratingvaluePEGI, "4") == 0))
ratingImgData = new GuiImageData(pegi_3_png); ratingImgData = Resources::GetImageData("pegi_3.png");
else if ((strcmp(gameinfo.ratingvaluePEGI, "7") == 0) || (strcmp(gameinfo.ratingvaluePEGI, "7") == 0)) else if ((strcmp(gameinfo.ratingvaluePEGI, "7") == 0) || (strcmp(gameinfo.ratingvaluePEGI, "7") == 0))
ratingImgData = new GuiImageData(pegi_7_png); ratingImgData = Resources::GetImageData("pegi_7.png");
else if (strcmp(gameinfo.ratingvaluePEGI, "12") == 0) else if (strcmp(gameinfo.ratingvaluePEGI, "12") == 0)
ratingImgData = new GuiImageData(pegi_12_png); ratingImgData = Resources::GetImageData("pegi_12.png");
else if ((strcmp(gameinfo.ratingvaluePEGI, "16") == 0) || (strcmp(gameinfo.ratingvaluePEGI, "15") == 0)) else if ((strcmp(gameinfo.ratingvaluePEGI, "16") == 0) || (strcmp(gameinfo.ratingvaluePEGI, "15") == 0))
ratingImgData = new GuiImageData(pegi_16_png); ratingImgData = Resources::GetImageData("pegi_16.png");
else if (strcmp(gameinfo.ratingvaluePEGI, "18") == 0) else if (strcmp(gameinfo.ratingvaluePEGI, "18") == 0)
ratingImgData = new GuiImageData(pegi_18_png); ratingImgData = Resources::GetImageData("pegi_18.png");
else else
{ {
ratingImgData = new GuiImageData(norating_png); ratingImgData = Resources::GetImageData("norating.png");
} }
} }
else if (strcmp(gameinfo.ratingtype, "CERO") == 0) else if (strcmp(gameinfo.ratingtype, "CERO") == 0)
{ {
if (strcmp(gameinfo.ratingvalueCERO, "A") == 0) if (strcmp(gameinfo.ratingvalueCERO, "A") == 0)
ratingImgData = new GuiImageData(cero_a_png); ratingImgData = Resources::GetImageData("cero_a.png");
else if (strcmp(gameinfo.ratingvalueCERO, "B") == 0) else if (strcmp(gameinfo.ratingvalueCERO, "B") == 0)
ratingImgData = new GuiImageData(cero_b_png); ratingImgData = Resources::GetImageData("cero_b.png");
else if (strcmp(gameinfo.ratingvalueCERO, "C") == 0) else if (strcmp(gameinfo.ratingvalueCERO, "C") == 0)
ratingImgData = new GuiImageData(cero_c_png); ratingImgData = Resources::GetImageData("cero_c.png");
else if (strcmp(gameinfo.ratingvalueCERO, "D") == 0) else if (strcmp(gameinfo.ratingvalueCERO, "D") == 0)
ratingImgData = new GuiImageData(cero_d_png); ratingImgData = Resources::GetImageData("cero_d.png");
else if (strcmp(gameinfo.ratingvalueCERO, "Z") == 0) else if (strcmp(gameinfo.ratingvalueCERO, "Z") == 0)
ratingImgData = new GuiImageData(cero_z_png); ratingImgData = Resources::GetImageData("cero_z.png");
else else
{ {
ratingImgData = new GuiImageData(norating_png); ratingImgData = Resources::GetImageData("norating.png");
} }
} }
else else
{ {
ratingImgData = new GuiImageData(norating_png); ratingImgData = Resources::GetImageData("norating.png");
} }
ratingImg = new GuiImage(ratingImgData); ratingImg = new GuiImage(ratingImgData);
ratingImg->SetWidescreen(Settings.widescreen); ratingImg->SetWidescreen(Settings.widescreen);

View File

@ -1,981 +0,0 @@
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/iosupport.h>
#include <sys/errno.h>
#include <fcntl.h>
#include <ogcsys.h>
#include <new>
#include "ramdisk.h"
#define NAMELENMAX 0x80
#define MAXPATHLEN 0x100
class RAMDISK_PARTITION;
class RAMDISK_LINK_ENTRY;
class RAMDISK_DIR_ENTRY;
class RAMDISK_FILE_ENTRY;
class RAMDISK_BASE_ENTRY
{
public:
RAMDISK_BASE_ENTRY(const char *Name, RAMDISK_DIR_ENTRY *Parent);
virtual ~RAMDISK_BASE_ENTRY();
void Rename(const char *Name);
RAMDISK_LINK_ENTRY *IsLink();
RAMDISK_DIR_ENTRY *IsDir();
RAMDISK_FILE_ENTRY *IsFile();
RAMDISK_PARTITION *GetPartition();
char *name;
RAMDISK_DIR_ENTRY *parent;
RAMDISK_BASE_ENTRY *next;
};
class RAMDISK_LINK_ENTRY: public RAMDISK_BASE_ENTRY
{
public:
RAMDISK_LINK_ENTRY(const char* Name, RAMDISK_DIR_ENTRY *Parent, RAMDISK_BASE_ENTRY *Link);
RAMDISK_BASE_ENTRY *link;
};
class RAMDISK_DIR_ENTRY: public RAMDISK_BASE_ENTRY
{
public:
RAMDISK_DIR_ENTRY(const char* Name, RAMDISK_DIR_ENTRY *Parent);
~RAMDISK_DIR_ENTRY();
RAMDISK_BASE_ENTRY *FindEntry(const char* Path);
RAMDISK_FILE_ENTRY *CreateFile(const char *Filename);
RAMDISK_DIR_ENTRY *CreateDir(const char *Filename);
void RemoveEntry(RAMDISK_BASE_ENTRY *Entry);
RAMDISK_BASE_ENTRY *first;
RAMDISK_BASE_ENTRY *last;
};
typedef struct
{
RAMDISK_DIR_ENTRY *dir;
RAMDISK_BASE_ENTRY *current_entry;
} DIR_STRUCT;
class RAMDISK_PARTITION: public RAMDISK_DIR_ENTRY
{
public:
RAMDISK_PARTITION(const char *Mountpoint, bool AutoMount);
RAMDISK_BASE_ENTRY *FindEntry(const char* Path);
RAMDISK_DIR_ENTRY *FindPath(const char* Path, const char **Basename = NULL);
RAMDISK_DIR_ENTRY *cwd;
bool automount;
};
class FILE_DATA
{
public:
FILE_DATA(size_t Len);
~FILE_DATA();
u8 *data;
size_t len;
FILE_DATA *next;
};
typedef struct
{
RAMDISK_FILE_ENTRY *file;
bool isLink;
u32 current_pos;
bool read;
bool write;
} FILE_STRUCT;
class RAMDISK_FILE_ENTRY: public RAMDISK_BASE_ENTRY
{
public:
RAMDISK_FILE_ENTRY(const char* Name, RAMDISK_DIR_ENTRY *Parent);
~RAMDISK_FILE_ENTRY();
bool Truncate(size_t newLen);
bool AddCluster(size_t size);
size_t Read(struct _reent *r, FILE_STRUCT *fileStruct, char *ptr, size_t len);
size_t Write(struct _reent *r, FILE_STRUCT *fileStruct, const char *ptr, size_t len);
size_t file_len;
size_t cluster_len;
FILE_DATA *first_cluster;
FILE_DATA *last_cluster;
};
RAMDISK_LINK_ENTRY::RAMDISK_LINK_ENTRY(const char* Name, RAMDISK_DIR_ENTRY *Parent, RAMDISK_BASE_ENTRY *Link) :
RAMDISK_BASE_ENTRY(Name, Parent), link(Link)
{
}
RAMDISK_BASE_ENTRY::RAMDISK_BASE_ENTRY(const char *Name, RAMDISK_DIR_ENTRY *Parent) :
name(strdup(Name)), parent(Parent), next(NULL)
{
}
RAMDISK_BASE_ENTRY::~RAMDISK_BASE_ENTRY()
{
free(name);
if (parent) parent->RemoveEntry(this);
}
void RAMDISK_BASE_ENTRY::Rename(const char *Name)
{
free(name);
name = strdup(Name);
}
inline RAMDISK_LINK_ENTRY *RAMDISK_BASE_ENTRY::IsLink()
{
return dynamic_cast<RAMDISK_LINK_ENTRY*> (this);
}
inline RAMDISK_DIR_ENTRY *RAMDISK_BASE_ENTRY::IsDir()
{
RAMDISK_LINK_ENTRY *lentry = dynamic_cast<RAMDISK_LINK_ENTRY*> (this);
return dynamic_cast<RAMDISK_DIR_ENTRY*> (lentry ? lentry->link : this);
}
inline RAMDISK_FILE_ENTRY *RAMDISK_BASE_ENTRY::IsFile()
{
RAMDISK_LINK_ENTRY *lentry = dynamic_cast<RAMDISK_LINK_ENTRY*> (this);
return dynamic_cast<RAMDISK_FILE_ENTRY*> (lentry ? lentry->link : this);
}
RAMDISK_PARTITION *RAMDISK_BASE_ENTRY::GetPartition()
{
for (RAMDISK_BASE_ENTRY *entry = this; entry; entry = entry->parent)
if (entry->parent == NULL) return dynamic_cast<RAMDISK_PARTITION *> (entry);
return NULL;
}
RAMDISK_DIR_ENTRY::RAMDISK_DIR_ENTRY(const char* Name, RAMDISK_DIR_ENTRY *Parent) :
RAMDISK_BASE_ENTRY(Name, Parent)
{
RAMDISK_BASE_ENTRY* entry = new RAMDISK_LINK_ENTRY(".", this, this);
first = entry;
last = entry;
if (parent)
{
entry = new RAMDISK_LINK_ENTRY("..", this, parent);
first->next = entry;
last = entry;
}
}
RAMDISK_DIR_ENTRY::~RAMDISK_DIR_ENTRY()
{
while (first)
{
first->parent = NULL; // ~RAMDISK_BASE_ENTRY() no calls RemoveEntry()
RAMDISK_BASE_ENTRY* next = first->next;
delete first;
first = next;
}
}
RAMDISK_BASE_ENTRY *RAMDISK_DIR_ENTRY::FindEntry(const char* Path)
{
const char* dirpath = Path;
const char* cptr;
while (dirpath[0] == '/')
dirpath++; // move past leading '/'
if (dirpath[0] == '\0') // this path is found
return this;
cptr = strchr(dirpath, '/'); // find next '/'
if (cptr == NULL) cptr = strchr(dirpath, '\0'); // cptr at end
for (RAMDISK_BASE_ENTRY *curr = first; curr; curr = curr->next)
{
if (strncmp(curr->name, dirpath, cptr - dirpath) == 0)
{
if ( RAMDISK_DIR_ENTRY *dir = curr->IsDir() )
return dir->FindEntry(cptr);
else return curr;
}
}
return NULL;
}
RAMDISK_FILE_ENTRY *RAMDISK_DIR_ENTRY::CreateFile(const char *Filename)
{
try
{
RAMDISK_FILE_ENTRY* file = new RAMDISK_FILE_ENTRY(Filename, this);
if (!first) first = file;
last->next = file;
last = file;
return file;
}
catch (...)
{
return NULL;
}
}
RAMDISK_DIR_ENTRY *RAMDISK_DIR_ENTRY::CreateDir(const char *Filename)
{
try
{
RAMDISK_DIR_ENTRY* dir = new RAMDISK_DIR_ENTRY(Filename, this);
if (!first) first = dir;
last->next = dir;
last = dir;
return dir;
}
catch (...)
{
return NULL;
}
}
void RAMDISK_DIR_ENTRY::RemoveEntry(RAMDISK_BASE_ENTRY *Entry)
{
RAMDISK_BASE_ENTRY **p_last = NULL;
for (RAMDISK_BASE_ENTRY **curr = &first; *curr; curr = &((*curr)->next))
{
if (*curr == Entry)
{
*curr = Entry->next;
if (Entry->next == NULL) // entry is last
last = *p_last;
break;
}
p_last = curr;
}
}
RAMDISK_PARTITION::RAMDISK_PARTITION(const char *Mountpoint, bool AutoMount) :
RAMDISK_DIR_ENTRY(Mountpoint, NULL), cwd(this), automount(AutoMount)
{
}
RAMDISK_BASE_ENTRY * RAMDISK_PARTITION::FindEntry(const char* path)
{
char *cptr;
if ((cptr = strchr(path, ':'))) path = cptr + 1; //move path past any device names
if (strchr(path, ':') != NULL)
{
// r->_errno = EINVAL;
return NULL;
}
if (*path == '/') // if first character is '/' use absolute root path
return RAMDISK_DIR_ENTRY::FindEntry(path);
else // else use current working dir
return cwd->FindEntry(path);
}
RAMDISK_DIR_ENTRY * RAMDISK_PARTITION::FindPath(const char* path, const char **basename)
{
int pathLen = strlen(path);
char dirfilename[pathLen + 1]; // to hold a full path
const char *cptr = path + pathLen; // find the end...
const char *filename = NULL; // to hold filename
while (cptr-- > path) //search till start
{
if ((*cptr == '/') || (*cptr == ':')) // split at either / or : (whichever comes first form the end!)
{
cptr++;
strlcpy(dirfilename, path, 1 + cptr - path); //copy string up till and including / or :
filename = cptr; //filename = now remainder of string
break;
}
}
if (!filename)
{
filename = path; //filename = complete path
dirfilename[0] = 0; //make directory path ""
}
RAMDISK_BASE_ENTRY *entry = FindEntry(dirfilename);
if (entry)
{
if (basename) *basename = filename;
return entry->IsDir();
}
return NULL;
}
FILE_DATA::FILE_DATA(size_t Len) :
next(NULL)
{
data = new u8[Len];
len = Len;
memset(data, 0, len);
}
FILE_DATA::~FILE_DATA()
{
delete[] data;
delete next;
}
RAMDISK_FILE_ENTRY::RAMDISK_FILE_ENTRY(const char* Name, RAMDISK_DIR_ENTRY *Parent) :
RAMDISK_BASE_ENTRY(Name, Parent), file_len(0), cluster_len(0), first_cluster(NULL), last_cluster(NULL)
{
}
RAMDISK_FILE_ENTRY::~RAMDISK_FILE_ENTRY()
{
Truncate(0);
}
#define CLUSTER_SIZE 4*1024
bool RAMDISK_FILE_ENTRY::Truncate(size_t newSize)
{
if (newSize > cluster_len)
{
// Expanding the file over cluster_len
return AddCluster(newSize - cluster_len);
}
else if (newSize < file_len)
{
// Shrinking the file
FILE_DATA *prev_cluster = NULL;
size_t len = 0;
for (FILE_DATA **p_cluster = &first_cluster; *p_cluster; p_cluster = &(*p_cluster)->next)
{
if (len >= newSize)
{
last_cluster = prev_cluster;
delete *p_cluster;
(*p_cluster) = NULL;
break;
}
len += (*p_cluster)->len;
prev_cluster = *p_cluster;
}
}
file_len = newSize;
return true;
}
bool RAMDISK_FILE_ENTRY::AddCluster(size_t len)
{
if (len < CLUSTER_SIZE) len = CLUSTER_SIZE;
try
{
*(last_cluster ? &last_cluster->next : &first_cluster) = last_cluster = new FILE_DATA(len);
cluster_len += len;
return true;
}
catch (...)
{
return false;
}
}
size_t RAMDISK_FILE_ENTRY::Read(struct _reent *r, FILE_STRUCT *fileStruct, char *ptr, size_t len)
{
if (!fileStruct->read)
{
r->_errno = EBADF;
return 0;
}
// Short circuit cases where len is 0 (or less)
if (len <= 0) return 0;
// Don't try to read if the read pointer is past the end of file
if (fileStruct->current_pos >= file_len)
{
r->_errno = EOVERFLOW;
return 0;
}
// Don't read past end of file
if (len + fileStruct->current_pos > file_len)
{
r->_errno = EOVERFLOW;
len = fileStruct->current_pos - file_len;
}
off_t pos = fileStruct->current_pos;
size_t readed = 0;
size_t max_len = file_len;
for (FILE_DATA *cluster = first_cluster; cluster; cluster = cluster->next)
{
if (pos > cluster->len)
{
pos -= cluster->len;
max_len -= cluster->len;
}
else
{
size_t read = max_len;
if (read > cluster->len) read = cluster->len;
read -= pos;
if (read > len) read = len;
memcpy(ptr, &(cluster->data[pos]), read);
readed += read;
ptr += read;
len -= read;
if (len == 0) break;
pos -= cluster->len;
max_len -= cluster->len;
}
}
fileStruct->current_pos += readed;
return readed;
}
size_t RAMDISK_FILE_ENTRY::Write(struct _reent *r, FILE_STRUCT *fileStruct, const char *ptr, size_t len)
{
if (!fileStruct->write)
{
r->_errno = EBADF;
return 0;
}
// Short circuit cases where len is 0 (or less)
if (len <= 0) return 0;
off_t pos = fileStruct->current_pos;
if (cluster_len < (pos + len) && !AddCluster((pos + len) - cluster_len))
{
// Couldn't get a cluster, so abort
r->_errno = ENOSPC;
return 0;
}
if (file_len < (pos + len)) file_len = (pos + len);
size_t written = 0;
size_t max_len = cluster_len;
for (FILE_DATA *cluster = first_cluster; cluster; cluster = cluster->next)
{
if (pos > cluster->len)
{
pos -= cluster->len;
max_len -= cluster->len;
}
else
{
size_t write = cluster->len - pos;
if (write > len) write = len;
memcpy(&(cluster->data[pos]), ptr, write);
written += write;
ptr += write;
len -= write;
if (len == 0) break;
pos -= cluster->len;
max_len -= cluster->len;
}
}
fileStruct->current_pos += written;
return written;
}
static int ramdiskFS_open_r(struct _reent *r, void *fileStruct, const char *path, int flags, int mode);
static int ramdiskFS_close_r(struct _reent *r, int fd);
static int ramdiskFS_write_r(struct _reent *r, int fd, const char *ptr, size_t len);
static int ramdiskFS_read_r(struct _reent *r, int fd, char *ptr, size_t len);
static off_t ramdiskFS_seek_r(struct _reent *r, int fd, off_t pos, int dir);
static int ramdiskFS_fstat_r(struct _reent *r, int fd, struct stat *st);
static int ramdiskFS_stat_r(struct _reent *r, const char *file, struct stat *st);
static int ramdiskFS_unlink_r(struct _reent *r, const char *name);
static int ramdiskFS_chdir_r(struct _reent *r, const char *name);
static int ramdiskFS_mkdir_r(struct _reent *r, const char *path, int mode);
static DIR_ITER* ramdiskFS_diropen_r(struct _reent *r, DIR_ITER *dirState, const char *path);
static int ramdiskFS_dirreset_r(struct _reent *r, DIR_ITER *dirState);
static int ramdiskFS_dirnext_r(struct _reent *r, DIR_ITER *dirState, char *filename, struct stat *st);
static int ramdiskFS_dirclose_r(struct _reent *r, DIR_ITER *dirState);
static int ramdiskFS_ftruncate_r(struct _reent *r, int fd, off_t len);
static devoptab_t ramdiskFS_devoptab = { "ramdisk", sizeof(FILE_STRUCT), // int structSize;
&ramdiskFS_open_r, // int (*open_r)(struct _reent *r, void *fileStruct, const char *path,int
// flags,int mode);
&ramdiskFS_close_r, // int (*close_r)(struct _reent *r, int fd);
&ramdiskFS_write_r, // int (*write_r)(struct _reent *r, int fd, const char *ptr, int len);
&ramdiskFS_read_r, // int (*read_r)(struct _reent *r, int fd, char *ptr, int len);
&ramdiskFS_seek_r, // off_t (*seek_r)(struct _reent *r, off_t fd, int pos, int dir);
&ramdiskFS_fstat_r, // int (*fstat_r)(struct _reent *r, int fd, struct stat *st);
&ramdiskFS_stat_r, // int (*stat_r)(struct _reent *r, const char *file, struct stat *st);
NULL, // int (*link_r)(struct _reent *r, const char *existing, const char *newLink);
&ramdiskFS_unlink_r, // int (*unlink_r)(struct _reent *r, const char *name);
&ramdiskFS_chdir_r, // int (*chdir_r)(struct _reent *r, const char *name);
NULL, // int (*rename_r) (struct _reent *r, const char *oldName, const char *newName);
ramdiskFS_mkdir_r, // int (*mkdir_r) (struct _reent *r, const char *path, int mode);
sizeof(DIR_STRUCT), // int dirStateSize;
&ramdiskFS_diropen_r, // DIR_ITER* (*diropen_r)(struct _reent *r, DIR_ITER *dirState, const char *path);
&ramdiskFS_dirreset_r, // int (*dirreset_r)(struct _reent *r, DIR_ITER *dirState);
&ramdiskFS_dirnext_r, // int (*dirnext_r)(struct _reent *r, DIR_ITER *dirState, char *filename,
// struct stat *filestat);
&ramdiskFS_dirclose_r, // int (*dirclose_r)(struct _reent *r, DIR_ITER *dirState);
NULL, // statvfs_r
&ramdiskFS_ftruncate_r, // int (*ftruncate_r)(struct _reent *r, int fd, off_t len);
NULL, // fsync_r,
NULL // Device data
};
//---------------------------------------------------------------------------------
static inline RAMDISK_PARTITION* ramdiskFS_getPartitionFromPath(const char* path)
{
//---------------------------------------------------------------------------------
const devoptab_t *devops = GetDeviceOpTab(path);
if (!devops) return NULL;
return *((RAMDISK_PARTITION**) devops->deviceData);
}
//---------------------------------------------------------------------------------
// File functions
//---------------------------------------------------------------------------------
static int ramdiskFS_open_r(struct _reent *r, void *file_Struct, const char *path, int flags, int mode)
{
//---------------------------------------------------------------------------------
FILE_STRUCT *fileStruct = (FILE_STRUCT*) file_Struct;
RAMDISK_PARTITION *partition = ramdiskFS_getPartitionFromPath(path);
if (partition == NULL)
{
r->_errno = ENODEV;
return -1;
}
if ((flags & 0x03) == O_RDONLY)
{
// Open the file for read-only access
fileStruct->read = true;
fileStruct->write = false;
}
else if ((flags & 0x03) == O_WRONLY)
{
// Open file for write only access
fileStruct->read = false;
fileStruct->write = true;
}
else if ((flags & 0x03) == O_RDWR)
{
// Open file for read/write access
fileStruct->read = true;
fileStruct->write = true;
}
else
{
r->_errno = EACCES;
return -1;
}
RAMDISK_BASE_ENTRY *entry = partition->FindEntry(path);
// The file shouldn't exist if we are trying to create it
if (entry && (flags & O_CREAT) && (flags & O_EXCL))
{
r->_errno = EEXIST;
return -1;
}
// It should not be a directory if we're openning a file,
if (entry && entry->IsDir())
{
r->_errno = EISDIR;
return -1;
}
fileStruct->isLink = entry ? entry->IsLink() : false;
fileStruct->file = entry ? entry->IsFile() : NULL;
if (!fileStruct->file) // entry not exists
{
if (flags & O_CREAT)
{
const char *filename;
RAMDISK_DIR_ENTRY *dir = partition->FindPath(path, &filename);
if (!dir)
{
r->_errno = ENOTDIR;
return -1;
}
fileStruct->file = dir->CreateFile(filename);
}
else
{
// file doesn't exist, and we aren't creating it
r->_errno = ENOENT;
return -1;
}
}
if (fileStruct->file)
{
fileStruct->current_pos = 0;
// Truncate the file if requested
if ((flags & O_TRUNC) && fileStruct->write) fileStruct->file->Truncate(0);
if (flags & O_APPEND) fileStruct->current_pos = fileStruct->file->file_len;
return 0;
}
r->_errno = ENOENT;
return (-1);
}
//---------------------------------------------------------------------------------
static int ramdiskFS_close_r(struct _reent *r, int fd)
{
//---------------------------------------------------------------------------------
return (0);
}
//---------------------------------------------------------------------------------
static int ramdiskFS_read_r(struct _reent *r, int fd, char *ptr, size_t len)
{
//---------------------------------------------------------------------------------
FILE_STRUCT *fileStruct = (FILE_STRUCT*) fd;
return fileStruct->file->Read(r, fileStruct, ptr, len);
}
//---------------------------------------------------------------------------------
static int ramdiskFS_write_r(struct _reent *r, int fd, const char *ptr, size_t len)
{
//---------------------------------------------------------------------------------
FILE_STRUCT *fileStruct = (FILE_STRUCT*) fd;
return fileStruct->file->Write(r, fileStruct, ptr, len);
}
//---------------------------------------------------------------------------------
static off_t ramdiskFS_seek_r(struct _reent *r, int fd, off_t pos, int dir)
{
//---------------------------------------------------------------------------------
//need check for eof here...
FILE_STRUCT *fileStruct = (FILE_STRUCT*) fd;
switch (dir)
{
case SEEK_SET:
break;
case SEEK_CUR:
pos += fileStruct->current_pos;
break;
case SEEK_END:
pos += fileStruct->file->file_len; // set start to end of file
break;
default:
r->_errno = EINVAL;
return -1;
}
return fileStruct->current_pos = pos;
}
//---------------------------------------------------------------------------------
static int ramdiskFS_fstat_r(struct _reent *r, int fd, struct stat *st)
{
//---------------------------------------------------------------------------------
FILE_STRUCT *fileStruct = (FILE_STRUCT*) fd;
st->st_mode = fileStruct->isLink ? S_IFLNK : S_IFREG;
st->st_size = fileStruct->file->file_len;
return (0);
}
//---------------------------------------------------------------------------------
static int ramdiskFS_stat_r(struct _reent *r, const char *file, struct stat *st)
{
//---------------------------------------------------------------------------------
FILE_STRUCT fileStruct;
DIR_STRUCT dirStruct;
DIR_ITER dirState;
dirState.dirStruct = &dirStruct; //create a temp dirstruct
int ret;
if (ramdiskFS_open_r(r, &fileStruct, file, 0, 0) == 0)
{
ret = ramdiskFS_fstat_r(r, (int) &fileStruct, st);
ramdiskFS_close_r(r, (int) &fileStruct);
return (ret);
}
else if ((ramdiskFS_diropen_r(r, &dirState, file) != NULL))
{
st->st_mode = S_IFDIR;
ramdiskFS_dirclose_r(r, &dirState);
return (0);
}
r->_errno = ENOENT;
return (-1);
}
//---------------------------------------------------------------------------------
static int ramdiskFS_unlink_r(struct _reent *r, const char *name)
{
//---------------------------------------------------------------------------------
RAMDISK_PARTITION *partition = ramdiskFS_getPartitionFromPath(name);
if (partition == NULL)
{
r->_errno = ENODEV;
return -1;
}
RAMDISK_BASE_ENTRY *entry = partition->FindEntry(name);
if (!entry)
{
r->_errno = ENOENT;
return -1;
}
if (entry->IsLink())
{
if (entry->name[0] == '.' && (entry->name[1] == '\0' || (entry->name[1] == '.' && entry->name[2] == '\0')))
{
r->_errno = EPERM;
return -1;
}
delete entry;
return 0;
}
if ( RAMDISK_DIR_ENTRY *dir = entry->IsDir() )
{
for (RAMDISK_BASE_ENTRY *entry = dir->first; entry; entry = entry->next)
{
if (!(entry->name[0] == '.'
&& (entry->name[1] == '\0' || (entry->name[1] == '.' && entry->name[2] == '\0'))))
{
r->_errno = EPERM;
return -1;
}
}
}
delete entry;
return 0;
}
//---------------------------------------------------------------------------------
static int ramdiskFS_chdir_r(struct _reent *r, const char *name)
{
//---------------------------------------------------------------------------------
DIR_STRUCT dirStruct;
DIR_ITER dirState;
dirState.dirStruct = &dirStruct;
if ((name == NULL))
{
r->_errno = ENODEV;
return -1;
}
if ((ramdiskFS_diropen_r(r, &dirState, name) == NULL)) return -1;
RAMDISK_PARTITION *partition = dirStruct.dir->GetPartition();
if (partition == NULL)
{
r->_errno = ENODEV;
return -1;
}
partition->cwd = dirStruct.dir;
ramdiskFS_dirclose_r(r, &dirState);
return 0;
}
//---------------------------------------------------------------------------------
static int ramdiskFS_mkdir_r(struct _reent *r, const char *path, int mode)
{
//---------------------------------------------------------------------------------
RAMDISK_PARTITION *partition = ramdiskFS_getPartitionFromPath(path);
if (partition == NULL)
{
r->_errno = ENODEV;
return -1;
}
RAMDISK_BASE_ENTRY *entry = partition->FindEntry(path);
if (entry)
{
r->_errno = EEXIST;
return -1;
}
const char *filename;
RAMDISK_DIR_ENTRY *dir = partition->FindPath(path, &filename);
if (!dir)
{
r->_errno = ENOTDIR;
return -1;
}
dir->CreateDir(filename);
return 0;
}
//---------------------------------------------------------------------------------
// Directory functions
//---------------------------------------------------------------------------------
static DIR_ITER* ramdiskFS_diropen_r(struct _reent *r, DIR_ITER *dirState, const char *path)
{
//---------------------------------------------------------------------------------
DIR_STRUCT *dirStruct = (DIR_STRUCT*) dirState->dirStruct;
char *cptr;
RAMDISK_PARTITION *partition = ramdiskFS_getPartitionFromPath(path);
if (partition == NULL)
{
r->_errno = ENODEV;
return NULL;
}
if ((cptr = strchr(path, ':'))) path = cptr + 1; //move path past any device names
if (strchr(path, ':') != NULL)
{
r->_errno = EINVAL;
return NULL;
}
if (*path == '/') //if first character is '/' use absolute root path
dirStruct->dir = partition; //first root dir
else dirStruct->dir = partition->cwd; //else use current working dir
RAMDISK_BASE_ENTRY *entry = dirStruct->dir->FindEntry(path);
if (entry == NULL)
{
r->_errno = ENOENT;
return NULL;
}
dirStruct->dir = entry->IsDir();
if (dirStruct->dir == NULL)
{
r->_errno = ENOTDIR;
return NULL;
}
dirStruct->current_entry = dirStruct->dir->first;
return dirState;
}
/*Consts containing relative system path strings*/
//reset dir to start of entry selected by dirStruct->cur_dir_id
//---------------------------------------------------------------------------------
static int ramdiskFS_dirreset_r(struct _reent *r, DIR_ITER *dirState)
{
//---------------------------------------------------------------------------------
DIR_STRUCT *dirStruct = (DIR_STRUCT*) dirState->dirStruct;
dirStruct->current_entry = dirStruct->dir->first;
return (0);
}
//---------------------------------------------------------------------------------
static int ramdiskFS_dirnext_r(struct _reent *r, DIR_ITER *dirState, char *filename, struct stat *st)
{
//---------------------------------------------------------------------------------
DIR_STRUCT *dirStruct = (DIR_STRUCT*) dirState->dirStruct;
// RAMDISK_BASE_ENTRY **dirStruct = (RAMDISK_BASE_ENTRY**)dirState->dirStruct;
if (dirStruct->current_entry)
{
strcpy(filename, dirStruct->current_entry->name);
if (dirStruct->current_entry->IsDir())
{
if (st) st->st_mode = S_IFDIR;
}
else
{
if (st) st->st_mode = 0;
}
dirStruct->current_entry = dirStruct->current_entry->next;
return (0);
}
r->_errno = ENOENT;
return (-1);
}
//---------------------------------------------------------------------------------
static int ramdiskFS_dirclose_r(struct _reent *r, DIR_ITER *dirState)
{
//---------------------------------------------------------------------------------
return (0);
}
//---------------------------------------------------------------------------------
static int ramdiskFS_ftruncate_r(struct _reent *r, int fd, off_t len)
{
//---------------------------------------------------------------------------------
FILE_STRUCT *fileStruct = (FILE_STRUCT*) fd;
if (len < 0)
{
// Trying to truncate to a negative size
r->_errno = EINVAL;
return -1;
}
/*
if ((sizeof(len) > 4) && len > (off_t)FILE_MAX_SIZE)
{
// Trying to extend the file beyond what supports
r->_errno = EFBIG;
return -1;
}
*/
if (!fileStruct->write)
{
// Read-only file
r->_errno = EINVAL;
return -1;
}
if (fileStruct->file->Truncate(len)) return 0;
r->_errno = ENOSPC;
return -1;
}
//---------------------------------------------------------------------------------
void ramdiskFS_Unmount(const char* mountpoint)
{
//---------------------------------------------------------------------------------
RAMDISK_PARTITION *partition;
devoptab_t *devops = (devoptab_t*) GetDeviceOpTab(mountpoint);
if (!devops) return;
// Perform a quick check to make sure we're dealing with a ramdiskFS_ controlled device
if (devops->open_r != ramdiskFS_devoptab.open_r) return;
if (RemoveDevice(mountpoint) == -1) return;
partition = *((RAMDISK_PARTITION **) devops->deviceData);
if (partition->automount) delete partition;
free(devops);
}
extern "C" void ramdiskUnmount(const char *mountpoint)
{
ramdiskFS_Unmount(mountpoint);
}
//---------------------------------------------------------------------------------
int ramdiskFS_Mount(const char *mountpoint, void *handle)
{
//---------------------------------------------------------------------------------
devoptab_t* devops;
char* nameCopy;
RAMDISK_PARTITION** partition;
char Mountpoint[100];
char *cptr;
strlcpy(Mountpoint, mountpoint, sizeof(Mountpoint));
int len = strlen(Mountpoint);
cptr = strchr(Mountpoint, ':');
if (cptr)
{
len = cptr - Mountpoint;
*++cptr = 0;
}
else strlcat(Mountpoint, ":", sizeof(Mountpoint));
ramdiskFS_Unmount(Mountpoint);
if (handle) ramdiskFS_Unmount(((RAMDISK_PARTITION*) handle)->name);
devops = (devoptab_t*) malloc(sizeof(devoptab_t) + sizeof(RAMDISK_PARTITION*) + len + 1);
if (!devops) return false;
partition = (RAMDISK_PARTITION**) (devops + 1); // Use the space allocated at the end of the devoptab struct
// for storing the partition
nameCopy = (char*) (partition + 1); // Use the space allocated at the end of the partition struct
// for storing the name
memcpy(devops, &ramdiskFS_devoptab, sizeof(ramdiskFS_devoptab)); // Add an entry for this device to the devoptab table
strlcpy(nameCopy, Mountpoint, len + 1);
devops->name = nameCopy;
if (handle)
{
*partition = (RAMDISK_PARTITION*) handle;
(*partition)->Rename(Mountpoint);
}
else *partition = new RAMDISK_PARTITION(Mountpoint, true);
devops->deviceData = partition;
if (AddDevice(devops) < 0)
{
free(devops);
return false;
}
return true;
}
extern "C" int ramdiskMount(const char *mountpoint, void *handle)
{
return ramdiskFS_Mount(mountpoint, handle);
}
//---------------------------------------------------------------------------------
extern "C" void* ramdiskCreate()
{
//---------------------------------------------------------------------------------
return new RAMDISK_PARTITION("", false);
}
//---------------------------------------------------------------------------------
extern "C" void ramdiskDelete(void* Handle)
{
//---------------------------------------------------------------------------------
RAMDISK_PARTITION *partition = (RAMDISK_PARTITION*) Handle;
if (partition->automount == false) ramdiskFS_Unmount(partition->name);
delete partition;
}

View File

@ -1,81 +0,0 @@
#ifndef __RAMDISK_H
#define __RAMDISK_H
#ifdef __cplusplus
extern "C"
{
#endif
/*
ramdiskCreate initialize a dynamic RAM-disk.
return: Handle for ramdiskMount
*/
void* ramdiskCreate();
/**************************************************
* ramdiskDelete
*
* destroy all datas
* if the ramdisk is allready mounted forces ramdiskUnmount
* IN: a Handle was created witch ramdiskCreate();
**************************************************/
void ramdiskDelete(void* Handle);
/**************************************************
* ramdiskMount
*
* mounts a ramdisk
* IN: mountpoint e.g. "RAM" or "MEM:"
* handle is a Handle was created ramdiskCreate()
* or NULL for auto-create
* OUT: 0 = Error / !0 = OK
**************************************************/
int ramdiskMount(const char *mountpoint, void *handle);
/**************************************************
* ramdiskUnmount
*
* unmounts a ramdisk
* IN: mountpoint e.g "RAM" or "MEM:"
**************************************************/
void ramdiskUnmount(const char *mountpoint);
/*
NOTE:
if the ramdisk not explizit created with ramdiskCreate (e.g ramdiskMount("RAMDISK:", NULL))
the ramdisk is implizit created. When unmount this "auto-created" ramdisk the ramdisk automitic deleted
but if the ramdisk explizit created (with ramdiskCreate),
then we can remount the filesystem without lost all datas.
Example1:
=========
void *ram = ramdiskCreate(); // create ramdisk
ramdiskMount("RAM", ram); // mount the ramdisk
...
fopen("RAM:/file", ...);
...
ramdiskMount("MEM", ram); // remount as MEM: (without lost of data)
...
fopen("RAM:/file", ...);
...
ramdiskUnmount("MEM"); // unmount
...
ramdiskMount("RAM", ram); // remount as RAM: (without lost of data)
...
ramdiskDelete(ram); // unmount and delete
Example2:
=========
ramdiskMount("RAM", NULL); // create and mount the ramdisk
...
fopen("RAM:/file", ...);
...
ramdiskUnmount("RAM"); // unmount and delete
*/
#ifdef __cplusplus
}
#endif
#endif /*__RAMDISK_H*/

View File

@ -106,33 +106,22 @@ int MenuSettings()
// GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
GuiSound btnClick1(button_click_pcm, button_click_pcm_size, Settings.sfxvolume); GuiSound btnClick1(button_click_pcm, button_click_pcm_size, Settings.sfxvolume);
char imgPath[100]; GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png"));
GuiImageData settingsbg(Resources::GetFile("settings_background.png"), Resources::GetFileSize("settings_background.png"));
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", Settings.theme_path); GuiImageData MainButtonImgData(Resources::GetFile("settings_title.png"), Resources::GetFileSize("settings_title.png"));
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
snprintf(imgPath, sizeof(imgPath), "%ssettings_background.png", Settings.theme_path);
GuiImageData settingsbg(imgPath, settings_background_png);
snprintf(imgPath, sizeof(imgPath), "%ssettings_title.png", Settings.theme_path); GuiImageData MainButtonImgOverData(Resources::GetFile("settings_title_over.png"), Resources::GetFileSize("settings_title_over.png"));
GuiImageData MainButtonImgData(imgPath, settings_title_png);
snprintf(imgPath, sizeof(imgPath), "%ssettings_title_over.png", Settings.theme_path); GuiImageData PageindicatorImgData(Resources::GetFile("pageindicator.png"), Resources::GetFileSize("pageindicator.png"));
GuiImageData MainButtonImgOverData(imgPath, settings_title_over_png);
snprintf(imgPath, sizeof(imgPath), "%spageindicator.png", Settings.theme_path); GuiImageData arrow_left(Resources::GetFile("startgame_arrow_left.png"), Resources::GetFileSize("startgame_arrow_left.png"));
GuiImageData PageindicatorImgData(imgPath, pageindicator_png);
snprintf(imgPath, sizeof(imgPath), "%sstartgame_arrow_left.png", Settings.theme_path); GuiImageData arrow_right(Resources::GetFile("startgame_arrow_right.png"), Resources::GetFileSize("startgame_arrow_right.png"));
GuiImageData arrow_left(imgPath, startgame_arrow_left_png);
snprintf(imgPath, sizeof(imgPath), "%sstartgame_arrow_right.png", Settings.theme_path); GuiImageData creditsImgData(Resources::GetFile("credits_button.png"), Resources::GetFileSize("credits_button.png"));
GuiImageData arrow_right(imgPath, startgame_arrow_right_png);
snprintf(imgPath, sizeof(imgPath), "%scredits_button.png", Settings.theme_path); GuiImageData creditsOver(Resources::GetFile("credits_button_over.png"), Resources::GetFileSize("credits_button_over.png"));
GuiImageData creditsImgData(imgPath, credits_button_png);
snprintf(imgPath, sizeof(imgPath), "%scredits_button_over.png", Settings.theme_path);
GuiImageData creditsOver(imgPath, credits_button_over_png);
GuiImage creditsImg(&creditsImgData); GuiImage creditsImg(&creditsImgData);
GuiImage creditsImgOver(&creditsOver); GuiImage creditsImgOver(&creditsOver);
@ -305,8 +294,7 @@ int MenuSettings()
MainButton4.SetTrigger(&trigA); MainButton4.SetTrigger(&trigA);
customOptionList options2(MAXOPTIONS); customOptionList options2(MAXOPTIONS);
GuiCustomOptionBrowser optionBrowser2(396, 280, &options2, Settings.theme_path, "bg_options_settings.png", GuiCustomOptionBrowser optionBrowser2(396, 280, &options2, "bg_options_settings.png", 0, 150);
bg_options_settings_png, 0, 150);
optionBrowser2.SetPosition(0, 90); optionBrowser2.SetPosition(0, 90);
optionBrowser2.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); optionBrowser2.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
@ -1731,27 +1719,17 @@ int MenuSettings()
Theme.Load(Settings.theme_path); Theme.Load(Settings.theme_path);
ResumeGui(); ResumeGui();
menu = MENU_SETTINGS; menu = MENU_SETTINGS;
snprintf(imgPath, sizeof(imgPath), "%splayer1_point.png", if(pointer[0]) delete pointer[0];
Settings.theme_path); if(pointer[1]) delete pointer[1];
pointer[0] = new GuiImageData(imgPath, player1_point_png); if(pointer[2]) delete pointer[2];
snprintf(imgPath, sizeof(imgPath), "%splayer2_point.png", if(pointer[3]) delete pointer[3];
Settings.theme_path); pointer[0] = Resources::GetImageData("player1_point.png");
pointer[1] = new GuiImageData(imgPath, player2_point_png); pointer[1] = Resources::GetImageData("player2_point.png");
snprintf(imgPath, sizeof(imgPath), "%splayer3_point.png", pointer[2] = Resources::GetImageData("player3_point.png");
Settings.theme_path); pointer[3] = Resources::GetImageData("player4_point.png");
pointer[2] = new GuiImageData(imgPath, player3_point_png); if(background) delete background;
snprintf(imgPath, sizeof(imgPath), "%splayer4_point.png", background = Resources::GetImageData(Settings.widescreen ? "wbackground.png" : "background.png");
Settings.theme_path); if(bgImg) delete bgImg;
pointer[3] = new GuiImageData(imgPath, player4_point_png);
if (Settings.widescreen)
snprintf(imgPath, sizeof(imgPath), "%swbackground.png",
Settings.theme_path);
else snprintf(imgPath, sizeof(imgPath), "%sbackground.png",
Settings.theme_path);
background = new GuiImageData(imgPath,
Settings.widescreen ? wbackground_png : background_png);
bgImg = new GuiImage(background); bgImg = new GuiImage(background);
mainWindow->Append(bgImg); mainWindow->Append(bgImg);
mainWindow->Append(&w); mainWindow->Append(&w);
@ -2292,18 +2270,12 @@ int MenuGameSettings(struct discHdr * header)
// GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
GuiSound btnClick1(button_click_pcm, button_click_pcm_size, Settings.sfxvolume); GuiSound btnClick1(button_click_pcm, button_click_pcm_size, Settings.sfxvolume);
char imgPath[100]; GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png"));
GuiImageData settingsbg(Resources::GetFile("settings_background.png"), Resources::GetFileSize("settings_background.png"));
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", Settings.theme_path); GuiImageData MainButtonImgData(Resources::GetFile("settings_title.png"), Resources::GetFileSize("settings_title.png"));
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
snprintf(imgPath, sizeof(imgPath), "%ssettings_background.png", Settings.theme_path);
GuiImageData settingsbg(imgPath, settings_background_png);
snprintf(imgPath, sizeof(imgPath), "%ssettings_title.png", Settings.theme_path); GuiImageData MainButtonImgOverData(Resources::GetFile("settings_title_over.png"), Resources::GetFileSize("settings_title_over.png"));
GuiImageData MainButtonImgData(imgPath, settings_title_png);
snprintf(imgPath, sizeof(imgPath), "%ssettings_title_over.png", Settings.theme_path);
GuiImageData MainButtonImgOverData(imgPath, settings_title_over_png);
GuiTrigger trigA; GuiTrigger trigA;
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
@ -2429,8 +2401,7 @@ int MenuGameSettings(struct discHdr * header)
MainButton4.SetTrigger(&trigA); MainButton4.SetTrigger(&trigA);
customOptionList options2(MAXOPTIONS); customOptionList options2(MAXOPTIONS);
GuiCustomOptionBrowser optionBrowser2(396, 280, &options2, Settings.theme_path, "bg_options_settings.png", GuiCustomOptionBrowser optionBrowser2(396, 280, &options2, "bg_options_settings.png", 0, 150);
bg_options_settings_png, 0, 150);
optionBrowser2.SetPosition(0, 90); optionBrowser2.SetPosition(0, 90);
optionBrowser2.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); optionBrowser2.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);

View File

@ -100,12 +100,8 @@ int MenuLanguageSelect()
if ( !btnClick2 ) btnClick2 = new GuiSound( button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume ); if ( !btnClick2 ) btnClick2 = new GuiSound( button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume );
// GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
char imgPath[100]; GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png"));
GuiImageData settingsbg(Resources::GetFile("settings_background.png"), Resources::GetFileSize("settings_background.png"));
snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", Settings.theme_path );
GuiImageData btnOutline( imgPath, button_dialogue_box_png );
snprintf( imgPath, sizeof( imgPath ), "%ssettings_background.png", Settings.theme_path );
GuiImageData settingsbg( imgPath, settings_background_png );
GuiTrigger trigA; GuiTrigger trigA;
trigA.SetSimpleTrigger( -1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A ); trigA.SetSimpleTrigger( -1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A );
@ -217,7 +213,7 @@ int MenuLanguageSelect()
scrollon = 1; scrollon = 1;
} }
GuiCustomOptionBrowser optionBrowser4( 396, 280, &options2, Settings.theme_path, "bg_options_settings.png", bg_options_settings_png, scrollon, 10 ); GuiCustomOptionBrowser optionBrowser4( 396, 280, &options2, "bg_options_settings.png", scrollon, 10 );
optionBrowser4.SetPosition( 0, 90 ); optionBrowser4.SetPosition( 0, 90 );
optionBrowser4.SetAlignment( ALIGN_CENTRE, ALIGN_TOP ); optionBrowser4.SetAlignment( ALIGN_CENTRE, ALIGN_TOP );

View File

@ -145,6 +145,8 @@ CTheme::~CTheme()
void CTheme::SetDefault() void CTheme::SetDefault()
{ {
Resources::Clear();
gamelist_x = 200; gamelist_x = 200;
gamelist_y = 49;//40; gamelist_y = 49;//40;
gamelist_w = 396; gamelist_w = 396;
@ -357,6 +359,8 @@ bool CTheme::Load(const char * theme_path)
} }
fclose(file); fclose(file);
Resources::LoadFiles(theme_path);
return true; return true;
} }

View File

@ -4,6 +4,7 @@
#include <string> #include <string>
#include <stdio.h> #include <stdio.h>
#include <gctypes.h> #include <gctypes.h>
#include "Resources.h"
class CTheme class CTheme
{ {

260
source/themes/Resources.cpp Normal file
View File

@ -0,0 +1,260 @@
#include <malloc.h>
#include <string.h>
#include "FileOperations/fileops.h"
#include "filelist.h"
#include "Resources.h"
RecourceFile Resources::RecourceFiles[] =
{
{"closebutton.png", closebutton_png, closebutton_png_size, NULL, 0},
{"gxlogo.png", gxlogo_png, gxlogo_png_size, NULL, 0},
{"sdcard.png", sdcard_png, sdcard_png_size, NULL, 0},
{"sdcard_over.png", sdcard_over_png, sdcard_over_png_size, NULL, 0},
{"Wifi_btn.png", Wifi_btn_png, Wifi_btn_png_size, NULL, 0},
{"wiimote.png", wiimote_png, wiimote_png_size, NULL, 0},
{"gameinfo1.png", gameinfo1_png, gameinfo1_png_size, NULL, 0},
{"gameinfo2.png", gameinfo2_png, gameinfo2_png_size, NULL, 0},
{"gameinfo1a.png", gameinfo1a_png, gameinfo1a_png_size, NULL, 0},
{"gameinfo2a.png", gameinfo2a_png, gameinfo2a_png_size, NULL, 0},
{"credits_button.png", credits_button_png, credits_button_png_size, NULL, 0},
{"credits_button_over.png", credits_button_over_png, credits_button_over_png_size, NULL, 0},
{"tooltip_left.png", tooltip_left_png, tooltip_left_png_size, NULL, 0},
{"tooltip_tile.png", tooltip_tile_png, tooltip_tile_png_size, NULL, 0},
{"tooltip_right.png", tooltip_right_png, tooltip_right_png_size, NULL, 0},
{"startgame_arrow_left.png", startgame_arrow_left_png, startgame_arrow_left_png_size, NULL, 0},
{"startgame_arrow_right.png", startgame_arrow_right_png, startgame_arrow_right_png_size, NULL, 0},
{"credits_bg.png", credits_bg_png, credits_bg_png_size, NULL, 0},
{"little_star.png", little_star_png, little_star_png_size, NULL, 0},
{"background.png", background_png, background_png_size, NULL, 0},
{"wbackground.png", wbackground_png, wbackground_png_size, NULL, 0},
{"bg_options_settings.png", bg_options_settings_png, bg_options_settings_png_size, NULL, 0},
{"settings_background.png", settings_background_png, settings_background_png_size, NULL, 0},
{"bg_browser.png", bg_browser_png, bg_browser_png_size, NULL, 0},
{"icon_folder.png", icon_folder_png, icon_folder_png_size, NULL, 0},
{"bg_browser_selection.png", bg_browser_selection_png, bg_browser_selection_png_size, NULL, 0},
{"addressbar_textbox.png", addressbar_textbox_png, addressbar_textbox_png_size, NULL, 0},
{"browser.png", browser_png, browser_png_size, NULL, 0},
{"browser_over.png", browser_over_png, browser_over_png_size, NULL, 0},
{"nocover.png", nocover_png, nocover_png_size, NULL, 0},
{"nocoverFlat.png", nocoverFlat_png, nocoverFlat_png_size, NULL, 0},
{"nodisc.png", nodisc_png, nodisc_png_size, NULL, 0},
{"theme_dialogue_box.png", theme_dialogue_box_png, theme_dialogue_box_png_size, NULL, 0},
{"button_install.png", button_install_png, button_install_png_size, NULL, 0},
{"button_install_over.png", button_install_over_png, button_install_over_png_size, NULL, 0},
{"dialogue_box_startgame.png", dialogue_box_startgame_png, dialogue_box_startgame_png_size, NULL, 0},
{"wdialogue_box_startgame.png", wdialogue_box_startgame_png, wdialogue_box_startgame_png_size, NULL, 0},
{"button_dialogue_box.png", button_dialogue_box_png, button_dialogue_box_png_size, NULL, 0},
{"keyboard_textbox.png", keyboard_textbox_png, keyboard_textbox_png_size, NULL, 0},
{"keyboard_key.png", keyboard_key_png, keyboard_key_png_size, NULL, 0},
{"keyboard_key_over.png", keyboard_key_over_png, keyboard_key_over_png_size, NULL, 0},
{"keyboard_mediumkey_over.png", keyboard_mediumkey_over_png, keyboard_mediumkey_over_png_size, NULL, 0},
{"keyboard_largekey_over.png", keyboard_largekey_over_png, keyboard_largekey_over_png_size, NULL, 0},
{"keyboard_backspace_over.png", keyboard_backspace_over_png, keyboard_backspace_over_png_size, NULL, 0},
{"keyboard_clear_over.png", keyboard_clear_over_png, keyboard_clear_over_png_size, NULL, 0},
{"menu_button.png", menu_button_png, menu_button_png_size, NULL, 0},
{"menu_button_over.png", menu_button_over_png, menu_button_over_png_size, NULL, 0},
{"settings_button.png", settings_button_png, settings_button_png_size, NULL, 0},
{"settings_button_over.png", settings_button_over_png, settings_button_over_png_size, NULL, 0},
{"settings_menu_button.png", settings_menu_button_png, settings_menu_button_png_size, NULL, 0},
{"wiimote_poweroff.png", wiimote_poweroff_png, wiimote_poweroff_png_size, NULL, 0},
{"dialogue_box.png", dialogue_box_png, dialogue_box_png_size, NULL, 0},
{"theme_box.png", theme_box_png, theme_box_png_size, NULL, 0},
{"wiimote_poweroff_over.png", wiimote_poweroff_over_png, wiimote_poweroff_over_png_size, NULL, 0},
{"bg_options.png", bg_options_png, bg_options_png_size, NULL, 0},
{"bg_options_entry.png", bg_options_entry_png, bg_options_entry_png_size, NULL, 0},
{"scrollbar.png", scrollbar_png, scrollbar_png_size, NULL, 0},
{"scrollbar_arrowup.png", scrollbar_arrowup_png, scrollbar_arrowup_png_size, NULL, 0},
{"scrollbar_arrowdown.png", scrollbar_arrowdown_png, scrollbar_arrowdown_png_size, NULL, 0},
{"scrollbar_box.png", scrollbar_box_png, scrollbar_box_png_size, NULL, 0},
{"progressbar.png", progressbar_png, progressbar_png_size, NULL, 0},
{"progressbar_empty.png", progressbar_empty_png, progressbar_empty_png_size, NULL, 0},
{"progressbar_outline.png", progressbar_outline_png, progressbar_outline_png_size, NULL, 0},
{"player1_point.png", player1_point_png, player1_point_png_size, NULL, 0},
{"player2_point.png", player2_point_png, player2_point_png_size, NULL, 0},
{"player3_point.png", player3_point_png, player3_point_png_size, NULL, 0},
{"player4_point.png", player4_point_png, player4_point_png_size, NULL, 0},
{"rplayer1_point.png", rplayer1_point_png, rplayer1_point_png_size, NULL, 0},
{"rplayer2_point.png", rplayer2_point_png, rplayer2_point_png_size, NULL, 0},
{"rplayer3_point.png", rplayer3_point_png, rplayer3_point_png_size, NULL, 0},
{"rplayer4_point.png", rplayer4_point_png, rplayer4_point_png_size, NULL, 0},
{"battery.png", battery_png, battery_png_size, NULL, 0},
{"battery_bar.png", battery_bar_png, battery_bar_png_size, NULL, 0},
{"battery_white.png", battery_white_png, battery_white_png_size, NULL, 0},
{"battery_red.png", battery_red_png, battery_red_png_size, NULL, 0},
{"battery_bar_white.png", battery_bar_white_png, battery_bar_white_png_size, NULL, 0},
{"battery_bar_red.png", battery_bar_red_png, battery_bar_red_png_size, NULL, 0},
{"arrow_next.png", arrow_next_png, arrow_next_png_size, NULL, 0},
{"arrow_previous.png", arrow_previous_png, arrow_previous_png_size, NULL, 0},
{"mp3_pause.png", mp3_pause_png, mp3_pause_png_size, NULL, 0},
{"mp3_stop.png", mp3_stop_png, mp3_stop_png_size, NULL, 0},
{"exit_top.png", exit_top_png, exit_top_png_size, NULL, 0},
{"exit_top_over.png", exit_top_over_png, exit_top_over_png_size, NULL, 0},
{"exit_bottom.png", exit_bottom_png, exit_bottom_png_size, NULL, 0},
{"exit_bottom_over.png", exit_bottom_over_png, exit_bottom_over_png_size, NULL, 0},
{"exit_button.png", exit_button_png, exit_button_png_size, NULL, 0},
{"favorite.png", favorite_png, favorite_png_size, NULL, 0},
{"not_favorite.png", not_favorite_png, not_favorite_png_size, NULL, 0},
{"favIcon.png", favIcon_png, favIcon_png_size, NULL, 0},
{"favIcon_gray.png", favIcon_gray_png, favIcon_gray_png_size, NULL, 0},
{"searchIcon.png", searchIcon_png, searchIcon_png_size, NULL, 0},
{"searchIcon_gray.png", searchIcon_gray_png, searchIcon_gray_png_size, NULL, 0},
{"abcIcon.png", abcIcon_png, abcIcon_png_size, NULL, 0},
{"abcIcon_gray.png", abcIcon_gray_png, abcIcon_gray_png_size, NULL, 0},
{"rankIcon.png", rankIcon_png, rankIcon_png_size, NULL, 0},
{"rankIcon_gray.png", rankIcon_gray_png, rankIcon_gray_png_size, NULL, 0},
{"playCountIcon.png", playCountIcon_png, playCountIcon_png_size, NULL, 0},
{"playCountIcon_gray.png", playCountIcon_gray_png, playCountIcon_gray_png_size, NULL, 0},
{"arrangeList.png", arrangeList_png, arrangeList_png_size, NULL, 0},
{"arrangeList_gray.png", arrangeList_gray_png, arrangeList_gray_png_size, NULL, 0},
{"arrangeGrid.png", arrangeGrid_png, arrangeGrid_png_size, NULL, 0},
{"arrangeGrid_gray.png", arrangeGrid_gray_png, arrangeGrid_gray_png_size, NULL, 0},
{"arrangeCarousel.png", arrangeCarousel_png, arrangeCarousel_png_size, NULL, 0},
{"arrangeCarousel_gray.png", arrangeCarousel_gray_png, arrangeCarousel_gray_png_size, NULL, 0},
{"settings_title.png", settings_title_png, settings_title_png_size, NULL, 0},
{"settings_title_over.png", settings_title_over_png, settings_title_over_png_size, NULL, 0},
{"pageindicator.png", pageindicator_png, pageindicator_png_size, NULL, 0},
{"Wiimote1.png", Wiimote1_png, Wiimote1_png_size, NULL, 0},
{"Wiimote2.png", Wiimote2_png, Wiimote1_png_size, NULL, 0},
{"Wiimote4.png", Wiimote4_png, Wiimote4_png_size, NULL, 0},
{"wifi1.png", wifi1_png, wifi1_png_size, NULL, 0},
{"wifi2.png", wifi2_png, wifi2_png_size, NULL, 0},
{"wifi3.png", wifi3_png, wifi3_png_size, NULL, 0},
{"wifi4.png", wifi4_png, wifi4_png_size, NULL, 0},
{"wifi8.png", wifi8_png, wifi8_png_size, NULL, 0},
{"wifi12.png", wifi12_png, wifi12_png_size, NULL, 0},
{"wifi16.png", wifi16_png, wifi16_png_size, NULL, 0},
{"wifi32.png", wifi32_png, wifi32_png_size, NULL, 0},
{"norating.png", norating_png, norating_png_size, NULL, 0},
{"guitar.png", guitar_png, guitar_png_size, NULL, 0},
{"guitarR.png", guitarR_png, guitarR_png_size, NULL, 0},
{"microphone.png", microphone_png, microphone_png_size, NULL, 0},
{"microphoneR.png", microphoneR_png, microphoneR_png_size, NULL, 0},
{"gcncontroller.png", gcncontroller_png, gcncontroller_png_size, NULL, 0},
{"gcncontrollerR.png", gcncontrollerR_png, gcncontrollerR_png_size, NULL, 0},
{"classiccontroller.png", classiccontroller_png, classiccontroller_png_size, NULL, 0},
{"classiccontrollerR.png", classiccontrollerR_png, classiccontrollerR_png_size, NULL, 0},
{"nunchuk.png", nunchuk_png, nunchuk_png_size, NULL, 0},
{"nunchukR.png", nunchukR_png, nunchukR_png_size, NULL, 0},
{"dancepad.png", dancepad_png, dancepad_png_size, NULL, 0},
{"dancepadR.png", dancepadR_png, dancepadR_png_size, NULL, 0},
{"balanceboard.png", balanceboard_png, balanceboard_png_size, NULL, 0},
{"balanceboardR.png", balanceboardR_png, balanceboardR_png_size, NULL, 0},
{"drums.png", drums_png, drums_png_size, NULL, 0},
{"drumsR.png", drumsR_png, drumsR_png_size, NULL, 0},
{"motionplus.png", motionplus_png, motionplus_png_size, NULL, 0},
{"motionplusR.png", motionplusR_png, motionplusR_png_size, NULL, 0},
{"wheel.png", wheel_png, wheel_png_size, NULL, 0},
{"wheelR.png", wheelR_png, wheelR_png_size, NULL, 0},
{"zapper.png", zapper_png, zapper_png_size, NULL, 0},
{"zapperR.png", zapperR_png, zapperR_png_size, NULL, 0},
{"wiispeak.png", wiispeak_png, wiispeak_png_size, NULL, 0},
{"wiispeakR.png", wiispeakR_png, wiispeakR_png_size, NULL, 0},
{"nintendods.png", nintendods_png, nintendods_png_size, NULL, 0},
{"nintendodsR.png", nintendodsR_png, nintendodsR_png_size, NULL, 0},
{"esrb_ec.png", esrb_ec_png, esrb_ec_png_size, NULL, 0},
{"esrb_e.png", esrb_e_png, esrb_e_png_size, NULL, 0},
{"esrb_eten.png", esrb_eten_png, esrb_eten_png_size, NULL, 0},
{"esrb_t.png", esrb_t_png, esrb_t_png_size, NULL, 0},
{"esrb_m.png", esrb_m_png, esrb_m_png_size, NULL, 0},
{"esrb_ao.png", esrb_ao_png, esrb_ao_png_size, NULL, 0},
{"cero_a.png", cero_a_png, cero_a_png_size, NULL, 0},
{"cero_b.png", cero_b_png, cero_b_png_size, NULL, 0},
{"cero_c.png", cero_c_png, cero_c_png_size, NULL, 0},
{"cero_d.png", cero_d_png, cero_d_png_size, NULL, 0},
{"cero_z.png", cero_z_png, cero_z_png_size, NULL, 0},
{"pegi_3.png", pegi_3_png, pegi_3_png_size, NULL, 0},
{"pegi_7.png", pegi_7_png, pegi_7_png_size, NULL, 0},
{"pegi_12.png", pegi_12_png, pegi_12_png_size, NULL, 0},
{"pegi_16.png", pegi_16_png, pegi_16_png_size, NULL, 0},
{"pegi_18.png", pegi_18_png, pegi_18_png_size, NULL, 0},
{"dvd.png", dvd_png, dvd_png_size, NULL, 0},
{"dvd_gray.png", dvd_gray_png, dvd_gray_png_size, NULL, 0},
{"new.png", new_png, new_png_size, NULL, 0},
{"lock.png", lock_png, lock_png_size, NULL, 0},
{"lock_gray.png", lock_gray_png, lock_gray_png_size, NULL, 0},
{"unlock.png", unlock_png, unlock_png_size, NULL, 0},
{"unlock_gray.png", unlock_gray_png, unlock_gray_png_size, NULL, 0},
{NULL, NULL, 0, NULL, 0}
};
void Resources::Clear()
{
for(int i = 0; RecourceFiles[i].filename != NULL; ++i)
{
if(RecourceFiles[i].CustomFile)
{
free(RecourceFiles[i].CustomFile);
RecourceFiles[i].CustomFile = NULL;
}
if(RecourceFiles[i].CustomFileSize != 0)
RecourceFiles[i].CustomFileSize = 0;
}
}
void Resources::LoadFiles(const char * path)
{
if(!path)
return;
Clear();
char fullpath[1024];
for(int i = 0; RecourceFiles[i].filename != NULL; ++i)
{
snprintf(fullpath, sizeof(fullpath), "%s/%s", path, RecourceFiles[i].filename);
if(CheckFile(fullpath))
{
u8 * buffer = NULL;
u64 filesize = 0;
LoadFileToMem(fullpath, &buffer, &filesize);
RecourceFiles[i].CustomFile = buffer;
RecourceFiles[i].CustomFileSize = (u32) filesize;
}
}
}
const u8 * Resources::GetFile(const char * filename)
{
for(int i = 0; RecourceFiles[i].filename != NULL; ++i)
{
if(strcasecmp(filename, RecourceFiles[i].filename) == 0)
{
return (RecourceFiles[i].CustomFile ? RecourceFiles[i].CustomFile : RecourceFiles[i].DefaultFile);
}
}
return NULL;
}
const u32 Resources::GetFileSize(const char * filename)
{
for(int i = 0; RecourceFiles[i].filename != NULL; ++i)
{
if(strcasecmp(filename, RecourceFiles[i].filename) == 0)
{
return (RecourceFiles[i].CustomFile ? RecourceFiles[i].CustomFileSize : RecourceFiles[i].DefaultFileSize);
}
}
return NULL;
}
GuiImageData * Resources::GetImageData(const char * filename)
{
for(int i = 0; RecourceFiles[i].filename != NULL; ++i)
{
if(strcasecmp(filename, RecourceFiles[i].filename) == 0)
{
const u8 * buff = RecourceFiles[i].CustomFile ? RecourceFiles[i].CustomFile : RecourceFiles[i].DefaultFile;
const u32 size = RecourceFiles[i].CustomFile ? RecourceFiles[i].CustomFileSize : RecourceFiles[i].DefaultFileSize;
return (new GuiImageData(buff, size));
}
}
return NULL;
}

29
source/themes/Resources.h Normal file
View File

@ -0,0 +1,29 @@
#ifndef RECOURCES_H_
#define RECOURCES_H_
#include "libwiigui/gui_imagedata.h"
#include "filelist.h"
typedef struct _RecourceFile
{
const char *filename;
const u8 *DefaultFile;
const u32 DefaultFileSize;
u8 *CustomFile;
u32 CustomFileSize;
} RecourceFile;
class Resources
{
public:
static void Clear();
static void LoadFiles(const char * path);
static const u8 * GetFile(const char * filename);
static const u32 GetFileSize(const char * filename);
static GuiImageData * GetImageData(const char * filename);
private:
static RecourceFile RecourceFiles[];
};
#endif

View File

@ -153,11 +153,8 @@ static int Theme_Prompt(const char *title, const char *author, GuiImageData *thu
if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
// GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
char imgPath[100]; GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png"));
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", Settings.theme_path); GuiImageData dialogBox(Resources::GetFile("theme_dialogue_box.png"), Resources::GetFileSize("theme_dialogue_box.png"));
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
snprintf(imgPath, sizeof(imgPath), "%stheme_dialogue_box.png", Settings.theme_path);
GuiImageData dialogBox(imgPath, theme_dialogue_box_png);
GuiImage dialogBoxImg(&dialogBox); GuiImage dialogBoxImg(&dialogBox);
@ -285,38 +282,28 @@ int Theme_Downloader()
char THEME_LINK[70]; char THEME_LINK[70];
sprintf(THEME_LINK, "http://wii.spiffy360.com/themes.php?xml=1&category=1&adult=%d", Settings.godmode); sprintf(THEME_LINK, "http://wii.spiffy360.com/themes.php?xml=1&category=1&adult=%d", Settings.godmode);
//gprintf("\nTHEME_LINK: %s", THEME_LINK);
//const char THEME_LINK_ADULT[70] = "http://wii.spiffy360.com/themes.php?xml=1&category=1&adult=1";
/*** Sound Variables ***/ /*** Sound Variables ***/
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, Settings.sfxvolume); GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, Settings.sfxvolume);
// because destroy GuiSound must wait while sound playing is finished, we use a global sound // because destroy GuiSound must wait while sound playing is finished, we use a global sound
if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
// GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
GuiSound btnClick1(button_click_pcm, button_click_pcm_size, Settings.sfxvolume); GuiSound btnClick1(button_click_pcm, button_click_pcm_size, Settings.sfxvolume);
/*** Image Variables ***/ /*** Image Variables ***/
char imgPath[150]; GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png"));
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", Settings.theme_path);
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
snprintf(imgPath, sizeof(imgPath), "%stheme_box.png", Settings.theme_path); GuiImageData theme_box_Data(Resources::GetFile("theme_box.png"), Resources::GetFileSize("theme_box.png"));
GuiImageData theme_box_Data(imgPath, theme_box_png);
snprintf(imgPath, sizeof(imgPath), "%ssettings_background.png", Settings.theme_path); GuiImageData bgData(Resources::GetFile("settings_background.png"), Resources::GetFileSize("settings_background.png"));
GuiImageData bgData(imgPath, settings_background_png);
snprintf(imgPath, sizeof(imgPath), "%sstartgame_arrow_left.png", Settings.theme_path); GuiImageData arrow_left(Resources::GetFile("startgame_arrow_left.png"), Resources::GetFileSize("startgame_arrow_left.png"));
GuiImageData arrow_left(imgPath, startgame_arrow_left_png);
snprintf(imgPath, sizeof(imgPath), "%sstartgame_arrow_right.png", Settings.theme_path); GuiImageData arrow_right(Resources::GetFile("startgame_arrow_right.png"), Resources::GetFileSize("startgame_arrow_right.png"));
GuiImageData arrow_right(imgPath, startgame_arrow_right_png);
snprintf(imgPath, sizeof(imgPath), "%sWifi_btn.png", Settings.theme_path); GuiImageData wifiImgData(Resources::GetFile("Wifi_btn.png"), Resources::GetFileSize("Wifi_btn.png"));
GuiImageData wifiImgData(imgPath, Wifi_btn_png);
snprintf(imgPath, sizeof(imgPath), "%spageindicator.png", Settings.theme_path); GuiImageData PageindicatorImgData(Resources::GetFile("pageindicator.png"), Resources::GetFileSize("pageindicator.png"));
GuiImageData PageindicatorImgData(imgPath, pageindicator_png);
GuiImage background(&bgData); GuiImage background(&bgData);

View File

@ -13,6 +13,7 @@
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <wiiuse/wpad.h> #include <wiiuse/wpad.h>
#include <pngu/pngu.h>
#include "input.h" #include "input.h"
#include "gecko.h" #include "gecko.h"

View File

@ -125,11 +125,8 @@ s32 Wad_Install(FILE *fp)
if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
// GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
char imgPath[100]; GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png"));
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", Settings.theme_path); GuiImageData dialogBox(Resources::GetFile("dialogue_box.png"), Resources::GetFileSize("dialogue_box.png"));
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
snprintf(imgPath, sizeof(imgPath), "%sdialogue_box.png", Settings.theme_path);
GuiImageData dialogBox(imgPath, dialogue_box_png);
GuiTrigger trigA; GuiTrigger trigA;
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
@ -150,8 +147,7 @@ s32 Wad_Install(FILE *fp)
btn1.SetLabel(&btn1Txt); btn1.SetLabel(&btn1Txt);
btn1.SetState(STATE_SELECTED); btn1.SetState(STATE_SELECTED);
snprintf(imgPath, sizeof(imgPath), "%sprogressbar_outline.png", Settings.theme_path); GuiImageData progressbarOutline(Resources::GetFile("progressbar_outline.png"), Resources::GetFileSize("progressbar_outline.png"));
GuiImageData progressbarOutline(imgPath, progressbar_outline_png);
GuiImage progressbarOutlineImg(&progressbarOutline); GuiImage progressbarOutlineImg(&progressbarOutline);
if (Settings.wsprompt == yes) if (Settings.wsprompt == yes)
{ {
@ -160,15 +156,13 @@ s32 Wad_Install(FILE *fp)
progressbarOutlineImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); progressbarOutlineImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
progressbarOutlineImg.SetPosition(25, 50); progressbarOutlineImg.SetPosition(25, 50);
snprintf(imgPath, sizeof(imgPath), "%sprogressbar_empty.png", Settings.theme_path); GuiImageData progressbarEmpty(Resources::GetFile("progressbar_empty.png"), Resources::GetFileSize("progressbar_empty.png"));
GuiImageData progressbarEmpty(imgPath, progressbar_empty_png);
GuiImage progressbarEmptyImg(&progressbarEmpty); GuiImage progressbarEmptyImg(&progressbarEmpty);
progressbarEmptyImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); progressbarEmptyImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
progressbarEmptyImg.SetPosition(25, 50); progressbarEmptyImg.SetPosition(25, 50);
progressbarEmptyImg.SetTile(100); progressbarEmptyImg.SetTile(100);
snprintf(imgPath, sizeof(imgPath), "%sprogressbar.png", Settings.theme_path); GuiImageData progressbar(Resources::GetFile("progressbar.png"), Resources::GetFileSize("progressbar.png"));
GuiImageData progressbar(imgPath, progressbar_png);
GuiImage progressbarImg(&progressbar); GuiImage progressbarImg(&progressbar);
progressbarImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); progressbarImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
progressbarImg.SetPosition(25, 50); progressbarImg.SetPosition(25, 50);
@ -311,6 +305,8 @@ s32 Wad_Install(FILE *fp)
// Get TMD info // Get TMD info
tmd_data = (tmd *) SIGNATURE_PAYLOAD(p_tmd); tmd_data = (tmd *) SIGNATURE_PAYLOAD(p_tmd);
char imgPath[150];
// Install contents // Install contents
//ResumeGui(); //ResumeGui();
@ -448,11 +444,8 @@ s32 Wad_Uninstall(FILE *fp)
if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
// GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
char imgPath[100]; GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png"));
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", Settings.theme_path); GuiImageData dialogBox(Resources::GetFile("dialogue_box.png"), Resources::GetFileSize("dialogue_box.png"));
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
snprintf(imgPath, sizeof(imgPath), "%sdialogue_box.png", Settings.theme_path);
GuiImageData dialogBox(imgPath, dialogue_box_png);
GuiTrigger trigA; GuiTrigger trigA;
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);