1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

use non-wx header only Ini library in preparation of the core/gui devide

This commit is contained in:
Peter Tissen 2014-06-01 22:57:50 +02:00
parent c00f4b6022
commit 2d77415cc3
8 changed files with 4434 additions and 170 deletions

View File

@ -0,0 +1,539 @@
/*
* 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 "ConvertUTF.h"
#ifdef CVTUTF_DEBUG
#include <stdio.h>
#endif
static const int halfShift = 10; /* used for shifting by 10 bits */
static const UTF32 halfBase = 0x0010000UL;
static const UTF32 halfMask = 0x3FFUL;
#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
#define false 0
#define true 1
/* --------------------------------------------------------------------- */
ConversionResult ConvertUTF32toUTF16 (
const UTF32** sourceStart, const UTF32* sourceEnd,
UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags) {
ConversionResult result = conversionOK;
const UTF32* source = *sourceStart;
UTF16* target = *targetStart;
while (source < sourceEnd) {
UTF32 ch;
if (target >= targetEnd) {
result = targetExhausted; break;
}
ch = *source++;
if (ch <= UNI_MAX_BMP) { /* Target is a character <= 0xFFFF */
/* UTF-16 surrogate values are illegal in UTF-32; 0xffff or 0xfffe are both reserved values */
if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
if (flags == strictConversion) {
--source; /* return to the illegal value itself */
result = sourceIllegal;
break;
} else {
*target++ = UNI_REPLACEMENT_CHAR;
}
} else {
*target++ = (UTF16)ch; /* normal case */
}
} else if (ch > UNI_MAX_LEGAL_UTF32) {
if (flags == strictConversion) {
result = sourceIllegal;
} else {
*target++ = UNI_REPLACEMENT_CHAR;
}
} else {
/* target is a character in range 0xFFFF - 0x10FFFF. */
if (target + 1 >= targetEnd) {
--source; /* Back up source pointer! */
result = targetExhausted; break;
}
ch -= halfBase;
*target++ = (UTF16)((ch >> halfShift) + UNI_SUR_HIGH_START);
*target++ = (UTF16)((ch & halfMask) + UNI_SUR_LOW_START);
}
}
*sourceStart = source;
*targetStart = target;
return result;
}
/* --------------------------------------------------------------------- */
ConversionResult ConvertUTF16toUTF32 (
const UTF16** sourceStart, const UTF16* sourceEnd,
UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags) {
ConversionResult result = conversionOK;
const UTF16* source = *sourceStart;
UTF32* target = *targetStart;
UTF32 ch, ch2;
while (source < sourceEnd) {
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) {
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;
} else if (flags == strictConversion) { /* it's an unpaired high surrogate */
--source; /* return to the illegal value itself */
result = sourceIllegal;
break;
}
} else { /* We don't have the 16 bits following the high surrogate. */
--source; /* return to the high surrogate */
result = sourceExhausted;
break;
}
} 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;
}
}
if (target >= targetEnd) {
source = oldSource; /* Back up source pointer! */
result = targetExhausted; break;
}
*target++ = ch;
}
*sourceStart = source;
*targetStart = target;
#ifdef CVTUTF_DEBUG
if (result == sourceIllegal) {
fprintf(stderr, "ConvertUTF16toUTF32 illegal seq 0x%04x,%04x\n", ch, ch2);
fflush(stderr);
}
#endif
return result;
}
/* --------------------------------------------------------------------- */
/*
* 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.
*/
/* --------------------------------------------------------------------- */
ConversionResult ConvertUTF16toUTF8 (
const UTF16** sourceStart, const UTF16* sourceEnd,
UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) {
ConversionResult result = conversionOK;
const UTF16* source = *sourceStart;
UTF8* target = *targetStart;
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;
} else if (flags == strictConversion) { /* it's an unpaired high surrogate */
--source; /* return to the illegal value itself */
result = sourceIllegal;
break;
}
} else { /* We don't have the 16 bits following the high surrogate. */
--source; /* return to the high surrogate */
result = sourceExhausted;
break;
}
} 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;
}
}
/* 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;
}
target += bytesToWrite;
if (target > targetEnd) {
source = oldSource; /* Back up source pointer! */
target -= bytesToWrite; result = targetExhausted; break;
}
switch (bytesToWrite) { /* note: everything falls through. */
case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
case 1: *--target = (UTF8)(ch | firstByteMark[bytesToWrite]);
}
target += bytesToWrite;
}
*sourceStart = source;
*targetStart = target;
return result;
}
/* --------------------------------------------------------------------- */
/*
* 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 Boolean 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.
*/
Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd) {
int length = trailingBytesForUTF8[*source]+1;
if (source+length > sourceEnd) {
return false;
}
return isLegalUTF8(source, length);
}
/* --------------------------------------------------------------------- */
ConversionResult ConvertUTF8toUTF16 (
const UTF8** sourceStart, const UTF8* sourceEnd,
UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags) {
ConversionResult result = conversionOK;
const UTF8* source = *sourceStart;
UTF16* target = *targetStart;
while (source < sourceEnd) {
UTF32 ch = 0;
unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
if (source + extraBytesToRead >= sourceEnd) {
result = sourceExhausted; break;
}
/* Do this check whether lenient or strict */
if (! isLegalUTF8(source, extraBytesToRead+1)) {
result = sourceIllegal;
break;
}
/*
* 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 (target >= targetEnd) {
source -= (extraBytesToRead+1); /* Back up source pointer! */
result = targetExhausted; break;
}
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) {
if (flags == strictConversion) {
source -= (extraBytesToRead+1); /* return to the illegal value itself */
result = sourceIllegal;
break;
} else {
*target++ = UNI_REPLACEMENT_CHAR;
}
} else {
*target++ = (UTF16)ch; /* normal case */
}
} else if (ch > UNI_MAX_UTF16) {
if (flags == strictConversion) {
result = sourceIllegal;
source -= (extraBytesToRead+1); /* return to the start */
break; /* Bail out; shouldn't continue */
} else {
*target++ = UNI_REPLACEMENT_CHAR;
}
} else {
/* target is a character in range 0xFFFF - 0x10FFFF. */
if (target + 1 >= targetEnd) {
source -= (extraBytesToRead+1); /* Back up source pointer! */
result = targetExhausted; break;
}
ch -= halfBase;
*target++ = (UTF16)((ch >> halfShift) + UNI_SUR_HIGH_START);
*target++ = (UTF16)((ch & halfMask) + UNI_SUR_LOW_START);
}
}
*sourceStart = source;
*targetStart = target;
return result;
}
/* --------------------------------------------------------------------- */
ConversionResult ConvertUTF32toUTF8 (
const UTF32** sourceStart, const UTF32* sourceEnd,
UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) {
ConversionResult result = conversionOK;
const UTF32* source = *sourceStart;
UTF8* target = *targetStart;
while (source < sourceEnd) {
UTF32 ch;
unsigned short bytesToWrite = 0;
const UTF32 byteMask = 0xBF;
const UTF32 byteMark = 0x80;
ch = *source++;
if (flags == strictConversion ) {
/* UTF-16 surrogate values are illegal in UTF-32 */
if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
--source; /* return to the illegal value itself */
result = sourceIllegal;
break;
}
}
/*
* Figure out how many bytes the result will require. Turn any
* illegally large UTF32 things (> Plane 17) into replacement chars.
*/
if (ch < (UTF32)0x80) { bytesToWrite = 1;
} else if (ch < (UTF32)0x800) { bytesToWrite = 2;
} else if (ch < (UTF32)0x10000) { bytesToWrite = 3;
} else if (ch <= UNI_MAX_LEGAL_UTF32) { bytesToWrite = 4;
} else { bytesToWrite = 3;
ch = UNI_REPLACEMENT_CHAR;
result = sourceIllegal;
}
target += bytesToWrite;
if (target > targetEnd) {
--source; /* Back up source pointer! */
target -= bytesToWrite; result = targetExhausted; break;
}
switch (bytesToWrite) { /* note: everything falls through. */
case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
case 1: *--target = (UTF8) (ch | firstByteMark[bytesToWrite]);
}
target += bytesToWrite;
}
*sourceStart = source;
*targetStart = target;
return result;
}
/* --------------------------------------------------------------------- */
ConversionResult ConvertUTF8toUTF32 (
const UTF8** sourceStart, const UTF8* sourceEnd,
UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags) {
ConversionResult result = conversionOK;
const UTF8* source = *sourceStart;
UTF32* target = *targetStart;
while (source < sourceEnd) {
UTF32 ch = 0;
unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
if (source + extraBytesToRead >= sourceEnd) {
result = sourceExhausted; break;
}
/* Do this check whether lenient or strict */
if (! isLegalUTF8(source, extraBytesToRead+1)) {
result = sourceIllegal;
break;
}
/*
* The cases all fall through. See "Note A" below.
*/
switch (extraBytesToRead) {
case 5: ch += *source++; ch <<= 6;
case 4: ch += *source++; ch <<= 6;
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 (target >= targetEnd) {
source -= (extraBytesToRead+1); /* Back up the source pointer! */
result = targetExhausted; break;
}
if (ch <= UNI_MAX_LEGAL_UTF32) {
/*
* UTF-16 surrogate values are illegal in UTF-32, and anything
* over Plane 17 (> 0x10FFFF) is illegal.
*/
if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
if (flags == strictConversion) {
source -= (extraBytesToRead+1); /* return to the illegal value itself */
result = sourceIllegal;
break;
} else {
*target++ = UNI_REPLACEMENT_CHAR;
}
} else {
*target++ = ch;
}
} else { /* i.e., ch > UNI_MAX_LEGAL_UTF32 */
result = sourceIllegal;
*target++ = UNI_REPLACEMENT_CHAR;
}
}
*sourceStart = source;
*targetStart = target;
return result;
}
/* ---------------------------------------------------------------------
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.
--------------------------------------------------------------------- */

