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">
<name>Snes9x GX</name>
<coder>Tantric</coder>
<version>4.1.8</version>
<release_date>20100409</release_date>
<version>4.1.9</version>
<release_date>20100519</release_date>
<short_description>Super Nintendo Emulator</short_description>
<long_description>A Super Nintendo Emulator for Wii</long_description>
</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 |
| (Under GPL License) |
`¨•¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨'
@ -43,6 +43,15 @@ Wii homebrew is WiiBrew (www.wiibrew.org).
| 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]
* Fix auto-save bug

View File

@ -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);

View File

@ -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;
}
}
}

View File

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

View File

@ -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,8 +551,8 @@ 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)
{

View File

@ -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();

View File

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

View File

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