mirror of https://github.com/PCSX2/pcsx2.git
SPU2-X: Added ConvertUTF.cpp (handy!), Changed instances of _T("") to the much less ugly L"", and removed references to _wfopen.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@557 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
1745eb2013
commit
34a0b82986
|
@ -0,0 +1,384 @@
|
|||
/*
|
||||
* Copyright 2001-2004 Unicode, Inc.
|
||||
*
|
||||
* Disclaimer
|
||||
*
|
||||
* This source code is provided as is by Unicode, Inc. No claims are
|
||||
* made as to fitness for any particular purpose. No warranties of any
|
||||
* kind are expressed or implied. The recipient agrees to determine
|
||||
* applicability of information provided. If this file has been
|
||||
* purchased on magnetic or optical media from Unicode, Inc., the
|
||||
* sole remedy for any claim will be exchange of defective media
|
||||
* within 90 days of receipt.
|
||||
*
|
||||
* Limitations on Rights to Redistribute This Code
|
||||
*
|
||||
* Unicode, Inc. hereby grants the right to freely use the information
|
||||
* supplied in this file in the creation of products supporting the
|
||||
* Unicode Standard, and to make copies of this file in any form
|
||||
* for internal or external distribution as long as this notice
|
||||
* remains attached.
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
|
||||
Conversions between UTF32, UTF-16, and UTF-8. Source code file.
|
||||
Author: Mark E. Davis, 1994.
|
||||
Rev History: Rick McGowan, fixes & updates May 2001.
|
||||
Sept 2001: fixed const & error conditions per
|
||||
mods suggested by S. Parent & A. Lillich.
|
||||
June 2002: Tim Dodd added detection and handling of incomplete
|
||||
source sequences, enhanced error detection, added casts
|
||||
to eliminate compiler warnings.
|
||||
July 2003: slight mods to back out aggressive FFFE detection.
|
||||
Jan 2004: updated switches in from-UTF8 conversions.
|
||||
Oct 2004: updated to use UNI_MAX_LEGAL_UTF32 in UTF-32 conversions.
|
||||
|
||||
See the header file "ConvertUTF.h" for complete documentation.
|
||||
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
#include "PS2Etypes.h"
|
||||
|
||||
#include <string>
|
||||
#include "ConvertUTF.h"
|
||||
|
||||
|
||||
using std::string;
|
||||
using std::wstring;
|
||||
|
||||
|
||||
#ifdef CVTUTF_DEBUG
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
namespace Unicode
|
||||
{
|
||||
/* Some fundamental constants */
|
||||
#define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD
|
||||
#define UNI_MAX_BMP (UTF32)0x0000FFFF
|
||||
#define UNI_MAX_UTF16 (UTF32)0x0010FFFF
|
||||
#define UNI_MAX_UTF32 (UTF32)0x7FFFFFFF
|
||||
#define UNI_MAX_LEGAL_UTF32 (UTF32)0x0010FFFF
|
||||
|
||||
#define UNI_SUR_HIGH_START (UTF32)0xD800
|
||||
#define UNI_SUR_HIGH_END (UTF32)0xDBFF
|
||||
#define UNI_SUR_LOW_START (UTF32)0xDC00
|
||||
#define UNI_SUR_LOW_END (UTF32)0xDFFF
|
||||
|
||||
static const int halfShift = 10; /* used for shifting by 10 bits */
|
||||
|
||||
static const UTF32 halfBase = 0x0010000UL;
|
||||
static const UTF32 halfMask = 0x3FFUL;
|
||||
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* Index into the table below with the first byte of a UTF-8 sequence to
|
||||
* get the number of trailing bytes that are supposed to follow it.
|
||||
* Note that *legal* UTF-8 values can't have 4 or 5-bytes. The table is
|
||||
* left as-is for anyone who may want to do such conversion, which was
|
||||
* allowed in earlier algorithms.
|
||||
*/
|
||||
static const char trailingBytesForUTF8[256] = {
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5
|
||||
};
|
||||
|
||||
/*
|
||||
* Magic values subtracted from a buffer value during UTF8 conversion.
|
||||
* This table contains as many values as there might be trailing bytes
|
||||
* in a UTF-8 sequence.
|
||||
*/
|
||||
static const UTF32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL,
|
||||
0x03C82080UL, 0xFA082080UL, 0x82082080UL };
|
||||
|
||||
/*
|
||||
* Once the bits are split out into bytes of UTF-8, this is a mask OR-ed
|
||||
* into the first byte, depending on how many bytes follow. There are
|
||||
* as many entries in this table as there are UTF-8 sequence types.
|
||||
* (I.e., one byte sequence, two byte... etc.). Remember that sequencs
|
||||
* for *legal* UTF-8 will be 4 or fewer bytes total.
|
||||
*/
|
||||
static const UTF8 firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
/* The interface converts a whole buffer to avoid function-call overhead.
|
||||
* Constants have been gathered. Loops & conditionals have been removed as
|
||||
* much as possible for efficiency, in favor of drop-through switches.
|
||||
* (See "Note A" at the bottom of the file for equivalent code.)
|
||||
* If your compiler supports it, the "isLegalUTF8" call can be turned
|
||||
* into an inline function.
|
||||
*/
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
void Convert( const wstring& src, string& dest )
|
||||
{
|
||||
const UTF16* source = (UTF16*)src.c_str();
|
||||
const UTF16* sourceEnd = &source[ src.length() ];
|
||||
|
||||
// initialize a four-char packet:
|
||||
std::wstring packet( L" " );
|
||||
|
||||
while (source < sourceEnd)
|
||||
{
|
||||
UTF32 ch;
|
||||
unsigned short bytesToWrite = 0;
|
||||
const UTF32 byteMask = 0xBF;
|
||||
const UTF32 byteMark = 0x80;
|
||||
const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */
|
||||
|
||||
ch = *source++;
|
||||
|
||||
/* If we have a surrogate pair, convert to UTF32 first. */
|
||||
if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END)
|
||||
{
|
||||
/* If the 16 bits following the high surrogate are in the source buffer... */
|
||||
if (source < sourceEnd)
|
||||
{
|
||||
UTF32 ch2 = *source;
|
||||
/* If it's a low surrogate, convert to UTF32. */
|
||||
if (ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END)
|
||||
{
|
||||
ch = ((ch - UNI_SUR_HIGH_START) << halfShift)
|
||||
+ (ch2 - UNI_SUR_LOW_START) + halfBase;
|
||||
++source;
|
||||
}
|
||||
#ifdef UTF_STRICT
|
||||
else if (flags == strictConversion)
|
||||
{
|
||||
/* it's an unpaired high surrogate */
|
||||
--source; /* return to the illegal value itself */
|
||||
result = SourceIllegal;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We don't have the 16 bits following the high surrogate. */
|
||||
//--source; /* return to the high surrogate */
|
||||
//result = SourceExhausted;
|
||||
//break;
|
||||
throw Exception::UTFConversion<string>( dest, "UTF16->UTF8 conversion failure: Unexpected end of source string!" );
|
||||
}
|
||||
}
|
||||
#ifdef UTF_STRICT
|
||||
else if (flags == strictConversion)
|
||||
{
|
||||
/* UTF-16 surrogate values are illegal in UTF-32 */
|
||||
if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END)
|
||||
{
|
||||
--source; /* return to the illegal value itself */
|
||||
result = sourceIllegal;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Figure out how many bytes the result will require */
|
||||
if (ch < (UTF32)0x80) bytesToWrite = 1;
|
||||
else if (ch < (UTF32)0x800) bytesToWrite = 2;
|
||||
else if (ch < (UTF32)0x10000) bytesToWrite = 3;
|
||||
else if (ch < (UTF32)0x110000) bytesToWrite = 4;
|
||||
else
|
||||
{
|
||||
bytesToWrite = 3;
|
||||
ch = UNI_REPLACEMENT_CHAR;
|
||||
}
|
||||
|
||||
packet.clear();
|
||||
switch( bytesToWrite )
|
||||
{
|
||||
/* note: everything falls through. */
|
||||
case 4: packet += (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
|
||||
case 3: packet += (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
|
||||
case 2: packet += (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
|
||||
case 1: packet += (UTF8) (ch | firstByteMark[bytesToWrite]);
|
||||
}
|
||||
dest.append( packet.rbegin(), packet.rend() );
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* Utility routine to tell whether a sequence of bytes is legal UTF-8.
|
||||
* This must be called with the length pre-determined by the first byte.
|
||||
* If not calling this from ConvertUTF8to*, then the length can be set by:
|
||||
* length = trailingBytesForUTF8[*source]+1;
|
||||
* and the sequence is illegal right away if there aren't that many bytes
|
||||
* available.
|
||||
* If presented with a length > 4, this returns false. The Unicode
|
||||
* definition of UTF-8 goes up to 4-byte sequences.
|
||||
*/
|
||||
static bool isLegalUTF8(const UTF8 *source, int length)
|
||||
{
|
||||
UTF8 a;
|
||||
const UTF8 *srcptr = source+length;
|
||||
|
||||
switch (length)
|
||||
{
|
||||
default: return false;
|
||||
/* Everything else falls through when "true"... */
|
||||
case 4: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
|
||||
case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
|
||||
case 2: if ((a = (*--srcptr)) > 0xBF) return false;
|
||||
|
||||
switch (*source)
|
||||
{
|
||||
/* no fall-through in this inner switch */
|
||||
case 0xE0: if (a < 0xA0) return false; break;
|
||||
case 0xED: if (a > 0x9F) return false; break;
|
||||
case 0xF0: if (a < 0x90) return false; break;
|
||||
case 0xF4: if (a > 0x8F) return false; break;
|
||||
default: if (a < 0x80) return false;
|
||||
}
|
||||
|
||||
case 1: if (*source >= 0x80 && *source < 0xC2) return false;
|
||||
}
|
||||
if (*source > 0xF4) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* Exported function to return whether a UTF-8 sequence is legal or not.
|
||||
* This is not used here; it's just exported.
|
||||
*/
|
||||
bool isLegalUTF8Sequence( const UTF8 *source, const UTF8 *sourceEnd )
|
||||
{
|
||||
int length = trailingBytesForUTF8[*source]+1;
|
||||
if (source+length > sourceEnd)
|
||||
return false;
|
||||
return isLegalUTF8(source, length);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
void Convert( const std::string& src, std::wstring& dest )
|
||||
{
|
||||
const UTF8* source = (UTF8*)src.c_str();
|
||||
const UTF8* sourceEnd = &source[ src.length() ];
|
||||
|
||||
while (source < sourceEnd)
|
||||
{
|
||||
UTF32 ch = 0;
|
||||
u16 extraBytesToRead = trailingBytesForUTF8[*source];
|
||||
|
||||
if( source + extraBytesToRead >= sourceEnd )
|
||||
{
|
||||
throw Exception::UTFConversion<wstring>( dest, "UTF8->UTF16 String Conversion failed: Unexpected end of string data." );
|
||||
}
|
||||
|
||||
/* Do this check whether lenient or strict */
|
||||
if (!isLegalUTF8(source, extraBytesToRead+1))
|
||||
{
|
||||
throw Exception::UTFConversion<wstring>( dest, "UTF8->UTF16 String Conversion failed: Illegal UTF8 data encountered!" );
|
||||
}
|
||||
|
||||
/*
|
||||
* The cases all fall through. See "Note A" below.
|
||||
*/
|
||||
switch (extraBytesToRead)
|
||||
{
|
||||
case 5: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
|
||||
case 4: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
|
||||
case 3: ch += *source++; ch <<= 6;
|
||||
case 2: ch += *source++; ch <<= 6;
|
||||
case 1: ch += *source++; ch <<= 6;
|
||||
case 0: ch += *source++;
|
||||
}
|
||||
ch -= offsetsFromUTF8[extraBytesToRead];
|
||||
|
||||
if (ch <= UNI_MAX_BMP)
|
||||
{
|
||||
/* Target is a character <= 0xFFFF */
|
||||
/* UTF-16 surrogate values are illegal in UTF-32 */
|
||||
if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END)
|
||||
{
|
||||
#ifdef UTF_STRICT
|
||||
if (flags == strictConversion)
|
||||
{
|
||||
source -= (extraBytesToRead+1); /* return to the illegal value itself */
|
||||
result = sourceIllegal;
|
||||
break;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
dest += UNI_REPLACEMENT_CHAR;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dest += (UTF16)ch; /* normal case */
|
||||
}
|
||||
} else if (ch > UNI_MAX_UTF16)
|
||||
{
|
||||
#ifdef UTF_STRICT
|
||||
if (flags == strictConversion)
|
||||
{
|
||||
result = sourceIllegal;
|
||||
source -= (extraBytesToRead+1); /* return to the start */
|
||||
break; /* Bail out; shouldn't continue */
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
dest += UNI_REPLACEMENT_CHAR;
|
||||
}
|
||||
} else
|
||||
{
|
||||
ch -= halfBase;
|
||||
dest += (UTF16)((ch >> halfShift) + UNI_SUR_HIGH_START);
|
||||
dest += (UTF16)((ch & halfMask) + UNI_SUR_LOW_START);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
|
||||
Note A.
|
||||
The fall-through switches in UTF-8 reading code save a
|
||||
temp variable, some decrements & conditionals. The switches
|
||||
are equivalent to the following loop:
|
||||
{
|
||||
int tmpBytesToRead = extraBytesToRead+1;
|
||||
do {
|
||||
ch += *source++;
|
||||
--tmpBytesToRead;
|
||||
if (tmpBytesToRead) ch <<= 6;
|
||||
} while (tmpBytesToRead > 0);
|
||||
}
|
||||
In UTF-8 writing code, the switches on "bytesToWrite" are
|
||||
similarly unrolled loops.
|
||||
|
||||
--------------------------------------------------------------------- */
|
||||
|
||||
wstring Convert( const string& src )
|
||||
{
|
||||
wstring dest;
|
||||
Convert( src, dest );
|
||||
return dest;
|
||||
}
|
||||
|
||||
string Convert( const wstring& src )
|
||||
{
|
||||
string dest;
|
||||
Convert( src, dest );
|
||||
return dest;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
#ifndef __CONVERTUTF_H__
|
||||
#define __CONVERTUTF_H__
|
||||
|
||||
namespace Unicode
|
||||
{
|
||||
|
||||
typedef unsigned long UTF32; /* at least 32 bits */
|
||||
typedef wchar_t UTF16; /* at least 16 bits */
|
||||
typedef unsigned char UTF8; /* typically 8 bits */
|
||||
|
||||
enum ConversionResult
|
||||
{
|
||||
ConversionOK, /* conversion successful */
|
||||
SourceExhausted, /* partial character in source, but hit end */
|
||||
SourceIllegal /* source sequence is illegal/malformed */
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Converts from UTF-16 to UTF-8.
|
||||
/// </summary>
|
||||
void Convert( const std::wstring& src, std::string& dest );
|
||||
std::string Convert( const std::wstring& src );
|
||||
|
||||
/// <summary>
|
||||
/// Converts from UTF-16 to UTF-8.
|
||||
/// </summary>
|
||||
void Convert( const std::string& src, std::wstring& dest );
|
||||
std::wstring Convert( const std::string& src );
|
||||
}
|
||||
|
||||
namespace Exception
|
||||
{
|
||||
template< typename ResultType >
|
||||
class UTFConversion : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
const ResultType PartialResult;
|
||||
|
||||
UTFConversion( const ResultType& result, std::string msg ) :
|
||||
runtime_error( msg ),
|
||||
PartialResult( result ) {}
|
||||
};
|
||||
}
|
||||
|
||||
#endif // __CONVERTUTF_H__
|
|
@ -101,7 +101,7 @@ void DoFullDump()
|
|||
|
||||
if(MemDump())
|
||||
{
|
||||
dump = _wfopen( MemDumpFileName, _T("wb") );
|
||||
dump = fopen( Unicode::Convert( MemDumpFileName ).c_str(), "wb" );
|
||||
if (dump)
|
||||
{
|
||||
fwrite(_spu2mem,0x200000,1,dump);
|
||||
|
@ -110,7 +110,7 @@ void DoFullDump()
|
|||
}
|
||||
if(RegDump())
|
||||
{
|
||||
dump = _wfopen( RegDumpFileName, _T("wb") );
|
||||
dump = fopen( Unicode::Convert( RegDumpFileName ).c_str(), "wb" );
|
||||
if (dump)
|
||||
{
|
||||
fwrite(spu2regs,0x2000,1,dump);
|
||||
|
@ -119,7 +119,7 @@ void DoFullDump()
|
|||
}
|
||||
|
||||
if(!CoresDump()) return;
|
||||
dump = _wfopen( CoresDumpFileName, _T("wt") );
|
||||
dump = fopen( Unicode::Convert( CoresDumpFileName ).c_str(), "wt" );
|
||||
if (dump)
|
||||
{
|
||||
for(c=0;c<2;c++)
|
||||
|
|
|
@ -144,11 +144,7 @@ EXPORT_C_(s32) SPU2init()
|
|||
#ifdef SPU2_LOG
|
||||
if(AccessLog())
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
spu2Log = _wfopen( AccessLogFileName, _T("w") );
|
||||
#else
|
||||
spu2Log = fopen((char*)AccessLogFileName, "w");
|
||||
#endif
|
||||
spu2Log = fopen( Unicode::Convert( AccessLogFileName ).c_str(), "w" );
|
||||
setvbuf(spu2Log, NULL, _IONBF, 0);
|
||||
FileLog("SPU2init\n");
|
||||
}
|
||||
|
|
|
@ -40,13 +40,8 @@ u16* DMABaseAddr;
|
|||
void DMALogOpen()
|
||||
{
|
||||
if(!DMALog()) return;
|
||||
#ifdef _MSC_VER
|
||||
DMA4LogFile = _wfopen( DMA4LogFileName, _T("wb") );
|
||||
DMA7LogFile = _wfopen( DMA7LogFileName, _T("wb") );
|
||||
#else
|
||||
DMA4LogFile = fopen((char*)DMA4LogFileName, "wb");
|
||||
DMA7LogFile = fopen((char*)DMA7LogFileName, "wb");
|
||||
#endif
|
||||
DMA4LogFile = fopen( Unicode::Convert( DMA4LogFileName ).c_str(), "wb");
|
||||
DMA7LogFile = fopen( Unicode::Convert( DMA7LogFileName ).c_str(), "wb");
|
||||
ADMA4LogFile = fopen( "logs/adma4.raw", "wb" );
|
||||
ADMA7LogFile = fopen( "logs/adma7.raw", "wb" );
|
||||
ADMAOutLogFile = fopen( "logs/admaOut.raw", "wb" );
|
||||
|
|
|
@ -24,19 +24,11 @@
|
|||
// (it can't have too many because that would generate a compiler error).
|
||||
const u16 zero=0;
|
||||
|
||||
#ifdef __LINUX__
|
||||
#define PCORE(c,p) \
|
||||
U16P(Cores[c].p)
|
||||
|
||||
#define PVCP(c,v,p) \
|
||||
PCORE(c,Voices[v].p)
|
||||
#else
|
||||
#define PCORE(c,p) \
|
||||
U16P(Cores[c].##p)
|
||||
|
||||
#define PVCP(c,v,p) \
|
||||
PCORE(c,Voices[v].##p)
|
||||
#endif
|
||||
|
||||
#define PVC(c,v) \
|
||||
PVCP(c,v,Volume.Left.Reg_VOL), \
|
||||
|
@ -59,15 +51,9 @@ const u16 zero=0;
|
|||
#define PRAW(a) \
|
||||
((u16*)NULL)
|
||||
|
||||
#ifdef __LINUX__
|
||||
#define PREVB_REG(c,n) \
|
||||
PCORE(c,Revb.n)+1, \
|
||||
PCORE(c,Revb.n)
|
||||
#else
|
||||
#define PREVB_REG(c,n) \
|
||||
PCORE(c,Revb.##n)+1, \
|
||||
PCORE(c,Revb.##n)
|
||||
#endif
|
||||
|
||||
#pragma pack(1)
|
||||
u16* regtable[0x800] =
|
||||
|
|
|
@ -70,20 +70,12 @@ public:
|
|||
|
||||
const wchar_t* GetIdent() const
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
return _T("nullout");
|
||||
#else
|
||||
return ((wchar_t*)"nullout");
|
||||
#endif
|
||||
return L"nullout";
|
||||
}
|
||||
|
||||
const wchar_t* GetLongName() const
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
return _T("No Sound (Emulate SPU2 only)");
|
||||
#else
|
||||
return((wchar_t*)"No Sound (Emulate SPU2 only)");
|
||||
#endif
|
||||
return L"No Sound (Emulate SPU2 only)";
|
||||
}
|
||||
|
||||
} NullOut;
|
||||
|
|
|
@ -94,8 +94,8 @@ void SysMessage(const char *fmt, ...)
|
|||
va_start(list,fmt);
|
||||
sprintf_s(tmp,fmt,list);
|
||||
va_end(list);
|
||||
swprintf_s(wtmp, _T("%S"), tmp);
|
||||
MessageBox(0, wtmp, _T("SPU2-X System Message"), 0);
|
||||
swprintf_s(wtmp, L"%S", tmp);
|
||||
MessageBox(0, wtmp, L"SPU2-X System Message", 0);
|
||||
}
|
||||
#else
|
||||
extern void SysMessage(const char *fmt, ...);
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
#define SVN_REV_UNKNOWN
|
||||
#endif
|
||||
|
||||
#include "ConvertUTF.h"
|
||||
|
||||
namespace VersionInfo
|
||||
{
|
||||
static const u8 PluginApi = PS2E_SPU2_VERSION;
|
||||
|
|
|
@ -37,9 +37,9 @@ static LRESULT WINAPI AboutProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
|
||||
wchar_t outstr[256];
|
||||
if( IsDevBuild )
|
||||
swprintf_s( outstr, _T("Build r%d -- Compiled on ") _T(__DATE__), SVN_REV );
|
||||
swprintf_s( outstr, L"Build r%d -- Compiled on " _T(__DATE__), SVN_REV );
|
||||
else
|
||||
swprintf_s( outstr, _T("Release v%d.%d -- Compiled on ") _T(__DATE__),
|
||||
swprintf_s( outstr, L"Release v%d.%d -- Compiled on " _T(__DATE__),
|
||||
VersionInfo::Release, VersionInfo::Revision );
|
||||
|
||||
SetWindowText( GetDlgItem(hDlg, IDC_LABEL_VERSION_INFO), outstr );
|
||||
|
@ -55,12 +55,12 @@ static LRESULT WINAPI AboutProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
return TRUE;
|
||||
|
||||
case IDC_LINK_WEBSITE:
|
||||
ShellExecute(hDlg, _T("open"), _T("http://www.pcsx2.net/"),
|
||||
ShellExecute(hDlg, L"open", L"http://www.pcsx2.net/",
|
||||
NULL, NULL, SW_SHOWNORMAL);
|
||||
return TRUE;
|
||||
|
||||
case IDC_LINK_GOOGLECODE:
|
||||
ShellExecute(hDlg, _T("open"), _T("http://code.google.com/p/pcsx2"),
|
||||
ShellExecute(hDlg, L"open", L"http://code.google.com/p/pcsx2",
|
||||
NULL, NULL, SW_SHOWNORMAL);
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
//////
|
||||
|
||||
const TCHAR CfgFile[] = _T("inis\\SPU2-X.ini");
|
||||
const TCHAR CfgFile[] = L"inis\\SPU2-X.ini";
|
||||
|
||||
|
||||
/*| Config File Format: |¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯*\
|
||||
|
@ -43,7 +43,7 @@ const TCHAR CfgFile[] = _T("inis\\SPU2-X.ini");
|
|||
|
||||
void CfgWriteBool(const TCHAR* Section, const TCHAR* Name, bool Value)
|
||||
{
|
||||
const TCHAR *Data = Value ? _T("TRUE") : _T("FALSE");
|
||||
const TCHAR *Data = Value ? L"TRUE" : L"FALSE";
|
||||
WritePrivateProfileString( Section, Name, Data, CfgFile );
|
||||
}
|
||||
|
||||
|
@ -70,18 +70,18 @@ bool CfgReadBool(const TCHAR *Section,const TCHAR* Name, bool Default)
|
|||
{
|
||||
TCHAR Data[255] = {0};
|
||||
|
||||
GetPrivateProfileString( Section, Name, _T(""), Data, 255, CfgFile );
|
||||
GetPrivateProfileString( Section, Name, L"", Data, 255, CfgFile );
|
||||
Data[254]=0;
|
||||
if(wcslen(Data)==0) {
|
||||
CfgWriteBool(Section,Name,Default);
|
||||
return Default;
|
||||
}
|
||||
|
||||
if(wcscmp(Data,_T("1"))==0) return true;
|
||||
if(wcscmp(Data,_T("Y"))==0) return true;
|
||||
if(wcscmp(Data,_T("T"))==0) return true;
|
||||
if(wcscmp(Data,_T("YES"))==0) return true;
|
||||
if(wcscmp(Data,_T("TRUE"))==0) return true;
|
||||
if(wcscmp(Data,L"1")==0) return true;
|
||||
if(wcscmp(Data,L"Y")==0) return true;
|
||||
if(wcscmp(Data,L"T")==0) return true;
|
||||
if(wcscmp(Data,L"YES")==0) return true;
|
||||
if(wcscmp(Data,L"TRUE")==0) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ bool CfgReadBool(const TCHAR *Section,const TCHAR* Name, bool Default)
|
|||
int CfgReadInt(const TCHAR* Section, const TCHAR* Name,int Default)
|
||||
{
|
||||
TCHAR Data[255]={0};
|
||||
GetPrivateProfileString(Section,Name,_T(""),Data,255,CfgFile);
|
||||
GetPrivateProfileString(Section,Name,L"",Data,255,CfgFile);
|
||||
Data[254]=0;
|
||||
|
||||
if(wcslen(Data)==0) {
|
||||
|
@ -102,10 +102,10 @@ int CfgReadInt(const TCHAR* Section, const TCHAR* Name,int Default)
|
|||
|
||||
void CfgReadStr(const TCHAR* Section, const TCHAR* Name, TCHAR* Data, int DataSize, const TCHAR* Default)
|
||||
{
|
||||
GetPrivateProfileString(Section,Name,_T(""),Data,DataSize,CfgFile);
|
||||
GetPrivateProfileString(Section,Name,L"",Data,DataSize,CfgFile);
|
||||
|
||||
if(wcslen(Data)==0) {
|
||||
swprintf_s( Data, DataSize, _T("%s"), Default );
|
||||
swprintf_s( Data, DataSize, L"%s", Default );
|
||||
CfgWriteStr( Section, Name, Data );
|
||||
}
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ void CfgReadStr(const TCHAR* Section, const TCHAR* Name, TCHAR* Data, int DataSi
|
|||
void CfgReadStr(const TCHAR* Section, const TCHAR* Name, wstring Data, int DataSize, const TCHAR* Default)
|
||||
{
|
||||
wchar_t workspace[512];
|
||||
GetPrivateProfileString(Section,Name,_T(""),workspace,DataSize,CfgFile);
|
||||
GetPrivateProfileString(Section,Name,L"",workspace,DataSize,CfgFile);
|
||||
|
||||
Data = workspace;
|
||||
|
||||
|
@ -130,7 +130,7 @@ bool CfgFindName( const TCHAR *Section, const TCHAR* Name)
|
|||
{
|
||||
// Only load 24 characters. No need to load more.
|
||||
TCHAR Data[24]={0};
|
||||
GetPrivateProfileString(Section,Name,_T(""),Data,24,CfgFile);
|
||||
GetPrivateProfileString(Section,Name,L"",Data,24,CfgFile);
|
||||
Data[23]=0;
|
||||
|
||||
if(wcslen(Data)==0) return false;
|
||||
|
|
|
@ -63,32 +63,32 @@ bool StereoExpansionDisabled = true;
|
|||
|
||||
void ReadSettings()
|
||||
{
|
||||
AutoDMAPlayRate[0] = CfgReadInt(_T("MIXING"),_T("AutoDMA_Play_Rate_0"),0);
|
||||
AutoDMAPlayRate[1] = CfgReadInt(_T("MIXING"),_T("AutoDMA_Play_Rate_1"),0);
|
||||
AutoDMAPlayRate[0] = CfgReadInt(L"MIXING",L"AutoDMA_Play_Rate_0",0);
|
||||
AutoDMAPlayRate[1] = CfgReadInt(L"MIXING",L"AutoDMA_Play_Rate_1",0);
|
||||
|
||||
Interpolation = CfgReadInt(_T("MIXING"),_T("Interpolation"),1);
|
||||
Interpolation = CfgReadInt(L"MIXING",L"Interpolation",1);
|
||||
|
||||
timeStretchDisabled = CfgReadBool( _T("OUTPUT"), _T("Disable_Timestretch"), false );
|
||||
EffectsDisabled = CfgReadBool( _T("MIXING"), _T("Disable_Effects"), false );
|
||||
timeStretchDisabled = CfgReadBool( L"OUTPUT", L"Disable_Timestretch", false );
|
||||
EffectsDisabled = CfgReadBool( L"MIXING", L"Disable_Effects", false );
|
||||
|
||||
StereoExpansionDisabled = CfgReadBool( _T("OUTPUT"), _T("Disable_StereoExpansion"), false );
|
||||
SndOutLatencyMS = CfgReadInt(_T("OUTPUT"),_T("Latency"), 160);
|
||||
StereoExpansionDisabled = CfgReadBool( L"OUTPUT", L"Disable_StereoExpansion", false );
|
||||
SndOutLatencyMS = CfgReadInt(L"OUTPUT",L"Latency", 160);
|
||||
|
||||
wchar_t omodid[128];
|
||||
CfgReadStr( _T("OUTPUT"), _T("Output_Module"), omodid, 127, XAudio2Out->GetIdent() );
|
||||
CfgReadStr( L"OUTPUT", L"Output_Module", omodid, 127, XAudio2Out->GetIdent() );
|
||||
|
||||
// find the driver index of this module:
|
||||
OutputModule = FindOutputModuleById( omodid );
|
||||
|
||||
CfgReadStr( _T("DSP PLUGIN"),_T("Filename"),dspPlugin,255,_T(""));
|
||||
dspPluginModule = CfgReadInt(_T("DSP PLUGIN"),_T("ModuleNum"),0);
|
||||
dspPluginEnabled= CfgReadBool(_T("DSP PLUGIN"),_T("Enabled"),false);
|
||||
CfgReadStr( L"DSP PLUGIN",L"Filename",dspPlugin,255,L"");
|
||||
dspPluginModule = CfgReadInt(L"DSP PLUGIN",L"ModuleNum",0);
|
||||
dspPluginEnabled= CfgReadBool(L"DSP PLUGIN",L"Enabled",false);
|
||||
|
||||
// Read DSOUNDOUT and WAVEOUT configs:
|
||||
CfgReadStr( _T("DSOUNDOUT"), _T("Device"), Config_DSoundOut.Device, 254, _T("default") );
|
||||
CfgReadStr( _T("WAVEOUT"), _T("Device"), Config_WaveOut.Device, 254, _T("default") );
|
||||
Config_DSoundOut.NumBuffers = CfgReadInt( _T("DSOUNDOUT"), _T("Buffer_Count"), 5 );
|
||||
Config_WaveOut.NumBuffers = CfgReadInt( _T("WAVEOUT"), _T("Buffer_Count"), 4 );
|
||||
CfgReadStr( L"DSOUNDOUT", L"Device", Config_DSoundOut.Device, 254, L"default" );
|
||||
CfgReadStr( L"WAVEOUT", L"Device", Config_WaveOut.Device, 254, L"default" );
|
||||
Config_DSoundOut.NumBuffers = CfgReadInt( L"DSOUNDOUT", L"Buffer_Count", 5 );
|
||||
Config_WaveOut.NumBuffers = CfgReadInt( L"WAVEOUT", L"Buffer_Count", 4 );
|
||||
|
||||
SoundtouchCfg::ReadSettings();
|
||||
DebugConfig::ReadSettings();
|
||||
|
@ -114,30 +114,30 @@ void ReadSettings()
|
|||
|
||||
void WriteSettings()
|
||||
{
|
||||
CfgWriteInt(_T("MIXING"),_T("Interpolation"),Interpolation);
|
||||
CfgWriteInt(L"MIXING",L"Interpolation",Interpolation);
|
||||
|
||||
CfgWriteInt(_T("MIXING"),_T("AutoDMA_Play_Rate_0"),AutoDMAPlayRate[0]);
|
||||
CfgWriteInt(_T("MIXING"),_T("AutoDMA_Play_Rate_1"),AutoDMAPlayRate[1]);
|
||||
CfgWriteInt(L"MIXING",L"AutoDMA_Play_Rate_0",AutoDMAPlayRate[0]);
|
||||
CfgWriteInt(L"MIXING",L"AutoDMA_Play_Rate_1",AutoDMAPlayRate[1]);
|
||||
|
||||
CfgWriteBool(_T("MIXING"),_T("Disable_Effects"),EffectsDisabled);
|
||||
CfgWriteBool(L"MIXING",L"Disable_Effects",EffectsDisabled);
|
||||
|
||||
CfgWriteStr(_T("OUTPUT"),_T("Output_Module"), mods[OutputModule]->GetIdent() );
|
||||
CfgWriteInt(_T("OUTPUT"),_T("Latency"), SndOutLatencyMS);
|
||||
CfgWriteBool(_T("OUTPUT"),_T("Disable_Timestretch"), timeStretchDisabled);
|
||||
CfgWriteBool(_T("OUTPUT"),_T("Disable_StereoExpansion"), StereoExpansionDisabled);
|
||||
CfgWriteStr(L"OUTPUT",L"Output_Module", mods[OutputModule]->GetIdent() );
|
||||
CfgWriteInt(L"OUTPUT",L"Latency", SndOutLatencyMS);
|
||||
CfgWriteBool(L"OUTPUT",L"Disable_Timestretch", timeStretchDisabled);
|
||||
CfgWriteBool(L"OUTPUT",L"Disable_StereoExpansion", StereoExpansionDisabled);
|
||||
|
||||
if( Config_DSoundOut.Device.empty() ) Config_DSoundOut.Device = _T("default");
|
||||
if( Config_WaveOut.Device.empty() ) Config_WaveOut.Device = _T("default");
|
||||
if( Config_DSoundOut.Device.empty() ) Config_DSoundOut.Device = L"default";
|
||||
if( Config_WaveOut.Device.empty() ) Config_WaveOut.Device = L"default";
|
||||
|
||||
CfgWriteStr(_T("DSOUNDOUT"),_T("Device"),Config_DSoundOut.Device);
|
||||
CfgWriteInt(_T("DSOUNDOUT"),_T("Buffer_Count"),Config_DSoundOut.NumBuffers);
|
||||
CfgWriteStr(L"DSOUNDOUT",L"Device",Config_DSoundOut.Device);
|
||||
CfgWriteInt(L"DSOUNDOUT",L"Buffer_Count",Config_DSoundOut.NumBuffers);
|
||||
|
||||
CfgWriteStr(_T("WAVEOUT"),_T("Device"),Config_WaveOut.Device);
|
||||
CfgWriteInt(_T("WAVEOUT"),_T("Buffer_Count"),Config_WaveOut.NumBuffers);
|
||||
CfgWriteStr(L"WAVEOUT",L"Device",Config_WaveOut.Device);
|
||||
CfgWriteInt(L"WAVEOUT",L"Buffer_Count",Config_WaveOut.NumBuffers);
|
||||
|
||||
CfgWriteStr(_T("DSP PLUGIN"),_T("Filename"),dspPlugin);
|
||||
CfgWriteInt(_T("DSP PLUGIN"),_T("ModuleNum"),dspPluginModule);
|
||||
CfgWriteBool(_T("DSP PLUGIN"),_T("Enabled"),dspPluginEnabled);
|
||||
CfgWriteStr(L"DSP PLUGIN",L"Filename",dspPlugin);
|
||||
CfgWriteInt(L"DSP PLUGIN",L"ModuleNum",dspPluginModule);
|
||||
CfgWriteBool(L"DSP PLUGIN",L"Enabled",dspPluginEnabled);
|
||||
|
||||
SoundtouchCfg::WriteSettings();
|
||||
DebugConfig::WriteSettings();
|
||||
|
@ -157,9 +157,9 @@ BOOL CALLBACK ConfigProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
|
|||
case WM_INITDIALOG:
|
||||
{
|
||||
SendDialogMsg( hWnd, IDC_INTERPOLATE, CB_RESETCONTENT,0,0 );
|
||||
SendDialogMsg( hWnd, IDC_INTERPOLATE, CB_ADDSTRING,0,(LPARAM) _T("0 - Nearest (none/fast)") );
|
||||
SendDialogMsg( hWnd, IDC_INTERPOLATE, CB_ADDSTRING,0,(LPARAM) _T("1 - Linear (recommended)") );
|
||||
SendDialogMsg( hWnd, IDC_INTERPOLATE, CB_ADDSTRING,0,(LPARAM) _T("2 - Cubic (not good with effects)") );
|
||||
SendDialogMsg( hWnd, IDC_INTERPOLATE, CB_ADDSTRING,0,(LPARAM) L"0 - Nearest (none/fast)" );
|
||||
SendDialogMsg( hWnd, IDC_INTERPOLATE, CB_ADDSTRING,0,(LPARAM) L"1 - Linear (recommended)" );
|
||||
SendDialogMsg( hWnd, IDC_INTERPOLATE, CB_ADDSTRING,0,(LPARAM) L"2 - Cubic (not good with effects)" );
|
||||
SendDialogMsg( hWnd, IDC_INTERPOLATE, CB_SETCURSEL,Interpolation,0 );
|
||||
|
||||
SendDialogMsg( hWnd, IDC_OUTPUT, CB_RESETCONTENT,0,0 );
|
||||
|
@ -167,7 +167,7 @@ BOOL CALLBACK ConfigProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
|
|||
int modidx = 0;
|
||||
while( mods[modidx] != NULL )
|
||||
{
|
||||
swprintf_s( temp, 72, _T("%d - %s"), modidx, mods[modidx]->GetLongName() );
|
||||
swprintf_s( temp, 72, L"%d - %s", modidx, mods[modidx]->GetLongName() );
|
||||
SendDialogMsg( hWnd, IDC_OUTPUT, CB_ADDSTRING,0,(LPARAM)temp );
|
||||
++modidx;
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ BOOL CALLBACK ConfigProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
|
|||
INIT_SLIDER( IDC_LATENCY_SLIDER, minexp, maxexp, 200, 42, 12 );
|
||||
|
||||
SendDialogMsg( hWnd, IDC_LATENCY_SLIDER, TBM_SETPOS, TRUE, (int)((pow( (double)SndOutLatencyMS, 1.0/3.0 ) * 128.0) + 0.5) );
|
||||
swprintf_s(temp,_T("%d ms (avg)"),SndOutLatencyMS);
|
||||
swprintf_s(temp,L"%d ms (avg)",SndOutLatencyMS);
|
||||
SetWindowText(GetDlgItem(hWnd,IDC_LATENCY_LABEL),temp);
|
||||
|
||||
EnableWindow( GetDlgItem( hWnd, IDC_OPEN_CONFIG_SOUNDTOUCH ), !timeStretchDisabled );
|
||||
|
@ -286,7 +286,7 @@ BOOL CALLBACK ConfigProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
|
|||
{
|
||||
double res = pow( curpos / 128.0, 3.0 );
|
||||
curpos = (int)res;
|
||||
swprintf_s(temp,_T("%d ms (avg)"),curpos);
|
||||
swprintf_s(temp,L"%d ms (avg)",curpos);
|
||||
SetDlgItemText(hWnd,IDC_LATENCY_LABEL,temp);
|
||||
}
|
||||
break;
|
||||
|
@ -310,7 +310,7 @@ void configure()
|
|||
ret = DialogBoxParam(hInstance,MAKEINTRESOURCE(IDD_CONFIG),GetActiveWindow(),(DLGPROC)ConfigProc,1);
|
||||
if(ret==-1)
|
||||
{
|
||||
MessageBoxEx(GetActiveWindow(),_T("Error Opening the config dialog."),_T("OMG ERROR!"),MB_OK,0);
|
||||
MessageBoxEx(GetActiveWindow(),L"Error Opening the config dialog.",L"OMG ERROR!",MB_OK,0);
|
||||
return;
|
||||
}
|
||||
ReadSettings();
|
||||
|
|
|
@ -54,66 +54,66 @@ wchar_t RegDumpFileName[255];
|
|||
|
||||
namespace DebugConfig {
|
||||
|
||||
static const TCHAR* Section = _T("DEBUG");
|
||||
static const TCHAR* Section = L"DEBUG";
|
||||
|
||||
void ReadSettings()
|
||||
{
|
||||
DebugEnabled = CfgReadBool(Section, _T("Global_Enable"),0);
|
||||
_MsgToConsole= CfgReadBool(Section, _T("Show_Messages"),0);
|
||||
_MsgKeyOnOff = CfgReadBool(Section, _T("Show_Messages_Key_On_Off"),0);
|
||||
_MsgVoiceOff = CfgReadBool(Section, _T("Show_Messages_Voice_Off"),0);
|
||||
_MsgDMA = CfgReadBool(Section, _T("Show_Messages_DMA_Transfer"),0);
|
||||
_MsgAutoDMA = CfgReadBool(Section, _T("Show_Messages_AutoDMA"),0);
|
||||
_MsgOverruns = CfgReadBool(Section, _T("Show_Messages_Overruns"),0);
|
||||
_MsgCache = CfgReadBool(Section, _T("Show_Messages_CacheStats"),0);
|
||||
DebugEnabled = CfgReadBool(Section, L"Global_Enable",0);
|
||||
_MsgToConsole= CfgReadBool(Section, L"Show_Messages",0);
|
||||
_MsgKeyOnOff = CfgReadBool(Section, L"Show_Messages_Key_On_Off",0);
|
||||
_MsgVoiceOff = CfgReadBool(Section, L"Show_Messages_Voice_Off",0);
|
||||
_MsgDMA = CfgReadBool(Section, L"Show_Messages_DMA_Transfer",0);
|
||||
_MsgAutoDMA = CfgReadBool(Section, L"Show_Messages_AutoDMA",0);
|
||||
_MsgOverruns = CfgReadBool(Section, L"Show_Messages_Overruns",0);
|
||||
_MsgCache = CfgReadBool(Section, L"Show_Messages_CacheStats",0);
|
||||
|
||||
_AccessLog = CfgReadBool(Section, _T("Log_Register_Access"),0);
|
||||
_DMALog = CfgReadBool(Section, _T("Log_DMA_Transfers"),0);
|
||||
_WaveLog = CfgReadBool(Section, _T("Log_WAVE_Output"),0);
|
||||
_AccessLog = CfgReadBool(Section, L"Log_Register_Access",0);
|
||||
_DMALog = CfgReadBool(Section, L"Log_DMA_Transfers",0);
|
||||
_WaveLog = CfgReadBool(Section, L"Log_WAVE_Output",0);
|
||||
|
||||
_CoresDump = CfgReadBool(Section, _T("Dump_Info"),0);
|
||||
_MemDump = CfgReadBool(Section, _T("Dump_Memory"),0);
|
||||
_RegDump = CfgReadBool(Section, _T("Dump_Regs"),0);
|
||||
_CoresDump = CfgReadBool(Section, L"Dump_Info",0);
|
||||
_MemDump = CfgReadBool(Section, L"Dump_Memory",0);
|
||||
_RegDump = CfgReadBool(Section, L"Dump_Regs",0);
|
||||
|
||||
CfgReadStr(Section,_T("Access_Log_Filename"),AccessLogFileName,255,_T("logs\\SPU2Log.txt"));
|
||||
CfgReadStr(Section,_T("WaveLog_Filename"), WaveLogFileName, 255,_T("logs\\SPU2log.wav"));
|
||||
CfgReadStr(Section,_T("DMA4Log_Filename"), DMA4LogFileName, 255,_T("logs\\SPU2dma4.dat"));
|
||||
CfgReadStr(Section,_T("DMA7Log_Filename"), DMA7LogFileName, 255,_T("logs\\SPU2dma7.dat"));
|
||||
CfgReadStr(Section,L"Access_Log_Filename",AccessLogFileName,255,L"logs\\SPU2Log.txt");
|
||||
CfgReadStr(Section,L"WaveLog_Filename", WaveLogFileName, 255,L"logs\\SPU2log.wav");
|
||||
CfgReadStr(Section,L"DMA4Log_Filename", DMA4LogFileName, 255,L"logs\\SPU2dma4.dat");
|
||||
CfgReadStr(Section,L"DMA7Log_Filename", DMA7LogFileName, 255,L"logs\\SPU2dma7.dat");
|
||||
|
||||
CfgReadStr(Section,_T("Info_Dump_Filename"),CoresDumpFileName,255,_T("logs\\SPU2Cores.txt"));
|
||||
CfgReadStr(Section,_T("Mem_Dump_Filename"), MemDumpFileName, 255,_T("logs\\SPU2mem.dat"));
|
||||
CfgReadStr(Section,_T("Reg_Dump_Filename"), RegDumpFileName, 255,_T("logs\\SPU2regs.dat"));
|
||||
CfgReadStr(Section,L"Info_Dump_Filename",CoresDumpFileName,255,L"logs\\SPU2Cores.txt");
|
||||
CfgReadStr(Section,L"Mem_Dump_Filename", MemDumpFileName, 255,L"logs\\SPU2mem.dat");
|
||||
CfgReadStr(Section,L"Reg_Dump_Filename", RegDumpFileName, 255,L"logs\\SPU2regs.dat");
|
||||
}
|
||||
|
||||
|
||||
void WriteSettings()
|
||||
{
|
||||
CfgWriteBool(Section,_T("Global_Enable"),DebugEnabled);
|
||||
CfgWriteBool(Section,L"Global_Enable",DebugEnabled);
|
||||
|
||||
CfgWriteBool(Section,_T("Show_Messages"), _MsgToConsole);
|
||||
CfgWriteBool(Section,_T("Show_Messages_Key_On_Off"), _MsgKeyOnOff);
|
||||
CfgWriteBool(Section,_T("Show_Messages_Voice_Off"), _MsgVoiceOff);
|
||||
CfgWriteBool(Section,_T("Show_Messages_DMA_Transfer"),_MsgDMA);
|
||||
CfgWriteBool(Section,_T("Show_Messages_AutoDMA"), _MsgAutoDMA);
|
||||
CfgWriteBool(Section,_T("Show_Messages_Overruns"), _MsgOverruns);
|
||||
CfgWriteBool(Section,_T("Show_Messages_CacheStats"), _MsgCache);
|
||||
CfgWriteBool(Section,L"Show_Messages", _MsgToConsole);
|
||||
CfgWriteBool(Section,L"Show_Messages_Key_On_Off", _MsgKeyOnOff);
|
||||
CfgWriteBool(Section,L"Show_Messages_Voice_Off", _MsgVoiceOff);
|
||||
CfgWriteBool(Section,L"Show_Messages_DMA_Transfer",_MsgDMA);
|
||||
CfgWriteBool(Section,L"Show_Messages_AutoDMA", _MsgAutoDMA);
|
||||
CfgWriteBool(Section,L"Show_Messages_Overruns", _MsgOverruns);
|
||||
CfgWriteBool(Section,L"Show_Messages_CacheStats", _MsgCache);
|
||||
|
||||
CfgWriteBool(Section,_T("Log_Register_Access"),_AccessLog);
|
||||
CfgWriteBool(Section,_T("Log_DMA_Transfers"), _DMALog);
|
||||
CfgWriteBool(Section,_T("Log_WAVE_Output"), _WaveLog);
|
||||
CfgWriteBool(Section,L"Log_Register_Access",_AccessLog);
|
||||
CfgWriteBool(Section,L"Log_DMA_Transfers", _DMALog);
|
||||
CfgWriteBool(Section,L"Log_WAVE_Output", _WaveLog);
|
||||
|
||||
CfgWriteBool(Section,_T("Dump_Info"), _CoresDump);
|
||||
CfgWriteBool(Section,_T("Dump_Memory"),_MemDump);
|
||||
CfgWriteBool(Section,_T("Dump_Regs"), _RegDump);
|
||||
CfgWriteBool(Section,L"Dump_Info", _CoresDump);
|
||||
CfgWriteBool(Section,L"Dump_Memory",_MemDump);
|
||||
CfgWriteBool(Section,L"Dump_Regs", _RegDump);
|
||||
|
||||
CfgWriteStr(Section,_T("Access_Log_Filename"),AccessLogFileName);
|
||||
CfgWriteStr(Section,_T("WaveLog_Filename"), WaveLogFileName);
|
||||
CfgWriteStr(Section,_T("DMA4Log_Filename"), DMA4LogFileName);
|
||||
CfgWriteStr(Section,_T("DMA7Log_Filename"), DMA7LogFileName);
|
||||
CfgWriteStr(Section,L"Access_Log_Filename",AccessLogFileName);
|
||||
CfgWriteStr(Section,L"WaveLog_Filename", WaveLogFileName);
|
||||
CfgWriteStr(Section,L"DMA4Log_Filename", DMA4LogFileName);
|
||||
CfgWriteStr(Section,L"DMA7Log_Filename", DMA7LogFileName);
|
||||
|
||||
CfgWriteStr(Section,_T("Info_Dump_Filename"),CoresDumpFileName);
|
||||
CfgWriteStr(Section,_T("Mem_Dump_Filename"), MemDumpFileName);
|
||||
CfgWriteStr(Section,_T("Reg_Dump_Filename"), RegDumpFileName);
|
||||
CfgWriteStr(Section,L"Info_Dump_Filename",CoresDumpFileName);
|
||||
CfgWriteStr(Section,L"Mem_Dump_Filename", MemDumpFileName);
|
||||
CfgWriteStr(Section,L"Reg_Dump_Filename", RegDumpFileName);
|
||||
|
||||
}
|
||||
|
||||
|
@ -224,7 +224,7 @@ void OpenDialog()
|
|||
INT_PTR ret = DialogBoxParam(hInstance,MAKEINTRESOURCE(IDD_CONFIG_DEBUG),GetActiveWindow(),(DLGPROC)DialogProc,1);
|
||||
if(ret == -1)
|
||||
{
|
||||
MessageBoxEx(GetActiveWindow(),_T("Error Opening the debug configuration dialog."),_T("OMG ERROR!"),MB_OK,0);
|
||||
MessageBoxEx(GetActiveWindow(),L"Error Opening the debug configuration dialog.",L"OMG ERROR!",MB_OK,0);
|
||||
return;
|
||||
}
|
||||
ReadSettings();
|
||||
|
|
|
@ -35,18 +35,18 @@ void SoundtouchCfg::ClampValues()
|
|||
|
||||
void SoundtouchCfg::ReadSettings()
|
||||
{
|
||||
SequenceLenMS = CfgReadInt( _T("SOUNDTOUCH"), _T("SequenceLengthMS"), 63 );
|
||||
SeekWindowMS = CfgReadInt( _T("SOUNDTOUCH"), _T("SeekWindowMS"), 16 );
|
||||
OverlapMS = CfgReadInt( _T("SOUNDTOUCH"), _T("OverlapMS"), 7 );
|
||||
SequenceLenMS = CfgReadInt( L"SOUNDTOUCH", L"SequenceLengthMS", 63 );
|
||||
SeekWindowMS = CfgReadInt( L"SOUNDTOUCH", L"SeekWindowMS", 16 );
|
||||
OverlapMS = CfgReadInt( L"SOUNDTOUCH", L"OverlapMS", 7 );
|
||||
|
||||
ClampValues();
|
||||
}
|
||||
|
||||
void SoundtouchCfg::WriteSettings()
|
||||
{
|
||||
CfgWriteInt( _T("SOUNDTOUCH"), _T("SequenceLengthMS"), SequenceLenMS );
|
||||
CfgWriteInt( _T("SOUNDTOUCH"), _T("SeekWindowMS"), SeekWindowMS );
|
||||
CfgWriteInt( _T("SOUNDTOUCH"), _T("OverlapMS"), OverlapMS );
|
||||
CfgWriteInt( L"SOUNDTOUCH", L"SequenceLengthMS", SequenceLenMS );
|
||||
CfgWriteInt( L"SOUNDTOUCH", L"SeekWindowMS", SeekWindowMS );
|
||||
CfgWriteInt( L"SOUNDTOUCH", L"OverlapMS", OverlapMS );
|
||||
}
|
||||
|
||||
BOOL CALLBACK SoundtouchCfg::DialogProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
|
||||
|
@ -106,7 +106,7 @@ void SoundtouchCfg::OpenDialog( HWND hWnd )
|
|||
ret = DialogBox( hInstance, MAKEINTRESOURCE(IDD_CONFIG_SOUNDTOUCH), hWnd, (DLGPROC)DialogProc );
|
||||
if(ret==-1)
|
||||
{
|
||||
MessageBoxEx(GetActiveWindow(),_T("Error Opening the Soundtouch advanced dialog."),_T("OMG ERROR!"),MB_OK,0);
|
||||
MessageBoxEx(GetActiveWindow(),L"Error Opening the Soundtouch advanced dialog.",L"OMG ERROR!",MB_OK,0);
|
||||
return;
|
||||
}
|
||||
ReadSettings();
|
||||
|
|
|
@ -103,7 +103,7 @@ void UpdateDebugDialog()
|
|||
if(!hf)
|
||||
{
|
||||
hf = CreateFont( 8, 0, 0, 0, 0, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
|
||||
DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, _T("Lucida Console") );
|
||||
DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, L"Lucida Console" );
|
||||
}
|
||||
|
||||
SelectObject(hdc,hf);
|
||||
|
@ -164,13 +164,13 @@ void UpdateDebugDialog()
|
|||
|
||||
static wchar_t t[1024];
|
||||
|
||||
swprintf_s(t,_T("%06x"),vc.StartA);
|
||||
swprintf_s(t,L"%06x",vc.StartA);
|
||||
TextOut(hdc,IX+4,IY+3,t,6);
|
||||
|
||||
swprintf_s(t,_T("%06x"),vc.NextA);
|
||||
swprintf_s(t,L"%06x",vc.NextA);
|
||||
TextOut(hdc,IX+4,IY+12,t,6);
|
||||
|
||||
swprintf_s(t,_T("%06x"),vc.LoopStartA);
|
||||
swprintf_s(t,L"%06x",vc.LoopStartA);
|
||||
TextOut(hdc,IX+4,IY+21,t,6);
|
||||
|
||||
vcd.displayPeak = 0;
|
||||
|
|
|
@ -296,7 +296,7 @@ private:
|
|||
|
||||
INIT_SLIDER( IDC_BUFFERS_SLIDER, 2, MAX_BUFFER_COUNT, 2, 1, 1 );
|
||||
SendMessage(GetDlgItem(hWnd,IDC_BUFFERS_SLIDER),TBM_SETPOS,TRUE,Config_DSoundOut.NumBuffers);
|
||||
swprintf_s(temp, _T("%d (%d ms latency)"),Config_DSoundOut.NumBuffers, 1000 / (96000 / (Config_DSoundOut.NumBuffers * BufferSize)));
|
||||
swprintf_s(temp, L"%d (%d ms latency)",Config_DSoundOut.NumBuffers, 1000 / (96000 / (Config_DSoundOut.NumBuffers * BufferSize)));
|
||||
SetWindowText(GetDlgItem(hWnd,IDC_LATENCY_LABEL),temp);
|
||||
}
|
||||
break;
|
||||
|
@ -320,7 +320,7 @@ private:
|
|||
}
|
||||
else
|
||||
{
|
||||
swprintf_s(temp, _T("{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}"),
|
||||
swprintf_s(temp, L"{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
|
||||
devices[i].guid.Data1,
|
||||
devices[i].guid.Data2,
|
||||
devices[i].guid.Data3,
|
||||
|
@ -370,7 +370,7 @@ private:
|
|||
if( wmEvent < 2 ) wmEvent = 2;
|
||||
if( wmEvent > MAX_BUFFER_COUNT ) wmEvent = MAX_BUFFER_COUNT;
|
||||
SendMessage((HWND)lParam,TBM_SETPOS,TRUE,wmEvent);
|
||||
swprintf_s(temp,_T("%d (%d ms latency)"),wmEvent, 1000 / (96000 / (wmEvent * BufferSize)));
|
||||
swprintf_s(temp,L"%d (%d ms latency)",wmEvent, 1000 / (96000 / (wmEvent * BufferSize)));
|
||||
SetWindowText(GetDlgItem(hWnd,IDC_LATENCY_LABEL),temp);
|
||||
break;
|
||||
}
|
||||
|
@ -393,7 +393,7 @@ public:
|
|||
ret=DialogBoxParam(hInstance,MAKEINTRESOURCE(IDD_DSOUND),GetActiveWindow(),(DLGPROC)ConfigProc,1);
|
||||
if(ret==-1)
|
||||
{
|
||||
MessageBoxEx(GetActiveWindow(),_T("Error Opening the config dialog."),_T("OMG ERROR!"),MB_OK,0);
|
||||
MessageBoxEx(GetActiveWindow(),L"Error Opening the config dialog.",L"OMG ERROR!",MB_OK,0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -421,12 +421,12 @@ public:
|
|||
|
||||
const wchar_t* GetIdent() const
|
||||
{
|
||||
return _T("dsound");
|
||||
return L"dsound";
|
||||
}
|
||||
|
||||
const wchar_t* GetLongName() const
|
||||
{
|
||||
return _T("DirectSound (nice)");
|
||||
return L"DirectSound (nice)";
|
||||
}
|
||||
|
||||
} DS;
|
||||
|
|
|
@ -231,33 +231,33 @@ public:
|
|||
switch( deviceDetails.OutputFormat.Format.nChannels )
|
||||
{
|
||||
case 2:
|
||||
ConLog( "* SPU2 > Using normal 2 speaker stereo output." );
|
||||
ConLog( "* SPU2 > Using normal 2 speaker stereo output.\n" );
|
||||
voiceContext = new StreamingVoice<StereoOut16>( pXAudio2 );
|
||||
break;
|
||||
|
||||
case 3:
|
||||
ConLog( "* SPU2 > 2.1 speaker expansion enabled." );
|
||||
ConLog( "* SPU2 > 2.1 speaker expansion enabled.\n" );
|
||||
voiceContext = new StreamingVoice<Stereo21Out16>( pXAudio2 );
|
||||
break;
|
||||
|
||||
case 4:
|
||||
ConLog( "* SPU2 > 4 speaker expansion enabled [quadraphenia]" );
|
||||
ConLog( "* SPU2 > 4 speaker expansion enabled [quadraphenia]\n" );
|
||||
voiceContext = new StreamingVoice<StereoQuadOut16>( pXAudio2 );
|
||||
break;
|
||||
|
||||
case 5:
|
||||
ConLog( "* SPU2 > 4.1 speaker expansion enabled." );
|
||||
ConLog( "* SPU2 > 4.1 speaker expansion enabled.\n" );
|
||||
voiceContext = new StreamingVoice<Stereo41Out16>( pXAudio2 );
|
||||
break;
|
||||
|
||||
case 6:
|
||||
case 7:
|
||||
ConLog( "* SPU2 > 5.1 speaker expansion enabled." );
|
||||
ConLog( "* SPU2 > 5.1 speaker expansion enabled.\n" );
|
||||
voiceContext = new StreamingVoice<Stereo51Out16>( pXAudio2 );
|
||||
break;
|
||||
|
||||
default: // anything 8 or more gets the 7.1 treatment!
|
||||
ConLog( "* SPU2 > 7.1 speaker expansion enabled." );
|
||||
ConLog( "* SPU2 > 7.1 speaker expansion enabled.\n" );
|
||||
voiceContext = new StreamingVoice<Stereo51Out16>( pXAudio2 );
|
||||
break;
|
||||
}
|
||||
|
@ -310,12 +310,12 @@ public:
|
|||
|
||||
const wchar_t* GetIdent() const
|
||||
{
|
||||
return _T("xaudio2");
|
||||
return L"xaudio2";
|
||||
}
|
||||
|
||||
const wchar_t* GetLongName() const
|
||||
{
|
||||
return _T("XAudio 2 (Recommended)");
|
||||
return L"XAudio 2 (Recommended)";
|
||||
}
|
||||
|
||||
} XA2;
|
||||
|
|
|
@ -110,26 +110,26 @@ public:
|
|||
switch( speakerConfig )
|
||||
{
|
||||
case 2:
|
||||
ConLog( "* SPU2 > Using normal 2 speaker stereo output." );
|
||||
ConLog( "* SPU2 > Using normal 2 speaker stereo output.\n" );
|
||||
threadproc = (LPTHREAD_START_ROUTINE)&RThread<StereoOut16>;
|
||||
speakerConfig = 2;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
ConLog( "* SPU2 > 4 speaker expansion enabled [quadraphenia]" );
|
||||
ConLog( "* SPU2 > 4 speaker expansion enabled [quadraphenia]\n" );
|
||||
threadproc = (LPTHREAD_START_ROUTINE)&RThread<StereoQuadOut16>;
|
||||
speakerConfig = 4;
|
||||
break;
|
||||
|
||||
case 6:
|
||||
case 7:
|
||||
ConLog( "* SPU2 > 5.1 speaker expansion enabled." );
|
||||
ConLog( "* SPU2 > 5.1 speaker expansion enabled.\n" );
|
||||
threadproc = (LPTHREAD_START_ROUTINE)&RThread<Stereo51Out16>;
|
||||
speakerConfig = 6;
|
||||
break;
|
||||
|
||||
default:
|
||||
ConLog( "* SPU2 > 7.1 speaker expansion enabled." );
|
||||
ConLog( "* SPU2 > 7.1 speaker expansion enabled.\n" );
|
||||
threadproc = (LPTHREAD_START_ROUTINE)&RThread<Stereo51Out16>;
|
||||
speakerConfig = 8;
|
||||
break;
|
||||
|
@ -219,7 +219,7 @@ private:
|
|||
wchar_t temp[128];
|
||||
INIT_SLIDER( IDC_BUFFERS_SLIDER, 3, MAX_BUFFER_COUNT, 2, 1, 1 );
|
||||
SendMessage(GetDlgItem(hWnd,IDC_BUFFERS_SLIDER),TBM_SETPOS,TRUE,Config_WaveOut.NumBuffers);
|
||||
swprintf_s(temp, 128, _T("%d (%d ms latency)"),Config_WaveOut.NumBuffers, 1000 / (96000 / (Config_WaveOut.NumBuffers * BufferSize)));
|
||||
swprintf_s(temp, 128, L"%d (%d ms latency)",Config_WaveOut.NumBuffers, 1000 / (96000 / (Config_WaveOut.NumBuffers * BufferSize)));
|
||||
SetWindowText(GetDlgItem(hWnd,IDC_LATENCY_LABEL),temp);
|
||||
break;
|
||||
|
||||
|
@ -261,7 +261,7 @@ private:
|
|||
if( wmEvent < 3 ) wmEvent = 3;
|
||||
if( wmEvent > MAX_BUFFER_COUNT ) wmEvent = MAX_BUFFER_COUNT;
|
||||
SendMessage((HWND)lParam,TBM_SETPOS,TRUE,wmEvent);
|
||||
swprintf_s(temp, _T("%d (%d ms latency)"),wmEvent, 1000 / (96000 / (wmEvent * BufferSize)));
|
||||
swprintf_s(temp, L"%d (%d ms latency)",wmEvent, 1000 / (96000 / (wmEvent * BufferSize)));
|
||||
SetWindowText(GetDlgItem(hWnd,IDC_LATENCY_LABEL),temp);
|
||||
break;
|
||||
default:
|
||||
|
@ -282,7 +282,7 @@ public:
|
|||
ret=DialogBoxParam(hInstance,MAKEINTRESOURCE(IDD_WAVEOUT),GetActiveWindow(),(DLGPROC)ConfigProc,1);
|
||||
if(ret==-1)
|
||||
{
|
||||
MessageBoxEx(GetActiveWindow(), _T("Error Opening the config dialog."), _T("OMG ERROR!"), MB_OK, 0);
|
||||
MessageBoxEx(GetActiveWindow(), L"Error Opening the config dialog.", L"OMG ERROR!", MB_OK, 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -309,12 +309,12 @@ public:
|
|||
|
||||
const wchar_t* GetIdent() const
|
||||
{
|
||||
return _T("waveout");
|
||||
return L"waveout";
|
||||
}
|
||||
|
||||
const wchar_t* GetLongName() const
|
||||
{
|
||||
return _T("waveOut (Laggy)");
|
||||
return L"waveOut (Laggy)";
|
||||
}
|
||||
|
||||
} WO;
|
||||
|
|
|
@ -418,6 +418,14 @@
|
|||
RelativePath="..\BaseTypes.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\ConvertUTF.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\ConvertUTF.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\utf8.cpp"
|
||||
>
|
||||
|
|
|
@ -70,7 +70,7 @@ void AssignSliderValue( HWND idcwnd, HWND hwndDisplay, int value )
|
|||
SendMessage(idcwnd,TBM_SETPOS,TRUE,value);
|
||||
|
||||
wchar_t tbox[32];
|
||||
swprintf_s( tbox, _T("%d"), value );
|
||||
swprintf_s( tbox, L"%d", value );
|
||||
SetWindowText( hwndDisplay, tbox );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue