Optimization Changes Part 1:

*Lots of changes in the TextDrawing stuff and FreeTypeGX to speed up the drawing
*Mostly optimization work which is not completely done yet, but mainly it is.
*You might not want to update to this revision right away there still might be bugs which are needed to be fixed. This is a version for everyone to test and report bugs caused by the changes.
*Vanishing WiiMotePointer should be fixed for the Settings/GameSettings probably (though it might still occur i am not sure if i didn't forget anything, there is just too much to change :P.
This commit is contained in:
dimok321 2009-10-17 20:48:52 +00:00
parent 1411b42132
commit 3c6bf6523b
25 changed files with 2304 additions and 2060 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -156,37 +156,68 @@
#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>
/*! forward deklaration of private structures
#define MAX_FONT_SIZE 100
/*! \struct ftgxCharData_
*
* 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 0x0003
#define FTGX_JUSTIFY_MASK 0x000f
#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_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_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_STYLE_UNDERLINE 0x0100
#define FTGX_STYLE_STRIKE 0x0200
#define FTGX_STYLE_MASK 0x0f00
#define FTGX_STYLE_UNDERLINE 0x1000
#define FTGX_STYLE_STRIKE 0x2000
#define FTGX_STYLE_MASK 0xf000
#define FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_MODULATE 0X0001
#define FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_DECAL 0X0002
@ -203,10 +234,11 @@ 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. */
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();
/*! \class FreeTypeGX
* \brief Wrapper class for the libFreeType library with GX rendering.
@ -219,59 +251,56 @@ const GXColor ftgxWhite = (GXColor) {
*/
class FreeTypeGX {
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. */
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. */
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();
void clearGlyphData();
ftgxCharData *cacheGlyphData(wchar_t charCode);
uint16_t cacheGlyphDataComplete();
void loadGlyphData(FT_Bitmap *bmp, ftgxCharData *charData);
void unloadFont();
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(uint8_t textureFormat = GX_TF_RGBA8, uint8_t vertexIndex = GX_VTXFMT1);
~FreeTypeGX();
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();
static wchar_t* charToWideChar(char* p);
static wchar_t* charToWideChar(const char* p);
void setVertexFormat(uint8_t vertexIndex);
void setCompatibilityMode(uint32_t compatibilityMode);
void InitFreeType(uint8_t* fontBuffer, FT_Long bufferSize, bool loadcustomfont);
void ChangeFontSize(FT_UInt pixelSize);
uint8_t GetMaxCharWidth();
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);
void setVertexFormat(uint8_t vertexIndex);
void setCompatibilityMode(uint32_t compatibilityMode);
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);
ftgxDataOffset* getOffset(wchar_t *text, ftgxDataOffset* offset);
ftgxDataOffset* 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);
void getOffset(wchar_t *text, ftgxDataOffset* offset);
void 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, GuiText::SCROLL);
titleTxt.SetMaxWidth(350, SCROLL_HORIZONTAL);
titleTxt.SetPosition(12,40);
for (int i = 0; i <= cntcheats; i++) {

View File

@ -150,7 +150,7 @@ int MenuHomebrewBrowse() {
backBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
GuiImage backBtnImg(&btnOutline);
if (Settings.wsprompt == yes) {
backBtnTxt.SetWidescreen(CFG.widescreen);
//backBtnTxt.SetWidescreen(CFG.widescreen);
backBtnImg.SetWidescreen(CFG.widescreen);
}
GuiButton backBtn(&backBtnImg,&backBtnImg, 2, 3, -180, 400, &trigA, &btnSoundOver, &btnClick,1);
@ -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, GuiText::DOTTED);
MainButton1Txt.SetMaxWidth(MainButton1Img.GetWidth()-150, 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, GuiText::DOTTED);
MainButton1DescTxt.SetMaxWidth(MainButton1Img.GetWidth()-150, 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, GuiText::SCROLL);
MainButton1DescOverTxt.SetMaxWidth(MainButton1Img.GetWidth()-150, SCROLL_HORIZONTAL);
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, GuiText::DOTTED);
MainButton2Txt.SetMaxWidth(MainButton2Img.GetWidth()-150, 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, GuiText::DOTTED);
MainButton2DescTxt.SetMaxWidth(MainButton2Img.GetWidth()-150, 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, GuiText::SCROLL);
MainButton2DescOverTxt.SetMaxWidth(MainButton2Img.GetWidth()-150, SCROLL_HORIZONTAL);
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, GuiText::DOTTED);
MainButton3Txt.SetMaxWidth(MainButton3Img.GetWidth()-150, 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, GuiText::DOTTED);
MainButton3DescTxt.SetMaxWidth(MainButton3Img.GetWidth()-150, 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, GuiText::SCROLL);
MainButton3DescOverTxt.SetMaxWidth(MainButton3Img.GetWidth()-150, SCROLL_HORIZONTAL);
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, GuiText::DOTTED);
MainButton4Txt.SetMaxWidth(MainButton4Img.GetWidth()-150, 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, GuiText::DOTTED);
MainButton4DescTxt.SetMaxWidth(MainButton4Img.GetWidth()-150, 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, GuiText::SCROLL);
MainButton4DescOverTxt.SetMaxWidth(MainButton4Img.GetWidth()-150, SCROLL_HORIZONTAL );
GuiButton MainButton4(MainButton4Img.GetWidth(), MainButton4Img.GetHeight());
MainButton4.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
MainButton4.SetPosition(0, 300);

View File