View File

@ -0,0 +1,149 @@
/*
* 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. Header file.
Several funtions are included here, forming a complete set of
conversions between the three formats. UTF-7 is not included
here, but is handled in a separate source file.
Each of these routines takes pointers to input buffers and output
buffers. The input buffers are const.
Each routine converts the text between *sourceStart and sourceEnd,
putting the result into the buffer between *targetStart and
targetEnd. Note: the end pointers are *after* the last item: e.g.
*(sourceEnd - 1) is the last item.
The return result indicates whether the conversion was successful,
and if not, whether the problem was in the source or target buffers.
(Only the first encountered problem is indicated.)
After the conversion, *sourceStart and *targetStart are both
updated to point to the end of last text successfully converted in
the respective buffers.
Input parameters:
sourceStart - pointer to a pointer to the source buffer.
The contents of this are modified on return so that
it points at the next thing to be converted.
targetStart - similarly, pointer to pointer to the target buffer.
sourceEnd, targetEnd - respectively pointers to the ends of the
two buffers, for overflow checking only.
These conversion functions take a ConversionFlags argument. When this
flag is set to strict, both irregular sequences and isolated surrogates
will cause an error. When the flag is set to lenient, both irregular
sequences and isolated surrogates are converted.
Whether the flag is strict or lenient, all illegal sequences will cause
an error return. This includes sequences such as: <F4 90 80 80>, <C0 80>,
or <A0> in UTF-8, and values above 0x10FFFF in UTF-32. Conformant code
must check for illegal sequences.
When the flag is set to lenient, characters over 0x10FFFF are converted
to the replacement character; otherwise (when the flag is set to strict)
they constitute an error.
Output parameters:
The value "sourceIllegal" is returned from some routines if the input
sequence is malformed. When "sourceIllegal" is returned, the source
value will point to the illegal value that caused the problem. E.g.,
in UTF-8 when a sequence is malformed, it points to the start of the
malformed sequence.
Author: Mark E. Davis, 1994.
Rev History: Rick McGowan, fixes & updates May 2001.
Fixes & updates, Sept 2001.
------------------------------------------------------------------------ */
/* ---------------------------------------------------------------------
The following 4 definitions are compiler-specific.
The C standard does not guarantee that wchar_t has at least
16 bits, so wchar_t is no less portable than unsigned short!
All should be unsigned values to avoid sign extension during
bit mask & shift operations.
------------------------------------------------------------------------ */
typedef unsigned int UTF32; /* at least 32 bits */
typedef unsigned short UTF16; /* at least 16 bits */
typedef unsigned char UTF8; /* typically 8 bits */
typedef unsigned char Boolean; /* 0 or 1 */
/* 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
typedef enum {
conversionOK, /* conversion successful */
sourceExhausted, /* partial character in source, but hit end */
targetExhausted, /* insuff. room in target for conversion */
sourceIllegal /* source sequence is illegal/malformed */
} ConversionResult;
typedef enum {
strictConversion = 0,
lenientConversion
} ConversionFlags;
/* This is for C++ and does no harm in C */
#ifdef __cplusplus
extern "C" {
#endif
ConversionResult ConvertUTF8toUTF16 (
const UTF8** sourceStart, const UTF8* sourceEnd,
UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags);
ConversionResult ConvertUTF16toUTF8 (
const UTF16** sourceStart, const UTF16* sourceEnd,
UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags);
ConversionResult ConvertUTF8toUTF32 (
const UTF8** sourceStart, const UTF8* sourceEnd,
UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags);
ConversionResult ConvertUTF32toUTF8 (
const UTF32** sourceStart, const UTF32* sourceEnd,
UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags);
ConversionResult ConvertUTF16toUTF32 (
const UTF16** sourceStart, const UTF16* sourceEnd,
UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags);
ConversionResult ConvertUTF32toUTF16 (
const UTF32** sourceStart, const UTF32* sourceEnd,
UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags);
Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd);
#ifdef __cplusplus
}
#endif
/* --------------------------------------------------------------------- */

View File

@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2006-2013 Brodie Thiesfield
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,150 @@
simpleini
=========
A cross-platform library that provides a simple API to read and write INI-style configuration files. It supports data files in ASCII, MBCS and Unicode. It is designed explicitly to be portable to any platform and has been tested on Windows, WinCE and Linux. Released as open-source and free using the MIT licence.
# Feature Summary
- MIT Licence allows free use in all software (including GPL and commercial)
- multi-platform (Windows 95/98/ME/NT/2K/XP/2003, Windows CE, Linux, Unix)
- loading and saving of INI-style configuration files
- configuration files can have any newline format on all platforms
- liberal acceptance of file format
* key/values with no section
* removal of whitespace around sections, keys and values
- support for multi-line values (values with embedded newline characters)
- optional support for multiple keys with the same name
- optional case-insensitive sections and keys (for ASCII characters only)
- saves files with sections and keys in the same order as they were loaded
- preserves comments on the file, section and keys where possible.
- supports both char or wchar_t programming interfaces
- supports both MBCS (system locale) and UTF-8 file encodings
- system locale does not need to be UTF-8 on Linux/Unix to load UTF-8 file
- support for non-ASCII characters in section, keys, values and comments
- support for non-standard character types or file encodings via user-written converter classes
- support for adding/modifying values programmatically
- compiles cleanly in the following compilers:
* Windows/VC6 (warning level 3)
* Windows/VC.NET 2003 (warning level 4)
* Windows/VC 2005 (warning level 4)
* Linux/gcc (-Wall)
* Windows/MinGW GCC
# Documentation
Full documentation of the interface is available in doxygen format.
# Examples
These snippets are included with the distribution in the file snippets.cpp.
### SIMPLE USAGE
```c++
CSimpleIniA ini;
ini.SetUnicode();
ini.LoadFile("myfile.ini");
const char * pVal = ini.GetValue("section", "key", "default");
ini.SetValue("section", "key", "newvalue");
```
### LOADING DATA
```c++
// load from a data file
CSimpleIniA ini(a_bIsUtf8, a_bUseMultiKey, a_bUseMultiLine);
SI_Error rc = ini.LoadFile(a_pszFile);
if (rc < 0) return false;
// load from a string
std::string strData;
rc = ini.LoadData(strData.c_str(), strData.size());
if (rc < 0) return false;
```
### GETTING SECTIONS AND KEYS
```c++
// get all sections
CSimpleIniA::TNamesDepend sections;
ini.GetAllSections(sections);
// get all keys in a section
CSimpleIniA::TNamesDepend keys;
ini.GetAllKeys("section-name", keys);
```
### GETTING VALUES
```c++
// get the value of a key
const char * pszValue = ini.GetValue("section-name",
"key-name", NULL /*default*/);
// get the value of a key which may have multiple
// values. If bHasMultipleValues is true, then just
// one value has been returned
bool bHasMultipleValues;
pszValue = ini.GetValue("section-name", "key-name",
NULL /*default*/, &amp;bHasMultipleValues);
// get all values of a key with multiple values
CSimpleIniA::TNamesDepend values;
ini.GetAllValues("section-name", "key-name", values);
// sort the values into the original load order
values.sort(CSimpleIniA::Entry::LoadOrder());
// output all of the items
CSimpleIniA::TNamesDepend::const_iterator i;
for (i = values.begin(); i != values.end(); ++i) {
printf("key-name = '%s'\n", i->pItem);
}
```
### MODIFYING DATA
```c++
// adding a new section
rc = ini.SetValue("new-section", NULL, NULL);
if (rc < 0) return false;
printf("section: %s\n", rc == SI_INSERTED ?
"inserted" : "updated");
// adding a new key ("new-section" will be added
// automatically if it doesn't already exist)
rc = ini.SetValue("new-section", "new-key", "value");
if (rc < 0) return false;
printf("key: %s\n", rc == SI_INSERTED ?
"inserted" : "updated");
// changing the value of a key
rc = ini.SetValue("section", "key", "updated-value");
if (rc < 0) return false;
printf("key: %s\n", rc == SI_INSERTED ?
"inserted" : "updated");
```
### DELETING DATA
```c++
// deleting a key from a section. Optionally the entire
// section may be deleted if it is now empty.
ini.Delete("section-name", "key-name",
true /*delete the section if empty*/);
// deleting an entire section and all keys in it
ini.Delete("section-name", NULL);
```
### SAVING DATA
```c++
// save the data to a string
rc = ini.Save(strData);
if (rc < 0) return false;
// save the data back to the file
rc = ini.SaveFile(a_pszFile);
if (rc < 0) return false;
```

