Quick fix for TOTA crashing/freezing at startup; caused by a sign extension bug in the new Shift-JIS -> Unicode text converter.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2141 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2009-11-06 21:43:14 +00:00
parent 35ec28eb48
commit 285ead05ec
2 changed files with 8 additions and 7 deletions

View File

@ -802,7 +802,8 @@ static const wchar_t* TwoBytes[256] = {
};
// requires two bytes on input (second CAN be 0), returns unicode mapping, assigns used bytes (1/2)
wchar_t ShiftJIS_ConvertChar(const char* input, int& used)
// This function takes a u8 by design - we do NOT want sign extension of the characters!!
wchar_t ShiftJIS_ConvertChar(const u8* input, int& used)
{
const uint FirstByte = input[0];
@ -832,13 +833,15 @@ wxString ShiftJIS_ConvertString( const char* src )
{
wxString result;
// The length of the sresult (in chars) cannot exceed the length of the source.
// Implementation Notes:
// * The length of the result (in chars) cannot exceed the length of the source.
result.reserve( strlen(src) );
while( *src != 0 )
{
int skip;
result += ShiftJIS_ConvertChar( src, skip );
result += ShiftJIS_ConvertChar( (u8*)src, skip );
src += skip;
}
@ -849,7 +852,7 @@ wxString ShiftJIS_ConvertString( const char* src, int maxlen )
{
wxString result;
// The length of the sresult (in chars) cannot exceed the length of the source.
// The length of the result (in chars) cannot exceed the length of the source.
result.reserve( maxlen );
const char* endpt = src + maxlen;
@ -857,7 +860,7 @@ wxString ShiftJIS_ConvertString( const char* src, int maxlen )
while( (*src != 0) && (src < endpt) )
{
int skip;
result += ShiftJIS_ConvertChar( src, skip );
result += ShiftJIS_ConvertChar( (u8*)src, skip );
src += skip;
}

View File

@ -291,8 +291,6 @@ void vtlb_dynarec_init()
// clear the buffer to 0xcc (easier debugging).
memset_8<0xcc,0x1000>( m_IndirectDispatchers );
//u8* baseptr = m_IndirectDispatchers;
for( int mode=0; mode<2; ++mode )
{
for( int bits=0; bits<5; ++bits )