@ -47,13 +47,14 @@
#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);
@ -90,6 +91,15 @@ enum
IMAGE_COPY
};
enum
{
WRAP,
LONGTEXT,
DOTTED,
SCROLL_HORIZONTAL,
SCROLL_NONE
};
enum
{
TRIGGER_SIMPLE,
@ -699,8 +709,8 @@ class GuiText : public GuiElement
//!Sets the text of the GuiText element
//!\param t Text
void SetText(const char * t);
void SetTextf(const char *format, ...) __attribute__((format(printf,2,3)));
void SetText(const wchar_t * t);
void SetTextf(const char *format, ...) __attribute__((format(printf,2,3)));
//!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
@ -710,28 +720,30 @@ class GuiText : public GuiElement
//!\param s Font style
//!\param h Text alignment (horizontal)
//!\param v Text alignment (vertical)
static void SetPresets(int sz, GXColor c, int w, int wrap, u16 s, int h, int v);
void SetPresets(int sz, GXColor c, int w, 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
enum {
WRAP,
DOTTED,
SCROLL,
MARQUEE
};
void SetMaxWidth(int w, short m=GuiText::WRAP);
void SetMaxWidth(int w = 0, int m = 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, u16 m=0xffff);
void SetStyle(u16 s);
//!Sets the text alignment
//!\param hor Horizontal alignment (ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTRE)
//!\param vert Vertical alignment (ALIGN_TOP, ALIGN_BOTTOM, ALIGN_MIDDLE)
@ -741,33 +753,35 @@ class GuiText : public GuiElement
void SetFont(FreeTypeGX *f);
//!Get the Horizontal Size of Text
int GetTextWidth();
// 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();
//!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);
//!Constantly called to draw the text
void Draw();
protected:
wchar_t* text; //!< Unicode text value
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
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;
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
bool widescreen; //added
int firstLine;
int linestodraw;
int totalLines;
int textWidth;
int currentSize;
u32 *LineBreak;
};
//!Display, manage, and manipulate tooltips in the GUI.
@ -980,6 +994,7 @@ 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), GuiText::DOTTED);
optionTxt[i]->SetMaxWidth(bgOptionsImg->GetWidth() - (coL2+24), 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), GuiText::DOTTED);
optionVal[i]->SetMaxWidth(bgOptionsImg->GetWidth() - (coL2+24), DOTTED);
optionValOver[i]->SetPosition(coL2,0);
optionValOver[i]->SetMaxWidth(bgOptionsImg->GetWidth() - (coL2+24), GuiText::SCROLL);
optionValOver[i]->SetMaxWidth(bgOptionsImg->GetWidth() - (coL2+24), SCROLL_HORIZONTAL);
}
}
}

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), GuiText::DOTTED);
fileListText[i]->SetMaxWidth(bgFileSelectionImg->GetWidth() - (arrowDownImg->GetWidth()+20), 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), GuiText::SCROLL);
fileListTextOver[i]->SetMaxWidth(bgFileSelectionImg->GetWidth() - (arrowDownImg->GetWidth()+20), SCROLL_HORIZONTAL);
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, GuiText::DOTTED);
gameTxt[i]->SetMaxWidth(maxTextWidth, 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, GuiText::SCROLL);
gameTxtOver[i]->SetMaxWidth(maxTextWidth, SCROLL_HORIZONTAL);
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, GuiText::DOTTED);
gamename->SetMaxWidth(280, 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), GuiText::SCROLL);
//text.SetWidescreen(CFG.widescreen);
text.SetMaxWidth(width-(10+2*42+10), SCROLL_HORIZONTAL);
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,18 +41,10 @@
#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});
@ -72,7 +64,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) {
@ -111,12 +103,6 @@ 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;
}
}
@ -125,6 +111,9 @@ 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;
@ -139,14 +128,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) {
@ -160,7 +149,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) {
@ -241,18 +230,11 @@ 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);
fontSystem->loadFont(fontPath, font_ttf, font_ttf_size, 0);
fontSystem->setCompatibilityMode(FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_PASSCLR | FTGX_COMPATIBILITY_DEFAULT_VTXDESC_GX_NONE);
LoadCustomFont(fontPath);
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,11 +8,8 @@
#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())
@ -336,7 +336,7 @@ int MenuDiscList() {
if (!dvdheader)
dvdheader = new struct discHdr;
u8 mountMethodOLD =0;
WDVD_GetCoverStatus(&covert);
u32 covertOld=covert;
@ -468,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)
@ -744,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);
@ -783,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(fontClock);
clockTimeBack.SetFont(clock_ttf, clock_ttf_size);
GuiText clockTime(theTime, 40, THEME.clock);
clockTime.SetAlignment(THEME.clock_align, ALIGN_TOP);
clockTime.SetPosition(THEME.clock_x, THEME.clock_y);
clockTime.SetFont(fontClock);
clockTime.SetFont(clock_ttf, clock_ttf_size);
HaltGui();
GuiWindow w(screenwidth, screenheight);
@ -807,7 +807,7 @@ int MenuDiscList() {
w.Append(&settingsBtn);
w.Append(&DownloadBtn);
w.Append(&idBtn);
// Begin Toolbar
w.Append(&favoriteBtn);
Toolbar[0] = &favoriteBtn;
@ -827,9 +827,9 @@ int MenuDiscList() {
Toolbar[7] = &dvdBtn;
w.SetUpdateCallback(DiscListWinUpdateCallback);
// End Toolbar
if (Settings.godmode == 1)
w.Append(&homebrewBtn);
@ -855,10 +855,10 @@ int MenuDiscList() {
if(searchBar)
mainWindow->Append(searchBar);
}
ResumeGui();
while (menu == MENU_NONE) {
if (idiotFlag==1) {
@ -891,31 +891,34 @@ int MenuDiscList() {
break;
}
//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);
//CLOCK update every 10 secs
if(frameCount % (60*10))
{
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) {
} else if (dataed > 0) {
clockTime.SetTextf("%i", (dataed-1));
}
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
@ -1059,7 +1062,7 @@ int MenuDiscList() {
//if(isSdInserted()) {
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();
@ -1176,8 +1179,8 @@ int MenuDiscList() {
wcscpy(newFilter, gameFilter);
newFilter[len] = searchChar;
newFilter[len+1] = 0;
__Menu_GetEntries(0, newFilter);
menu = MENU_DISCLIST;
break;
@ -1207,7 +1210,7 @@ int MenuDiscList() {
searchBtn.SetImageOver(&searchBtnImg_g);
searchBtn.SetAlpha(180);
}
ResumeGui();
}
else if(searchChar == 8) // Backspace
@ -1218,7 +1221,7 @@ int MenuDiscList() {
}
}
else if (abcBtn.GetState() == STATE_CLICKED) {
if (Settings.sort != all) {
Settings.sort=all;
@ -1314,7 +1317,7 @@ int MenuDiscList() {
}
else if (dvdBtn.GetState() == STATE_CLICKED) {
mountMethodOLD = (mountMethod==3?mountMethod:0);
mountMethod=DiscMount(dvdheader);
dvdBtn.ResetState();
@ -1367,7 +1370,7 @@ int MenuDiscList() {
delete GameRegionTxt;
GameRegionTxt = NULL;
}
switch (header->id[3]) {
case 'E':
sprintf(gameregion,"NTSC U");
@ -1431,7 +1434,7 @@ int MenuDiscList() {
}
}
}
if (idBtn.GetState() == STATE_CLICKED && mountMethod!=3) {
struct discHdr * header = &gameList[gameBrowser->GetSelectedOption()];
//enter new game ID
@ -1444,13 +1447,13 @@ int MenuDiscList() {
//__Menu_GetEntries();
menu = MENU_DISCLIST;
}
idBtn.ResetState();
}
}
if (((gameSelected >= 0) && (gameSelected < (s32)gameCnt))
|| mountMethod==1
|| mountMethod==1
|| mountMethod==2) {
if(searchBar)
{
@ -1479,7 +1482,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;
@ -1523,7 +1526,7 @@ int MenuDiscList() {
}
}
wiilight(0);
if (isInserted(bootDevice)) {
//////////save game play count////////////////
@ -1622,7 +1625,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));
@ -1679,7 +1682,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) {
@ -1697,11 +1700,11 @@ int MenuDiscList() {
}
}
}
if (menu == MENU_EXIT) {
SDCard_deInit();
}
HaltGui();
mainWindow->RemoveAll();
mainWindow->Append(bgImg);
@ -1744,7 +1747,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);
@ -2184,7 +2187,7 @@ int MainMenu(int menu) {
break;
}
}
//MemInfoPrompt();
//for testing
/*if (mountMethod)
@ -2207,10 +2210,9 @@ int MainMenu(int menu) {
delete GameIDTxt;
delete cover;
delete coverImg;
delete fontClock;
delete fontSystem;
ShutdownAudio();
StopGX();
ClearFontData();
gettextCleanUp();
if (mountMethod==3)
{
@ -2250,7 +2252,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 +2272,7 @@ int MainMenu(int menu) {
}
reloadblock = off;
}
int ios2;
switch (iosChoice) {
case i249:
@ -2297,8 +2299,8 @@ int MainMenu(int menu) {
Sys_IosReload(249);
}
}
if (!mountMethod)
{
if (!mountMethod)
{
ret = Disc_SetUSB(header->id);
if (ret < 0) Sys_BackToLoader();
}
@ -2313,7 +2315,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

@ -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, GuiText::SCROLL);
titleTxt.SetMaxWidth(356, SCROLL_HORIZONTAL);
GuiImage settingsbackground(&settingsbg);
GuiButton settingsbackgroundbtn(settingsbackground.GetWidth(), settingsbackground.GetHeight());
@ -173,7 +173,7 @@ int DiscBrowse(struct discHdr * header) {
cancelBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
GuiImage cancelBtnImg(&btnOutline);
if (Settings.wsprompt == yes) {
cancelBtnTxt.SetWidescreen(CFG.widescreen);
//cancelBtnTxt.SetWidescreen(CFG.widescreen);
cancelBtnImg.SetWidescreen(CFG.widescreen);
}
GuiButton cancelBtn(&cancelBtnImg,&cancelBtnImg, 2, 3, 180, 400, &trigA, &btnSoundOver, &btnClick,1);

View File

@ -30,6 +30,7 @@ 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;
@ -52,8 +53,13 @@ static void GameInstallProgress() {
if (gameinstalltotal <= 0)
return;
int oldinstalldone = gameinstalldone;
GetProgressValue(&gameinstalldone, &gameinstalltotal);
if((oldinstalldone == gameinstalldone) && (gameinstalldone > 0))
return;
if (gameinstalldone > gameinstalltotal)
gameinstalldone = gameinstalltotal;
@ -89,6 +95,7 @@ static void GameInstallProgress() {
snprintf(progressSizeLeft, sizeof(progressSizeLeft), "%.2fGB/%.2fGB", gamesize * gameinstalldone/gameinstalltotal, gamesize);
snprintf(progressSpeed, sizeof(progressSpeed), "%.1fMB/s", speed);
changed = true;
}
/****************************************************************************
@ -165,12 +172,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, GuiText::DOTTED);
msg1Txt.SetMaxWidth(430, DOTTED);
GuiText msg2Txt(msg2, 22, THEME.prompttext );
msg2Txt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
msg2Txt.SetPosition(0,125);
msg2Txt.SetMaxWidth(430, GuiText::DOTTED);
msg2Txt.SetMaxWidth(430, DOTTED);
GuiText prsTxt("%", 22, THEME.prompttext);
prsTxt.SetAlignment(ALIGN_RIGHT, ALIGN_MIDDLE);
@ -198,8 +205,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, GuiText::DOTTED);
msg2Txt.SetMaxWidth(380, GuiText::DOTTED);
msg1Txt.SetMaxWidth(380, DOTTED);
msg2Txt.SetMaxWidth(380, DOTTED);
timeTxt.SetPosition(250,-50);
timeTxt.SetFontSize(20);
@ -246,28 +253,33 @@ 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 (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);
if(changed)
{
changed = false;
prTxt.SetTextf("%.2f", progressDone);
tmp = static_cast<int>(progressbarImg.GetWidth()*progressDone);
if (showSize) {
sizeTxt.SetText(progressSizeLeft);
speedTxt.SetText(progressSpeed);
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 (showTime)
timeTxt.SetText(progressTime);
if (msg2)
msg2Txt.SetText(dyn_message);
}
promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
@ -384,7 +396,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, 0);
LWP_CreateThread(&progressthread, ProgressThread, NULL, NULL, 0, 80);
}
/****************************************************************************

View File

@ -90,7 +90,7 @@ int OnScreenKeyboard(char * var, u32 maxlen, int min) {
GuiText okBtnTxt(tr("OK"), 22, THEME.prompttext);
GuiImage okBtnImg(&btnOutline);
if (Settings.wsprompt == yes) {
okBtnTxt.SetWidescreen(CFG.widescreen);
//okBtnTxt.SetWidescreen(CFG.widescreen);
okBtnImg.SetWidescreen(CFG.widescreen);
}
GuiButton okBtn(&okBtnImg,&okBtnImg, 0, 4, 5, 15, &trigA, &btnSoundOver, &btnClick,1);
@ -98,7 +98,7 @@ int OnScreenKeyboard(char * var, u32 maxlen, int min) {
GuiText cancelBtnTxt(tr("Cancel"), 22, THEME.prompttext);
GuiImage cancelBtnImg(&btnOutline);
if (Settings.wsprompt == yes) {
cancelBtnTxt.SetWidescreen(CFG.widescreen);
//cancelBtnTxt.SetWidescreen(CFG.widescreen);
cancelBtnImg.SetWidescreen(CFG.widescreen);
}
GuiButton cancelBtn(&cancelBtnImg,&cancelBtnImg, 1, 4, -5, 15, &trigA, &btnSoundOver, &btnClick,1);
@ -215,7 +215,7 @@ void WindowCredits() {
i++;
y+=28;
GuiText::SetPresets(22, (GXColor) {255, 255, 255, 255}, 0, GuiText::WRAP,FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP, ALIGN_LEFT, ALIGN_TOP);
txt[i]->SetPresets(22, (GXColor) {255, 255, 255, 255}, WRAP, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP, ALIGN_LEFT, ALIGN_TOP);
txt[i] = new GuiText(tr("Coding:"));
txt[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
@ -459,7 +459,7 @@ WindowPrompt(const char *title, const char *msg, const char *btn1Label,
GuiText btn1Txt(btn1Label, 22, THEME.prompttext);
GuiImage btn1Img(&btnOutline);
if (Settings.wsprompt == yes) {
btn1Txt.SetWidescreen(CFG.widescreen);
//btn1Txt.SetWidescreen(CFG.widescreen);
btn1Img.SetWidescreen(CFG.widescreen);
}
@ -470,7 +470,7 @@ WindowPrompt(const char *title, const char *msg, const char *btn1Label,
GuiText btn2Txt(btn2Label, 22, THEME.prompttext);
GuiImage btn2Img(&btnOutline);
if (Settings.wsprompt == yes) {
btn2Txt.SetWidescreen(CFG.widescreen);
//btn2Txt.SetWidescreen(CFG.widescreen);
btn2Img.SetWidescreen(CFG.widescreen);
}
GuiButton btn2(&btn2Img, &btn2Img, 0,3,0,0,&trigA,&btnSoundOver,&btnClick,1);
@ -481,7 +481,7 @@ WindowPrompt(const char *title, const char *msg, const char *btn1Label,
GuiText btn3Txt(btn3Label, 22, THEME.prompttext);
GuiImage btn3Img(&btnOutline);
if (Settings.wsprompt == yes) {
btn3Txt.SetWidescreen(CFG.widescreen);
//btn3Txt.SetWidescreen(CFG.widescreen);
btn3Img.SetWidescreen(CFG.widescreen);
}
GuiButton btn3(&btn3Img, &btn3Img, 0,3,0,0,&trigA,&btnSoundOver,&btnClick,1);
@ -492,7 +492,7 @@ WindowPrompt(const char *title, const char *msg, const char *btn1Label,
GuiText btn4Txt(btn4Label, 22, THEME.prompttext);
GuiImage btn4Img(&btnOutline);
if (Settings.wsprompt == yes) {
btn4Txt.SetWidescreen(CFG.widescreen);
//btn4Txt.SetWidescreen(CFG.widescreen);
btn4Img.SetWidescreen(CFG.widescreen);
}
GuiButton btn4(&btn4Img, &btn4Img, 0,3,0,0,&trigA,&btnSoundOver,&btnClick,1);
@ -778,7 +778,7 @@ WindowExitPrompt(const char *title, const char *msg, const char *btn1Label,
closeTxt.SetPosition(10,3);
GuiImage closeImg(&close);
if (Settings.wsprompt == yes) {
closeTxt.SetWidescreen(CFG.widescreen);
//closeTxt.SetWidescreen(CFG.widescreen);
closeImg.SetWidescreen(CFG.widescreen);
}
GuiButton closeBtn(close.GetWidth(), close.GetHeight());
@ -797,7 +797,7 @@ WindowExitPrompt(const char *title, const char *msg, const char *btn1Label,
GuiText btn2Txt((HBC!=1?tr("Homebrew Channel"):btn1Label), 28, (GXColor) {0, 0, 0, 255});
GuiImage btn2Img(&button);
if (Settings.wsprompt == yes) {
btn2Txt.SetWidescreen(CFG.widescreen);
//btn2Txt.SetWidescreen(CFG.widescreen);
btn2Img.SetWidescreen(CFG.widescreen);
}
GuiButton btn2(&btn2Img,&btn2Img, 2, 5, -150, 0, &trigA, &btnSoundOver, &btnClick,1);
@ -811,7 +811,7 @@ WindowExitPrompt(const char *title, const char *msg, const char *btn1Label,
GuiText btn3Txt(btn2Label, 28, (GXColor) {0, 0, 0, 255});
GuiImage btn3Img(&button);
if (Settings.wsprompt == yes) {
btn3Txt.SetWidescreen(CFG.widescreen);
//btn3Txt.SetWidescreen(CFG.widescreen);
btn3Img.SetWidescreen(CFG.widescreen);
}
GuiButton btn3(&btn3Img,&btn3Img, 2, 5, 150, 0, &trigA, &btnSoundOver, &btnClick,1);
@ -1060,9 +1060,9 @@ int GameWindowPrompt() {
if (Settings.wsprompt == yes)
nameBtnTT.SetWidescreen(CFG.widescreen);
GuiText nameTxt("", 22, THEME.prompttext);
if (Settings.wsprompt == yes)
nameTxt.SetWidescreen(CFG.widescreen);
nameTxt.SetMaxWidth(350, GuiText::SCROLL);
//if (Settings.wsprompt == yes)
//nameTxt.SetWidescreen(CFG.widescreen);
nameTxt.SetMaxWidth(350, SCROLL_HORIZONTAL);
GuiButton nameBtn(120,50);
nameBtn.SetLabel(&nameTxt);
// nameBtn.SetLabelOver(&nameTxt);
@ -1110,7 +1110,7 @@ int GameWindowPrompt() {
GuiText btn2Txt(tr("Back"), 22, THEME.prompttext);
GuiImage btn2Img(&btnOutline);
if (Settings.wsprompt == yes) {
btn2Txt.SetWidescreen(CFG.widescreen);
//btn2Txt.SetWidescreen(CFG.widescreen);
btn2Img.SetWidescreen(CFG.widescreen);
}
GuiButton btn2(&btn2Img,&btn2Img, 1, 5, 0, 0, &trigA, &btnSoundOver, &btnClick,1);
@ -1128,7 +1128,7 @@ int GameWindowPrompt() {
GuiText btn3Txt(tr("Settings"), 22, THEME.prompttext);
GuiImage btn3Img(&btnOutline);
if (Settings.wsprompt == yes) {
btn3Txt.SetWidescreen(CFG.widescreen);
//btn3Txt.SetWidescreen(CFG.widescreen);
btn3Img.SetWidescreen(CFG.widescreen);
}
GuiButton btn3(&btn3Img,&btn3Img, 0, 4, 50, -40, &trigA, &btnSoundOver, &btnClick,1);
@ -1566,7 +1566,7 @@ DiscWait(const char *title, const char *msg, const char *btn1Label, const char *
GuiText btn1Txt(btn1Label, 22, THEME.prompttext);
GuiImage btn1Img(&btnOutline);
if (Settings.wsprompt == yes) {
btn1Txt.SetWidescreen(CFG.widescreen);
//btn1Txt.SetWidescreen(CFG.widescreen);
btn1Img.SetWidescreen(CFG.widescreen);
}
GuiButton btn1(&btn1Img,&btn1Img, 1, 5, 0, 0, &trigA, &btnSoundOver, &btnClick,1);
@ -1586,7 +1586,7 @@ DiscWait(const char *title, const char *msg, const char *btn1Label, const char *
GuiText btn2Txt(btn2Label, 22, THEME.prompttext);
GuiImage btn2Img(&btnOutline);
if (Settings.wsprompt == yes) {
btn2Txt.SetWidescreen(CFG.widescreen);
//btn2Txt.SetWidescreen(CFG.widescreen);
btn2Img.SetWidescreen(CFG.widescreen);
}
GuiButton btn2(&btn2Img,&btn2Img, 1, 4, -20, -25, &trigA, &btnSoundOver, &btnClick,1);
@ -1872,7 +1872,7 @@ bool NetworkInitPrompt() {
GuiText btn1Txt(tr("Cancel"), 22, THEME.prompttext);
GuiImage btn1Img(&btnOutline);
if (Settings.wsprompt == yes) {
btn1Txt.SetWidescreen(CFG.widescreen);
//btn1Txt.SetWidescreen(CFG.widescreen);
btn1Img.SetWidescreen(CFG.widescreen);
}
GuiButton btn1(&btn1Img,&btn1Img, 2, 4, 0, -45, &trigA, &btnSoundOver, &btnClick,1);
@ -2000,7 +2000,7 @@ ProgressDownloadWindow(int choice2) {
GuiText btn1Txt(tr("Cancel"), 22, THEME.prompttext);
GuiImage btn1Img(&btnOutline);
if (Settings.wsprompt == yes) {
btn1Txt.SetWidescreen(CFG.widescreen);
//btn1Txt.SetWidescreen(CFG.widescreen);
btn1Img.SetWidescreen(CFG.widescreen);
}
GuiButton btn1(&btn1Img,&btn1Img, 2, 4, 0, -45, &trigA, &btnSoundOver, &btnClick,1);
@ -2484,7 +2484,7 @@ int ProgressUpdateWindow() {
GuiText btn1Txt(tr("Cancel"), 22, THEME.prompttext);
GuiImage btn1Img(&btnOutline);
if (Settings.wsprompt == yes) {
btn1Txt.SetWidescreen(CFG.widescreen);
//btn1Txt.SetWidescreen(CFG.widescreen);
btn1Img.SetWidescreen(CFG.widescreen);
}
GuiButton btn1(&btn1Img,&btn1Img, 2, 4, 0, -40, &trigA, &btnSoundOver, &btnClick,1);
@ -3112,7 +3112,7 @@ int CodeDownload(const char *id) {
GuiText btn1Txt(tr("Cancel"), 22, THEME.prompttext);
GuiImage btn1Img(&btnOutline);
if (Settings.wsprompt == yes) {
btn1Txt.SetWidescreen(CFG.widescreen);
//btn1Txt.SetWidescreen(CFG.widescreen);
btn1Img.SetWidescreen(CFG.widescreen);
}
GuiButton btn1(&btn1Img,&btn1Img, 2, 4, 0, -40, &trigA, &btnSoundOver, &btnClick,1);
@ -3324,7 +3324,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, GuiText::SCROLL);
nameTxt.SetMaxWidth(430, SCROLL_HORIZONTAL);
if (strcmp(coder,""))
@ -3349,11 +3349,16 @@ 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);
long_descriptionTxt.SetNumLines(pagesize);
long_descriptionTxt.SetMaxWidth(360, LONGTEXT);
long_descriptionTxt.SetLinesToDraw(pagesize);
long_descriptionTxt.SetFirstLine(currentLine);
int TotalLines = long_descriptionTxt.GetTotalLines();
//convert filesize from u64 to char and put unit of measurement after it
char temp2[7];
@ -3384,7 +3389,7 @@ HBCWindowPrompt(const char *name, const char *coder, const char *version,
GuiText btn1Txt(tr("Load"), 22, THEME.prompttext);
GuiImage btn1Img(&btnOutline);
if (Settings.wsprompt == yes) {
btn1Txt.SetWidescreen(CFG.widescreen);
//btn1Txt.SetWidescreen(CFG.widescreen);
btn1Img.SetWidescreen(CFG.widescreen);
}
@ -3395,7 +3400,7 @@ HBCWindowPrompt(const char *name, const char *coder, const char *version,
GuiText btn2Txt(tr("Back"), 22, THEME.prompttext);
GuiImage btn2Img(&btnOutline);
if (Settings.wsprompt == yes) {
btn2Txt.SetWidescreen(CFG.widescreen);
//btn2Txt.SetWidescreen(CFG.widescreen);
btn2Img.SetWidescreen(CFG.widescreen);
}
GuiButton btn2(&btn2Img, &btn2Img, 0,3,0,0,&trigA,&btnSoundOver,&btnClick,1);
@ -3445,18 +3450,24 @@ 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) ) {
if (long_descriptionTxt.GetFirstLine()>1)
long_descriptionTxt.SetFirstLine(long_descriptionTxt.GetFirstLine()-1);
currentLine--;
if(currentLine+pagesize > TotalLines)
currentLine = TotalLines-pagesize;
if(currentLine < 0)
currentLine = 0;
long_descriptionTxt.SetFirstLine(currentLine);
usleep(60000);
if (!((ButtonsHold() & WPAD_BUTTON_UP)||(ButtonsHold() & PAD_BUTTON_UP)))
arrowUpBtn.ResetState();
} 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;
} else if (arrowDownBtn.GetState()==STATE_CLICKED||arrowDownBtn.GetState()==STATE_HELD) {
currentLine++;
if(currentLine+pagesize > TotalLines)
currentLine = TotalLines-pagesize;
if(currentLine < 0)
currentLine = 0;
long_descriptionTxt.SetFirstLine(l);
long_descriptionTxt.SetFirstLine(currentLine);
usleep(60000);
if (!((ButtonsHold() & WPAD_BUTTON_DOWN)||(ButtonsHold() & PAD_BUTTON_DOWN)))
arrowDownBtn.ResetState();

View File

@ -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, GuiText::SCROLL);
titleTxt.SetMaxWidth(356, SCROLL_HORIZONTAL);
GuiImage settingsbackground(&settingsbg);
GuiButton settingsbackgroundbtn(settingsbackground.GetWidth(), settingsbackground.GetHeight());
@ -262,7 +262,7 @@ int TitleBrowser(u32 type) {
cancelBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
GuiImage cancelBtnImg(&btnOutline);
if (Settings.wsprompt == yes) {
cancelBtnTxt.SetWidescreen(CFG.widescreen);
//cancelBtnTxt.SetWidescreen(CFG.widescreen);
cancelBtnImg.SetWidescreen(CFG.widescreen);
}
GuiButton cancelBtn(&cancelBtnImg,&cancelBtnImg, 2, 3, 180, 400, &trigA, &btnSoundOver, &btnClick,1);

View File

@ -322,7 +322,7 @@ int BrowseDevice(char * Path, int Path_size, int Flags, FILTERCASCADE *Filter/*=
GuiText ExitBtnTxt(tr("Cancel"), 24, (GXColor) {0, 0, 0, 255});
GuiImage ExitBtnImg(&btnOutline);
if (Settings.wsprompt == yes) {
ExitBtnTxt.SetWidescreen(CFG.widescreen);
//ExitBtnTxt.SetWidescreen(CFG.widescreen);
ExitBtnImg.SetWidescreen(CFG.widescreen);
}
GuiButton ExitBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
@ -337,7 +337,7 @@ int BrowseDevice(char * Path, int Path_size, int Flags, FILTERCASCADE *Filter/*=
GuiText usbBtnTxt(browsers[(curDevice+1)%browsers.size()].rootdir, 24, (GXColor) {0, 0, 0, 255});
GuiImage usbBtnImg(&btnOutline);
if (Settings.wsprompt == yes) {
usbBtnTxt.SetWidescreen(CFG.widescreen);
//usbBtnTxt.SetWidescreen(CFG.widescreen);
usbBtnImg.SetWidescreen(CFG.widescreen);
}
GuiButton usbBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
@ -351,7 +351,7 @@ int BrowseDevice(char * Path, int Path_size, int Flags, FILTERCASCADE *Filter/*=
GuiText okBtnTxt(tr("OK"), 22, THEME.prompttext);
GuiImage okBtnImg(&btnOutline);
if (Settings.wsprompt == yes) {
okBtnTxt.SetWidescreen(CFG.widescreen);
//okBtnTxt.SetWidescreen(CFG.widescreen);
okBtnImg.SetWidescreen(CFG.widescreen);
}
GuiButton okBtn(&okBtnImg,&okBtnImg, 0, 4, 40, -35, &trigA, &btnSoundOver, &btnClick,1);
@ -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, GuiText::SCROLL);
AdressText.SetMaxWidth(Address.GetWidth()-40, SCROLL_HORIZONTAL);
GuiImage AdressbarImg(&Address);
GuiButton Adressbar(Address.GetWidth(), Address.GetHeight());
Adressbar.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);

View File

@ -267,13 +267,13 @@ int showGameInfo(char *ID) {
if (zapper) zapperImgData = new GuiImageData(zapperR_png);
else zapperImgData = new GuiImageData(zapper_png);
if (wiispeak) wiispeakImgData = new GuiImageData(wiispeakR_png);
else wiispeakImgData = new GuiImageData(wiispeak_png);
if (nintendods) nintendodsImgData = new GuiImageData(nintendodsR_png);
else nintendodsImgData = new GuiImageData(nintendods_png);
//if (vitalitysensor) vitalitysensorImgData = new GuiImageData(vitalitysensorR_png);
//else vitalitysensorImgData = new GuiImageData(vitalitysensor_png);
@ -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, GuiText::SCROLL);
titleTxt->SetMaxWidth(350, SCROLL_HORIZONTAL);
//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,GuiText::WRAP);
publisherTxt->SetMaxWidth(250, 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,GuiText::WRAP);
developerTxt->SetMaxWidth(250, WRAP);
developerTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
developerTxt->SetPosition(-17,12+indexy);
indexy+=(20 * newline);
@ -721,14 +721,17 @@ 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,GuiText::WRAP);
synopsisTxt->SetMaxWidth(350, LONGTEXT);
synopsisTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
synopsisTxt->SetPosition(0,0);
synopsisTxt->SetNumLines(pagesize);
//synopsisTxt->SetFirstLine(12);
synopsisTxt->SetLinesToDraw(pagesize);
synopsisTxt->SetFirstLine(0);
TotalLines = synopsisTxt->GetTotalLines();
dialogBoxImg11 = new GuiImage(&dialogBox1);
dialogBoxImg11->SetAlignment(0,3);
@ -784,7 +787,7 @@ int showGameInfo(char *ID) {
mainWindow->Append(&gameinfoWindow);
mainWindow->ChangeFocus(&gameinfoWindow);
ResumeGui();
bool savedURL = false;
while (choice == -1) {
@ -849,23 +852,24 @@ int showGameInfo(char *ID) {
}
} else if ((upBtn.GetState()==STATE_CLICKED||upBtn.GetState()==STATE_HELD) && page==2) {
//int l=synopsisTxt->GetFirstLine()-1;
if (synopsisTxt->GetFirstLine()>1)
synopsisTxt->SetFirstLine(synopsisTxt->GetFirstLine()-1);
usleep(60000);
currentLine--;
if(currentLine+pagesize > TotalLines)
currentLine = TotalLines-pagesize;
if(currentLine < 0)
currentLine = 0;
synopsisTxt->SetFirstLine(currentLine);
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
&&synopsisTxt->GetTotalLines()>pagesize
&&synopsisTxt->GetFirstLine()-1<synopsisTxt->GetTotalLines()-pagesize) {
int l=0;
//if(synopsisTxt->GetTotalLines()>pagesize)
l=synopsisTxt->GetFirstLine()+1;
} 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;
//if (l>(synopsisTxt->GetTotalLines()+1)-pagesize)
//l=(synopsisTxt->GetTotalLines()+1)-pagesize;
synopsisTxt->SetFirstLine(l);
synopsisTxt->SetFirstLine(currentLine);
usleep(60000);
if (!((ButtonsHold() & WPAD_BUTTON_DOWN)||(ButtonsHold() & PAD_BUTTON_DOWN)))
dnBtn.ResetState();
@ -985,7 +989,7 @@ int showGameInfo(char *ID) {
mainWindow->SetState(STATE_DEFAULT);
ResumeGui();
}
if (savedURL) return 3;
return choice;
@ -1019,7 +1023,7 @@ bool save_gamelist(int txt) { // save gamelist
f32 size = 0.0;
f32 freespace, used;
unsigned int i;
WBFS_DiskSpace(&used, &freespace);
fprintf(f, "# USB Loader Has Saved this file\n");
@ -1027,14 +1031,14 @@ bool save_gamelist(int txt) { // save gamelist
fclose(f);
/* Closing and reopening because of a write issue we are having right now */
f = fopen(tmp, "w");
if (txt==0) {
fprintf(f, "# USB Loader Has Saved this file\n");
fprintf(f, "# This file was created based on your list of games and language settings.\n\n");
fprintf(f, "%.2fGB %s %.2fGB %s\n\n",freespace,tr("of"),(freespace+used),tr("free"));
fprintf(f, "ID Size(GB) Name\n");
for (i = 0; i < gameCnt ; i++) {
struct discHdr* header = &gameList[i];
WBFS_GameSize(header->id, &size);
@ -1046,9 +1050,9 @@ bool save_gamelist(int txt) { // save gamelist
fprintf(f, "\n");
}
} else {
fprintf(f, "\"ID\",\"Size(GB)\",\"Name\"\n");
for (i = 0; i < gameCnt ; i++) {
struct discHdr* header = &gameList[i];
WBFS_GameSize(header->id, &size);
@ -1105,7 +1109,7 @@ bool save_XML_URL() { // save xml url as as txt file for people without wifi
fprintf(f, "# USB Loader Has Saved this file\n");
fprintf(f, "# This URL was created based on your list of games and language settings.\n");
fclose(f);
// Closing and reopening because of a write issue we are having right now
// Closing and reopening because of a write issue we are having right now
f = fopen(tmp, "w");
fprintf(f, "# USB Loader Has Saved this file\n");
fprintf(f, "# This URL was created based on your list of games and language settings.\n");

File diff suppressed because it is too large Load Diff

View File

@ -85,7 +85,7 @@ bool MenuOGG() {
backBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
GuiImage backBtnImg(&btnOutline);
if (Settings.wsprompt == yes) {
backBtnTxt.SetWidescreen(CFG.widescreen);
//backBtnTxt.SetWidescreen(CFG.widescreen);
backBtnImg.SetWidescreen(CFG.widescreen);
}
GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
@ -103,7 +103,7 @@ bool MenuOGG() {
defaultBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
GuiImage defaultBtnImg(&btnOutline);
if (Settings.wsprompt == yes) {
defaultBtnTxt.SetWidescreen(CFG.widescreen);
//defaultBtnTxt.SetWidescreen(CFG.widescreen);
defaultBtnImg.SetWidescreen(CFG.widescreen);
}
GuiButton defaultBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
@ -367,7 +367,7 @@ int MenuLanguageSelect() {
backBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
GuiImage backBtnImg(&btnOutline);
if (Settings.wsprompt == yes) {
backBtnTxt.SetWidescreen(CFG.widescreen);
//backBtnTxt.SetWidescreen(CFG.widescreen);
backBtnImg.SetWidescreen(CFG.widescreen);
}
GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
@ -385,7 +385,7 @@ int MenuLanguageSelect() {
defaultBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
GuiImage defaultBtnImg(&btnOutline);
if (Settings.wsprompt == yes) {
defaultBtnTxt.SetWidescreen(CFG.widescreen);
//defaultBtnTxt.SetWidescreen(CFG.widescreen);
defaultBtnImg.SetWidescreen(CFG.widescreen);
}
GuiButton defaultBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
@ -402,7 +402,7 @@ int MenuLanguageSelect() {
updateBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
GuiImage updateBtnImg(&btnOutline);
if (Settings.wsprompt == yes) {
updateBtnTxt.SetWidescreen(CFG.widescreen);
//updateBtnTxt.SetWidescreen(CFG.widescreen);
updateBtnImg.SetWidescreen(CFG.widescreen);
}
GuiButton updateBtn(btnOutline.GetWidth(), btnOutline.GetHeight());

View File

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

View File

@ -142,7 +142,7 @@ s32 Wad_Install(FILE *fp)
GuiText btn1Txt(tr("OK"), 22, THEME.prompttext);
GuiImage btn1Img(&btnOutline);
if (Settings.wsprompt == yes){
btn1Txt.SetWidescreen(CFG.widescreen);
//btn1Txt.SetWidescreen(CFG.widescreen);
btn1Img.SetWidescreen(CFG.widescreen);}
GuiButton btn1(&btn1Img,&btn1Img, 2, 4, 0, -35, &trigA, &btnSoundOver, &btnClick,1);
btn1.SetLabel(&btn1Txt);
@ -471,7 +471,7 @@ s32 Wad_Uninstall(FILE *fp)
GuiText btn1Txt(tr("OK"), 22, THEME.prompttext);
GuiImage btn1Img(&btnOutline);
if (Settings.wsprompt == yes){
btn1Txt.SetWidescreen(CFG.widescreen);
//btn1Txt.SetWidescreen(CFG.widescreen);
btn1Img.SetWidescreen(CFG.widescreen);}
GuiButton btn1(&btn1Img,&btn1Img, 2, 4, 0, -55, &trigA, &btnSoundOver, &btnClick,1);
btn1.SetLabel(&btn1Txt);