finalize 4.1.9

This commit is contained in:
dborth 2010-05-19 21:51:33 +00:00
parent 115a5e8943
commit ee1a761904
9 changed files with 152 additions and 33 deletions

View File

@ -2,8 +2,8 @@
<app version="1"> <app version="1">
<name>Snes9x GX</name> <name>Snes9x GX</name>
<coder>Tantric</coder> <coder>Tantric</coder>
<version>4.1.8</version> <version>4.1.9</version>
<release_date>20100409</release_date> <release_date>20100519</release_date>
<short_description>Super Nintendo Emulator</short_description> <short_description>Super Nintendo Emulator</short_description>
<long_description>A Super Nintendo Emulator for Wii</long_description> <long_description>A Super Nintendo Emulator for Wii</long_description>
</app> </app>

View File

@ -10,7 +10,7 @@
­———————————————————————————————————————————————————————————————————————————— ­————————————————————————————————————————————————————————————————————————————
×—–­—–­—–­—–­ –­—–­—–­—–­—–­—–­—–­—–­—–­—–­— ­—–­—–­—–­—–­—–­—–­—–­—-­—–­-–•¬ ×—–­—–­—–­—–­ –­—–­—–­—–­—–­—–­—–­—–­—–­—–­— ­—–­—–­—–­—–­—–­—–­—–­—-­—–­-–•¬
|0O×øo· Snes9x GX 4.1.8 ·oø×O0| |0O×øo· Snes9x GX 4.1.9 ·oø×O0|
| http://code.google.com/p/snes9x-gx | | http://code.google.com/p/snes9x-gx |
| (Under GPL License) | | (Under GPL License) |
`¨•¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨' `¨•¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨'
@ -43,6 +43,15 @@ Wii homebrew is WiiBrew (www.wiibrew.org).
| UPDATE HISTORY | | UPDATE HISTORY |
•˜———–—––-- - —————————––––– ———–—––-- - —————————––––– ———–—––-- - ————————• •˜———–—––-- - —————————––––– ———–—––-- - —————————––––– ———–—––-- - ————————•
[4.1.9 - May 19, 2010]
* DVD support fixed
* Fixed some cheats issues
* Fixed some potential hangs when returning to menu
* Video/audio code changes
* Fixed scrolling text bug
* Other minor changes
[4.1.8 - April 9, 2010] [4.1.8 - April 9, 2010]
* Fix auto-save bug * Fix auto-save bug

View File

@ -641,6 +641,11 @@ 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);
//!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) //!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
@ -656,6 +661,8 @@ class GuiText : public GuiElement
//!Sets the maximum width of the drawn texture image //!Sets the maximum width of the drawn texture image
//!\param w Maximum width //!\param w Maximum width
void SetMaxWidth(int w); void SetMaxWidth(int w);
//!Gets the width of the text when rendered
int GetTextWidth();
//!Enables/disables text scrolling //!Enables/disables text scrolling
//!\param s Scrolling on/off //!\param s Scrolling on/off
void SetScroll(int s); void SetScroll(int s);

View File