File diff suppressed because it is too large Load Diff

View File

@ -17,7 +17,7 @@ protected:
long style = wxDEFAULT_FRAME_STYLE,
bool is_skip_resize = false)
: wxFrame(parent, id, framename, defposition, defsize, style)
, m_default_info(defsize, defposition)
, m_default_info(std::pair<int, int>(defsize.GetWidth(), defsize.GetHeight()), std::pair<int, int>(defposition.x, defposition.y))
, m_is_skip_resize(is_skip_resize)
{
m_ini.Init(ininame.empty() ? fmt::ToUTF8(framename) : ininame, "GuiSettings");
@ -41,19 +41,19 @@ protected:
void LoadInfo()
{
const WindowInfo& info = m_ini.LoadValue(m_default_info);
SetSize(info.size);
SetPosition(info.position);
SetSize(wxSize(info.size.first, info.size.second));
SetPosition(wxPoint(info.position.first, info.position.second));
}
void OnMove(wxMoveEvent& event)
{
m_ini.SetValue(WindowInfo(m_ini.GetValue().size, GetPosition()));
m_ini.SetValue(WindowInfo(m_ini.GetValue().size, std::pair<int, int>(GetPosition().x, GetPosition().y)));
event.Skip();
}
void OnResize(wxSizeEvent& event)
{
m_ini.SetValue(WindowInfo(GetSize(), m_ini.GetValue().position));
m_ini.SetValue(WindowInfo(std::pair<int, int>(GetSize().GetWidth(), GetSize().GetHeight()), m_ini.GetValue().position));
if(m_is_skip_resize) event.Skip();
}

View File

@ -1,10 +1,30 @@
#include "stdafx.h"
#include "Ini.h"
#ifdef _WIN32
#include <wx/msw/iniconf.h>
#endif
#include <algorithm>
#include <cctype>
#define DEF_CONFIG_NAME "./rpcs3.ini"
CSimpleIniCaseA *getIniFile()
{
static bool inited = false;
static CSimpleIniCaseA ini;
if (inited == false)
{
ini.SetUnicode(true);
ini.LoadFile(DEF_CONFIG_NAME);
inited = true;
}
return &ini;
}
void saveIniFile()
{
getIniFile()->SaveFile(DEF_CONFIG_NAME);
}
std::pair<int, int> rDefaultSize = { -1, -1 };
Inis Ini;
static bool StringToBool(const wxString& str)
@ -29,42 +49,49 @@ static wxString BoolToString(const bool b)
return "false";
}
static wxSize StringToSize(const wxString& str)
//takes a string of format "[number]x[number]" and returns a pair of ints
//example input would be "123x456" and the returned value would be {123,456}
static std::pair<int, int> StringToSize(const std::string& str)
{
wxSize ret;
std::pair<int, int> ret;
wxString s[2] = {wxEmptyString, wxEmptyString};
std::string s[2] = { "", "" };
for(uint i=0, a=0; i<str.Length(); ++i)
for (uint i = 0, a = 0; i<str.size(); ++i)
{
if(!str(i, 1).CmpNoCase("x"))
if (!fmt::CmpNoCase(str.substr(i, 1), "x"))
{
if(++a >= 2) return wxDefaultSize;
if (++a >= 2) return rDefaultSize;
continue;
}
s[a] += str(i, 1);
}
if(s[0].IsEmpty() || s[1].IsEmpty())
{
return wxDefaultSize;
s[a] += str.substr(i, 1);
}
s[0].ToLong((long*)&ret.x);
s[1].ToLong((long*)&ret.y);
if(ret.x <= 0 || ret.y <= 0)
if (s[0].empty() || s[1].empty())
{
return wxDefaultSize;
return rDefaultSize;
}
try{
ret.first = std::stoi(s[0]);
ret.first = std::stoi(s[1]);
}
catch (const std::invalid_argument &e)
{
return rDefaultSize;
}
if (ret.first < 0 || ret.second < 0)
{
return rDefaultSize;
}
return ret;
}
static wxString SizeToString(const wxSize& size)
static std::string SizeToString(const std::pair<int, int>& size)
{
return wxString::Format("%dx%d", size.x, size.y);
return fmt::Format("%dx%d", size.first, size.second);
}
static wxPoint StringToPosition(const wxString& str)
@ -100,39 +127,39 @@ static wxPoint StringToPosition(const wxString& str)
return ret;
}
static wxString PositionToString(const wxPoint& position)
static WindowInfo StringToWindowInfo(const std::string& str)
{
return wxString::Format("%dx%d", position.x, position.y);
}
WindowInfo ret = WindowInfo(rDefaultSize, rDefaultSize);
static WindowInfo StringToWindowInfo(const wxString& str)
{
WindowInfo ret = WindowInfo(wxDefaultSize, wxDefaultPosition);
std::string s[4] = { "", "", "", "" };
wxString s[4] = {wxEmptyString, wxEmptyString, wxEmptyString, wxEmptyString};
for(uint i=0, a=0; i<str.Length(); ++i)
for (uint i = 0, a = 0; i<str.size(); ++i)
{
if(!str(i, 1).CmpNoCase("x") || !str(i, 1).CmpNoCase(":"))
if (!fmt::CmpNoCase(str.substr(i, 1), "x") || !fmt::CmpNoCase(str.substr(i, 1), ":"))
{
if(++a >= 4) return WindowInfo::GetDefault();
if (++a >= 4) return WindowInfo::GetDefault();
continue;
}
s[a] += str(i, 1);
s[a] += str.substr(i, 1);
}
if(s[0].IsEmpty() || s[1].IsEmpty() || s[2].IsEmpty() || s[3].IsEmpty())
if (s[0].empty() || s[1].empty() || s[2].empty() || s[3].empty())
{
return WindowInfo::GetDefault();
}
s[0].ToLong((long*)&ret.size.x);
s[1].ToLong((long*)&ret.size.y);
s[2].ToLong((long*)&ret.position.x);
s[3].ToLong((long*)&ret.position.y);
if(ret.size.x <= 0 || ret.size.y <= 0)
try{
ret.size.first = std::stoi(s[0]);
ret.size.second = std::stoi(s[1]);
ret.position.first = std::stoi(s[2]);
ret.position.second = std::stoi(s[3]);
}
catch (const std::invalid_argument &e)
{
return WindowInfo::GetDefault();
}
if (ret.size.first <= 0 || ret.size.second <= 0)
{
return WindowInfo::GetDefault();
}
@ -140,86 +167,81 @@ static WindowInfo StringToWindowInfo(const wxString& str)
return ret;
}
static wxString WindowInfoToString(const WindowInfo& wind)
static std::string WindowInfoToString(const WindowInfo& wind)
{
const int px = wind.position.x < -wind.size.x ? -1 : wind.position.x;
const int py = wind.position.y < -wind.size.y ? -1 : wind.position.y;
return wxString::Format("%dx%d:%dx%d", wind.size.x, wind.size.y, px, py);
const int px = wind.position.first < -wind.size.first ? -1 : wind.position.first;
const int py = wind.position.second < -wind.size.second ? -1 : wind.position.second;
return fmt::Format("%dx%d:%dx%d", wind.size.first, wind.size.second, px, py);
}
//Ini
Ini::Ini()
{
#ifdef _WIN32
m_Config = new wxIniConfig( wxEmptyString, wxEmptyString,
wxGetCwd() + "/rpcs3.ini",
wxEmptyString, wxCONFIG_USE_LOCAL_FILE );
#else
m_Config = new wxConfig("rpcs3");
#endif
m_Config = getIniFile();
}
Ini::~Ini()
{
safe_delete(m_Config);
saveIniFile();
}
void Ini::Save(const wxString& key, int value)
//TODO: saving the file after each change seems like overkill but that's how wx did it
void Ini::Save(const std::string& section, const std::string& key, int value)
{
m_Config->Write(key, value);
m_Config->SetLongValue(section.c_str(), key.c_str(), value);
saveIniFile();
}
void Ini::Save(const wxString& key, bool value)
void Ini::Save(const std::string& section, const std::string& key, bool value)
{
m_Config->Write(key, BoolToString(value));
m_Config->SetBoolValue(section.c_str(), key.c_str(), value);
saveIniFile();
}
void Ini::Save(const wxString& key, wxSize value)
void Ini::Save(const std::string& section, const std::string& key, std::pair<int, int> value)
{
m_Config->Write(key, SizeToString(value));
m_Config->SetValue(section.c_str(), key.c_str(), SizeToString(value).c_str());
saveIniFile();
}
void Ini::Save(const wxString& key, wxPoint value)
void Ini::Save(const std::string& section, const std::string& key, const std::string& value)
{
m_Config->Write(key, PositionToString(value));
m_Config->SetValue(section.c_str(), key.c_str(), value.c_str());
saveIniFile();
}
void Ini::Save(const wxString& key, const std::string& value)
void Ini::Save(const std::string& section, const std::string& key, WindowInfo value)
{
m_Config->Write(key, fmt::FromUTF8(value));
m_Config->SetValue(section.c_str(), key.c_str(), WindowInfoToString(value).c_str());
saveIniFile();
}
void Ini::Save(const wxString& key, WindowInfo value)
int Ini::Load(const std::string& section, const std::string& key, const int def_value)
{
m_Config->Write(key, WindowInfoToString(value));
return m_Config->GetLongValue(section.c_str(), key.c_str(), def_value);
saveIniFile();
}
int Ini::Load(const wxString& key, const int def_value)
bool Ini::Load(const std::string& section, const std::string& key, const bool def_value)
{
return m_Config->Read(key, def_value);
return StringToBool(m_Config->GetValue(section.c_str(), key.c_str(), BoolToString(def_value).c_str()));
saveIniFile();
}
bool Ini::Load(const wxString& key, const bool def_value)
std::pair<int, int> Ini::Load(const std::string& section, const std::string& key, const std::pair<int, int> def_value)
{
return StringToBool(m_Config->Read(key, BoolToString(def_value)));
return StringToSize(m_Config->GetValue(section.c_str(), key.c_str(), SizeToString(def_value).c_str()));
saveIniFile();
}
wxSize Ini::Load(const wxString& key, const wxSize def_value)
std::string Ini::Load(const std::string& section, const std::string& key, const std::string& def_value)
{
return StringToSize(m_Config->Read(key, SizeToString(def_value)));
return std::string(m_Config->GetValue(section.c_str(), key.c_str(), def_value.c_str()));
saveIniFile();
}
wxPoint Ini::Load(const wxString& key, const wxPoint def_value)
WindowInfo Ini::Load(const std::string& section, const std::string& key, const WindowInfo& def_value)
{
return StringToPosition(m_Config->Read(key, PositionToString(def_value)));
}
std::string Ini::Load(const wxString& key, const std::string& def_value)
{
return fmt::ToUTF8(m_Config->Read(key, def_value));
}
WindowInfo Ini::Load(const wxString& key, const WindowInfo& def_value)
{
return StringToWindowInfo(m_Config->Read(key, WindowInfoToString(def_value)));
return StringToWindowInfo(m_Config->GetValue(section.c_str(), key.c_str(), WindowInfoToString(def_value).c_str()));
saveIniFile();
}

View File

@ -1,21 +1,28 @@
#pragma once
#include <wx/config.h>
#include <utility>
#include "../Utilities/simpleini/SimpleIni.h"
//TODO: make thread safe/remove static singleton
CSimpleIniCaseA *getIniFile();
//TODO: move this to the gui module
struct WindowInfo
{
wxSize size;
wxPoint position;
std::pair<int, int> size;
std::pair<int, int> position;
WindowInfo(const wxSize _size = wxDefaultSize, const wxPoint _position = wxDefaultPosition)
//the (-1,-1) values are currently used because of wxWidgets using it gdicmn.h as default size and default postion
WindowInfo(const std::pair<int, int> _size = { -1, -1 }, const std::pair<int, int> _position = { -1, -1 })
: size(_size)
, position(_position)
{
}
static WindowInfo& GetDefault()
//TODO: remove
static WindowInfo GetDefault()
{
return *new WindowInfo(wxDefaultSize, wxDefaultPosition);
return WindowInfo({ -1, -1 }, { -1, -1 });
}
};
@ -25,38 +32,37 @@ public:
virtual ~Ini();
protected:
wxConfigBase* m_Config;
CSimpleIniCaseA *m_Config;
Ini();
void Save(const wxString& key, int value);
void Save(const wxString& key, bool value);
void Save(const wxString& key, wxSize value);
void Save(const wxString& key, wxPoint value);
void Save(const wxString& key, const std::string& value);
void Save(const wxString& key, WindowInfo value);
void Save(const std::string& section, const std::string& key, int value);
void Save(const std::string& section, const std::string& key, bool value);
void Save(const std::string& section, const std::string& key, std::pair<int, int> value);
void Save(const std::string& section, const std::string& key, const std::string& value);
void Save(const std::string& section, const std::string& key, WindowInfo value);
int Load(const wxString& key, const int def_value);
bool Load(const wxString& key, const bool def_value);
wxSize Load(const wxString& key, const wxSize def_value);
wxPoint Load(const wxString& key, const wxPoint def_value);
std::string Load(const wxString& key, const std::string& def_value);
WindowInfo Load(const wxString& key, const WindowInfo& def_value);
int Load(const std::string& section, const std::string& key, const int def_value);
bool Load(const std::string& section, const std::string& key, const bool def_value);
std::pair<int, int> Load(const std::string& section, const std::string& key, const std::pair<int, int> def_value);
std::string Load(const std::string& section, const std::string& key, const std::string& def_value);
WindowInfo Load(const std::string& section, const std::string& key, const WindowInfo& def_value);
};
template<typename T> struct IniEntry : public Ini
{
T m_value;
std::string m_key;
std::string m_section;
IniEntry() : Ini()
{
}
void Init(const std::string& key, const std::string& path)
void Init(const std::string& section, const std::string& key)
{
m_key = key;
m_Config->SetPath(fmt::FromUTF8(path));
m_section = section;
}
void SetValue(const T& value)
@ -71,22 +77,22 @@ template<typename T> struct IniEntry : public Ini
T LoadValue(const T& defvalue)
{
return Ini::Load(m_key, defvalue);
return Ini::Load(m_section, m_key, defvalue);
}
void SaveValue(const T& value)
{
Ini::Save(m_key, value);
Ini::Save(m_section, m_key, value);
}
void Save()
{
Ini::Save(m_key, m_value);
Ini::Save(m_section, m_key, m_value);
}
T Load(const T& defvalue)
{
return (m_value = Ini::Load(m_key, defvalue));
return (m_value = Ini::Load(m_section, m_key, defvalue));
}
};
@ -151,68 +157,61 @@ public:
{
std::string path;
path = DefPath + "/" + "CPU";
CPUDecoderMode.Init("DecoderMode", path);
CPUIgnoreRWErrors.Init("IgnoreRWErrors", path);
SPUDecoderMode.Init("SPUDecoderMode", path);
path = DefPath;
CPUDecoderMode.Init(path, "CPU_DecoderMode");
CPUIgnoreRWErrors.Init(path, "CPU_IgnoreRWErrors");
SPUDecoderMode.Init(path, "CPU_SPUDecoderMode");
path = DefPath + "/" + "GS";
GSRenderMode.Init("RenderMode", path);
GSResolution.Init("Resolution", path);
GSAspectRatio.Init("AspectRatio", path);
GSVSyncEnable.Init("VSyncEnable", path);
GSLogPrograms.Init("LogPrograms", path);
GSDumpColorBuffers.Init("DumpColorBuffers", path);
GSDumpDepthBuffer.Init("DumpDepthBuffer", path);
SkipPamf.Init("SkipPamf", path);
GSRenderMode.Init(path, "GS_RenderMode");
GSResolution.Init(path, "GS_Resolution");
GSAspectRatio.Init(path, "GS_AspectRatio");
GSVSyncEnable.Init(path, "GS_VSyncEnable");
GSLogPrograms.Init(path, "GS_LogPrograms");
GSDumpColorBuffers.Init(path, "GS_DumpColorBuffers");
GSDumpDepthBuffer.Init(path, "GS_DumpDepthBuffer");
SkipPamf.Init(path, "GS_SkipPamf");
path = DefPath + "/" + "IO";
PadHandlerMode.Init("PadHandlerMode", path);
KeyboardHandlerMode.Init("KeyboardHandlerMode", path);
MouseHandlerMode.Init("MouseHandlerMode", path);
PadHandlerMode.Init(path, "IO_PadHandlerMode");
KeyboardHandlerMode.Init(path, "IO_KeyboardHandlerMode");
MouseHandlerMode.Init(path, "IO_MouseHandlerMode");
path = DefPath + "/" + "ControlSetings";
PadHandlerLStickLeft.Init("PadHandlerLStickLeft", path);
PadHandlerLStickDown.Init("PadHandlerLStickDown", path);
PadHandlerLStickRight.Init("PadHandlerLStickRight", path);
PadHandlerLStickUp.Init("PadHandlerLStickUp", path);
PadHandlerLeft.Init("PadHandlerLeft", path);
PadHandlerDown.Init("PadHandlerDown", path);
PadHandlerRight.Init("PadHandlerRight", path);
PadHandlerUp.Init("PadHandlerUp", path);
PadHandlerStart.Init("PadHandlerStart", path);
PadHandlerR3.Init("PadHandlerR3", path);
PadHandlerL3.Init("PadHandlerL3", path);
PadHandlerSelect.Init("PadHandlerSelect", path);
PadHandlerSquare.Init("PadHandlerSquare", path);
PadHandlerCross.Init("PadHandlerCross", path);
PadHandlerCircle.Init("PadHandlerCircle", path);
PadHandlerTriangle.Init("PadHandlerTriangle", path);
PadHandlerR1.Init("PadHandlerR1", path);
PadHandlerL1.Init("PadHandlerL1", path);
PadHandlerR2.Init("PadHandlerR2", path);
PadHandlerL2.Init("PadHandlerL2", path);
PadHandlerRStickLeft.Init("PadHandlerRStickLeft", path);
PadHandlerRStickDown.Init("PadHandlerRStickDown", path);
PadHandlerRStickRight.Init("PadHandlerRStickRight", path);
PadHandlerRStickUp.Init("PadHandlerRStickUp", path);
PadHandlerLStickLeft.Init(path, "ControlSetings_PadHandlerLStickLeft");
PadHandlerLStickDown.Init(path, "ControlSetings_PadHandlerLStickDown");
PadHandlerLStickRight.Init(path, "ControlSetings_PadHandlerLStickRight");
PadHandlerLStickUp.Init(path, "ControlSetings_PadHandlerLStickUp");
PadHandlerLeft.Init(path, "ControlSetings_PadHandlerLeft");
PadHandlerDown.Init(path, "ControlSetings_PadHandlerDown");
PadHandlerRight.Init(path, "ControlSetings_PadHandlerRight");
PadHandlerUp.Init(path, "ControlSetings_PadHandlerUp");
PadHandlerStart.Init(path, "ControlSetings_PadHandlerStart");
PadHandlerR3.Init(path, "ControlSetings_PadHandlerR3");
PadHandlerL3.Init(path, "ControlSetings_PadHandlerL3");
PadHandlerSelect.Init(path, "ControlSetings_PadHandlerSelect");
PadHandlerSquare.Init(path, "ControlSetings_PadHandlerSquare");
PadHandlerCross.Init(path, "ControlSetings_PadHandlerCross");
PadHandlerCircle.Init(path, "ControlSetings_PadHandlerCircle");
PadHandlerTriangle.Init(path, "ControlSetings_PadHandlerTriangle");
PadHandlerR1.Init(path, "ControlSetings_PadHandlerR1");
PadHandlerL1.Init(path, "ControlSetings_PadHandlerL1");
PadHandlerR2.Init(path, "ControlSetings_PadHandlerR2");
PadHandlerL2.Init(path, "ControlSetings_PadHandlerL2");
PadHandlerRStickLeft.Init(path, "ControlSetings_PadHandlerRStickLeft");
PadHandlerRStickDown.Init(path, "ControlSetings_PadHandlerRStickDown");
PadHandlerRStickRight.Init(path, "ControlSetings_PadHandlerRStickRight");
PadHandlerRStickUp.Init(path, "ControlSetings_PadHandlerRStickUp");
AudioOutMode.Init(path, "Audio_AudioOutMode");
AudioDumpToFile.Init(path, "Audio_AudioDumpToFile");
AudioConvertToU16.Init(path, "Audio_AudioConvertToU16");
path = DefPath + "/" + "Audio";
AudioOutMode.Init("AudioOutMode", path);
AudioDumpToFile.Init("AudioDumpToFile", path);
AudioConvertToU16.Init("AudioConvertToU16", path);
HLELogging.Init(path, "HLE_HLELogging");
HLEHookStFunc.Init(path, "HLE_HLEHookStFunc");
HLESaveTTY.Init(path, "HLE_HLESaveTTY");
HLEExitOnStop.Init(path, "HLE_HLEExitOnStop");
HLELogLvl.Init(path, "HLE_HLELogLvl");
HLEHideDebugConsole.Init(path, "HLE_HLEHideDebugConsole");
path = DefPath + "/" + "HLE";
HLELogging.Init("HLELogging", path);
HLEHookStFunc.Init("HLEHookStFunc", path);
HLESaveTTY.Init("HLESaveTTY", path);
HLEExitOnStop.Init("HLEExitOnStop", path);
HLELogLvl.Init("HLELogLvl", path);
HLEHideDebugConsole.Init("HLEHideDebugConsole", path);
path = DefPath + "/" + "System";
SysLanguage.Init("SysLanguage", path);
SysLanguage.Init(path, "Sytem_SysLanguage");
}
void Load()