revert dimok's stuff, because it makes too many trubble

This commit is contained in:
ardi@ist-einmalig.de 2009-10-19 20:34:54 +00:00
parent 9f66829728
commit 31cd4d03e2
24 changed files with 2083 additions and 2351 deletions

File diff suppressed because it is too large Load Diff

View File

@ -156,68 +156,37 @@
#include FT_FREETYPE_H
#include FT_BITMAP_H
#include "Metaphrasis.h"
#include "filelist.h"
#include <malloc.h>
#include <string.h>
#include <wchar.h>
#include <map>
#define MAX_FONT_SIZE 100
/*! \struct ftgxCharData_
/*! forward deklaration of private structures
*
* Font face character glyph relevant data structure.
*/
typedef struct ftgxCharData_ {
int16_t renderOffsetX; /**< Texture X axis bearing offset. */
uint16_t glyphAdvanceX; /**< Character glyph X coordinate advance in pixels. */
uint16_t glyphIndex; /**< Charachter glyph index in the font face. */
uint16_t textureWidth; /**< Texture width in pixels/bytes. */
uint16_t textureHeight; /**< Texture glyph height in pixels/bytes. */
int16_t renderOffsetY; /**< Texture Y axis bearing offset. */
int16_t renderOffsetMax; /**< Texture Y axis bearing maximum value. */
int16_t renderOffsetMin; /**< Texture Y axis bearing minimum value. */
uint32_t* glyphDataTexture; /**< Glyph texture bitmap data buffer. */
} ftgxCharData;
/*! \struct ftgxDataOffset_
*
* Offset structure which hold both a maximum and minimum value.
*/
typedef struct ftgxDataOffset_ {
int16_t ascender; /**< Maximum data offset. */
int16_t descender; /**< Minimum data offset. */
int16_t max; /**< Maximum data offset. */
int16_t min; /**< Minimum data offset. */
} ftgxDataOffset;
typedef struct ftgxCharData_ ftgxCharData;
typedef struct ftgxDataOffset_ ftgxDataOffset;
#define _TEXT(t) L ## t /**< Unicode helper macro. */
#define FTGX_NULL 0x0000
#define FTGX_JUSTIFY_LEFT 0x0001
#define FTGX_JUSTIFY_CENTER 0x0002
#define FTGX_JUSTIFY_RIGHT 0x0004
#define FTGX_JUSTIFY_MASK 0x000f
#define FTGX_NULL 0x0000
#define FTGX_JUSTIFY_LEFT 0x0001
#define FTGX_JUSTIFY_CENTER 0x0002
#define FTGX_JUSTIFY_RIGHT 0x0003
#define FTGX_JUSTIFY_MASK 0x000f
#define FTGX_ALIGN_TOP 0x0010
#define FTGX_ALIGN_MIDDLE 0x0020
#define FTGX_ALIGN_BOTTOM 0x0040
#define FTGX_ALIGN_BASELINE 0x0080
#define FTGX_ALIGN_GLYPH_TOP 0x0100
#define FTGX_ALIGN_GLYPH_MIDDLE 0x0200
#define FTGX_ALIGN_GLYPH_BOTTOM 0x0400
#define FTGX_ALIGN_MASK 0x0ff0
#define FTGX_ALIGN_TOP 0x0010
#define FTGX_ALIGN_MIDDLE 0x0020
#define FTGX_ALIGN_BOTTOM 0x0030
#define FTGX_ALIGN_BASELINE 0x0040
#define FTGX_ALIGN_GLYPH_TOP 0x0050
#define FTGX_ALIGN_GLYPH_MIDDLE 0x0060
#define FTGX_ALIGN_GLYPH_BOTTOM 0x0070
#define FTGX_ALIGN_MASK 0x00f0
#define FTGX_STYLE_UNDERLINE 0x1000
#define FTGX_STYLE_STRIKE 0x2000
#define FTGX_STYLE_MASK 0xf000
#define FTGX_STYLE_UNDERLINE 0x0100
#define FTGX_STYLE_STRIKE 0x0200
#define FTGX_STYLE_MASK 0x0f00
#define FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_MODULATE 0X0001
#define FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_DECAL 0X0002
@ -234,11 +203,10 @@ typedef struct ftgxDataOffset_ ftgxDataOffset;
#define FTGX_COMPATIBILITY_GRRLIB FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_PASSCLR | FTGX_COMPATIBILITY_DEFAULT_VTXDESC_GX_NONE
#define FTGX_COMPATIBILITY_LIBWIISPRITE FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_MODULATE | FTGX_COMPATIBILITY_DEFAULT_VTXDESC_GX_DIRECT
const GXColor ftgxWhite = (GXColor){0xff, 0xff, 0xff, 0xff}; /**< Constant color value used only to sanitize Doxygen documentation. */
wchar_t* charToWideChar(const char* p);
bool LoadCustomFont(const char *path);
void ClearFontData();
const GXColor ftgxWhite = (GXColor) {
0xff, 0xff, 0xff, 0xff
}
; /**< Constant color value used only to sanitize Doxygen documentation. */
/*! \class FreeTypeGX
* \brief Wrapper class for the libFreeType library with GX rendering.
@ -251,56 +219,59 @@ void ClearFontData();
*/
class FreeTypeGX {
private:
FT_Library ftLibrary; /**< FreeType FT_Library instance. */
FT_Face ftFace; /**< FreeType reusable FT_Face typographic object. */
FT_GlyphSlot ftSlot; /**< FreeType reusable FT_GlyphSlot glyph container object. */
FT_UInt ftPointSize; /**< Requested size of the rendered font. */
bool ftKerningEnabled; /**< Flag indicating the availability of font kerning data. */
private:
FT_Library ftLibrary; /**< FreeType FT_Library instance. */
FT_Face ftFace; /**< FreeType reusable FT_Face typographic object. */
FT_Byte *ftFace_fromFile;
FT_GlyphSlot ftSlot; /**< FreeType reusable FT_GlyphSlot glyph container object. */
FT_UInt ftPointSize; /**< Requested size of the rendered font. */
bool ftKerningEnabled; /**< Flag indicating the availability of font kerning data. */
uint8_t textureFormat; /**< Defined texture format of the target EFB. */
uint8_t vertexIndex; /**< Vertex format descriptor index. */
uint32_t compatibilityMode; /**< Compatibility mode for default tev operations and vertex descriptors. */
std::map<wchar_t, ftgxCharData> fontData; /**< Map which holds the glyph data structures for the corresponding characters. */
uint8_t textureFormat; /**< Defined texture format of the target EFB. */
uint8_t vertexIndex; /**< Vertex format descriptor index. */
uint32_t compatibilityMode; /**< Compatibility mode for default tev operations and vertex descriptors. */
std::map<wchar_t, ftgxCharData> fontData; /**< Map which holds the glyph data structures for the corresponding characters. */
static uint16_t adjustTextureWidth(uint16_t textureWidth, uint8_t textureFormat);
static uint16_t adjustTextureHeight(uint16_t textureHeight, uint8_t textureFormat);
static uint16_t adjustTextureWidth(uint16_t textureWidth, uint8_t textureFormat);
static uint16_t adjustTextureHeight(uint16_t textureHeight, uint8_t textureFormat);
static int16_t getStyleOffsetWidth(uint16_t width, uint16_t format);
static int16_t getStyleOffsetHeight(ftgxDataOffset *offset, uint16_t format);
static int16_t getStyleOffsetWidth(uint16_t width, uint16_t format);
static int16_t getStyleOffsetHeight(ftgxDataOffset *offset, uint16_t format);
void unloadFont();
ftgxCharData *cacheGlyphData(wchar_t charCode);
uint16_t cacheGlyphDataComplete();
void loadGlyphData(FT_Bitmap *bmp, ftgxCharData *charData);
void unloadFont();
void clearGlyphData();
ftgxCharData *cacheGlyphData(wchar_t charCode);
uint16_t cacheGlyphDataComplete();
void loadGlyphData(FT_Bitmap *bmp, ftgxCharData *charData);
void setDefaultMode();
void setDefaultMode();
void drawTextFeature(int16_t x, int16_t y, uint16_t width, ftgxDataOffset *offsetData, uint16_t format, GXColor color);
void copyTextureToFramebuffer(GXTexObj *texObj, f32 texWidth, f32 texHeight, int16_t screenX, int16_t screenY, GXColor color);
void copyFeatureToFramebuffer(f32 featureWidth, f32 featureHeight, int16_t screenX, int16_t screenY, GXColor color);
void drawTextFeature(int16_t x, int16_t y, uint16_t width, ftgxDataOffset *offsetData, uint16_t format, GXColor color);
void copyTextureToFramebuffer(GXTexObj *texObj, f32 texWidth, f32 texHeight, int16_t screenX, int16_t screenY, GXColor color);
void copyFeatureToFramebuffer(f32 featureWidth, f32 featureHeight, int16_t screenX, int16_t screenY, GXColor color);
public:
FreeTypeGX(FT_UInt pixelSize, uint8_t textureFormat, uint8_t vertexIndex);
FreeTypeGX(FT_UInt pixelSize, bool loadcustomfont = true, uint8_t* fontBuffer = (u8*)font_ttf, FT_Long bufferSize = font_ttf_size, uint8_t textureFormat = GX_TF_RGBA8, uint8_t vertexIndex = GX_VTXFMT1);
~FreeTypeGX();
public:
FreeTypeGX(uint8_t textureFormat = GX_TF_RGBA8, uint8_t vertexIndex = GX_VTXFMT1);
~FreeTypeGX();
void InitFreeType(uint8_t* fontBuffer, FT_Long bufferSize, bool loadcustomfont);
void ChangeFontSize(FT_UInt pixelSize, FT_UInt pixelSizeHorz = 0);
uint8_t GetMaxCharWidth();
static wchar_t* charToWideChar(char* p);
static wchar_t* charToWideChar(const char* p);
void setVertexFormat(uint8_t vertexIndex);
void setCompatibilityMode(uint32_t compatibilityMode);
void setVertexFormat(uint8_t vertexIndex);
void setCompatibilityMode(uint32_t compatibilityMode);
uint16_t loadFont(char* fontPath, uint8_t* fontBuffer, FT_Long bufferSize, FT_UInt pointSize, bool cacheAll = false);
uint16_t loadFont(const char* fontPath, const uint8_t* fontBuffer, FT_Long bufferSize, FT_UInt pointSize, bool cacheAll = false);
void changeSize(FT_UInt vPointSize, FT_UInt hPointSize=0);
uint16_t drawText(int16_t x, int16_t y, wchar_t *text, GXColor color = ftgxWhite, uint16_t textStyling = FTGX_NULL);
uint16_t drawText(int16_t x, int16_t y, wchar_t const *text, GXColor color = ftgxWhite, uint16_t textStyling = FTGX_NULL);
uint16_t drawText(int16_t x, int16_t y, wchar_t *text, GXColor color = ftgxWhite, uint16_t textStyling = FTGX_NULL);
uint16_t drawText(int16_t x, int16_t y, wchar_t const *text, GXColor color = ftgxWhite, uint16_t textStyling = FTGX_NULL);
uint16_t getWidth(wchar_t *text);
uint16_t getWidth(wchar_t const *text);
uint16_t getHeight(wchar_t *text);
uint16_t getHeight(wchar_t const *text);
void getOffset(wchar_t *text, ftgxDataOffset* offset);
void getOffset(wchar_t const *text, ftgxDataOffset* offset);
uint16_t getWidth(wchar_t *text);
uint16_t getWidth(wchar_t const *text);
uint16_t getHeight(wchar_t *text);
uint16_t getHeight(wchar_t const *text);
ftgxDataOffset* getOffset(wchar_t *text, ftgxDataOffset* offset);
ftgxDataOffset* getOffset(wchar_t const *text, ftgxDataOffset* offset);
};
#endif /* FREETYPEGX_H_ */

