mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Merge ext/native/stringutil.cpp/h into Common/StringUtils.cpp/h.
This commit is contained in:
parent
656adf1fcd
commit
ed88761ecc
83 changed files with 381 additions and 399 deletions
|
@ -946,9 +946,6 @@ add_library(native STATIC
|
|||
ext/native/base/colorutil.h
|
||||
ext/native/base/display.cpp
|
||||
ext/native/base/display.h
|
||||
ext/native/base/linked_ptr.h
|
||||
ext/native/base/stringutil.cpp
|
||||
ext/native/base/stringutil.h
|
||||
ext/native/data/base64.cpp
|
||||
ext/native/data/base64.h
|
||||
ext/native/data/compression.cpp
|
||||
|
|
|
@ -34,8 +34,9 @@
|
|||
#include "ppsspp_config.h"
|
||||
#include "thread/threadutil.h"
|
||||
#include "util/text/utf8.h"
|
||||
#include "Common.h"
|
||||
#include "ConsoleListener.h" // Common
|
||||
#include "Common/Common.h"
|
||||
#include "Common/ConsoleListener.h"
|
||||
#include "Common/StringUtils.h"
|
||||
|
||||
#if defined(USING_WIN_UI)
|
||||
const int LOG_PENDING_MAX = 120 * 10000;
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include "CommonWindows.h"
|
||||
#endif
|
||||
|
||||
#include "base/stringutil.h"
|
||||
#include "base/NativeApp.h"
|
||||
#include "file/ini_file.h"
|
||||
#include "input/input_state.h"
|
||||
|
@ -32,6 +31,7 @@
|
|||
|
||||
#include "Common/Log.h"
|
||||
#include "Common/KeyMap.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Core/HLE/sceUtility.h"
|
||||
#include "Core/Config.h"
|
||||
|
||||
|
|
|
@ -43,16 +43,16 @@ const char *GetLastErrorMsg()
|
|||
const char *GetStringErrorMsg(int errCode) {
|
||||
static const size_t buff_size = 1023;
|
||||
#ifdef _WIN32
|
||||
static __THREAD wchar_t err_strw[buff_size] = {};
|
||||
static thread_local wchar_t err_strw[buff_size] = {};
|
||||
|
||||
FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, errCode,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
err_strw, buff_size, NULL);
|
||||
|
||||
static __THREAD char err_str[buff_size] = {};
|
||||
static thread_local char err_str[buff_size] = {};
|
||||
snprintf(err_str, buff_size, "%s", ConvertWStringToUTF8(err_strw).c_str());
|
||||
#else
|
||||
static __thread char err_str[buff_size] = {};
|
||||
static thread_local char err_str[buff_size] = {};
|
||||
|
||||
// Thread safe (XSI-compliant)
|
||||
if (strerror_r(errCode, err_str, buff_size) == 0) {
|
||||
|
|
|
@ -16,6 +16,33 @@
|
|||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "ppsspp_config.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#undef min
|
||||
#undef max
|
||||
#endif
|
||||
|
||||
#if PPSSPP_PLATFORM(SWITCH)
|
||||
#define _GNU_SOURCE
|
||||
#include <cstdio>
|
||||
#endif
|
||||
|
||||
#include <cstdarg>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <limits.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <iomanip>
|
||||
|
||||
#include "base/buffer.h"
|
||||
|
||||
#include "Common.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
|
@ -114,3 +141,179 @@ std::string GetFilenameFromPath(std::string full_path) {
|
|||
// No directory components, just return the full path.
|
||||
return full_path;
|
||||
}
|
||||
|
||||
std::string LineNumberString(const std::string &str) {
|
||||
std::stringstream input(str);
|
||||
std::stringstream output;
|
||||
std::string line;
|
||||
|
||||
int lineNumber = 1;
|
||||
while (std::getline(input, line)) {
|
||||
output << std::setw(4) << lineNumber++ << ": " << line << std::endl;
|
||||
}
|
||||
|
||||
return output.str();
|
||||
}
|
||||
|
||||
void SkipSpace(const char **ptr) {
|
||||
while (**ptr && isspace(**ptr)) {
|
||||
(*ptr)++;
|
||||
}
|
||||
}
|
||||
|
||||
void DataToHexString(const uint8_t *data, size_t size, std::string *output) {
|
||||
Buffer buffer;
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
if (i && !(i & 15))
|
||||
buffer.Printf("\n");
|
||||
buffer.Printf("%02x ", data[i]);
|
||||
}
|
||||
buffer.TakeAll(output);
|
||||
}
|
||||
|
||||
void DataToHexString(const char* prefix, uint32_t startAddr, const uint8_t* data, size_t size, std::string* output) {
|
||||
Buffer buffer;
|
||||
size_t i = 0;
|
||||
for (; i < size; i++) {
|
||||
if (i && !(i & 15)) {
|
||||
buffer.Printf(" ");
|
||||
for (size_t j = i - 16; j < i; j++) {
|
||||
buffer.Printf("%c", ((data[j] < 0x20) || (data[j] > 0x7e)) ? 0x2e : data[j]);
|
||||
}
|
||||
buffer.Printf("\n");
|
||||
}
|
||||
if (!(i & 15))
|
||||
buffer.Printf("%s%08x ", prefix, startAddr + i);
|
||||
buffer.Printf("%02x ", data[i]);
|
||||
}
|
||||
if (size & 15) {
|
||||
size_t padded_size = ((size - 1) | 15) + 1;
|
||||
for (size_t j = size; j < padded_size; j++) {
|
||||
buffer.Printf(" ");
|
||||
}
|
||||
buffer.Printf(" ");
|
||||
for (size_t j = size & ~UINT64_C(0xF); j < size; j++) {
|
||||
buffer.Printf("%c", ((data[j] < 0x20) || (data[j] > 0x7e)) ? 0x2e : data[j]);
|
||||
}
|
||||
}
|
||||
buffer.TakeAll(output);
|
||||
}
|
||||
|
||||
std::string StringFromFormat(const char* format, ...)
|
||||
{
|
||||
va_list args;
|
||||
std::string temp = "";
|
||||
#ifdef _WIN32
|
||||
int required = 0;
|
||||
|
||||
va_start(args, format);
|
||||
required = _vscprintf(format, args);
|
||||
// Using + 2 to be safe between MSVC versions.
|
||||
// In MSVC 2015 and later, vsnprintf counts the trailing zero (per c++11.)
|
||||
temp.resize(required + 2);
|
||||
if (vsnprintf(&temp[0], required + 1, format, args) < 0) {
|
||||
temp.resize(0);
|
||||
} else {
|
||||
temp.resize(required);
|
||||
}
|
||||
va_end(args);
|
||||
#else
|
||||
char *buf = nullptr;
|
||||
|
||||
va_start(args, format);
|
||||
if (vasprintf(&buf, format, args) < 0)
|
||||
buf = nullptr;
|
||||
va_end(args);
|
||||
|
||||
if (buf != nullptr) {
|
||||
temp = buf;
|
||||
free(buf);
|
||||
}
|
||||
#endif
|
||||
return temp;
|
||||
}
|
||||
|
||||
std::string StringFromInt(int value)
|
||||
{
|
||||
char temp[16];
|
||||
sprintf(temp, "%i", value);
|
||||
return temp;
|
||||
}
|
||||
|
||||
// Turns " hej " into "hej". Also handles tabs.
|
||||
std::string StripSpaces(const std::string &str)
|
||||
{
|
||||
const size_t s = str.find_first_not_of(" \t\r\n");
|
||||
|
||||
if (str.npos != s)
|
||||
return str.substr(s, str.find_last_not_of(" \t\r\n") - s + 1);
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
// "\"hello\"" is turned to "hello"
|
||||
// This one assumes that the string has already been space stripped in both
|
||||
// ends, as done by StripSpaces above, for example.
|
||||
std::string StripQuotes(const std::string& s)
|
||||
{
|
||||
if (s.size() && '\"' == s[0] && '\"' == *s.rbegin())
|
||||
return s.substr(1, s.size() - 2);
|
||||
else
|
||||
return s;
|
||||
}
|
||||
|
||||
void SplitString(const std::string& str, const char delim, std::vector<std::string>& output)
|
||||
{
|
||||
size_t next = 0;
|
||||
for (size_t pos = 0, len = str.length(); pos < len; ++pos) {
|
||||
if (str[pos] == delim) {
|
||||
output.push_back(str.substr(next, pos - next));
|
||||
// Skip the delimiter itself.
|
||||
next = pos + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (next == 0) {
|
||||
output.push_back(str);
|
||||
} else if (next < str.length()) {
|
||||
output.push_back(str.substr(next));
|
||||
}
|
||||
}
|
||||
|
||||
void GetQuotedStrings(const std::string& str, std::vector<std::string>& output)
|
||||
{
|
||||
size_t next = 0;
|
||||
bool even = 0;
|
||||
for (size_t pos = 0, len = str.length(); pos < len; ++pos) {
|
||||
if (str[pos] == '\"' || str[pos] == '\'') {
|
||||
if (even) {
|
||||
//quoted text
|
||||
output.push_back(str.substr(next, pos - next));
|
||||
even = 0;
|
||||
} else {
|
||||
//non quoted text
|
||||
even = 1;
|
||||
}
|
||||
// Skip the delimiter itself.
|
||||
next = pos + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string ReplaceAll(std::string result, const std::string& src, const std::string& dest)
|
||||
{
|
||||
size_t pos = 0;
|
||||
|
||||
if (src == dest)
|
||||
return result;
|
||||
|
||||
while (1)
|
||||
{
|
||||
pos = result.find(src, pos);
|
||||
if (pos == result.npos)
|
||||
break;
|
||||
result.replace(pos, src.size(), dest);
|
||||
pos += dest.size();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -17,10 +17,66 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <base/stringutil.h>
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning (disable:4996)
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#else
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
// Useful for shaders with error messages..
|
||||
std::string LineNumberString(const std::string &str);
|
||||
|
||||
// Other simple string utilities.
|
||||
|
||||
inline bool startsWith(const std::string &str, const std::string &what) {
|
||||
if (str.size() < what.size())
|
||||
return false;
|
||||
return str.substr(0, what.size()) == what;
|
||||
}
|
||||
|
||||
inline bool endsWith(const std::string &str, const std::string &what) {
|
||||
if (str.size() < what.size())
|
||||
return false;
|
||||
return str.substr(str.size() - what.size()) == what;
|
||||
}
|
||||
|
||||
// Only use on strings where you're only concerned about ASCII.
|
||||
inline bool startsWithNoCase(const std::string &str, const std::string &what) {
|
||||
if (str.size() < what.size())
|
||||
return false;
|
||||
return strncasecmp(str.c_str(), what.c_str(), what.size()) == 0;
|
||||
}
|
||||
|
||||
inline bool endsWithNoCase(const std::string &str, const std::string &what) {
|
||||
if (str.size() < what.size())
|
||||
return false;
|
||||
const size_t offset = str.size() - what.size();
|
||||
return strncasecmp(str.c_str() + offset, what.c_str(), what.size()) == 0;
|
||||
}
|
||||
|
||||
void DataToHexString(const uint8_t *data, size_t size, std::string *output);
|
||||
void DataToHexString(const char* prefix, uint32_t startAddr, const uint8_t* data, size_t size, std::string* output);
|
||||
|
||||
std::string StringFromFormat(const char* format, ...);
|
||||
std::string StringFromInt(int value);
|
||||
|
||||
std::string StripSpaces(const std::string &s);
|
||||
std::string StripQuotes(const std::string &s);
|
||||
|
||||
void SplitString(const std::string& str, const char delim, std::vector<std::string>& output);
|
||||
|
||||
void GetQuotedStrings(const std::string& str, std::vector<std::string>& output);
|
||||
|
||||
std::string ReplaceAll(std::string input, const std::string& src, const std::string& dest);
|
||||
|
||||
void SkipSpace(const char **ptr);
|
||||
|
||||
void truncate_cpy(char *dest, size_t destSize, const char *src);
|
||||
template<size_t Count>
|
||||
|
|
|
@ -17,8 +17,10 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
#include "base/stringutil.h"
|
||||
|
||||
#include "util/text/utf8.h"
|
||||
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Core/Debugger/Breakpoints.h"
|
||||
#include "Core/Debugger/DisassemblyManager.h"
|
||||
#include "Core/Debugger/WebSocket/DisasmSubscriber.h"
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
// Official git repository and contact information can be found at
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
#include "base/stringutil.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/Debugger/DisassemblyManager.h"
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
// Official git repository and contact information can be found at
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
#include "base/stringutil.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Core/Debugger/Breakpoints.h"
|
||||
#include "Core/Debugger/DisassemblyManager.h"
|
||||
#include "Core/Debugger/WebSocket/SteppingSubscriber.h"
|
||||
|
|
|
@ -21,13 +21,13 @@
|
|||
|
||||
#include <thread>
|
||||
|
||||
#include "base/stringutil.h"
|
||||
#include "i18n/i18n.h"
|
||||
#include "thread/threadutil.h"
|
||||
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/Serialize/Serializer.h"
|
||||
#include "Common/Serialize/SerializeFuncs.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Core/FileSystems/MetaFileSystem.h"
|
||||
#include "Core/Util/PPGeDraw.h"
|
||||
#include "Core/HLE/sceCtrl.h"
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
#include <algorithm>
|
||||
|
||||
#include "base/stringutil.h"
|
||||
#include "Common/Common.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Core/FileLoaders/HTTPFileLoader.h"
|
||||
|
||||
HTTPFileLoader::HTTPFileLoader(const std::string &filename)
|
||||
|
|
|
@ -19,13 +19,14 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
#include "base/stringutil.h"
|
||||
|
||||
#include "file/free.h"
|
||||
#include "file/zip_read.h"
|
||||
#include "i18n/i18n.h"
|
||||
#include "util/text/utf8.h"
|
||||
#include "Common/Serialize/Serializer.h"
|
||||
#include "Common/Serialize/SerializeFuncs.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Core/FileSystems/DirectoryFileSystem.h"
|
||||
#include "Core/FileSystems/ISOFileSystem.h"
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
#include "zlib.h"
|
||||
|
||||
#include "base/stringutil.h"
|
||||
#include "Common/Serialize/Serializer.h"
|
||||
#include "Common/Serialize/SerializeFuncs.h"
|
||||
#include "Common/Serialize/SerializeSet.h"
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/LogManager.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Common/Serialize/Serializer.h"
|
||||
#include "Common/Serialize/SerializeFuncs.h"
|
||||
#include "Common/Serialize/SerializeList.h"
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
|
||||
#include "base/stringutil.h"
|
||||
#include "file/file_util.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/StringUtils.h"
|
||||
|
||||
#include "Core/FileLoaders/CachingFileLoader.h"
|
||||
#include "Core/FileLoaders/DiskCachingFileLoader.h"
|
||||
|
|
|
@ -19,12 +19,16 @@
|
|||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
#include <set>
|
||||
#include <cstdlib>
|
||||
#include <cstdarg>
|
||||
|
||||
#include "Core/Reporting.h"
|
||||
|
||||
#include "Common/CPUDetect.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/Serialize/SerializeFuncs.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/Config.h"
|
||||
|
@ -44,15 +48,10 @@
|
|||
#include "net/resolve.h"
|
||||
#include "net/url.h"
|
||||
|
||||
#include "base/stringutil.h"
|
||||
#include "base/buffer.h"
|
||||
#include "thread/threadutil.h"
|
||||
#include "file/zip_read.h"
|
||||
|
||||
#include <set>
|
||||
#include <stdlib.h>
|
||||
#include <cstdarg>
|
||||
|
||||
namespace Reporting
|
||||
{
|
||||
const int DEFAULT_PORT = 80;
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <thread>
|
||||
#include <mutex>
|
||||
|
||||
#include "base/stringutil.h"
|
||||
#include "i18n/i18n.h"
|
||||
#include "thread/threadutil.h"
|
||||
#include "util/text/parsers.h"
|
||||
|
@ -28,6 +27,7 @@
|
|||
#include "Common/FileUtil.h"
|
||||
#include "Common/Serialize/Serializer.h"
|
||||
#include "Common/Serialize/SerializeFuncs.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Common/TimeUtil.h"
|
||||
|
||||
#include "Core/SaveState.h"
|
||||
|
|
|
@ -22,13 +22,14 @@
|
|||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include "base/stringutil.h"
|
||||
|
||||
#include "i18n/i18n.h"
|
||||
#include "ext/xxhash.h"
|
||||
#include "file/ini_file.h"
|
||||
#include "util/text/parsers.h"
|
||||
#include "Common/ColorConv.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/Host.h"
|
||||
#include "Core/System.h"
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include <algorithm>
|
||||
|
||||
#include "base/colorutil.h"
|
||||
#include "base/stringutil.h"
|
||||
#include "file/vfs.h"
|
||||
#include "gfx/texture_atlas.h"
|
||||
#include "gfx_es2/draw_text.h"
|
||||
|
@ -28,6 +27,7 @@
|
|||
|
||||
#include "Common/Serialize/Serializer.h"
|
||||
#include "Common/Serialize/SerializeFuncs.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Core/HDRemaster.h"
|
||||
#include "Core/Host.h"
|
||||
#include "GPU/ge_constants.h"
|
||||
|
|
|
@ -18,16 +18,16 @@
|
|||
#include <algorithm>
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
#include <unordered_map>
|
||||
#include "base/stringutil.h"
|
||||
|
||||
#include "file/fd_util.h"
|
||||
#include "net/http_client.h"
|
||||
#include "net/http_server.h"
|
||||
#include "net/sinks.h"
|
||||
#include "thread/threadutil.h"
|
||||
#include "Common/Log.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/TimeUtil.h"
|
||||
#include "Common/Log.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/Debugger/WebSocket.h"
|
||||
#include "Core/WebServer.h"
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "file/vfs.h"
|
||||
#include "gfx_es2/gpu_features.h"
|
||||
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Core/Config.h"
|
||||
#include "GPU/Common/PostShader.h"
|
||||
|
||||
|
|
|
@ -35,8 +35,9 @@
|
|||
#endif
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "base/stringutil.h"
|
||||
#include "Common/Log.h"
|
||||
#include "Common/StringUtils.h"
|
||||
|
||||
#include "GPU/Common/ShaderTranslation.h"
|
||||
#include "ext/glslang/SPIRV/GlslangToSpv.h"
|
||||
#include "thin3d/thin3d.h"
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <cstdint>
|
||||
#include <cfloat>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <d3d11.h>
|
||||
#include <D3Dcompiler.h>
|
||||
|
||||
|
@ -12,10 +13,10 @@
|
|||
#include "thin3d/d3d11_loader.h"
|
||||
#endif
|
||||
|
||||
#include "base/stringutil.h"
|
||||
|
||||
#include "Common/CommonFuncs.h"
|
||||
#include "Common/Log.h"
|
||||
#include "Common/StringUtils.h"
|
||||
|
||||
#include "D3D11Util.h"
|
||||
|
||||
static std::vector<uint8_t> CompileShaderToBytecode(const char *code, size_t codeSize, const char *target, UINT flags) {
|
||||
|
@ -126,7 +127,7 @@ void StockObjectsD3D11::Create(ID3D11Device *device) {
|
|||
sampler_desc.MinLOD = -FLT_MAX;
|
||||
sampler_desc.MaxLOD = FLT_MAX;
|
||||
sampler_desc.MipLODBias = 0.0f;
|
||||
sampler_desc.MaxAnisotropy = 1.0f;
|
||||
sampler_desc.MaxAnisotropy = 1;
|
||||
ASSERT_SUCCESS(device->CreateSamplerState(&sampler_desc, &samplerPoint2DWrap));
|
||||
sampler_desc.Filter = D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT;
|
||||
ASSERT_SUCCESS(device->CreateSamplerState(&sampler_desc, &samplerLinear2DWrap));
|
||||
|
|
|
@ -21,10 +21,12 @@
|
|||
#include <set>
|
||||
#include <vector>
|
||||
#include <snappy-c.h>
|
||||
#include "base/stringutil.h"
|
||||
|
||||
#include "Common/Common.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/Log.h"
|
||||
#include "Common/StringUtils.h"
|
||||
|
||||
#include "Core/Core.h"
|
||||
#include "Core/ELF/ParamSFO.h"
|
||||
#include "Core/HLE/sceDisplay.h"
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include <map>
|
||||
|
||||
#include "gfx/d3d9_shader.h"
|
||||
#include "base/stringutil.h"
|
||||
#include "i18n/i18n.h"
|
||||
#include "math/lin/matrix4x4.h"
|
||||
#include "math/math_util.h"
|
||||
|
@ -33,6 +32,8 @@
|
|||
|
||||
#include "Common/Common.h"
|
||||
#include "Common/Log.h"
|
||||
#include "Common/StringUtils.h"
|
||||
|
||||
#include "Core/Config.h"
|
||||
#include "Core/Host.h"
|
||||
#include "Core/Reporting.h"
|
||||
|
|
|
@ -15,14 +15,14 @@
|
|||
// Official git repository and contact information can be found at
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
#include <stdio.h>
|
||||
#include <cstdio>
|
||||
#include <locale.h>
|
||||
|
||||
#if defined(_WIN32) && defined(_DEBUG)
|
||||
#include "Common/CommonWindows.h"
|
||||
#endif
|
||||
|
||||
#include "base/stringutil.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "GPU/ge_constants.h"
|
||||
#include "GPU/GPUState.h"
|
||||
#include "Core/Config.h"
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "Common/CommonWindows.h"
|
||||
#endif
|
||||
|
||||
#include "base/stringutil.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "GPU/ge_constants.h"
|
||||
#include "GPU/GPUState.h"
|
||||
#include "Core/Config.h"
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
//#define SHADERLOG
|
||||
#endif
|
||||
|
||||
#include "base/stringutil.h"
|
||||
#include "math/lin/matrix4x4.h"
|
||||
#include "math/math_util.h"
|
||||
#include "math/dataconv.h"
|
||||
|
@ -27,6 +26,7 @@
|
|||
#include "thin3d/thin3d.h"
|
||||
#include "util/text/utf8.h"
|
||||
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Common/Vulkan/VulkanContext.h"
|
||||
#include "Common/Vulkan/VulkanMemory.h"
|
||||
#include "Common/Log.h"
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "thin3d/VulkanRenderManager.h"
|
||||
|
||||
#include "Common/ColorConv.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/Host.h"
|
||||
#include "Core/MemMap.h"
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "Common/CommonWindows.h"
|
||||
#endif
|
||||
|
||||
#include "base/stringutil.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Common/Vulkan/VulkanLoader.h"
|
||||
#include "Core/Config.h"
|
||||
#include "GPU/ge_constants.h"
|
||||
|
|
|
@ -15,9 +15,8 @@
|
|||
// Official git repository and contact information can be found at
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "base/stringutil.h"
|
||||
#include "Common/Log.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Common/Vulkan/VulkanContext.h"
|
||||
#include "GPU/Vulkan/VulkanUtil.h"
|
||||
|
||||
|
|
|
@ -15,10 +15,6 @@
|
|||
// Official git repository and contact information can be found at
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
#include "TouchControlVisibilityScreen.h"
|
||||
#include "UI/ComboKeyMappingScreen.h"
|
||||
|
||||
#include "Core/Config.h"
|
||||
#include "i18n/i18n.h"
|
||||
#include "base/colorutil.h"
|
||||
#include "base/display.h"
|
||||
|
@ -26,12 +22,16 @@
|
|||
#include "gfx_es2/draw_buffer.h"
|
||||
#include "gfx/texture_atlas.h"
|
||||
#include "math/curves.h"
|
||||
#include "base/stringutil.h"
|
||||
#include "ui/ui_context.h"
|
||||
#include "ui/view.h"
|
||||
#include "ui/viewgroup.h"
|
||||
|
||||
#include "Common/TimeUtil.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Core/Config.h"
|
||||
|
||||
#include "TouchControlVisibilityScreen.h"
|
||||
#include "UI/ComboKeyMappingScreen.h"
|
||||
|
||||
void ComboKeyScreen::CreateViews() {
|
||||
using namespace UI;
|
||||
|
|
|
@ -15,13 +15,13 @@
|
|||
// Official git repository and contact information can be found at
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
#include "base/stringutil.h"
|
||||
#include "ext/xxhash.h"
|
||||
#include "i18n/i18n.h"
|
||||
#include "ui/ui.h"
|
||||
#include "util/text/utf8.h"
|
||||
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/CwCheat.h"
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
#include "ppsspp_config.h"
|
||||
#include "base/display.h"
|
||||
#include "base/stringutil.h"
|
||||
#include "gfx_es2/gpu_features.h"
|
||||
#include "i18n/i18n.h"
|
||||
#include "ui/ui_context.h"
|
||||
|
@ -30,6 +29,7 @@
|
|||
|
||||
#include "Common/LogManager.h"
|
||||
#include "Common/CPUDetect.h"
|
||||
#include "Common/StringUtils.h"
|
||||
|
||||
#include "Core/MemMap.h"
|
||||
#include "Core/Config.h"
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include <memory>
|
||||
#include <algorithm>
|
||||
|
||||
#include "base/stringutil.h"
|
||||
#include "file/file_util.h"
|
||||
#include "file/zip_read.h"
|
||||
#include "thin3d/thin3d.h"
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
#include "base/display.h" // Only to check screen aspect ratio with pixel_yres/pixel_xres
|
||||
|
||||
#include "base/colorutil.h"
|
||||
#include "base/stringutil.h"
|
||||
#include "Common/TimeUtil.h"
|
||||
#include "math/curves.h"
|
||||
#include "net/resolve.h"
|
||||
#include "gfx_es2/gpu_features.h"
|
||||
|
@ -54,6 +52,8 @@
|
|||
#include "Common/KeyMap.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/OSVersion.h"
|
||||
#include "Common/TimeUtil.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/ConfigValues.h"
|
||||
#include "Core/Host.h"
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "gfx/texture_atlas.h"
|
||||
#include "gfx_es2/draw_buffer.h"
|
||||
#include "math/curves.h"
|
||||
#include "base/stringutil.h"
|
||||
#include "ui/root.h"
|
||||
#include "ui/ui_context.h"
|
||||
#include "ui/view.h"
|
||||
|
@ -34,6 +33,7 @@
|
|||
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/TimeUtil.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Core/System.h"
|
||||
#include "Core/Host.h"
|
||||
#include "Core/Reporting.h"
|
||||
|
|
|
@ -44,8 +44,6 @@
|
|||
#endif
|
||||
|
||||
#include "base/display.h"
|
||||
#include "base/stringutil.h"
|
||||
#include "Common/TimeUtil.h"
|
||||
#include "base/NativeApp.h"
|
||||
#include "file/vfs.h"
|
||||
#include "file/zip_read.h"
|
||||
|
@ -71,6 +69,8 @@
|
|||
|
||||
#include "Common/CPUDetect.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/TimeUtil.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Common/KeyMap.h"
|
||||
#include "Common/LogManager.h"
|
||||
#include "Common/MemArena.h"
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include "base/stringutil.h"
|
||||
|
||||
#include "i18n/i18n.h"
|
||||
#include "gfx_es2/draw_buffer.h"
|
||||
#include "ui/view.h"
|
||||
|
@ -26,6 +26,8 @@
|
|||
#include "ui/ui_screen.h"
|
||||
#include "thin3d/thin3d.h"
|
||||
|
||||
#include "Common/StringUtils.h"
|
||||
|
||||
#include "Core/Reporting.h"
|
||||
#include "Core/SaveState.h"
|
||||
#include "Core/System.h"
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include <netfw.h>
|
||||
#endif
|
||||
|
||||
#include "base/stringutil.h"
|
||||
#include "file/path.h"
|
||||
// TODO: For text align flags, probably shouldn't be in gfx_es2/...
|
||||
#include "gfx_es2/draw_buffer.h"
|
||||
|
@ -34,8 +33,10 @@
|
|||
#include "net/http_client.h"
|
||||
#include "net/resolve.h"
|
||||
#include "net/url.h"
|
||||
|
||||
#include "Common/Common.h"
|
||||
#include "Common/TimeUtil.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/WebServer.h"
|
||||
#include "UI/RemoteISOScreen.h"
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include <string>
|
||||
|
||||
#include "base/display.h"
|
||||
#include "base/stringutil.h"
|
||||
// TODO: For text align flags, probably shouldn't be in gfx_es2/...
|
||||
#include "gfx_es2/draw_buffer.h"
|
||||
#include "i18n/i18n.h"
|
||||
|
@ -33,6 +32,7 @@
|
|||
#include "Core/System.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/Log.h"
|
||||
#include "Common/StringUtils.h"
|
||||
|
||||
using namespace UI;
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include <functional>
|
||||
|
||||
#include "base/colorutil.h"
|
||||
#include "base/stringutil.h"
|
||||
#include "gfx_es2/draw_buffer.h"
|
||||
#include "i18n/i18n.h"
|
||||
#include "math/curves.h"
|
||||
|
@ -35,6 +34,7 @@
|
|||
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/TimeUtil.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Core/Host.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/Loaders.h"
|
||||
|
|
|
@ -387,7 +387,6 @@
|
|||
<ClInclude Include="..\..\ext\native\base\NativeApp.h" />
|
||||
<ClInclude Include="..\..\ext\native\base\NKCodeFromQt.h" />
|
||||
<ClInclude Include="..\..\ext\native\base\NKCodeFromSDL.h" />
|
||||
<ClInclude Include="..\..\ext\native\base\stringutil.h" />
|
||||
<ClInclude Include="..\..\ext\native\data\base64.h" />
|
||||
<ClInclude Include="..\..\ext\native\data\compression.h" />
|
||||
<ClInclude Include="..\..\ext\native\ext\cityhash\city.h" />
|
||||
|
@ -472,7 +471,6 @@
|
|||
<ClCompile Include="..\..\ext\native\base\buffer.cpp" />
|
||||
<ClCompile Include="..\..\ext\native\base\colorutil.cpp" />
|
||||
<ClCompile Include="..\..\ext\native\base\display.cpp" />
|
||||
<ClCompile Include="..\..\ext\native\base\stringutil.cpp" />
|
||||
<ClCompile Include="..\..\ext\native\data\base64.cpp" />
|
||||
<ClCompile Include="..\..\ext\native\data\compression.cpp" />
|
||||
<ClCompile Include="..\..\ext\native\ext\cityhash\city.cpp" />
|
||||
|
|
|
@ -73,9 +73,6 @@
|
|||
<ClCompile Include="..\..\ext\native\base\display.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\ext\native\base\stringutil.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\ext\native\thin3d\thin3d.cpp">
|
||||
<Filter>thin3d</Filter>
|
||||
</ClCompile>
|
||||
|
@ -487,9 +484,6 @@
|
|||
<ClInclude Include="..\..\ext\native\base\NativeApp.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\ext\native\base\stringutil.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\ext\native\thin3d\thin3d.h">
|
||||
<Filter>thin3d</Filter>
|
||||
</ClInclude>
|
||||
|
|
|
@ -24,10 +24,11 @@
|
|||
#include "Core/CoreTiming.h"
|
||||
#include "Core/MIPS/MIPSAnalyst.h"
|
||||
|
||||
#include "base/stringutil.h"
|
||||
#include "util/text/utf8.h"
|
||||
|
||||
#include "Common/CommonWindows.h"
|
||||
#include "Common/StringUtils.h"
|
||||
|
||||
#include <windowsx.h>
|
||||
#include <commctrl.h>
|
||||
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/stringutil.h"
|
||||
#include "util/text/parsers.h"
|
||||
#include "Common/ColorConv.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/Screenshot.h"
|
||||
#include "Windows/GEDebugger/GEDebugger.h"
|
||||
|
|
|
@ -55,7 +55,6 @@
|
|||
#include "Common/Vulkan/VulkanLoader.h"
|
||||
#include "Common/Vulkan/VulkanContext.h"
|
||||
|
||||
#include "base/stringutil.h"
|
||||
#include "thin3d/thin3d.h"
|
||||
#include "thin3d/thin3d_create.h"
|
||||
#include "thin3d/VulkanRenderManager.h"
|
||||
|
|
|
@ -34,8 +34,8 @@
|
|||
|
||||
#include "base/display.h"
|
||||
#include "base/NativeApp.h"
|
||||
#include "base/stringutil.h"
|
||||
#include "Common/TimeUtil.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "i18n/i18n.h"
|
||||
#include "input/input_state.h"
|
||||
#include "input/keycodes.h"
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
#include "resource.h"
|
||||
|
||||
#include "base/stringutil.h"
|
||||
#include "i18n/i18n.h"
|
||||
#include "util/text/utf8.h"
|
||||
#include "base/NativeApp.h"
|
||||
|
@ -19,6 +18,7 @@
|
|||
#include "Common/ConsoleListener.h"
|
||||
#include "Common/OSVersion.h"
|
||||
#include "Common/Vulkan/VulkanLoader.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#if PPSSPP_API(ANY_GL)
|
||||
#include "GPU/GLES/TextureScalerGLES.h"
|
||||
#include "GPU/GLES/TextureCacheGLES.h"
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include <mmsystem.h>
|
||||
|
||||
#include "base/display.h"
|
||||
#include "base/stringutil.h"
|
||||
#include "base/NativeApp.h"
|
||||
#include "file/vfs.h"
|
||||
#include "file/zip_read.h"
|
||||
|
@ -51,6 +50,7 @@
|
|||
|
||||
#include "Common/LogManager.h"
|
||||
#include "Common/ConsoleListener.h"
|
||||
#include "Common/StringUtils.h"
|
||||
|
||||
#include "Commctrl.h"
|
||||
|
||||
|
|
|
@ -50,7 +50,6 @@ struct JNIEnv {};
|
|||
#endif
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "base/stringutil.h"
|
||||
#include "base/display.h"
|
||||
#include "base/NativeApp.h"
|
||||
#include "thread/threadutil.h"
|
||||
|
@ -67,7 +66,9 @@ struct JNIEnv {};
|
|||
|
||||
#include "Common/Log.h"
|
||||
#include "Common/GraphicsContext.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Common/TimeUtil.h"
|
||||
|
||||
#include "AndroidGraphicsContext.h"
|
||||
#include "AndroidVulkanContext.h"
|
||||
#include "AndroidEGLContext.h"
|
||||
|
|
|
@ -10,7 +10,6 @@ LOCAL_SRC_FILES :=\
|
|||
base/buffer.cpp \
|
||||
base/display.cpp \
|
||||
base/colorutil.cpp \
|
||||
base/stringutil.cpp \
|
||||
data/base64.cpp \
|
||||
data/compression.cpp \
|
||||
ext/cityhash/city.cpp \
|
||||
|
|
|
@ -33,8 +33,6 @@
|
|||
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
|
||||
#endif
|
||||
|
||||
inline uint8_t swap8(uint8_t _data) {return _data;}
|
||||
|
||||
// Just in case this has been defined by platform
|
||||
#undef swap16
|
||||
#undef swap32
|
||||
|
|
|
@ -1,198 +0,0 @@
|
|||
#include "ppsspp_config.h"
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#undef min
|
||||
#undef max
|
||||
#endif
|
||||
#if PPSSPP_PLATFORM(SWITCH)
|
||||
#define _GNU_SOURCE
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#include <cstring>
|
||||
#include <cstdarg>
|
||||
#include <errno.h>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <limits.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <iomanip>
|
||||
|
||||
#include "base/buffer.h"
|
||||
#include "base/stringutil.h"
|
||||
|
||||
std::string LineNumberString(const std::string &str) {
|
||||
std::stringstream input(str);
|
||||
std::stringstream output;
|
||||
std::string line;
|
||||
|
||||
int lineNumber = 1;
|
||||
while (std::getline(input, line)) {
|
||||
output << std::setw(4) << lineNumber++ << ": " << line << std::endl;
|
||||
}
|
||||
|
||||
return output.str();
|
||||
}
|
||||
|
||||
void SkipSpace(const char **ptr) {
|
||||
while (**ptr && isspace(**ptr)) {
|
||||
(*ptr)++;
|
||||
}
|
||||
}
|
||||
|
||||
void DataToHexString(const uint8_t *data, size_t size, std::string *output) {
|
||||
Buffer buffer;
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
if (i && !(i & 15))
|
||||
buffer.Printf("\n");
|
||||
buffer.Printf("%02x ", data[i]);
|
||||
}
|
||||
buffer.TakeAll(output);
|
||||
}
|
||||
|
||||
void DataToHexString(const char* prefix, uint32_t startAddr, const uint8_t* data, size_t size, std::string* output) {
|
||||
Buffer buffer;
|
||||
size_t i = 0;
|
||||
for (; i < size; i++) {
|
||||
if (i && !(i & 15)) {
|
||||
buffer.Printf(" ");
|
||||
for (size_t j = i - 16; j < i; j++) {
|
||||
buffer.Printf("%c", ((data[j] < 0x20) || (data[j] > 0x7e)) ? 0x2e : data[j]);
|
||||
}
|
||||
buffer.Printf("\n");
|
||||
}
|
||||
if (!(i & 15))
|
||||
buffer.Printf("%s%08x ", prefix, startAddr + i);
|
||||
buffer.Printf("%02x ", data[i]);
|
||||
}
|
||||
if (size & 15) {
|
||||
size_t padded_size = ((size-1) | 15) + 1;
|
||||
for (size_t j = size; j < padded_size; j++) {
|
||||
buffer.Printf(" ");
|
||||
}
|
||||
buffer.Printf(" ");
|
||||
for (size_t j = size & ~UINT64_C(0xF); j < size; j++) {
|
||||
buffer.Printf("%c", ((data[j] < 0x20) || (data[j] > 0x7e)) ? 0x2e : data[j]);
|
||||
}
|
||||
}
|
||||
buffer.TakeAll(output);
|
||||
}
|
||||
|
||||
std::string StringFromFormat(const char* format, ...)
|
||||
{
|
||||
va_list args;
|
||||
std::string temp = "";
|
||||
#ifdef _WIN32
|
||||
int required = 0;
|
||||
|
||||
va_start(args, format);
|
||||
required = _vscprintf(format, args);
|
||||
// Using + 2 to be safe between MSVC versions.
|
||||
// In MSVC 2015 and later, vsnprintf counts the trailing zero (per c++11.)
|
||||
temp.resize(required + 2);
|
||||
if (vsnprintf(&temp[0], required + 1, format, args) < 0) {
|
||||
temp.resize(0);
|
||||
} else {
|
||||
temp.resize(required);
|
||||
}
|
||||
va_end(args);
|
||||
#else
|
||||
char *buf = nullptr;
|
||||
|
||||
va_start(args, format);
|
||||
if (vasprintf(&buf, format, args) < 0)
|
||||
buf = nullptr;
|
||||
va_end(args);
|
||||
|
||||
if (buf != nullptr) {
|
||||
temp = buf;
|
||||
free(buf);
|
||||
}
|
||||
#endif
|
||||
return temp;
|
||||
}
|
||||
|
||||
std::string StringFromInt(int value)
|
||||
{
|
||||
char temp[16];
|
||||
sprintf(temp, "%i", value);
|
||||
return temp;
|
||||
}
|
||||
|
||||
// Turns " hej " into "hej". Also handles tabs.
|
||||
std::string StripSpaces(const std::string &str)
|
||||
{
|
||||
const size_t s = str.find_first_not_of(" \t\r\n");
|
||||
|
||||
if (str.npos != s)
|
||||
return str.substr(s, str.find_last_not_of(" \t\r\n") - s + 1);
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
// "\"hello\"" is turned to "hello"
|
||||
// This one assumes that the string has already been space stripped in both
|
||||
// ends, as done by StripSpaces above, for example.
|
||||
std::string StripQuotes(const std::string& s)
|
||||
{
|
||||
if (s.size() && '\"' == s[0] && '\"' == *s.rbegin())
|
||||
return s.substr(1, s.size() - 2);
|
||||
else
|
||||
return s;
|
||||
}
|
||||
|
||||
void SplitString(const std::string& str, const char delim, std::vector<std::string>& output)
|
||||
{
|
||||
size_t next = 0;
|
||||
for (size_t pos = 0, len = str.length(); pos < len; ++pos) {
|
||||
if (str[pos] == delim) {
|
||||
output.push_back(str.substr(next, pos - next));
|
||||
// Skip the delimiter itself.
|
||||
next = pos + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (next == 0) {
|
||||
output.push_back(str);
|
||||
} else if (next < str.length()) {
|
||||
output.push_back(str.substr(next));
|
||||
}
|
||||
}
|
||||
|
||||
void GetQuotedStrings(const std::string& str, std::vector<std::string>& output)
|
||||
{
|
||||
size_t next = 0;
|
||||
bool even = 0;
|
||||
for (size_t pos = 0, len = str.length(); pos < len; ++pos) {
|
||||
if (str[pos] == '\"' || str[pos] == '\'') {
|
||||
if (even) {
|
||||
//quoted text
|
||||
output.push_back(str.substr(next, pos - next));
|
||||
even = 0;
|
||||
} else {
|
||||
//non quoted text
|
||||
even = 1;
|
||||
}
|
||||
// Skip the delimiter itself.
|
||||
next = pos + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string ReplaceAll(std::string result, const std::string& src, const std::string& dest)
|
||||
{
|
||||
size_t pos = 0;
|
||||
|
||||
if (src == dest)
|
||||
return result;
|
||||
|
||||
while(1)
|
||||
{
|
||||
pos = result.find(src, pos);
|
||||
if (pos == result.npos)
|
||||
break;
|
||||
result.replace(pos, src.size(), dest);
|
||||
pos += dest.size();
|
||||
}
|
||||
return result;
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/basictypes.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning (disable:4996)
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#else
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
// Useful for shaders with error messages..
|
||||
std::string LineNumberString(const std::string &str);
|
||||
|
||||
// Other simple string utilities.
|
||||
|
||||
inline bool startsWith(const std::string &str, const std::string &what) {
|
||||
if (str.size() < what.size())
|
||||
return false;
|
||||
return str.substr(0, what.size()) == what;
|
||||
}
|
||||
|
||||
inline bool endsWith(const std::string &str, const std::string &what) {
|
||||
if (str.size() < what.size())
|
||||
return false;
|
||||
return str.substr(str.size() - what.size()) == what;
|
||||
}
|
||||
|
||||
// Only use on strings where you're only concerned about ASCII.
|
||||
inline bool startsWithNoCase(const std::string &str, const std::string &what) {
|
||||
if (str.size() < what.size())
|
||||
return false;
|
||||
return strncasecmp(str.c_str(), what.c_str(), what.size()) == 0;
|
||||
}
|
||||
|
||||
inline bool endsWithNoCase(const std::string &str, const std::string &what) {
|
||||
if (str.size() < what.size())
|
||||
return false;
|
||||
const size_t offset = str.size() - what.size();
|
||||
return strncasecmp(str.c_str() + offset, what.c_str(), what.size()) == 0;
|
||||
}
|
||||
|
||||
void DataToHexString(const uint8_t *data, size_t size, std::string *output);
|
||||
void DataToHexString(const char* prefix, uint32_t startAddr, const uint8_t* data, size_t size, std::string* output);
|
||||
|
||||
std::string StringFromFormat(const char* format, ...);
|
||||
std::string StringFromInt(int value);
|
||||
|
||||
std::string StripSpaces(const std::string &s);
|
||||
std::string StripQuotes(const std::string &s);
|
||||
|
||||
void SplitString(const std::string& str, const char delim, std::vector<std::string>& output);
|
||||
|
||||
void GetQuotedStrings(const std::string& str, std::vector<std::string>& output);
|
||||
|
||||
std::string ReplaceAll(std::string input, const std::string& src, const std::string& dest);
|
||||
|
||||
void SkipSpace(const char **ptr);
|
|
@ -19,10 +19,11 @@
|
|||
#include <ctype.h>
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "base/stringutil.h"
|
||||
#include "file/file_util.h"
|
||||
#include "util/text/utf8.h"
|
||||
|
||||
#include "Common/StringUtils.h"
|
||||
|
||||
#if !defined(__linux__) && !defined(_WIN32) && !defined(__QNX__)
|
||||
#define stat64 stat
|
||||
#endif
|
||||
|
@ -126,22 +127,6 @@ bool readFileToString(bool text_file, const char *filename, std::string &str)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool readDataFromFile(bool text_file, unsigned char* &data, const unsigned int size, const char *filename)
|
||||
{
|
||||
FILE *f = openCFile(filename, text_file ? "r" : "rb");
|
||||
if (!f)
|
||||
return false;
|
||||
size_t len = (size_t)GetSize(f);
|
||||
if(len < size) {
|
||||
fclose(f);
|
||||
return false;
|
||||
}
|
||||
data[fread(data, 1, size, f)] = 0;
|
||||
fclose(f);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Returns true if filename is a directory
|
||||
bool isDirectory(const std::string &filename) {
|
||||
FileInfo info;
|
||||
|
|
|
@ -12,7 +12,6 @@ bool writeStringToFile(bool text_file, const std::string &str, const char *filen
|
|||
bool readFileToString(bool text_file, const char *filename, std::string &str);
|
||||
|
||||
bool writeDataToFile(bool text_file, const void* data, const unsigned int size, const char *filename);
|
||||
bool readDataFromFile(bool text_file, unsigned char* &data, const unsigned int size, const char *filename);
|
||||
|
||||
// Beginnings of a directory utility system. TODO: Improve.
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/stringutil.h"
|
||||
#include "file/ini_file.h"
|
||||
#include "file/vfs.h"
|
||||
#include "util/text/parsers.h"
|
||||
|
@ -25,6 +24,8 @@
|
|||
#include "util/text/utf8.h"
|
||||
#endif
|
||||
|
||||
#include "Common/StringUtils.h"
|
||||
|
||||
static bool ParseLineKey(const std::string &line, size_t &pos, std::string *keyOut) {
|
||||
std::string key = "";
|
||||
|
||||
|
@ -164,6 +165,22 @@ std::string* Section::GetLine(const char* key, std::string* valueOut, std::strin
|
|||
return 0;
|
||||
}
|
||||
|
||||
void Section::Set(const char* key, uint32_t newValue) {
|
||||
Set(key, StringFromFormat("0x%08x", newValue).c_str());
|
||||
}
|
||||
|
||||
void Section::Set(const char* key, float newValue) {
|
||||
Set(key, StringFromFormat("%f", newValue).c_str());
|
||||
}
|
||||
|
||||
void Section::Set(const char* key, double newValue) {
|
||||
Set(key, StringFromFormat("%f", newValue).c_str());
|
||||
}
|
||||
|
||||
void Section::Set(const char* key, int newValue) {
|
||||
Set(key, StringFromInt(newValue).c_str());
|
||||
}
|
||||
|
||||
void Section::Set(const char* key, const char* newValue)
|
||||
{
|
||||
std::string value, commented;
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "base/stringutil.h"
|
||||
|
||||
class Section
|
||||
{
|
||||
|
@ -34,21 +33,13 @@ public:
|
|||
}
|
||||
bool Get(const char* key, std::string* value, const char* defaultValue);
|
||||
|
||||
void Set(const char* key, uint32_t newValue) {
|
||||
Set(key, StringFromFormat("0x%08x", newValue).c_str());
|
||||
}
|
||||
void Set(const char* key, float newValue) {
|
||||
Set(key, StringFromFormat("%f", newValue).c_str());
|
||||
}
|
||||
void Set(const char* key, uint32_t newValue);
|
||||
void Set(const char* key, float newValue);
|
||||
void Set(const char* key, const float newValue, const float defaultValue);
|
||||
void Set(const char* key, double newValue) {
|
||||
Set(key, StringFromFormat("%f", newValue).c_str());
|
||||
}
|
||||
void Set(const char* key, double newValue);
|
||||
|
||||
void Set(const char* key, int newValue, int defaultValue);
|
||||
void Set(const char* key, int newValue) {
|
||||
Set(key, StringFromInt(newValue).c_str());
|
||||
}
|
||||
void Set(const char* key, int newValue);
|
||||
|
||||
void Set(const char* key, bool newValue, bool defaultValue);
|
||||
void Set(const char* key, bool newValue) {
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <set>
|
||||
#include "base/stringutil.h"
|
||||
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Common/TimeUtil.h"
|
||||
|
||||
#include "file/path.h"
|
||||
#include "net/http_client.h"
|
||||
#include "net/url.h"
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include <stddef.h>
|
||||
|
||||
#include "base/display.h"
|
||||
#include "base/stringutil.h"
|
||||
#include "math/math_util.h"
|
||||
#include "gfx/texture_atlas.h"
|
||||
#include "gfx/gl_debug_log.h"
|
||||
|
@ -14,6 +13,7 @@
|
|||
#include "util/text/wrap_text.h"
|
||||
|
||||
#include "Common/Log.h"
|
||||
#include "Common/StringUtils.h"
|
||||
|
||||
enum {
|
||||
// Enough?
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include "base/display.h"
|
||||
#include "base/stringutil.h"
|
||||
#include "thin3d/thin3d.h"
|
||||
#include "util/hash/hash.h"
|
||||
#include "util/text/wrap_text.h"
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include "base/display.h"
|
||||
#include "base/stringutil.h"
|
||||
#include "thin3d/thin3d.h"
|
||||
#include "util/hash/hash.h"
|
||||
#include "util/text/wrap_text.h"
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include "base/display.h"
|
||||
#include "base/stringutil.h"
|
||||
#include "thin3d/thin3d.h"
|
||||
#include "util/hash/hash.h"
|
||||
#include "util/text/wrap_text.h"
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include "base/display.h"
|
||||
#include "base/stringutil.h"
|
||||
#include "thin3d/thin3d.h"
|
||||
#include "util/hash/hash.h"
|
||||
#include "util/text/wrap_text.h"
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include "base/display.h"
|
||||
#include "base/stringutil.h"
|
||||
#include "thin3d/thin3d.h"
|
||||
#include "util/hash/hash.h"
|
||||
#include "util/text/wrap_text.h"
|
||||
|
@ -8,6 +7,7 @@
|
|||
#include "gfx_es2/draw_text_win.h"
|
||||
|
||||
#include "Common/Log.h"
|
||||
#include "Common/StringUtils.h"
|
||||
|
||||
#if defined(_WIN32) && !defined(USING_QT_UI) && !PPSSPP_PLATFORM(UWP)
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include <cstring>
|
||||
#include <set>
|
||||
|
||||
#include "base/stringutil.h"
|
||||
#include "Common/StringUtils.h"
|
||||
|
||||
#if PPSSPP_API(ANY_GL)
|
||||
#include "gfx/gl_common.h"
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#include "base/stringutil.h"
|
||||
#include "i18n/i18n.h"
|
||||
#include "file/ini_file.h"
|
||||
#include "file/vfs.h"
|
||||
|
||||
#include "Common/StringUtils.h"
|
||||
|
||||
I18NRepo i18nrepo;
|
||||
|
||||
I18NRepo::~I18NRepo() {
|
||||
|
|
|
@ -387,7 +387,6 @@
|
|||
<ClInclude Include="base\colorutil.h" />
|
||||
<ClInclude Include="base\display.h" />
|
||||
<ClInclude Include="base\NativeApp.h" />
|
||||
<ClInclude Include="base\stringutil.h" />
|
||||
<ClInclude Include="data\base64.h" />
|
||||
<ClInclude Include="data\compression.h" />
|
||||
<ClInclude Include="ext\cityhash\city.h" />
|
||||
|
@ -509,7 +508,6 @@
|
|||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="base\stringutil.cpp" />
|
||||
<ClCompile Include="data\base64.cpp" />
|
||||
<ClCompile Include="data\compression.cpp" />
|
||||
<ClCompile Include="ext\cityhash\city.cpp">
|
||||
|
|
|
@ -80,9 +80,6 @@
|
|||
<ClInclude Include="input\gesture_detector.h">
|
||||
<Filter>input</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="base\stringutil.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ext\sha1\sha1.h">
|
||||
<Filter>ext</Filter>
|
||||
</ClInclude>
|
||||
|
@ -412,9 +409,6 @@
|
|||
<ClCompile Include="file\fd_util.cpp">
|
||||
<Filter>file</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="base\stringutil.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="net\resolve.cpp">
|
||||
<Filter>net</Filter>
|
||||
</ClCompile>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "net/http_client.h"
|
||||
|
||||
#include "Common/TimeUtil.h"
|
||||
#include "Common/StringUtils.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <arpa/inet.h>
|
||||
|
@ -19,7 +21,6 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#include "base/buffer.h"
|
||||
#include "base/stringutil.h"
|
||||
#include "data/compression.h"
|
||||
#include "file/fd_util.h"
|
||||
#include "net/resolve.h"
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "base/stringutil.h"
|
||||
#include "file/fd_util.h"
|
||||
#include "net/sinks.h"
|
||||
|
||||
#include "Common/Log.h"
|
||||
#include "Common/StringUtils.h"
|
||||
|
||||
namespace http {
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "base/stringutil.h"
|
||||
#include "net/url.h"
|
||||
|
||||
#include "Common/Log.h"
|
||||
#include "Common/StringUtils.h"
|
||||
|
||||
const char *UrlEncoder::unreservedChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.~";
|
||||
const char *UrlEncoder::hexChars = "0123456789ABCDEF";
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
|
||||
#include "base/stringutil.h"
|
||||
#include "data/base64.h"
|
||||
#include "net/http_server.h"
|
||||
#include "net/sinks.h"
|
||||
|
@ -23,6 +22,7 @@
|
|||
|
||||
#include "Common/Crypto/sha1.h"
|
||||
#include "Common/Log.h"
|
||||
#include "Common/StringUtils.h"
|
||||
|
||||
static const char *const WEBSOCKET_GUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include <algorithm>
|
||||
|
||||
#include "base/stringutil.h"
|
||||
#include "gfx/gl_common.h"
|
||||
#include "gfx/gl_debug_log.h"
|
||||
#include "gfx_es2/gpu_features.h"
|
||||
|
@ -10,6 +9,7 @@
|
|||
|
||||
#include "Common/Log.h"
|
||||
#include "Common/MemoryUtil.h"
|
||||
#include "Common/StringUtils.h"
|
||||
|
||||
#include "Core/Reporting.h"
|
||||
#include "GLQueueRunner.h"
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <sstream>
|
||||
|
||||
#include "Common/Log.h"
|
||||
#include "Common/StringUtils.h"
|
||||
|
||||
#include "Common/Vulkan/VulkanContext.h"
|
||||
#include "thin3d/VulkanRenderManager.h"
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include <thread>
|
||||
|
||||
#include "base/display.h"
|
||||
#include "base/stringutil.h"
|
||||
#include "Common/Vulkan/VulkanContext.h"
|
||||
#include "math/dataconv.h"
|
||||
#include "math/math_util.h"
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include <map>
|
||||
|
||||
#include "base/display.h"
|
||||
#include "base/stringutil.h"
|
||||
#include "image/zim_load.h"
|
||||
#include "math/lin/matrix4x4.h"
|
||||
#include "math/dataconv.h"
|
||||
|
@ -29,6 +28,7 @@
|
|||
#include "thin3d/VulkanRenderManager.h"
|
||||
|
||||
#include "Common/Log.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Common/Vulkan/VulkanContext.h"
|
||||
#include "Common/Vulkan/VulkanImage.h"
|
||||
#include "Common/Vulkan/VulkanMemory.h"
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include <sstream>
|
||||
|
||||
#include "base/display.h"
|
||||
#include "base/stringutil.h"
|
||||
#include "input/input_state.h"
|
||||
#include "input/keycodes.h"
|
||||
#include "math/curves.h"
|
||||
|
@ -15,6 +14,7 @@
|
|||
#include "gfx_es2/draw_buffer.h"
|
||||
|
||||
#include "Common/Log.h"
|
||||
#include "Common/StringUtils.h"
|
||||
|
||||
static const bool ClickDebug = false;
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include <algorithm>
|
||||
#include <mutex>
|
||||
|
||||
#include "base/stringutil.h"
|
||||
#include "input/input_state.h"
|
||||
#include "input/keycodes.h"
|
||||
#include "gfx_es2/draw_buffer.h"
|
||||
|
@ -16,6 +15,7 @@
|
|||
#include "base/NativeApp.h"
|
||||
|
||||
#include "Common/TimeUtil.h"
|
||||
#include "Common/StringUtils.h"
|
||||
|
||||
namespace UI {
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include <set>
|
||||
#include <mutex>
|
||||
|
||||
#include "base/stringutil.h"
|
||||
#include "input/keycodes.h"
|
||||
#include "math/curves.h"
|
||||
#include "ui/ui_context.h"
|
||||
|
@ -15,6 +14,7 @@
|
|||
|
||||
#include "Common/Log.h"
|
||||
#include "Common/TimeUtil.h"
|
||||
#include "Common/StringUtils.h"
|
||||
|
||||
namespace UI {
|
||||
|
||||
|
|
|
@ -2,9 +2,10 @@
|
|||
#include <cstdio>
|
||||
#include <string>
|
||||
|
||||
#include "base/stringutil.h"
|
||||
#include "util/text/parsers.h"
|
||||
|
||||
#include "Common/StringUtils.h"
|
||||
|
||||
bool Version::ParseVersionString(std::string str) {
|
||||
if (str.empty())
|
||||
return false;
|
||||
|
|
|
@ -217,7 +217,6 @@ SOURCES_CXX += \
|
|||
$(EXTDIR)/native/base/buffer.cpp \
|
||||
$(EXTDIR)/native/base/colorutil.cpp \
|
||||
$(EXTDIR)/native/base/display.cpp \
|
||||
$(EXTDIR)/native/base/stringutil.cpp \
|
||||
$(EXTDIR)/native/data/compression.cpp \
|
||||
$(EXTDIR)/native/json/json_reader.cpp \
|
||||
$(EXTDIR)/glslang/OGLCompilersDLL/InitializeDll.cpp \
|
||||
|
|
Loading…
Add table
Reference in a new issue