mirror of
https://github.com/dborth/vbagx.git
synced 2024-12-26 02:31:50 +01:00
finalize 2.1.6
This commit is contained in:
parent
47280c60b8
commit
0893c0857b
@ -2,8 +2,8 @@
|
||||
<app version="1">
|
||||
<name>Visual Boy Advance GX</name>
|
||||
<coder>Tantric</coder>
|
||||
<version>2.1.5</version>
|
||||
<release_date>20100409</release_date>
|
||||
<version>2.1.6</version>
|
||||
<release_date>20100519</release_date>
|
||||
<short_description>GBA/GBC/GB Emulator</short_description>
|
||||
<long_description>A port of Visual Boy Advance - M to the Wii.</long_description>
|
||||
</app>
|
||||
|
10
readme.txt
10
readme.txt
@ -1,7 +1,7 @@
|
||||
¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤
|
||||
|
||||
- Visual Boy Advance GX -
|
||||
Version 2.1.5
|
||||
Version 2.1.6
|
||||
http://code.google.com/p/vba-wii
|
||||
(Under GPL License)
|
||||
|
||||
@ -28,6 +28,14 @@ With it you can play GBA/Game Boy Color/Game Boy games on your Wii/GameCube.
|
||||
|0O×øo· UPDATE HISTORY ·oø×O0|
|
||||
`¨•¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨'
|
||||
|
||||
[2.1.6 - May 19, 2010]
|
||||
|
||||
* DVD support fixed
|
||||
* Fixed some potential hangs when returning to menu
|
||||
* Video/audio code changes
|
||||
* Fixed scrolling text bug
|
||||
* Other minor changes
|
||||
|
||||
[2.1.5 - April 9, 2010]
|
||||
|
||||
* Fix auto-save bug
|
||||
|
@ -641,6 +641,11 @@ class GuiText : public GuiElement
|
||||
//!Sets the text of the GuiText element
|
||||
//!\param t Text
|
||||
void SetText(const char * t);
|
||||
//!Sets the text of the GuiText element
|
||||
//!\param t UTF-8 Text
|
||||
void SetWText(wchar_t * t);
|
||||
//!Gets the translated text length of the GuiText element
|
||||
int GetLength();
|
||||
//!Sets up preset values to be used by GuiText(t)
|
||||
//!Useful when printing multiple text elements, all with the same attributes set
|
||||
//!\param sz Font size
|
||||
@ -656,6 +661,8 @@ class GuiText : public GuiElement
|
||||
//!Sets the maximum width of the drawn texture image
|
||||
//!\param w Maximum width
|
||||
void SetMaxWidth(int w);
|
||||
//!Gets the width of the text when rendered
|
||||
int GetTextWidth();
|
||||
//!Enables/disables text scrolling
|
||||
//!\param s Scrolling on/off
|
||||
void SetScroll(int s);
|
||||
|
@ -49,6 +49,9 @@ GuiText::GuiText(const char * t, int s, GXColor c)
|
||||
origText = strdup(t);
|
||||
text = charToWideChar(gettext(t));
|
||||
}
|
||||
|
||||
for(int i=0; i < 20; i++)
|
||||
textDyn[i] = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -78,6 +81,9 @@ GuiText::GuiText(const char * t)
|
||||
origText = strdup(t);
|
||||
text = charToWideChar(gettext(t));
|
||||
}
|
||||
|
||||
for(int i=0; i < 20; i++)
|
||||
textDyn[i] = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -93,6 +99,7 @@ GuiText::~GuiText()
|
||||
if(textDynNum > 0)
|
||||
{
|
||||
for(int i=0; i < textDynNum; i++)
|
||||
if(textDyn[i])
|
||||
delete[] textDyn[i];
|
||||
}
|
||||
}
|
||||
@ -107,6 +114,7 @@ void GuiText::SetText(const char * t)
|
||||
if(textDynNum > 0)
|
||||
{
|
||||
for(int i=0; i < textDynNum; i++)
|
||||
if(textDyn[i])
|
||||
delete[] textDyn[i];
|
||||
}
|
||||
|
||||
@ -123,6 +131,38 @@ void GuiText::SetText(const char * t)
|
||||
}
|
||||
}
|
||||
|
||||
void GuiText::SetWText(wchar_t * t)
|
||||
{
|
||||
if(origText)
|
||||
free(origText);
|
||||
if(text)
|
||||
delete[] text;
|
||||
|
||||
if(textDynNum > 0)
|
||||
{
|
||||
for(int i=0; i < textDynNum; i++)
|
||||
if(textDyn[i])
|
||||
delete[] textDyn[i];
|
||||
}
|
||||
|
||||
origText = NULL;
|
||||
text = NULL;
|
||||
textDynNum = 0;
|
||||
textScrollPos = 0;
|
||||
textScrollInitialDelay = TEXT_SCROLL_INITIAL_DELAY;
|
||||
|
||||
if(t)
|
||||
text = wcsdup(t);
|
||||
}
|
||||
|
||||
int GuiText::GetLength()
|
||||
{
|
||||
if(!text)
|
||||
return 0;
|
||||
|
||||
return wcslen(text);
|
||||
}
|
||||
|
||||
void GuiText::SetPresets(int sz, GXColor c, int w, u16 s, int h, int v)
|
||||
{
|
||||
presetSize = sz;
|
||||
@ -142,24 +182,49 @@ void GuiText::SetMaxWidth(int width)
|
||||
{
|
||||
maxWidth = width;
|
||||
|
||||
if(textDynNum > 0)
|
||||
{
|
||||
for(int i=0; i < textDynNum; i++)
|
||||
{
|
||||
if(textDyn[i])
|
||||
{
|
||||
delete[] textDyn[i];
|
||||
textDyn[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
textDynNum = 0;
|
||||
}
|
||||
|
||||
int GuiText::GetTextWidth()
|
||||
{
|
||||
if(!text)
|
||||
return 0;
|
||||
|
||||
if(currentSize != size)
|
||||
{
|
||||
ChangeFontSize(size);
|
||||
|
||||
if(!fontSystem[size])
|
||||
fontSystem[size] = new FreeTypeGX(size);
|
||||
|
||||
currentSize = size;
|
||||
}
|
||||
return fontSystem[size]->getWidth(text);
|
||||
}
|
||||
|
||||
void GuiText::SetWrap(bool w, int width)
|
||||
{
|
||||
wrap = w;
|
||||
maxWidth = width;
|
||||
|
||||
if(textDynNum > 0)
|
||||
{
|
||||
for(int i=0; i < textDynNum; i++)
|
||||
{
|
||||
if(textDyn[i])
|
||||
{
|
||||
delete[] textDyn[i];
|
||||
textDyn[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
textDynNum = 0;
|
||||
}
|
||||
|
||||
@ -168,11 +233,15 @@ void GuiText::SetScroll(int s)
|
||||
if(textScroll == s)
|
||||
return;
|
||||
|
||||
if(textDynNum > 0)
|
||||
{
|
||||
for(int i=0; i < textDynNum; i++)
|
||||
{
|
||||
if(textDyn[i])
|
||||
{
|
||||
delete[] textDyn[i];
|
||||
textDyn[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
textDynNum = 0;
|
||||
|
||||
textScroll = s;
|
||||
@ -234,12 +303,17 @@ void GuiText::ResetText()
|
||||
|
||||
text = charToWideChar(gettext(origText));
|
||||
|
||||
if(textDynNum > 0)
|
||||
{
|
||||
for(int i=0; i < textDynNum; i++)
|
||||
{
|
||||
if(textDyn[i])
|
||||
{
|
||||
delete[] textDyn[i];
|
||||
textDyn[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
textDynNum = 0;
|
||||
currentSize = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -276,7 +350,6 @@ void GuiText::Draw()
|
||||
return;
|
||||
}
|
||||
|
||||
u32 maxChar = maxWidth*2.5 / (float)newSize; // approximate
|
||||
u32 textlen = wcslen(text);
|
||||
|
||||
if(wrap)
|
||||
@ -298,7 +371,7 @@ void GuiText::Draw()
|
||||
|
||||
if(text[ch] == ' ' || ch == textlen-1)
|
||||
{
|
||||
if(wcslen(textDyn[linenum]) >= maxChar)
|
||||
if(fontSystem[currentSize]->getWidth(textDyn[linenum]) > maxWidth)
|
||||
{
|
||||
if(lastSpace >= 0)
|
||||
{
|
||||
@ -344,14 +417,15 @@ void GuiText::Draw()
|
||||
{
|
||||
textDynNum = 1;
|
||||
textDyn[0] = wcsdup(text);
|
||||
int len = wcslen(textDyn[0]);
|
||||
|
||||
if(textlen > maxChar)
|
||||
textDyn[0][maxChar] = 0;
|
||||
while(fontSystem[currentSize]->getWidth(textDyn[0]) > maxWidth)
|
||||
textDyn[0][--len] = 0;
|
||||
}
|
||||
|
||||
if(textScroll == SCROLL_HORIZONTAL)
|
||||
{
|
||||
if(textlen > maxChar && (FrameTimer % textScrollDelay == 0))
|
||||
if(fontSystem[currentSize]->getWidth(text) > maxWidth && (FrameTimer % textScrollDelay == 0))
|
||||
{
|
||||
if(textScrollInitialDelay)
|
||||
{
|
||||
@ -366,15 +440,36 @@ void GuiText::Draw()
|
||||
textScrollInitialDelay = TEXT_SCROLL_INITIAL_DELAY;
|
||||
}
|
||||
|
||||
wcsncpy(textDyn[0], &text[textScrollPos], maxChar-1);
|
||||
|
||||
wcscpy(textDyn[0], &text[textScrollPos]);
|
||||
u32 dynlen = wcslen(textDyn[0]);
|
||||
|
||||
if(dynlen+2 < maxChar)
|
||||
if(dynlen+2 < textlen)
|
||||
{
|
||||
textDyn[0][dynlen] = ' ';
|
||||
textDyn[0][dynlen+1] = ' ';
|
||||
wcsncat(&textDyn[0][dynlen+2], text, maxChar - dynlen - 2);
|
||||
textDyn[0][dynlen+2] = 0;
|
||||
dynlen += 2;
|
||||
}
|
||||
|
||||
if(fontSystem[currentSize]->getWidth(textDyn[0]) > maxWidth)
|
||||
{
|
||||
while(fontSystem[currentSize]->getWidth(textDyn[0]) > maxWidth)
|
||||
textDyn[0][--dynlen] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
while(fontSystem[currentSize]->getWidth(textDyn[0]) < maxWidth && dynlen+1 < textlen)
|
||||
{
|
||||
textDyn[0][dynlen] = text[i++];
|
||||
textDyn[0][++dynlen] = 0;
|
||||
}
|
||||
|
||||
if(fontSystem[currentSize]->getWidth(textDyn[0]) > maxWidth)
|
||||
textDyn[0][dynlen-2] = 0;
|
||||
else
|
||||
textDyn[0][dynlen-1] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -38,6 +38,13 @@ void InitFreeType(uint8_t* fontBuffer, FT_Long bufferSize)
|
||||
fontSystem[i] = NULL;
|
||||
}
|
||||
|
||||
void DeinitFreeType()
|
||||
{
|
||||
ClearFontData();
|
||||
FT_Done_FreeType(ftLibrary);
|
||||
ftLibrary = NULL;
|
||||
}
|
||||
|
||||
void ChangeFontSize(FT_UInt pixelSize)
|
||||
{
|
||||
FT_Set_Pixel_Sizes(ftFace, 0, pixelSize);
|
||||
@ -544,10 +551,10 @@ uint16_t FreeTypeGX::getWidth(wchar_t *text)
|
||||
|
||||
std::map<wchar_t, ftgxCharData>::iterator thisEnd =this->fontData.end();
|
||||
|
||||
for (uint32_t i = 0; i < strLength; ++i){
|
||||
|
||||
for (uint32_t i = 0; i < strLength; ++i)
|
||||
{
|
||||
ftgxCharData* glyphData = NULL;
|
||||
if( this->fontData.find(text[i]) != thisEnd)
|
||||
if(this->fontData.find(text[i]) != thisEnd)
|
||||
{
|
||||
glyphData = &this->fontData[text[i]];
|
||||
}
|
||||
@ -560,7 +567,7 @@ uint16_t FreeTypeGX::getWidth(wchar_t *text)
|
||||
{
|
||||
if(this->ftKerningEnabled && (i > 0))
|
||||
{
|
||||
FT_Get_Kerning( 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 += glyphData->glyphAdvanceX;
|
||||
|
@ -155,13 +155,14 @@
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include FT_BITMAP_H
|
||||
#include "Metaphrasis.h"
|
||||
|
||||
#include <malloc.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include <map>
|
||||
|
||||
#include "Metaphrasis.h"
|
||||
|
||||
#define MAX_FONT_SIZE 100
|
||||
|
||||
/*! \struct ftgxCharData_
|
||||
@ -236,6 +237,7 @@ typedef struct ftgxDataOffset_ ftgxDataOffset;
|
||||
const GXColor ftgxWhite = (GXColor){0xff, 0xff, 0xff, 0xff}; /**< Constant color value used only to sanitize Doxygen documentation. */
|
||||
|
||||
void InitFreeType(uint8_t* fontBuffer, FT_Long bufferSize);
|
||||
void DeinitFreeType();
|
||||
void ChangeFontSize(FT_UInt pixelSize);
|
||||
wchar_t* charToWideChar(const char* p);
|
||||
void ClearFontData();
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "utils/FreeTypeGX.h"
|
||||
|
||||
#define APPNAME "Visual Boy Advance GX"
|
||||
#define APPVERSION "2.1.5"
|
||||
#define APPVERSION "2.1.6"
|
||||
#define APPFOLDER "vbagx"
|
||||
#define PREF_FILE_NAME "settings.xml"
|
||||
#define PAL_FILE_NAME "palettes.xml"
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<app version="2.1.5">
|
||||
<file url="http://vba-wii.googlecode.com/files/Visual%20Boy%20Advance%20GX%202.1.5.zip"></file>
|
||||
<app version="2.1.6">
|
||||
<file url="http://vba-wii.googlecode.com/files/Visual%20Boy%20Advance%20GX%202.1.6.zip"></file>
|
||||
</app>
|
||||
|
Loading…
Reference in New Issue
Block a user