@ -49,6 +49,9 @@ GuiText::GuiText(const char * t, int s, GXColor c)
origText = strdup(t); origText = strdup(t);
text = charToWideChar(gettext(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); origText = strdup(t);
text = charToWideChar(gettext(t)); text = charToWideChar(gettext(t));
} }
for(int i=0; i < 20; i++)
textDyn[i] = NULL;
} }
/** /**
@ -93,7 +99,8 @@ GuiText::~GuiText()
if(textDynNum > 0) if(textDynNum > 0)
{ {
for(int i=0; i < textDynNum; i++) for(int i=0; i < textDynNum; i++)
delete[] textDyn[i]; if(textDyn[i])
delete[] textDyn[i];
} }
} }
@ -107,7 +114,8 @@ void GuiText::SetText(const char * t)
if(textDynNum > 0) if(textDynNum > 0)
{ {
for(int i=0; i < textDynNum; i++) for(int i=0; i < textDynNum; i++)
delete[] textDyn[i]; if(textDyn[i])
delete[] textDyn[i];
} }
origText = NULL; origText = NULL;
@ -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) void GuiText::SetPresets(int sz, GXColor c, int w, u16 s, int h, int v)
{ {
presetSize = sz; presetSize = sz;
@ -142,24 +182,49 @@ void GuiText::SetMaxWidth(int width)
{ {
maxWidth = width; maxWidth = width;
if(textDynNum > 0) for(int i=0; i < textDynNum; i++)
{ {
for(int i=0; i < textDynNum; i++) if(textDyn[i])
{
delete[] textDyn[i]; delete[] textDyn[i];
textDyn[i] = NULL;
}
} }
textDynNum = 0; 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) void GuiText::SetWrap(bool w, int width)
{ {
wrap = w; wrap = w;
maxWidth = width; maxWidth = width;
if(textDynNum > 0) for(int i=0; i < textDynNum; i++)
{ {
for(int i=0; i < textDynNum; i++) if(textDyn[i])
{
delete[] textDyn[i]; delete[] textDyn[i];
textDyn[i] = NULL;
}
} }
textDynNum = 0; textDynNum = 0;
} }
@ -168,11 +233,15 @@ void GuiText::SetScroll(int s)
if(textScroll == s) if(textScroll == s)
return; return;
if(textDynNum > 0) for(int i=0; i < textDynNum; i++)
{ {
for(int i=0; i < textDynNum; i++) if(textDyn[i])
{
delete[] textDyn[i]; delete[] textDyn[i];
textDyn[i] = NULL;
}
} }
textDynNum = 0; textDynNum = 0;
textScroll = s; textScroll = s;
@ -234,12 +303,17 @@ void GuiText::ResetText()
text = charToWideChar(gettext(origText)); text = charToWideChar(gettext(origText));
if(textDynNum > 0) for(int i=0; i < textDynNum; i++)
{ {
for(int i=0; i < textDynNum; i++) if(textDyn[i])
{
delete[] textDyn[i]; delete[] textDyn[i];
textDyn[i] = NULL;
}
} }
textDynNum = 0; textDynNum = 0;
currentSize = 0;
} }
/** /**
@ -276,7 +350,6 @@ void GuiText::Draw()
return; return;
} }
u32 maxChar = maxWidth*2.5 / (float)newSize; // approximate
u32 textlen = wcslen(text); u32 textlen = wcslen(text);
if(wrap) if(wrap)
@ -298,7 +371,7 @@ void GuiText::Draw()
if(text[ch] == ' ' || ch == textlen-1) if(text[ch] == ' ' || ch == textlen-1)
{ {
if(wcslen(textDyn[linenum]) >= maxChar) if(fontSystem[currentSize]->getWidth(textDyn[linenum]) > maxWidth)
{ {
if(lastSpace >= 0) if(lastSpace >= 0)
{ {
@ -344,14 +417,15 @@ void GuiText::Draw()
{ {
textDynNum = 1; textDynNum = 1;
textDyn[0] = wcsdup(text); textDyn[0] = wcsdup(text);
int len = wcslen(textDyn[0]);
if(textlen > maxChar) while(fontSystem[currentSize]->getWidth(textDyn[0]) > maxWidth)
textDyn[0][maxChar] = 0; textDyn[0][--len] = 0;
} }
if(textScroll == SCROLL_HORIZONTAL) if(textScroll == SCROLL_HORIZONTAL)
{ {
if(textlen > maxChar && (FrameTimer % textScrollDelay == 0)) if(fontSystem[currentSize]->getWidth(text) > maxWidth && (FrameTimer % textScrollDelay == 0))
{ {
if(textScrollInitialDelay) if(textScrollInitialDelay)
{ {
@ -366,15 +440,36 @@ void GuiText::Draw()
textScrollInitialDelay = TEXT_SCROLL_INITIAL_DELAY; textScrollInitialDelay = TEXT_SCROLL_INITIAL_DELAY;
} }
wcsncpy(textDyn[0], &text[textScrollPos], maxChar-1); wcscpy(textDyn[0], &text[textScrollPos]);
u32 dynlen = wcslen(textDyn[0]); u32 dynlen = wcslen(textDyn[0]);
if(dynlen+2 < maxChar) if(dynlen+2 < textlen)
{ {
textDyn[0][dynlen] = ' '; textDyn[0][dynlen] = ' ';
textDyn[0][dynlen+1] = ' '; 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;
} }
} }
} }

View File

@ -20,7 +20,7 @@
#include "filelist.h" #include "filelist.h"
#define APPNAME "Snes9x GX" #define APPNAME "Snes9x GX"
#define APPVERSION "4.1.8" #define APPVERSION "4.1.9"
#define APPFOLDER "snes9xgx" #define APPFOLDER "snes9xgx"
#define PREF_FILE_NAME "settings.xml" #define PREF_FILE_NAME "settings.xml"

View File

@ -38,6 +38,13 @@ void InitFreeType(uint8_t* fontBuffer, FT_Long bufferSize)
fontSystem[i] = NULL; fontSystem[i] = NULL;
} }
void DeinitFreeType()
{
ClearFontData();
FT_Done_FreeType(ftLibrary);
ftLibrary = NULL;
}
void ChangeFontSize(FT_UInt pixelSize) void ChangeFontSize(FT_UInt pixelSize)
{ {
FT_Set_Pixel_Sizes(ftFace, 0, 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(); 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; ftgxCharData* glyphData = NULL;
if( this->fontData.find(text[i]) != thisEnd) if(this->fontData.find(text[i]) != thisEnd)
{ {
glyphData = &this->fontData[text[i]]; glyphData = &this->fontData[text[i]];
} }
@ -560,7 +567,7 @@ uint16_t FreeTypeGX::getWidth(wchar_t *text)
{ {
if(this->ftKerningEnabled && (i > 0)) 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 += pairDelta.x >> 6;
} }
strWidth += glyphData->glyphAdvanceX; strWidth += glyphData->glyphAdvanceX;

View File

@ -155,13 +155,14 @@
#include <ft2build.h> #include <ft2build.h>
#include FT_FREETYPE_H #include FT_FREETYPE_H
#include FT_BITMAP_H #include FT_BITMAP_H
#include "Metaphrasis.h"
#include <malloc.h> #include <malloc.h>
#include <string.h> #include <string.h>
#include <wchar.h> #include <wchar.h>
#include <map> #include <map>
#include "Metaphrasis.h"
#define MAX_FONT_SIZE 100 #define MAX_FONT_SIZE 100
/*! \struct ftgxCharData_ /*! \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. */ 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 InitFreeType(uint8_t* fontBuffer, FT_Long bufferSize);
void DeinitFreeType();
void ChangeFontSize(FT_UInt pixelSize); void ChangeFontSize(FT_UInt pixelSize);
wchar_t* charToWideChar(const char* p); wchar_t* charToWideChar(const char* p);
void ClearFontData(); void ClearFontData();

View File

@ -763,10 +763,9 @@ update_video (int width, int height)
yscale = (vheight > (vmode->efbHeight/2)) ? (vheight / 2) : vheight; yscale = (vheight > (vmode->efbHeight/2)) ? (vheight / 2) : vheight;
} }
// aspect ratio scaling (change width scale) // match the original console's width for "widescreen" to prevent flickering
// yes its pretty cheap and ugly, but its easy!
if (GCSettings.widescreen) if (GCSettings.widescreen)
xscale = (3*xscale)/4; xscale = 256;
xscale *= GCSettings.zoomHor; xscale *= GCSettings.zoomHor;
yscale *= GCSettings.zoomVert; yscale *= GCSettings.zoomVert;

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<app version="4.1.8"> <app version="4.1.9">
<file url="http://snes9x-gx.googlecode.com/files/Snes9x%20GX%204.1.8.zip"></file> <file url="http://snes9x-gx.googlecode.com/files/Snes9x%20GX%204.1.9.zip"></file>
</app> </app>