mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-12-28 12:51:52 +01:00
*Little changes to FreetypeGX, also cleaned it up a lot
*Added errboot4, errboot5, errboot6 to translations *Updated english.ini and italian.ini for this rev
This commit is contained in:
parent
8301e6dfd2
commit
aa2d58c188
@ -22,22 +22,13 @@
|
||||
#include "FreeTypeGX.h"
|
||||
#include "memory/mem2.hpp"
|
||||
|
||||
/**
|
||||
* Default constructor for the FreeTypeGX class.
|
||||
* @param positionFormat Optional positional format (GX_POS_*) of the texture as defined by the libogc gx.h header file. If not specified default value is GX_POS_XYZ.
|
||||
*/
|
||||
FreeTypeGX::FreeTypeGX(uint8_t positionFormat)
|
||||
FreeTypeGX::FreeTypeGX()
|
||||
{
|
||||
FT_Init_FreeType(&this->ftLibrary);
|
||||
|
||||
this->positionFormat = positionFormat;
|
||||
reset();
|
||||
this->ftFace = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default destructor for the FreeTypeGX class.
|
||||
*/
|
||||
FreeTypeGX::~FreeTypeGX()
|
||||
{
|
||||
this->unloadFont();
|
||||
@ -45,15 +36,6 @@ FreeTypeGX::~FreeTypeGX()
|
||||
FT_Done_FreeType(this->ftLibrary);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a short char sctring to a wide char string.
|
||||
*
|
||||
* This routine converts a supplied shot character string into a wide character string.
|
||||
* Note that it is the user's responsibility to clear the returned buffer once it is no longer needed.
|
||||
*
|
||||
* @param strChar Character string to be converted.
|
||||
* @return Wide character representation of supplied character string.
|
||||
*/
|
||||
wchar_t* FreeTypeGX::charToWideChar(char* strChar)
|
||||
{
|
||||
wchar_t *strWChar;
|
||||
@ -66,59 +48,34 @@ wchar_t* FreeTypeGX::charToWideChar(char* strChar)
|
||||
return strWChar;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 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(uint8_t* fontBuffer, FT_Long bufferSize, FT_UInt pointSize, FT_Pos weight, uint32_t index, bool cacheAll)
|
||||
uint16_t FreeTypeGX::loadFont(FT_Byte *fontBuffer, FT_Long bufferSize, FT_UInt pointSize, FT_Pos weight, uint32_t index, bool cacheAll)
|
||||
{
|
||||
this->unloadFont();
|
||||
this->ftPointSize = pointSize != 0 ? pointSize : this->ftPointSize;
|
||||
this->ftWeight = weight;
|
||||
|
||||
// check if the index is valid
|
||||
// Check if the index is valid
|
||||
if (index != 0)
|
||||
{
|
||||
FT_New_Memory_Face(this->ftLibrary, (FT_Byte *)fontBuffer, bufferSize, -1, &this->ftFace);
|
||||
FT_New_Memory_Face(this->ftLibrary, fontBuffer, bufferSize, -1, &this->ftFace);
|
||||
if (index >= (uint32_t) this->ftFace->num_faces)
|
||||
index = this->ftFace->num_faces - 1; // Use the last face
|
||||
FT_Done_Face(this->ftFace);
|
||||
this->ftFace = NULL;
|
||||
}
|
||||
|
||||
FT_New_Memory_Face(this->ftLibrary, (FT_Byte *)fontBuffer, bufferSize, index, &this->ftFace);
|
||||
FT_New_Memory_Face(this->ftLibrary, fontBuffer, bufferSize, index, &this->ftFace);
|
||||
FT_Set_Pixel_Sizes(this->ftFace, 0, this->ftPointSize);
|
||||
|
||||
this->ftSlot = this->ftFace->glyph;
|
||||
this->ftKerningEnabled = FT_HAS_KERNING(this->ftFace);
|
||||
|
||||
if (cacheAll) {
|
||||
if (cacheAll)
|
||||
return this->cacheGlyphDataComplete();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* \overload
|
||||
*/
|
||||
uint16_t FreeTypeGX::loadFont(const uint8_t* fontBuffer, FT_Long bufferSize, FT_UInt pointSize, FT_Pos weight, uint32_t index, bool cacheAll)
|
||||
{
|
||||
return this->loadFont((uint8_t *)fontBuffer, bufferSize, pointSize, weight, index, cacheAll);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
void FreeTypeGX::unloadFont()
|
||||
{
|
||||
if(this->fontData.size() == 0)
|
||||
@ -130,25 +87,14 @@ void FreeTypeGX::unloadFont()
|
||||
this->fontData.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Caches the given font glyph in the instance font texture buffer.
|
||||
*
|
||||
* This routine renders and stores the requested glyph's bitmap and relevant information into its own quickly addressible
|
||||
* structure within an instance-specific map.
|
||||
*
|
||||
* @param charCode The requested glyph's character code.
|
||||
* @return A pointer to the allocated font structure.
|
||||
*/
|
||||
ftgxCharData *FreeTypeGX::cacheGlyphData(wchar_t charCode)
|
||||
{
|
||||
FT_UInt gIndex;
|
||||
uint16_t textureWidth = 0, textureHeight = 0;
|
||||
|
||||
gIndex = FT_Get_Char_Index( this->ftFace, charCode );
|
||||
if (!FT_Load_Glyph(this->ftFace, gIndex, FT_LOAD_DEFAULT ))
|
||||
if(!FT_Load_Glyph(this->ftFace, gIndex, FT_LOAD_DEFAULT | FT_LOAD_RENDER))
|
||||
{
|
||||
FT_Render_Glyph( this->ftSlot, FT_RENDER_MODE_NORMAL );
|
||||
|
||||
if(this->ftSlot->format == FT_GLYPH_FORMAT_BITMAP)
|
||||
{
|
||||
FT_Bitmap *glyphBitmap = &this->ftSlot->bitmap;
|
||||
@ -177,12 +123,6 @@ ftgxCharData *FreeTypeGX::cacheGlyphData(wchar_t charCode)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Locates each character in this wrapper's configured font face and proccess them.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
uint16_t FreeTypeGX::cacheGlyphDataComplete()
|
||||
{
|
||||
uint16_t i = 0;
|
||||
@ -199,61 +139,43 @@ uint16_t FreeTypeGX::cacheGlyphDataComplete()
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the rendered bitmap into the relevant structure's data buffer.
|
||||
*
|
||||
* This routine does a simple byte-wise copy of the glyph's rendered 8-bit grayscale bitmap into the structure's buffer.
|
||||
* Each byte is converted from the bitmap's intensity value into the a uint32_t RGBA value.
|
||||
*
|
||||
* @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.
|
||||
*/
|
||||
|
||||
void FreeTypeGX::loadGlyphData(FT_Bitmap *bmp, ftgxCharData *charData)
|
||||
{
|
||||
int glyphSize = (charData->textureWidth * charData->textureHeight) >> 1;
|
||||
int glyphSize = (charData->textureWidth * charData->textureHeight) >> 1;
|
||||
|
||||
uint8_t *glyphData = (uint8_t *) MEM2_alloc(glyphSize);
|
||||
if(glyphData < 0)
|
||||
return;
|
||||
memset(glyphData, 0x00, glyphSize);
|
||||
uint8_t *glyphData = (uint8_t *) MEM2_alloc(glyphSize);
|
||||
if(glyphData < 0)
|
||||
return;
|
||||
memset(glyphData, 0x00, glyphSize);
|
||||
|
||||
uint8_t *src = (uint8_t *)bmp->buffer;
|
||||
uint8_t *dst = glyphData;
|
||||
int32_t pos, x1, y1, x, y;
|
||||
uint8_t *src = (uint8_t *)bmp->buffer;
|
||||
uint8_t *dst = glyphData;
|
||||
int32_t pos, x1, y1, x, y;
|
||||
|
||||
for(y1 = 0; y1 < bmp->rows; y1 += 8)
|
||||
{
|
||||
for(x1 = 0; x1 < bmp->width; x1 += 8)
|
||||
{
|
||||
for(y = y1; y < (y1 + 8); y++)
|
||||
{
|
||||
for(x = x1; x < (x1 + 8); x += 2, dst++)
|
||||
{
|
||||
if(x >= bmp->width || y >= bmp->rows)
|
||||
continue;
|
||||
for(y1 = 0; y1 < bmp->rows; y1 += 8)
|
||||
{
|
||||
for(x1 = 0; x1 < bmp->width; x1 += 8)
|
||||
{
|
||||
for(y = y1; y < (y1 + 8); y++)
|
||||
{
|
||||
for(x = x1; x < (x1 + 8); x += 2, dst++)
|
||||
{
|
||||
if(x >= bmp->width || y >= bmp->rows)
|
||||
continue;
|
||||
|
||||
pos = y * bmp->width + x;
|
||||
*dst = (src[pos] & 0xF0);
|
||||
pos = y * bmp->width + x;
|
||||
*dst = (src[pos] & 0xF0);
|
||||
|
||||
if(x+1 < bmp->width)
|
||||
*dst |= (src[pos + 1] >> 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
DCFlushRange(glyphData, glyphSize);
|
||||
charData->glyphDataTexture = glyphData;
|
||||
*dst |= (src[pos + 1] >> 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
DCFlushRange(glyphData, glyphSize);
|
||||
charData->glyphDataTexture = glyphData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the x offset of the rendered string.
|
||||
*
|
||||
* This routine calculates the x offset of the rendered string based off of a supplied positional format parameter.
|
||||
*
|
||||
* @param width Current pixel width of the string.
|
||||
* @param format Positional format of the string.
|
||||
*/
|
||||
uint16_t FreeTypeGX::getStyleOffsetWidth(uint16_t width, uint16_t format)
|
||||
{
|
||||
if (format & FTGX_JUSTIFY_LEFT )
|
||||
@ -265,14 +187,6 @@ uint16_t FreeTypeGX::getStyleOffsetWidth(uint16_t width, uint16_t format)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the y offset of the rendered string.
|
||||
*
|
||||
* This routine calculates the y offset of the rendered string based off of a supplied positional format parameter.
|
||||
*
|
||||
* @param offset Current pixel offset data of the string.
|
||||
* @param format Positional format of the string.
|
||||
*/
|
||||
uint16_t FreeTypeGX::getStyleOffsetHeight(ftgxDataOffset offset, uint16_t format)
|
||||
{
|
||||
if (format & FTGX_ALIGN_TOP )
|
||||
@ -284,20 +198,7 @@ uint16_t FreeTypeGX::getStyleOffsetHeight(ftgxDataOffset offset, uint16_t format
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes the supplied text string and prints the results at the specified coordinates.
|
||||
*
|
||||
* This routine processes each character of the supplied text string, loads the relevant preprocessed bitmap buffer,
|
||||
* a texture from said buffer, and loads the resultant texture into the EFB.
|
||||
*
|
||||
* @param x Screen X coordinate at which to output the text.
|
||||
* @param y Screen Y coordinate at which to output the text. Note that this value corresponds to the text string origin and not the top or bottom of the glyphs.
|
||||
* @param text NULL terminated string to output.
|
||||
* @param color Optional color to apply to the text characters. If not specified default value is ftgxWhite: (GXColor){0xff, 0xff, 0xff, 0xff}
|
||||
* @param textStyle Flags which specify any styling which should be applied to the rendered string.
|
||||
* @return The number of characters printed.
|
||||
*/
|
||||
uint16_t FreeTypeGX::drawText(uint16_t x, uint16_t y, wchar_t *text, GXColor color, uint16_t textStyle)
|
||||
uint16_t FreeTypeGX::drawText(uint16_t x, uint16_t y, const wchar_t *text, GXColor color, uint16_t textStyle)
|
||||
{
|
||||
uint16_t strLength = wcslen(text);
|
||||
uint16_t x_pos = x, printed = 0;
|
||||
@ -305,9 +206,9 @@ uint16_t FreeTypeGX::drawText(uint16_t x, uint16_t y, wchar_t *text, GXColor col
|
||||
GXTexObj glyphTexture;
|
||||
FT_Vector pairDelta;
|
||||
|
||||
if(textStyle & 0x000F)
|
||||
if(textStyle & FTGX_JUSTIFY_MASK)
|
||||
x_offset = this->getStyleOffsetWidth(this->getWidth(text), textStyle);
|
||||
if(textStyle & 0x00F0)
|
||||
if(textStyle & FTGX_ALIGN_MASK)
|
||||
y_offset = this->getStyleOffsetHeight(this->getOffset(text), textStyle);
|
||||
|
||||
GX_SetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_CLEAR);
|
||||
@ -315,7 +216,7 @@ uint16_t FreeTypeGX::drawText(uint16_t x, uint16_t y, wchar_t *text, GXColor col
|
||||
for (uint16_t i = 0; i < strLength; i++)
|
||||
{
|
||||
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]];
|
||||
else
|
||||
glyphData = this->cacheGlyphData(text[i]);
|
||||
@ -325,85 +226,36 @@ uint16_t FreeTypeGX::drawText(uint16_t x, uint16_t y, wchar_t *text, GXColor col
|
||||
|
||||
if(this->ftKerningEnabled && i)
|
||||
{
|
||||
FT_Get_Kerning( this->ftFace, this->fontData[text[i - 1]].glyphIndex, glyphData->glyphIndex, FT_KERNING_DEFAULT, &pairDelta );
|
||||
FT_Get_Kerning( this->ftFace, this->fontData[text[i - 1]].glyphIndex, glyphData->glyphIndex, FT_KERNING_DEFAULT, &pairDelta);
|
||||
x_pos += pairDelta.x >> 6;
|
||||
}
|
||||
|
||||
GX_InitTexObj(&glyphTexture, glyphData->glyphDataTexture, glyphData->textureWidth, glyphData->textureHeight, GX_TF_I4, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
this->copyTextureToFramebuffer(&glyphTexture, this->positionFormat, glyphData->textureWidth, glyphData->textureHeight, x_pos - x_offset, y - glyphData->renderOffsetY - y_offset, color);
|
||||
this->copyTextureToFramebuffer(&glyphTexture, glyphData->textureWidth, glyphData->textureHeight, x_pos - x_offset, y - glyphData->renderOffsetY - y_offset, color);
|
||||
|
||||
x_pos += glyphData->glyphAdvanceX;
|
||||
printed++;
|
||||
}
|
||||
}
|
||||
|
||||
if(textStyle & 0x0F00)
|
||||
if(textStyle & FTGX_STYLE_MASK)
|
||||
this->drawTextFeature(x - x_offset, y, this->getWidth(text), this->getOffset(text), textStyle, color);
|
||||
|
||||
return printed;
|
||||
}
|
||||
|
||||
/**
|
||||
* \overload
|
||||
*/
|
||||
uint16_t FreeTypeGX::drawText(uint16_t x, uint16_t y, wchar_t const *text, GXColor color, uint16_t textStyle)
|
||||
{
|
||||
return this->drawText(x, y, (wchar_t *)text, color, textStyle);
|
||||
}
|
||||
|
||||
void FreeTypeGX::drawTextFeature(uint16_t x, uint16_t y, uint16_t width, ftgxDataOffset offsetData, uint16_t format, GXColor color)
|
||||
{
|
||||
uint16_t featureHeight = this->ftPointSize >> 4 > 0 ? this->ftPointSize >> 4 : 1;
|
||||
|
||||
if (format & FTGX_STYLE_UNDERLINE )
|
||||
{
|
||||
switch(format & 0x00F0)
|
||||
{
|
||||
case FTGX_ALIGN_TOP:
|
||||
this->copyFeatureToFramebuffer(this->positionFormat, width, featureHeight, x, y + offsetData.max + 1, color);
|
||||
break;
|
||||
case FTGX_ALIGN_MIDDLE:
|
||||
this->copyFeatureToFramebuffer(this->positionFormat, width, featureHeight, x, y + ((offsetData.max - offsetData.min) >> 1) + 1, color);
|
||||
break;
|
||||
case FTGX_ALIGN_BOTTOM:
|
||||
this->copyFeatureToFramebuffer(this->positionFormat, width, featureHeight, x, y - offsetData.min, color);
|
||||
break;
|
||||
default:
|
||||
this->copyFeatureToFramebuffer(this->positionFormat, width, featureHeight, x, y + 1, color);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (format & FTGX_STYLE_UNDERLINE)
|
||||
this->copyFeatureToFramebuffer(width, featureHeight, x, y + 1, color);
|
||||
|
||||
if (format & FTGX_STYLE_STRIKE )
|
||||
{
|
||||
switch(format & 0x00F0)
|
||||
{
|
||||
case FTGX_ALIGN_TOP:
|
||||
this->copyFeatureToFramebuffer(this->positionFormat, width, featureHeight, x, y + ((offsetData.max + offsetData.min) >> 1), color);
|
||||
break;
|
||||
case FTGX_ALIGN_MIDDLE:
|
||||
this->copyFeatureToFramebuffer(this->positionFormat, width, featureHeight, x, y, color);
|
||||
break;
|
||||
case FTGX_ALIGN_BOTTOM:
|
||||
this->copyFeatureToFramebuffer(this->positionFormat, width, featureHeight, x, y - ((offsetData.max + offsetData.min) >> 1), color);
|
||||
break;
|
||||
default:
|
||||
this->copyFeatureToFramebuffer(this->positionFormat, width, featureHeight, x, y - ((offsetData.max - offsetData.min) >> 1), color);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (format & FTGX_STYLE_STRIKE)
|
||||
this->copyFeatureToFramebuffer(width, featureHeight, x, y - ((offsetData.max) >> 1), color);
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes the supplied string and return the width of the string in pixels.
|
||||
*
|
||||
* This routine processes each character of the supplied text string and calculates the width of the entire string.
|
||||
* Note that if precaching of the entire font set is not enabled any uncached glyph will be cached after the call to this function.
|
||||
*
|
||||
* @param text NULL terminated string to calculate.
|
||||
* @return The width of the text string in pixels.
|
||||
*/
|
||||
uint16_t FreeTypeGX::getWidth(wchar_t *text)
|
||||
uint16_t FreeTypeGX::getWidth(const wchar_t *text)
|
||||
{
|
||||
uint16_t strLength = wcslen(text);
|
||||
uint16_t strWidth = 0;
|
||||
@ -412,7 +264,7 @@ uint16_t FreeTypeGX::getWidth(wchar_t *text)
|
||||
for (uint16_t i = 0; i < strLength; i++)
|
||||
{
|
||||
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]];
|
||||
else
|
||||
glyphData = this->cacheGlyphData(text[i]);
|
||||
@ -420,7 +272,7 @@ uint16_t FreeTypeGX::getWidth(wchar_t *text)
|
||||
{
|
||||
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( this->ftFace, this->fontData[text[i - 1]].glyphIndex, glyphData->glyphIndex, FT_KERNING_DEFAULT, &pairDelta);
|
||||
strWidth += pairDelta.x >> 6;
|
||||
}
|
||||
|
||||
@ -431,49 +283,13 @@ uint16_t FreeTypeGX::getWidth(wchar_t *text)
|
||||
return strWidth;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* \overload
|
||||
*/
|
||||
uint16_t FreeTypeGX::getWidth(wchar_t const *text)
|
||||
{
|
||||
return this->getWidth((wchar_t *)text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes the supplied string and return the height of the string in pixels.
|
||||
*
|
||||
* This routine processes each character of the supplied text string and calculates the height of the entire string.
|
||||
* Note that if precaching of the entire font set is not enabled any uncached glyph will be cached after the call to this function.
|
||||
*
|
||||
* @param text NULL terminated string to calculate.
|
||||
* @return The height of the text string in pixels.
|
||||
*/
|
||||
uint16_t FreeTypeGX::getHeight(wchar_t *text)
|
||||
uint16_t FreeTypeGX::getHeight(const wchar_t *text)
|
||||
{
|
||||
ftgxDataOffset offset = this->getOffset(text);
|
||||
return offset.max + offset.min;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* \overload
|
||||
*/
|
||||
uint16_t FreeTypeGX::getHeight(wchar_t const *text)
|
||||
{
|
||||
return this->getHeight((wchar_t *)text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the maximum offset above and minimum offset below the font origin line.
|
||||
*
|
||||
* This function calculates the maximum pixel height above the font origin line and the minimum
|
||||
* pixel height below the font origin line and returns the values in an addressible structure.
|
||||
*
|
||||
* @param text NULL terminated string to calculate.
|
||||
* @return The max and min values above and below the font origin line.
|
||||
*/
|
||||
ftgxDataOffset FreeTypeGX::getOffset(wchar_t *text)
|
||||
ftgxDataOffset FreeTypeGX::getOffset(const wchar_t *text)
|
||||
{
|
||||
uint16_t strLength = wcslen(text);
|
||||
uint16_t strMax = 0, strMin = 0;
|
||||
@ -481,7 +297,7 @@ ftgxDataOffset FreeTypeGX::getOffset(wchar_t *text)
|
||||
for (uint16_t i = 0; i < strLength; i++)
|
||||
{
|
||||
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]];
|
||||
else
|
||||
glyphData = this->cacheGlyphData(text[i]);
|
||||
@ -495,133 +311,51 @@ ftgxDataOffset FreeTypeGX::getOffset(wchar_t *text)
|
||||
return (ftgxDataOffset){strMax, strMin};
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* \overload
|
||||
*/
|
||||
ftgxDataOffset FreeTypeGX::getOffset(wchar_t const *text)
|
||||
{
|
||||
return this->getOffset(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies the supplied texture quad to the EFB.
|
||||
*
|
||||
* This routine uses the in-built GX quad builder functions to define the texture bounds and location on the EFB target.
|
||||
*
|
||||
* @param texObj A pointer to the glyph's initialized texture object.
|
||||
* @param positionFormat The positional format of the graphics subsystem.
|
||||
* @param texWidth The pixel width of the texture object.
|
||||
* @param texHeight The pixel height of the texture object.
|
||||
* @param screenX The screen X 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.
|
||||
*/
|
||||
void FreeTypeGX::copyTextureToFramebuffer(GXTexObj *texObj, uint8_t positionFormat, uint16_t texWidth, uint16_t texHeight, int16_t screenX, int16_t screenY, GXColor color)
|
||||
void FreeTypeGX::copyTextureToFramebuffer(GXTexObj *texObj, uint16_t texWidth, uint16_t texHeight, int16_t screenX, int16_t screenY, GXColor color)
|
||||
{
|
||||
f32 f32TexWidth = texWidth, f32TexHeight = texHeight;
|
||||
float x = (float)screenX + xPos;
|
||||
float y = (float)screenY + yPos;
|
||||
|
||||
GX_LoadTexObj(texObj, GX_TEXMAP0);
|
||||
|
||||
// GX_SetTevOp (GX_TEVSTAGE0, GX_MODULATE);
|
||||
// GX_SetVtxDesc (GX_VA_TEX0, GX_DIRECT);
|
||||
|
||||
GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
|
||||
switch(positionFormat)
|
||||
{
|
||||
case GX_POS_XY:
|
||||
GX_Position2f32(x * xScale, y * yScale);
|
||||
GX_Color4u8(color.r, color.g, color.b, color.a);
|
||||
GX_TexCoord2f32(0.0f, 0.0f);
|
||||
|
||||
GX_Position2f32((f32TexWidth + x) * xScale, y * yScale);
|
||||
GX_Color4u8(color.r, color.g, color.b, color.a);
|
||||
GX_TexCoord2f32(1.0f, 0.0f);
|
||||
|
||||
GX_Position2f32((f32TexWidth + x) * xScale, (f32TexHeight + y) * yScale);
|
||||
GX_Color4u8(color.r, color.g, color.b, color.a);
|
||||
GX_TexCoord2f32(1.0f, 1.0f);
|
||||
|
||||
GX_Position2f32(x * xScale, (f32TexHeight + y) * yScale);
|
||||
GX_Color4u8(color.r, color.g, color.b, color.a);
|
||||
GX_TexCoord2f32(0.0f, 1.0f);
|
||||
break;
|
||||
|
||||
case GX_POS_XYZ:
|
||||
GX_Position3f32(x * xScale, y * yScale, 0);
|
||||
GX_Color4u8(color.r, color.g, color.b, color.a);
|
||||
GX_TexCoord2f32(0.0f, 0.0f);
|
||||
GX_Position3f32(x * xScale, y * yScale, 0);
|
||||
GX_Color4u8(color.r, color.g, color.b, color.a);
|
||||
GX_TexCoord2f32(0.0f, 0.0f);
|
||||
|
||||
GX_Position3f32((f32TexWidth + x) * xScale, y * yScale, 0);
|
||||
GX_Color4u8(color.r, color.g, color.b, color.a);
|
||||
GX_TexCoord2f32(1.0f, 0.0f);
|
||||
GX_Position3f32((f32TexWidth + x) * xScale, y * yScale, 0);
|
||||
GX_Color4u8(color.r, color.g, color.b, color.a);
|
||||
GX_TexCoord2f32(1.0f, 0.0f);
|
||||
|
||||
GX_Position3f32((f32TexWidth + x) * xScale, (f32TexHeight + y) * yScale, 0);
|
||||
GX_Color4u8(color.r, color.g, color.b, color.a);
|
||||
GX_TexCoord2f32(1.0f, 1.0f);
|
||||
GX_Position3f32((f32TexWidth + x) * xScale, (f32TexHeight + y) * yScale, 0);
|
||||
GX_Color4u8(color.r, color.g, color.b, color.a);
|
||||
GX_TexCoord2f32(1.0f, 1.0f);
|
||||
|
||||
GX_Position3f32(x * xScale, (f32TexHeight + y) * yScale, 0);
|
||||
GX_Color4u8(color.r, color.g, color.b, color.a);
|
||||
GX_TexCoord2f32(0.0f, 1.0f);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
GX_Position3f32(x * xScale, (f32TexHeight + y) * yScale, 0);
|
||||
GX_Color4u8(color.r, color.g, color.b, color.a);
|
||||
GX_TexCoord2f32(0.0f, 1.0f);
|
||||
|
||||
GX_End();
|
||||
// GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR);
|
||||
// GX_SetVtxDesc (GX_VA_TEX0, GX_NONE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a feature quad to the EFB.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param positionFormat The positional format of the graphics subsystem.
|
||||
* @param featureWidth The pixel width of the quad.
|
||||
* @param featureHeight The pixel height of the quad.
|
||||
* @param screenX The screen X 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.
|
||||
*/
|
||||
void FreeTypeGX::copyFeatureToFramebuffer(uint8_t positionFormat, uint16_t featureWidth, uint16_t featureHeight, int16_t screenX, int16_t screenY, GXColor color)
|
||||
void FreeTypeGX::copyFeatureToFramebuffer(uint16_t featureWidth, uint16_t featureHeight, int16_t screenX, int16_t screenY, GXColor color)
|
||||
{
|
||||
f32 f32FeatureWidth = featureWidth, f32FeatureHeight = featureHeight;
|
||||
|
||||
GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
|
||||
switch(positionFormat)
|
||||
{
|
||||
case GX_POS_XY:
|
||||
GX_Position2f32(screenX, screenY);
|
||||
GX_Color4u8(color.r, color.g, color.b, color.a);
|
||||
|
||||
GX_Position2f32(f32FeatureWidth + screenX, screenY);
|
||||
GX_Color4u8(color.r, color.g, color.b, color.a);
|
||||
|
||||
GX_Position2f32(f32FeatureWidth + screenX, f32FeatureHeight + screenY);
|
||||
GX_Color4u8(color.r, color.g, color.b, color.a);
|
||||
|
||||
GX_Position2f32(screenX, f32FeatureHeight + screenY);
|
||||
GX_Color4u8(color.r, color.g, color.b, color.a);
|
||||
break;
|
||||
|
||||
case GX_POS_XYZ:
|
||||
GX_Position3f32(screenX, screenY, 0);
|
||||
GX_Color4u8(color.r, color.g, color.b, color.a);
|
||||
GX_Position3f32(screenX, screenY, 0);
|
||||
GX_Color4u8(color.r, color.g, color.b, color.a);
|
||||
|
||||
GX_Position3f32(f32FeatureWidth + screenX, screenY, 0);
|
||||
GX_Color4u8(color.r, color.g, color.b, color.a);
|
||||
GX_Position3f32(f32FeatureWidth + screenX, screenY, 0);
|
||||
GX_Color4u8(color.r, color.g, color.b, color.a);
|
||||
|
||||
GX_Position3f32(f32FeatureWidth + screenX, f32FeatureHeight + screenY, 0);
|
||||
GX_Color4u8(color.r, color.g, color.b, color.a);
|
||||
GX_Position3f32(f32FeatureWidth + screenX, f32FeatureHeight + screenY, 0);
|
||||
GX_Color4u8(color.r, color.g, color.b, color.a);
|
||||
|
||||
GX_Position3f32(screenX, f32FeatureHeight + screenY, 0);
|
||||
GX_Color4u8(color.r, color.g, color.b, color.a);
|
||||
|
||||
GX_Position3f32(screenX, f32FeatureHeight + screenY, 0);
|
||||
GX_Color4u8(color.r, color.g, color.b, color.a);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
GX_End();
|
||||
}
|
||||
}
|
@ -19,135 +19,6 @@
|
||||
* along with FreeTypeGX. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** \mainpage FreeTypeGX
|
||||
*
|
||||
* \section sec_intro Introduction
|
||||
*
|
||||
* FreeTypeGX is a wrapper class for libFreeType which renders a compiled FreeType parsable font into a GX texture for Wii homebrew development.
|
||||
* <br>
|
||||
* FreeTypeGX is written in C++ and makes use of a selectable pre-buffered or buffer-on-demand methodology to allow fast and efficient printing of text to the EFB.
|
||||
* <p>
|
||||
* This library was developed in-full by Armin Tamzarian with the support of developers in \#wiibrew on EFnet.
|
||||
*
|
||||
* \section sec_installation_source Installation (Source Code)
|
||||
*
|
||||
* -# Ensure that you have the <a href = "http://www.tehskeen.com/forums/showthread.php?t=9404">libFreeType</a> Wii library installed in your development environment with the library added to your Makefile where appropriate.
|
||||
* -# Ensure that you have the <a href = "http://code.google.com/p/metaphrasis">Metaphrasis</a> library installed in your development environment with the library added to your Makefile where appropriate.
|
||||
* -# Extract the FreeTypeGX archive.
|
||||
* -# Copy the contents of the <i>src</i> directory into your project's development path.
|
||||
* -# Include the FreeTypeGX header file in your code using syntax such as the following:
|
||||
* \code
|
||||
* #include "FreeTypeGX.h"
|
||||
* \endcode
|
||||
*
|
||||
* \section sec_installation_library Installation (Library)
|
||||
*
|
||||
* -# Ensure that you have the <a href = "http://www.tehskeen.com/forums/showthread.php?t=9404">libFreeType</a> Wii library installed in your development environment with the library added to your Makefile where appropriate.
|
||||
* -# Ensure that you have the <a href = "http://code.google.com/p/metaphrasis">Metaphrasis</a> library installed in your development environment with the library added to your Makefile where appropriate.
|
||||
* -# Extract the FreeTypeGX archive.
|
||||
* -# Copy the contents of the <i>lib</i> directory into your <i>devKitPro/libogc</i> directory.
|
||||
* -# Include the FreeTypeGX header file in your code using syntax such as the following:
|
||||
* \code
|
||||
* #include "FreeTypeGX.h"
|
||||
* \endcode
|
||||
*
|
||||
* \section sec_freetypegx_prerequisites FreeTypeGX Prerequisites
|
||||
*
|
||||
* Before you begin using FreeTypeGX in your project you must ensure that the desired font in compiled into your project. For this example I will assume you are building your project with a Makefile using devKitPro evironment and are attempting to include a font whose filename is rursus_compact_mono.ttf.
|
||||
*
|
||||
* -# Copy the font into a directory which will be processed by the project's Makefile. If you are unsure about where you should place your font just copy the it into your project's source directory.
|
||||
* \n\n
|
||||
* -# Modify the Makefile to convert the font into an object file:
|
||||
* \code
|
||||
* %.ttf.o : %.ttf
|
||||
* @echo $(notdir $<)
|
||||
* $(bin2o)
|
||||
* \endcode
|
||||
* \n
|
||||
* -# Include the font object's generated header file in your source code:
|
||||
* \code
|
||||
* #include "rursus_compact_mono_ttf.h"
|
||||
* \endcode
|
||||
* This header file defines the two variables that you will need for use within your project:
|
||||
* \code
|
||||
* extern const u8 rursus_compact_mono_ttf[]; A pointer to the font buffer within the compiled project.
|
||||
* extern const u32 rursus_compact_mono_ttf_size; The size of the font's buffer in bytes.
|
||||
* \endcode
|
||||
*
|
||||
* \section sec_freetypegx_usage FreeTypeGX Usage
|
||||
*
|
||||
* -# Within the file you included the FreeTypeGX.h header create an instance object of the FreeTypeGX class:
|
||||
* \code
|
||||
* FreeTypeGX *freeTypeGX = new FreeTypeGX();
|
||||
* \endcode
|
||||
* Alternately you can specify a texture format to which you would like to render the font characters. Note that the default value for this parameter is GX_TF_RGBA8.
|
||||
* \code
|
||||
* FreeTypeGX *freeTypeGX = new FreeTypeGX(GX_TF_RGB565);
|
||||
* \endcode
|
||||
* Furthermore, you can also specify a positional format as defined in your graphics subsystem initialization. Note that the default value for this parameter is GX_POS_XYZ.
|
||||
* \code
|
||||
* FreeTypeGX *freeTypeGX = new FreeTypeGX(GX_TF_RGB565, GX_POS_XY);
|
||||
* \endcode
|
||||
* \n
|
||||
* Currently supported textures are:
|
||||
* \li <i>GX_TF_I4</i>
|
||||
* \li <i>GX_TF_I8</i>
|
||||
* \li <i>GX_TF_IA4</i>
|
||||
* \li <i>GX_TF_IA8</i>
|
||||
* \li <i>GX_TF_RGB565</i>
|
||||
* \li <i>GX_TF_RGB5A3</i>
|
||||
* \li <i>GX_TF_RGBA8</i>
|
||||
*
|
||||
* \n
|
||||
* Currently supported position formats are:
|
||||
* \li <i>GX_POS_XY</i>
|
||||
* \li <i>GX_POS_XYZ</i>
|
||||
*
|
||||
* \n
|
||||
* -# Using the allocated FreeTypeGX instance object call the loadFont function to load the font from the compiled buffer and specify the desired point size. Note that this function can be called multiple times to load a new:
|
||||
* \code
|
||||
* fontSystem->loadFont(rursus_compact_mono_ttf, rursus_compact_mono_ttf_size, 64);
|
||||
* \endcode
|
||||
* Alternately you can specify a flag which will load and cache all available font glyphs immidiately. Note that on large font sets enabling this feature could take a significant amount of time.
|
||||
* \code
|
||||
* fontSystem->loadFont(rursus_compact_mono_ttf, rursus_compact_mono_ttf_size, 64, true);
|
||||
* \endcode
|
||||
* \n
|
||||
* -# Using the allocated FreeTypeGX instance object call the drawText function to print a string at the specified screen X and Y coordinates to the current EFB:
|
||||
* \code
|
||||
* freeTypeGX->drawText(10, 25, _TEXT("FreeTypeGX Rocks!"));
|
||||
* \endcode
|
||||
* Alternately you can specify a <i>GXColor</i> object you would like to apply to the printed characters:
|
||||
* \code
|
||||
* freeTypeGX->drawText(10, 25, _TEXT("FreeTypeGX Rocks!"),
|
||||
* (GXColor){0xff, 0xee, 0xaa, 0xff});
|
||||
* \endcode
|
||||
* Furthermore you can also specify a group of styling parameters which will modify the positioning or style of the text:
|
||||
* \code
|
||||
* freeTypeGX->drawText(10, 25, _TEXT("FreeTypeGX Rocks!"),
|
||||
* (GXColor){0xff, 0xee, 0xaa, 0xff},
|
||||
* FTGX_JUSTIFY_CENTER | FTGX_ALIGN_BOTTOM | FTGX_STYLE_UNDERLINE);
|
||||
* \endcode
|
||||
* \n
|
||||
* Currently style parameters are:
|
||||
* \li <i>FTGX_JUSTIFY_LEFT</i>
|
||||
* \li <i>FTGX_JUSTIFY_CENTER</i>
|
||||
* \li <i>FTGX_JUSTIFY_RIGHT</i>
|
||||
* \li <i>FTGX_ALIGN_TOP</i>
|
||||
* \li <i>FTGX_ALIGN_MIDDLE</i>
|
||||
* \li <i>FTGX_ALIGN_BOTTOM</i>
|
||||
* \li <i>FTGX_STYLE_UNDERLINE</i>
|
||||
* \li <i>FTGX_STYLE_STRIKE</i>
|
||||
*
|
||||
* \section sec_license License
|
||||
*
|
||||
* FreeTypeGX is distributed under the GNU Lesser General Public License.
|
||||
*
|
||||
* \section sec_contact Contact
|
||||
*
|
||||
* If you have any suggestions, questions, or comments regarding this library feel free to e-mail me at tamzarian1989 [at] gmail [dawt] com.
|
||||
*/
|
||||
|
||||
#ifndef FREETYPEGX_H_
|
||||
#define FREETYPEGX_H_
|
||||
|
||||
@ -162,58 +33,42 @@
|
||||
#include <wchar.h>
|
||||
#include <map>
|
||||
|
||||
/*! \struct ftgxCharData_
|
||||
*
|
||||
* Font face character glyph relevant data structure.
|
||||
*/
|
||||
typedef struct ftgxCharData_ {
|
||||
uint16_t glyphAdvanceX; /**< Character glyph X coordinate advance in pixels. */
|
||||
uint16_t glyphIndex; /**< Charachter glyph index in the font face. */
|
||||
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. */
|
||||
uint16_t textureWidth; /**< Texture width in pixels/bytes. */
|
||||
uint16_t textureHeight; /**< Texture glyph height in pixels/bytes. */
|
||||
|
||||
uint16_t renderOffsetY; /**< Texture Y axis bearing offset. */
|
||||
uint16_t renderOffsetY; /**< Texture Y axis bearing offset. */
|
||||
uint16_t renderOffsetMax; /**< Texture Y axis bearing maximum value. */
|
||||
uint16_t renderOffsetMin; /**< Texture Y axis bearing minimum value. */
|
||||
|
||||
uint8_t* glyphDataTexture; /**< Glyph texture bitmap data buffer. */
|
||||
} ftgxCharData;
|
||||
|
||||
/*! \struct ftgxDataOffset_
|
||||
*
|
||||
* Offset structure which hold both a maximum and minimum value.
|
||||
*/
|
||||
typedef struct ftgxDataOffset_ {
|
||||
uint16_t max; /**< Maximum data offset. */
|
||||
uint16_t min; /**< Minimum data offset. */
|
||||
} ftgxDataOffset;
|
||||
|
||||
#define _TEXT(t) L ## t /**< Unicode helper macro. */
|
||||
|
||||
#define FTGX_NULL 0x0000
|
||||
#define FTGX_JUSTIFY_LEFT 0x0001
|
||||
#define FTGX_JUSTIFY_CENTER 0x0002
|
||||
#define FTGX_JUSTIFY_RIGHT 0x0004
|
||||
#define FTGX_JUSTIFY_MASK 0x000f
|
||||
|
||||
#define FTGX_ALIGN_TOP 0x0010
|
||||
#define FTGX_ALIGN_MIDDLE 0x0020
|
||||
#define FTGX_ALIGN_BOTTOM 0x0040
|
||||
#define FTGX_ALIGN_MASK 0x0ff0
|
||||
|
||||
#define FTGX_STYLE_UNDERLINE 0x0100
|
||||
#define FTGX_STYLE_STRIKE 0x0200
|
||||
#define FTGX_STYLE_UNDERLINE 0x1000
|
||||
#define FTGX_STYLE_STRIKE 0x2000
|
||||
#define FTGX_STYLE_MASK 0xf000
|
||||
|
||||
const GXColor ftgxWhite = (GXColor){0xff, 0xff, 0xff, 0xff}; /**< Constant color value used only to sanitize Doxygen documentation. */
|
||||
|
||||
/*! \class FreeTypeGX
|
||||
* \brief Wrapper class for the libFreeType library with GX rendering.
|
||||
* \author Armin Tamzarian
|
||||
* \version 0.2.3
|
||||
*
|
||||
* FreeTypeGX acts as a wrapper class for the libFreeType library. It supports precaching of transformed glyph data into
|
||||
* a specified texture format. Rendering of the data to the EFB is accomplished through the application of high performance
|
||||
* GX texture functions resulting in high throughput of string rendering.
|
||||
*/
|
||||
class FreeTypeGX {
|
||||
|
||||
private:
|
||||
@ -228,14 +83,13 @@ class FreeTypeGX {
|
||||
float xPos;
|
||||
float yPos;
|
||||
|
||||
uint8_t positionFormat; /**< Defined position format of the texture. */
|
||||
std::map<wchar_t, ftgxCharData> fontData; /**< Map which holds the glyph data structures for the corresponding characters. */
|
||||
|
||||
static uint16_t getStyleOffsetWidth(uint16_t width, uint16_t format);
|
||||
static uint16_t getStyleOffsetHeight(ftgxDataOffset offset, uint16_t format);
|
||||
|
||||
void copyTextureToFramebuffer(GXTexObj *texObj, uint8_t positionFormat, uint16_t texWidth, uint16_t texHeight, int16_t screenX, int16_t screenY, GXColor color);
|
||||
static void copyFeatureToFramebuffer(uint8_t positionFormat, uint16_t featureWidth, uint16_t featureHeight, int16_t screenX, int16_t screenY, GXColor color);
|
||||
void copyTextureToFramebuffer(GXTexObj *texObj, uint16_t texWidth, uint16_t texHeight, int16_t screenX, int16_t screenY, GXColor color);
|
||||
void copyFeatureToFramebuffer(uint16_t featureWidth, uint16_t featureHeight, int16_t screenX, int16_t screenY, GXColor color);
|
||||
|
||||
void unloadFont();
|
||||
ftgxCharData *cacheGlyphData(wchar_t charCode);
|
||||
@ -244,23 +98,18 @@ class FreeTypeGX {
|
||||
void drawTextFeature(uint16_t x, uint16_t y, uint16_t width, ftgxDataOffset offsetData, uint16_t format, GXColor color);
|
||||
|
||||
public:
|
||||
FreeTypeGX(uint8_t positionFormat = GX_POS_XYZ);
|
||||
FreeTypeGX();
|
||||
~FreeTypeGX();
|
||||
|
||||
static wchar_t* charToWideChar(char* p);
|
||||
|
||||
uint16_t loadFont(uint8_t* fontBuffer, FT_Long bufferSize, FT_UInt pointSize, FT_Pos weight = 0, uint32_t index = 0, bool cacheAll = false);
|
||||
uint16_t loadFont(const uint8_t* fontBuffer, FT_Long bufferSize, FT_UInt pointSize, FT_Pos weight = 0, uint32_t index = 0, bool cacheAll = false);
|
||||
uint16_t loadFont(FT_Byte *fontBuffer, FT_Long bufferSize, FT_UInt pointSize, FT_Pos weight = 0, uint32_t index = 0, bool cacheAll = false);
|
||||
|
||||
uint16_t drawText(uint16_t x, uint16_t y, wchar_t *text, GXColor color = ftgxWhite, uint16_t textStyling = FTGX_NULL);
|
||||
uint16_t drawText(uint16_t x, uint16_t y, wchar_t const *text, GXColor color = ftgxWhite, uint16_t textStyling = FTGX_NULL);
|
||||
uint16_t drawText(uint16_t x, uint16_t y, const wchar_t *text, GXColor color = ftgxWhite, uint16_t textStyling = FTGX_NULL);
|
||||
|
||||
uint16_t getWidth(wchar_t *text);
|
||||
uint16_t getWidth(wchar_t const *text);
|
||||
uint16_t getHeight(wchar_t *text);
|
||||
uint16_t getHeight(wchar_t const *text);
|
||||
ftgxDataOffset getOffset(wchar_t *text);
|
||||
ftgxDataOffset getOffset(wchar_t const *text);
|
||||
uint16_t getWidth(const wchar_t *text);
|
||||
uint16_t getHeight(const wchar_t *text);
|
||||
ftgxDataOffset getOffset(const wchar_t *text);
|
||||
|
||||
float getXScale(void) const { return xScale; }
|
||||
float getYScale(void) const { return yScale; }
|
||||
|
@ -194,7 +194,7 @@ void CMenu::init(void)
|
||||
if(drive == check) // Should not happen
|
||||
{
|
||||
_buildMenus();
|
||||
error(L"No available partitions found!");
|
||||
error(_fmt("errboot4", L"No available partitions found!"));
|
||||
m_exit = true;
|
||||
return;
|
||||
}
|
||||
@ -250,12 +250,12 @@ void CMenu::init(void)
|
||||
_buildMenus();
|
||||
if(DeviceHandler::Instance()->IsInserted(SD))
|
||||
{
|
||||
error(L"data_on_usb=yes and No available usb partitions for data!\nUsing SD.");
|
||||
error(_fmt("erroboot5", L"data_on_usb=yes and No available usb partitions for data!\nUsing SD."));
|
||||
drive = DeviceName[SD];
|
||||
}
|
||||
else
|
||||
{
|
||||
error(L"No available usb partitions for data and no SD inserted!\nExitting.");
|
||||
error(_fmt("erroboot6", L"No available usb partitions for data and no SD inserted!\nExitting."));
|
||||
m_exit = true;
|
||||
return;
|
||||
}
|
||||
|
@ -191,6 +191,9 @@ DMLprogP=PAL 480p
|
||||
errboot1=No cIOS found!\ncIOS d2x 249 base 56 and 250 base 57 are enough for all your games.
|
||||
errboot2=Could not find a device to save configuration files on!
|
||||
errboot3=Could not initialize the DIP module!
|
||||
errboot4=No available partitions found!
|
||||
errboot5=data_on_usb=yes and No available usb partitions for data!\nUsing SD.
|
||||
errboot6=No available usb partitions for data and no SD inserted!\nExitting.
|
||||
errgame1=Cannot find the game with ID: %s
|
||||
errgame2=No cIOS found!
|
||||
errgame4=Couldn't load IOS %i
|
||||
|
@ -179,6 +179,9 @@ DMLdefG=Gioco
|
||||
errboot1=Nessun cIOS trovato!\nI cIOS d2x 249 base 56 e 250 base 57 bastano per tutti i giochi.
|
||||
errboot2=Impossibile trovare una periferica su cui salvare i file di configurazione!
|
||||
errboot3=Impossibile inizializzare il modulo DIP!
|
||||
errboot4=Non è stata trovata nessuna partizione disponibile!
|
||||
errboot5=data_on_usb=yes e nessuna partizione disponibile per i dati!\nVerrà usata la SD.
|
||||
errboot6=Nessuna partizione usb disponibile per i dati e nessuna SD inserita!\nUscendo.
|
||||
errgame1=Impossibile trovare il gioco con ID: %s
|
||||
errgame2=Nessun cIOS trovato!
|
||||
errgame4=Impossibile caricare il IOS %i
|
||||
|
Loading…
Reference in New Issue
Block a user