mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-18 17:29:17 +01:00
revert dimok's stuff, because it makes too many trubble
This commit is contained in:
parent
9f66829728
commit
31cd4d03e2
@ -20,54 +20,64 @@
|
|||||||
* along with FreeTypeGX. If not, see <http://www.gnu.org/licenses/>.
|
* along with FreeTypeGX. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <wchar.h>
|
||||||
#include "FreeTypeGX.h"
|
#include "FreeTypeGX.h"
|
||||||
|
#include "settings/cfg.h"
|
||||||
|
|
||||||
FreeTypeGX *fontSystem[MAX_FONT_SIZE+1];
|
#include "main.h"
|
||||||
|
|
||||||
static FT_Byte *customfontbuffer = NULL;
|
/*! \struct ftgxCharData_
|
||||||
static u32 cstfontfilesize = 0;
|
*
|
||||||
|
* 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. */
|
||||||
|
|
||||||
bool LoadCustomFont(const char *path)
|
uint16_t textureWidth; /**< Texture width in pixels/bytes. */
|
||||||
{
|
uint16_t textureHeight; /**< Texture glyph height in pixels/bytes. */
|
||||||
FILE *pfile = fopen(path, "rb");
|
|
||||||
|
|
||||||
if(pfile)
|
int16_t renderOffsetY; /**< Texture Y axis bearing offset. */
|
||||||
{
|
int16_t renderOffsetMax; /**< Texture Y axis bearing maximum value. */
|
||||||
fseek(pfile, 0, SEEK_END);
|
int16_t renderOffsetMin; /**< Texture Y axis bearing minimum value. */
|
||||||
cstfontfilesize = ftell(pfile);
|
|
||||||
rewind(pfile);
|
|
||||||
|
|
||||||
customfontbuffer = new FT_Byte[cstfontfilesize];
|
uint32_t* glyphDataTexture; /**< Glyph texture bitmap data buffer. */
|
||||||
if(!customfontbuffer)
|
} ftgxCharData;
|
||||||
{
|
|
||||||
cstfontfilesize = 0;
|
|
||||||
fclose(pfile);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
fread(customfontbuffer, 1, cstfontfilesize, pfile);
|
/*! \struct ftgxDataOffset_
|
||||||
fclose(pfile);
|
*
|
||||||
|
* 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;
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
/**
|
||||||
|
* Default constructor for the FreeTypeGX class.
|
||||||
|
*
|
||||||
|
* @param textureFormat Optional format (GX_TF_*) of the texture as defined by the libogc gx.h header file. If not specified default value is GX_TF_RGBA8.
|
||||||
|
* @param vertexIndex Optional vertex format index (GX_VTXFMT*) of the glyph textures as defined by the libogc gx.h header file. If not specified default value is GX_VTXFMT1.
|
||||||
|
*/
|
||||||
|
FreeTypeGX::FreeTypeGX(uint8_t textureFormat, uint8_t vertexIndex) : ftFace(NULL), ftFace_fromFile(NULL) {
|
||||||
|
FT_Init_FreeType(&this->ftLibrary);
|
||||||
|
|
||||||
|
this->textureFormat = textureFormat;
|
||||||
|
this->setVertexFormat(vertexIndex);
|
||||||
|
this->setCompatibilityMode(FTGX_COMPATIBILITY_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClearFontData()
|
/**
|
||||||
{
|
* Default destructor for the FreeTypeGX class.
|
||||||
for(int i=0; i<50; i++)
|
*/
|
||||||
{
|
FreeTypeGX::~FreeTypeGX() {
|
||||||
if(fontSystem[i])
|
this->unloadFont();
|
||||||
delete fontSystem[i];
|
FT_Done_FreeType(this->ftLibrary);
|
||||||
fontSystem[i] = NULL;
|
|
||||||
}
|
|
||||||
if(customfontbuffer)
|
|
||||||
{
|
|
||||||
delete customfontbuffer;
|
|
||||||
customfontbuffer = NULL;
|
|
||||||
cstfontfilesize = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -79,85 +89,31 @@ void ClearFontData()
|
|||||||
* @param strChar Character string to be converted.
|
* @param strChar Character string to be converted.
|
||||||
* @return Wide character representation of supplied character string.
|
* @return Wide character representation of supplied character string.
|
||||||
*/
|
*/
|
||||||
|
wchar_t* FreeTypeGX::charToWideChar(char* strChar) {
|
||||||
wchar_t* charToWideChar(const char* strChar)
|
|
||||||
{
|
|
||||||
wchar_t *strWChar;
|
wchar_t *strWChar;
|
||||||
strWChar = new wchar_t[strlen(strChar) + 1];
|
try {strWChar = new wchar_t[strlen(strChar) + 1];}
|
||||||
|
catch (...) { return 0; }
|
||||||
// UTF-8
|
// UTF-8
|
||||||
int bt;
|
int bt;
|
||||||
bt = mbstowcs(strWChar, strChar, strlen(strChar));
|
bt = mbstowcs(strWChar, strChar, strlen(strChar));
|
||||||
if(bt > 0) {
|
if (bt > 0) {
|
||||||
strWChar[bt] = (wchar_t)'\0';
|
strWChar[bt] = (wchar_t)'\0';
|
||||||
return strWChar;
|
return strWChar;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *tempSrc = (char *)strChar;
|
char *tempSrc = strChar;
|
||||||
wchar_t *tempDest = strWChar;
|
wchar_t *tempDest = strWChar;
|
||||||
while((*tempDest++ = *tempSrc++));
|
while ((*tempDest++ = *tempSrc++));
|
||||||
|
|
||||||
return strWChar;
|
return strWChar;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor for the FreeTypeGX class.
|
|
||||||
*
|
*
|
||||||
* @param textureFormat Optional format (GX_TF_*) of the texture as defined by the libogc gx.h header file. If not specified default value is GX_TF_RGBA8.
|
* \overload
|
||||||
* @param vertexIndex Optional vertex format index (GX_VTXFMT*) of the glyph textures as defined by the libogc gx.h header file. If not specified default value is GX_VTXFMT1.
|
|
||||||
*/
|
*/
|
||||||
FreeTypeGX::FreeTypeGX(FT_UInt pixelSize, uint8_t textureFormat, uint8_t vertexIndex)
|
wchar_t* FreeTypeGX::charToWideChar(const char* strChar) {
|
||||||
{
|
return FreeTypeGX::charToWideChar((char*) strChar);
|
||||||
this->textureFormat = textureFormat;
|
|
||||||
this->setVertexFormat(vertexIndex);
|
|
||||||
this->setCompatibilityMode(FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_PASSCLR | FTGX_COMPATIBILITY_DEFAULT_VTXDESC_GX_NONE);
|
|
||||||
this->ftPointSize = pixelSize;
|
|
||||||
this->ftKerningEnabled = FT_HAS_KERNING(ftFace);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Overload for WiiXplorer
|
|
||||||
*/
|
|
||||||
FreeTypeGX::FreeTypeGX(FT_UInt pixelSize, bool loadcustomfont, uint8_t* fontBuffer, FT_Long bufferSize, uint8_t textureFormat, uint8_t vertexIndex)
|
|
||||||
{
|
|
||||||
this->InitFreeType(fontBuffer, bufferSize, loadcustomfont);
|
|
||||||
this->textureFormat = textureFormat;
|
|
||||||
this->setVertexFormat(vertexIndex);
|
|
||||||
this->setCompatibilityMode(FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_PASSCLR | FTGX_COMPATIBILITY_DEFAULT_VTXDESC_GX_NONE);
|
|
||||||
this->ftPointSize = pixelSize;
|
|
||||||
this->ftKerningEnabled = FT_HAS_KERNING(ftFace);
|
|
||||||
this->ChangeFontSize(pixelSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Default destructor for the FreeTypeGX class.
|
|
||||||
*/
|
|
||||||
FreeTypeGX::~FreeTypeGX()
|
|
||||||
{
|
|
||||||
FT_Done_FreeType(ftLibrary);
|
|
||||||
FT_Done_Face(ftFace);
|
|
||||||
this->unloadFont();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void FreeTypeGX::InitFreeType(uint8_t* fontBuffer, FT_Long bufferSize, bool loadcustomfont)
|
|
||||||
{
|
|
||||||
FT_Init_FreeType(&ftLibrary);
|
|
||||||
if(customfontbuffer && cstfontfilesize > 0 && loadcustomfont)
|
|
||||||
FT_New_Memory_Face(ftLibrary, customfontbuffer, cstfontfilesize, 0,&ftFace);
|
|
||||||
else
|
|
||||||
FT_New_Memory_Face(ftLibrary, (FT_Byte *)fontBuffer, bufferSize, 0, &ftFace);
|
|
||||||
ftSlot = ftFace->glyph;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FreeTypeGX::ChangeFontSize(FT_UInt pixelSize, FT_UInt pixelSizeHorz)
|
|
||||||
{
|
|
||||||
FT_Set_Pixel_Sizes(ftFace, pixelSizeHorz, pixelSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t FreeTypeGX::GetMaxCharWidth()
|
|
||||||
{
|
|
||||||
return ftFace->size->metrics.max_advance >> 6;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -169,9 +125,9 @@ uint8_t FreeTypeGX::GetMaxCharWidth()
|
|||||||
*
|
*
|
||||||
* @param vertexIndex Vertex format index (GX_VTXFMT*) of the glyph textures as defined by the libogc gx.h header file.
|
* @param vertexIndex Vertex format index (GX_VTXFMT*) of the glyph textures as defined by the libogc gx.h header file.
|
||||||
*/
|
*/
|
||||||
void FreeTypeGX::setVertexFormat(uint8_t vertexIndex)
|
void FreeTypeGX::setVertexFormat(uint8_t vertexIndex) {
|
||||||
{
|
|
||||||
this->vertexIndex = vertexIndex;
|
this->vertexIndex = vertexIndex;
|
||||||
|
|
||||||
GX_SetVtxAttrFmt(this->vertexIndex, GX_VA_POS, GX_POS_XY, GX_S16, 0);
|
GX_SetVtxAttrFmt(this->vertexIndex, GX_VA_POS, GX_POS_XY, GX_S16, 0);
|
||||||
GX_SetVtxAttrFmt(this->vertexIndex, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0);
|
GX_SetVtxAttrFmt(this->vertexIndex, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0);
|
||||||
GX_SetVtxAttrFmt(this->vertexIndex, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
|
GX_SetVtxAttrFmt(this->vertexIndex, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
|
||||||
@ -187,8 +143,7 @@ void FreeTypeGX::setVertexFormat(uint8_t vertexIndex)
|
|||||||
*
|
*
|
||||||
* @param compatibilityMode Compatibility descritor (FTGX_COMPATIBILITY_*) as defined in FreeTypeGX.h
|
* @param compatibilityMode Compatibility descritor (FTGX_COMPATIBILITY_*) as defined in FreeTypeGX.h
|
||||||
*/
|
*/
|
||||||
void FreeTypeGX::setCompatibilityMode(uint32_t compatibilityMode)
|
void FreeTypeGX::setCompatibilityMode(uint32_t compatibilityMode) {
|
||||||
{
|
|
||||||
this->compatibilityMode = compatibilityMode;
|
this->compatibilityMode = compatibilityMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,12 +153,9 @@ void FreeTypeGX::setCompatibilityMode(uint32_t compatibilityMode)
|
|||||||
* This function calls the GX_SetTevOp and GX_SetVtxDesc functions with the compatibility parameters specified
|
* This function calls the GX_SetTevOp and GX_SetVtxDesc functions with the compatibility parameters specified
|
||||||
* in setCompatibilityMode.
|
* in setCompatibilityMode.
|
||||||
*/
|
*/
|
||||||
void FreeTypeGX::setDefaultMode()
|
void FreeTypeGX::setDefaultMode() {
|
||||||
{
|
if (this->compatibilityMode) {
|
||||||
if(this->compatibilityMode)
|
switch (this->compatibilityMode & 0x00FF) {
|
||||||
{
|
|
||||||
switch(this->compatibilityMode & 0x00FF)
|
|
||||||
{
|
|
||||||
case FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_MODULATE:
|
case FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_MODULATE:
|
||||||
GX_SetTevOp(GX_TEVSTAGE0, GX_MODULATE);
|
GX_SetTevOp(GX_TEVSTAGE0, GX_MODULATE);
|
||||||
break;
|
break;
|
||||||
@ -223,8 +175,7 @@ void FreeTypeGX::setDefaultMode()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(this->compatibilityMode & 0xFF00)
|
switch (this->compatibilityMode & 0xFF00) {
|
||||||
{
|
|
||||||
case FTGX_COMPATIBILITY_DEFAULT_VTXDESC_GX_NONE:
|
case FTGX_COMPATIBILITY_DEFAULT_VTXDESC_GX_NONE:
|
||||||
GX_SetVtxDesc(GX_VA_TEX0, GX_NONE);
|
GX_SetVtxDesc(GX_VA_TEX0, GX_NONE);
|
||||||
break;
|
break;
|
||||||
@ -243,20 +194,99 @@ void FreeTypeGX::setDefaultMode()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads and processes a specified true type font buffer to a specific point size.
|
||||||
|
*
|
||||||
|
* This routine takes a precompiled true type font buffer and loads the necessary processed data into memory. This routine should be called before drawText will succeed.
|
||||||
|
*
|
||||||
|
* @param fontPath filename with path to load font from file in memory.
|
||||||
|
* @param fontBuffer A pointer in memory to a precompiled true type font buffer.
|
||||||
|
* @param bufferSize Size of the true type font buffer in bytes.
|
||||||
|
* @param pointSize The desired point size this wrapper's configured font face.
|
||||||
|
* @param cacheAll Optional flag to specify if all font characters should be cached when the class object is created. If specified as false the characters only become cached the first time they are used. If not specified default value is false.
|
||||||
|
*/
|
||||||
|
uint16_t FreeTypeGX::loadFont(char* fontPath, uint8_t* fontBuffer, FT_Long bufferSize, FT_UInt pointSize, bool cacheAll) {
|
||||||
|
this->unloadFont();
|
||||||
|
this->ftPointSize = pointSize;
|
||||||
|
struct stat st;
|
||||||
|
|
||||||
|
if (fontPath && (stat(fontPath, &st)==0)) {
|
||||||
|
FILE *fontfile = fopen(fontPath, "rb");
|
||||||
|
if (fontfile) {
|
||||||
|
FT_Long ftFace_fromFile_Size;
|
||||||
|
|
||||||
|
fseek(fontfile, 0, SEEK_END);
|
||||||
|
ftFace_fromFile_Size = ftell(fontfile);
|
||||||
|
fseek(fontfile, 0, SEEK_SET);
|
||||||
|
ftFace_fromFile = (uint8_t*)malloc(ftFace_fromFile_Size);
|
||||||
|
if (ftFace_fromFile != NULL) {
|
||||||
|
fread(ftFace_fromFile, 1, ftFace_fromFile_Size, fontfile);
|
||||||
|
FT_New_Memory_Face(this->ftLibrary, ftFace_fromFile, ftFace_fromFile_Size, 0, &this->ftFace);
|
||||||
|
}
|
||||||
|
fclose(fontfile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ftFace_fromFile == NULL)
|
||||||
|
FT_New_Memory_Face(this->ftLibrary, (FT_Byte *)fontBuffer, bufferSize, 0, &this->ftFace);
|
||||||
|
|
||||||
|
if (this->ftPointSize > 0)
|
||||||
|
FT_Set_Pixel_Sizes(this->ftFace, 0, this->ftPointSize);
|
||||||
|
|
||||||
|
this->ftSlot = this->ftFace->glyph;
|
||||||
|
this->ftKerningEnabled = FT_HAS_KERNING(this->ftFace);
|
||||||
|
|
||||||
|
if (cacheAll) {
|
||||||
|
return this->cacheGlyphDataComplete();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* \overload
|
||||||
|
*/
|
||||||
|
uint16_t FreeTypeGX::loadFont(const char* fontPath, const uint8_t* fontBuffer, FT_Long bufferSize, FT_UInt pointSize, bool cacheAll) {
|
||||||
|
return this->loadFont((char*)fontPath, (uint8_t *)fontBuffer, bufferSize, pointSize, cacheAll);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FreeTypeGX::unloadFont() {
|
||||||
|
clearGlyphData();
|
||||||
|
|
||||||
|
if (this->ftFace) {
|
||||||
|
FT_Done_Face(this->ftFace);
|
||||||
|
this->ftFace = NULL;
|
||||||
|
}
|
||||||
|
if (this->ftFace_fromFile) {
|
||||||
|
free(this->ftFace_fromFile);
|
||||||
|
this->ftFace_fromFile = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Clears all loaded font glyph data.
|
* Clears all loaded font glyph data.
|
||||||
*
|
*
|
||||||
* This routine clears all members of the font map structure and frees all allocated memory back to the system.
|
* This routine clears all members of the font map structure and frees all allocated memory back to the system.
|
||||||
*/
|
*/
|
||||||
void FreeTypeGX::unloadFont()
|
void FreeTypeGX::clearGlyphData() {
|
||||||
{
|
if (this->fontData.size() == 0)
|
||||||
if(this->fontData.size() == 0)
|
|
||||||
return;
|
return;
|
||||||
for(std::map<wchar_t, ftgxCharData>::iterator i = this->fontData.begin(); i != this->fontData.end(); i++)
|
|
||||||
|
GX_DrawDone();
|
||||||
|
GX_Flush();
|
||||||
|
|
||||||
|
for ( std::map<wchar_t, ftgxCharData>::iterator i = this->fontData.begin(); i != this->fontData.end(); i++) {
|
||||||
free(i->second.glyphDataTexture);
|
free(i->second.glyphDataTexture);
|
||||||
|
}
|
||||||
|
|
||||||
this->fontData.clear();
|
this->fontData.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FreeTypeGX::changeSize(FT_UInt vPointSize, FT_UInt hPointSize/*=0*/) {
|
||||||
|
this->clearGlyphData();
|
||||||
|
this->ftPointSize = vPointSize;
|
||||||
|
FT_Set_Pixel_Sizes(this->ftFace, hPointSize, this->ftPointSize);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adjusts the texture data buffer to necessary width for a given texture format.
|
* Adjusts the texture data buffer to necessary width for a given texture format.
|
||||||
*
|
*
|
||||||
@ -266,12 +296,10 @@ void FreeTypeGX::unloadFont()
|
|||||||
* @param textureFormat The texture format to which the data is to be converted.
|
* @param textureFormat The texture format to which the data is to be converted.
|
||||||
* @return The correctly adjusted texture width.
|
* @return The correctly adjusted texture width.
|
||||||
*/
|
*/
|
||||||
uint16_t FreeTypeGX::adjustTextureWidth(uint16_t textureWidth, uint8_t textureFormat)
|
uint16_t FreeTypeGX::adjustTextureWidth(uint16_t textureWidth, uint8_t textureFormat) {
|
||||||
{
|
|
||||||
uint16_t alignment;
|
uint16_t alignment;
|
||||||
|
|
||||||
switch(textureFormat)
|
switch (textureFormat) {
|
||||||
{
|
|
||||||
case GX_TF_I4: /* 8x8 Tiles - 4-bit Intensity */
|
case GX_TF_I4: /* 8x8 Tiles - 4-bit Intensity */
|
||||||
case GX_TF_I8: /* 8x4 Tiles - 8-bit Intensity */
|
case GX_TF_I8: /* 8x4 Tiles - 8-bit Intensity */
|
||||||
case GX_TF_IA4: /* 8x4 Tiles - 4-bit Intensity, , 4-bit Alpha */
|
case GX_TF_IA4: /* 8x4 Tiles - 4-bit Intensity, , 4-bit Alpha */
|
||||||
@ -287,6 +315,7 @@ uint16_t FreeTypeGX::adjustTextureWidth(uint16_t textureWidth, uint8_t textureFo
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return textureWidth % alignment == 0 ? textureWidth : alignment + textureWidth - (textureWidth % alignment);
|
return textureWidth % alignment == 0 ? textureWidth : alignment + textureWidth - (textureWidth % alignment);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -298,12 +327,10 @@ uint16_t FreeTypeGX::adjustTextureWidth(uint16_t textureWidth, uint8_t textureFo
|
|||||||
* @param textureFormat The texture format to which the data is to be converted.
|
* @param textureFormat The texture format to which the data is to be converted.
|
||||||
* @return The correctly adjusted texture height.
|
* @return The correctly adjusted texture height.
|
||||||
*/
|
*/
|
||||||
uint16_t FreeTypeGX::adjustTextureHeight(uint16_t textureHeight, uint8_t textureFormat)
|
uint16_t FreeTypeGX::adjustTextureHeight(uint16_t textureHeight, uint8_t textureFormat) {
|
||||||
{
|
|
||||||
uint16_t alignment;
|
uint16_t alignment;
|
||||||
|
|
||||||
switch(textureFormat)
|
switch (textureFormat) {
|
||||||
{
|
|
||||||
case GX_TF_I4: /* 8x8 Tiles - 4-bit Intensity */
|
case GX_TF_I4: /* 8x8 Tiles - 4-bit Intensity */
|
||||||
alignment = 8;
|
alignment = 8;
|
||||||
break;
|
break;
|
||||||
@ -319,6 +346,7 @@ uint16_t FreeTypeGX::adjustTextureHeight(uint16_t textureHeight, uint8_t texture
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return textureHeight % alignment == 0 ? textureHeight : alignment + textureHeight - (textureHeight % alignment);
|
return textureHeight % alignment == 0 ? textureHeight : alignment + textureHeight - (textureHeight % alignment);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -330,30 +358,29 @@ uint16_t FreeTypeGX::adjustTextureHeight(uint16_t textureHeight, uint8_t texture
|
|||||||
* @param charCode The requested glyph's character code.
|
* @param charCode The requested glyph's character code.
|
||||||
* @return A pointer to the allocated font structure.
|
* @return A pointer to the allocated font structure.
|
||||||
*/
|
*/
|
||||||
ftgxCharData *FreeTypeGX::cacheGlyphData(wchar_t charCode)
|
ftgxCharData *FreeTypeGX::cacheGlyphData(wchar_t charCode) {
|
||||||
{
|
|
||||||
FT_UInt gIndex;
|
FT_UInt gIndex;
|
||||||
uint16_t textureWidth = 0, textureHeight = 0;
|
uint16_t textureWidth = 0, textureHeight = 0;
|
||||||
|
|
||||||
gIndex = FT_Get_Char_Index( ftFace, charCode );
|
gIndex = FT_Get_Char_Index( this->ftFace, charCode );
|
||||||
if (!FT_Load_Glyph(ftFace, gIndex, FT_LOAD_DEFAULT )) {
|
if (!FT_Load_Glyph(this->ftFace, gIndex, FT_LOAD_DEFAULT )) {
|
||||||
FT_Render_Glyph( ftSlot, FT_RENDER_MODE_NORMAL );
|
FT_Render_Glyph( this->ftSlot, FT_RENDER_MODE_NORMAL );
|
||||||
|
|
||||||
if(ftSlot->format == FT_GLYPH_FORMAT_BITMAP) {
|
if (this->ftSlot->format == FT_GLYPH_FORMAT_BITMAP) {
|
||||||
FT_Bitmap *glyphBitmap = &ftSlot->bitmap;
|
FT_Bitmap *glyphBitmap = &this->ftSlot->bitmap;
|
||||||
|
|
||||||
textureWidth = adjustTextureWidth(glyphBitmap->width, this->textureFormat);
|
textureWidth = adjustTextureWidth(glyphBitmap->width, this->textureFormat);
|
||||||
textureHeight = adjustTextureHeight(glyphBitmap->rows, this->textureFormat);
|
textureHeight = adjustTextureHeight(glyphBitmap->rows, this->textureFormat);
|
||||||
|
|
||||||
this->fontData[charCode] = (ftgxCharData){
|
this->fontData[charCode] = (ftgxCharData) {
|
||||||
ftSlot->bitmap_left,
|
this->ftSlot->bitmap_left,
|
||||||
ftSlot->advance.x >> 6,
|
this->ftSlot->advance.x >> 6,
|
||||||
gIndex,
|
gIndex,
|
||||||
textureWidth,
|
textureWidth,
|
||||||
textureHeight,
|
textureHeight,
|
||||||
ftSlot->bitmap_top,
|
this->ftSlot->bitmap_top,
|
||||||
ftSlot->bitmap_top,
|
this->ftSlot->bitmap_top,
|
||||||
glyphBitmap->rows - ftSlot->bitmap_top,
|
glyphBitmap->rows - this->ftSlot->bitmap_top,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
this->loadGlyphData(glyphBitmap, &this->fontData[charCode]);
|
this->loadGlyphData(glyphBitmap, &this->fontData[charCode]);
|
||||||
@ -361,6 +388,7 @@ ftgxCharData *FreeTypeGX::cacheGlyphData(wchar_t charCode)
|
|||||||
return &this->fontData[charCode];
|
return &this->fontData[charCode];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,17 +398,19 @@ ftgxCharData *FreeTypeGX::cacheGlyphData(wchar_t charCode)
|
|||||||
* This routine locates each character in the configured font face and renders the glyph's bitmap.
|
* This routine locates each character in the configured font face and renders the glyph's bitmap.
|
||||||
* Each bitmap and relevant information is loaded into its own quickly addressible structure within an instance-specific map.
|
* Each bitmap and relevant information is loaded into its own quickly addressible structure within an instance-specific map.
|
||||||
*/
|
*/
|
||||||
uint16_t FreeTypeGX::cacheGlyphDataComplete()
|
uint16_t FreeTypeGX::cacheGlyphDataComplete() {
|
||||||
{
|
|
||||||
uint16_t i = 0;
|
uint16_t i = 0;
|
||||||
FT_UInt gIndex;
|
FT_UInt gIndex;
|
||||||
FT_ULong charCode = FT_Get_First_Char( ftFace, &gIndex );
|
FT_ULong charCode = FT_Get_First_Char( this->ftFace, &gIndex );
|
||||||
while ( gIndex != 0 )
|
while ( gIndex != 0 ) {
|
||||||
{
|
|
||||||
if(this->cacheGlyphData(charCode) != NULL)
|
if (this->cacheGlyphData(charCode) != NULL) {
|
||||||
i++;
|
i++;
|
||||||
charCode = FT_Get_Next_Char( ftFace, charCode, &gIndex );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
charCode = FT_Get_Next_Char( this->ftFace, charCode, &gIndex );
|
||||||
|
}
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -393,22 +423,19 @@ uint16_t FreeTypeGX::cacheGlyphDataComplete()
|
|||||||
* @param bmp A pointer to the most recently rendered glyph's bitmap.
|
* @param bmp A pointer to the most recently rendered glyph's bitmap.
|
||||||
* @param charData A pointer to an allocated ftgxCharData structure whose data represent that of the last rendered glyph.
|
* @param charData A pointer to an allocated ftgxCharData structure whose data represent that of the last rendered glyph.
|
||||||
*/
|
*/
|
||||||
void FreeTypeGX::loadGlyphData(FT_Bitmap *bmp, ftgxCharData *charData)
|
void FreeTypeGX::loadGlyphData(FT_Bitmap *bmp, ftgxCharData *charData) {
|
||||||
{
|
|
||||||
uint32_t *glyphData = (uint32_t *)memalign(32, charData->textureWidth * charData->textureHeight * 4);
|
uint32_t *glyphData = (uint32_t *)memalign(32, charData->textureWidth * charData->textureHeight * 4);
|
||||||
memset(glyphData, 0x00, charData->textureWidth * charData->textureHeight * 4);
|
memset(glyphData, 0x00, charData->textureWidth * charData->textureHeight * 4);
|
||||||
|
|
||||||
for (uint16_t imagePosY = 0; imagePosY < bmp->rows; imagePosY++)
|
for (uint16_t imagePosY = 0; imagePosY < bmp->rows; imagePosY++) {
|
||||||
{
|
for (uint16_t imagePosX = 0; imagePosX < bmp->width; imagePosX++) {
|
||||||
for (uint16_t imagePosX = 0; imagePosX < bmp->width; imagePosX++)
|
|
||||||
{
|
|
||||||
uint32_t pixel = (uint32_t) bmp->buffer[imagePosY * bmp->width + imagePosX];
|
uint32_t pixel = (uint32_t) bmp->buffer[imagePosY * bmp->width + imagePosX];
|
||||||
glyphData[imagePosY * charData->textureWidth + imagePosX] = 0x00000000 | (pixel << 24) | (pixel << 16) | (pixel << 8) | pixel;
|
glyphData[imagePosY * charData->textureWidth + imagePosX] = 0x00000000 | (pixel << 24) | (pixel << 16) | (pixel << 8) | pixel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(this->textureFormat)
|
switch (this->textureFormat) {
|
||||||
{
|
|
||||||
case GX_TF_I4:
|
case GX_TF_I4:
|
||||||
charData->glyphDataTexture = Metaphrasis::convertBufferToI4(glyphData, charData->textureWidth, charData->textureHeight);
|
charData->glyphDataTexture = Metaphrasis::convertBufferToI4(glyphData, charData->textureWidth, charData->textureHeight);
|
||||||
break;
|
break;
|
||||||
@ -432,6 +459,7 @@ void FreeTypeGX::loadGlyphData(FT_Bitmap *bmp, ftgxCharData *charData)
|
|||||||
charData->glyphDataTexture = Metaphrasis::convertBufferToRGBA8(glyphData, charData->textureWidth, charData->textureHeight);
|
charData->glyphDataTexture = Metaphrasis::convertBufferToRGBA8(glyphData, charData->textureWidth, charData->textureHeight);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(glyphData);
|
free(glyphData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -443,14 +471,20 @@ void FreeTypeGX::loadGlyphData(FT_Bitmap *bmp, ftgxCharData *charData)
|
|||||||
* @param width Current pixel width of the string.
|
* @param width Current pixel width of the string.
|
||||||
* @param format Positional format of the string.
|
* @param format Positional format of the string.
|
||||||
*/
|
*/
|
||||||
int16_t FreeTypeGX::getStyleOffsetWidth(uint16_t width, uint16_t format)
|
int16_t FreeTypeGX::getStyleOffsetWidth(uint16_t width, uint16_t format) {
|
||||||
{
|
|
||||||
if (format & FTGX_JUSTIFY_LEFT)
|
switch (format & FTGX_JUSTIFY_MASK) {
|
||||||
|
case FTGX_JUSTIFY_LEFT:
|
||||||
return 0;
|
return 0;
|
||||||
else if (format & FTGX_JUSTIFY_CENTER)
|
|
||||||
|
default:
|
||||||
|
case FTGX_JUSTIFY_CENTER:
|
||||||
return -(width >> 1);
|
return -(width >> 1);
|
||||||
else if (format & FTGX_JUSTIFY_RIGHT)
|
|
||||||
|
case FTGX_JUSTIFY_RIGHT:
|
||||||
return -width;
|
return -width;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -462,10 +496,8 @@ int16_t FreeTypeGX::getStyleOffsetWidth(uint16_t width, uint16_t format)
|
|||||||
* @param offset Current pixel offset data of the string.
|
* @param offset Current pixel offset data of the string.
|
||||||
* @param format Positional format of the string.
|
* @param format Positional format of the string.
|
||||||
*/
|
*/
|
||||||
int16_t FreeTypeGX::getStyleOffsetHeight(ftgxDataOffset *offset, uint16_t format)
|
int16_t FreeTypeGX::getStyleOffsetHeight(ftgxDataOffset *offset, uint16_t format) {
|
||||||
{
|
switch (format & FTGX_ALIGN_MASK) {
|
||||||
switch(format & FTGX_ALIGN_MASK)
|
|
||||||
{
|
|
||||||
case FTGX_ALIGN_TOP:
|
case FTGX_ALIGN_TOP:
|
||||||
return offset->ascender;
|
return offset->ascender;
|
||||||
|
|
||||||
@ -488,6 +520,7 @@ int16_t FreeTypeGX::getStyleOffsetHeight(ftgxDataOffset *offset, uint16_t format
|
|||||||
case FTGX_ALIGN_GLYPH_BOTTOM:
|
case FTGX_ALIGN_GLYPH_BOTTOM:
|
||||||
return offset->min;
|
return offset->min;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -504,11 +537,7 @@ int16_t FreeTypeGX::getStyleOffsetHeight(ftgxDataOffset *offset, uint16_t format
|
|||||||
* @param textStyle Flags which specify any styling which should be applied to the rendered string.
|
* @param textStyle Flags which specify any styling which should be applied to the rendered string.
|
||||||
* @return The number of characters printed.
|
* @return The number of characters printed.
|
||||||
*/
|
*/
|
||||||
uint16_t FreeTypeGX::drawText(int16_t x, int16_t y, wchar_t *text, GXColor color, uint16_t textStyle)
|
uint16_t FreeTypeGX::drawText(int16_t x, int16_t y, wchar_t *text, GXColor color, uint16_t textStyle) {
|
||||||
{
|
|
||||||
if(!text)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
uint16_t strLength = wcslen(text);
|
uint16_t strLength = wcslen(text);
|
||||||
uint16_t x_pos = x, printed = 0;
|
uint16_t x_pos = x, printed = 0;
|
||||||
uint16_t x_offset = 0, y_offset = 0;
|
uint16_t x_offset = 0, y_offset = 0;
|
||||||
@ -516,33 +545,26 @@ uint16_t FreeTypeGX::drawText(int16_t x, int16_t y, wchar_t *text, GXColor color
|
|||||||
FT_Vector pairDelta;
|
FT_Vector pairDelta;
|
||||||
ftgxDataOffset offset;
|
ftgxDataOffset offset;
|
||||||
|
|
||||||
if(textStyle & FTGX_JUSTIFY_MASK)
|
if (textStyle & FTGX_JUSTIFY_MASK) {
|
||||||
{
|
|
||||||
x_offset = this->getStyleOffsetWidth(this->getWidth(text), textStyle);
|
x_offset = this->getStyleOffsetWidth(this->getWidth(text), textStyle);
|
||||||
}
|
}
|
||||||
if(textStyle & FTGX_ALIGN_MASK)
|
if (textStyle & FTGX_ALIGN_MASK) {
|
||||||
{
|
y_offset = this->getStyleOffsetHeight(this->getOffset(text, &offset), textStyle);
|
||||||
this->getOffset(text, &offset);
|
|
||||||
y_offset = this->getStyleOffsetHeight(&offset, textStyle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint16_t i = 0; i < strLength; i++)
|
for (uint16_t i = 0; i < strLength; i++) {
|
||||||
{
|
|
||||||
ftgxCharData* glyphData = NULL;
|
ftgxCharData* glyphData = NULL;
|
||||||
if( this->fontData.find(text[i]) != this->fontData.end() )
|
if ( this->fontData.find(text[i]) != this->fontData.end() ) {
|
||||||
{
|
|
||||||
glyphData = &this->fontData[text[i]];
|
glyphData = &this->fontData[text[i]];
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
glyphData = this->cacheGlyphData(text[i]);
|
glyphData = this->cacheGlyphData(text[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(glyphData != NULL)
|
if (glyphData != NULL) {
|
||||||
{
|
|
||||||
if(this->ftKerningEnabled && i)
|
if (this->ftKerningEnabled && i) {
|
||||||
{
|
FT_Get_Kerning( this->ftFace, this->fontData[text[i - 1]].glyphIndex, glyphData->glyphIndex, FT_KERNING_DEFAULT, &pairDelta );
|
||||||
FT_Get_Kerning( ftFace, this->fontData[text[i - 1]].glyphIndex, glyphData->glyphIndex, FT_KERNING_DEFAULT, &pairDelta );
|
|
||||||
x_pos += pairDelta.x >> 6;
|
x_pos += pairDelta.x >> 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -554,10 +576,8 @@ uint16_t FreeTypeGX::drawText(int16_t x, int16_t y, wchar_t *text, GXColor color
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(textStyle & FTGX_STYLE_MASK)
|
if (textStyle & FTGX_STYLE_MASK) {
|
||||||
{
|
this->drawTextFeature(x + x_offset, y + y_offset, this->getWidth(text), this->getOffset(text, &offset), textStyle, color);
|
||||||
this->getOffset(text, &offset);
|
|
||||||
this->drawTextFeature(x + x_offset, y + y_offset, this->getWidth(text), &offset, textStyle, color);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return printed;
|
return printed;
|
||||||
@ -566,20 +586,51 @@ uint16_t FreeTypeGX::drawText(int16_t x, int16_t y, wchar_t *text, GXColor color
|
|||||||
/**
|
/**
|
||||||
* \overload
|
* \overload
|
||||||
*/
|
*/
|
||||||
uint16_t FreeTypeGX::drawText(int16_t x, int16_t y, wchar_t const *text, GXColor color, uint16_t textStyle)
|
uint16_t FreeTypeGX::drawText(int16_t x, int16_t y, wchar_t const *text, GXColor color, uint16_t textStyle) {
|
||||||
{
|
|
||||||
return this->drawText(x, y, (wchar_t *)text, color, textStyle);
|
return this->drawText(x, y, (wchar_t *)text, color, textStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FreeTypeGX::drawTextFeature(int16_t x, int16_t y, uint16_t width, ftgxDataOffset *offsetData, uint16_t format, GXColor color)
|
void FreeTypeGX::drawTextFeature(int16_t x, int16_t y, uint16_t width, ftgxDataOffset *offsetData, uint16_t format, GXColor color) {
|
||||||
{
|
|
||||||
uint16_t featureHeight = this->ftPointSize >> 4 > 0 ? this->ftPointSize >> 4 : 1;
|
uint16_t featureHeight = this->ftPointSize >> 4 > 0 ? this->ftPointSize >> 4 : 1;
|
||||||
|
|
||||||
if (format & FTGX_STYLE_UNDERLINE)
|
if (format & FTGX_STYLE_UNDERLINE ) {
|
||||||
|
switch (format & FTGX_ALIGN_MASK) {
|
||||||
|
/*
|
||||||
|
case FTGX_ALIGN_TOP:
|
||||||
|
this->copyFeatureToFramebuffer(width, featureHeight, x, y + offsetData->max + 1, color);
|
||||||
|
break;
|
||||||
|
case FTGX_ALIGN_MIDDLE:
|
||||||
|
this->copyFeatureToFramebuffer(width, featureHeight, x, y + ((offsetData->max - offsetData->min + 1) >> 1), color);
|
||||||
|
break;
|
||||||
|
case FTGX_ALIGN_BOTTOM:
|
||||||
|
this->copyFeatureToFramebuffer(width, featureHeight, x, y - offsetData->min, color);
|
||||||
|
break;
|
||||||
|
*/
|
||||||
|
default:
|
||||||
this->copyFeatureToFramebuffer(width, featureHeight, x, y + 1, color);
|
this->copyFeatureToFramebuffer(width, featureHeight, x, y + 1, color);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (format & FTGX_STYLE_STRIKE)
|
if (format & FTGX_STYLE_STRIKE ) {
|
||||||
|
switch (format & FTGX_ALIGN_MASK) {
|
||||||
|
/*
|
||||||
|
case FTGX_ALIGN_TOP:
|
||||||
|
this->copyFeatureToFramebuffer(width, featureHeight, x, y + ((offsetData->max - offsetData->min + 1) >> 1), color);
|
||||||
|
break;
|
||||||
|
case FTGX_ALIGN_MIDDLE:
|
||||||
|
this->copyFeatureToFramebuffer(width, featureHeight, x, y, color);
|
||||||
|
break;
|
||||||
|
case FTGX_ALIGN_BOTTOM:
|
||||||
|
this->copyFeatureToFramebuffer(width, featureHeight, x, y - ((offsetData->max + offsetData->min) >> 1), color);
|
||||||
|
break;
|
||||||
|
*/
|
||||||
|
default:
|
||||||
|
// this->copyFeatureToFramebuffer(width, featureHeight, x, y - ((offsetData->max - offsetData->min) >> 1), color);
|
||||||
this->copyFeatureToFramebuffer(width, featureHeight, x, y - ((offsetData->max) >> 1), color);
|
this->copyFeatureToFramebuffer(width, featureHeight, x, y - ((offsetData->max) >> 1), color);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -591,38 +642,30 @@ void FreeTypeGX::drawTextFeature(int16_t x, int16_t y, uint16_t width, ftgxDataO
|
|||||||
* @param text NULL terminated string to calculate.
|
* @param text NULL terminated string to calculate.
|
||||||
* @return The width of the text string in pixels.
|
* @return The width of the text string in pixels.
|
||||||
*/
|
*/
|
||||||
uint16_t FreeTypeGX::getWidth(wchar_t *text)
|
uint16_t FreeTypeGX::getWidth(wchar_t *text) {
|
||||||
{
|
|
||||||
if(!text)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
uint16_t strLength = wcslen(text);
|
uint16_t strLength = wcslen(text);
|
||||||
uint16_t strWidth = 0;
|
uint16_t strWidth = 0;
|
||||||
FT_Vector pairDelta;
|
FT_Vector pairDelta;
|
||||||
|
|
||||||
for (uint16_t i = 0; i < strLength; i++)
|
for (uint16_t i = 0; i < strLength; i++) {
|
||||||
{
|
|
||||||
|
|
||||||
ftgxCharData* glyphData = NULL;
|
ftgxCharData* glyphData = NULL;
|
||||||
if( this->fontData.find(text[i]) != this->fontData.end() )
|
if ( this->fontData.find(text[i]) != this->fontData.end() ) {
|
||||||
{
|
|
||||||
glyphData = &this->fontData[text[i]];
|
glyphData = &this->fontData[text[i]];
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
glyphData = this->cacheGlyphData(text[i]);
|
glyphData = this->cacheGlyphData(text[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(glyphData != NULL)
|
if (glyphData != NULL) {
|
||||||
{
|
if (this->ftKerningEnabled && (i > 0)) {
|
||||||
if(this->ftKerningEnabled && (i > 0))
|
FT_Get_Kerning( this->ftFace, this->fontData[text[i - 1]].glyphIndex, glyphData->glyphIndex, FT_KERNING_DEFAULT, &pairDelta );
|
||||||
{
|
|
||||||
FT_Get_Kerning( ftFace, this->fontData[text[i - 1]].glyphIndex, glyphData->glyphIndex, FT_KERNING_DEFAULT, &pairDelta );
|
|
||||||
strWidth += pairDelta.x >> 6;
|
strWidth += pairDelta.x >> 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
strWidth += glyphData->glyphAdvanceX;
|
strWidth += glyphData->glyphAdvanceX;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return strWidth;
|
return strWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -630,8 +673,7 @@ uint16_t FreeTypeGX::getWidth(wchar_t *text)
|
|||||||
*
|
*
|
||||||
* \overload
|
* \overload
|
||||||
*/
|
*/
|
||||||
uint16_t FreeTypeGX::getWidth(wchar_t const *text)
|
uint16_t FreeTypeGX::getWidth(wchar_t const *text) {
|
||||||
{
|
|
||||||
return this->getWidth((wchar_t *)text);
|
return this->getWidth((wchar_t *)text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -644,10 +686,10 @@ uint16_t FreeTypeGX::getWidth(wchar_t const *text)
|
|||||||
* @param text NULL terminated string to calculate.
|
* @param text NULL terminated string to calculate.
|
||||||
* @return The height of the text string in pixels.
|
* @return The height of the text string in pixels.
|
||||||
*/
|
*/
|
||||||
uint16_t FreeTypeGX::getHeight(wchar_t *text)
|
uint16_t FreeTypeGX::getHeight(wchar_t *text) {
|
||||||
{
|
|
||||||
ftgxDataOffset offset;
|
ftgxDataOffset offset;
|
||||||
this->getOffset(text, &offset);
|
this->getOffset(text, &offset);
|
||||||
|
|
||||||
return offset.max - offset.min;
|
return offset.max - offset.min;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -655,8 +697,7 @@ uint16_t FreeTypeGX::getHeight(wchar_t *text)
|
|||||||
*
|
*
|
||||||
* \overload
|
* \overload
|
||||||
*/
|
*/
|
||||||
uint16_t FreeTypeGX::getHeight(wchar_t const *text)
|
uint16_t FreeTypeGX::getHeight(wchar_t const *text) {
|
||||||
{
|
|
||||||
return this->getHeight((wchar_t *)text);
|
return this->getHeight((wchar_t *)text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -670,43 +711,37 @@ uint16_t FreeTypeGX::getHeight(wchar_t const *text)
|
|||||||
* @param offset returns the max and min values above and below the font origin line
|
* @param offset returns the max and min values above and below the font origin line
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void FreeTypeGX::getOffset(wchar_t *text, ftgxDataOffset* offset)
|
ftgxDataOffset* FreeTypeGX::getOffset(wchar_t *text, ftgxDataOffset* offset) {
|
||||||
{
|
|
||||||
uint16_t strLength = wcslen(text);
|
uint16_t strLength = wcslen(text);
|
||||||
int16_t strMax = 0, strMin = 9999;
|
int16_t strMax = 0, strMin = 9999;
|
||||||
|
|
||||||
for (uint16_t i = 0; i < strLength; i++)
|
for (uint16_t i = 0; i < strLength; i++) {
|
||||||
{
|
|
||||||
|
|
||||||
ftgxCharData* glyphData = NULL;
|
ftgxCharData* glyphData = NULL;
|
||||||
if( this->fontData.find(text[i]) != this->fontData.end() )
|
if ( this->fontData.find(text[i]) != this->fontData.end() ) {
|
||||||
{
|
|
||||||
glyphData = &this->fontData[text[i]];
|
glyphData = &this->fontData[text[i]];
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
glyphData = this->cacheGlyphData(text[i]);
|
glyphData = this->cacheGlyphData(text[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(glyphData != NULL)
|
if (glyphData != NULL) {
|
||||||
{
|
|
||||||
strMax = glyphData->renderOffsetMax > strMax ? glyphData->renderOffsetMax : strMax;
|
strMax = glyphData->renderOffsetMax > strMax ? glyphData->renderOffsetMax : strMax;
|
||||||
strMin = glyphData->renderOffsetMin < strMin ? glyphData->renderOffsetMin : strMin;
|
strMin = glyphData->renderOffsetMin < strMin ? glyphData->renderOffsetMin : strMin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
offset->ascender = ftFace->size->metrics.ascender>>6;
|
offset->ascender = this->ftFace->size->metrics.ascender>>6;
|
||||||
offset->descender = ftFace->size->metrics.descender>>6;
|
offset->descender = this->ftFace->size->metrics.descender>>6;
|
||||||
offset->max = strMax;
|
offset->max = strMax;
|
||||||
offset->min = strMin;
|
offset->min = strMin;
|
||||||
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* \overload
|
* \overload
|
||||||
*/
|
*/
|
||||||
void FreeTypeGX::getOffset(wchar_t const *text, ftgxDataOffset* offset)
|
ftgxDataOffset* FreeTypeGX::getOffset(wchar_t const *text, ftgxDataOffset* offset) {
|
||||||
{
|
return this->getOffset(text, offset);
|
||||||
this->getOffset(text, offset);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -721,8 +756,8 @@ void FreeTypeGX::getOffset(wchar_t const *text, ftgxDataOffset* offset)
|
|||||||
* @param screenY The screen Y coordinate at which to output the rendered texture.
|
* @param screenY The screen Y coordinate at which to output the rendered texture.
|
||||||
* @param color Color to apply to the texture.
|
* @param color Color to apply to the texture.
|
||||||
*/
|
*/
|
||||||
void FreeTypeGX::copyTextureToFramebuffer(GXTexObj *texObj, f32 texWidth, f32 texHeight, int16_t screenX, int16_t screenY, GXColor color)
|
void FreeTypeGX::copyTextureToFramebuffer(GXTexObj *texObj, f32 texWidth, f32 texHeight, int16_t screenX, int16_t screenY, GXColor color) {
|
||||||
{
|
|
||||||
GX_LoadTexObj(texObj, GX_TEXMAP0);
|
GX_LoadTexObj(texObj, GX_TEXMAP0);
|
||||||
GX_InvalidateTexAll();
|
GX_InvalidateTexAll();
|
||||||
|
|
||||||
@ -761,8 +796,8 @@ void FreeTypeGX::copyTextureToFramebuffer(GXTexObj *texObj, f32 texWidth, f32 te
|
|||||||
* @param screenY The screen Y coordinate at which to output the quad.
|
* @param screenY The screen Y coordinate at which to output the quad.
|
||||||
* @param color Color to apply to the texture.
|
* @param color Color to apply to the texture.
|
||||||
*/
|
*/
|
||||||
void FreeTypeGX::copyFeatureToFramebuffer(f32 featureWidth, f32 featureHeight, int16_t screenX, int16_t screenY, GXColor color)
|
void FreeTypeGX::copyFeatureToFramebuffer(f32 featureWidth, f32 featureHeight, int16_t screenX, int16_t screenY, GXColor color) {
|
||||||
{
|
|
||||||
GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR);
|
GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR);
|
||||||
GX_SetVtxDesc (GX_VA_TEX0, GX_NONE);
|
GX_SetVtxDesc (GX_VA_TEX0, GX_NONE);
|
||||||
|
|
||||||
|
@ -156,45 +156,14 @@
|
|||||||
#include FT_FREETYPE_H
|
#include FT_FREETYPE_H
|
||||||
#include FT_BITMAP_H
|
#include FT_BITMAP_H
|
||||||
#include "Metaphrasis.h"
|
#include "Metaphrasis.h"
|
||||||
#include "filelist.h"
|
|
||||||
|
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <wchar.h>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#define MAX_FONT_SIZE 100
|
/*! forward deklaration of private structures
|
||||||
|
|
||||||
/*! \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 ftgxCharData_ ftgxCharData;
|
||||||
typedef struct ftgxDataOffset_ ftgxDataOffset;
|
typedef struct ftgxDataOffset_ ftgxDataOffset;
|
||||||
|
|
||||||
@ -203,21 +172,21 @@ typedef struct ftgxDataOffset_ ftgxDataOffset;
|
|||||||
#define FTGX_NULL 0x0000
|
#define FTGX_NULL 0x0000
|
||||||
#define FTGX_JUSTIFY_LEFT 0x0001
|
#define FTGX_JUSTIFY_LEFT 0x0001
|
||||||
#define FTGX_JUSTIFY_CENTER 0x0002
|
#define FTGX_JUSTIFY_CENTER 0x0002
|
||||||
#define FTGX_JUSTIFY_RIGHT 0x0004
|
#define FTGX_JUSTIFY_RIGHT 0x0003
|
||||||
#define FTGX_JUSTIFY_MASK 0x000f
|
#define FTGX_JUSTIFY_MASK 0x000f
|
||||||
|
|
||||||
#define FTGX_ALIGN_TOP 0x0010
|
#define FTGX_ALIGN_TOP 0x0010
|
||||||
#define FTGX_ALIGN_MIDDLE 0x0020
|
#define FTGX_ALIGN_MIDDLE 0x0020
|
||||||
#define FTGX_ALIGN_BOTTOM 0x0040
|
#define FTGX_ALIGN_BOTTOM 0x0030
|
||||||
#define FTGX_ALIGN_BASELINE 0x0080
|
#define FTGX_ALIGN_BASELINE 0x0040
|
||||||
#define FTGX_ALIGN_GLYPH_TOP 0x0100
|
#define FTGX_ALIGN_GLYPH_TOP 0x0050
|
||||||
#define FTGX_ALIGN_GLYPH_MIDDLE 0x0200
|
#define FTGX_ALIGN_GLYPH_MIDDLE 0x0060
|
||||||
#define FTGX_ALIGN_GLYPH_BOTTOM 0x0400
|
#define FTGX_ALIGN_GLYPH_BOTTOM 0x0070
|
||||||
#define FTGX_ALIGN_MASK 0x0ff0
|
#define FTGX_ALIGN_MASK 0x00f0
|
||||||
|
|
||||||
#define FTGX_STYLE_UNDERLINE 0x1000
|
#define FTGX_STYLE_UNDERLINE 0x0100
|
||||||
#define FTGX_STYLE_STRIKE 0x2000
|
#define FTGX_STYLE_STRIKE 0x0200
|
||||||
#define FTGX_STYLE_MASK 0xf000
|
#define FTGX_STYLE_MASK 0x0f00
|
||||||
|
|
||||||
#define FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_MODULATE 0X0001
|
#define FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_MODULATE 0X0001
|
||||||
#define FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_DECAL 0X0002
|
#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_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
|
#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
|
||||||
wchar_t* charToWideChar(const char* p);
|
}
|
||||||
bool LoadCustomFont(const char *path);
|
; /**< Constant color value used only to sanitize Doxygen documentation. */
|
||||||
void ClearFontData();
|
|
||||||
|
|
||||||
/*! \class FreeTypeGX
|
/*! \class FreeTypeGX
|
||||||
* \brief Wrapper class for the libFreeType library with GX rendering.
|
* \brief Wrapper class for the libFreeType library with GX rendering.
|
||||||
@ -251,9 +219,10 @@ void ClearFontData();
|
|||||||
*/
|
*/
|
||||||
class FreeTypeGX {
|
class FreeTypeGX {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FT_Library ftLibrary; /**< FreeType FT_Library instance. */
|
FT_Library ftLibrary; /**< FreeType FT_Library instance. */
|
||||||
FT_Face ftFace; /**< FreeType reusable FT_Face typographic object. */
|
FT_Face ftFace; /**< FreeType reusable FT_Face typographic object. */
|
||||||
|
FT_Byte *ftFace_fromFile;
|
||||||
FT_GlyphSlot ftSlot; /**< FreeType reusable FT_GlyphSlot glyph container object. */
|
FT_GlyphSlot ftSlot; /**< FreeType reusable FT_GlyphSlot glyph container object. */
|
||||||
FT_UInt ftPointSize; /**< Requested size of the rendered font. */
|
FT_UInt ftPointSize; /**< Requested size of the rendered font. */
|
||||||
bool ftKerningEnabled; /**< Flag indicating the availability of font kerning data. */
|
bool ftKerningEnabled; /**< Flag indicating the availability of font kerning data. */
|
||||||
@ -270,6 +239,7 @@ class FreeTypeGX {
|
|||||||
static int16_t getStyleOffsetHeight(ftgxDataOffset *offset, uint16_t format);
|
static int16_t getStyleOffsetHeight(ftgxDataOffset *offset, uint16_t format);
|
||||||
|
|
||||||
void unloadFont();
|
void unloadFont();
|
||||||
|
void clearGlyphData();
|
||||||
ftgxCharData *cacheGlyphData(wchar_t charCode);
|
ftgxCharData *cacheGlyphData(wchar_t charCode);
|
||||||
uint16_t cacheGlyphDataComplete();
|
uint16_t cacheGlyphDataComplete();
|
||||||
void loadGlyphData(FT_Bitmap *bmp, ftgxCharData *charData);
|
void loadGlyphData(FT_Bitmap *bmp, ftgxCharData *charData);
|
||||||
@ -280,18 +250,19 @@ class FreeTypeGX {
|
|||||||
void copyTextureToFramebuffer(GXTexObj *texObj, f32 texWidth, f32 texHeight, int16_t screenX, int16_t screenY, 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 copyFeatureToFramebuffer(f32 featureWidth, f32 featureHeight, int16_t screenX, int16_t screenY, GXColor color);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FreeTypeGX(FT_UInt pixelSize, uint8_t textureFormat, uint8_t vertexIndex);
|
FreeTypeGX(uint8_t textureFormat = GX_TF_RGBA8, uint8_t vertexIndex = GX_VTXFMT1);
|
||||||
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();
|
~FreeTypeGX();
|
||||||
|
|
||||||
void InitFreeType(uint8_t* fontBuffer, FT_Long bufferSize, bool loadcustomfont);
|
static wchar_t* charToWideChar(char* p);
|
||||||
void ChangeFontSize(FT_UInt pixelSize, FT_UInt pixelSizeHorz = 0);
|
static wchar_t* charToWideChar(const char* p);
|
||||||
uint8_t GetMaxCharWidth();
|
|
||||||
|
|
||||||
void setVertexFormat(uint8_t vertexIndex);
|
void setVertexFormat(uint8_t vertexIndex);
|
||||||
void setCompatibilityMode(uint32_t compatibilityMode);
|
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 *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 const *text, GXColor color = ftgxWhite, uint16_t textStyling = FTGX_NULL);
|
||||||
|
|
||||||
@ -299,8 +270,8 @@ class FreeTypeGX {
|
|||||||
uint16_t getWidth(wchar_t const *text);
|
uint16_t getWidth(wchar_t const *text);
|
||||||
uint16_t getHeight(wchar_t *text);
|
uint16_t getHeight(wchar_t *text);
|
||||||
uint16_t getHeight(wchar_t const *text);
|
uint16_t getHeight(wchar_t const *text);
|
||||||
void getOffset(wchar_t *text, ftgxDataOffset* offset);
|
ftgxDataOffset* getOffset(wchar_t *text, ftgxDataOffset* offset);
|
||||||
void getOffset(wchar_t const *text, ftgxDataOffset* offset);
|
ftgxDataOffset* getOffset(wchar_t const *text, ftgxDataOffset* offset);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FREETYPEGX_H_ */
|
#endif /* FREETYPEGX_H_ */
|
||||||
|
@ -82,7 +82,7 @@ int CheatMenu(const char * gameID) {
|
|||||||
|
|
||||||
GuiText titleTxt(c.getGameName().c_str(), 28, (GXColor) {0, 0, 0, 255});
|
GuiText titleTxt(c.getGameName().c_str(), 28, (GXColor) {0, 0, 0, 255});
|
||||||
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||||
titleTxt.SetMaxWidth(350, SCROLL_HORIZONTAL);
|
titleTxt.SetMaxWidth(350, GuiText::SCROLL);
|
||||||
titleTxt.SetPosition(12,40);
|
titleTxt.SetPosition(12,40);
|
||||||
|
|
||||||
for (int i = 0; i <= cntcheats; i++) {
|
for (int i = 0; i <= cntcheats; i++) {
|
||||||
|
@ -190,15 +190,15 @@ int MenuHomebrewBrowse() {
|
|||||||
GuiImage MainButton1Img(&MainButtonImgData);
|
GuiImage MainButton1Img(&MainButtonImgData);
|
||||||
GuiImage MainButton1ImgOver(&MainButtonImgOverData);
|
GuiImage MainButton1ImgOver(&MainButtonImgOverData);
|
||||||
GuiText MainButton1Txt(MainButtonText, 18, (GXColor) {0, 0, 0, 255});
|
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.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
MainButton1Txt.SetPosition(148, -12);
|
MainButton1Txt.SetPosition(148, -12);
|
||||||
GuiText MainButton1DescTxt(MainButtonText, 18, (GXColor) {0, 0, 0, 255});
|
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.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
MainButton1DescTxt.SetPosition(148, 15);
|
MainButton1DescTxt.SetPosition(148, 15);
|
||||||
GuiText MainButton1DescOverTxt(MainButtonText, 18, (GXColor) { 0, 0, 0, 255});
|
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.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
MainButton1DescOverTxt.SetPosition(148, 15);
|
MainButton1DescOverTxt.SetPosition(148, 15);
|
||||||
GuiButton MainButton1(MainButton1Img.GetWidth(), MainButton1Img.GetHeight());
|
GuiButton MainButton1(MainButton1Img.GetWidth(), MainButton1Img.GetHeight());
|
||||||
@ -219,15 +219,15 @@ int MenuHomebrewBrowse() {
|
|||||||
GuiText MainButton2Txt(MainButtonText, 18, (GXColor) {0, 0, 0, 255 });
|
GuiText MainButton2Txt(MainButtonText, 18, (GXColor) {0, 0, 0, 255 });
|
||||||
MainButton2Txt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
MainButton2Txt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
MainButton2Txt.SetPosition(148, -12);
|
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});
|
GuiText MainButton2DescTxt(MainButtonText, 18, (GXColor) { 0, 0, 0, 255});
|
||||||
MainButton2DescTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
MainButton2DescTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
MainButton2DescTxt.SetPosition(148, 15);
|
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});
|
GuiText MainButton2DescOverTxt(MainButtonText, 18, (GXColor) {0, 0, 0, 255});
|
||||||
MainButton2DescOverTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
MainButton2DescOverTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
MainButton2DescOverTxt.SetPosition(148, 15);
|
MainButton2DescOverTxt.SetPosition(148, 15);
|
||||||
MainButton2DescOverTxt.SetMaxWidth(MainButton2Img.GetWidth()-150, SCROLL_HORIZONTAL);
|
MainButton2DescOverTxt.SetMaxWidth(MainButton2Img.GetWidth()-150, GuiText::SCROLL);
|
||||||
GuiButton MainButton2(MainButton2Img.GetWidth(), MainButton2Img.GetHeight());
|
GuiButton MainButton2(MainButton2Img.GetWidth(), MainButton2Img.GetHeight());
|
||||||
MainButton2.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
MainButton2.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||||
MainButton2.SetPosition(0, 160);
|
MainButton2.SetPosition(0, 160);
|
||||||
@ -246,15 +246,15 @@ int MenuHomebrewBrowse() {
|
|||||||
GuiText MainButton3Txt(MainButtonText, 18, (GXColor) {0, 0, 0, 255});
|
GuiText MainButton3Txt(MainButtonText, 18, (GXColor) {0, 0, 0, 255});
|
||||||
MainButton3Txt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
MainButton3Txt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
MainButton3Txt.SetPosition(148, -12);
|
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});
|
GuiText MainButton3DescTxt(MainButtonText, 18, (GXColor) { 0, 0, 0, 255});
|
||||||
MainButton3DescTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
MainButton3DescTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
MainButton3DescTxt.SetPosition(148, 15);
|
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 });
|
GuiText MainButton3DescOverTxt(MainButtonText, 18, (GXColor) {0, 0, 0, 255 });
|
||||||
MainButton3DescOverTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
MainButton3DescOverTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
MainButton3DescOverTxt.SetPosition(148, 15);
|
MainButton3DescOverTxt.SetPosition(148, 15);
|
||||||
MainButton3DescOverTxt.SetMaxWidth(MainButton3Img.GetWidth()-150, SCROLL_HORIZONTAL);
|
MainButton3DescOverTxt.SetMaxWidth(MainButton3Img.GetWidth()-150, GuiText::SCROLL);
|
||||||
GuiButton MainButton3(MainButton3Img.GetWidth(), MainButton3Img.GetHeight());
|
GuiButton MainButton3(MainButton3Img.GetWidth(), MainButton3Img.GetHeight());
|
||||||
MainButton3.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
MainButton3.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||||
MainButton3.SetPosition(0, 230);
|
MainButton3.SetPosition(0, 230);
|
||||||
@ -273,15 +273,15 @@ int MenuHomebrewBrowse() {
|
|||||||
GuiText MainButton4Txt(MainButtonText, 18, (GXColor) {0, 0, 0, 255} );
|
GuiText MainButton4Txt(MainButtonText, 18, (GXColor) {0, 0, 0, 255} );
|
||||||
MainButton4Txt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
MainButton4Txt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
MainButton4Txt.SetPosition(148, -12);
|
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});
|
GuiText MainButton4DescTxt(MainButtonText, 18, (GXColor) {0, 0, 0, 255});
|
||||||
MainButton4DescTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
MainButton4DescTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
MainButton4DescTxt.SetPosition(148, 15);
|
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});
|
GuiText MainButton4DescOverTxt(MainButtonText, 18, (GXColor) { 0, 0, 0, 255});
|
||||||
MainButton4DescOverTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
MainButton4DescOverTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
MainButton4DescOverTxt.SetPosition(148, 15);
|
MainButton4DescOverTxt.SetPosition(148, 15);
|
||||||
MainButton4DescOverTxt.SetMaxWidth(MainButton4Img.GetWidth()-150, SCROLL_HORIZONTAL );
|
MainButton4DescOverTxt.SetMaxWidth(MainButton4Img.GetWidth()-150, GuiText::SCROLL);
|
||||||
GuiButton MainButton4(MainButton4Img.GetWidth(), MainButton4Img.GetHeight());
|
GuiButton MainButton4(MainButton4Img.GetWidth(), MainButton4Img.GetHeight());
|
||||||
MainButton4.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
MainButton4.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||||
MainButton4.SetPosition(0, 300);
|
MainButton4.SetPosition(0, 300);
|
||||||
|
@ -47,14 +47,13 @@
|
|||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "oggplayer.h"
|
#include "oggplayer.h"
|
||||||
|
|
||||||
extern FreeTypeGX *fontSystem[];
|
extern FreeTypeGX *fontSystem;
|
||||||
|
|
||||||
#define SCROLL_INITIAL_DELAY 20
|
#define SCROLL_INITIAL_DELAY 20
|
||||||
#define SCROLL_LOOP_DELAY 3
|
#define SCROLL_LOOP_DELAY 3
|
||||||
#define PAGESIZE 9
|
#define PAGESIZE 9
|
||||||
#define FILEBROWSERSIZE 8
|
#define FILEBROWSERSIZE 8
|
||||||
#define MAX_OPTIONS 170
|
#define MAX_OPTIONS 170
|
||||||
#define MAX_LINES_TO_DRAW 30
|
|
||||||
|
|
||||||
typedef void (*UpdateCallback)(void * e);
|
typedef void (*UpdateCallback)(void * e);
|
||||||
|
|
||||||
@ -91,16 +90,6 @@ enum
|
|||||||
IMAGE_COPY
|
IMAGE_COPY
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
NONE,
|
|
||||||
WRAP,
|
|
||||||
LONGTEXT,
|
|
||||||
DOTTED,
|
|
||||||
SCROLL_HORIZONTAL,
|
|
||||||
SCROLL_NONE
|
|
||||||
};
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
TRIGGER_SIMPLE,
|
TRIGGER_SIMPLE,
|
||||||
@ -710,8 +699,8 @@ class GuiText : public GuiElement
|
|||||||
//!Sets the text of the GuiText element
|
//!Sets the text of the GuiText element
|
||||||
//!\param t Text
|
//!\param t Text
|
||||||
void SetText(const char * t);
|
void SetText(const char * t);
|
||||||
void SetText(const wchar_t * t);
|
|
||||||
void SetTextf(const char *format, ...) __attribute__((format(printf,2,3)));
|
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)
|
//!Sets up preset values to be used by GuiText(t)
|
||||||
//!Useful when printing multiple text elements, all with the same attributes set
|
//!Useful when printing multiple text elements, all with the same attributes set
|
||||||
//!\param sz Font size
|
//!\param sz Font size
|
||||||
@ -721,30 +710,28 @@ class GuiText : public GuiElement
|
|||||||
//!\param s Font style
|
//!\param s Font style
|
||||||
//!\param h Text alignment (horizontal)
|
//!\param h Text alignment (horizontal)
|
||||||
//!\param v Text alignment (vertical)
|
//!\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
|
//!Sets the font size
|
||||||
//!\param s Font size
|
//!\param s Font size
|
||||||
void SetFontSize(int s);
|
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
|
//!Sets the maximum width of the drawn texture image
|
||||||
//!If the text exceeds this, it is wrapped to the next line
|
//!If the text exceeds this, it is wrapped to the next line
|
||||||
//!\param w Maximum width
|
//!\param w Maximum width
|
||||||
//!\param m WrapMode
|
//!\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
|
//!Sets the font color
|
||||||
//!\param c Font color
|
//!\param c Font color
|
||||||
void SetColor(GXColor c);
|
void SetColor(GXColor c);
|
||||||
//!Sets the FreeTypeGX style attributes
|
//!Sets the FreeTypeGX style attributes
|
||||||
//!\param s Style attributes
|
//!\param s Style attributes
|
||||||
//!\param m Style-Mask attributes
|
//!\param m Style-Mask attributes
|
||||||
void SetStyle(u16 s);
|
void SetStyle(u16 s, u16 m=0xffff);
|
||||||
//!Sets the text alignment
|
//!Sets the text alignment
|
||||||
//!\param hor Horizontal alignment (ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTRE)
|
//!\param hor Horizontal alignment (ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTRE)
|
||||||
//!\param vert Vertical alignment (ALIGN_TOP, ALIGN_BOTTOM, ALIGN_MIDDLE)
|
//!\param vert Vertical alignment (ALIGN_TOP, ALIGN_BOTTOM, ALIGN_MIDDLE)
|
||||||
@ -754,37 +741,33 @@ class GuiText : public GuiElement
|
|||||||
void SetFont(FreeTypeGX *f);
|
void SetFont(FreeTypeGX *f);
|
||||||
//!Get the Horizontal Size of Text
|
//!Get the Horizontal Size of Text
|
||||||
int GetTextWidth();
|
int GetTextWidth();
|
||||||
//!Get the offset of a linebreak
|
// not NULL set horizontal scale to 0.75 //added
|
||||||
u32 GetLineBreakOffset(int line);
|
|
||||||
//!Change the font
|
|
||||||
//!\param font bufferblock
|
|
||||||
//!\param font filesize
|
|
||||||
bool SetFont(const u8 *font, const u32 filesize);
|
|
||||||
//!SetWidescreen
|
|
||||||
void SetWidescreen(bool w);
|
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
|
//!Constantly called to draw the text
|
||||||
void Draw();
|
void Draw();
|
||||||
protected:
|
protected:
|
||||||
wchar_t *text;
|
wchar_t* text; //!< Unicode text value
|
||||||
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 size; //!< Font size
|
||||||
int maxWidth; //!< Maximum width of the generated text object (for text wrapping)
|
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
|
u16 style; //!< FreeTypeGX style attributes
|
||||||
GXColor color; //!< Font color
|
GXColor color; //!< Font color
|
||||||
FreeTypeGX *font;
|
FreeTypeGX *font;
|
||||||
bool widescreen; //added
|
short widescreen; //added
|
||||||
int firstLine;
|
//!these are default until the text is drawn
|
||||||
int linestodraw;
|
int firstLine; //!these are the first line and the number of lines drawn when the text is wrapped
|
||||||
int totalLines;
|
int numLines;//! default is -1 and it means that all lines are drawn
|
||||||
int textWidth;
|
int totalLines; //!this is the total # of lines when in wrap mode
|
||||||
int currentSize;
|
|
||||||
u32 *LineBreak;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//!Display, manage, and manipulate tooltips in the GUI.
|
//!Display, manage, and manipulate tooltips in the GUI.
|
||||||
@ -997,7 +980,6 @@ class GuiKeyboard : public GuiWindow
|
|||||||
GuiTrigger * trigB;
|
GuiTrigger * trigB;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef struct _optionlist {
|
typedef struct _optionlist {
|
||||||
int length;
|
int length;
|
||||||
char name[MAX_OPTIONS][60];
|
char name[MAX_OPTIONS][60];
|
||||||
|
@ -187,7 +187,7 @@ GuiCustomOptionBrowser::GuiCustomOptionBrowser(int w, int h, customOptionList *
|
|||||||
optionTxt[i] = new GuiText(options->GetName(i), 20, THEME.settingstext);
|
optionTxt[i] = new GuiText(options->GetName(i), 20, THEME.settingstext);
|
||||||
optionTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
optionTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
optionTxt[i]->SetPosition(24,0);
|
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);
|
optionBg[i] = new GuiImage(bgOptionsEntry);
|
||||||
|
|
||||||
@ -424,10 +424,10 @@ void GuiCustomOptionBrowser::UpdateListEntries()
|
|||||||
if(optionBtn[i]->GetState() != STATE_DISABLED)
|
if(optionBtn[i]->GetState() != STATE_DISABLED)
|
||||||
{
|
{
|
||||||
optionVal[i]->SetPosition(coL2,0);
|
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]->SetPosition(coL2,0);
|
||||||
optionValOver[i]->SetMaxWidth(bgOptionsImg->GetWidth() - (coL2+24), SCROLL_HORIZONTAL);
|
optionValOver[i]->SetMaxWidth(bgOptionsImg->GetWidth() - (coL2+24), GuiText::SCROLL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,12 +111,12 @@ GuiFileBrowser::GuiFileBrowser(int w, int h)
|
|||||||
fileListText[i] = new GuiText(NULL,20, (GXColor){0, 0, 0, 0xff});
|
fileListText[i] = new GuiText(NULL,20, (GXColor){0, 0, 0, 0xff});
|
||||||
fileListText[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
fileListText[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
fileListText[i]->SetPosition(5,0);
|
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] = new GuiText(NULL,20, (GXColor){0, 0, 0, 0xff});
|
||||||
fileListTextOver[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
fileListTextOver[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
fileListTextOver[i]->SetPosition(5,0);
|
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);
|
fileListBg[i] = new GuiImage(bgFileSelectionEntry);
|
||||||
//fileListArchives[i] = new GuiImage(fileArchives);
|
//fileListArchives[i] = new GuiImage(fileArchives);
|
||||||
|
@ -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] = new GuiText(get_title(&gameList[i]), 20, THEME.gametext);
|
||||||
gameTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
gameTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
gameTxt[i]->SetPosition(24,0);
|
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] = new GuiText(get_title(&gameList[i]), 20, THEME.gametext);
|
||||||
gameTxtOver[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
gameTxtOver[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
gameTxtOver[i]->SetPosition(24,0);
|
gameTxtOver[i]->SetPosition(24,0);
|
||||||
gameTxtOver[i]->SetMaxWidth(maxTextWidth, SCROLL_HORIZONTAL);
|
gameTxtOver[i]->SetMaxWidth(maxTextWidth, GuiText::SCROLL);
|
||||||
|
|
||||||
gameBg[i] = new GuiImage(bgGamesEntry);
|
gameBg[i] = new GuiImage(bgGamesEntry);
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ noCover(nocover_png)
|
|||||||
gamename->SetParent(this);
|
gamename->SetParent(this);
|
||||||
gamename->SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
gamename->SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||||
gamename->SetPosition(0, 330);
|
gamename->SetPosition(0, 330);
|
||||||
gamename->SetMaxWidth(280, DOTTED);
|
gamename->SetMaxWidth(280, GuiText::DOTTED);
|
||||||
|
|
||||||
gameIndex = new int[pagesize];
|
gameIndex = new int[pagesize];
|
||||||
game = new GuiButton * [pagesize];
|
game = new GuiButton * [pagesize];
|
||||||
|
@ -69,8 +69,8 @@ sndClick(button_click_pcm, button_click_pcm_size, SOUND_PCM, Settings.sfxvolume)
|
|||||||
text.SetText(gameFilter);
|
text.SetText(gameFilter);
|
||||||
text.SetPosition(10, 15);
|
text.SetPosition(10, 15);
|
||||||
text.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
text.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||||
//text.SetWidescreen(CFG.widescreen);
|
text.SetWidescreen(CFG.widescreen);
|
||||||
text.SetMaxWidth(width-(10+2*42+10), SCROLL_HORIZONTAL);
|
text.SetMaxWidth(width-(10+2*42+10), GuiText::SCROLL);
|
||||||
this->Append(&text);
|
this->Append(&text);
|
||||||
|
|
||||||
snprintf(imgPath, sizeof(imgPath), "%skeyboard_backspace_over.png", CFG.theme_path);
|
snprintf(imgPath, sizeof(imgPath), "%skeyboard_backspace_over.png", CFG.theme_path);
|
||||||
|
@ -10,62 +10,42 @@
|
|||||||
|
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
|
|
||||||
static int presetSize = 18;
|
static int currentSize = 0;
|
||||||
|
static int currentWidescreen = 0;
|
||||||
|
static int presetSize = 0;
|
||||||
|
static GXColor presetColor = (GXColor){255, 255, 255, 255};
|
||||||
static int presetMaxWidth = 0;
|
static int presetMaxWidth = 0;
|
||||||
|
static int presetWrapMode = GuiText::WRAP;
|
||||||
|
static u16 presetStyle = FTGX_NULL;
|
||||||
static int presetAlignmentHor = 0;
|
static int presetAlignmentHor = 0;
|
||||||
static int presetAlignmentVert = 0;
|
static int presetAlignmentVert = 0;
|
||||||
static int presetWrapMode = 0;
|
|
||||||
static u16 presetStyle = FTGX_NULL;
|
|
||||||
static GXColor presetColor = (GXColor){255, 255, 255, 255};
|
|
||||||
|
|
||||||
#define TEXT_SCROLL_DELAY 5
|
|
||||||
#define TEXT_SCROLL_INITIAL_DELAY 8
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for the GuiText class.
|
* Constructor for the GuiText class.
|
||||||
*/
|
*/
|
||||||
GuiText::GuiText(const char * t, int s, GXColor c)
|
GuiText::GuiText(const char * t, int s, GXColor c)
|
||||||
{
|
{
|
||||||
origText = NULL;
|
|
||||||
text = NULL;
|
text = NULL;
|
||||||
size = s;
|
size = s;
|
||||||
currentSize = size;
|
|
||||||
color = c;
|
color = c;
|
||||||
alpha = c.a;
|
alpha = c.a;
|
||||||
style = FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE;
|
style = FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE;
|
||||||
maxWidth = 0;
|
maxWidth = 0;
|
||||||
wrapMode = 0;
|
wrapMode = GuiText::WRAP;
|
||||||
firstLine = 0;
|
scrollPos1 = 0;
|
||||||
linestodraw = 8;
|
scrollPos2 = 0;
|
||||||
totalLines = 0;
|
scrollDelay = 0;
|
||||||
widescreen = false; //added
|
|
||||||
LineBreak = NULL;
|
|
||||||
textDyn = NULL;
|
|
||||||
font = NULL;
|
font = NULL;
|
||||||
textScrollPos = 0;
|
widescreen = 0; //added
|
||||||
textScrollInitialDelay = TEXT_SCROLL_INITIAL_DELAY;
|
firstLine = 1;
|
||||||
textScrollDelay = TEXT_SCROLL_DELAY;
|
numLines = -1;
|
||||||
|
totalLines = 1;
|
||||||
|
|
||||||
alignmentHor = ALIGN_CENTRE;
|
alignmentHor = ALIGN_CENTRE;
|
||||||
alignmentVert = ALIGN_MIDDLE;
|
alignmentVert = ALIGN_MIDDLE;
|
||||||
|
|
||||||
for(int i = 0; i < MAX_LINES_TO_DRAW; i++)
|
|
||||||
textDynRow[i] = NULL;
|
|
||||||
|
|
||||||
if(t)
|
if(t)
|
||||||
{
|
text = FreeTypeGX::charToWideChar((char *)t);
|
||||||
origText = strdup(t);
|
|
||||||
text = charToWideChar(t);
|
|
||||||
|
|
||||||
if(currentSize > MAX_FONT_SIZE)
|
|
||||||
currentSize = MAX_FONT_SIZE;
|
|
||||||
|
|
||||||
if(!fontSystem[currentSize])
|
|
||||||
{
|
|
||||||
fontSystem[currentSize] = new FreeTypeGX(currentSize);
|
|
||||||
}
|
|
||||||
textWidth = fontSystem[currentSize]->getWidth(text);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -73,46 +53,27 @@ GuiText::GuiText(const char * t, int s, GXColor c)
|
|||||||
*/
|
*/
|
||||||
GuiText::GuiText(const char * t)
|
GuiText::GuiText(const char * t)
|
||||||
{
|
{
|
||||||
origText = NULL;
|
|
||||||
text = NULL;
|
text = NULL;
|
||||||
size = presetSize;
|
size = presetSize;
|
||||||
currentSize = size;
|
|
||||||
color = presetColor;
|
color = presetColor;
|
||||||
alpha = presetColor.a;
|
alpha = presetColor.a;
|
||||||
style = presetStyle;
|
style = presetStyle;
|
||||||
maxWidth = presetMaxWidth;
|
maxWidth = presetMaxWidth;
|
||||||
wrapMode = presetWrapMode;
|
wrapMode = presetWrapMode;
|
||||||
firstLine = 0;
|
scrollPos1 = 0;
|
||||||
linestodraw = 8;
|
scrollPos2 = 0;
|
||||||
totalLines = 0;
|
scrollDelay = 0;
|
||||||
widescreen = false; //added
|
|
||||||
LineBreak = NULL;
|
|
||||||
textDyn = NULL;
|
|
||||||
font = NULL;
|
font = NULL;
|
||||||
textScrollPos = 0;
|
widescreen = 0; //added
|
||||||
textScrollInitialDelay = TEXT_SCROLL_INITIAL_DELAY;
|
firstLine = 1;
|
||||||
textScrollDelay = TEXT_SCROLL_DELAY;
|
numLines = -1;
|
||||||
|
totalLines = 1;
|
||||||
|
|
||||||
alignmentHor = presetAlignmentHor;
|
alignmentHor = presetAlignmentHor;
|
||||||
alignmentVert = presetAlignmentVert;
|
alignmentVert = presetAlignmentVert;
|
||||||
|
|
||||||
for(int i = 0; i < MAX_LINES_TO_DRAW; i++)
|
|
||||||
textDynRow[i] = NULL;
|
|
||||||
|
|
||||||
if(t)
|
if(t)
|
||||||
{
|
text = FreeTypeGX::charToWideChar((char *)t);
|
||||||
origText = strdup(t);
|
|
||||||
text = charToWideChar(t);
|
|
||||||
|
|
||||||
if(currentSize > MAX_FONT_SIZE)
|
|
||||||
currentSize = MAX_FONT_SIZE;
|
|
||||||
|
|
||||||
if(!fontSystem[currentSize])
|
|
||||||
{
|
|
||||||
fontSystem[currentSize] = new FreeTypeGX(currentSize);
|
|
||||||
}
|
|
||||||
textWidth = fontSystem[currentSize]->getWidth(text);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -120,109 +81,64 @@ GuiText::GuiText(const char * t)
|
|||||||
*/
|
*/
|
||||||
GuiText::~GuiText()
|
GuiText::~GuiText()
|
||||||
{
|
{
|
||||||
if(origText)
|
|
||||||
free(origText);
|
|
||||||
if(text)
|
if(text)
|
||||||
|
{
|
||||||
delete [] text;
|
delete [] text;
|
||||||
if(textDyn)
|
text = NULL;
|
||||||
delete [] textDyn;
|
|
||||||
|
|
||||||
if(LineBreak) {
|
|
||||||
free(LineBreak);
|
|
||||||
LineBreak = NULL;
|
|
||||||
}
|
|
||||||
if(font)
|
|
||||||
{
|
|
||||||
delete font;
|
|
||||||
font = NULL;
|
|
||||||
}
|
|
||||||
for(int i = 0; i < MAX_LINES_TO_DRAW; i++)
|
|
||||||
{
|
|
||||||
if(textDynRow[i])
|
|
||||||
{
|
|
||||||
delete [] textDynRow[i];
|
|
||||||
textDynRow[i] = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GuiText::SetNumLines(int n)
|
||||||
|
{
|
||||||
|
numLines = n;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiText::SetFirstLine(int n)
|
||||||
|
{
|
||||||
|
firstLine = n;
|
||||||
|
}
|
||||||
|
|
||||||
|
int GuiText::GetNumLines()
|
||||||
|
{
|
||||||
|
return numLines;
|
||||||
|
}
|
||||||
|
|
||||||
|
int GuiText::GetFirstLine()
|
||||||
|
{
|
||||||
|
return firstLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
int GuiText::GetTotalLines()
|
||||||
|
{
|
||||||
|
return totalLines;
|
||||||
|
}
|
||||||
|
|
||||||
|
int GuiText::GetLineHeight(int n)
|
||||||
|
{
|
||||||
|
int newSize = size*this->GetScale();
|
||||||
|
int lineheight = newSize + 6;
|
||||||
|
|
||||||
|
if (numLines <0)
|
||||||
|
return totalLines*lineheight+newSize;
|
||||||
|
|
||||||
|
else return numLines*lineheight+newSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiText::SetText(const char * t)
|
void GuiText::SetText(const char * t)
|
||||||
{
|
{
|
||||||
if(t && origText)
|
|
||||||
if(strcmp(t, origText) == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
LOCK(this);
|
LOCK(this);
|
||||||
|
|
||||||
if(origText)
|
|
||||||
free(origText);
|
|
||||||
if(text)
|
if(text)
|
||||||
delete [] text;
|
delete [] text;
|
||||||
if(textDyn)
|
|
||||||
delete [] textDyn;
|
|
||||||
for(int i = 0; i < MAX_LINES_TO_DRAW; i++)
|
|
||||||
{
|
|
||||||
if(textDynRow[i])
|
|
||||||
{
|
|
||||||
delete [] textDynRow[i];
|
|
||||||
textDynRow[i] = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
origText = NULL;
|
|
||||||
text = NULL;
|
text = NULL;
|
||||||
textDyn = NULL;
|
|
||||||
textScrollPos = 0;
|
|
||||||
textScrollInitialDelay = TEXT_SCROLL_INITIAL_DELAY;
|
|
||||||
|
|
||||||
if(t)
|
if(t)
|
||||||
{
|
text = FreeTypeGX::charToWideChar((char *)t);
|
||||||
origText = strdup(t);
|
scrollPos2 = 0;
|
||||||
text = charToWideChar(t);
|
scrollDelay = 0;
|
||||||
textWidth = fontSystem[currentSize]->getWidth(text);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiText::SetText(const wchar_t * t)
|
|
||||||
{
|
|
||||||
LOCK(this);
|
|
||||||
if(origText)
|
|
||||||
free(origText);
|
|
||||||
if(text)
|
|
||||||
delete [] text;
|
|
||||||
if(textDyn)
|
|
||||||
delete [] textDyn;
|
|
||||||
for(int i = 0; i < MAX_LINES_TO_DRAW; i++)
|
|
||||||
{
|
|
||||||
if(textDynRow[i])
|
|
||||||
{
|
|
||||||
delete [] textDynRow[i];
|
|
||||||
textDynRow[i] = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
origText = NULL;
|
|
||||||
text = NULL;
|
|
||||||
textDyn = NULL;
|
|
||||||
textScrollPos = 0;
|
|
||||||
textScrollInitialDelay = TEXT_SCROLL_INITIAL_DELAY;
|
|
||||||
|
|
||||||
if(t)
|
|
||||||
{
|
|
||||||
int len = wcslen(t);
|
|
||||||
text = new wchar_t[len+1];
|
|
||||||
if(text)
|
|
||||||
{
|
|
||||||
wcscpy(text, t);
|
|
||||||
textWidth = fontSystem[currentSize]->getWidth(text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void GuiText::SetTextf(const char *format, ...)
|
void GuiText::SetTextf(const char *format, ...)
|
||||||
{
|
{
|
||||||
LOCK(this);
|
|
||||||
|
|
||||||
char *tmp=0;
|
char *tmp=0;
|
||||||
va_list va;
|
va_list va;
|
||||||
va_start(va, format);
|
va_start(va, format);
|
||||||
@ -233,14 +149,31 @@ void GuiText::SetTextf(const char *format, ...)
|
|||||||
}
|
}
|
||||||
va_end(va);
|
va_end(va);
|
||||||
}
|
}
|
||||||
|
void GuiText::SetText(const wchar_t * t)
|
||||||
void GuiText::SetPresets(int sz, GXColor c, int w, u16 s, int h, int v)
|
|
||||||
{
|
{
|
||||||
LOCK(this);
|
LOCK(this);
|
||||||
|
if(text)
|
||||||
|
delete [] text;
|
||||||
|
text = NULL;
|
||||||
|
|
||||||
|
if(t)
|
||||||
|
{
|
||||||
|
int len = wcslen(t);
|
||||||
|
text = new wchar_t[len+1];
|
||||||
|
if(text) wcscpy(text, t);
|
||||||
|
}
|
||||||
|
scrollPos2 = 0;
|
||||||
|
scrollDelay = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiText::SetPresets(int sz, GXColor c, int w, int wrap, u16 s, int h, int v)
|
||||||
|
{
|
||||||
presetSize = sz;
|
presetSize = sz;
|
||||||
presetColor = c;
|
presetColor = c;
|
||||||
presetStyle = s;
|
|
||||||
presetMaxWidth = w;
|
presetMaxWidth = w;
|
||||||
|
presetWrapMode = wrap;
|
||||||
|
presetStyle = s;
|
||||||
presetAlignmentHor = h;
|
presetAlignmentHor = h;
|
||||||
presetAlignmentVert = v;
|
presetAlignmentVert = v;
|
||||||
}
|
}
|
||||||
@ -248,109 +181,14 @@ void GuiText::SetPresets(int sz, GXColor c, int w, u16 s, int h, int v)
|
|||||||
void GuiText::SetFontSize(int s)
|
void GuiText::SetFontSize(int s)
|
||||||
{
|
{
|
||||||
LOCK(this);
|
LOCK(this);
|
||||||
|
|
||||||
size = s;
|
size = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiText::SetMaxWidth(int width, int w)
|
void GuiText::SetMaxWidth(int w, short m/*=GuiText::WRAP*/)
|
||||||
{
|
{
|
||||||
LOCK(this);
|
LOCK(this);
|
||||||
|
maxWidth = w;
|
||||||
maxWidth = width;
|
wrapMode = m;
|
||||||
wrapMode = w;
|
|
||||||
|
|
||||||
if(w == LONGTEXT && text) {
|
|
||||||
|
|
||||||
int strlen = wcslen(text);
|
|
||||||
int i = 0;
|
|
||||||
int ch = 0;
|
|
||||||
int linenum = 0;
|
|
||||||
int lastSpace = -1;
|
|
||||||
int lastSpaceIndex = -1;
|
|
||||||
|
|
||||||
wchar_t *tmptext = new wchar_t[maxWidth];
|
|
||||||
|
|
||||||
LineBreak = (u32 *) malloc(sizeof(u32));
|
|
||||||
memset(&(LineBreak[linenum]), 0, sizeof(u32));
|
|
||||||
|
|
||||||
LineBreak[linenum] = 0;
|
|
||||||
linenum++;
|
|
||||||
|
|
||||||
while(ch < strlen)
|
|
||||||
{
|
|
||||||
tmptext[i] = text[ch];
|
|
||||||
tmptext[i+1] = 0;
|
|
||||||
|
|
||||||
if(text[ch] == ' ' || ch == strlen-1 || fontSystem[currentSize]->getWidth(tmptext) >= maxWidth)
|
|
||||||
{
|
|
||||||
if(fontSystem[currentSize]->getWidth(tmptext) >= maxWidth)
|
|
||||||
{
|
|
||||||
if(lastSpace >= 0)
|
|
||||||
{
|
|
||||||
tmptext[lastSpaceIndex] = 0; // discard space, and everything after
|
|
||||||
ch = lastSpace; // go backwards to the last space
|
|
||||||
lastSpace = -1; // we have used this space
|
|
||||||
lastSpaceIndex = -1;
|
|
||||||
}
|
|
||||||
LineBreak = (u32 *) realloc(LineBreak, (linenum+1)* sizeof(u32));
|
|
||||||
memset(&(LineBreak[linenum]), 0, sizeof(u32));
|
|
||||||
LineBreak[linenum] = ch;
|
|
||||||
linenum++;
|
|
||||||
i = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(text[ch] == ' ' && i >= 0)
|
|
||||||
{
|
|
||||||
lastSpace = ch+1;
|
|
||||||
lastSpaceIndex = i;
|
|
||||||
}
|
|
||||||
if(text[ch] == '\n')
|
|
||||||
{
|
|
||||||
LineBreak = (u32 *) realloc(LineBreak, (linenum+1)* sizeof(u32));
|
|
||||||
memset(&(LineBreak[linenum]), 0, sizeof(u32));
|
|
||||||
LineBreak[linenum] = ch+1;
|
|
||||||
linenum++;
|
|
||||||
i = -1;
|
|
||||||
lastSpace = -1;
|
|
||||||
lastSpaceIndex = -1;
|
|
||||||
}
|
|
||||||
ch++;
|
|
||||||
i++;
|
|
||||||
|
|
||||||
if(ch == strlen)
|
|
||||||
{
|
|
||||||
LineBreak = (u32 *) realloc(LineBreak, (linenum+1)* sizeof(u32));
|
|
||||||
memset(&(LineBreak[linenum]), 0, sizeof(u32));
|
|
||||||
LineBreak[linenum] = ch;
|
|
||||||
linenum++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
delete [] tmptext;
|
|
||||||
totalLines = linenum;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(w == SCROLL_HORIZONTAL) {
|
|
||||||
|
|
||||||
textScrollPos = 0;
|
|
||||||
textScrollInitialDelay = TEXT_SCROLL_INITIAL_DELAY;
|
|
||||||
textScrollDelay = TEXT_SCROLL_DELAY;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(textDyn)
|
|
||||||
{
|
|
||||||
delete [] textDyn;
|
|
||||||
textDyn = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(int i = 0; i < MAX_LINES_TO_DRAW; i++)
|
|
||||||
{
|
|
||||||
if(textDynRow[i])
|
|
||||||
{
|
|
||||||
delete [] textDynRow[i];
|
|
||||||
textDynRow[i] = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiText::SetColor(GXColor c)
|
void GuiText::SetColor(GXColor c)
|
||||||
@ -360,16 +198,17 @@ void GuiText::SetColor(GXColor c)
|
|||||||
alpha = c.a;
|
alpha = c.a;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiText::SetStyle(u16 s)
|
void GuiText::SetStyle(u16 s, u16 m/*=0xffff*/)
|
||||||
{
|
{
|
||||||
LOCK(this);
|
LOCK(this);
|
||||||
style = s;
|
style &= ~m;
|
||||||
|
style |= s & m;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiText::SetAlignment(int hor, int vert)
|
void GuiText::SetAlignment(int hor, int vert)
|
||||||
{
|
{
|
||||||
LOCK(this);
|
LOCK(this);
|
||||||
style = 0;
|
style = FTGX_NULL;
|
||||||
|
|
||||||
switch(hor)
|
switch(hor)
|
||||||
{
|
{
|
||||||
@ -399,74 +238,31 @@ void GuiText::SetAlignment(int hor, int vert)
|
|||||||
alignmentHor = hor;
|
alignmentHor = hor;
|
||||||
alignmentVert = vert;
|
alignmentVert = vert;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Set the Font
|
||||||
|
*/
|
||||||
|
void GuiText::SetFont(FreeTypeGX *f)
|
||||||
|
{
|
||||||
|
LOCK(this);
|
||||||
|
font = f;
|
||||||
|
}
|
||||||
|
|
||||||
int GuiText::GetTextWidth()
|
int GuiText::GetTextWidth()
|
||||||
{
|
{
|
||||||
|
LOCK(this);
|
||||||
if(!text)
|
if(!text)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return fontSystem[currentSize]->getWidth(text);
|
int newSize = size*this->GetScale();
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
if(newSize != currentSize || currentWidescreen != widescreen)
|
||||||
* Set the lines to draw
|
|
||||||
*/
|
|
||||||
void GuiText::SetFirstLine(int line)
|
|
||||||
{
|
|
||||||
LOCK(this);
|
|
||||||
firstLine = line;
|
|
||||||
|
|
||||||
for(int i = 0; i < MAX_LINES_TO_DRAW; i++)
|
|
||||||
{
|
{
|
||||||
if(textDynRow[i])
|
//fontSystem->changeSize(newSize);
|
||||||
{
|
(font ? font : fontSystem)->changeSize(newSize, widescreen ? newSize*0.8 : 0);
|
||||||
delete [] textDynRow[i];
|
currentSize = newSize;
|
||||||
textDynRow[i] = NULL;
|
currentWidescreen = widescreen;
|
||||||
}
|
}
|
||||||
}
|
return (font ? font : fontSystem)->getWidth(text);
|
||||||
}
|
|
||||||
|
|
||||||
void GuiText::SetLinesToDraw(int line)
|
|
||||||
{
|
|
||||||
LOCK(this);
|
|
||||||
linestodraw = line;
|
|
||||||
|
|
||||||
if(linestodraw >= MAX_LINES_TO_DRAW)
|
|
||||||
linestodraw = MAX_LINES_TO_DRAW-1;
|
|
||||||
|
|
||||||
for(int i = 0; i < MAX_LINES_TO_DRAW; i++)
|
|
||||||
{
|
|
||||||
if(textDynRow[i])
|
|
||||||
{
|
|
||||||
delete [] textDynRow[i];
|
|
||||||
textDynRow[i] = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int GuiText::GetTotalLines()
|
|
||||||
{
|
|
||||||
return totalLines-1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Change font
|
|
||||||
*/
|
|
||||||
bool GuiText::SetFont(const u8 *fontbuffer, const u32 filesize)
|
|
||||||
{
|
|
||||||
if(!fontbuffer || !filesize)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
LOCK(this);
|
|
||||||
if(font)
|
|
||||||
{
|
|
||||||
delete font;
|
|
||||||
font = NULL;
|
|
||||||
}
|
|
||||||
font = new FreeTypeGX(currentSize, false, (u8 *) fontbuffer, filesize);
|
|
||||||
textWidth = font->getWidth(text);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiText::SetWidescreen(bool w)
|
void GuiText::SetWidescreen(bool w)
|
||||||
@ -474,12 +270,12 @@ void GuiText::SetWidescreen(bool w)
|
|||||||
LOCK(this);
|
LOCK(this);
|
||||||
widescreen = w;
|
widescreen = w;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draw the text on screen
|
* Draw the text on screen
|
||||||
*/
|
*/
|
||||||
void GuiText::Draw()
|
void GuiText::Draw()
|
||||||
{
|
{
|
||||||
|
LOCK(this);
|
||||||
if(!text)
|
if(!text)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -491,196 +287,59 @@ void GuiText::Draw()
|
|||||||
|
|
||||||
int newSize = size*this->GetScale();
|
int newSize = size*this->GetScale();
|
||||||
|
|
||||||
if(newSize > MAX_FONT_SIZE)
|
if(newSize != currentSize || currentWidescreen != widescreen)
|
||||||
newSize = MAX_FONT_SIZE;
|
|
||||||
|
|
||||||
if(newSize != currentSize)
|
|
||||||
{
|
{
|
||||||
if(font)
|
//fontSystem->changeSize(newSize);
|
||||||
{
|
(font ? font : fontSystem)->changeSize(newSize, widescreen ? newSize*0.8 : 0);
|
||||||
font->ChangeFontSize(newSize);
|
|
||||||
}
|
|
||||||
else if(!fontSystem[newSize])
|
|
||||||
fontSystem[newSize] = new FreeTypeGX(newSize);
|
|
||||||
|
|
||||||
if(text)
|
|
||||||
textWidth = (font ? font : fontSystem[newSize])->getWidth(text);
|
|
||||||
currentSize = newSize;
|
currentSize = newSize;
|
||||||
|
currentWidescreen = widescreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(widescreen)
|
int voffset = 0;
|
||||||
(font ? font : fontSystem[currentSize])->ChangeFontSize(currentSize, currentSize*0.8);
|
|
||||||
|
|
||||||
if(maxWidth > 0 && maxWidth <= textWidth)
|
// if(alignmentVert == ALIGN_MIDDLE)
|
||||||
|
// voffset = -newSize/2 + 2;
|
||||||
|
|
||||||
|
if(maxWidth > 0 && (font ? font : fontSystem)->getWidth(text) > maxWidth)
|
||||||
{
|
{
|
||||||
if(wrapMode == LONGTEXT) // text wrapping
|
if(wrapMode == GuiText::WRAP) // text wrapping
|
||||||
{
|
{
|
||||||
int lineheight = newSize + 6;
|
int lineheight = newSize + 6;
|
||||||
if(!textDynRow[0])
|
|
||||||
{
|
|
||||||
int index = 0;
|
|
||||||
u32 strlen = (u32) wcslen(text);
|
|
||||||
int linenum = firstLine;
|
|
||||||
int lineIndex = 0;
|
|
||||||
u32 ch = LineBreak[linenum];
|
|
||||||
|
|
||||||
u32 lastch = LineBreak[linenum+linestodraw]+1;
|
|
||||||
|
|
||||||
textDynRow[lineIndex] = new wchar_t[maxWidth];
|
|
||||||
|
|
||||||
textDynRow[lineIndex][index] = 0;
|
|
||||||
|
|
||||||
while((ch < lastch) && (ch < strlen+1))
|
|
||||||
{
|
|
||||||
if(ch == LineBreak[linenum+1])
|
|
||||||
{
|
|
||||||
(font ? font : fontSystem[currentSize])->drawText(this->GetLeft(), this->GetTop()+lineIndex*lineheight, textDynRow[lineIndex], c, style);
|
|
||||||
linenum++;
|
|
||||||
lineIndex++;
|
|
||||||
index = 0;
|
|
||||||
if(!textDynRow[lineIndex])
|
|
||||||
textDynRow[lineIndex] = new wchar_t[maxWidth];
|
|
||||||
textDynRow[lineIndex][index] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
textDynRow[lineIndex][index] = text[ch];
|
|
||||||
textDynRow[lineIndex][index+1] = 0;
|
|
||||||
|
|
||||||
index++;
|
|
||||||
ch++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for(int i = 0; i < linestodraw; i++)
|
|
||||||
if(textDynRow[i])
|
|
||||||
(font ? font : fontSystem[currentSize])->drawText(this->GetLeft(), this->GetTop()+i*lineheight, textDynRow[i], c, style);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(wrapMode == DOTTED) // text dotted
|
|
||||||
{
|
|
||||||
if(!textDyn)
|
|
||||||
{
|
|
||||||
int strlen = wcslen(text);
|
int strlen = wcslen(text);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
textDyn = new wchar_t[maxWidth];
|
|
||||||
|
|
||||||
while(i < strlen)
|
|
||||||
{
|
|
||||||
textDyn[i] = text[i];
|
|
||||||
textDyn[i+1] = 0;
|
|
||||||
|
|
||||||
if((font ? font : fontSystem[currentSize])->getWidth(textDyn) >= maxWidth)
|
|
||||||
{
|
|
||||||
textDyn[i-3] = '.';
|
|
||||||
textDyn[i-2] = '.';
|
|
||||||
textDyn[i-1] = '.';
|
|
||||||
textDyn[i] = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(textDyn)
|
|
||||||
(font ? font : fontSystem[currentSize])->drawText(this->GetLeft(), this->GetTop(), textDyn, c, style);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(wrapMode == SCROLL_HORIZONTAL)
|
|
||||||
{
|
|
||||||
int strlen = wcslen(text);
|
|
||||||
|
|
||||||
int ch = 0;
|
|
||||||
if(!textDyn) {
|
|
||||||
textDyn = new wchar_t[maxWidth];
|
|
||||||
|
|
||||||
while(ch < strlen)
|
|
||||||
{
|
|
||||||
textDyn[ch] = text[ch];
|
|
||||||
textDyn[ch+1] = 0;
|
|
||||||
ch++;
|
|
||||||
|
|
||||||
if((font ? font : fontSystem[currentSize])->getWidth(textDyn) >= maxWidth)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(maxWidth < textWidth && (frameCount % textScrollDelay == 0))
|
|
||||||
{
|
|
||||||
if(textScrollInitialDelay)
|
|
||||||
{
|
|
||||||
textScrollInitialDelay--;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
textScrollPos++;
|
|
||||||
if(textScrollPos > strlen)
|
|
||||||
{
|
|
||||||
textScrollPos = 0;
|
|
||||||
textScrollInitialDelay = TEXT_SCROLL_INITIAL_DELAY;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ch = textScrollPos;
|
|
||||||
|
|
||||||
if(textDyn) {
|
|
||||||
delete [] textDyn;
|
|
||||||
textDyn = NULL;
|
|
||||||
}
|
|
||||||
textDyn = new wchar_t[maxWidth];
|
|
||||||
|
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
while(1)
|
|
||||||
{
|
|
||||||
if(ch > strlen-1) {
|
|
||||||
textDyn[i++] = ' ';
|
|
||||||
textDyn[i++] = ' ';
|
|
||||||
textDyn[i++] = ' ';
|
|
||||||
textDyn[i+1] = 0;
|
|
||||||
ch = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
textDyn[i] = text[ch];
|
|
||||||
textDyn[i+1] = 0;
|
|
||||||
ch++;
|
|
||||||
i++;
|
|
||||||
|
|
||||||
if((font ? font : fontSystem[currentSize])->getWidth(textDyn) >= maxWidth)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(textDyn)
|
|
||||||
(font ? font : fontSystem[currentSize])->drawText(this->GetLeft(), this->GetTop(), textDyn, c, style);
|
|
||||||
}
|
|
||||||
else if(wrapMode == WRAP)
|
|
||||||
{
|
|
||||||
int lineheight = newSize + 6;
|
|
||||||
if(!textDynRow[0])
|
|
||||||
{
|
|
||||||
int txtlen = wcslen(text);
|
|
||||||
int i = 0;
|
|
||||||
int ch = 0;
|
int ch = 0;
|
||||||
int linenum = 0;
|
int linenum = 0;
|
||||||
|
int linemax = 200;
|
||||||
int lastSpace = -1;
|
int lastSpace = -1;
|
||||||
int lastSpaceIndex = -1;
|
int lastSpaceIndex = -1;
|
||||||
|
wchar_t * tmptext[linemax];
|
||||||
|
|
||||||
while(ch < txtlen && linenum < MAX_LINES_TO_DRAW)
|
totalLines=0;
|
||||||
|
while(ch < strlen)
|
||||||
{
|
{
|
||||||
if(!textDynRow[linenum])
|
if(i == 0)
|
||||||
textDynRow[linenum] = new wchar_t[maxWidth];
|
|
||||||
|
|
||||||
textDynRow[linenum][i] = text[ch];
|
|
||||||
textDynRow[linenum][i+1] = 0;
|
|
||||||
|
|
||||||
if(text[ch] == ' ' || ch == txtlen-1)
|
|
||||||
{
|
{
|
||||||
if((font ? font : fontSystem[currentSize])->getWidth(textDynRow[linenum]) >= maxWidth)
|
if (linenum <= linemax)
|
||||||
|
{
|
||||||
|
tmptext[linenum] = new wchar_t[strlen + 1];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tmptext[linenum][i] = text[ch];
|
||||||
|
tmptext[linenum][i+1] = 0;
|
||||||
|
|
||||||
|
//if(text[ch] == ' ' || ch == strlen-1)
|
||||||
|
//{
|
||||||
|
if((font ? font : fontSystem)->getWidth(tmptext[linenum]) >= maxWidth)
|
||||||
|
//if(fontSystem->getWidth(tmptext[linenum]) >= maxWidth)
|
||||||
{
|
{
|
||||||
if(lastSpace >= 0)
|
if(lastSpace >= 0)
|
||||||
{
|
{
|
||||||
textDynRow[linenum][lastSpaceIndex] = 0; // discard space, and everything after
|
tmptext[linenum][lastSpaceIndex] = 0; // discard space, and everything after
|
||||||
ch = lastSpace; // go backwards to the last space
|
ch = lastSpace; // go backwards to the last space
|
||||||
lastSpace = -1; // we have used this space
|
lastSpace = -1; // we have used this space
|
||||||
lastSpaceIndex = -1;
|
lastSpaceIndex = -1;
|
||||||
@ -688,43 +347,186 @@ void GuiText::Draw()
|
|||||||
linenum++;
|
linenum++;
|
||||||
i = -1;
|
i = -1;
|
||||||
}
|
}
|
||||||
else if(ch == txtlen-1)
|
else if(ch == strlen-1)
|
||||||
{
|
{
|
||||||
linenum++;
|
linenum++;
|
||||||
}
|
}
|
||||||
}
|
//}
|
||||||
if(text[ch] == ' ' && i >= 0)
|
if(text[ch] == ' ' && i >= 0)
|
||||||
{
|
{
|
||||||
lastSpace = ch;
|
lastSpace = ch;
|
||||||
lastSpaceIndex = i;
|
lastSpaceIndex = i;
|
||||||
}
|
}
|
||||||
|
if(text[ch] == '\n' && ch != strlen-1 && i >= 0)
|
||||||
|
{
|
||||||
|
linenum++;
|
||||||
|
i = -1;
|
||||||
|
}
|
||||||
ch++;
|
ch++;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
linestodraw = linenum;
|
totalLines = linenum;
|
||||||
}
|
|
||||||
|
|
||||||
int voffset = 0;
|
|
||||||
if(alignmentVert == ALIGN_MIDDLE)
|
if(alignmentVert == ALIGN_MIDDLE)
|
||||||
voffset = -(lineheight*linestodraw)/2 + lineheight/2;
|
voffset = voffset - (lineheight*linenum)/2 + lineheight/2;
|
||||||
|
|
||||||
for(int i=0; i < linestodraw; i++)
|
if (numLines <0){
|
||||||
|
for(i=0; i < linenum; i++)
|
||||||
{
|
{
|
||||||
if(textDynRow[i])
|
(font ? font : fontSystem)->drawText(this->GetLeft(), this->GetTop()+voffset+i*lineheight, tmptext[i], c, style);
|
||||||
(font ? font : fontSystem[currentSize])->drawText(this->GetLeft(), this->GetTop()+voffset+i*lineheight, textDynRow[i], c, style);
|
delete tmptext[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//put in for txt vertical txt scrolling
|
||||||
|
else {
|
||||||
|
int j;
|
||||||
|
i=0;
|
||||||
|
for(j=firstLine-1; j < numLines+firstLine-1; j++)
|
||||||
|
{
|
||||||
|
//if (j<linenum-(firstLine-1))
|
||||||
|
if (j < linenum)
|
||||||
|
(font ? font : fontSystem)->drawText(this->GetLeft(), this->GetTop()+voffset+i*lineheight, tmptext[j], c, style);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
for(i=0; i < linenum; i++)
|
||||||
|
{
|
||||||
|
delete tmptext[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else if(wrapMode == GuiText::DOTTED) // text dotted
|
||||||
|
{
|
||||||
|
wchar_t save[4];
|
||||||
|
int strlen = wcslen(text);
|
||||||
|
int dotPos=strlen-3;
|
||||||
|
int i;
|
||||||
|
bool drawed = false;
|
||||||
|
while(dotPos > 0 && drawed == false)
|
||||||
|
{
|
||||||
|
for(i=0; i<4; i++) // save Text for "..."
|
||||||
|
{
|
||||||
|
save[i] = text[dotPos+i];
|
||||||
|
text[dotPos+i] = (i != 3 ? _TEXT('.') : 0);
|
||||||
|
}
|
||||||
|
if(((font ? font : fontSystem)->getWidth(text)) <= maxWidth)
|
||||||
|
{
|
||||||
|
(font ? font : fontSystem)->drawText(this->GetLeft(), this->GetTop()+voffset, text, c, style);
|
||||||
|
drawed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i=0; i<4; i++) // write saved Text back
|
||||||
|
text[dotPos+i] = save[i];
|
||||||
|
dotPos--;
|
||||||
|
}
|
||||||
|
if(!drawed)
|
||||||
|
(font ? font : fontSystem)->drawText(this->GetLeft(), this->GetTop()+voffset, text, c, style);
|
||||||
|
}
|
||||||
|
else if(wrapMode == GuiText::SCROLL) // text scroller
|
||||||
|
{
|
||||||
|
wchar_t save;
|
||||||
|
|
||||||
|
if(scrollPos2 == 0 || frameCount > scrollDelay+5)
|
||||||
|
{
|
||||||
|
scrollPos1 = 0;
|
||||||
|
scrollOffset = 0;
|
||||||
|
for(scrollPos2 = wcslen(text); scrollPos2 > 1; scrollPos2--)
|
||||||
|
{
|
||||||
|
save = text[scrollPos2]; // save Pos2
|
||||||
|
text[scrollPos2] = 0;
|
||||||
|
int textWidth = (font ? font : fontSystem)->getWidth(text);
|
||||||
|
text[scrollPos2] = save; // restore Pos2
|
||||||
|
if(textWidth <= maxWidth)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
scrollDelay = frameCount+50; // wait 50 Frames before beginning with scrolling
|
||||||
|
}
|
||||||
|
else if(scrollPos2 > 0 && frameCount >= scrollDelay)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(--scrollOffset < 0)
|
||||||
|
{
|
||||||
|
wchar_t tmp[] = { text[scrollPos1], text[scrollPos1+1], 0 };
|
||||||
|
scrollOffset += (font ? font : fontSystem)->getWidth(tmp) - (font ? font : fontSystem)->getWidth(tmp+1);
|
||||||
|
scrollPos1++;
|
||||||
|
}
|
||||||
|
|
||||||
|
int strlen = wcslen(text);
|
||||||
|
for(; scrollPos2 < strlen; scrollPos2++)
|
||||||
|
{
|
||||||
|
save = text[scrollPos2+1]; // save Pos2
|
||||||
|
text[scrollPos2+1] = 0;
|
||||||
|
int textWidth = (font ? font : fontSystem)->getWidth(&text[scrollPos1]);
|
||||||
|
text[scrollPos2+1] = save; // restore Pos2
|
||||||
|
if(textWidth+scrollOffset > maxWidth)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(scrollPos2 == strlen)
|
||||||
|
{
|
||||||
|
scrollPos2 = -scrollPos2;
|
||||||
|
scrollDelay = frameCount+25; // when dir-change wait 25 Frames
|
||||||
|
}
|
||||||
|
else
|
||||||
|
scrollDelay = frameCount+1; // wait 1 Frames
|
||||||
|
}
|
||||||
|
else if(frameCount >= scrollDelay)
|
||||||
|
{
|
||||||
|
scrollPos2 = -scrollPos2;
|
||||||
|
|
||||||
|
scrollOffset++;
|
||||||
|
wchar_t tmp[] = { text[scrollPos1-1], text[scrollPos1], 0 };
|
||||||
|
int tmpOffset = (font ? font : fontSystem)->getWidth(tmp) - (font ? font : fontSystem)->getWidth(tmp+1);
|
||||||
|
if(scrollOffset >= tmpOffset)
|
||||||
|
{
|
||||||
|
scrollOffset -= tmpOffset;
|
||||||
|
scrollPos1--;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(; scrollPos2 > scrollPos1; scrollPos2--)
|
||||||
|
{
|
||||||
|
save = text[scrollPos2]; // save Pos2
|
||||||
|
text[scrollPos2] = 0;
|
||||||
|
int textWidth = (font ? font : fontSystem)->getWidth(&text[scrollPos1]);
|
||||||
|
text[scrollPos2] = save; // restore Pos2
|
||||||
|
if(textWidth+scrollOffset <= maxWidth)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(scrollPos1 == 0)
|
||||||
|
{
|
||||||
|
scrollPos2 = -scrollPos2;
|
||||||
|
scrollDelay = frameCount+25; // when dir-change wait 25 Frames
|
||||||
|
}
|
||||||
|
else
|
||||||
|
scrollDelay = frameCount+1; // wait 10 Frames
|
||||||
|
|
||||||
|
scrollPos2 = -scrollPos2;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t drawStyle = style;
|
||||||
|
uint16_t drawX = this->GetLeft() + scrollOffset;
|
||||||
|
|
||||||
|
if((drawStyle & FTGX_JUSTIFY_MASK) == FTGX_JUSTIFY_CENTER)
|
||||||
|
{
|
||||||
|
drawStyle = (drawStyle & ~FTGX_JUSTIFY_MASK) | FTGX_JUSTIFY_LEFT;
|
||||||
|
drawX -= maxWidth >> 1;
|
||||||
|
}
|
||||||
|
else if((drawStyle & FTGX_JUSTIFY_MASK) == FTGX_JUSTIFY_RIGHT)
|
||||||
|
{
|
||||||
|
drawStyle = (drawStyle & ~FTGX_JUSTIFY_MASK) | FTGX_JUSTIFY_LEFT;
|
||||||
|
drawX -= maxWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
save = text[abs(scrollPos2)]; // save Pos2
|
||||||
|
text[abs(scrollPos2)] = 0;
|
||||||
|
(font ? font : fontSystem)->drawText(drawX, this->GetTop()+voffset, &text[scrollPos1], c, drawStyle);
|
||||||
|
text[abs(scrollPos2)] = save; // restore Pos2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
(font ? font : fontSystem[currentSize])->drawText(this->GetLeft(), this->GetTop(), text, c, style);
|
(font ? font : fontSystem)->drawText(this->GetLeft(), this->GetTop()+voffset, text, c, style);
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
(font ? font : fontSystem[currentSize])->drawText(this->GetLeft(), this->GetTop(), text, c, style);
|
|
||||||
}
|
}
|
||||||
this->UpdateEffects();
|
this->UpdateEffects();
|
||||||
|
|
||||||
if(widescreen)
|
|
||||||
(font ? font : fontSystem[currentSize])->ChangeFontSize(currentSize, 0);
|
|
||||||
}
|
}
|
||||||
|
@ -41,10 +41,18 @@
|
|||||||
#define CONSOLE_WIDTH 340
|
#define CONSOLE_WIDTH 340
|
||||||
#define CONSOLE_HEIGHT 218
|
#define CONSOLE_HEIGHT 218
|
||||||
|
|
||||||
|
FreeTypeGX *fontSystem=0;
|
||||||
|
FreeTypeGX *fontClock=0;
|
||||||
|
|
||||||
static void BootUpProblems()
|
static void BootUpProblems()
|
||||||
{
|
{
|
||||||
s32 ret2;
|
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);
|
GuiImageData bootimageData(gxlogo_png);
|
||||||
GuiImage bootimage(&bootimageData);
|
GuiImage bootimage(&bootimageData);
|
||||||
GuiText boottext(NULL, 20, (GXColor) {255, 255, 255, 255});
|
GuiText boottext(NULL, 20, (GXColor) {255, 255, 255, 255});
|
||||||
@ -103,6 +111,12 @@ static void BootUpProblems()
|
|||||||
Menu_Render();
|
Menu_Render();
|
||||||
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
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");
|
setlocale(LC_ALL, "en.UTF-8");
|
||||||
|
|
||||||
for(int i = 0; i < MAX_FONT_SIZE+1; i++)
|
|
||||||
fontSystem[i] = NULL;
|
|
||||||
|
|
||||||
s32 ret;
|
s32 ret;
|
||||||
bool startupproblem = false;
|
bool startupproblem = false;
|
||||||
|
|
||||||
@ -230,11 +241,18 @@ main(int argc, char *argv[]) {
|
|||||||
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
|
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
|
||||||
WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight);
|
WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight);
|
||||||
|
|
||||||
|
// load main font from file, or default to built-in font
|
||||||
|
fontSystem = new FreeTypeGX();
|
||||||
char *fontPath = NULL;
|
char *fontPath = NULL;
|
||||||
asprintf(&fontPath, "%sfont.ttf", CFG.theme_path);
|
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);
|
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();
|
InitGUIThreads();
|
||||||
MainMenu(MENU_CHECK);
|
MainMenu(MENU_CHECK);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -8,8 +8,11 @@
|
|||||||
#ifndef _MAIN_H_
|
#ifndef _MAIN_H_
|
||||||
#define _MAIN_H_
|
#define _MAIN_H_
|
||||||
|
|
||||||
|
#include "FreeTypeGX.h"
|
||||||
|
|
||||||
extern struct SSettings Settings;
|
extern struct SSettings Settings;
|
||||||
|
|
||||||
void DefaultSettings();
|
void DefaultSettings();
|
||||||
|
extern FreeTypeGX *fontSystem;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -329,7 +329,6 @@ int MenuDiscList() {
|
|||||||
int dataed = -1;
|
int dataed = -1;
|
||||||
int cosa=0,sina=0;
|
int cosa=0,sina=0;
|
||||||
int selectImg1 = 0;
|
int selectImg1 = 0;
|
||||||
bool firstRun = true;
|
|
||||||
char ID[4];
|
char ID[4];
|
||||||
char IDfull[7];
|
char IDfull[7];
|
||||||
u32 covert = 0;
|
u32 covert = 0;
|
||||||
@ -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});
|
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.SetAlignment(THEME.clock_align, ALIGN_TOP);
|
||||||
clockTimeBack.SetPosition(THEME.clock_x, THEME.clock_y);
|
clockTimeBack.SetPosition(THEME.clock_x, THEME.clock_y);
|
||||||
clockTimeBack.SetFont(clock_ttf, clock_ttf_size);
|
clockTimeBack.SetFont(fontClock);
|
||||||
GuiText clockTime(theTime, 40, THEME.clock);
|
GuiText clockTime(theTime, 40, THEME.clock);
|
||||||
clockTime.SetAlignment(THEME.clock_align, ALIGN_TOP);
|
clockTime.SetAlignment(THEME.clock_align, ALIGN_TOP);
|
||||||
clockTime.SetPosition(THEME.clock_x, THEME.clock_y);
|
clockTime.SetPosition(THEME.clock_x, THEME.clock_y);
|
||||||
clockTime.SetFont(clock_ttf, clock_ttf_size);
|
clockTime.SetFont(fontClock);
|
||||||
|
|
||||||
HaltGui();
|
HaltGui();
|
||||||
GuiWindow w(screenwidth, screenheight);
|
GuiWindow w(screenwidth, screenheight);
|
||||||
@ -892,11 +891,7 @@ int MenuDiscList() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//CLOCK update every 10 secs
|
//CLOCK
|
||||||
if(frameCount % 600 == 0 || firstRun)
|
|
||||||
{
|
|
||||||
firstRun = false;
|
|
||||||
|
|
||||||
time_t rawtime = time(0); //this fixes code dump caused by the clock
|
time_t rawtime = time(0); //this fixes code dump caused by the clock
|
||||||
if (((Settings.hddinfo == hr12)||(Settings.hddinfo == hr24)) && rawtime != lastrawtime) {
|
if (((Settings.hddinfo == hr12)||(Settings.hddinfo == hr24)) && rawtime != lastrawtime) {
|
||||||
lastrawtime = rawtime;
|
lastrawtime = rawtime;
|
||||||
@ -921,7 +916,6 @@ int MenuDiscList() {
|
|||||||
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);}}
|
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
|
// respond to button presses
|
||||||
@ -1239,6 +1233,7 @@ int MenuDiscList() {
|
|||||||
else if (countBtn.GetState() == STATE_CLICKED) {
|
else if (countBtn.GetState() == STATE_CLICKED) {
|
||||||
if (Settings.sort != pcount) {
|
if (Settings.sort != pcount) {
|
||||||
Settings.sort=pcount;
|
Settings.sort=pcount;
|
||||||
|
//if(isSdInserted()) {
|
||||||
if (isInserted(bootDevice)) {
|
if (isInserted(bootDevice)) {
|
||||||
cfg_save_global();
|
cfg_save_global();
|
||||||
}
|
}
|
||||||
@ -2208,9 +2203,10 @@ int MainMenu(int menu) {
|
|||||||
delete GameIDTxt;
|
delete GameIDTxt;
|
||||||
delete cover;
|
delete cover;
|
||||||
delete coverImg;
|
delete coverImg;
|
||||||
|
delete fontClock;
|
||||||
|
delete fontSystem;
|
||||||
ShutdownAudio();
|
ShutdownAudio();
|
||||||
StopGX();
|
StopGX();
|
||||||
ClearFontData();
|
|
||||||
gettextCleanUp();
|
gettextCleanUp();
|
||||||
if (mountMethod==3)
|
if (mountMethod==3)
|
||||||
{
|
{
|
||||||
|
@ -161,7 +161,7 @@ int DiscBrowse(struct discHdr * header) {
|
|||||||
GuiText titleTxt(get_title(header), 28, (GXColor) {0, 0, 0, 255});
|
GuiText titleTxt(get_title(header), 28, (GXColor) {0, 0, 0, 255});
|
||||||
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||||
titleTxt.SetPosition(12,40);
|
titleTxt.SetPosition(12,40);
|
||||||
titleTxt.SetMaxWidth(356, SCROLL_HORIZONTAL);
|
titleTxt.SetMaxWidth(356, GuiText::SCROLL);
|
||||||
|
|
||||||
GuiImage settingsbackground(&settingsbg);
|
GuiImage settingsbackground(&settingsbg);
|
||||||
GuiButton settingsbackgroundbtn(settingsbackground.GetWidth(), settingsbackground.GetHeight());
|
GuiButton settingsbackgroundbtn(settingsbackground.GetWidth(), settingsbackground.GetHeight());
|
||||||
|
@ -30,7 +30,6 @@ static int showProgress = 0;
|
|||||||
static f32 progressDone = 0.0;
|
static f32 progressDone = 0.0;
|
||||||
static bool showTime = false;
|
static bool showTime = false;
|
||||||
static bool showSize = false;
|
static bool showSize = false;
|
||||||
static bool changed = true;
|
|
||||||
static s32 gameinstalldone = 0;
|
static s32 gameinstalldone = 0;
|
||||||
static s32 gameinstalltotal = -1;
|
static s32 gameinstalltotal = -1;
|
||||||
static time_t start;
|
static time_t start;
|
||||||
@ -53,13 +52,8 @@ static void GameInstallProgress() {
|
|||||||
if (gameinstalltotal <= 0)
|
if (gameinstalltotal <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int oldinstalldone = gameinstalldone;
|
|
||||||
|
|
||||||
GetProgressValue(&gameinstalldone, &gameinstalltotal);
|
GetProgressValue(&gameinstalldone, &gameinstalltotal);
|
||||||
|
|
||||||
if((oldinstalldone == gameinstalldone) && (gameinstalldone > 0))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (gameinstalldone > gameinstalltotal)
|
if (gameinstalldone > gameinstalltotal)
|
||||||
gameinstalldone = gameinstalltotal;
|
gameinstalldone = gameinstalltotal;
|
||||||
|
|
||||||
@ -95,7 +89,6 @@ static void GameInstallProgress() {
|
|||||||
snprintf(progressSizeLeft, sizeof(progressSizeLeft), "%.2fGB/%.2fGB", gamesize * gameinstalldone/gameinstalltotal, gamesize);
|
snprintf(progressSizeLeft, sizeof(progressSizeLeft), "%.2fGB/%.2fGB", gamesize * gameinstalldone/gameinstalltotal, gamesize);
|
||||||
snprintf(progressSpeed, sizeof(progressSpeed), "%.1fMB/s", speed);
|
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);
|
msg1Txt.SetPosition(0,120);
|
||||||
else
|
else
|
||||||
msg1Txt.SetPosition(0,100);
|
msg1Txt.SetPosition(0,100);
|
||||||
msg1Txt.SetMaxWidth(430, DOTTED);
|
msg1Txt.SetMaxWidth(430, GuiText::DOTTED);
|
||||||
|
|
||||||
GuiText msg2Txt(msg2, 22, THEME.prompttext );
|
GuiText msg2Txt(msg2, 22, THEME.prompttext );
|
||||||
msg2Txt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
msg2Txt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||||
msg2Txt.SetPosition(0,125);
|
msg2Txt.SetPosition(0,125);
|
||||||
msg2Txt.SetMaxWidth(430, DOTTED);
|
msg2Txt.SetMaxWidth(430, GuiText::DOTTED);
|
||||||
|
|
||||||
GuiText prsTxt("%", 22, THEME.prompttext);
|
GuiText prsTxt("%", 22, THEME.prompttext);
|
||||||
prsTxt.SetAlignment(ALIGN_RIGHT, ALIGN_MIDDLE);
|
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.SetPosition(80,40);
|
||||||
progressbarEmptyImg.SetTile(78);
|
progressbarEmptyImg.SetTile(78);
|
||||||
progressbarImg.SetPosition(80, 40);
|
progressbarImg.SetPosition(80, 40);
|
||||||
msg1Txt.SetMaxWidth(380, DOTTED);
|
msg1Txt.SetMaxWidth(380, GuiText::DOTTED);
|
||||||
msg2Txt.SetMaxWidth(380, DOTTED);
|
msg2Txt.SetMaxWidth(380, GuiText::DOTTED);
|
||||||
|
|
||||||
timeTxt.SetPosition(250,-50);
|
timeTxt.SetPosition(250,-50);
|
||||||
timeTxt.SetFontSize(20);
|
timeTxt.SetFontSize(20);
|
||||||
@ -253,13 +246,9 @@ static void ProgressWindow(const char *title, const char *msg1, const char *msg2
|
|||||||
while (showProgress) {
|
while (showProgress) {
|
||||||
|
|
||||||
VIDEO_WaitVSync ();
|
VIDEO_WaitVSync ();
|
||||||
|
usleep(20000);
|
||||||
|
|
||||||
GameInstallProgress();
|
GameInstallProgress();
|
||||||
|
|
||||||
if(changed)
|
|
||||||
{
|
|
||||||
changed = false;
|
|
||||||
|
|
||||||
tmp = static_cast<int>(progressbarImg.GetWidth()*progressDone);
|
tmp = static_cast<int>(progressbarImg.GetWidth()*progressDone);
|
||||||
|
|
||||||
if (CFG.widescreen && Settings.wsprompt == yes)
|
if (CFG.widescreen && Settings.wsprompt == yes)
|
||||||
@ -280,7 +269,6 @@ static void ProgressWindow(const char *title, const char *msg1, const char *msg2
|
|||||||
if (msg2)
|
if (msg2)
|
||||||
msg2Txt.SetText(dyn_message);
|
msg2Txt.SetText(dyn_message);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
|
promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
|
||||||
while (promptWindow.GetEffect() > 0) usleep(100);
|
while (promptWindow.GetEffect() > 0) usleep(100);
|
||||||
@ -386,7 +374,6 @@ void ShowProgress(const char *title, const char *msg1, char *dynmsg2, f32 done,
|
|||||||
|
|
||||||
showProgress = 1;
|
showProgress = 1;
|
||||||
progressDone = 100.0*done/total;
|
progressDone = 100.0*done/total;
|
||||||
changed = true;
|
|
||||||
|
|
||||||
LWP_ResumeThread(progressthread);
|
LWP_ResumeThread(progressthread);
|
||||||
}
|
}
|
||||||
@ -397,7 +384,7 @@ void ShowProgress(const char *title, const char *msg1, char *dynmsg2, f32 done,
|
|||||||
* Startup Progressthread in idle prio
|
* Startup Progressthread in idle prio
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void InitProgressThread() {
|
void InitProgressThread() {
|
||||||
LWP_CreateThread(&progressthread, ProgressThread, NULL, NULL, 0, 80);
|
LWP_CreateThread(&progressthread, ProgressThread, NULL, NULL, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -216,7 +216,7 @@ void WindowCredits() {
|
|||||||
i++;
|
i++;
|
||||||
y+=28;
|
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] = new GuiText(tr("Coding:"));
|
||||||
txt[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
txt[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||||
@ -1063,7 +1063,7 @@ int GameWindowPrompt() {
|
|||||||
GuiText nameTxt("", 22, THEME.prompttext);
|
GuiText nameTxt("", 22, THEME.prompttext);
|
||||||
if (Settings.wsprompt == yes)
|
if (Settings.wsprompt == yes)
|
||||||
nameTxt.SetWidescreen(CFG.widescreen);
|
nameTxt.SetWidescreen(CFG.widescreen);
|
||||||
nameTxt.SetMaxWidth(350, SCROLL_HORIZONTAL);
|
nameTxt.SetMaxWidth(350, GuiText::SCROLL);
|
||||||
GuiButton nameBtn(120,50);
|
GuiButton nameBtn(120,50);
|
||||||
nameBtn.SetLabel(&nameTxt);
|
nameBtn.SetLabel(&nameTxt);
|
||||||
// nameBtn.SetLabelOver(&nameTxt);
|
// nameBtn.SetLabelOver(&nameTxt);
|
||||||
@ -1819,7 +1819,7 @@ bool SearchMissingImages(int choice2) {
|
|||||||
__Menu_GetEntries();
|
__Menu_GetEntries();
|
||||||
ResumeGui();
|
ResumeGui();
|
||||||
|
|
||||||
if (cntMissFiles > 0) {
|
if (cntMissFiles > 0) { //&& !IsNetworkInit()) {
|
||||||
NetworkInitPrompt();
|
NetworkInitPrompt();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3296,7 +3296,7 @@ HBCWindowPrompt(const char *name, const char *coder, const char *version,
|
|||||||
GuiText nameTxt(name,30 , THEME.prompttext);
|
GuiText nameTxt(name,30 , THEME.prompttext);
|
||||||
nameTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
nameTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||||
nameTxt.SetPosition(0,-15);
|
nameTxt.SetPosition(0,-15);
|
||||||
nameTxt.SetMaxWidth(430, SCROLL_HORIZONTAL);
|
nameTxt.SetMaxWidth(430, GuiText::SCROLL);
|
||||||
|
|
||||||
|
|
||||||
if (strcmp(coder,""))
|
if (strcmp(coder,""))
|
||||||
@ -3321,16 +3321,11 @@ HBCWindowPrompt(const char *name, const char *coder, const char *version,
|
|||||||
release_dateTxt.SetMaxWidth(430);
|
release_dateTxt.SetMaxWidth(430);
|
||||||
|
|
||||||
int pagesize = 6;
|
int pagesize = 6;
|
||||||
int currentLine = 0;
|
|
||||||
|
|
||||||
GuiText long_descriptionTxt(long_description, 20, THEME.prompttext);
|
GuiText long_descriptionTxt(long_description, 20, THEME.prompttext);
|
||||||
long_descriptionTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
long_descriptionTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||||
long_descriptionTxt.SetPosition(46,117);
|
long_descriptionTxt.SetPosition(46,117);
|
||||||
long_descriptionTxt.SetMaxWidth(360, LONGTEXT);
|
long_descriptionTxt.SetMaxWidth(360);
|
||||||
long_descriptionTxt.SetLinesToDraw(pagesize);
|
long_descriptionTxt.SetNumLines(pagesize);
|
||||||
long_descriptionTxt.SetFirstLine(currentLine);
|
|
||||||
|
|
||||||
int TotalLines = long_descriptionTxt.GetTotalLines();
|
|
||||||
|
|
||||||
//convert filesize from u64 to char and put unit of measurement after it
|
//convert filesize from u64 to char and put unit of measurement after it
|
||||||
char temp2[7];
|
char temp2[7];
|
||||||
@ -3422,24 +3417,18 @@ HBCWindowPrompt(const char *name, const char *coder, const char *version,
|
|||||||
} else if (btn2.GetState() == STATE_CLICKED) {
|
} else if (btn2.GetState() == STATE_CLICKED) {
|
||||||
choice = 0;
|
choice = 0;
|
||||||
} else if ((arrowUpBtn.GetState()==STATE_CLICKED||arrowUpBtn.GetState()==STATE_HELD) ) {
|
} else if ((arrowUpBtn.GetState()==STATE_CLICKED||arrowUpBtn.GetState()==STATE_HELD) ) {
|
||||||
currentLine--;
|
if (long_descriptionTxt.GetFirstLine()>1)
|
||||||
if(currentLine+pagesize > TotalLines)
|
long_descriptionTxt.SetFirstLine(long_descriptionTxt.GetFirstLine()-1);
|
||||||
currentLine = TotalLines-pagesize;
|
|
||||||
if(currentLine < 0)
|
|
||||||
currentLine = 0;
|
|
||||||
|
|
||||||
long_descriptionTxt.SetFirstLine(currentLine);
|
|
||||||
usleep(60000);
|
usleep(60000);
|
||||||
if (!((ButtonsHold() & WPAD_BUTTON_UP)||(ButtonsHold() & PAD_BUTTON_UP)))
|
if (!((ButtonsHold() & WPAD_BUTTON_UP)||(ButtonsHold() & PAD_BUTTON_UP)))
|
||||||
arrowUpBtn.ResetState();
|
arrowUpBtn.ResetState();
|
||||||
} else if (arrowDownBtn.GetState()==STATE_CLICKED||arrowDownBtn.GetState()==STATE_HELD) {
|
} else if ((arrowDownBtn.GetState()==STATE_CLICKED||arrowDownBtn.GetState()==STATE_HELD)
|
||||||
currentLine++;
|
&&long_descriptionTxt.GetTotalLines()>pagesize
|
||||||
if(currentLine+pagesize > TotalLines)
|
&&long_descriptionTxt.GetFirstLine()-1<long_descriptionTxt.GetTotalLines()-pagesize) {
|
||||||
currentLine = TotalLines-pagesize;
|
int l=0;
|
||||||
if(currentLine < 0)
|
l=long_descriptionTxt.GetFirstLine()+1;
|
||||||
currentLine = 0;
|
|
||||||
|
|
||||||
long_descriptionTxt.SetFirstLine(currentLine);
|
long_descriptionTxt.SetFirstLine(l);
|
||||||
usleep(60000);
|
usleep(60000);
|
||||||
if (!((ButtonsHold() & WPAD_BUTTON_DOWN)||(ButtonsHold() & PAD_BUTTON_DOWN)))
|
if (!((ButtonsHold() & WPAD_BUTTON_DOWN)||(ButtonsHold() & PAD_BUTTON_DOWN)))
|
||||||
arrowDownBtn.ResetState();
|
arrowDownBtn.ResetState();
|
||||||
|
@ -250,7 +250,7 @@ int TitleBrowser(u32 type) {
|
|||||||
GuiText titleTxt(tr("Title Launcher"), 28, (GXColor) {0, 0, 0, 255});
|
GuiText titleTxt(tr("Title Launcher"), 28, (GXColor) {0, 0, 0, 255});
|
||||||
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||||
titleTxt.SetPosition(12,40);
|
titleTxt.SetPosition(12,40);
|
||||||
titleTxt.SetMaxWidth(356, SCROLL_HORIZONTAL);
|
titleTxt.SetMaxWidth(356, GuiText::SCROLL);
|
||||||
|
|
||||||
GuiImage settingsbackground(&settingsbg);
|
GuiImage settingsbackground(&settingsbg);
|
||||||
GuiButton settingsbackgroundbtn(settingsbackground.GetWidth(), settingsbackground.GetHeight());
|
GuiButton settingsbackgroundbtn(settingsbackground.GetWidth(), settingsbackground.GetHeight());
|
||||||
|
@ -366,7 +366,7 @@ int BrowseDevice(char * Path, int Path_size, int Flags, FILTERCASCADE *Filter/*=
|
|||||||
AdressText.SetTextf("%s%s", browser->rootdir, browser->dir);
|
AdressText.SetTextf("%s%s", browser->rootdir, browser->dir);
|
||||||
AdressText.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
AdressText.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
AdressText.SetPosition(20, 0);
|
AdressText.SetPosition(20, 0);
|
||||||
AdressText.SetMaxWidth(Address.GetWidth()-40, SCROLL_HORIZONTAL);
|
AdressText.SetMaxWidth(Address.GetWidth()-40, GuiText::SCROLL);
|
||||||
GuiImage AdressbarImg(&Address);
|
GuiImage AdressbarImg(&Address);
|
||||||
GuiButton Adressbar(Address.GetWidth(), Address.GetHeight());
|
GuiButton Adressbar(Address.GetWidth(), Address.GetHeight());
|
||||||
Adressbar.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
Adressbar.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||||
|
@ -596,7 +596,7 @@ int showGameInfo(char *ID) {
|
|||||||
if (strcmp(gameinfo.title,"") != 0) {
|
if (strcmp(gameinfo.title,"") != 0) {
|
||||||
snprintf(linebuf, sizeof(linebuf), "%s",gameinfo.title);
|
snprintf(linebuf, sizeof(linebuf), "%s",gameinfo.title);
|
||||||
titleTxt = new GuiText(linebuf, titlefontsize, (GXColor) {0,0,0, 255});
|
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); }
|
//while (titleTxt->GetWidth()>250) { titleTxt->SetFontSize(titlefontsize-=2); }
|
||||||
titleTxt->SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
titleTxt->SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||||
titleTxt->SetPosition(txtXOffset,12+titley);
|
titleTxt->SetPosition(txtXOffset,12+titley);
|
||||||
@ -664,7 +664,7 @@ int showGameInfo(char *ID) {
|
|||||||
snprintf(linebuf, sizeof(linebuf), "%s %s", tr("Published by"), gameinfo.publisher);
|
snprintf(linebuf, sizeof(linebuf), "%s %s", tr("Published by"), gameinfo.publisher);
|
||||||
publisherTxt = new GuiText(linebuf, 16, (GXColor) {0,0,0, 255});
|
publisherTxt = new GuiText(linebuf, 16, (GXColor) {0,0,0, 255});
|
||||||
if (publisherTxt->GetWidth()>250) newline=2;
|
if (publisherTxt->GetWidth()>250) newline=2;
|
||||||
publisherTxt->SetMaxWidth(250, WRAP);
|
publisherTxt->SetMaxWidth(250,GuiText::WRAP);
|
||||||
publisherTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
|
publisherTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
|
||||||
publisherTxt->SetPosition(-17,12+indexy);
|
publisherTxt->SetPosition(-17,12+indexy);
|
||||||
indexy+=(20 * newline);
|
indexy+=(20 * newline);
|
||||||
@ -677,7 +677,7 @@ int showGameInfo(char *ID) {
|
|||||||
snprintf(linebuf, sizeof(linebuf), "%s %s", tr("Developed by"), gameinfo.developer);
|
snprintf(linebuf, sizeof(linebuf), "%s %s", tr("Developed by"), gameinfo.developer);
|
||||||
developerTxt = new GuiText(linebuf, 16, (GXColor) {0,0,0, 255});
|
developerTxt = new GuiText(linebuf, 16, (GXColor) {0,0,0, 255});
|
||||||
if (developerTxt->GetWidth()>250) newline=2;
|
if (developerTxt->GetWidth()>250) newline=2;
|
||||||
developerTxt->SetMaxWidth(250, WRAP);
|
developerTxt->SetMaxWidth(250,GuiText::WRAP);
|
||||||
developerTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
|
developerTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
|
||||||
developerTxt->SetPosition(-17,12+indexy);
|
developerTxt->SetPosition(-17,12+indexy);
|
||||||
indexy+=(20 * newline);
|
indexy+=(20 * newline);
|
||||||
@ -721,17 +721,14 @@ int showGameInfo(char *ID) {
|
|||||||
|
|
||||||
//synopsis
|
//synopsis
|
||||||
int pagesize=12;
|
int pagesize=12;
|
||||||
int currentLine = 0;
|
|
||||||
int TotalLines = 0;
|
|
||||||
if (strcmp(gameinfo.synopsis,"") != 0) {
|
if (strcmp(gameinfo.synopsis,"") != 0) {
|
||||||
snprintf(linebuf, sizeof(linebuf), "%s", gameinfo.synopsis);
|
snprintf(linebuf, sizeof(linebuf), "%s", gameinfo.synopsis);
|
||||||
synopsisTxt = new GuiText(linebuf, 16, (GXColor) {0,0,0, 255});
|
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->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||||
synopsisTxt->SetPosition(0,0);
|
synopsisTxt->SetPosition(0,0);
|
||||||
synopsisTxt->SetLinesToDraw(pagesize);
|
synopsisTxt->SetNumLines(pagesize);
|
||||||
synopsisTxt->SetFirstLine(0);
|
//synopsisTxt->SetFirstLine(12);
|
||||||
TotalLines = synopsisTxt->GetTotalLines();
|
|
||||||
|
|
||||||
dialogBoxImg11 = new GuiImage(&dialogBox1);
|
dialogBoxImg11 = new GuiImage(&dialogBox1);
|
||||||
dialogBoxImg11->SetAlignment(0,3);
|
dialogBoxImg11->SetAlignment(0,3);
|
||||||
@ -852,24 +849,23 @@ int showGameInfo(char *ID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else if ((upBtn.GetState()==STATE_CLICKED||upBtn.GetState()==STATE_HELD) && page==2) {
|
} else if ((upBtn.GetState()==STATE_CLICKED||upBtn.GetState()==STATE_HELD) && page==2) {
|
||||||
currentLine--;
|
//int l=synopsisTxt->GetFirstLine()-1;
|
||||||
if(currentLine+pagesize > TotalLines)
|
if (synopsisTxt->GetFirstLine()>1)
|
||||||
currentLine = TotalLines-pagesize;
|
synopsisTxt->SetFirstLine(synopsisTxt->GetFirstLine()-1);
|
||||||
if(currentLine < 0)
|
|
||||||
currentLine = 0;
|
|
||||||
|
|
||||||
synopsisTxt->SetFirstLine(currentLine);
|
|
||||||
usleep(60000);
|
usleep(60000);
|
||||||
if (!((ButtonsHold() & WPAD_BUTTON_UP)||(ButtonsHold() & PAD_BUTTON_UP)))
|
if (!((ButtonsHold() & WPAD_BUTTON_UP)||(ButtonsHold() & PAD_BUTTON_UP)))
|
||||||
upBtn.ResetState();
|
upBtn.ResetState();
|
||||||
} else if ((dnBtn.GetState()==STATE_CLICKED||dnBtn.GetState()==STATE_HELD) && page==2) {
|
} else if ((dnBtn.GetState()==STATE_CLICKED||dnBtn.GetState()==STATE_HELD) && page==2
|
||||||
currentLine++;
|
&&synopsisTxt->GetTotalLines()>pagesize
|
||||||
if(currentLine+pagesize > TotalLines)
|
&&synopsisTxt->GetFirstLine()-1<synopsisTxt->GetTotalLines()-pagesize) {
|
||||||
currentLine = TotalLines-pagesize;
|
int l=0;
|
||||||
if(currentLine < 0)
|
//if(synopsisTxt->GetTotalLines()>pagesize)
|
||||||
currentLine = 0;
|
l=synopsisTxt->GetFirstLine()+1;
|
||||||
|
|
||||||
synopsisTxt->SetFirstLine(currentLine);
|
//if (l>(synopsisTxt->GetTotalLines()+1)-pagesize)
|
||||||
|
//l=(synopsisTxt->GetTotalLines()+1)-pagesize;
|
||||||
|
|
||||||
|
synopsisTxt->SetFirstLine(l);
|
||||||
usleep(60000);
|
usleep(60000);
|
||||||
if (!((ButtonsHold() & WPAD_BUTTON_DOWN)||(ButtonsHold() & PAD_BUTTON_DOWN)))
|
if (!((ButtonsHold() & WPAD_BUTTON_DOWN)||(ButtonsHold() & PAD_BUTTON_DOWN)))
|
||||||
dnBtn.ResetState();
|
dnBtn.ResetState();
|
||||||
|
@ -251,7 +251,6 @@ int MenuSettings() {
|
|||||||
|
|
||||||
int pageToDisplay = 1;
|
int pageToDisplay = 1;
|
||||||
while ( pageToDisplay > 0) { //set pageToDisplay to 0 to quit
|
while ( pageToDisplay > 0) { //set pageToDisplay to 0 to quit
|
||||||
|
|
||||||
VIDEO_WaitVSync ();
|
VIDEO_WaitVSync ();
|
||||||
|
|
||||||
menu = MENU_NONE;
|
menu = MENU_NONE;
|
||||||
@ -493,7 +492,6 @@ int MenuSettings() {
|
|||||||
while (optionBrowser2.GetEffect() > 0) usleep(50);
|
while (optionBrowser2.GetEffect() > 0) usleep(50);
|
||||||
|
|
||||||
int returnhere = 1;
|
int returnhere = 1;
|
||||||
bool firstRun = true;
|
|
||||||
char * languagefile;
|
char * languagefile;
|
||||||
languagefile = strrchr(Settings.language_path, '/')+1;
|
languagefile = strrchr(Settings.language_path, '/')+1;
|
||||||
|
|
||||||
@ -502,144 +500,28 @@ int MenuSettings() {
|
|||||||
|
|
||||||
returnhere = 1;
|
returnhere = 1;
|
||||||
|
|
||||||
if (backBtn.GetState() == STATE_CLICKED) {
|
|
||||||
backBtn.ResetState();
|
|
||||||
exit = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (shutdown == 1)
|
|
||||||
Sys_Shutdown();
|
|
||||||
else if (reset == 1)
|
|
||||||
Sys_Reboot();
|
|
||||||
|
|
||||||
else if (menu == MENU_DISCLIST) {
|
|
||||||
w.Remove(&optionBrowser2);
|
|
||||||
w.Remove(&backBtn);
|
|
||||||
WindowCredits();
|
|
||||||
w.Append(&optionBrowser2);
|
|
||||||
w.Append(&backBtn);
|
|
||||||
} else if (homo.GetState() == STATE_CLICKED) {
|
|
||||||
cfg_save_global();
|
|
||||||
optionBrowser2.SetState(STATE_DISABLED);
|
|
||||||
s32 thetimeofbg = bgMusic->GetPlayTime();
|
|
||||||
bgMusic->Stop();
|
|
||||||
choice = WindowExitPrompt(tr("Exit USB Loader GX?"),0, tr("Back to Loader"),tr("Wii Menu"),tr("Back"),0);
|
|
||||||
if (!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path)) {
|
|
||||||
bgMusic->Play();
|
|
||||||
} else {
|
|
||||||
bgMusic->PlayOggFile(Settings.ogg_path);
|
|
||||||
}
|
|
||||||
bgMusic->SetPlayTime(thetimeofbg);
|
|
||||||
SetVolumeOgg(255*(Settings.volume/100.0));
|
|
||||||
if (choice == 3) {
|
|
||||||
Sys_LoadMenu(); // Back to System Menu
|
|
||||||
} else if (choice == 2) {
|
|
||||||
Sys_BackToLoader();
|
|
||||||
} else {
|
|
||||||
homo.ResetState();
|
|
||||||
}
|
|
||||||
optionBrowser2.SetState(STATE_DEFAULT);
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = optionBrowser2.GetClickedOption();
|
|
||||||
|
|
||||||
if(firstRun || ret >= 0)
|
|
||||||
{
|
|
||||||
firstRun = false;
|
|
||||||
|
|
||||||
switch (ret)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
if (isInserted(bootDevice)) {
|
|
||||||
if ( Settings.godmode == 1) {
|
|
||||||
w.SetEffect(EFFECT_FADE, -20);
|
|
||||||
while (w.GetEffect()>0) usleep(50);
|
|
||||||
mainWindow->Remove(&w);
|
|
||||||
while (returnhere == 1)
|
|
||||||
returnhere = MenuLanguageSelect();
|
|
||||||
if (returnhere == 2) {
|
|
||||||
menu = MENU_SETTINGS;
|
|
||||||
pageToDisplay = 0;
|
|
||||||
exit = true;
|
|
||||||
mainWindow->Append(&w);
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
HaltGui();
|
|
||||||
mainWindow->Append(&w);
|
|
||||||
w.SetEffect(EFFECT_FADE, 20);
|
|
||||||
ResumeGui();
|
|
||||||
while (w.GetEffect()>0) usleep(50);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
WindowPrompt(tr("Language change:"),tr("Console should be unlocked to modify it."),tr("OK"));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
WindowPrompt(tr("No SD-Card inserted!"), tr("Insert an SD-Card to use this option."), tr("OK"));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
Settings.sinfo++;
|
|
||||||
if (Settings.sinfo >= settings_sinfo_max)
|
if (Settings.sinfo >= settings_sinfo_max)
|
||||||
Settings.sinfo = 0;
|
Settings.sinfo = 0;
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
Settings.hddinfo++;
|
|
||||||
if (Settings.hddinfo >= settings_clock_max)
|
if (Settings.hddinfo >= settings_clock_max)
|
||||||
Settings.hddinfo = 0; //CLOCK
|
Settings.hddinfo = 0; //CLOCK
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
Settings.tooltips++;
|
|
||||||
if (Settings.tooltips >= settings_tooltips_max)
|
if (Settings.tooltips >= settings_tooltips_max)
|
||||||
Settings.tooltips = 0;
|
Settings.tooltips = 0;
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
Settings.xflip++;
|
|
||||||
if ( Settings.xflip >= settings_xflip_max)
|
if ( Settings.xflip >= settings_xflip_max)
|
||||||
Settings.xflip = 0;
|
Settings.xflip = 0;
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
Settings.wsprompt++;
|
|
||||||
if ( Settings.wsprompt > 1 )
|
if ( Settings.wsprompt > 1 )
|
||||||
Settings.wsprompt = 0;
|
Settings.wsprompt = 0;
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
Settings.keyset++;
|
|
||||||
if ( Settings.keyset >= settings_keyset_max)
|
if ( Settings.keyset >= settings_keyset_max)
|
||||||
Settings.keyset = 0;
|
Settings.keyset = 0;
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
Settings.discart++;
|
|
||||||
if (Settings.discart >= 4)
|
|
||||||
Settings.discart = 0;
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
Settings.wiilight++;
|
|
||||||
if ( Settings.wiilight > 2 )
|
if ( Settings.wiilight > 2 )
|
||||||
Settings.wiilight = 0;
|
Settings.wiilight = 0;
|
||||||
break;
|
|
||||||
case 9:
|
|
||||||
Settings.rumble++;
|
|
||||||
if (Settings.rumble >= settings_rumble_max)
|
if (Settings.rumble >= settings_rumble_max)
|
||||||
Settings.rumble = 0; //RUMBLE
|
Settings.rumble = 0; //RUMBLE
|
||||||
break;
|
|
||||||
case 10:
|
|
||||||
Settings.autonetwork++;
|
|
||||||
if (Settings.autonetwork > 1)
|
|
||||||
Settings.autonetwork = 0;
|
|
||||||
break;
|
|
||||||
case 11:
|
|
||||||
Settings.titlesOverride++;
|
|
||||||
if (Settings.titlesOverride >= 2)
|
|
||||||
Settings.titlesOverride = 0;
|
|
||||||
break;
|
|
||||||
case 12:
|
|
||||||
Settings.screensaver++;
|
|
||||||
if (Settings.screensaver >= settings_screensaver_max)
|
if (Settings.screensaver >= settings_screensaver_max)
|
||||||
Settings.screensaver = 0; //RUMBLE
|
Settings.screensaver = 0; //RUMBLE
|
||||||
break;
|
if (Settings.titlesOverride >= 2)
|
||||||
}
|
Settings.titlesOverride = 0;
|
||||||
|
if (Settings.discart >= 4)
|
||||||
|
Settings.discart = 0;
|
||||||
if (!strcmp("notset", Settings.language_path))
|
if (!strcmp("notset", Settings.language_path))
|
||||||
options2.SetValue(0, "%s", tr("Default"));
|
options2.SetValue(0, "%s", tr("Default"));
|
||||||
else
|
else
|
||||||
@ -697,6 +579,117 @@ int MenuSettings() {
|
|||||||
else if (Settings.screensaver == 4) options2.SetValue(12,tr("20 min"));
|
else if (Settings.screensaver == 4) options2.SetValue(12,tr("20 min"));
|
||||||
else if (Settings.screensaver == 5) options2.SetValue(12,tr("30 min"));
|
else if (Settings.screensaver == 5) options2.SetValue(12,tr("30 min"));
|
||||||
else if (Settings.screensaver == 6) options2.SetValue(12,tr("1 hour"));
|
else if (Settings.screensaver == 6) options2.SetValue(12,tr("1 hour"));
|
||||||
|
|
||||||
|
if (backBtn.GetState() == STATE_CLICKED) {
|
||||||
|
backBtn.ResetState();
|
||||||
|
exit = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shutdown == 1)
|
||||||
|
Sys_Shutdown();
|
||||||
|
else if (reset == 1)
|
||||||
|
Sys_Reboot();
|
||||||
|
|
||||||
|
else if (menu == MENU_DISCLIST) {
|
||||||
|
w.Remove(&optionBrowser2);
|
||||||
|
w.Remove(&backBtn);
|
||||||
|
WindowCredits();
|
||||||
|
w.Append(&optionBrowser2);
|
||||||
|
w.Append(&backBtn);
|
||||||
|
} else if (homo.GetState() == STATE_CLICKED) {
|
||||||
|
cfg_save_global();
|
||||||
|
optionBrowser2.SetState(STATE_DISABLED);
|
||||||
|
s32 thetimeofbg = bgMusic->GetPlayTime();
|
||||||
|
bgMusic->Stop();
|
||||||
|
choice = WindowExitPrompt(tr("Exit USB Loader GX?"),0, tr("Back to Loader"),tr("Wii Menu"),tr("Back"),0);
|
||||||
|
if (!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path)) {
|
||||||
|
bgMusic->Play();
|
||||||
|
} else {
|
||||||
|
bgMusic->PlayOggFile(Settings.ogg_path);
|
||||||
|
}
|
||||||
|
bgMusic->SetPlayTime(thetimeofbg);
|
||||||
|
SetVolumeOgg(255*(Settings.volume/100.0));
|
||||||
|
if (choice == 3) {
|
||||||
|
Sys_LoadMenu(); // Back to System Menu
|
||||||
|
} else if (choice == 2) {
|
||||||
|
Sys_BackToLoader();
|
||||||
|
} else {
|
||||||
|
homo.ResetState();
|
||||||
|
}
|
||||||
|
optionBrowser2.SetState(STATE_DEFAULT);
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = optionBrowser2.GetClickedOption();
|
||||||
|
|
||||||
|
switch (ret) {
|
||||||
|
case 0:
|
||||||
|
if (isInserted(bootDevice)) {
|
||||||
|
if ( Settings.godmode == 1) {
|
||||||
|
w.SetEffect(EFFECT_FADE, -20);
|
||||||
|
while (w.GetEffect()>0) usleep(50);
|
||||||
|
mainWindow->Remove(&w);
|
||||||
|
while (returnhere == 1)
|
||||||
|
returnhere = MenuLanguageSelect();
|
||||||
|
if (returnhere == 2) {
|
||||||
|
menu = MENU_SETTINGS;
|
||||||
|
pageToDisplay = 0;
|
||||||
|
exit = true;
|
||||||
|
mainWindow->Append(&w);
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
HaltGui();
|
||||||
|
mainWindow->Append(&w);
|
||||||
|
w.SetEffect(EFFECT_FADE, 20);
|
||||||
|
ResumeGui();
|
||||||
|
while (w.GetEffect()>0) usleep(50);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
WindowPrompt(tr("Language change:"),tr("Console should be unlocked to modify it."),tr("OK"));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
WindowPrompt(tr("No SD-Card inserted!"), tr("Insert an SD-Card to use this option."), tr("OK"));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
Settings.sinfo++;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
Settings.hddinfo++;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
Settings.tooltips++;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
Settings.xflip++;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
Settings.wsprompt++;
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
Settings.keyset++;
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
Settings.discart++;
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
Settings.wiilight++;
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
Settings.rumble++;
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
Settings.autonetwork++;
|
||||||
|
if (Settings.autonetwork > 1)
|
||||||
|
Settings.autonetwork = 0;
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
Settings.titlesOverride++;
|
||||||
|
break;
|
||||||
|
case 12:
|
||||||
|
Settings.screensaver++;
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
optionBrowser2.SetEffect(EFFECT_FADE, -20);
|
optionBrowser2.SetEffect(EFFECT_FADE, -20);
|
||||||
@ -741,98 +734,28 @@ int MenuSettings() {
|
|||||||
optionBrowser2.SetClickable(true);
|
optionBrowser2.SetClickable(true);
|
||||||
ResumeGui();
|
ResumeGui();
|
||||||
|
|
||||||
bool firstRun = true;
|
|
||||||
|
|
||||||
VIDEO_WaitVSync ();
|
VIDEO_WaitVSync ();
|
||||||
optionBrowser2.SetEffect(EFFECT_FADE, 20);
|
optionBrowser2.SetEffect(EFFECT_FADE, 20);
|
||||||
while (optionBrowser2.GetEffect() > 0) usleep(50);
|
while (optionBrowser2.GetEffect() > 0) usleep(50);
|
||||||
|
|
||||||
while (!exit)
|
while (!exit) {
|
||||||
{
|
|
||||||
VIDEO_WaitVSync ();
|
VIDEO_WaitVSync ();
|
||||||
|
|
||||||
if (backBtn.GetState() == STATE_CLICKED) {
|
|
||||||
backBtn.ResetState();
|
|
||||||
exit = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (shutdown == 1)
|
|
||||||
Sys_Shutdown();
|
|
||||||
else if (reset == 1)
|
|
||||||
Sys_Reboot();
|
|
||||||
|
|
||||||
else if (homo.GetState() == STATE_CLICKED) {
|
|
||||||
cfg_save_global();
|
|
||||||
optionBrowser2.SetState(STATE_DISABLED);
|
|
||||||
s32 thetimeofbg = bgMusic->GetPlayTime();
|
|
||||||
bgMusic->Stop();
|
|
||||||
choice = WindowExitPrompt(tr("Exit USB Loader GX?"),0, tr("Back to Loader"),tr("Wii Menu"),tr("Back"),0);
|
|
||||||
if (!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path)) {
|
|
||||||
bgMusic->Play();
|
|
||||||
} else {
|
|
||||||
bgMusic->PlayOggFile(Settings.ogg_path);
|
|
||||||
}
|
|
||||||
bgMusic->SetPlayTime(thetimeofbg);
|
|
||||||
SetVolumeOgg(255*(Settings.volume/100.0));
|
|
||||||
if (choice == 3) {
|
|
||||||
Sys_LoadMenu(); // Back to System Menu
|
|
||||||
} else if (choice == 2) {
|
|
||||||
Sys_BackToLoader();
|
|
||||||
} else {
|
|
||||||
homo.ResetState();
|
|
||||||
}
|
|
||||||
optionBrowser2.SetState(STATE_DEFAULT);
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = optionBrowser2.GetClickedOption();
|
|
||||||
|
|
||||||
if(firstRun || ret >= 0)
|
|
||||||
{
|
|
||||||
firstRun = false;
|
|
||||||
|
|
||||||
switch (ret) {
|
|
||||||
case 0:
|
|
||||||
Settings.video++;
|
|
||||||
if (Settings.video >= settings_video_max)
|
if (Settings.video >= settings_video_max)
|
||||||
Settings.video = 0;
|
Settings.video = 0;
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
Settings.vpatch++;
|
|
||||||
if (Settings.vpatch >= settings_off_on_max)
|
if (Settings.vpatch >= settings_off_on_max)
|
||||||
Settings.vpatch = 0;
|
Settings.vpatch = 0;
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
Settings.language++;
|
|
||||||
if ( Settings.language >= settings_language_max)
|
|
||||||
Settings.language = 0;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
Settings.patchcountrystrings++;
|
|
||||||
if ( Settings.patchcountrystrings > 1)
|
if ( Settings.patchcountrystrings > 1)
|
||||||
Settings.patchcountrystrings = 0;
|
Settings.patchcountrystrings = 0;
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
Settings.ocarina++;
|
|
||||||
if (Settings.ocarina >= settings_off_on_max)
|
if (Settings.ocarina >= settings_off_on_max)
|
||||||
Settings.ocarina = 0;
|
Settings.ocarina = 0;
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
if (Settings.godmode)
|
|
||||||
Settings.cios++;
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
Settings.qboot++;
|
|
||||||
if ( Settings.qboot > 1 )
|
if ( Settings.qboot > 1 )
|
||||||
Settings.qboot = 0;
|
Settings.qboot = 0;
|
||||||
break;
|
if ( Settings.cios >= settings_cios_max)
|
||||||
case 7:
|
Settings.cios = 0;
|
||||||
Settings.error002++;
|
if ( Settings.language >= settings_language_max)
|
||||||
|
Settings.language = 0;
|
||||||
if (Settings.error002 >= settings_off_on_max+1)
|
if (Settings.error002 >= settings_off_on_max+1)
|
||||||
Settings.error002 = 0;
|
Settings.error002 = 0;
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Settings.video == discdefault) options2.SetValue(0,"%s",tr("Disc Default"));
|
if (Settings.video == discdefault) options2.SetValue(0,"%s",tr("Disc Default"));
|
||||||
else if (Settings.video == systemdefault) options2.SetValue(0,"%s",tr("System Default"));
|
else if (Settings.video == systemdefault) options2.SetValue(0,"%s",tr("System Default"));
|
||||||
@ -872,6 +795,70 @@ int MenuSettings() {
|
|||||||
if (Settings.error002 == no) options2.SetValue(7,"%s",tr("No"));
|
if (Settings.error002 == no) options2.SetValue(7,"%s",tr("No"));
|
||||||
else if (Settings.error002 == yes) options2.SetValue(7,"%s",tr("Yes"));
|
else if (Settings.error002 == yes) options2.SetValue(7,"%s",tr("Yes"));
|
||||||
else if (Settings.error002 == anti) options2.SetValue(7,"%s",tr("Anti"));
|
else if (Settings.error002 == anti) options2.SetValue(7,"%s",tr("Anti"));
|
||||||
|
|
||||||
|
if (backBtn.GetState() == STATE_CLICKED) {
|
||||||
|
backBtn.ResetState();
|
||||||
|
exit = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shutdown == 1)
|
||||||
|
Sys_Shutdown();
|
||||||
|
else if (reset == 1)
|
||||||
|
Sys_Reboot();
|
||||||
|
|
||||||
|
else if (homo.GetState() == STATE_CLICKED) {
|
||||||
|
cfg_save_global();
|
||||||
|
optionBrowser2.SetState(STATE_DISABLED);
|
||||||
|
s32 thetimeofbg = bgMusic->GetPlayTime();
|
||||||
|
bgMusic->Stop();
|
||||||
|
choice = WindowExitPrompt(tr("Exit USB Loader GX?"),0, tr("Back to Loader"),tr("Wii Menu"),tr("Back"),0);
|
||||||
|
if (!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path)) {
|
||||||
|
bgMusic->Play();
|
||||||
|
} else {
|
||||||
|
bgMusic->PlayOggFile(Settings.ogg_path);
|
||||||
|
}
|
||||||
|
bgMusic->SetPlayTime(thetimeofbg);
|
||||||
|
SetVolumeOgg(255*(Settings.volume/100.0));
|
||||||
|
if (choice == 3) {
|
||||||
|
Sys_LoadMenu(); // Back to System Menu
|
||||||
|
} else if (choice == 2) {
|
||||||
|
Sys_BackToLoader();
|
||||||
|
} else {
|
||||||
|
homo.ResetState();
|
||||||
|
}
|
||||||
|
optionBrowser2.SetState(STATE_DEFAULT);
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = optionBrowser2.GetClickedOption();
|
||||||
|
|
||||||
|
switch (ret) {
|
||||||
|
case 0:
|
||||||
|
Settings.video++;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
Settings.vpatch++;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
Settings.language++;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
Settings.patchcountrystrings++;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
Settings.ocarina++;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
if (Settings.godmode)
|
||||||
|
Settings.cios++;
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
Settings.qboot++;
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
Settings.error002++;
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
optionBrowser2.SetEffect(EFFECT_FADE, -20);
|
optionBrowser2.SetEffect(EFFECT_FADE, -20);
|
||||||
@ -910,23 +897,37 @@ int MenuSettings() {
|
|||||||
optionBrowser2.SetClickable(true);
|
optionBrowser2.SetClickable(true);
|
||||||
ResumeGui();
|
ResumeGui();
|
||||||
|
|
||||||
bool firstRun = true;
|
|
||||||
|
|
||||||
VIDEO_WaitVSync ();
|
VIDEO_WaitVSync ();
|
||||||
optionBrowser2.SetEffect(EFFECT_FADE, 20);
|
optionBrowser2.SetEffect(EFFECT_FADE, 20);
|
||||||
while (optionBrowser2.GetEffect() > 0) usleep(50);
|
while (optionBrowser2.GetEffect() > 0) usleep(50);
|
||||||
|
|
||||||
while (!exit)
|
while (!exit) {
|
||||||
{
|
|
||||||
VIDEO_WaitVSync ();
|
VIDEO_WaitVSync ();
|
||||||
|
|
||||||
|
if (Settings.parentalcontrol > 4 )
|
||||||
|
Settings.parentalcontrol = 0;
|
||||||
|
|
||||||
|
if ( Settings.godmode == 1 ) options2.SetValue(0, tr("Unlocked"));
|
||||||
|
else if ( Settings.godmode == 0 ) options2.SetValue(0, tr("Locked"));
|
||||||
|
|
||||||
|
if ( Settings.godmode != 1) options2.SetValue(1, "********");
|
||||||
|
else if (!strcmp("", Settings.unlockCode)) options2.SetValue(1, "%s",tr("not set"));
|
||||||
|
else options2.SetValue(1, Settings.unlockCode);
|
||||||
|
|
||||||
|
if (Settings.godmode != 1) options2.SetValue(2, "********");
|
||||||
|
else if (Settings.parentalcontrol == 0) options2.SetValue(2, tr("OFF"));
|
||||||
|
else if (Settings.parentalcontrol == 1) options2.SetValue(2, tr("1 (Child 7+)"));
|
||||||
|
else if (Settings.parentalcontrol == 2) options2.SetValue(2, tr("2 (Teen 12+)"));
|
||||||
|
else if (Settings.parentalcontrol == 3) options2.SetValue(2, tr("3 (Mature 16+)"));
|
||||||
|
else if (Settings.parentalcontrol == 4) options2.SetValue(2, tr("4 (Adults Only 18+)"));
|
||||||
|
|
||||||
if (backBtn.GetState() == STATE_CLICKED) {
|
if (backBtn.GetState() == STATE_CLICKED) {
|
||||||
backBtn.ResetState();
|
backBtn.ResetState();
|
||||||
exit = true;
|
exit = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (shutdown == 1)
|
if (shutdown == 1)
|
||||||
Sys_Shutdown();
|
Sys_Shutdown();
|
||||||
else if (reset == 1)
|
else if (reset == 1)
|
||||||
Sys_Reboot();
|
Sys_Reboot();
|
||||||
@ -956,10 +957,6 @@ int MenuSettings() {
|
|||||||
|
|
||||||
ret = optionBrowser2.GetClickedOption();
|
ret = optionBrowser2.GetClickedOption();
|
||||||
|
|
||||||
if(firstRun || ret >= 0)
|
|
||||||
{
|
|
||||||
firstRun = false;
|
|
||||||
|
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
case 0:
|
case 0:
|
||||||
if (!strcmp("", Settings.unlockCode)) {
|
if (!strcmp("", Settings.unlockCode)) {
|
||||||
@ -1015,26 +1012,8 @@ int MenuSettings() {
|
|||||||
case 2:
|
case 2:
|
||||||
if (Settings.godmode)
|
if (Settings.godmode)
|
||||||
Settings.parentalcontrol++;
|
Settings.parentalcontrol++;
|
||||||
if (Settings.parentalcontrol > 4 )
|
|
||||||
Settings.parentalcontrol = 0;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ( Settings.godmode == 1 ) options2.SetValue(0, tr("Unlocked"));
|
|
||||||
else if ( Settings.godmode == 0 ) options2.SetValue(0, tr("Locked"));
|
|
||||||
|
|
||||||
if ( Settings.godmode != 1) options2.SetValue(1, "********");
|
|
||||||
else if (!strcmp("", Settings.unlockCode)) options2.SetValue(1, "%s",tr("not set"));
|
|
||||||
else options2.SetValue(1, Settings.unlockCode);
|
|
||||||
|
|
||||||
if (Settings.godmode != 1) options2.SetValue(2, "********");
|
|
||||||
else if (Settings.parentalcontrol == 0) options2.SetValue(2, tr("OFF"));
|
|
||||||
else if (Settings.parentalcontrol == 1) options2.SetValue(2, tr("1 (Child 7+)"));
|
|
||||||
else if (Settings.parentalcontrol == 2) options2.SetValue(2, tr("2 (Teen 12+)"));
|
|
||||||
else if (Settings.parentalcontrol == 3) options2.SetValue(2, tr("3 (Mature 16+)"));
|
|
||||||
else if (Settings.parentalcontrol == 4) options2.SetValue(2, tr("4 (Adults Only 18+)"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
optionBrowser2.SetEffect(EFFECT_FADE, -20);
|
optionBrowser2.SetEffect(EFFECT_FADE, -20);
|
||||||
while (optionBrowser2.GetEffect() > 0) usleep(50);
|
while (optionBrowser2.GetEffect() > 0) usleep(50);
|
||||||
@ -1072,8 +1051,6 @@ int MenuSettings() {
|
|||||||
optionBrowser2.SetClickable(true);
|
optionBrowser2.SetClickable(true);
|
||||||
ResumeGui();
|
ResumeGui();
|
||||||
|
|
||||||
bool firstRun = true;
|
|
||||||
|
|
||||||
VIDEO_WaitVSync ();
|
VIDEO_WaitVSync ();
|
||||||
optionBrowser2.SetEffect(EFFECT_FADE, 20);
|
optionBrowser2.SetEffect(EFFECT_FADE, 20);
|
||||||
while (optionBrowser2.GetEffect() > 0) usleep(50);
|
while (optionBrowser2.GetEffect() > 0) usleep(50);
|
||||||
@ -1086,13 +1063,29 @@ int MenuSettings() {
|
|||||||
|
|
||||||
bool returnhere = true;
|
bool returnhere = true;
|
||||||
|
|
||||||
|
if (!strcmp("notset", Settings.ogg_path))
|
||||||
|
options2.SetValue(0, "%s", tr("Standard"));
|
||||||
|
else {
|
||||||
|
oggfile = strrchr(Settings.ogg_path, '/')+1;
|
||||||
|
options2.SetValue(0, "%s", oggfile);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Settings.volume > 0)
|
||||||
|
options2.SetValue(1,"%i", Settings.volume);
|
||||||
|
else
|
||||||
|
options2.SetValue(1,"%s", tr("OFF"));
|
||||||
|
if (Settings.sfxvolume > 0)
|
||||||
|
options2.SetValue(2,"%i", Settings.sfxvolume);
|
||||||
|
else
|
||||||
|
options2.SetValue(2,"%s", tr("OFF"));
|
||||||
|
|
||||||
if (backBtn.GetState() == STATE_CLICKED) {
|
if (backBtn.GetState() == STATE_CLICKED) {
|
||||||
backBtn.ResetState();
|
backBtn.ResetState();
|
||||||
exit = true;
|
exit = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (shutdown == 1)
|
if (shutdown == 1)
|
||||||
Sys_Shutdown();
|
Sys_Shutdown();
|
||||||
else if (reset == 1)
|
else if (reset == 1)
|
||||||
Sys_Reboot();
|
Sys_Reboot();
|
||||||
@ -1122,12 +1115,7 @@ int MenuSettings() {
|
|||||||
|
|
||||||
ret = optionBrowser2.GetClickedOption();
|
ret = optionBrowser2.GetClickedOption();
|
||||||
|
|
||||||
if(firstRun || ret >= 0)
|
switch (ret) {
|
||||||
{
|
|
||||||
firstRun = false;
|
|
||||||
|
|
||||||
switch (ret)
|
|
||||||
{
|
|
||||||
case 0:
|
case 0:
|
||||||
if (isInserted(bootDevice)) {
|
if (isInserted(bootDevice)) {
|
||||||
w.SetEffect(EFFECT_FADE, -20);
|
w.SetEffect(EFFECT_FADE, -20);
|
||||||
@ -1158,23 +1146,6 @@ int MenuSettings() {
|
|||||||
btnClick1.SetVolume(Settings.sfxvolume);
|
btnClick1.SetVolume(Settings.sfxvolume);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp("notset", Settings.ogg_path))
|
|
||||||
options2.SetValue(0, "%s", tr("Standard"));
|
|
||||||
else {
|
|
||||||
oggfile = strrchr(Settings.ogg_path, '/')+1;
|
|
||||||
options2.SetValue(0, "%s", oggfile);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Settings.volume > 0)
|
|
||||||
options2.SetValue(1,"%i", Settings.volume);
|
|
||||||
else
|
|
||||||
options2.SetValue(1,"%s", tr("OFF"));
|
|
||||||
if (Settings.sfxvolume > 0)
|
|
||||||
options2.SetValue(2,"%i", Settings.sfxvolume);
|
|
||||||
else
|
|
||||||
options2.SetValue(2,"%s", tr("OFF"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
optionBrowser2.SetEffect(EFFECT_FADE, -20);
|
optionBrowser2.SetEffect(EFFECT_FADE, -20);
|
||||||
while (optionBrowser2.GetEffect() > 0) usleep(50);
|
while (optionBrowser2.GetEffect() > 0) usleep(50);
|
||||||
@ -1222,8 +1193,6 @@ int MenuSettings() {
|
|||||||
optionBrowser2.SetClickable(true);
|
optionBrowser2.SetClickable(true);
|
||||||
ResumeGui();
|
ResumeGui();
|
||||||
|
|
||||||
bool firstRun = true;
|
|
||||||
|
|
||||||
VIDEO_WaitVSync ();
|
VIDEO_WaitVSync ();
|
||||||
optionBrowser2.SetEffect(EFFECT_FADE, 20);
|
optionBrowser2.SetEffect(EFFECT_FADE, 20);
|
||||||
while (optionBrowser2.GetEffect() > 0) usleep(50);
|
while (optionBrowser2.GetEffect() > 0) usleep(50);
|
||||||
@ -1233,13 +1202,24 @@ int MenuSettings() {
|
|||||||
while (!exit) {
|
while (!exit) {
|
||||||
VIDEO_WaitVSync ();
|
VIDEO_WaitVSync ();
|
||||||
|
|
||||||
|
options2.SetValue(0, "%s", Settings.covers_path);
|
||||||
|
options2.SetValue(1, "%s", Settings.covers2d_path);
|
||||||
|
options2.SetValue(2, "%s", Settings.disc_path);
|
||||||
|
options2.SetValue(3, "%s", CFG.theme_path);
|
||||||
|
options2.SetValue(4, "%s", Settings.titlestxt_path);
|
||||||
|
options2.SetValue(5, "%s", Settings.update_path);
|
||||||
|
options2.SetValue(6, "%s", Settings.Cheatcodespath);
|
||||||
|
options2.SetValue(7, "%s", Settings.TxtCheatcodespath);
|
||||||
|
options2.SetValue(8, "%s", Settings.dolpath);
|
||||||
|
options2.SetValue(9, "%s", Settings.homebrewapps_path);
|
||||||
|
|
||||||
if (backBtn.GetState() == STATE_CLICKED) {
|
if (backBtn.GetState() == STATE_CLICKED) {
|
||||||
backBtn.ResetState();
|
backBtn.ResetState();
|
||||||
exit = true;
|
exit = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (shutdown == 1)
|
if (shutdown == 1)
|
||||||
Sys_Shutdown();
|
Sys_Shutdown();
|
||||||
else if (reset == 1)
|
else if (reset == 1)
|
||||||
Sys_Reboot();
|
Sys_Reboot();
|
||||||
@ -1269,10 +1249,6 @@ int MenuSettings() {
|
|||||||
|
|
||||||
ret = optionBrowser2.GetClickedOption();
|
ret = optionBrowser2.GetClickedOption();
|
||||||
|
|
||||||
if(firstRun || ret >= 0)
|
|
||||||
{
|
|
||||||
firstRun = false;
|
|
||||||
|
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
case 0:
|
case 0:
|
||||||
if ( Settings.godmode == 1) {
|
if ( Settings.godmode == 1) {
|
||||||
@ -1552,18 +1528,6 @@ int MenuSettings() {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
options2.SetValue(0, "%s", Settings.covers_path);
|
|
||||||
options2.SetValue(1, "%s", Settings.covers2d_path);
|
|
||||||
options2.SetValue(2, "%s", Settings.disc_path);
|
|
||||||
options2.SetValue(3, "%s", CFG.theme_path);
|
|
||||||
options2.SetValue(4, "%s", Settings.titlestxt_path);
|
|
||||||
options2.SetValue(5, "%s", Settings.update_path);
|
|
||||||
options2.SetValue(6, "%s", Settings.Cheatcodespath);
|
|
||||||
options2.SetValue(7, "%s", Settings.TxtCheatcodespath);
|
|
||||||
options2.SetValue(8, "%s", Settings.dolpath);
|
|
||||||
options2.SetValue(9, "%s", Settings.homebrewapps_path);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/** If not godmode don't let him inside **/
|
/** If not godmode don't let him inside **/
|
||||||
} else {
|
} else {
|
||||||
@ -1676,10 +1640,10 @@ int MenuSettings() {
|
|||||||
|
|
||||||
if (shutdown == 1)
|
if (shutdown == 1)
|
||||||
Sys_Shutdown();
|
Sys_Shutdown();
|
||||||
else if (reset == 1)
|
if (reset == 1)
|
||||||
Sys_Reboot();
|
Sys_Reboot();
|
||||||
|
|
||||||
else if (backBtn.GetState() == STATE_CLICKED) {
|
if (backBtn.GetState() == STATE_CLICKED) {
|
||||||
//Add the procedure call to save the global configuration
|
//Add the procedure call to save the global configuration
|
||||||
if (isInserted(bootDevice)) {
|
if (isInserted(bootDevice)) {
|
||||||
cfg_save_global();
|
cfg_save_global();
|
||||||
@ -1689,7 +1653,7 @@ int MenuSettings() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (GoLeftBtn.GetState() == STATE_CLICKED) {
|
if (GoLeftBtn.GetState() == STATE_CLICKED) {
|
||||||
pageToDisplay--;
|
pageToDisplay--;
|
||||||
/** Change direction of the flying buttons **/
|
/** Change direction of the flying buttons **/
|
||||||
if (pageToDisplay < 1)
|
if (pageToDisplay < 1)
|
||||||
@ -1699,7 +1663,7 @@ int MenuSettings() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (GoRightBtn.GetState() == STATE_CLICKED) {
|
if (GoRightBtn.GetState() == STATE_CLICKED) {
|
||||||
pageToDisplay++;
|
pageToDisplay++;
|
||||||
/** Change direction of the flying buttons **/
|
/** Change direction of the flying buttons **/
|
||||||
if (pageToDisplay > 2)
|
if (pageToDisplay > 2)
|
||||||
@ -1709,7 +1673,7 @@ int MenuSettings() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (PageIndicatorBtn1.GetState() == STATE_CLICKED) {
|
if (PageIndicatorBtn1.GetState() == STATE_CLICKED) {
|
||||||
if (pageToDisplay == 2) {
|
if (pageToDisplay == 2) {
|
||||||
slidedirection = LEFT;
|
slidedirection = LEFT;
|
||||||
pageToDisplay = 1;
|
pageToDisplay = 1;
|
||||||
@ -1727,7 +1691,7 @@ int MenuSettings() {
|
|||||||
PageIndicatorBtn2.ResetState();
|
PageIndicatorBtn2.ResetState();
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (homo.GetState() == STATE_CLICKED) {
|
if (homo.GetState() == STATE_CLICKED) {
|
||||||
cfg_save_global();
|
cfg_save_global();
|
||||||
optionBrowser2.SetState(STATE_DISABLED);
|
optionBrowser2.SetState(STATE_DISABLED);
|
||||||
s32 thetimeofbg = bgMusic->GetPlayTime();
|
s32 thetimeofbg = bgMusic->GetPlayTime();
|
||||||
@ -1833,7 +1797,7 @@ int GameSettings(struct discHdr * header) {
|
|||||||
GuiText titleTxt(!mountMethod?get_title(header):gameName, 28, (GXColor) {0, 0, 0, 255});
|
GuiText titleTxt(!mountMethod?get_title(header):gameName, 28, (GXColor) {0, 0, 0, 255});
|
||||||
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||||
titleTxt.SetPosition(12,40);
|
titleTxt.SetPosition(12,40);
|
||||||
titleTxt.SetMaxWidth(356, SCROLL_HORIZONTAL);
|
titleTxt.SetMaxWidth(356, GuiText::SCROLL);
|
||||||
|
|
||||||
GuiImage settingsbackground(&settingsbg);
|
GuiImage settingsbackground(&settingsbg);
|
||||||
|
|
||||||
@ -2074,7 +2038,6 @@ int GameSettings(struct discHdr * header) {
|
|||||||
while (optionBrowser2.GetEffect() > 0) usleep(50);
|
while (optionBrowser2.GetEffect() > 0) usleep(50);
|
||||||
|
|
||||||
int returnhere = 1;
|
int returnhere = 1;
|
||||||
bool firstRun = true;
|
|
||||||
char * languagefile;
|
char * languagefile;
|
||||||
languagefile = strrchr(Settings.language_path, '/')+1;
|
languagefile = strrchr(Settings.language_path, '/')+1;
|
||||||
|
|
||||||
@ -2083,77 +2046,30 @@ int GameSettings(struct discHdr * header) {
|
|||||||
|
|
||||||
returnhere = 1;
|
returnhere = 1;
|
||||||
|
|
||||||
if (backBtn.GetState() == STATE_CLICKED) {
|
if (videoChoice >= 6)
|
||||||
backBtn.ResetState();
|
videoChoice = 0;
|
||||||
exit = true;
|
if (viChoice >= 2)
|
||||||
break;
|
viChoice = 0;
|
||||||
}
|
if (languageChoice >= 11)
|
||||||
|
languageChoice = 0;
|
||||||
else if (shutdown == 1)
|
if ( ocarinaChoice >= 2)
|
||||||
Sys_Shutdown();
|
ocarinaChoice = 0;
|
||||||
else if (reset == 1)
|
if ( Settings.wsprompt > 1 )
|
||||||
Sys_Reboot();
|
Settings.wsprompt = 0;
|
||||||
|
if ( iosChoice >= 3)
|
||||||
else if (menu == MENU_DISCLIST) {
|
iosChoice = 0;
|
||||||
w.Remove(&optionBrowser2);
|
if ( Settings.wiilight > 2 )
|
||||||
w.Remove(&backBtn);
|
Settings.wiilight = 0;
|
||||||
WindowCredits();
|
if (parentalcontrolChoice >= 5)
|
||||||
w.Append(&optionBrowser2);
|
parentalcontrolChoice = 0;
|
||||||
w.Append(&backBtn);
|
if (fix002 >= 3)
|
||||||
} else if (homo.GetState() == STATE_CLICKED) {
|
fix002 = 0; //RUMBLE
|
||||||
cfg_save_global();
|
if (countrystrings >= 2)
|
||||||
optionBrowser2.SetState(STATE_DISABLED);
|
countrystrings = 0;
|
||||||
s32 thetimeofbg = bgMusic->GetPlayTime();
|
if (alternatedol >= 3)
|
||||||
bgMusic->Stop();
|
alternatedol = 0;
|
||||||
choice = WindowExitPrompt(tr("Exit USB Loader GX?"),0, tr("Back to Loader"),tr("Wii Menu"),tr("Back"),0);
|
if (reloadblock >= 2)
|
||||||
if (!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path)) {
|
reloadblock = 0;
|
||||||
bgMusic->Play();
|
|
||||||
} else {
|
|
||||||
bgMusic->PlayOggFile(Settings.ogg_path);
|
|
||||||
}
|
|
||||||
bgMusic->SetPlayTime(thetimeofbg);
|
|
||||||
SetVolumeOgg(255*(Settings.volume/100.0));
|
|
||||||
if (choice == 3) {
|
|
||||||
Sys_LoadMenu(); // Back to System Menu
|
|
||||||
} else if (choice == 2) {
|
|
||||||
Sys_BackToLoader();
|
|
||||||
} else {
|
|
||||||
homo.ResetState();
|
|
||||||
}
|
|
||||||
optionBrowser2.SetState(STATE_DEFAULT);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (saveBtn.GetState() == STATE_CLICKED) {
|
|
||||||
|
|
||||||
if (isInserted(bootDevice)) {
|
|
||||||
if (CFG_save_game_opt(header->id)) {
|
|
||||||
/* commented because the database language now depends on the main language setting, this could be enabled again if there is a separate language setting for the database
|
|
||||||
// if game language has changed when saving game settings, reload titles
|
|
||||||
int opt_langnew = 0;
|
|
||||||
game_cfg = CFG_get_game_opt(header->id);
|
|
||||||
if (game_cfg) opt_langnew = game_cfg->language;
|
|
||||||
if (Settings.titlesOverride==1 && opt_lang != opt_langnew)
|
|
||||||
OpenXMLDatabase(Settings.titlestxt_path, Settings.db_language, Settings.db_JPtoEN, true, true, false); // open file, reload titles, do not keep in memory
|
|
||||||
// titles are refreshed in menu.cpp as soon as this function returns
|
|
||||||
*/
|
|
||||||
game_cfg = CFG_get_game_opt(header->id); // needed here for "if (game_cfg)" earlier in case it's the first time settings are saved for a game
|
|
||||||
WindowPrompt(tr("Successfully Saved"), 0, tr("OK"));
|
|
||||||
} else {
|
|
||||||
WindowPrompt(tr("Save Failed"), 0, tr("OK"));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
WindowPrompt(tr("No SD-Card inserted!"), tr("Insert an SD-Card to save."), tr("OK"));
|
|
||||||
}
|
|
||||||
|
|
||||||
saveBtn.ResetState();
|
|
||||||
optionBrowser2.SetFocus(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = optionBrowser2.GetClickedOption();
|
|
||||||
|
|
||||||
if(ret >= 0 || firstRun == true)
|
|
||||||
{
|
|
||||||
firstRun = false;
|
|
||||||
|
|
||||||
if (videoChoice == discdefault) options2.SetValue(0,"%s",tr("Disc Default"));
|
if (videoChoice == discdefault) options2.SetValue(0,"%s",tr("Disc Default"));
|
||||||
else if (videoChoice == systemdefault) options2.SetValue(0,"%s",tr("System Default"));
|
else if (videoChoice == systemdefault) options2.SetValue(0,"%s",tr("System Default"));
|
||||||
@ -2208,51 +2124,75 @@ int GameSettings(struct discHdr * header) {
|
|||||||
if (reloadblock == on) options2.SetValue(10,tr("ON"));
|
if (reloadblock == on) options2.SetValue(10,tr("ON"));
|
||||||
else if (reloadblock == off) options2.SetValue(10,tr("OFF"));
|
else if (reloadblock == off) options2.SetValue(10,tr("OFF"));
|
||||||
|
|
||||||
|
if (backBtn.GetState() == STATE_CLICKED) {
|
||||||
|
backBtn.ResetState();
|
||||||
|
exit = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shutdown == 1)
|
||||||
|
Sys_Shutdown();
|
||||||
|
else if (reset == 1)
|
||||||
|
Sys_Reboot();
|
||||||
|
|
||||||
|
else if (menu == MENU_DISCLIST) {
|
||||||
|
w.Remove(&optionBrowser2);
|
||||||
|
w.Remove(&backBtn);
|
||||||
|
WindowCredits();
|
||||||
|
w.Append(&optionBrowser2);
|
||||||
|
w.Append(&backBtn);
|
||||||
|
} else if (homo.GetState() == STATE_CLICKED) {
|
||||||
|
cfg_save_global();
|
||||||
|
optionBrowser2.SetState(STATE_DISABLED);
|
||||||
|
s32 thetimeofbg = bgMusic->GetPlayTime();
|
||||||
|
bgMusic->Stop();
|
||||||
|
choice = WindowExitPrompt(tr("Exit USB Loader GX?"),0, tr("Back to Loader"),tr("Wii Menu"),tr("Back"),0);
|
||||||
|
if (!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path)) {
|
||||||
|
bgMusic->Play();
|
||||||
|
} else {
|
||||||
|
bgMusic->PlayOggFile(Settings.ogg_path);
|
||||||
|
}
|
||||||
|
bgMusic->SetPlayTime(thetimeofbg);
|
||||||
|
SetVolumeOgg(255*(Settings.volume/100.0));
|
||||||
|
if (choice == 3) {
|
||||||
|
Sys_LoadMenu(); // Back to System Menu
|
||||||
|
} else if (choice == 2) {
|
||||||
|
Sys_BackToLoader();
|
||||||
|
} else {
|
||||||
|
homo.ResetState();
|
||||||
|
}
|
||||||
|
optionBrowser2.SetState(STATE_DEFAULT);
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = optionBrowser2.GetClickedOption();
|
||||||
|
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
case 0:
|
case 0:
|
||||||
videoChoice = (videoChoice + 1) % CFG_VIDEO_COUNT;
|
videoChoice = (videoChoice + 1) % CFG_VIDEO_COUNT;
|
||||||
if (videoChoice >= 6)
|
|
||||||
videoChoice = 0;
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
viChoice = (viChoice + 1) % 2;
|
viChoice = (viChoice + 1) % 2;
|
||||||
if (viChoice >= 2)
|
|
||||||
viChoice = 0;
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
languageChoice = (languageChoice + 1) % CFG_LANG_COUNT;
|
languageChoice = (languageChoice + 1) % CFG_LANG_COUNT;
|
||||||
if (languageChoice >= 11)
|
|
||||||
languageChoice = 0;
|
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
ocarinaChoice = (ocarinaChoice + 1) % 2;
|
ocarinaChoice = (ocarinaChoice + 1) % 2;
|
||||||
if ( ocarinaChoice >= 2)
|
|
||||||
ocarinaChoice = 0;
|
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
iosChoice = (iosChoice + 1) % 3;
|
iosChoice = (iosChoice + 1) % 3;
|
||||||
if ( iosChoice >= 3)
|
|
||||||
iosChoice = 0;
|
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
parentalcontrolChoice = (parentalcontrolChoice + 1) % 5;
|
parentalcontrolChoice = (parentalcontrolChoice + 1) % 5;
|
||||||
if (parentalcontrolChoice >= 5)
|
|
||||||
parentalcontrolChoice = 0;
|
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
fix002 = (fix002+1) % 3;
|
fix002 = (fix002+1) % 3;
|
||||||
if (fix002 >= 3)
|
|
||||||
fix002 = 0; //RUMBLE
|
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
countrystrings = (countrystrings+1) % 2;
|
countrystrings = (countrystrings+1) % 2;
|
||||||
if (countrystrings >= 2)
|
|
||||||
countrystrings = 0;
|
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
alternatedol = (alternatedol+2) % 3;
|
alternatedol = (alternatedol+2) % 3;
|
||||||
if (alternatedol >= 3)
|
|
||||||
alternatedol = 0;
|
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
if (alternatedol == 2) {
|
if (alternatedol == 2) {
|
||||||
@ -2300,10 +2240,34 @@ int GameSettings(struct discHdr * header) {
|
|||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
reloadblock = (reloadblock+1) % 2;
|
reloadblock = (reloadblock+1) % 2;
|
||||||
if (reloadblock >= 2)
|
|
||||||
reloadblock = 0;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (saveBtn.GetState() == STATE_CLICKED) {
|
||||||
|
|
||||||
|
if (isInserted(bootDevice)) {
|
||||||
|
if (CFG_save_game_opt(header->id)) {
|
||||||
|
/* commented because the database language now depends on the main language setting, this could be enabled again if there is a separate language setting for the database
|
||||||
|
// if game language has changed when saving game settings, reload titles
|
||||||
|
int opt_langnew = 0;
|
||||||
|
game_cfg = CFG_get_game_opt(header->id);
|
||||||
|
if (game_cfg) opt_langnew = game_cfg->language;
|
||||||
|
if (Settings.titlesOverride==1 && opt_lang != opt_langnew)
|
||||||
|
OpenXMLDatabase(Settings.titlestxt_path, Settings.db_language, Settings.db_JPtoEN, true, true, false); // open file, reload titles, do not keep in memory
|
||||||
|
// titles are refreshed in menu.cpp as soon as this function returns
|
||||||
|
*/
|
||||||
|
game_cfg = CFG_get_game_opt(header->id); // needed here for "if (game_cfg)" earlier in case it's the first time settings are saved for a game
|
||||||
|
WindowPrompt(tr("Successfully Saved"), 0, tr("OK"));
|
||||||
|
} else {
|
||||||
|
WindowPrompt(tr("Save Failed"), 0, tr("OK"));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
WindowPrompt(tr("No SD-Card inserted!"), tr("Insert an SD-Card to save."), tr("OK"));
|
||||||
|
}
|
||||||
|
|
||||||
|
saveBtn.ResetState();
|
||||||
|
optionBrowser2.SetFocus(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2347,8 +2311,7 @@ int GameSettings(struct discHdr * header) {
|
|||||||
optionBrowser2.SetClickable(true);
|
optionBrowser2.SetClickable(true);
|
||||||
ResumeGui();
|
ResumeGui();
|
||||||
|
|
||||||
bool firstRun = true;
|
VIDEO_WaitVSync ();
|
||||||
|
|
||||||
optionBrowser2.SetEffect(EFFECT_FADE, 20);
|
optionBrowser2.SetEffect(EFFECT_FADE, 20);
|
||||||
while (optionBrowser2.GetEffect() > 0) usleep(50);
|
while (optionBrowser2.GetEffect() > 0) usleep(50);
|
||||||
|
|
||||||
@ -2361,7 +2324,7 @@ int GameSettings(struct discHdr * header) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (shutdown == 1)
|
if (shutdown == 1)
|
||||||
Sys_Shutdown();
|
Sys_Shutdown();
|
||||||
else if (reset == 1)
|
else if (reset == 1)
|
||||||
Sys_Reboot();
|
Sys_Reboot();
|
||||||
@ -2391,10 +2354,6 @@ int GameSettings(struct discHdr * header) {
|
|||||||
|
|
||||||
ret = optionBrowser2.GetClickedOption();
|
ret = optionBrowser2.GetClickedOption();
|
||||||
|
|
||||||
if(firstRun || ret >= 0)
|
|
||||||
{
|
|
||||||
firstRun = false;
|
|
||||||
|
|
||||||
int choice1;
|
int choice1;
|
||||||
char tmp[200];
|
char tmp[200];
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
@ -2477,7 +2436,6 @@ int GameSettings(struct discHdr * header) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
optionBrowser2.SetEffect(EFFECT_FADE, -20);
|
optionBrowser2.SetEffect(EFFECT_FADE, -20);
|
||||||
while (optionBrowser2.GetEffect() > 0) usleep(50);
|
while (optionBrowser2.GetEffect() > 0) usleep(50);
|
||||||
pageToDisplay = 1;
|
pageToDisplay = 1;
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include <wctype.h>
|
#include <wctype.h>
|
||||||
#include "getentries.h"
|
#include "getentries.h"
|
||||||
#include "FreeTypeGX.h"
|
|
||||||
|
|
||||||
#include "../prompts/TitleBrowser.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)
|
if(get_block(header) >= Settings.parentalcontrol)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
wchar_t *wname = charToWideChar(get_title(header));
|
wchar_t *wname = FreeTypeGX::charToWideChar(get_title(header));
|
||||||
if(wname) nameList.push_back(wname);
|
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++)
|
for(i=0; i<gameCnt; i++)
|
||||||
{
|
{
|
||||||
u32 nextFilterChar = 0x10000;
|
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(gameName == NULL) goto error;
|
||||||
|
|
||||||
if(wcslen(gameName) > filter_len)
|
if(wcslen(gameName) > filter_len)
|
||||||
@ -392,7 +391,7 @@ int buildTitleList(int t, wchar_t* gameFilter, discHdr ** PgameList, u32 *PgameC
|
|||||||
|
|
||||||
if(gameFilter && *gameFilter) {
|
if(gameFilter && *gameFilter) {
|
||||||
u32 filter_len = wcslen(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)) {
|
if (!gameName || wcsnicmp(gameName, gameFilter, filter_len)) {
|
||||||
delete [] gameName;
|
delete [] gameName;
|
||||||
continue;
|
continue;
|
||||||
@ -487,7 +486,7 @@ int __Menu_GetGameList(int t, wchar_t* gameFilter, discHdr ** PgameList, u32 *Pg
|
|||||||
|
|
||||||
if(gameFilter && *gameFilter && t==0) {
|
if(gameFilter && *gameFilter && t==0) {
|
||||||
u32 filter_len = wcslen(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)) {
|
if (!gameName || wcsnicmp(gameName, gameFilter, filter_len)) {
|
||||||
delete [] gameName;
|
delete [] gameName;
|
||||||
continue;
|
continue;
|
||||||
|
@ -218,12 +218,12 @@ void StopGX() {
|
|||||||
* Renders everything current sent to GX, and flushes video
|
* Renders everything current sent to GX, and flushes video
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void Menu_Render() {
|
void Menu_Render() {
|
||||||
|
GX_DrawDone ();
|
||||||
|
|
||||||
whichfb ^= 1; // flip framebuffer
|
whichfb ^= 1; // flip framebuffer
|
||||||
GX_SetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE);
|
GX_SetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE);
|
||||||
GX_SetColorUpdate(GX_TRUE);
|
GX_SetColorUpdate(GX_TRUE);
|
||||||
GX_CopyDisp(xfb[whichfb],GX_TRUE);
|
GX_CopyDisp(xfb[whichfb],GX_TRUE);
|
||||||
GX_DrawDone ();
|
|
||||||
VIDEO_SetNextFramebuffer(xfb[whichfb]);
|
VIDEO_SetNextFramebuffer(xfb[whichfb]);
|
||||||
VIDEO_Flush();
|
VIDEO_Flush();
|
||||||
VIDEO_WaitVSync();
|
VIDEO_WaitVSync();
|
||||||
|
@ -141,11 +141,9 @@ s32 Wad_Install(FILE *fp)
|
|||||||
|
|
||||||
GuiText btn1Txt(tr("OK"), 22, THEME.prompttext);
|
GuiText btn1Txt(tr("OK"), 22, THEME.prompttext);
|
||||||
GuiImage btn1Img(&btnOutline);
|
GuiImage btn1Img(&btnOutline);
|
||||||
if (Settings.wsprompt == yes)
|
if (Settings.wsprompt == yes){
|
||||||
{
|
|
||||||
btn1Txt.SetWidescreen(CFG.widescreen);
|
btn1Txt.SetWidescreen(CFG.widescreen);
|
||||||
btn1Img.SetWidescreen(CFG.widescreen);
|
btn1Img.SetWidescreen(CFG.widescreen);}
|
||||||
}
|
|
||||||
GuiButton btn1(&btn1Img,&btn1Img, 2, 4, 0, -35, &trigA, &btnSoundOver, &btnClick,1);
|
GuiButton btn1(&btn1Img,&btn1Img, 2, 4, 0, -35, &trigA, &btnSoundOver, &btnClick,1);
|
||||||
btn1.SetLabel(&btn1Txt);
|
btn1.SetLabel(&btn1Txt);
|
||||||
btn1.SetState(STATE_SELECTED);
|
btn1.SetState(STATE_SELECTED);
|
||||||
@ -472,11 +470,9 @@ s32 Wad_Uninstall(FILE *fp)
|
|||||||
|
|
||||||
GuiText btn1Txt(tr("OK"), 22, THEME.prompttext);
|
GuiText btn1Txt(tr("OK"), 22, THEME.prompttext);
|
||||||
GuiImage btn1Img(&btnOutline);
|
GuiImage btn1Img(&btnOutline);
|
||||||
if (Settings.wsprompt == yes)
|
if (Settings.wsprompt == yes){
|
||||||
{
|
|
||||||
btn1Txt.SetWidescreen(CFG.widescreen);
|
btn1Txt.SetWidescreen(CFG.widescreen);
|
||||||
btn1Img.SetWidescreen(CFG.widescreen);
|
btn1Img.SetWidescreen(CFG.widescreen);}
|
||||||
}
|
|
||||||
GuiButton btn1(&btn1Img,&btn1Img, 2, 4, 0, -55, &trigA, &btnSoundOver, &btnClick,1);
|
GuiButton btn1(&btn1Img,&btn1Img, 2, 4, 0, -55, &trigA, &btnSoundOver, &btnClick,1);
|
||||||
btn1.SetLabel(&btn1Txt);
|
btn1.SetLabel(&btn1Txt);
|
||||||
btn1.SetState(STATE_SELECTED);
|
btn1.SetState(STATE_SELECTED);
|
||||||
|
Loading…
Reference in New Issue
Block a user