SimpleIni removed

This commit is contained in:
O1L 2015-11-15 13:05:25 +04:00
parent fd13a495de
commit f34bd724e3
11 changed files with 0 additions and 4962 deletions

View File

@ -1,539 +0,0 @@
/*
* 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

@ -1,151 +0,0 @@
#pragma once
/*
* 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

@ -1,20 +0,0 @@
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

@ -1,150 +0,0 @@
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

@ -142,7 +142,6 @@ GLOB_RECURSE
RPCS3_SRC
"${RPCS3_SRC_DIR}/rpcs3.cpp"
"${RPCS3_SRC_DIR}/config.cpp"
"${RPCS3_SRC_DIR}/Ini.cpp"
"${RPCS3_SRC_DIR}/../Utilities/GNU.cpp"
"${RPCS3_SRC_DIR}/Emu/*"
"${RPCS3_SRC_DIR}/Gui/*"
@ -151,8 +150,6 @@ RPCS3_SRC
"${RPCS3_SRC_DIR}/../Utilities/*"
)
list(REMOVE_ITEM RPCS3_SRC ${RPCS3_SRC_DIR}/../Utilities/simpleini/ConvertUTF.c)
add_executable(rpcs3 ${RPCS3_SRC})
if(NOT MSVC)

View File

@ -1,5 +1,4 @@
#pragma once
#include "rpcs3/Ini.h"
#include "Emu/state.h"
class FrameBase : public wxFrame

View File

@ -1,182 +0,0 @@
#include "stdafx.h"
#include "Utilities/rPlatform.h"
#include "Utilities/simpleini/SimpleIni.h"
#include "Ini.h"
#include <cctype>
#include <regex>
#define DEF_CONFIG_NAME "./rpcs3.ini"
//TODO: make thread safe/remove static singleton
CSimpleIniCaseA *getIniFile()
{
static bool inited = false;
static CSimpleIniCaseA ini;
if (inited == false)
{
ini.SetUnicode(true);
ini.LoadFile(std::string(rPlatform::getConfigDir() + DEF_CONFIG_NAME).c_str());
inited = true;
}
return &ini;
}
void saveIniFile()
{
getIniFile()->SaveFile(std::string(rPlatform::getConfigDir() + DEF_CONFIG_NAME).c_str());
}
Inis Ini;
static bool StringToBool(const std::string& str)
{
return std::regex_match(str.begin(), str.end(),
std::regex("1|e|t|enable|true", std::regex_constants::icase));
}
static inline std::string BoolToString(const bool b)
{
return b ? "true" : "false";
}
//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)
{
std::size_t start = 0, found;
std::vector<int> vec;
for (int i = 0; i < 2 && (found = str.find_first_of('x', start)); i++)
{
try
{
vec.push_back(std::stoi(str.substr(start, found == std::string::npos ? found : found - start)));
}
catch (const std::invalid_argument& e)
{
return std::make_pair(-1, -1);
}
if (found == std::string::npos)
break;
start = found + 1;
}
if (vec.size() < 2 || vec[0] < 0 || vec[1] < 0)
{
return std::make_pair(-1, -1);
}
return std::make_pair(vec[0], vec[1]);
}
static std::string SizeToString(const std::pair<int, int>& size)
{
return fmt::format("%dx%d", size.first, size.second);
}
static WindowInfo StringToWindowInfo(const std::string& str)
{
std::size_t start = 0, found;
std::vector<int> vec;
for (int i = 0; i < 4 && (found = str.find_first_of("x:", start)); i++) {
try {
vec.push_back(std::stoi(str.substr(start, found == std::string::npos ? found : found - start)));
}
catch (const std::invalid_argument& e) {
return WindowInfo();
}
if (found == std::string::npos)
break;
start = found + 1;
}
if (vec.size() < 4 || vec[0] <= 0 || vec[1] <= 0 || vec[2] < 0 || vec[3] < 0)
return WindowInfo();
return WindowInfo(std::make_pair(vec[0], vec[1]), std::make_pair(vec[2], vec[3]));
}
static std::string WindowInfoToString(const WindowInfo& wind)
{
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()
{
m_config = getIniFile();
}
Ini::~Ini()
{
saveIniFile();
}
//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)
{
static_cast<CSimpleIniCaseA*>(m_config)->SetLongValue(section.c_str(), key.c_str(), value);
saveIniFile();
}
void Ini::Save(const std::string& section, const std::string& key, unsigned int value)
{
static_cast<CSimpleIniCaseA*>(m_config)->SetLongValue(section.c_str(), key.c_str(), value);
saveIniFile();
}
void Ini::Save(const std::string& section, const std::string& key, bool value)
{
static_cast<CSimpleIniCaseA*>(m_config)->SetBoolValue(section.c_str(), key.c_str(), value);
saveIniFile();
}
void Ini::Save(const std::string& section, const std::string& key, std::pair<int, int> value)
{
static_cast<CSimpleIniCaseA*>(m_config)->SetValue(section.c_str(), key.c_str(), SizeToString(value).c_str());
saveIniFile();
}
void Ini::Save(const std::string& section, const std::string& key, const std::string& value)
{
static_cast<CSimpleIniCaseA*>(m_config)->SetValue(section.c_str(), key.c_str(), value.c_str());
saveIniFile();
}
void Ini::Save(const std::string& section, const std::string& key, WindowInfo value)
{
static_cast<CSimpleIniCaseA*>(m_config)->SetValue(section.c_str(), key.c_str(), WindowInfoToString(value).c_str());
saveIniFile();
}
int Ini::Load(const std::string& section, const std::string& key, const int def_value)
{
return static_cast<CSimpleIniCaseA*>(m_config)->GetLongValue(section.c_str(), key.c_str(), def_value);
}
unsigned int Ini::Load(const std::string& section, const std::string& key, const unsigned int def_value)
{
return static_cast<CSimpleIniCaseA*>(m_config)->GetLongValue(section.c_str(), key.c_str(), def_value);
}
bool Ini::Load(const std::string& section, const std::string& key, const bool def_value)
{
return StringToBool(static_cast<CSimpleIniCaseA*>(m_config)->GetValue(section.c_str(), key.c_str(), BoolToString(def_value).c_str()));
}
std::pair<int, int> Ini::Load(const std::string& section, const std::string& key, const std::pair<int, int> def_value)
{
return StringToSize(static_cast<CSimpleIniCaseA*>(m_config)->GetValue(section.c_str(), key.c_str(), SizeToString(def_value).c_str()));
}
std::string Ini::Load(const std::string& section, const std::string& key, const std::string& def_value)
{
return std::string(static_cast<CSimpleIniCaseA*>(m_config)->GetValue(section.c_str(), key.c_str(), def_value.c_str()));
}
WindowInfo Ini::Load(const std::string& section, const std::string& key, const WindowInfo& def_value)
{
return StringToWindowInfo(static_cast<CSimpleIniCaseA*>(m_config)->GetValue(section.c_str(), key.c_str(), WindowInfoToString(def_value).c_str()));
}

View File

@ -1,512 +0,0 @@
#pragma once
//TODO: move this to the gui module
struct WindowInfo
{
std::pair<int, int> size;
std::pair<int, int> position;
//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)
{
}
};
class Ini
{
public:
virtual ~Ini();
protected:
void* m_config;
Ini();
void Save(const std::string& section, const std::string& key, int value);
void Save(const std::string& section, const std::string& key, unsigned 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 std::string& section, const std::string& key, const int def_value);
unsigned int Load(const std::string& section, const std::string& key, const unsigned 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& section)
{
m_key = key;
m_section = section;
}
void SetValue(const T& value)
{
m_value = value;
}
T GetValue() const
{
return m_value;
}
T LoadValue(const T& defvalue)
{
return Ini::Load(m_section, m_key, defvalue);
}
void SaveValue(const T& value)
{
Ini::Save(m_section, m_key, value);
}
void Save()
{
Ini::Save(m_section, m_key, m_value);
}
T Load(const T& defvalue)
{
return (m_value = Ini::Load(m_section, m_key, defvalue));
}
};
class Inis
{
private:
const std::string DefPath;
public:
// Core
IniEntry<u8> CPUDecoderMode;
IniEntry<bool> LLVMExclusionRange;
IniEntry<u32> LLVMMinId;
IniEntry<u32> LLVMMaxId;
IniEntry<u32> LLVMThreshold;
IniEntry<u8> SPUDecoderMode;
IniEntry<bool> HookStFunc;
IniEntry<bool> LoadLibLv2;
// Graphics
IniEntry<u8> GSRenderMode;
IniEntry<u8> GSD3DAdaptater;
IniEntry<u8> GSResolution;
IniEntry<u8> GSAspectRatio;
IniEntry<u8> GSFrameLimit;
IniEntry<bool> GSLogPrograms;
IniEntry<bool> GSVSyncEnable;
IniEntry<bool> GS3DTV;
IniEntry<bool> GSDebugOutputEnable;
IniEntry<bool> GSOverlay;
// Audio
IniEntry<u8> AudioOutMode;
IniEntry<bool> AudioDumpToFile;
IniEntry<bool> AudioConvertToU16;
// Camera
IniEntry<u8> Camera;
IniEntry<u8> CameraType;
// Input/Output
IniEntry<u8> PadHandlerMode;
IniEntry<u8> KeyboardHandlerMode;
IniEntry<u8> MouseHandlerMode;
IniEntry<int> PadHandlerLStickLeft;
IniEntry<int> PadHandlerLStickDown;
IniEntry<int> PadHandlerLStickRight;
IniEntry<int> PadHandlerLStickUp;
IniEntry<int> PadHandlerLeft;
IniEntry<int> PadHandlerDown;
IniEntry<int> PadHandlerRight;
IniEntry<int> PadHandlerUp;
IniEntry<int> PadHandlerStart;
IniEntry<int> PadHandlerR3;
IniEntry<int> PadHandlerL3;
IniEntry<int> PadHandlerSelect;
IniEntry<int> PadHandlerSquare;
IniEntry<int> PadHandlerCross;
IniEntry<int> PadHandlerCircle;
IniEntry<int> PadHandlerTriangle;
IniEntry<int> PadHandlerR1;
IniEntry<int> PadHandlerL1;
IniEntry<int> PadHandlerR2;
IniEntry<int> PadHandlerL2;
IniEntry<int> PadHandlerRStickLeft;
IniEntry<int> PadHandlerRStickDown;
IniEntry<int> PadHandlerRStickRight;
IniEntry<int> PadHandlerRStickUp;
// HLE/Miscs
IniEntry<u8> HLELogLvl;
IniEntry<u8> NETStatus;
IniEntry<u8> NETInterface;
IniEntry<bool> HLELogging;
IniEntry<bool> RSXLogging;
IniEntry<bool> HLESaveTTY;
IniEntry<bool> HLEExitOnStop;
IniEntry<bool> HLEAlwaysStart;
IniEntry<bool> UseDefaultIni;
// Auto Pause
IniEntry<bool> DBGAutoPauseSystemCall;
IniEntry<bool> DBGAutoPauseFunctionCall;
// Custom EmulationDir
IniEntry<std::string> SysEmulationDirPath;
IniEntry<bool> SysEmulationDirPathEnable;
// Language
IniEntry<u8> SysLanguage;
public:
Inis() : DefPath("EmuSettings")
{
std::string path;
path = DefPath;
// Core
CPUDecoderMode.Init("CORE_DecoderMode", path);
LLVMExclusionRange.Init("LLVM_Exclusion_Range", path);
LLVMMinId.Init("LLVM_Min_ID", path);
LLVMMaxId.Init("LLVM_Max_ID", path);
LLVMThreshold.Init("LLVM_Threshold", path);
SPUDecoderMode.Init("CORE_SPUDecoderMode", path);
HookStFunc.Init("CORE_HookStFunc", path);
LoadLibLv2.Init("CORE_LoadLibLv2", path);
// Graphics
GSRenderMode.Init("GS_RenderMode", path);
GSD3DAdaptater.Init("GS_D3DAdaptater", path);
GSResolution.Init("GS_Resolution", path);
GSAspectRatio.Init("GS_AspectRatio", path);
GSFrameLimit.Init("GS_FrameLimit", path);
GSLogPrograms.Init("GS_LogPrograms", path);
GSVSyncEnable.Init("GS_VSyncEnable", path);
GSDebugOutputEnable.Init("GS_DebugOutputEnable", path);
GS3DTV.Init("GS_3DTV", path);
GSOverlay.Init("GS_Overlay", path);
// Audio
AudioOutMode.Init("Audio_OutMode", path);
AudioDumpToFile.Init("Audio_DumpToFile", path);
AudioConvertToU16.Init("Audio_ConvertToU16", path);
// Camera
Camera.Init("Camera", path);
CameraType.Init("Camera_Type", path);
// Input/Output
PadHandlerMode.Init("IO_PadHandlerMode", path);
KeyboardHandlerMode.Init("IO_KeyboardHandlerMode", path);
MouseHandlerMode.Init("IO_MouseHandlerMode", path);
PadHandlerLStickLeft.Init("ControlSetings_PadHandlerLStickLeft", path);
PadHandlerLStickDown.Init("ControlSetings_PadHandlerLStickDown", path);
PadHandlerLStickRight.Init("ControlSetings_PadHandlerLStickRight", path);
PadHandlerLStickUp.Init("ControlSetings_PadHandlerLStickUp", path);
PadHandlerLeft.Init("ControlSetings_PadHandlerLeft", path);
PadHandlerDown.Init("ControlSetings_PadHandlerDown", path);
PadHandlerRight.Init("ControlSetings_PadHandlerRight", path);
PadHandlerUp.Init("ControlSetings_PadHandlerUp", path);
PadHandlerStart.Init("ControlSetings_PadHandlerStart", path);
PadHandlerR3.Init("ControlSetings_PadHandlerR3", path);
PadHandlerL3.Init("ControlSetings_PadHandlerL3", path);
PadHandlerSelect.Init("ControlSetings_PadHandlerSelect", path);
PadHandlerSquare.Init("ControlSetings_PadHandlerSquare", path);
PadHandlerCross.Init("ControlSetings_PadHandlerCross", path);
PadHandlerCircle.Init("ControlSetings_PadHandlerCircle", path);
PadHandlerTriangle.Init("ControlSetings_PadHandlerTriangle", path);
PadHandlerR1.Init("ControlSetings_PadHandlerR1", path);
PadHandlerL1.Init("ControlSetings_PadHandlerL1", path);
PadHandlerR2.Init("ControlSetings_PadHandlerR2", path);
PadHandlerL2.Init("ControlSetings_PadHandlerL2", path);
PadHandlerRStickLeft.Init("ControlSetings_PadHandlerRStickLeft", path);
PadHandlerRStickDown.Init("ControlSetings_PadHandlerRStickDown", path);
PadHandlerRStickRight.Init("ControlSetings_PadHandlerRStickRight", path);
PadHandlerRStickUp.Init("ControlSetings_PadHandlerRStickUp", path);
// Miscellaneous
HLELogging.Init("HLE_HLELogging", path);
RSXLogging.Init("RSX_Logging", path);
NETStatus.Init("NET_Status", path);
NETInterface.Init("NET_Interface", path);
HLESaveTTY.Init("HLE_HLESaveTTY", path);
HLEExitOnStop.Init("HLE_HLEExitOnStop", path);
HLELogLvl.Init("HLE_HLELogLvl", path);
HLEAlwaysStart.Init("HLE_HLEAlwaysStart", path);
UseDefaultIni.Init("HLE_UseDefaultIni", path);
// Auto Pause
DBGAutoPauseFunctionCall.Init("DBG_AutoPauseFunctionCall", path);
DBGAutoPauseSystemCall.Init("DBG_AutoPauseSystemCall", path);
// Customed EmulationDir
SysEmulationDirPath.Init("System_EmulationDir", path);
SysEmulationDirPathEnable.Init("System_EmulationDirEnable", path);
// Language
SysLanguage.Init("Sytem_SysLanguage", path);
}
void Load()
{
// Core
CPUDecoderMode.Load(0);
LLVMExclusionRange.Load(false);
LLVMMinId.Load(200);
LLVMMaxId.Load(250);
LLVMThreshold.Load(1000);
SPUDecoderMode.Load(0);
HookStFunc.Load(false);
LoadLibLv2.Load(false);
// Graphics
GSRenderMode.Load(1);
GSD3DAdaptater.Load(1);
GSResolution.Load(4);
GSAspectRatio.Load(2);
GSFrameLimit.Load(0);
GSLogPrograms.Load(false);
GSVSyncEnable.Load(false);
GSDebugOutputEnable.Load(false);
GS3DTV.Load(false);
GSOverlay.Load(false);
// Audio
AudioOutMode.Load(1);
AudioDumpToFile.Load(false);
AudioConvertToU16.Load(false);
// Camera
Camera.Load(1);
CameraType.Load(2);
// Input/Ouput
PadHandlerMode.Load(1);
KeyboardHandlerMode.Load(0);
MouseHandlerMode.Load(0);
PadHandlerLStickLeft.Load(314); //WXK_LEFT
PadHandlerLStickDown.Load(317); //WXK_DOWN
PadHandlerLStickRight.Load(316); //WXK_RIGHT
PadHandlerLStickUp.Load(315); //WXK_UP
PadHandlerLeft.Load(static_cast<int>('A'));
PadHandlerDown.Load(static_cast<int>('S'));
PadHandlerRight.Load(static_cast<int>('D'));
PadHandlerUp.Load(static_cast<int>('W'));
PadHandlerStart.Load(13); //WXK_RETURN
PadHandlerR3.Load(static_cast<int>('C'));
PadHandlerL3.Load(static_cast<int>('Z'));
PadHandlerSelect.Load(32); //WXK_SPACE
PadHandlerSquare.Load(static_cast<int>('J'));
PadHandlerCross.Load(static_cast<int>('K'));
PadHandlerCircle.Load(static_cast<int>('L'));
PadHandlerTriangle.Load(static_cast<int>('I'));
PadHandlerR1.Load(static_cast<int>('3'));
PadHandlerL1.Load(static_cast<int>('1'));
PadHandlerR2.Load(static_cast<int>('E'));
PadHandlerL2.Load(static_cast<int>('Q'));
PadHandlerRStickLeft.Load(313); //WXK_HOME
PadHandlerRStickDown.Load(367); //WXK_PAGEDOWN
PadHandlerRStickRight.Load(312); //WXK_END
PadHandlerRStickUp.Load(366); //WXK_PAGEUP
// Miscellaneous
HLELogging.Load(false);
RSXLogging.Load(false);
NETStatus.Load(0);
NETInterface.Load(0);
HLESaveTTY.Load(false);
HLEExitOnStop.Load(false);
HLELogLvl.Load(3);
HLEAlwaysStart.Load(true);
UseDefaultIni.Load(false);
//Auto Pause
DBGAutoPauseFunctionCall.Load(false);
DBGAutoPauseSystemCall.Load(false);
// Language
SysLanguage.Load(1);
// Customed EmulationDir
SysEmulationDirPath.Load("");
SysEmulationDirPathEnable.Load(false);
}
void Save()
{
// Core
CPUDecoderMode.Save();
LLVMExclusionRange.Save();
LLVMMinId.Save();
LLVMMaxId.Save();
LLVMThreshold.Save();
SPUDecoderMode.Save();
HookStFunc.Save();
LoadLibLv2.Save();
// Graphics
GSRenderMode.Save();
GSD3DAdaptater.Save();
GSResolution.Save();
GSAspectRatio.Save();
GSFrameLimit.Save();
GSLogPrograms.Save();
GSVSyncEnable.Save();
GSDebugOutputEnable.Save();
GS3DTV.Save();
GSOverlay.Save();
// Audio
AudioOutMode.Save();
AudioDumpToFile.Save();
AudioConvertToU16.Save();
// Camera
Camera.Save();
CameraType.Save();
// Input/Output
PadHandlerMode.Save();
KeyboardHandlerMode.Save();
MouseHandlerMode.Save();
PadHandlerLStickLeft.Save();
PadHandlerLStickDown.Save();
PadHandlerLStickRight.Save();
PadHandlerLStickUp.Save();
PadHandlerLeft.Save();
PadHandlerDown.Save();
PadHandlerRight.Save();
PadHandlerUp.Save();
PadHandlerStart.Save();
PadHandlerR3.Save();
PadHandlerL3.Save();
PadHandlerSelect.Save();
PadHandlerSquare.Save();
PadHandlerCross.Save();
PadHandlerCircle.Save();
PadHandlerTriangle.Save();
PadHandlerR1.Save();
PadHandlerL1.Save();
PadHandlerR2.Save();
PadHandlerL2.Save();
PadHandlerRStickLeft.Save();
PadHandlerRStickDown.Save();
PadHandlerRStickRight.Save();
PadHandlerRStickUp.Save();
// Miscellaneous
HLELogging.Save();
RSXLogging.Save();
NETStatus.Save();
NETInterface.Save();
HLESaveTTY.Save();
HLEExitOnStop.Save();
HLELogLvl.Save();
HLEAlwaysStart.Save();
UseDefaultIni.Save();
//Auto Pause
DBGAutoPauseFunctionCall.Save();
DBGAutoPauseSystemCall.Save();
// Language
SysLanguage.Save();
// Customed EmulationDir
SysEmulationDirPath.Save();
SysEmulationDirPathEnable.Save();
}
// For getting strings for certain options to display settings in the log.
inline static const char* CPUIdToString(u8 code)
{
switch (code)
{
case 0: return "PPU Interpreter";
case 1: return "PPU Interpreter 2";
case 2: return "PPU JIT (LLVM)";
default: return "Unknown";
}
}
inline static const char* SPUIdToString(u8 code)
{
switch (code)
{
case 0: return "SPU Interpreter (precise)";
case 1: return "SPU Interpreter (fast)";
case 2: return "SPU Recompiler (ASMJIT)";
default: return "Unknown";
}
}
inline static const char* RendererIdToString(u8 code)
{
switch (code)
{
case 0: return "Null";
case 1: return "OpenGL";
case 2: return "DirectX 12";
default: return "Unknown";
}
}
inline static const char* AdapterIdToString(u8 code)
{
switch (code)
{
case 0: return "WARP";
case 1: return "Default";
case 2: return "Renderer 0";
case 3: return "Renderer 1";
case 4: return "Renderer 2";
default: return "Unknown";
}
}
inline static const char* AudioOutIdToString(u8 code)
{
switch (code)
{
case 0: return "Null";
case 1: return "OpenAL";
case 2: return "XAudio2";
default: return "Unknown";
}
}
inline static const char* ResolutionIdToString(u32 id)
{
switch (id)
{
case 1: return "1920x1080";
case 2: return "1280x720";
case 4: return "720x480";
case 5: return "720x576";
case 10: return "1600x1080";
case 11: return "1440x1080";
case 12: return "1280x1080";
case 13: return "960x1080";
default: return "Unknown";
}
}
};
extern Inis Ini;

View File

@ -321,7 +321,6 @@
<ClCompile Include="Emu\SysCalls\Modules\sys_spu_.cpp" />
<ClCompile Include="Emu\SysCalls\SysCalls.cpp" />
<ClCompile Include="Emu\System.cpp" />
<ClCompile Include="Ini.cpp" />
<ClCompile Include="Loader\ELF32.cpp" />
<ClCompile Include="Loader\ELF64.cpp" />
<ClCompile Include="Loader\Loader.cpp" />
@ -359,8 +358,6 @@
<ClInclude Include="..\Utilities\rXml.h" />
<ClInclude Include="..\Utilities\Semaphore.h" />
<ClInclude Include="..\Utilities\SharedMutex.h" />
<ClInclude Include="..\Utilities\simpleini\ConvertUTF.h" />
<ClInclude Include="..\Utilities\simpleini\SimpleIni.h" />
<ClInclude Include="..\Utilities\SleepQueue.h" />
<ClInclude Include="..\Utilities\StrFmt.h" />
<ClInclude Include="..\Utilities\Thread.h" />
@ -630,7 +627,6 @@
<ClInclude Include="Emu\SysCalls\SC_FUNC.h" />
<ClInclude Include="Emu\SysCalls\SysCalls.h" />
<ClInclude Include="Emu\System.h" />
<ClInclude Include="Ini.h" />
<ClInclude Include="Loader\ELF32.h" />
<ClInclude Include="Loader\ELF64.h" />
<ClInclude Include="Loader\Loader.h" />

View File

@ -51,9 +51,6 @@
<Filter Include="Utilities">
<UniqueIdentifier>{be701b55-2a3d-4692-a3bf-347681ab1c7e}</UniqueIdentifier>
</Filter>
<Filter Include="Utilities\SimpleIni">
<UniqueIdentifier>{84c34dd1-4c49-4ecf-8ee2-4165c14f24be}</UniqueIdentifier>
</Filter>
<Filter Include="Emu\Io\Null">
<UniqueIdentifier>{fcac6852-b45f-4cf2-afee-cf56bcea14e5}</UniqueIdentifier>
</Filter>
@ -512,9 +509,6 @@
<ClCompile Include="Emu\SysCalls\LogBase.cpp">
<Filter>Emu\SysCalls</Filter>
</ClCompile>
<ClCompile Include="Ini.cpp">
<Filter>Utilities</Filter>
</ClCompile>
<ClCompile Include="..\Utilities\rMsgBox.cpp">
<Filter>Utilities</Filter>
</ClCompile>
@ -1334,12 +1328,6 @@
<ClInclude Include="Emu\SysCalls\ModuleManager.h">
<Filter>Emu\SysCalls</Filter>
</ClInclude>
<ClInclude Include="..\Utilities\simpleini\ConvertUTF.h">
<Filter>Utilities\SimpleIni</Filter>
</ClInclude>
<ClInclude Include="..\Utilities\simpleini\SimpleIni.h">
<Filter>Utilities\SimpleIni</Filter>
</ClInclude>
<ClInclude Include="Emu\DbgCommand.h">
<Filter>Emu</Filter>
</ClInclude>
@ -1472,9 +1460,6 @@
<ClInclude Include="Emu\IdManager.h">
<Filter>Emu</Filter>
</ClInclude>
<ClInclude Include="Ini.h">
<Filter>Utilities</Filter>
</ClInclude>
<ClInclude Include="Emu\Io\Null\NullPadHandler.h">
<Filter>Emu\Io\Null</Filter>
</ClInclude>