View File

@ -82,7 +82,7 @@ int CheatMenu(const char * gameID) {
GuiText titleTxt(c.getGameName().c_str(), 28, (GXColor) {0, 0, 0, 255});
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
titleTxt.SetMaxWidth(350, SCROLL_HORIZONTAL);
titleTxt.SetMaxWidth(350, GuiText::SCROLL);
titleTxt.SetPosition(12,40);
for (int i = 0; i <= cntcheats; i++) {

View File

@ -190,15 +190,15 @@ int MenuHomebrewBrowse() {
GuiImage MainButton1Img(&MainButtonImgData);
GuiImage MainButton1ImgOver(&MainButtonImgOverData);
GuiText MainButton1Txt(MainButtonText, 18, (GXColor) {0, 0, 0, 255});
MainButton1Txt.SetMaxWidth(MainButton1Img.GetWidth()-150, DOTTED);
MainButton1Txt.SetMaxWidth(MainButton1Img.GetWidth()-150, GuiText::DOTTED);
MainButton1Txt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
MainButton1Txt.SetPosition(148, -12);
GuiText MainButton1DescTxt(MainButtonText, 18, (GXColor) {0, 0, 0, 255});
MainButton1DescTxt.SetMaxWidth(MainButton1Img.GetWidth()-150, DOTTED);
MainButton1DescTxt.SetMaxWidth(MainButton1Img.GetWidth()-150, GuiText::DOTTED);
MainButton1DescTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
MainButton1DescTxt.SetPosition(148, 15);
GuiText MainButton1DescOverTxt(MainButtonText, 18, (GXColor) { 0, 0, 0, 255});
MainButton1DescOverTxt.SetMaxWidth(MainButton1Img.GetWidth()-150, SCROLL_HORIZONTAL);
MainButton1DescOverTxt.SetMaxWidth(MainButton1Img.GetWidth()-150, GuiText::SCROLL);
MainButton1DescOverTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
MainButton1DescOverTxt.SetPosition(148, 15);
GuiButton MainButton1(MainButton1Img.GetWidth(), MainButton1Img.GetHeight());
@ -219,15 +219,15 @@ int MenuHomebrewBrowse() {
GuiText MainButton2Txt(MainButtonText, 18, (GXColor) {0, 0, 0, 255 });
MainButton2Txt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
MainButton2Txt.SetPosition(148, -12);
MainButton2Txt.SetMaxWidth(MainButton2Img.GetWidth()-150, DOTTED);
MainButton2Txt.SetMaxWidth(MainButton2Img.GetWidth()-150, GuiText::DOTTED);
GuiText MainButton2DescTxt(MainButtonText, 18, (GXColor) { 0, 0, 0, 255});
MainButton2DescTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
MainButton2DescTxt.SetPosition(148, 15);
MainButton2DescTxt.SetMaxWidth(MainButton2Img.GetWidth()-150, DOTTED);
MainButton2DescTxt.SetMaxWidth(MainButton2Img.GetWidth()-150, GuiText::DOTTED);
GuiText MainButton2DescOverTxt(MainButtonText, 18, (GXColor) {0, 0, 0, 255});
MainButton2DescOverTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
MainButton2DescOverTxt.SetPosition(148, 15);
MainButton2DescOverTxt.SetMaxWidth(MainButton2Img.GetWidth()-150, SCROLL_HORIZONTAL);
MainButton2DescOverTxt.SetMaxWidth(MainButton2Img.GetWidth()-150, GuiText::SCROLL);
GuiButton MainButton2(MainButton2Img.GetWidth(), MainButton2Img.GetHeight());
MainButton2.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
MainButton2.SetPosition(0, 160);
@ -246,15 +246,15 @@ int MenuHomebrewBrowse() {
GuiText MainButton3Txt(MainButtonText, 18, (GXColor) {0, 0, 0, 255});
MainButton3Txt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
MainButton3Txt.SetPosition(148, -12);
MainButton3Txt.SetMaxWidth(MainButton3Img.GetWidth()-150, DOTTED);
MainButton3Txt.SetMaxWidth(MainButton3Img.GetWidth()-150, GuiText::DOTTED);
GuiText MainButton3DescTxt(MainButtonText, 18, (GXColor) { 0, 0, 0, 255});
MainButton3DescTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
MainButton3DescTxt.SetPosition(148, 15);
MainButton3DescTxt.SetMaxWidth(MainButton3Img.GetWidth()-150, DOTTED);
MainButton3DescTxt.SetMaxWidth(MainButton3Img.GetWidth()-150, GuiText::DOTTED);
GuiText MainButton3DescOverTxt(MainButtonText, 18, (GXColor) {0, 0, 0, 255 });
MainButton3DescOverTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
MainButton3DescOverTxt.SetPosition(148, 15);
MainButton3DescOverTxt.SetMaxWidth(MainButton3Img.GetWidth()-150, SCROLL_HORIZONTAL);
MainButton3DescOverTxt.SetMaxWidth(MainButton3Img.GetWidth()-150, GuiText::SCROLL);
GuiButton MainButton3(MainButton3Img.GetWidth(), MainButton3Img.GetHeight());
MainButton3.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
MainButton3.SetPosition(0, 230);
@ -273,15 +273,15 @@ int MenuHomebrewBrowse() {
GuiText MainButton4Txt(MainButtonText, 18, (GXColor) {0, 0, 0, 255} );
MainButton4Txt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
MainButton4Txt.SetPosition(148, -12);
MainButton4Txt.SetMaxWidth(MainButton4Img.GetWidth()-150, DOTTED);
MainButton4Txt.SetMaxWidth(MainButton4Img.GetWidth()-150, GuiText::DOTTED);
GuiText MainButton4DescTxt(MainButtonText, 18, (GXColor) {0, 0, 0, 255});
MainButton4DescTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
MainButton4DescTxt.SetPosition(148, 15);
MainButton4DescTxt.SetMaxWidth(MainButton4Img.GetWidth()-150, DOTTED);
MainButton4DescTxt.SetMaxWidth(MainButton4Img.GetWidth()-150, GuiText::DOTTED);
GuiText MainButton4DescOverTxt(MainButtonText, 18, (GXColor) { 0, 0, 0, 255});
MainButton4DescOverTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
MainButton4DescOverTxt.SetPosition(148, 15);
MainButton4DescOverTxt.SetMaxWidth(MainButton4Img.GetWidth()-150, SCROLL_HORIZONTAL );
MainButton4DescOverTxt.SetMaxWidth(MainButton4Img.GetWidth()-150, GuiText::SCROLL);
GuiButton MainButton4(MainButton4Img.GetWidth(), MainButton4Img.GetHeight());
MainButton4.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
MainButton4.SetPosition(0, 300);
@ -838,29 +838,29 @@ int MenuHomebrewBrowse() {
read += result;
}
char filename[101];
if (!error) {
network_read((u8*) &filename, 100);
// Do we need to unzip this thing?
if (wiiloadVersion[0] > 0 || wiiloadVersion[1] > 4) {
// We need to unzip...
if (temp[0] == 'P' && temp[1] == 'K' && temp[2] == 0x03 && temp[3] == 0x04) {
// It's a zip file, unzip to the apps directory
// Zip archive, ask for permission to install the zip
char zippath[255];
sprintf((char *) &zippath, "%s%s", Settings.homebrewapps_path, filename);
FILE *fp = fopen(zippath, "wb");
if (fp != NULL)
{
fwrite(temp, 1, infilesize, fp);
fclose(fp);
// Now unzip the zip file...
unzFile uf = unzOpen(zippath);
if (uf==NULL) {
@ -868,9 +868,9 @@ int MenuHomebrewBrowse() {
} else {
extractZip(uf,0,1,0, Settings.homebrewapps_path);
unzCloseCurrentFile(uf);
remove(zippath);
// Reload this menu here...
menu = MENU_HOMEBREWBROWSE;
break;
@ -884,17 +884,17 @@ int MenuHomebrewBrowse() {
uLongf f = uncfilesize;
error = uncompress(unc, &f, temp, infilesize) != Z_OK;
uncfilesize = f;
free(temp);
temp = unc;
}
}
if (!error && strstr(filename,".zip") == NULL) {
innetbuffer = temp;
}
}
ProgressStop();
if (error || read != infilesize) {

View File

@ -47,14 +47,13 @@
#include "input.h"
#include "oggplayer.h"
extern FreeTypeGX *fontSystem[];
extern FreeTypeGX *fontSystem;
#define SCROLL_INITIAL_DELAY 20
#define SCROLL_LOOP_DELAY 3
#define PAGESIZE 9
#define FILEBROWSERSIZE 8
#define MAX_OPTIONS 170
#define MAX_LINES_TO_DRAW 30
typedef void (*UpdateCallback)(void * e);
@ -91,16 +90,6 @@ enum
IMAGE_COPY
};
enum
{
NONE,
WRAP,
LONGTEXT,
DOTTED,
SCROLL_HORIZONTAL,
SCROLL_NONE
};
enum
{
TRIGGER_SIMPLE,
@ -710,8 +699,8 @@ class GuiText : public GuiElement
//!Sets the text of the GuiText element
//!\param t Text
void SetText(const char * t);
void SetText(const wchar_t * t);
void SetTextf(const char *format, ...) __attribute__((format(printf,2,3)));
void SetText(const wchar_t * t);
//!Sets up preset values to be used by GuiText(t)
//!Useful when printing multiple text elements, all with the same attributes set
//!\param sz Font size
@ -721,30 +710,28 @@ class GuiText : public GuiElement
//!\param s Font style
//!\param h Text alignment (horizontal)
//!\param v Text alignment (vertical)
void SetPresets(int sz, GXColor c, int w, u16 s, int h, int v);
static void SetPresets(int sz, GXColor c, int w, int wrap, u16 s, int h, int v);
//!Sets the font size
//!\param s Font size
void SetFontSize(int s);
//!Sets the first line to draw (default = 0)
//!\param line
void SetFirstLine(int line);
//!Sets max lines to draw
//!\param lines
void SetLinesToDraw(int lines);
//!Gets the total line number
int GetTotalLines();
//!Sets the maximum width of the drawn texture image
//!If the text exceeds this, it is wrapped to the next line
//!\param w Maximum width
//!\param m WrapMode
void SetMaxWidth(int w = 0, int m = WRAP);
enum {
WRAP,
DOTTED,
SCROLL,
MARQUEE
};
void SetMaxWidth(int w, short m=GuiText::WRAP);
//!Sets the font color
//!\param c Font color
void SetColor(GXColor c);
//!Sets the FreeTypeGX style attributes
//!\param s Style attributes
//!\param m Style-Mask attributes
void SetStyle(u16 s);
void SetStyle(u16 s, u16 m=0xffff);
//!Sets the text alignment
//!\param hor Horizontal alignment (ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTRE)
//!\param vert Vertical alignment (ALIGN_TOP, ALIGN_BOTTOM, ALIGN_MIDDLE)
@ -754,37 +741,33 @@ class GuiText : public GuiElement
void SetFont(FreeTypeGX *f);
//!Get the Horizontal Size of Text
int GetTextWidth();
//!Get the offset of a linebreak
u32 GetLineBreakOffset(int line);
//!Change the font
//!\param font bufferblock
//!\param font filesize
bool SetFont(const u8 *font, const u32 filesize);
//!SetWidescreen
// not NULL set horizontal scale to 0.75 //added
void SetWidescreen(bool w);
void SetNumLines(int n);//! these two are used to set the first line and numLine
void SetFirstLine(int n);
int GetNumLines();//! these return the line variables for this text
int GetFirstLine();
int GetLineHeight(int n);//! returns the height of the #n of lines including spacing if wrap mode is on
int GetTotalLines();
//!Constantly called to draw the text
void Draw();
protected:
wchar_t *text;
wchar_t *textDyn; //!< Wrapped text value
wchar_t *textDynRow[MAX_LINES_TO_DRAW]; //!< Wrapped lines text values
char *origText; //!< Original text data
int wrapMode; //!< Wrapping toggle
int textScrollPos; //!< Current starting index of text string for scrolling
int textScrollInitialDelay; //!< Delay to wait before starting to scroll
int textScrollDelay; //!< Scrolling speed
wchar_t* text; //!< Unicode text value
int size; //!< Font size
int maxWidth; //!< Maximum width of the generated text object (for text wrapping)
short wrapMode;
short scrollPos1;
short scrollPos2;
short scrollOffset;
u32 scrollDelay;
u16 style; //!< FreeTypeGX style attributes
GXColor color; //!< Font color
FreeTypeGX *font;
bool widescreen; //added
int firstLine;
int linestodraw;
int totalLines;
int textWidth;
int currentSize;
u32 *LineBreak;
short widescreen; //added
//!these are default until the text is drawn
int firstLine; //!these are the first line and the number of lines drawn when the text is wrapped
int numLines;//! default is -1 and it means that all lines are drawn
int totalLines; //!this is the total # of lines when in wrap mode
};
//!Display, manage, and manipulate tooltips in the GUI.
@ -997,7 +980,6 @@ class GuiKeyboard : public GuiWindow
GuiTrigger * trigB;
};
typedef struct _optionlist {
int length;
char name[MAX_OPTIONS][60];

View File

@ -187,7 +187,7 @@ GuiCustomOptionBrowser::GuiCustomOptionBrowser(int w, int h, customOptionList *
optionTxt[i] = new GuiText(options->GetName(i), 20, THEME.settingstext);
optionTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
optionTxt[i]->SetPosition(24,0);
optionTxt[i]->SetMaxWidth(bgOptionsImg->GetWidth() - (coL2+24), DOTTED);
optionTxt[i]->SetMaxWidth(bgOptionsImg->GetWidth() - (coL2+24), GuiText::DOTTED);
optionBg[i] = new GuiImage(bgOptionsEntry);
@ -424,10 +424,10 @@ void GuiCustomOptionBrowser::UpdateListEntries()
if(optionBtn[i]->GetState() != STATE_DISABLED)
{
optionVal[i]->SetPosition(coL2,0);
optionVal[i]->SetMaxWidth(bgOptionsImg->GetWidth() - (coL2+24), DOTTED);
optionVal[i]->SetMaxWidth(bgOptionsImg->GetWidth() - (coL2+24), GuiText::DOTTED);
optionValOver[i]->SetPosition(coL2,0);
optionValOver[i]->SetMaxWidth(bgOptionsImg->GetWidth() - (coL2+24), SCROLL_HORIZONTAL);
optionValOver[i]->SetMaxWidth(bgOptionsImg->GetWidth() - (coL2+24), GuiText::SCROLL);
}
}
}

View File

@ -111,12 +111,12 @@ GuiFileBrowser::GuiFileBrowser(int w, int h)
fileListText[i] = new GuiText(NULL,20, (GXColor){0, 0, 0, 0xff});
fileListText[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
fileListText[i]->SetPosition(5,0);
fileListText[i]->SetMaxWidth(bgFileSelectionImg->GetWidth() - (arrowDownImg->GetWidth()+20), DOTTED);
fileListText[i]->SetMaxWidth(bgFileSelectionImg->GetWidth() - (arrowDownImg->GetWidth()+20), GuiText::DOTTED);
fileListTextOver[i] = new GuiText(NULL,20, (GXColor){0, 0, 0, 0xff});
fileListTextOver[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
fileListTextOver[i]->SetPosition(5,0);
fileListTextOver[i]->SetMaxWidth(bgFileSelectionImg->GetWidth() - (arrowDownImg->GetWidth()+20), SCROLL_HORIZONTAL);
fileListTextOver[i]->SetMaxWidth(bgFileSelectionImg->GetWidth() - (arrowDownImg->GetWidth()+20), GuiText::SCROLL);
fileListBg[i] = new GuiImage(bgFileSelectionEntry);
//fileListArchives[i] = new GuiImage(fileArchives);

View File

@ -127,13 +127,13 @@ GuiGameBrowser::GuiGameBrowser(int w, int h, struct discHdr * l, int gameCnt, co
gameTxt[i] = new GuiText(get_title(&gameList[i]), 20, THEME.gametext);
gameTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
gameTxt[i]->SetPosition(24,0);
gameTxt[i]->SetMaxWidth(maxTextWidth, DOTTED);
gameTxt[i]->SetMaxWidth(maxTextWidth, GuiText::DOTTED);
gameTxtOver[i] = new GuiText(get_title(&gameList[i]), 20, THEME.gametext);
gameTxtOver[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
gameTxtOver[i]->SetPosition(24,0);
gameTxtOver[i]->SetMaxWidth(maxTextWidth, SCROLL_HORIZONTAL);
gameTxtOver[i]->SetMaxWidth(maxTextWidth, GuiText::SCROLL);
gameBg[i] = new GuiImage(bgGamesEntry);

View File

@ -111,7 +111,7 @@ noCover(nocover_png)
gamename->SetParent(this);
gamename->SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
gamename->SetPosition(0, 330);
gamename->SetMaxWidth(280, DOTTED);
gamename->SetMaxWidth(280, GuiText::DOTTED);
gameIndex = new int[pagesize];
game = new GuiButton * [pagesize];

View File

@ -69,8 +69,8 @@ sndClick(button_click_pcm, button_click_pcm_size, SOUND_PCM, Settings.sfxvolume)
text.SetText(gameFilter);
text.SetPosition(10, 15);
text.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
//text.SetWidescreen(CFG.widescreen);
text.SetMaxWidth(width-(10+2*42+10), SCROLL_HORIZONTAL);
text.SetWidescreen(CFG.widescreen);
text.SetMaxWidth(width-(10+2*42+10), GuiText::SCROLL);
this->Append(&text);
snprintf(imgPath, sizeof(imgPath), "%skeyboard_backspace_over.png", CFG.theme_path);

File diff suppressed because it is too large Load Diff

View File

@ -41,10 +41,18 @@
#define CONSOLE_WIDTH 340
#define CONSOLE_HEIGHT 218
FreeTypeGX *fontSystem=0;
FreeTypeGX *fontClock=0;
static void BootUpProblems()
{
s32 ret2;
// load main font from file, or default to built-in font
fontSystem = new FreeTypeGX();
fontSystem->loadFont(NULL, font_ttf, font_ttf_size, 0);
fontSystem->setCompatibilityMode(FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_PASSCLR | FTGX_COMPATIBILITY_DEFAULT_VTXDESC_GX_NONE);
GuiImageData bootimageData(gxlogo_png);
GuiImage bootimage(&bootimageData);
GuiText boottext(NULL, 20, (GXColor) {255, 255, 255, 255});
@ -64,7 +72,7 @@ static void BootUpProblems()
ret2 = IOS_ReloadIOS(249);
if (ret2 < 0) {
ret2 = IOS_ReloadIOS(222);
SDCard_Init();
SDCard_Init();
load_ehc_module();
SDCard_deInit();
if(ret2 <0) {
@ -103,6 +111,12 @@ static void BootUpProblems()
Menu_Render();
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
}
///delete font to load up custom if set
if(fontSystem) {
delete fontSystem;
fontSystem = NULL;
}
}
@ -111,9 +125,6 @@ main(int argc, char *argv[]) {
setlocale(LC_ALL, "en.UTF-8");
for(int i = 0; i < MAX_FONT_SIZE+1; i++)
fontSystem[i] = NULL;
s32 ret;
bool startupproblem = false;
@ -128,14 +139,14 @@ main(int argc, char *argv[]) {
/** PAD_Init has to be before InitVideo don't move that **/
PAD_Init(); // initialize PAD/WPAD
USBDevice_Init();// seems enough to wake up some HDDs if they are in sleep mode when the loader starts (tested with WD MyPassport Essential 2.5")
ret = IOS_ReloadIOS(249);
if (ret < 0) {
ret = IOS_ReloadIOS(222);
SDCard_Init();
SDCard_Init();
load_ehc_module();
SDCard_deInit();
if(ret <0) {
@ -149,7 +160,7 @@ main(int argc, char *argv[]) {
if (ret < 0) {
ret = IOS_ReloadIOS(222);
SDCard_Init();
SDCard_Init();
load_ehc_module();
SDCard_deInit();
if(ret < 0) {
@ -230,11 +241,18 @@ main(int argc, char *argv[]) {
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight);
// load main font from file, or default to built-in font
fontSystem = new FreeTypeGX();
char *fontPath = NULL;
asprintf(&fontPath, "%sfont.ttf", CFG.theme_path);
LoadCustomFont(fontPath);
fontSystem->loadFont(fontPath, font_ttf, font_ttf_size, 0);
fontSystem->setCompatibilityMode(FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_PASSCLR | FTGX_COMPATIBILITY_DEFAULT_VTXDESC_GX_NONE);
free(fontPath);
fontClock = new FreeTypeGX();
fontClock->loadFont(NULL, clock_ttf, clock_ttf_size, 0);
fontClock->setCompatibilityMode(FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_PASSCLR | FTGX_COMPATIBILITY_DEFAULT_VTXDESC_GX_NONE);
InitGUIThreads();
MainMenu(MENU_CHECK);
return 0;

View File

@ -8,8 +8,11 @@
#ifndef _MAIN_H_
#define _MAIN_H_
#include "FreeTypeGX.h"
extern struct SSettings Settings;
void DefaultSettings();
extern FreeTypeGX *fontSystem;
#endif

View File

@ -213,7 +213,7 @@ void ExitGUIThreads() {
}
void rockout(int f = 0) {
HaltGui();
int num=(f==2?-1:gameSelected);
@ -270,7 +270,7 @@ GuiImageData *LoadCoverImage(struct discHdr *header, bool Prefere3D, bool noCove
{
char *coverPath = flag ? Settings.covers_path : Settings.covers2d_path; flag = !flag;
//Load full id image
snprintf(Path, sizeof(Path), "%s%s.png", coverPath, IDfull);
snprintf(Path, sizeof(Path), "%s%s.png", coverPath, IDfull);
delete Cover; Cover = new(std::nothrow) GuiImageData(Path, NULL);
//Load short id image
if (!Cover || !Cover->GetImage())
@ -329,7 +329,6 @@ int MenuDiscList() {
int dataed = -1;
int cosa=0,sina=0;
int selectImg1 = 0;
bool firstRun = true;
char ID[4];
char IDfull[7];
u32 covert = 0;
@ -337,7 +336,7 @@ int MenuDiscList() {
if (!dvdheader)
dvdheader = new struct discHdr;
u8 mountMethodOLD =0;
WDVD_GetCoverStatus(&covert);
u32 covertOld=covert;
@ -469,19 +468,19 @@ int MenuDiscList() {
GuiText usedSpaceTxt(spaceinfo, 18, THEME.info);
usedSpaceTxt.SetAlignment(THEME.hddinfo_align, ALIGN_TOP);
usedSpaceTxt.SetPosition(THEME.hddinfo_x, THEME.hddinfo_y);
char GamesCnt[15];
sprintf(GamesCnt,"%s: %i",(mountMethod!=3?tr("Games"):tr("Channels")), gameCnt);
GuiText gamecntTxt(GamesCnt, 18, THEME.info);
GuiButton gamecntBtn(100,18);
gamecntBtn.SetAlignment(THEME.gamecount_align, ALIGN_TOP);
gamecntBtn.SetPosition(THEME.gamecount_x,THEME.gamecount_y);
gamecntBtn.SetLabel(&gamecntTxt);
gamecntBtn.SetEffectGrow();
gamecntBtn.SetTrigger(&trigA);
GuiTooltip installBtnTT(tr("Install a game"));
if (Settings.wsprompt == yes)
@ -745,18 +744,18 @@ int MenuDiscList() {
idBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
idBtn.SetPosition(THEME.id_x,THEME.id_y);
if (Settings.godmode == 1 && mountMethod!=3) {//only make the button have trigger & tooltip if in godmode
DownloadBtn.SetSoundOver(&btnSoundOver);
DownloadBtn.SetTrigger(&trigA);
DownloadBtn.SetTrigger(&trig1);
DownloadBtn.SetToolTip(&DownloadBtnTT,205,-30);
idBtn.SetSoundOver(&btnSoundOver);
idBtn.SetTrigger(&trigA);
idBtn.SetToolTip(&IDBtnTT,205,-30);
} else
{
DownloadBtn.SetRumble(false);
@ -784,11 +783,11 @@ int MenuDiscList() {
GuiText clockTimeBack("88:88", 40, (GXColor) {THEME.clock.r, THEME.clock.g, THEME.clock.b, THEME.clock.a/6});
clockTimeBack.SetAlignment(THEME.clock_align, ALIGN_TOP);
clockTimeBack.SetPosition(THEME.clock_x, THEME.clock_y);
clockTimeBack.SetFont(clock_ttf, clock_ttf_size);
clockTimeBack.SetFont(fontClock);
GuiText clockTime(theTime, 40, THEME.clock);
clockTime.SetAlignment(THEME.clock_align, ALIGN_TOP);
clockTime.SetPosition(THEME.clock_x, THEME.clock_y);
clockTime.SetFont(clock_ttf, clock_ttf_size);
clockTime.SetFont(fontClock);
HaltGui();
GuiWindow w(screenwidth, screenheight);
@ -808,7 +807,7 @@ int MenuDiscList() {
w.Append(&settingsBtn);
w.Append(&DownloadBtn);
w.Append(&idBtn);
// Begin Toolbar
w.Append(&favoriteBtn);
Toolbar[0] = &favoriteBtn;
@ -828,9 +827,9 @@ int MenuDiscList() {
Toolbar[7] = &dvdBtn;
w.SetUpdateCallback(DiscListWinUpdateCallback);
// End Toolbar
if (Settings.godmode == 1)
w.Append(&homebrewBtn);
@ -856,10 +855,10 @@ int MenuDiscList() {
if(searchBar)
mainWindow->Append(searchBar);
}
ResumeGui();
while (menu == MENU_NONE) {
if (idiotFlag==1) {
@ -892,36 +891,31 @@ int MenuDiscList() {
break;
}
//CLOCK update every 10 secs
if(frameCount % 600 == 0 || firstRun)
{
firstRun = false;
time_t rawtime = time(0); //this fixes code dump caused by the clock
if (((Settings.hddinfo == hr12)||(Settings.hddinfo == hr24)) && rawtime != lastrawtime) {
lastrawtime = rawtime;
timeinfo = localtime (&rawtime);
if (dataed < 1) {
if (Settings.hddinfo == hr12) {
if (rawtime & 1)
strftime(theTime, sizeof(theTime), "%I:%M", timeinfo);
else
strftime(theTime, sizeof(theTime), "%I %M", timeinfo);
}
if (Settings.hddinfo == hr24) {
if (rawtime & 1)
strftime(theTime, sizeof(theTime), "%H:%M", timeinfo);
else
strftime(theTime, sizeof(theTime), "%H %M", timeinfo);
}
clockTime.SetText(theTime);
} else if (dataed > 0) {
clockTime.SetTextf("%i", (dataed-1));
//CLOCK
time_t rawtime = time(0); //this fixes code dump caused by the clock
if (((Settings.hddinfo == hr12)||(Settings.hddinfo == hr24)) && rawtime != lastrawtime) {
lastrawtime = rawtime;
timeinfo = localtime (&rawtime);
if (dataed < 1) {
if (Settings.hddinfo == hr12) {
if (rawtime & 1)
strftime(theTime, sizeof(theTime), "%I:%M", timeinfo);
else
strftime(theTime, sizeof(theTime), "%I %M", timeinfo);
}
if (Settings.hddinfo == hr24) {
if (rawtime & 1)
strftime(theTime, sizeof(theTime), "%H:%M", timeinfo);
else
strftime(theTime, sizeof(theTime), "%H %M", timeinfo);
}
clockTime.SetText(theTime);
} else if (dataed > 0) {
clockTime.SetTextf("%i", (dataed-1));
}
}
if ((datagB<1)&&(Settings.cios==1)&&(Settings.video == ntsc)&&(Settings.hddinfo == hr12)&&(Settings.qboot==1)&&(Settings.wsprompt==0)&&(Settings.language==ger)&&(Settings.tooltips==0)){dataed=1;dataef=1;}if (dataef==1){if (cosa>7){cosa=1;}datag++;if (sina==3){wiiBtn.SetAlignment(ALIGN_LEFT,ALIGN_BOTTOM);wiiBtnImg.SetAngle(0);if(datag>163){datag=1;}else if (datag<62){wiiBtn.SetPosition(((cosa)*70),(-2*(datag)+120));}else if(62<=datag){wiiBtn.SetPosition(((cosa)*70),((datag*2)-130));}if (datag>162){wiiBtn.SetPosition(700,700);w.Remove(&wiiBtn);datagB=2;cosa++;sina=lastrawtime%4;}w.Append(&wiiBtn);}if (sina==2){wiiBtn.SetAlignment(ALIGN_RIGHT,ALIGN_TOP);wiiBtnImg.SetAngle(270);if(datag>163){datag=1;}else if (datag<62){wiiBtn.SetPosition(((-2*(datag)+130)),((cosa)*50));}else if(62<=datag){wiiBtn.SetPosition((2*(datag)-120),((cosa)*50));}if (datag>162){wiiBtn.SetPosition(700,700);w.Remove(&wiiBtn);datagB=2;cosa++;sina=lastrawtime%4;}w.Append(&wiiBtn);}if (sina==1){wiiBtn.SetAlignment(ALIGN_TOP,ALIGN_LEFT);wiiBtnImg.SetAngle(180);if(datag>163){datag=1;}else if (datag<62){wiiBtn.SetPosition(((cosa)*70),(2*(datag)-120));}else if(62<=datag){wiiBtn.SetPosition(((cosa)*70),(-2*(datag)+130));}if (datag>162){wiiBtn.SetPosition(700,700);w.Remove(&wiiBtn);datagB=2;cosa++;sina=lastrawtime%4;}w.Append(&wiiBtn);}if (sina==0){wiiBtn.SetAlignment(ALIGN_TOP,ALIGN_LEFT);wiiBtnImg.SetAngle(90);if(datag>163){datag=1;}else if (datag<62){wiiBtn.SetPosition(((2*(datag)-130)),((cosa)*50));}else if(62<=datag){wiiBtn.SetPosition((-2*(datag)+120),((cosa)*50));}if (datag>162){wiiBtn.SetPosition(700,700);w.Remove(&wiiBtn);datagB=2;cosa++;sina=lastrawtime%4;}w.Append(&wiiBtn);}}
// respond to button presses
@ -1064,7 +1058,7 @@ int MenuDiscList() {
}
if (isInserted(bootDevice)) {
HaltGui(); // to fix endless rumble when clicking on the SD icon when rumble is disabled because rumble is set to on in Global_Default()
CFG_Load();
CFG_Load();
ResumeGui();
}
sdcardBtn.ResetState();
@ -1179,8 +1173,8 @@ int MenuDiscList() {
wcscpy(newFilter, gameFilter);
newFilter[len] = searchChar;
newFilter[len+1] = 0;
__Menu_GetEntries(0, newFilter);
menu = MENU_DISCLIST;
break;
@ -1210,7 +1204,7 @@ int MenuDiscList() {
searchBtn.SetImageOver(&searchBtnImg_g);
searchBtn.SetAlpha(180);
}
ResumeGui();
}
else if(searchChar == 8) // Backspace
@ -1221,7 +1215,7 @@ int MenuDiscList() {
}
}
else if (abcBtn.GetState() == STATE_CLICKED) {
if (Settings.sort != all) {
Settings.sort=all;
@ -1239,6 +1233,7 @@ int MenuDiscList() {
else if (countBtn.GetState() == STATE_CLICKED) {
if (Settings.sort != pcount) {
Settings.sort=pcount;
//if(isSdInserted()) {
if (isInserted(bootDevice)) {
cfg_save_global();
}
@ -1315,7 +1310,7 @@ int MenuDiscList() {
}
else if (dvdBtn.GetState() == STATE_CLICKED) {
mountMethodOLD = (mountMethod==3?mountMethod:0);
mountMethod=DiscMount(dvdheader);
dvdBtn.ResetState();
@ -1368,7 +1363,7 @@ int MenuDiscList() {
delete GameRegionTxt;
GameRegionTxt = NULL;
}
switch (header->id[3]) {
case 'E':
sprintf(gameregion,"NTSC U");
@ -1432,7 +1427,7 @@ int MenuDiscList() {
}
}
}
if (idBtn.GetState() == STATE_CLICKED && mountMethod!=3) {
struct discHdr * header = &gameList[gameBrowser->GetSelectedOption()];
//enter new game ID
@ -1445,13 +1440,13 @@ int MenuDiscList() {
//__Menu_GetEntries();
menu = MENU_DISCLIST;
}
idBtn.ResetState();
}
}
if (((gameSelected >= 0) && (gameSelected < (s32)gameCnt))
|| mountMethod==1
|| mountMethod==1
|| mountMethod==2) {
if(searchBar)
{
@ -1480,7 +1475,7 @@ int MenuDiscList() {
header = (mountMethod==1||mountMethod==2?dvdheader:&gameList[gameSelected]); //reset header
snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
struct Game_CFG* game_cfg = CFG_get_game_opt(header->id);
if (game_cfg) {
alternatedol = game_cfg->loadalternatedol;
ocarinaChoice = game_cfg->ocarina;
@ -1524,7 +1519,7 @@ int MenuDiscList() {
}
}
wiilight(0);
if (isInserted(bootDevice)) {
//////////save game play count////////////////
@ -1623,7 +1618,7 @@ int MenuDiscList() {
wiilight(0);
//re-evaluate header now in case they changed games while on the game prompt
header = &gameList[gameSelected];
//enter new game title
char entered[60];
snprintf(entered, sizeof(entered), "%s", get_title(header));
@ -1680,7 +1675,7 @@ int MenuDiscList() {
if (game_cfg) {
if (game_cfg->alternatedolstart != 0)
altdoldefault = false;
}
}
if (altdoldefault) {
int autodol = autoSelectDol((char*)header->id, true);
if (autodol>0) {
@ -1698,11 +1693,11 @@ int MenuDiscList() {
}
}
}
if (menu == MENU_EXIT) {
SDCard_deInit();
}
HaltGui();
mainWindow->RemoveAll();
mainWindow->Append(bgImg);
@ -1745,7 +1740,7 @@ static int MenuInstall() {
GuiImageData batteryRed(imgPath, battery_red_png);
snprintf(imgPath, sizeof(imgPath), "%sbattery_bar_red.png", CFG.theme_path);
GuiImageData batteryBarRed(imgPath, battery_bar_red_png);
HaltGui();
GuiWindow w(screenwidth, screenheight);
@ -2185,7 +2180,7 @@ int MainMenu(int menu) {
break;
}
}
//MemInfoPrompt();
//for testing
/*if (mountMethod)
@ -2208,9 +2203,10 @@ int MainMenu(int menu) {
delete GameIDTxt;
delete cover;
delete coverImg;
delete fontClock;
delete fontSystem;
ShutdownAudio();
StopGX();
ClearFontData();
gettextCleanUp();
if (mountMethod==3)
{
@ -2250,7 +2246,7 @@ int MainMenu(int menu) {
if (!altdoldefault) {
alternatedol = game_cfg->loadalternatedol;
alternatedoloffset = game_cfg->alternatedolstart;
}
}
reloadblock = game_cfg->iosreloadblock;
} else {
videoChoice = Settings.video;
@ -2270,7 +2266,7 @@ int MainMenu(int menu) {
}
reloadblock = off;
}
int ios2;
switch (iosChoice) {
case i249:
@ -2297,8 +2293,8 @@ int MainMenu(int menu) {
Sys_IosReload(249);
}
}
if (!mountMethod)
{
if (!mountMethod)
{
ret = Disc_SetUSB(header->id);
if (ret < 0) Sys_BackToLoader();
}
@ -2313,7 +2309,7 @@ int MainMenu(int menu) {
}
if(dvdheader)
delete dvdheader;
if (reloadblock == on && (IOS_GetVersion() == 222 || IOS_GetVersion() == 223)) {
patch_cios_data();
mload_close();

View File

@ -50,7 +50,7 @@ int DiscBrowse(struct discHdr * header) {
return ret;
}
}
ret = Disc_Open();
if (ret < 0) {
ResumeGui();
@ -71,7 +71,7 @@ int DiscBrowse(struct discHdr * header) {
WindowPrompt(tr("ERROR:"), tr("Could not open WBFS partition"), tr("OK"));
return ret;
}
int *buffer = (int*)allocate_memory(0x20);
if (buffer == NULL) {
@ -86,7 +86,7 @@ int DiscBrowse(struct discHdr * header) {
WindowPrompt(tr("ERROR:"), tr("Could not read the disc."), tr("OK"));
return ret;
}
void *fstbuffer = allocate_memory(buffer[2]*4);
FST_ENTRY *fst = (FST_ENTRY *)fstbuffer;
@ -161,7 +161,7 @@ int DiscBrowse(struct discHdr * header) {
GuiText titleTxt(get_title(header), 28, (GXColor) {0, 0, 0, 255});
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
titleTxt.SetPosition(12,40);
titleTxt.SetMaxWidth(356, SCROLL_HORIZONTAL);
titleTxt.SetMaxWidth(356, GuiText::SCROLL);
GuiImage settingsbackground(&settingsbg);
GuiButton settingsbackgroundbtn(settingsbackground.GetWidth(), settingsbackground.GetHeight());
@ -241,29 +241,29 @@ int autoSelectDol(const char *id, bool force) {
char id4[10];
sprintf(id4,"%c%c%c%c",id[0],id[1],id[2],id[3]);
////// games that can be forced (always need alt dol)
//Boogie
//Boogie
if (strcmp(id,"RBOP69") == 0) return 675;//previous value was 657
if (strcmp(id,"RBOE69") == 0) return 675;//starstremr
//Fifa 08
if (strcmp(id,"RF8E69") == 0) return 439;//from isostar
if (strcmp(id,"RF8P69") == 0) return 463;//from isostar
if (strcmp(id,"RF8X69") == 0) return 464;//from isostar
//Madden NFL07
if (strcmp(id,"RMDP69") == 0) return 39;//from isostar
//Madden NFL08
if (strcmp(id,"RNFP69") == 0) return 1079;//from isostar
//Medal of Honor: Heroes 2
if (strcmp(id,"RM2X69") == 0)return 601;//dj_skual
if (strcmp(id,"RM2P69") == 0)return 517;//MZottel
if (strcmp(id,"RM2E69") == 0) return 492;//Old8oy
if (strcmp(id,"RM2E69") == 0) return 492;//Old8oy
//Mortal Kombat
if (strcmp(id,"RKMP5D") == 0) return 290;//from isostar
if (strcmp(id,"RKME5D") == 0) return 290;//starstremr
@ -273,7 +273,7 @@ int autoSelectDol(const char *id, bool force) {
//Pangya! Golf with Style
if (strcmp(id,"RPYP9B") == 0) return 12490;//from isostar
//Redsteel
if (strcmp(id,"REDP41") == 0) return 1957;//from isostar
if (strcmp(id,"REDE41") == 0) return 1957;//starstremr
@ -281,37 +281,37 @@ int autoSelectDol(const char *id, bool force) {
//SSX
if (strcmp(id,"RSXP69") == 0) return 377;//previous value was 337
if (strcmp(id,"RSXE69") == 0) return 377;//previous value was 337
//Wii Sports Resort, needs alt dol one time only, to show the Motion Plus video
//if (strcmp(id,"RZTP01") == 0 && CheckForSave(id4)==0) return 952;//from isostar
//if (strcmp(id,"RZTE01") == 0 && CheckForSave(id4)==0) return 674;//from starstremr
//as well as Grand Slam Tennis, Tiger Woods 10, Virtual Tennis 2009
///// games that can't be forced (alt dol is not always needed)
if (!force) {
//Grand Slam Tennis
if (strcmp(id,"R5TP69") == 0) return 1493;//from isostar
if (strcmp(id,"R5TE69") == 0) return 1493;//starstremr
//Medal of Honor Heroes
if (strcmp(id,"RMZX69") == 0) return 492;//from isostar
if (strcmp(id,"RMZP69") == 0) return 492;//from isostar
if (strcmp(id,"RMZE69") == 0) return 492;//starstremr
if (strcmp(id,"RMZE69") == 0) return 492;//starstremr
//Tiger Woods 10
if (strcmp(id,"R9OP69") == 0) return 1991;//from isostar
if (strcmp(id,"R9OE69") == 0) return 1973;//starstremr
//Virtual Tennis 2009
if (strcmp(id,"RVUP8P") == 0) return 16426;//from isostar
if (strcmp(id,"RVUE8P") == 0) return 16405;//from isostar
//Wii Sports Resort
if (strcmp(id,"RZTP01") == 0) return 952;//from isostar
if (strcmp(id,"RZTE01") == 0) return 674;//from starstremr
}
return -1;
}
@ -320,7 +320,7 @@ int autoSelectDolMenu(const char *id, bool force) {
/*
char id4[10];
sprintf(id4,"%c%c%c%c",id[0],id[1],id[2],id[3]);
switch (CheckForSave(id4)) {
case 0:
WindowPrompt(tr("NO save"),0,tr("OK"));
@ -336,7 +336,7 @@ int autoSelectDolMenu(const char *id, bool force) {
}
return -1;
*/
//Indiana Jones and the Staff of Kings (Fate of Atlantis)
if (strcmp(id,"RJ8E64") == 0) {
int choice = WindowPrompt(tr("Select a DOL"), 0, "Fate of Atlantis", tr("Default"));
@ -362,7 +362,7 @@ int autoSelectDolMenu(const char *id, bool force) {
}
return choice;
}
//Metal Slug Anthology (Metal Slug 6)
if (strcmp(id,"RMLEH4") == 0) {
int choice = WindowPrompt(tr("Select a DOL"), 0, "Metal Slug 6", tr("Default"));
@ -388,7 +388,7 @@ int autoSelectDolMenu(const char *id, bool force) {
}
return choice;
}
//Metroid Prime Trilogy
if (strcmp(id,"R3ME01") == 0) {
//do not use any alt dol if there is no save game in the nand
@ -439,7 +439,7 @@ int autoSelectDolMenu(const char *id, bool force) {
}
return choice;
}
//Rampage: Total Destruction (M1.dol=Rampage, jarvos.dol=Rampage World Tour)
if (strcmp(id,"RPGP5D") == 0) {
int choice = WindowPrompt(tr("Select a DOL"), 0, "Rampage", "World Tour", tr("Default"));
@ -456,7 +456,7 @@ int autoSelectDolMenu(const char *id, bool force) {
}
return choice;
}
//The House Of The Dead 2 & 3 Return (only to play 2)
if (strcmp(id,"RHDE8P") == 0) {
int choice = WindowPrompt(tr("Select a DOL"), 0, "HotD 2", tr("Default"));
@ -501,7 +501,7 @@ void __dvd_readidcb(s32 result)
u8 DiscMount(discHdr *header) {
int ret;
HaltGui();
u8 *tmpBuff = (u8 *) malloc(0x60);
memcpy(tmpBuff, g_diskID, 0x60); // Make a backup of the first 96 bytes at 0x80000000
@ -509,7 +509,7 @@ u8 DiscMount(discHdr *header) {
dvddone = 0;
ret = bwDVD_LowReset(__dvd_readidcb);
while(ret>=0 && dvddone==0);
dvddone = 0;
ret = bwDVD_LowReadID(g_diskID, __dvd_readidcb); // Leave this one here, or you'll get an IOCTL error
while(ret>=0 && dvddone==0);
@ -517,12 +517,12 @@ u8 DiscMount(discHdr *header) {
dvddone = 0;
ret = bwDVD_LowUnencryptedRead(g_diskID, 0x60, 0x00, __dvd_readidcb); // Overwrite the g_diskID thing
while(ret>=0 && dvddone==0);
memcpy(header, g_diskID, 0x60);
memcpy(g_diskID, tmpBuff, 0x60); // Put the backup back, or games won't load
free(tmpBuff);
ResumeGui();
if (dvddone != 1) {
return 0;

View File

@ -30,7 +30,6 @@ static int showProgress = 0;
static f32 progressDone = 0.0;
static bool showTime = false;
static bool showSize = false;
static bool changed = true;
static s32 gameinstalldone = 0;
static s32 gameinstalltotal = -1;
static time_t start;
@ -53,13 +52,8 @@ static void GameInstallProgress() {
if (gameinstalltotal <= 0)
return;
int oldinstalldone = gameinstalldone;
GetProgressValue(&gameinstalldone, &gameinstalltotal);
if((oldinstalldone == gameinstalldone) && (gameinstalldone > 0))
return;
if (gameinstalldone > gameinstalltotal)
gameinstalldone = gameinstalltotal;
@ -95,7 +89,6 @@ static void GameInstallProgress() {
snprintf(progressSizeLeft, sizeof(progressSizeLeft), "%.2fGB/%.2fGB", gamesize * gameinstalldone/gameinstalltotal, gamesize);
snprintf(progressSpeed, sizeof(progressSpeed), "%.1fMB/s", speed);
changed = true;
}
/****************************************************************************
@ -172,12 +165,12 @@ static void ProgressWindow(const char *title, const char *msg1, const char *msg2
msg1Txt.SetPosition(0,120);
else
msg1Txt.SetPosition(0,100);
msg1Txt.SetMaxWidth(430, DOTTED);
msg1Txt.SetMaxWidth(430, GuiText::DOTTED);
GuiText msg2Txt(msg2, 22, THEME.prompttext );
msg2Txt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
msg2Txt.SetPosition(0,125);
msg2Txt.SetMaxWidth(430, DOTTED);
msg2Txt.SetMaxWidth(430, GuiText::DOTTED);
GuiText prsTxt("%", 22, THEME.prompttext);
prsTxt.SetAlignment(ALIGN_RIGHT, ALIGN_MIDDLE);
@ -205,8 +198,8 @@ static void ProgressWindow(const char *title, const char *msg1, const char *msg2
progressbarEmptyImg.SetPosition(80,40);
progressbarEmptyImg.SetTile(78);
progressbarImg.SetPosition(80, 40);
msg1Txt.SetMaxWidth(380, DOTTED);
msg2Txt.SetMaxWidth(380, DOTTED);
msg1Txt.SetMaxWidth(380, GuiText::DOTTED);
msg2Txt.SetMaxWidth(380, GuiText::DOTTED);
timeTxt.SetPosition(250,-50);
timeTxt.SetFontSize(20);
@ -253,33 +246,28 @@ static void ProgressWindow(const char *title, const char *msg1, const char *msg2
while (showProgress) {
VIDEO_WaitVSync ();
usleep(20000);
GameInstallProgress();
tmp = static_cast<int>(progressbarImg.GetWidth()*progressDone);
if(changed)
{
changed = false;
if (CFG.widescreen && Settings.wsprompt == yes)
progressbarImg.SetSkew(0,0,static_cast<int>(progressbarImg.GetWidth()*progressDone*0.8)-progressbarImg.GetWidth(),0,static_cast<int>(progressbarImg.GetWidth()*progressDone*0.8)-progressbarImg.GetWidth(),0,0,0);
else
progressbarImg.SetSkew(0,0,static_cast<int>(progressbarImg.GetWidth()*progressDone)-progressbarImg.GetWidth(),0,static_cast<int>(progressbarImg.GetWidth()*progressDone)-progressbarImg.GetWidth(),0,0,0);
tmp = static_cast<int>(progressbarImg.GetWidth()*progressDone);
prTxt.SetTextf("%.2f", progressDone);
if (CFG.widescreen && Settings.wsprompt == yes)
progressbarImg.SetSkew(0,0,static_cast<int>(progressbarImg.GetWidth()*progressDone*0.8)-progressbarImg.GetWidth(),0,static_cast<int>(progressbarImg.GetWidth()*progressDone*0.8)-progressbarImg.GetWidth(),0,0,0);
else
progressbarImg.SetSkew(0,0,static_cast<int>(progressbarImg.GetWidth()*progressDone)-progressbarImg.GetWidth(),0,static_cast<int>(progressbarImg.GetWidth()*progressDone)-progressbarImg.GetWidth(),0,0,0);
prTxt.SetTextf("%.2f", progressDone);
if (showSize) {
sizeTxt.SetText(progressSizeLeft);
speedTxt.SetText(progressSpeed);
}
if (showTime)
timeTxt.SetText(progressTime);
if (msg2)
msg2Txt.SetText(dyn_message);
if (showSize) {
sizeTxt.SetText(progressSizeLeft);
speedTxt.SetText(progressSpeed);
}
if (showTime)
timeTxt.SetText(progressTime);
if (msg2)
msg2Txt.SetText(dyn_message);
}
promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
@ -386,7 +374,6 @@ void ShowProgress(const char *title, const char *msg1, char *dynmsg2, f32 done,
showProgress = 1;
progressDone = 100.0*done/total;
changed = true;
LWP_ResumeThread(progressthread);
}
@ -397,7 +384,7 @@ void ShowProgress(const char *title, const char *msg1, char *dynmsg2, f32 done,
* Startup Progressthread in idle prio
***************************************************************************/
void InitProgressThread() {
LWP_CreateThread(&progressthread, ProgressThread, NULL, NULL, 0, 80);
LWP_CreateThread(&progressthread, ProgressThread, NULL, NULL, 0, 0);
}
/****************************************************************************

View File

@ -216,7 +216,7 @@ void WindowCredits() {
i++;
y+=28;
txt[i]->SetPresets(22, (GXColor) {255, 255, 255, 255}, WRAP, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP, ALIGN_LEFT, ALIGN_TOP);
GuiText::SetPresets(22, (GXColor) {255, 255, 255, 255}, 0, GuiText::WRAP,FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP, ALIGN_LEFT, ALIGN_TOP);
txt[i] = new GuiText(tr("Coding:"));
txt[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
@ -916,7 +916,7 @@ WindowExitPrompt(const char *title, const char *msg, const char *btn1Label,
StopGX();
WII_Initialize();
WII_BootHBC();
}
choice = 2;
}
@ -1002,7 +1002,7 @@ void SetFavoriteImages(GuiImage *b1, GuiImage *b2, GuiImage *b3, GuiImage *b4, G
b3->SetImage(favoritevar >= 3 ? on : off);
b4->SetImage(favoritevar >= 4 ? on : off);
b5->SetImage(favoritevar >= 5 ? on : off);
}
}
/****************************************************************************
* GameWindowPrompt
@ -1063,7 +1063,7 @@ int GameWindowPrompt() {
GuiText nameTxt("", 22, THEME.prompttext);
if (Settings.wsprompt == yes)
nameTxt.SetWidescreen(CFG.widescreen);
nameTxt.SetMaxWidth(350, SCROLL_HORIZONTAL);
nameTxt.SetMaxWidth(350, GuiText::SCROLL);
GuiButton nameBtn(120,50);
nameBtn.SetLabel(&nameTxt);
// nameBtn.SetLabelOver(&nameTxt);
@ -1227,8 +1227,8 @@ int GameWindowPrompt() {
if (diskCover)
delete diskCover;
snprintf(imgPath,sizeof(imgPath),"%s%s.png", Settings.disc_path, IDFull); //changed to current full id
diskCover = new GuiImageData(imgPath,0);
@ -1299,13 +1299,13 @@ int GameWindowPrompt() {
nameTxt.SetEffect(EFFECT_FADE, 17);
} else
diskImg.SetImage(diskCover);
if (!mountMethod)
{
WBFS_GameSize(header->id, &size);
sizeTxt.SetTextf("%.2fGB", size); //set size text;
}
nameTxt.SetText(get_title(header));
struct Game_NUM* game_num = CFG_get_game_num(header->id);
@ -1721,7 +1721,7 @@ FormatingPartition(const char *title, partitionEntry *entry) {
* SearchMissingImages
***************************************************************************/
bool SearchMissingImages(int choice2) {
GuiWindow promptWindow(472,320);
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
promptWindow.SetPosition(0, -10);
@ -1762,14 +1762,14 @@ bool SearchMissingImages(int choice2) {
mainWindow->Append(&promptWindow);
mainWindow->ChangeFocus(&promptWindow);
ResumeGui();
//make sure that all games are added to the gamelist
__Menu_GetEntries(1);
cntMissFiles = 0;
u32 i = 0;
char filename[11];
//add IDs of games that are missing covers to cntMissFiles
bool found1 = false;
bool found2 = false;
@ -1777,7 +1777,7 @@ bool SearchMissingImages(int choice2) {
for (i = 0; i < gameCnt && cntMissFiles < 500; i++) {
struct discHdr* header = &gameList[i];
if (choice2 != 3) {
char *covers_path = choice2==1 ? Settings.covers2d_path : Settings.covers_path;
snprintf (filename,sizeof(filename),"%c%c%c.png", header->id[0], header->id[1], header->id[2]);
@ -1809,7 +1809,7 @@ bool SearchMissingImages(int choice2) {
msgTxt.SetText(tr("No file missing!"));
sleep(1);
}
promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
while (promptWindow.GetEffect() > 0) usleep(50);
@ -1818,8 +1818,8 @@ bool SearchMissingImages(int choice2) {
mainWindow->SetState(STATE_DEFAULT);
__Menu_GetEntries();
ResumeGui();
if (cntMissFiles > 0) {
if (cntMissFiles > 0) { //&& !IsNetworkInit()) {
NetworkInitPrompt();
}
@ -2327,7 +2327,7 @@ ProgressDownloadWindow(int choice2) {
}
/**Temporary redownloading 1st image because of a fucking corruption bug **/
#if 0 // is no longer necessary, since libfat is fixed
#if 0 // is no longer necessary, since libfat is fixed
char URLFile[100];
struct block file = downloadfile(URLFile);
if (choice2 == 2) {
@ -2894,7 +2894,7 @@ int ProgressUpdateWindow() {
titleTxt.SetTextf("%s USB Loader GX", tr("Updating"));
msgTxt.SetPosition(0,100);
msgTxt.SetTextf("%s", tr("Updating WiiTDB.zip"));
char wiitdbpath[200];
char wiitdbpathtmp[200];
struct block file = downloadfile(XMLurl);
@ -2915,7 +2915,7 @@ int ProgressUpdateWindow() {
OpenXMLDatabase(Settings.titlestxt_path, Settings.db_language, Settings.db_JPtoEN, true, Settings.titlesOverride==1?true:false, true); // open file, reload titles, keep in memory
}
}
msgTxt.SetTextf("%s", tr("Updating Language Files:"));
updateLanguageFiles();
promptWindow.Append(&progressbarEmptyImg);
@ -3296,7 +3296,7 @@ HBCWindowPrompt(const char *name, const char *coder, const char *version,
GuiText nameTxt(name,30 , THEME.prompttext);
nameTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
nameTxt.SetPosition(0,-15);
nameTxt.SetMaxWidth(430, SCROLL_HORIZONTAL);
nameTxt.SetMaxWidth(430, GuiText::SCROLL);
if (strcmp(coder,""))
@ -3321,16 +3321,11 @@ HBCWindowPrompt(const char *name, const char *coder, const char *version,
release_dateTxt.SetMaxWidth(430);
int pagesize = 6;
int currentLine = 0;
GuiText long_descriptionTxt(long_description, 20, THEME.prompttext);
long_descriptionTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
long_descriptionTxt.SetPosition(46,117);
long_descriptionTxt.SetMaxWidth(360, LONGTEXT);
long_descriptionTxt.SetLinesToDraw(pagesize);
long_descriptionTxt.SetFirstLine(currentLine);
int TotalLines = long_descriptionTxt.GetTotalLines();
long_descriptionTxt.SetMaxWidth(360);
long_descriptionTxt.SetNumLines(pagesize);
//convert filesize from u64 to char and put unit of measurement after it
char temp2[7];
@ -3422,24 +3417,18 @@ HBCWindowPrompt(const char *name, const char *coder, const char *version,
} else if (btn2.GetState() == STATE_CLICKED) {
choice = 0;
} else if ((arrowUpBtn.GetState()==STATE_CLICKED||arrowUpBtn.GetState()==STATE_HELD) ) {
currentLine--;
if(currentLine+pagesize > TotalLines)
currentLine = TotalLines-pagesize;
if(currentLine < 0)
currentLine = 0;
long_descriptionTxt.SetFirstLine(currentLine);
if (long_descriptionTxt.GetFirstLine()>1)
long_descriptionTxt.SetFirstLine(long_descriptionTxt.GetFirstLine()-1);
usleep(60000);
if (!((ButtonsHold() & WPAD_BUTTON_UP)||(ButtonsHold() & PAD_BUTTON_UP)))
arrowUpBtn.ResetState();
} else if (arrowDownBtn.GetState()==STATE_CLICKED||arrowDownBtn.GetState()==STATE_HELD) {
currentLine++;
if(currentLine+pagesize > TotalLines)
currentLine = TotalLines-pagesize;
if(currentLine < 0)
currentLine = 0;
} else if ((arrowDownBtn.GetState()==STATE_CLICKED||arrowDownBtn.GetState()==STATE_HELD)
&&long_descriptionTxt.GetTotalLines()>pagesize
&&long_descriptionTxt.GetFirstLine()-1<long_descriptionTxt.GetTotalLines()-pagesize) {
int l=0;
l=long_descriptionTxt.GetFirstLine()+1;
long_descriptionTxt.SetFirstLine(currentLine);
long_descriptionTxt.SetFirstLine(l);
usleep(60000);
if (!((ButtonsHold() & WPAD_BUTTON_DOWN)||(ButtonsHold() & PAD_BUTTON_DOWN)))
arrowDownBtn.ResetState();

View File

@ -121,7 +121,7 @@ int TitleBrowser(u32 type) {
char line[200];
char tmp[50];
snprintf(tmp,50," ");
//check if the content.bin is on the SD card for that game
//if there is content.bin,then the game is on the SDmenu and not the wii
sprintf(line,"SD:/private/wii/title/%s/content.bin",text);
@ -250,7 +250,7 @@ int TitleBrowser(u32 type) {
GuiText titleTxt(tr("Title Launcher"), 28, (GXColor) {0, 0, 0, 255});
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
titleTxt.SetPosition(12,40);
titleTxt.SetMaxWidth(356, SCROLL_HORIZONTAL);
titleTxt.SetMaxWidth(356, GuiText::SCROLL);
GuiImage settingsbackground(&settingsbg);
GuiButton settingsbackgroundbtn(settingsbackground.GetWidth(), settingsbackground.GetHeight());
@ -406,7 +406,7 @@ int TitleBrowser(u32 type) {
char temp[50];
char filepath[100];
u32 read = 0;
//make sure there is a folder for this to be saved in
struct stat st;
snprintf(filepath, sizeof(filepath), "%s/wad/", bootDevice);
@ -416,7 +416,7 @@ int TitleBrowser(u32 type) {
}
}
snprintf(filepath, sizeof(filepath), "%s/wad/tmp.tmp", bootDevice);
if (infilesize < MBSIZE)
snprintf(filesizetxt, sizeof(filesizetxt), tr("Incoming file %0.2fKB"), infilesize/KBSIZE);
@ -493,17 +493,17 @@ int TitleBrowser(u32 type) {
int pick = WindowPrompt(tr(" Wad Saved as:"), tmptxt, tr("Install"),tr("Uninstall"),tr("Cancel"));
//install or uninstall it
if (pick==1)
{
{
HaltGui();
w.Remove(&titleTxt);
w.Remove(&cancelBtn);
w.Remove(&wifiBtn);
w.Remove(&optionBrowser3);
ResumeGui();
ResumeGui();
Wad_Install(file);
HaltGui();
w.Append(&titleTxt);
w.Append(&cancelBtn);

View File

@ -77,7 +77,7 @@ int InitBrowsers() {
char rootdir[ROOTDIRLEN];
for(int i=3; i<STD_MAX; i++)
{
if(strcmp(devoptab_list[i]->name, "stdnull"))
if(strcmp(devoptab_list[i]->name, "stdnull"))
{
snprintf(rootdir, sizeof(rootdir) , "%s:/", devoptab_list[i]->name);
if(DIR_ITER *dir = diropen(rootdir))
@ -195,7 +195,7 @@ int ParseDirectory(const char* Path, int Flags, FILTERCASCADE *Filter) {
return -1;
}
if(getcwd(fulldir, sizeof(fulldir))) return -1; // gets the concatenated current working dir
chdir(filename); // restore the saved cwd
chdir(filename); // restore the saved cwd
}
}
for(i=0; i<browsers.size(); i++) // searchs the browser who match the path
@ -206,15 +206,15 @@ int ParseDirectory(const char* Path, int Flags, FILTERCASCADE *Filter) {
break;
}
}
if(i != browsers.size()) // found browser
if(i != browsers.size()) // found browser
{
curDevice = i;
browser = &browsers[curDevice];
strcpy(browser->dir, &fulldir[strlen(browser->rootdir)]);
}
else if(Flags & FB_TRYSTDDEV)
{
curDevice = 0;
{
curDevice = 0;
browser = &browsers[curDevice]; // when no browser was found and
browser->dir[0] = 0; // we alowed try StdDevice and try RootDir
strlcpy(fulldir, browser->rootdir, sizeof(fulldir)); // set the first browser with root-dir
@ -315,7 +315,7 @@ int BrowseDevice(char * Path, int Path_size, int Flags, FILTERCASCADE *Filter/*=
folderBtn.SetImage(&folderImg);
folderBtn.SetTrigger(&trigA);
folderBtn.SetEffectGrow();
char imgPath[100];
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path);
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
@ -366,7 +366,7 @@ int BrowseDevice(char * Path, int Path_size, int Flags, FILTERCASCADE *Filter/*=
AdressText.SetTextf("%s%s", browser->rootdir, browser->dir);
AdressText.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
AdressText.SetPosition(20, 0);
AdressText.SetMaxWidth(Address.GetWidth()-40, SCROLL_HORIZONTAL);
AdressText.SetMaxWidth(Address.GetWidth()-40, GuiText::SCROLL);
GuiImage AdressbarImg(&Address);
GuiButton Adressbar(Address.GetWidth(), Address.GetHeight());
Adressbar.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
@ -422,11 +422,11 @@ int BrowseDevice(char * Path, int Path_size, int Flags, FILTERCASCADE *Filter/*=
else if (strcmp(browser->browserList[clickedIndex].filename,"."))
{
/* test new directory namelength */
if ((strlen(browser->dir) + strlen(browser->browserList[clickedIndex].filename)
if ((strlen(browser->dir) + strlen(browser->browserList[clickedIndex].filename)
+ 1/*'/'*/) < MAXPATHLEN)
{
/* update current directory name */
sprintf(browser->dir, "%s%s/",browser->dir,
sprintf(browser->dir, "%s%s/",browser->dir,
browser->browserList[clickedIndex].filename);
pathCanged = true;
}
@ -484,7 +484,7 @@ int BrowseDevice(char * Path, int Path_size, int Flags, FILTERCASCADE *Filter/*=
char oldfolder[100];
snprintf(newfolder, sizeof(newfolder), "%s%s", browser->rootdir, browser->dir);
strcpy(oldfolder,newfolder);
int result = OnScreenKeyboard(newfolder, sizeof(newfolder), strlen(browser->rootdir));
if ( result == 1 ) {
unsigned int len = strlen(newfolder);

View File

@ -596,7 +596,7 @@ int showGameInfo(char *ID) {
if (strcmp(gameinfo.title,"") != 0) {
snprintf(linebuf, sizeof(linebuf), "%s",gameinfo.title);
titleTxt = new GuiText(linebuf, titlefontsize, (GXColor) {0,0,0, 255});
titleTxt->SetMaxWidth(350, SCROLL_HORIZONTAL);
titleTxt->SetMaxWidth(350, GuiText::SCROLL);
//while (titleTxt->GetWidth()>250) { titleTxt->SetFontSize(titlefontsize-=2); }
titleTxt->SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
titleTxt->SetPosition(txtXOffset,12+titley);
@ -664,7 +664,7 @@ int showGameInfo(char *ID) {
snprintf(linebuf, sizeof(linebuf), "%s %s", tr("Published by"), gameinfo.publisher);
publisherTxt = new GuiText(linebuf, 16, (GXColor) {0,0,0, 255});
if (publisherTxt->GetWidth()>250) newline=2;
publisherTxt->SetMaxWidth(250, WRAP);
publisherTxt->SetMaxWidth(250,GuiText::WRAP);
publisherTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
publisherTxt->SetPosition(-17,12+indexy);
indexy+=(20 * newline);
@ -677,7 +677,7 @@ int showGameInfo(char *ID) {
snprintf(linebuf, sizeof(linebuf), "%s %s", tr("Developed by"), gameinfo.developer);
developerTxt = new GuiText(linebuf, 16, (GXColor) {0,0,0, 255});
if (developerTxt->GetWidth()>250) newline=2;
developerTxt->SetMaxWidth(250, WRAP);
developerTxt->SetMaxWidth(250,GuiText::WRAP);
developerTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
developerTxt->SetPosition(-17,12+indexy);
indexy+=(20 * newline);
@ -721,17 +721,14 @@ int showGameInfo(char *ID) {
//synopsis
int pagesize=12;
int currentLine = 0;
int TotalLines = 0;
if (strcmp(gameinfo.synopsis,"") != 0) {
snprintf(linebuf, sizeof(linebuf), "%s", gameinfo.synopsis);
synopsisTxt = new GuiText(linebuf, 16, (GXColor) {0,0,0, 255});
synopsisTxt->SetMaxWidth(350, LONGTEXT);
synopsisTxt->SetMaxWidth(350,GuiText::WRAP);
synopsisTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
synopsisTxt->SetPosition(0,0);
synopsisTxt->SetLinesToDraw(pagesize);
synopsisTxt->SetFirstLine(0);
TotalLines = synopsisTxt->GetTotalLines();
synopsisTxt->SetNumLines(pagesize);
//synopsisTxt->SetFirstLine(12);
dialogBoxImg11 = new GuiImage(&dialogBox1);
dialogBoxImg11->SetAlignment(0,3);
@ -852,24 +849,23 @@ int showGameInfo(char *ID) {
}
} else if ((upBtn.GetState()==STATE_CLICKED||upBtn.GetState()==STATE_HELD) && page==2) {
currentLine--;
if(currentLine+pagesize > TotalLines)
currentLine = TotalLines-pagesize;
if(currentLine < 0)
currentLine = 0;
synopsisTxt->SetFirstLine(currentLine);
usleep(60000);
//int l=synopsisTxt->GetFirstLine()-1;
if (synopsisTxt->GetFirstLine()>1)
synopsisTxt->SetFirstLine(synopsisTxt->GetFirstLine()-1);
usleep(60000);
if (!((ButtonsHold() & WPAD_BUTTON_UP)||(ButtonsHold() & PAD_BUTTON_UP)))
upBtn.ResetState();
} else if ((dnBtn.GetState()==STATE_CLICKED||dnBtn.GetState()==STATE_HELD) && page==2) {
currentLine++;
if(currentLine+pagesize > TotalLines)
currentLine = TotalLines-pagesize;
if(currentLine < 0)
currentLine = 0;
} else if ((dnBtn.GetState()==STATE_CLICKED||dnBtn.GetState()==STATE_HELD) && page==2
&&synopsisTxt->GetTotalLines()>pagesize
&&synopsisTxt->GetFirstLine()-1<synopsisTxt->GetTotalLines()-pagesize) {
int l=0;
//if(synopsisTxt->GetTotalLines()>pagesize)
l=synopsisTxt->GetFirstLine()+1;
synopsisTxt->SetFirstLine(currentLine);
//if (l>(synopsisTxt->GetTotalLines()+1)-pagesize)
//l=(synopsisTxt->GetTotalLines()+1)-pagesize;
synopsisTxt->SetFirstLine(l);
usleep(60000);
if (!((ButtonsHold() & WPAD_BUTTON_DOWN)||(ButtonsHold() & PAD_BUTTON_DOWN)))
dnBtn.ResetState();

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,6 @@
#include "main.h"
#include <wctype.h>
#include "getentries.h"
#include "FreeTypeGX.h"
#include "../prompts/TitleBrowser.h"
@ -175,7 +174,7 @@ int __Menu_GetPrevFilter(int t, wchar_t* gameFilter, u32 gameFiltered, wchar_t *
if(get_block(header) >= Settings.parentalcontrol)
continue;
wchar_t *wname = charToWideChar(get_title(header));
wchar_t *wname = FreeTypeGX::charToWideChar(get_title(header));
if(wname) nameList.push_back(wname);
}
@ -221,7 +220,7 @@ int __Menu_GetGameFilter_NextList(discHdr *gameList, u32 gameCnt, wchar_t **Pgam
for(i=0; i<gameCnt; i++)
{
u32 nextFilterChar = 0x10000;
wchar_t *gameName = charToWideChar(get_title(&gameList[i]));
wchar_t *gameName = FreeTypeGX::charToWideChar(get_title(&gameList[i]));
if(gameName == NULL) goto error;
if(wcslen(gameName) > filter_len)
@ -392,7 +391,7 @@ int buildTitleList(int t, wchar_t* gameFilter, discHdr ** PgameList, u32 *PgameC
if(gameFilter && *gameFilter) {
u32 filter_len = wcslen(gameFilter);
wchar_t *gameName = charToWideChar(get_title(header));
wchar_t *gameName = FreeTypeGX::charToWideChar(get_title(header));
if (!gameName || wcsnicmp(gameName, gameFilter, filter_len)) {
delete [] gameName;
continue;
@ -487,7 +486,7 @@ int __Menu_GetGameList(int t, wchar_t* gameFilter, discHdr ** PgameList, u32 *Pg
if(gameFilter && *gameFilter && t==0) {
u32 filter_len = wcslen(gameFilter);
wchar_t *gameName = charToWideChar(get_title(header));
wchar_t *gameName = FreeTypeGX::charToWideChar(get_title(header));
if (!gameName || wcsnicmp(gameName, gameFilter, filter_len)) {
delete [] gameName;
continue;

View File

@ -218,12 +218,12 @@ void StopGX() {
* Renders everything current sent to GX, and flushes video
***************************************************************************/
void Menu_Render() {
GX_DrawDone ();
whichfb ^= 1; // flip framebuffer
GX_SetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE);
GX_SetColorUpdate(GX_TRUE);
GX_CopyDisp(xfb[whichfb],GX_TRUE);
GX_DrawDone ();
VIDEO_SetNextFramebuffer(xfb[whichfb]);
VIDEO_Flush();
VIDEO_WaitVSync();

View File

@ -141,11 +141,9 @@ s32 Wad_Install(FILE *fp)
GuiText btn1Txt(tr("OK"), 22, THEME.prompttext);
GuiImage btn1Img(&btnOutline);
if (Settings.wsprompt == yes)
{
btn1Txt.SetWidescreen(CFG.widescreen);
btn1Img.SetWidescreen(CFG.widescreen);
}
if (Settings.wsprompt == yes){
btn1Txt.SetWidescreen(CFG.widescreen);
btn1Img.SetWidescreen(CFG.widescreen);}
GuiButton btn1(&btn1Img,&btn1Img, 2, 4, 0, -35, &trigA, &btnSoundOver, &btnClick,1);
btn1.SetLabel(&btn1Txt);
btn1.SetState(STATE_SELECTED);
@ -371,7 +369,7 @@ s32 Wad_Install(FILE *fp)
// Increase variables
idx += size;
offset += size;
//snprintf(imgPath, sizeof(imgPath), "%s%d (%d)...",tr(">> Installing content #"),content->cid,idx);
//msg4Txt.SetText(imgPath);
@ -472,11 +470,9 @@ s32 Wad_Uninstall(FILE *fp)
GuiText btn1Txt(tr("OK"), 22, THEME.prompttext);
GuiImage btn1Img(&btnOutline);
if (Settings.wsprompt == yes)
{
btn1Txt.SetWidescreen(CFG.widescreen);
btn1Img.SetWidescreen(CFG.widescreen);
}
if (Settings.wsprompt == yes){
btn1Txt.SetWidescreen(CFG.widescreen);
btn1Img.SetWidescreen(CFG.widescreen);}
GuiButton btn1(&btn1Img,&btn1Img, 2, 4, 0, -55, &trigA, &btnSoundOver, &btnClick,1);
btn1.SetLabel(&btn1Txt);
btn1.SetState(STATE_SELECTED);