Merge pull request #13504 from hrydgard/move-more-stuff-to-common

Move more stuff to common
This commit is contained in:
Henrik Rydgård 2020-10-04 13:26:54 +02:00 committed by GitHub
commit 58776927ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
289 changed files with 1334 additions and 1341 deletions

View File

@ -437,6 +437,8 @@ add_library(Common STATIC
Common/Data/Collections/TinySet.h
Common/Data/Color/RGBAUtil.cpp
Common/Data/Color/RGBAUtil.h
Common/Data/Convert/SmallDataConvert.cpp
Common/Data/Convert/SmallDataConvert.h
Common/Data/Encoding/Base64.cpp
Common/Data/Encoding/Base64.h
Common/Data/Encoding/Compression.cpp
@ -445,6 +447,14 @@ add_library(Common STATIC
Common/Data/Encoding/Utf8.cpp
Common/Data/Encoding/Utf8.h
Common/Data/Encoding/Utf16.h
Common/Data/Format/RIFF.cpp
Common/Data/Format/RIFF.h
Common/Data/Format/IniFile.cpp
Common/Data/Format/IniFile.h
Common/Data/Format/JSONReader.h
Common/Data/Format/JSONReader.cpp
Common/Data/Format/JSONWriter.h
Common/Data/Format/JSONWriter.cpp
Common/Data/Hash/Hash.cpp
Common/Data/Hash/Hash.h
Common/Data/Text/I18n.cpp
@ -454,11 +464,37 @@ add_library(Common STATIC
Common/Data/Text/WrapText.cpp
Common/Data/Text/WrapText.h
Common/Data/Random/Rng.h
Common/File/VFS/VFS.h
Common/File/VFS/VFS.cpp
Common/File/VFS/AssetReader.cpp
Common/File/VFS/AssetReader.h
Common/File/DiskFree.h
Common/File/DiskFree.cpp
Common/File/PathBrowser.h
Common/File/PathBrowser.cpp
Common/Input/GestureDetector.cpp
Common/Input/GestureDetector.h
Common/Input/KeyCodes.h
Common/Input/InputState.cpp
Common/Input/InputState.h
Common/Math/fast/fast_math.c
Common/Math/fast/fast_matrix.c
Common/Math/fast/fast_matrix_neon.S
Common/Math/fast/fast_matrix_sse.c
Common/Math/curves.cpp
Common/Math/curves.h
Common/Math/expression_parser.cpp
Common/Math/expression_parser.h
Common/Math/lin/matrix4x4.cpp
Common/Math/lin/matrix4x4.h
Common/Math/lin/vec3.cpp
Common/Math/lin/vec3.h
Common/Math/math_util.cpp
Common/Math/math_util.h
Common/Profiler/Profiler.cpp
Common/Profiler/Profiler.h
Common/System/Display.cpp
Common/System/Display.h
Common/Thread/Executor.cpp
Common/Thread/Executor.h
Common/Thread/PrioritizedWorkQueue.cpp
@ -486,8 +522,6 @@ add_library(Common STATIC
Common/ExceptionHandlerSetup.h
Common/FileUtil.cpp
Common/FileUtil.h
Common/KeyMap.cpp
Common/KeyMap.h
Common/Hashmaps.h
Common/Log.h
Common/Log.cpp
@ -780,7 +814,6 @@ if(ANDROID)
)
set(NativeAppSource ${NativeAppSource}
ext/native/base/NativeApp.h
android/jni/app-android.cpp
android/jni/AndroidEGLContext.cpp
android/jni/AndroidEGLContext.h
@ -978,23 +1011,10 @@ endif()
add_library(native STATIC
${nativeExtra}
ext/native/base/display.cpp
ext/native/base/display.h
ext/native/file/chunk_file.cpp
ext/native/file/chunk_file.h
ext/native/file/fd_util.cpp
ext/native/file/fd_util.h
ext/native/file/file_util.cpp
ext/native/file/file_util.h
ext/native/file/free.cpp
ext/native/file/free.h
ext/native/file/ini_file.cpp
ext/native/file/ini_file.h
ext/native/file/path.cpp
ext/native/file/path.h
ext/native/file/vfs.h
ext/native/file/zip_read.cpp
ext/native/file/zip_read.h
ext/native/gfx/gl_common.h
ext/native/gfx/gl_debug_log.cpp
ext/native/gfx/gl_debug_log.h
@ -1026,26 +1046,6 @@ add_library(native STATIC
ext/native/image/zim_load.h
ext/native/image/zim_save.cpp
ext/native/image/zim_save.h
ext/native/json/json_reader.h
ext/native/json/json_reader.cpp
ext/native/json/json_writer.h
ext/native/json/json_writer.cpp
ext/native/math/fast/fast_math.c
ext/native/math/fast/fast_matrix.c
ext/native/math/fast/fast_matrix_neon.S
ext/native/math/fast/fast_matrix_sse.c
ext/native/math/dataconv.cpp
ext/native/math/dataconv.h
ext/native/math/curves.cpp
ext/native/math/curves.h
ext/native/math/expression_parser.cpp
ext/native/math/expression_parser.h
ext/native/math/lin/matrix4x4.cpp
ext/native/math/lin/matrix4x4.h
ext/native/math/lin/vec3.cpp
ext/native/math/lin/vec3.h
ext/native/math/math_util.cpp
ext/native/math/math_util.h
ext/native/net/http_client.cpp
ext/native/net/http_client.h
ext/native/net/http_headers.cpp
@ -1060,8 +1060,6 @@ add_library(native STATIC
ext/native/net/url.h
ext/native/net/websocket_server.cpp
ext/native/net/websocket_server.h
ext/native/profiler/profiler.cpp
ext/native/profiler/profiler.h
ext/native/thin3d/thin3d.cpp
ext/native/thin3d/thin3d.h
ext/native/thin3d/thin3d_create.h
@ -1465,6 +1463,8 @@ add_library(${CoreLibName} ${CoreLinkType}
Core/HDRemaster.h
Core/Instance.cpp
Core/Instance.h
Core/KeyMap.cpp
Core/KeyMap.h
Core/ThreadEventQueue.h
Core/WebServer.cpp
Core/WebServer.h

View File

@ -12,13 +12,12 @@
#include <cstdlib>
#include <cstring>
#include "Arm64Emitter.h"
#include "MathUtil.h"
#include "CommonTypes.h"
#include "CommonWindows.h"
#include "CPUDetect.h"
#include "CommonWindows.h"
#include "Common/Arm64Emitter.h"
#include "Common/MathUtil.h"
#include "Common/CommonTypes.h"
#include "Common/CommonWindows.h"
#include "Common/CPUDetect.h"
#include "Common/Log.h"
#ifdef IOS
#include <libkern/OSCacheControl.h>

View File

@ -6,10 +6,11 @@
#include <functional>
#include "ArmCommon.h"
#include "BitSet.h"
#include "CodeBlock.h"
#include "Common.h"
#include "Common/ArmCommon.h"
#include "Common/BitSet.h"
#include "Common/CodeBlock.h"
#include "Common/Common.h"
#include "Common/Log.h"
#define DYNA_REC JIT

View File

@ -20,9 +20,10 @@
#include <vector>
#include <cstdint>
#include "Common.h"
#include "ArmCommon.h"
#include "CodeBlock.h"
#include "Common/Common.h"
#include "Common/Log.h"
#include "Common/ArmCommon.h"
#include "Common/CodeBlock.h"
// VCVT flags
#define TO_FLOAT 0

View File

@ -5,8 +5,10 @@
#pragma once
#include <cstddef>
#include "Common.h"
#include "MemoryUtil.h"
#include "Common/CommonTypes.h"
#include "Common/Log.h"
#include "Common/MemoryUtil.h"
// Everything that needs to generate code should inherit from this.
// You get memory management for free, plus, you can use all emitter functions without

View File

@ -28,7 +28,6 @@
#pragma warning(disable:4996)
#endif
#include "Log.h"
#include "CommonTypes.h"
#include "CommonFuncs.h"

View File

@ -362,20 +362,38 @@
<ClInclude Include="Data\Collections\ConstMap.h" />
<ClInclude Include="Data\Collections\TinySet.h" />
<ClInclude Include="Data\Color\RGBAUtil.h" />
<ClInclude Include="Data\Convert\SmallDataConvert.h" />
<ClInclude Include="Data\Encoding\Base64.h" />
<ClInclude Include="Data\Encoding\Compression.h" />
<ClInclude Include="Data\Encoding\Shiftjis.h" />
<ClInclude Include="Data\Encoding\Utf16.h" />
<ClInclude Include="Data\Encoding\Utf8.h" />
<ClInclude Include="Data\Format\IniFile.h" />
<ClInclude Include="Data\Format\JSONReader.h" />
<ClInclude Include="Data\Format\JSONWriter.h" />
<ClInclude Include="Data\Format\RIFF.h" />
<ClInclude Include="Data\Hash\Hash.h" />
<ClInclude Include="Data\Random\Rng.h" />
<ClInclude Include="Data\Text\I18n.h" />
<ClInclude Include="Data\Text\Parsers.h" />
<ClInclude Include="Data\Text\WrapText.h" />
<ClInclude Include="FakeEmitter.h" />
<ClInclude Include="File\DiskFree.h" />
<ClInclude Include="File\PathBrowser.h" />
<ClInclude Include="File\VFS\VFS.h" />
<ClInclude Include="File\VFS\AssetReader.h" />
<ClInclude Include="Input\GestureDetector.h" />
<ClInclude Include="Input\InputState.h" />
<ClInclude Include="Input\KeyCodes.h" />
<ClInclude Include="Math\curves.h" />
<ClInclude Include="Math\expression_parser.h" />
<ClInclude Include="Math\fast\fast_math.h" />
<ClInclude Include="Math\fast\fast_matrix.h" />
<ClInclude Include="Math\geom2d.h" />
<ClInclude Include="Math\lin\matrix4x4.h" />
<ClInclude Include="Math\lin\vec3.h" />
<ClInclude Include="Math\math_util.h" />
<ClInclude Include="Profiler\Profiler.h" />
<ClInclude Include="Serialize\SerializeDeque.h" />
<ClInclude Include="Serialize\SerializeFuncs.h" />
<ClInclude Include="ColorConvNEON.h" />
@ -420,7 +438,6 @@
</ClInclude>
<ClInclude Include="GraphicsContext.h" />
<ClInclude Include="Hashmaps.h" />
<ClInclude Include="KeyMap.h" />
<ClInclude Include="Log.h" />
<ClInclude Include="LogManager.h" />
<ClInclude Include="MakeUnique.h" />
@ -434,6 +451,9 @@
<ClInclude Include="StringUtils.h" />
<ClInclude Include="Swap.h" />
<ClInclude Include="SysError.h" />
<ClInclude Include="System\Display.h" />
<ClInclude Include="System\NativeApp.h" />
<ClInclude Include="System\System.h" />
<ClInclude Include="ThreadPools.h" />
<ClInclude Include="ThreadSafeList.h" />
<ClInclude Include="Thread\Executor.h" />
@ -628,16 +648,34 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">false</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="Data\Color\RGBAUtil.cpp" />
<ClCompile Include="Data\Convert\SmallDataConvert.cpp" />
<ClCompile Include="Data\Encoding\Base64.cpp" />
<ClCompile Include="Data\Encoding\Compression.cpp" />
<ClCompile Include="Data\Encoding\Utf8.cpp" />
<ClCompile Include="Data\Format\IniFile.cpp" />
<ClCompile Include="Data\Format\JSONReader.cpp" />
<ClCompile Include="Data\Format\JSONWriter.cpp" />
<ClCompile Include="Data\Format\RIFF.cpp" />
<ClCompile Include="Data\Hash\Hash.cpp" />
<ClCompile Include="Data\Text\I18n.cpp" />
<ClCompile Include="Data\Text\Parsers.cpp" />
<ClCompile Include="Data\Text\WrapText.cpp" />
<ClCompile Include="File\DiskFree.cpp" />
<ClCompile Include="File\PathBrowser.cpp" />
<ClCompile Include="File\VFS\VFS.cpp" />
<ClCompile Include="File\VFS\AssetReader.cpp" />
<ClCompile Include="Input\GestureDetector.cpp" />
<ClCompile Include="Input\InputState.cpp" />
<ClCompile Include="Log.cpp" />
<ClCompile Include="Math\curves.cpp" />
<ClCompile Include="Math\expression_parser.cpp" />
<ClCompile Include="Math\fast\fast_math.c" />
<ClCompile Include="Math\fast\fast_matrix.c" />
<ClCompile Include="Math\fast\fast_matrix_sse.c" />
<ClCompile Include="Math\lin\matrix4x4.cpp" />
<ClCompile Include="Math\lin\vec3.cpp" />
<ClCompile Include="Math\math_util.cpp" />
<ClCompile Include="Profiler\Profiler.cpp" />
<ClCompile Include="Serialize\Serializer.cpp" />
<ClCompile Include="ColorConv.cpp" />
<ClCompile Include="ConsoleListener.cpp" />
@ -677,7 +715,6 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="KeyMap.cpp" />
<ClCompile Include="LogManager.cpp" />
<ClCompile Include="MemArenaAndroid.cpp" />
<ClCompile Include="MemArenaPosix.cpp" />
@ -688,6 +725,7 @@
<ClCompile Include="SysError.cpp" />
<ClCompile Include="OSVersion.cpp" />
<ClCompile Include="StringUtils.cpp" />
<ClCompile Include="System\Display.cpp" />
<ClCompile Include="ThreadPools.cpp" />
<ClCompile Include="Thread\Executor.cpp" />
<ClCompile Include="Thread\PrioritizedWorkQueue.cpp" />
@ -712,6 +750,10 @@
<Project>{f761046e-6c38-4428-a5f1-38391a37bb34}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="Math\fast\fast_matrix_neon.S" />
<None Include="Math\lin\matrix_neon.s" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>

View File

@ -23,7 +23,6 @@
<ClInclude Include="Crypto\md5.h">
<Filter>Crypto</Filter>
</ClInclude>
<ClInclude Include="KeyMap.h" />
<ClInclude Include="Swap.h" />
<ClInclude Include="CommonWindows.h" />
<ClInclude Include="Crypto\sha1.h">
@ -176,6 +175,69 @@
<ClInclude Include="Data\Color\RGBAUtil.h">
<Filter>Data\Color</Filter>
</ClInclude>
<ClInclude Include="Data\Convert\SmallDataConvert.h">
<Filter>Data\Convert</Filter>
</ClInclude>
<ClInclude Include="Math\curves.h">
<Filter>Math</Filter>
</ClInclude>
<ClInclude Include="Math\expression_parser.h">
<Filter>Math</Filter>
</ClInclude>
<ClInclude Include="Math\geom2d.h">
<Filter>Math</Filter>
</ClInclude>
<ClInclude Include="Math\math_util.h">
<Filter>Math</Filter>
</ClInclude>
<ClInclude Include="Math\lin\matrix4x4.h">
<Filter>Math\lin</Filter>
</ClInclude>
<ClInclude Include="Math\lin\vec3.h">
<Filter>Math\lin</Filter>
</ClInclude>
<ClInclude Include="Math\fast\fast_math.h">
<Filter>Math\fast</Filter>
</ClInclude>
<ClInclude Include="Math\fast\fast_matrix.h">
<Filter>Math\fast</Filter>
</ClInclude>
<ClInclude Include="Data\Format\RIFF.h">
<Filter>Data\Format</Filter>
</ClInclude>
<ClInclude Include="File\DiskFree.h">
<Filter>File</Filter>
</ClInclude>
<ClInclude Include="File\PathBrowser.h">
<Filter>File</Filter>
</ClInclude>
<ClInclude Include="File\VFS\VFS.h">
<Filter>File\VFS</Filter>
</ClInclude>
<ClInclude Include="File\VFS\AssetReader.h">
<Filter>File\VFS</Filter>
</ClInclude>
<ClInclude Include="Data\Format\IniFile.h">
<Filter>Data\Format</Filter>
</ClInclude>
<ClInclude Include="Data\Format\JSONReader.h">
<Filter>Data\Format</Filter>
</ClInclude>
<ClInclude Include="Data\Format\JSONWriter.h">
<Filter>Data\Format</Filter>
</ClInclude>
<ClInclude Include="Profiler\Profiler.h">
<Filter>Profiler</Filter>
</ClInclude>
<ClInclude Include="System\Display.h">
<Filter>System</Filter>
</ClInclude>
<ClInclude Include="System\System.h">
<Filter>System</Filter>
</ClInclude>
<ClInclude Include="System\NativeApp.h">
<Filter>System</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="ABI.cpp" />
@ -195,7 +257,6 @@
<ClCompile Include="Crypto\md5.cpp">
<Filter>Crypto</Filter>
</ClCompile>
<ClCompile Include="KeyMap.cpp" />
<ClCompile Include="Crypto\sha1.cpp">
<Filter>Crypto</Filter>
</ClCompile>
@ -333,6 +394,63 @@
<ClCompile Include="Data\Color\RGBAUtil.cpp">
<Filter>Data\Color</Filter>
</ClCompile>
<ClCompile Include="Data\Convert\SmallDataConvert.cpp">
<Filter>Data\Convert</Filter>
</ClCompile>
<ClCompile Include="Math\curves.cpp">
<Filter>Math</Filter>
</ClCompile>
<ClCompile Include="Math\expression_parser.cpp">
<Filter>Math</Filter>
</ClCompile>
<ClCompile Include="Math\math_util.cpp">
<Filter>Math</Filter>
</ClCompile>
<ClCompile Include="Math\lin\matrix4x4.cpp">
<Filter>Math\lin</Filter>
</ClCompile>
<ClCompile Include="Math\lin\vec3.cpp">
<Filter>Math\lin</Filter>
</ClCompile>
<ClCompile Include="Math\fast\fast_math.c">
<Filter>Math\fast</Filter>
</ClCompile>
<ClCompile Include="Math\fast\fast_matrix.c">
<Filter>Math\fast</Filter>
</ClCompile>
<ClCompile Include="Math\fast\fast_matrix_sse.c">
<Filter>Math\fast</Filter>
</ClCompile>
<ClCompile Include="Data\Format\RIFF.cpp">
<Filter>Data\Format</Filter>
</ClCompile>
<ClCompile Include="File\DiskFree.cpp">
<Filter>File</Filter>
</ClCompile>
<ClCompile Include="File\PathBrowser.cpp">
<Filter>File</Filter>
</ClCompile>
<ClCompile Include="File\VFS\VFS.cpp">
<Filter>File\VFS</Filter>
</ClCompile>
<ClCompile Include="File\VFS\AssetReader.cpp">
<Filter>File\VFS</Filter>
</ClCompile>
<ClCompile Include="Data\Format\IniFile.cpp">
<Filter>Data\Format</Filter>
</ClCompile>
<ClCompile Include="Data\Format\JSONReader.cpp">
<Filter>Data\Format</Filter>
</ClCompile>
<ClCompile Include="Data\Format\JSONWriter.cpp">
<Filter>Data\Format</Filter>
</ClCompile>
<ClCompile Include="Profiler\Profiler.cpp">
<Filter>Profiler</Filter>
</ClCompile>
<ClCompile Include="System\Display.cpp">
<Filter>System</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="Crypto">
@ -383,10 +501,45 @@
<Filter Include="Data\Color">
<UniqueIdentifier>{1ada1f0f-6f1c-4bf2-8450-1fc63d77da17}</UniqueIdentifier>
</Filter>
<Filter Include="Math">
<UniqueIdentifier>{9f70c234-1671-49db-aa45-1a6a75698a40}</UniqueIdentifier>
</Filter>
<Filter Include="Data\Convert">
<UniqueIdentifier>{98967255-542c-490d-9183-a4b21c074703}</UniqueIdentifier>
</Filter>
<Filter Include="Math\lin">
<UniqueIdentifier>{aa083b68-34ed-4679-a8de-1797a00a1772}</UniqueIdentifier>
</Filter>
<Filter Include="Math\fast">
<UniqueIdentifier>{ffa5052d-e78f-4c47-a43e-e3537c5e7ad0}</UniqueIdentifier>
</Filter>
<Filter Include="Data\Format">
<UniqueIdentifier>{3eebbd6c-0c35-4dac-9869-5d38419432a6}</UniqueIdentifier>
</Filter>
<Filter Include="File">
<UniqueIdentifier>{d9e60709-9bf4-4bc7-b902-742219df7ffb}</UniqueIdentifier>
</Filter>
<Filter Include="File\VFS">
<UniqueIdentifier>{b10822cf-4cc0-4bc3-91a9-b20cb66e5cbd}</UniqueIdentifier>
</Filter>
<Filter Include="Profiler">
<UniqueIdentifier>{8321632b-8fc5-4a67-adb7-126a328d50eb}</UniqueIdentifier>
</Filter>
<Filter Include="System">
<UniqueIdentifier>{89ddf0bd-3fc4-4a69-87a7-b82cfc412e0a}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<Text Include="..\ext\libpng17\CMakeLists.txt">
<Filter>ext\libpng17</Filter>
</Text>
</ItemGroup>
<ItemGroup>
<None Include="Math\lin\matrix_neon.s">
<Filter>Math\lin</Filter>
</None>
<None Include="Math\fast\fast_matrix_neon.S">
<Filter>Math\fast</Filter>
</None>
</ItemGroup>
</Project>

View File

@ -22,14 +22,6 @@
#pragma once
struct u24_be {
unsigned char value[3];
operator unsigned int(){
return 0x00000000 | (value[0] << 16) | (value[1] << 8) | (value[2] << 0);
}
};
#if defined(_MSC_VER)
typedef unsigned __int8 u8;

View File

@ -1,3 +1,3 @@
#include "dataconv.h"
#include "Common/Data/Convert/SmallDataConvert.h"
alignas(16) const float one_over_255_x4[4] = { 1.0f / 255.0f, 1.0f / 255.0f, 1.0f / 255.0f, 1.0f / 255.0f, };

View File

@ -16,8 +16,8 @@
#include <string>
#include <vector>
#include "file/ini_file.h"
#include "file/vfs.h"
#include "Common/Data/Format/IniFile.h"
#include "Common/File/VFS/VFS.h"
#include "Common/Data/Text/Parsers.h"
#ifdef _WIN32

View File

@ -1,6 +1,5 @@
#include "file/zip_read.h"
#include "file/vfs.h"
#include "json/json_reader.h"
#include "Common/File/VFS/VFS.h"
#include "Common/Data/Format/JSONReader.h"
namespace json {

View File

@ -2,8 +2,8 @@
#include <cmath>
#include <cstring>
#include "json/json_reader.h"
#include "json/json_writer.h"
#include "Common/Data/Format/JSONReader.h"
#include "Common/Data/Format/JSONWriter.h"
namespace json {

View File

@ -1,8 +1,7 @@
#include "file/chunk_file.h"
#include "file/zip_read.h"
#include "file/file_util.h"
#include <cstring>
#include "Common/Log.h"
#include "Common/Data/Format/RIFF.h"
inline uint32_t flipID(uint32_t id) {
return ((id >> 24) & 0xFF) | ((id >> 8) & 0xFF00) | ((id << 8) & 0xFF0000) | ((id << 24) & 0xFF000000);

View File

@ -1,6 +1,6 @@
#pragma once
// Simple RIFF file format reader/writer.
// Simple RIFF file format reader.
// Unrelated to the ChunkFile.h used in Dolphin and PPSSPP.
// TO REMEMBER WHEN USING:
@ -10,7 +10,6 @@
// otherwise the scheme breaks.
#include <string>
#include <cstdio>
#include <cstdint>
class RIFFReader {

View File

@ -1,6 +1,6 @@
#include "Common/Data/Text/I18n.h"
#include "file/ini_file.h"
#include "file/vfs.h"
#include "Common/Data/Format/IniFile.h"
#include "Common/File/VFS/VFS.h"
#include "Common/StringUtils.h"

View File

@ -2,12 +2,13 @@
#include <cstring>
#include <set>
#include "Common/StringUtils.h"
#include "Common/TimeUtil.h"
#include "file/path.h"
#include "net/http_client.h"
#include "net/url.h"
#include "Common/File/PathBrowser.h"
#include "Common/StringUtils.h"
#include "Common/TimeUtil.h"
#include "Common/Log.h"
#include "Common/Thread/ThreadUtil.h"
bool LoadRemoteFileList(const std::string &url, bool *cancel, std::vector<FileInfo> &files) {

View File

@ -3,7 +3,7 @@
#include <condition_variable>
#include <mutex>
#include <string>
#include <string.h>
#include <cstring>
#include <thread>
#include <vector>
#include <stdlib.h>
@ -36,7 +36,7 @@ public:
// Do nothing
#elif defined(__linux)
char *home = getenv("HOME");
if (home != NULL && !strncmp(str.c_str(), home, strlen(home))) {
if (home != nullptr && !strncmp(str.c_str(), home, strlen(home))) {
str = str.substr(strlen(home));
str.insert(0, 1, '~');
}

View File

@ -7,10 +7,9 @@
#include <zip.h>
#endif
#include "file/zip_read.h"
#include "Common/Common.h"
#include "Common/Log.h"
#include "Common/File/VFS/AssetReader.h"
#ifdef __ANDROID__
uint8_t *ReadFromZip(zip *archive, const char* filename, size_t *size) {
@ -34,34 +33,6 @@ uint8_t *ReadFromZip(zip *archive, const char* filename, size_t *size) {
#endif
// The return is non-const because - why not?
uint8_t *ReadLocalFile(const char *filename, size_t *size) {
FILE *file = openCFile(filename, "rb");
if (!file) {
*size = 0;
return nullptr;
}
fseek(file, 0, SEEK_END);
size_t f_size = ftell(file);
if ((long)f_size < 0) {
*size = 0;
fclose(file);
return nullptr;
}
fseek(file, 0, SEEK_SET);
uint8_t *contents = new uint8_t[f_size+1];
if (fread(contents, 1, f_size, file) != f_size) {
delete [] contents;
contents = nullptr;
*size = 0;
} else {
contents[f_size] = 0;
*size = f_size;
}
fclose(file);
return contents;
}
#ifdef __ANDROID__
ZipAssetReader::ZipAssetReader(const char *zip_file, const char *in_zip_path) {
@ -258,118 +229,3 @@ bool DirectoryAssetReader::GetFileInfo(const char *path, FileInfo *info)
strcat(new_path, path);
return getFileInfo(new_path, info);
}
struct VFSEntry {
const char *prefix;
AssetReader *reader;
};
static VFSEntry entries[16];
static int num_entries = 0;
void VFSRegister(const char *prefix, AssetReader *reader) {
entries[num_entries].prefix = prefix;
entries[num_entries].reader = reader;
DEBUG_LOG(IO, "Registered VFS for prefix %s: %s", prefix, reader->toString().c_str());
num_entries++;
}
void VFSShutdown() {
for (int i = 0; i < num_entries; i++) {
delete entries[i].reader;
}
num_entries = 0;
}
static bool IsLocalPath(const char *path) {
bool isUnixLocal = path[0] == '/';
#ifdef _WIN32
bool isWindowsLocal = isalpha(path[0]) && path[1] == ':';
#else
bool isWindowsLocal = false;
#endif
return isUnixLocal || isWindowsLocal;
}
// The returned data should be free'd with delete[].
uint8_t *VFSReadFile(const char *filename, size_t *size) {
if (IsLocalPath(filename)) {
// Local path, not VFS.
// INFO_LOG(IO, "Not a VFS path: %s . Reading local file.", filename);
return ReadLocalFile(filename, size);
}
int fn_len = (int)strlen(filename);
bool fileSystemFound = false;
for (int i = 0; i < num_entries; i++) {
int prefix_len = (int)strlen(entries[i].prefix);
if (prefix_len >= fn_len) continue;
if (0 == memcmp(filename, entries[i].prefix, prefix_len)) {
fileSystemFound = true;
// INFO_LOG(IO, "Prefix match: %s (%s) -> %s", entries[i].prefix, filename, filename + prefix_len);
uint8_t *data = entries[i].reader->ReadAsset(filename + prefix_len, size);
if (data)
return data;
else
continue;
// Else try the other registered file systems.
}
}
if (!fileSystemFound) {
ERROR_LOG(IO, "Missing filesystem for '%s'", filename);
} // Otherwise, the file was just missing. No need to log.
return 0;
}
bool VFSGetFileListing(const char *path, std::vector<FileInfo> *listing, const char *filter) {
if (IsLocalPath(path)) {
// Local path, not VFS.
// INFO_LOG(IO, "Not a VFS path: %s . Reading local directory.", path);
getFilesInDir(path, listing, filter);
return true;
}
int fn_len = (int)strlen(path);
bool fileSystemFound = false;
for (int i = 0; i < num_entries; i++) {
int prefix_len = (int)strlen(entries[i].prefix);
if (prefix_len >= fn_len) continue;
if (0 == memcmp(path, entries[i].prefix, prefix_len)) {
fileSystemFound = true;
if (entries[i].reader->GetFileListing(path + prefix_len, listing, filter)) {
return true;
}
}
}
if (!fileSystemFound) {
ERROR_LOG(IO, "Missing filesystem for %s", path);
} // Otherwise, the file was just missing. No need to log.
return false;
}
bool VFSGetFileInfo(const char *path, FileInfo *info) {
if (IsLocalPath(path)) {
// Local path, not VFS.
// INFO_LOG(IO, "Not a VFS path: %s . Getting local file info.", path);
return getFileInfo(path, info);
}
bool fileSystemFound = false;
int fn_len = (int)strlen(path);
for (int i = 0; i < num_entries; i++) {
int prefix_len = (int)strlen(entries[i].prefix);
if (prefix_len >= fn_len) continue;
if (0 == memcmp(path, entries[i].prefix, prefix_len)) {
fileSystemFound = true;
if (entries[i].reader->GetFileInfo(path + prefix_len, info))
return true;
else
continue;
}
}
if (!fileSystemFound) {
ERROR_LOG(IO, "Missing filesystem for %s", path);
} // Otherwise, the file was just missing. No need to log.
return false;
}

View File

@ -8,7 +8,7 @@
#include <string.h>
#include <string>
#include "file/vfs.h"
#include "Common/File/VFS/VFS.h"
#include "file/file_util.h"
// Direct readers. deallocate using delete [].

118
Common/File/VFS/VFS.cpp Normal file
View File

@ -0,0 +1,118 @@
#include "Common/Log.h"
#include "Common/File/VFS/VFS.h"
#include "Common/File/VFS/AssetReader.h"
struct VFSEntry {
const char *prefix;
AssetReader *reader;
};
static VFSEntry entries[16];
static int num_entries = 0;
void VFSRegister(const char *prefix, AssetReader *reader) {
entries[num_entries].prefix = prefix;
entries[num_entries].reader = reader;
DEBUG_LOG(IO, "Registered VFS for prefix %s: %s", prefix, reader->toString().c_str());
num_entries++;
}
void VFSShutdown() {
for (int i = 0; i < num_entries; i++) {
delete entries[i].reader;
}
num_entries = 0;
}
static bool IsLocalPath(const char *path) {
bool isUnixLocal = path[0] == '/';
#ifdef _WIN32
bool isWindowsLocal = isalpha(path[0]) && path[1] == ':';
#else
bool isWindowsLocal = false;
#endif
return isUnixLocal || isWindowsLocal;
}
// The returned data should be free'd with delete[].
uint8_t *VFSReadFile(const char *filename, size_t *size) {
if (IsLocalPath(filename)) {
// Local path, not VFS.
// INFO_LOG(IO, "Not a VFS path: %s . Reading local file.", filename);
return ReadLocalFile(filename, size);
}
int fn_len = (int)strlen(filename);
bool fileSystemFound = false;
for (int i = 0; i < num_entries; i++) {
int prefix_len = (int)strlen(entries[i].prefix);
if (prefix_len >= fn_len) continue;
if (0 == memcmp(filename, entries[i].prefix, prefix_len)) {
fileSystemFound = true;
// INFO_LOG(IO, "Prefix match: %s (%s) -> %s", entries[i].prefix, filename, filename + prefix_len);
uint8_t *data = entries[i].reader->ReadAsset(filename + prefix_len, size);
if (data)
return data;
else
continue;
// Else try the other registered file systems.
}
}
if (!fileSystemFound) {
ERROR_LOG(IO, "Missing filesystem for '%s'", filename);
} // Otherwise, the file was just missing. No need to log.
return 0;
}
bool VFSGetFileListing(const char *path, std::vector<FileInfo> *listing, const char *filter) {
if (IsLocalPath(path)) {
// Local path, not VFS.
// INFO_LOG(IO, "Not a VFS path: %s . Reading local directory.", path);
getFilesInDir(path, listing, filter);
return true;
}
int fn_len = (int)strlen(path);
bool fileSystemFound = false;
for (int i = 0; i < num_entries; i++) {
int prefix_len = (int)strlen(entries[i].prefix);
if (prefix_len >= fn_len) continue;
if (0 == memcmp(path, entries[i].prefix, prefix_len)) {
fileSystemFound = true;
if (entries[i].reader->GetFileListing(path + prefix_len, listing, filter)) {
return true;
}
}
}
if (!fileSystemFound) {
ERROR_LOG(IO, "Missing filesystem for %s", path);
} // Otherwise, the file was just missing. No need to log.
return false;
}
bool VFSGetFileInfo(const char *path, FileInfo *info) {
if (IsLocalPath(path)) {
// Local path, not VFS.
// INFO_LOG(IO, "Not a VFS path: %s . Getting local file info.", path);
return getFileInfo(path, info);
}
bool fileSystemFound = false;
int fn_len = (int)strlen(path);
for (int i = 0; i < num_entries; i++) {
int prefix_len = (int)strlen(entries[i].prefix);
if (prefix_len >= fn_len) continue;
if (0 == memcmp(path, entries[i].prefix, prefix_len)) {
fileSystemFound = true;
if (entries[i].reader->GetFileInfo(path + prefix_len, info))
return true;
else
continue;
}
}
if (!fileSystemFound) {
ERROR_LOG(IO, "Missing filesystem for %s", path);
} // Otherwise, the file was just missing. No need to log.
return false;
}

View File

@ -27,6 +27,7 @@
#include <cstring>
#include <memory>
#include "Common/Log.h"
#include "Common/FileUtil.h"
#include "Common/StringUtils.h"
#include "Common/SysError.h"
@ -511,7 +512,7 @@ bool GetFileDetails(const std::string &filename, FileDetails *details) {
if (!GetFileAttributesEx(ConvertUTF8ToWString(filename).c_str(), GetFileExInfoStandard, &attr))
return false;
details->isDirectory = (attr.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
details->size = ((u64)attr.nFileSizeHigh << 32) | (u64)attr.nFileSizeLow;
details->size = ((uint64_t)attr.nFileSizeHigh << 32) | (uint64_t)attr.nFileSizeLow;
details->atime = FiletimeToStatTime(attr.ftLastAccessTime);
details->mtime = FiletimeToStatTime(attr.ftLastWriteTime);
details->ctime = FiletimeToStatTime(attr.ftCreationTime);
@ -588,14 +589,14 @@ std::string GetFilename(std::string path) {
// Returns the size of file (64bit)
// TODO: Add a way to return an error.
u64 GetFileSize(const std::string &filename) {
uint64_t GetFileSize(const std::string &filename) {
#if defined(_WIN32) && defined(UNICODE)
WIN32_FILE_ATTRIBUTE_DATA attr;
if (!GetFileAttributesEx(ConvertUTF8ToWString(filename).c_str(), GetFileExInfoStandard, &attr))
return 0;
if (attr.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
return 0;
return ((u64)attr.nFileSizeHigh << 32) | (u64)attr.nFileSizeLow;
return ((uint64_t)attr.nFileSizeHigh << 32) | (uint64_t)attr.nFileSizeLow;
#else
#if __ANDROID__ && __ANDROID_API__ < 21
struct stat file_info;
@ -618,14 +619,14 @@ u64 GetFileSize(const std::string &filename) {
}
// Overloaded GetSize, accepts FILE*
u64 GetFileSize(FILE *f) {
uint64_t GetFileSize(FILE *f) {
// can't use off_t here because it can be 32-bit
u64 pos = ftello(f);
uint64_t pos = ftello(f);
if (fseeko(f, 0, SEEK_END) != 0) {
ERROR_LOG(COMMON, "GetSize: seek failed %p: %s", f, GetLastErrorMsg().c_str());
return 0;
}
u64 size = ftello(f);
uint64_t size = ftello(f);
if ((size != pos) && (fseeko(f, pos, SEEK_SET) != 0)) {
ERROR_LOG(COMMON, "GetSize: seek failed %p: %s", f, GetLastErrorMsg().c_str());
return 0;
@ -904,7 +905,7 @@ void IOFile::SetHandle(std::FILE* file)
m_file = file;
}
u64 IOFile::GetSize()
uint64_t IOFile::GetSize()
{
if (IsOpen())
return File::GetFileSize(m_file);
@ -912,7 +913,7 @@ u64 IOFile::GetSize()
return 0;
}
bool IOFile::Seek(s64 off, int origin)
bool IOFile::Seek(int64_t off, int origin)
{
if (!IsOpen() || 0 != fseeko(m_file, off, origin))
m_good = false;
@ -920,7 +921,7 @@ bool IOFile::Seek(s64 off, int origin)
return m_good;
}
u64 IOFile::Tell()
uint64_t IOFile::Tell()
{
if (IsOpen())
return ftello(m_file);
@ -936,7 +937,7 @@ bool IOFile::Flush()
return m_good;
}
bool IOFile::Resize(u64 size)
bool IOFile::Resize(uint64_t size)
{
if (!IsOpen() || 0 !=
#ifdef _WIN32

View File

@ -22,6 +22,7 @@
#include <string>
#include <vector>
#include <time.h>
#include <cstdint>
#include "Common.h"
@ -37,7 +38,7 @@ namespace File {
struct FileDetails {
bool isDirectory;
u64 size;
uint64_t size;
uint64_t atime;
uint64_t mtime;
uint64_t ctime;
@ -70,10 +71,10 @@ std::string GetFilename(std::string path);
bool GetModifTime(const std::string &filename, tm &return_time);
// Returns the size of filename (64bit)
u64 GetFileSize(const std::string &filename);
uint64_t GetFileSize(const std::string &filename);
// Overloaded GetSize, accepts FILE*
u64 GetFileSize(FILE *f);
uint64_t GetFileSize(FILE *f);
// Returns true if successful, or path already exists.
bool CreateDir(const std::string &filename);
@ -114,13 +115,14 @@ bool SetCurrentDir(const std::string &directory);
const std::string &GetExeDirectory();
// simple wrapper for cstdlib file functions to
// hopefully will make error checking easier
// and make forgetting an fclose() harder
class IOFile {
public:
IOFile();
IOFile(std::FILE* file);
IOFile(FILE* file);
IOFile(const std::string& filename, const char openmode[]);
~IOFile();
@ -171,10 +173,10 @@ public:
void SetHandle(std::FILE* file);
bool Seek(s64 off, int origin);
u64 Tell();
u64 GetSize();
bool Resize(u64 size);
bool Seek(int64_t off, int origin);
uint64_t Tell();
uint64_t GetSize();
bool Resize(uint64_t size);
bool Flush();
// clear error state

View File

@ -1,5 +1,5 @@
#include "Common/Input/InputState.h"
#include "math/geom2d.h"
#include "Common/Math/geom2d.h"
// Mainly for detecting (multi-)touch gestures but also useable for left button mouse dragging etc.
// Currently only supports simple scroll-drags with inertia.

View File

@ -7,7 +7,7 @@
#include <vector>
#include <mutex>
#include "math/lin/vec3.h"
#include "Common/Math/lin/vec3.h"
#include "Common/Input/KeyCodes.h"
// Default device IDs

View File

@ -23,7 +23,7 @@
#include <mutex>
#include <vector>
#include "file/ini_file.h"
#include "Common/Data/Format/IniFile.h"
#include "Common/CommonFuncs.h"
#include "Common/Log.h"

View File

@ -1,7 +1,7 @@
#include <cmath>
#include "math/math_util.h"
#include "Common/Math/math_util.h"
#include "curves.h"
#include "Common/Common.h"

View File

@ -244,7 +244,7 @@ bool initPostfixExpression(const char* infix, IExpressionFunctions* funcs, Postf
isFloat = true;
else if (parseNumber(subStr,16,subPos,value) == false)
{
sprintf(expressionError,"Invalid number \"%s\"",subStr);
snprintf(expressionError, sizeof(expressionError), "Invalid number \"%s\"",subStr);
return false;
}
@ -273,14 +273,14 @@ bool initPostfixExpression(const char* infix, IExpressionFunctions* funcs, Postf
continue;
}
sprintf(expressionError,"Invalid symbol \"%s\"",subStr);
snprintf(expressionError, sizeof(expressionError), "Invalid symbol \"%s\"",subStr);
return false;
} else {
int len;
ExpressionOpcodeType type = getExpressionOpcode(&infix[infixPos],len,lastOpcode);
if (type == EXOP_NONE)
{
sprintf(expressionError,"Invalid operator at \"%s\"",&infix[infixPos]);
snprintf(expressionError, sizeof(expressionError), "Invalid operator at \"%s\"",&infix[infixPos]);
return false;
}
@ -295,7 +295,7 @@ bool initPostfixExpression(const char* infix, IExpressionFunctions* funcs, Postf
{
if (opcodeStack.empty())
{
sprintf(expressionError,"Closing parenthesis without opening one");
snprintf(expressionError, sizeof(expressionError), "Closing parenthesis without opening one");
return false;
}
ExpressionOpcodeType t = opcodeStack[opcodeStack.size()-1];
@ -309,7 +309,7 @@ bool initPostfixExpression(const char* infix, IExpressionFunctions* funcs, Postf
{
if (opcodeStack.empty())
{
sprintf(expressionError,"Closing bracket without opening one");
snprintf(expressionError, sizeof(expressionError), "Closing bracket without opening one");
return false;
}
ExpressionOpcodeType t = opcodeStack[opcodeStack.size()-1];
@ -362,7 +362,7 @@ bool initPostfixExpression(const char* infix, IExpressionFunctions* funcs, Postf
if (t == EXOP_BRACKETL) // opening bracket without closing one
{
sprintf(expressionError,"Parenthesis not closed");
snprintf(expressionError, sizeof(expressionError), "Parenthesis not closed");
return false;
}
dest.push_back(ExpressionPair(EXCOMM_OP,t));
@ -421,7 +421,7 @@ bool parsePostfixExpression(PostfixExpression& exp, IExpressionFunctions* funcs,
opcode = exp[num++].second;
if (valueStack.size() < ExpressionOpcodes[opcode].args)
{
sprintf(expressionError,"Not enough arguments");
snprintf(expressionError, sizeof(expressionError), "Not enough arguments");
return false;
}
for (int l = 0; l < ExpressionOpcodes[opcode].args; l++)
@ -437,7 +437,7 @@ bool parsePostfixExpression(PostfixExpression& exp, IExpressionFunctions* funcs,
case EXOP_MEMSIZE: // must be followed by EXOP_MEM
if (exp[num++].second != EXOP_MEM)
{
sprintf(expressionError,"Invalid memsize operator");
snprintf(expressionError, sizeof(expressionError), "Invalid memsize operator");
return false;
}
@ -481,7 +481,7 @@ bool parsePostfixExpression(PostfixExpression& exp, IExpressionFunctions* funcs,
case EXOP_DIV: // a/b
if (arg[0] == 0)
{
sprintf(expressionError,"Division by zero");
snprintf(expressionError, sizeof(expressionError), "Division by zero");
return false;
}
if (useFloat)
@ -492,7 +492,7 @@ bool parsePostfixExpression(PostfixExpression& exp, IExpressionFunctions* funcs,
case EXOP_MOD: // a%b
if (arg[0] == 0)
{
sprintf(expressionError,"Modulo by zero");
snprintf(expressionError, sizeof(expressionError), "Modulo by zero");
return false;
}
valueStack.push_back(arg[1]%arg[0]);
@ -565,7 +565,7 @@ bool parsePostfixExpression(PostfixExpression& exp, IExpressionFunctions* funcs,
case EXOP_TERTELSE: // exp ? exp : exp, else muss zuerst kommen!
if (exp[num++].second != EXOP_TERTIF)
{
sprintf(expressionError,"Invalid tertiary operator");
snprintf(expressionError, sizeof(expressionError), "Invalid tertiary operator");
return false;
}
valueStack.push_back(arg[2]?arg[1]:arg[0]);
@ -589,6 +589,6 @@ bool parseExpression(char* exp, IExpressionFunctions* funcs, uint32_t& dest)
const char* getExpressionError()
{
if (expressionError[0] == 0) strcpy(expressionError,"Invalid expression");
if (expressionError[0] == 0) snprintf(expressionError, sizeof(expressionError), "Invalid expression");
return expressionError;
}

View File

@ -1,9 +1,9 @@
#include "math/lin/matrix4x4.h"
#include "Common/Math/lin/matrix4x4.h"
#include <cstdio>
#include "math/lin/vec3.h"
#include "math/fast/fast_matrix.h"
#include "Common/Math/lin/vec3.h"
#include "Common/Math/fast/fast_matrix.h"
#ifdef _WIN32
#undef far

View File

@ -1,7 +1,7 @@
#ifndef _MATH_LIN_MATRIX4X4_H
#define _MATH_LIN_MATRIX4X4_H
#include "math/lin/vec3.h"
#include "Common/Math/lin/vec3.h"
namespace Lin {

View File

@ -1,7 +1,7 @@
#include <stdio.h>
#include "math/lin/vec3.h"
#include "math/lin/matrix4x4.h"
#include "Common/Math/lin/vec3.h"
#include "Common/Math/lin/matrix4x4.h"
namespace Lin {

View File

@ -1,4 +1,4 @@
#include "math/math_util.h"
#include "Common/Math/math_util.h"
#include <stdlib.h>
// QNX can only use RunFast mode and it is already the default.

View File

@ -27,11 +27,11 @@
#include <linux/ashmem.h>
#include <dlfcn.h>
#include "base/NativeApp.h"
#include "Common/Log.h"
#include "Common/MemoryUtil.h"
#include "Common/MemArena.h"
#include "Common/StringUtils.h"
#include "Common/System/System.h"
// Hopefully this ABI will never change...

View File

@ -20,11 +20,12 @@
#if defined(__APPLE__)
#include <string>
#include <inttypes.h>
#include <cstdint>
#include "FileUtil.h"
#include "MemoryUtil.h"
#include "MemArena.h"
#include "Common/Log.h"
#include "Common/FileUtil.h"
#include "Common/MemoryUtil.h"
#include "Common/MemArena.h"
#include <sys/stat.h>
#include <fcntl.h>

View File

@ -21,9 +21,10 @@
#include <string>
#include "FileUtil.h"
#include "MemoryUtil.h"
#include "MemArena.h"
#include "Common/FileUtil.h"
#include "Common/MemoryUtil.h"
#include "Common/MemArena.h"
#include "Common/Log.h"
#include <sys/stat.h>
#include <fcntl.h>

View File

@ -5,14 +5,14 @@
#include <map>
#include <string>
#include <vector>
#include <cstring>
#include <string.h>
#include "ppsspp_config.h"
#include "gfx_es2/draw_buffer.h"
#include "Common/TimeUtil.h"
#include "gfx_es2/draw_buffer.h"
#include "ppsspp_config.h"
#include "profiler/profiler.h"
#include "Common/Profiler/Profiler.h"
#include "Common/Log.h"
#define MAX_CATEGORIES 64 // Can be any number, represents max profiled names.

View File

@ -1,5 +1,5 @@
#include "base/display.h"
#include "math/math_util.h"
#include "Common/System/Display.h"
#include "Common/Math/math_util.h"
int dp_xres;
int dp_yres;

View File

@ -1,6 +1,6 @@
#pragma once
#include "math/lin/matrix4x4.h"
#include "Common/Math/lin/matrix4x4.h"
// This is meant to be a framework for handling DPI scaling etc.
// For now, it just consists of these ugly globals.

View File

@ -2,7 +2,6 @@
#include <functional>
#include <string>
#include <vector>
// The Native App API.
//
@ -17,17 +16,6 @@ struct AxisInput;
class GraphicsContext;
enum SystemPermission {
SYSTEM_PERMISSION_STORAGE,
};
enum PermissionStatus {
PERMISSION_STATUS_UNKNOWN,
PERMISSION_STATUS_DENIED,
PERMISSION_STATUS_PENDING,
PERMISSION_STATUS_GRANTED,
};
// The first function to get called, just write strings to the two pointers.
// This might get called multiple times in some implementations, you must be able to handle that.
void NativeGetAppInfo(std::string *app_dir_name, std::string *app_nice_name, bool *landscape, std::string *version);
@ -101,89 +89,3 @@ void NativeSetMixer(void* mixer);
// Main thread.
void NativeShutdownGraphics();
void NativeShutdown();
// Calls back into Java / SDL
// These APIs must be implemented by every port (for example app-android.cpp, SDLMain.cpp).
// You are free to call these.
void SystemToast(const char *text);
void ShowKeyboard();
// Vibrate either takes a number of milliseconds to vibrate unconditionally,
// or you can specify these constants for "standard" feedback. On Android,
// these will only be performed if haptic feedback is enabled globally.
// Also, on Android, these will work even if you don't have the VIBRATE permission,
// while generic vibration will not if you don't have it.
enum {
HAPTIC_SOFT_KEYBOARD = -1,
HAPTIC_VIRTUAL_KEY = -2,
HAPTIC_LONG_PRESS_ACTIVATED = -3,
};
void Vibrate(int length_ms);
void OpenDirectory(const char *path);
void LaunchBrowser(const char *url);
void LaunchMarket(const char *url);
void LaunchEmail(const char *email_address);
void System_InputBoxGetString(const std::string &title, const std::string &defaultValue, std::function<void(bool, const std::string &)> cb);
void System_SendMessage(const char *command, const char *parameter);
PermissionStatus System_GetPermissionStatus(SystemPermission permission);
void System_AskForPermission(SystemPermission permission);
// This will get muddy with multi-screen support :/ But this will always be the type of the main device.
enum SystemDeviceType {
DEVICE_TYPE_MOBILE = 0, // phones and pads
DEVICE_TYPE_TV = 1, // Android TV and similar
DEVICE_TYPE_DESKTOP = 2, // Desktop computer
};
enum SystemProperty {
SYSPROP_NAME,
SYSPROP_LANGREGION,
SYSPROP_CPUINFO,
SYSPROP_BOARDNAME,
SYSPROP_CLIPBOARD_TEXT,
SYSPROP_GPUDRIVER_VERSION,
SYSPROP_HAS_FILE_BROWSER,
SYSPROP_HAS_IMAGE_BROWSER,
SYSPROP_HAS_BACK_BUTTON,
// Available as Int:
SYSPROP_SYSTEMVERSION,
SYSPROP_DISPLAY_XRES,
SYSPROP_DISPLAY_YRES,
SYSPROP_DISPLAY_REFRESH_RATE,
SYSPROP_DISPLAY_LOGICAL_DPI,
SYSPROP_DISPLAY_DPI,
SYSPROP_DISPLAY_COUNT,
SYSPROP_MOGA_VERSION,
// Float only:
SYSPROP_DISPLAY_SAFE_INSET_LEFT,
SYSPROP_DISPLAY_SAFE_INSET_RIGHT,
SYSPROP_DISPLAY_SAFE_INSET_TOP,
SYSPROP_DISPLAY_SAFE_INSET_BOTTOM,
SYSPROP_DEVICE_TYPE,
SYSPROP_APP_GOLD, // To avoid having #ifdef GOLD other than in main.cpp and similar.
// Exposed on Android. Choosing the optimal sample rate for audio
// will result in lower latencies. Buffer size is automatically matched
// by the OpenSL audio backend, only exposed here for debugging/info.
SYSPROP_AUDIO_SAMPLE_RATE,
SYSPROP_AUDIO_FRAMES_PER_BUFFER,
SYSPROP_AUDIO_OPTIMAL_SAMPLE_RATE,
SYSPROP_AUDIO_OPTIMAL_FRAMES_PER_BUFFER,
// Exposed on SDL.
SYSPROP_AUDIO_DEVICE_LIST,
SYSPROP_SUPPORTS_PERMISSIONS,
SYSPROP_SUPPORTS_SUSTAINED_PERF_MODE,
};
std::string System_GetProperty(SystemProperty prop);
int System_GetPropertyInt(SystemProperty prop);
float System_GetPropertyFloat(SystemProperty prop);
bool System_GetPropertyBool(SystemProperty prop);
std::vector<std::string> __cameraGetDeviceList();

101
Common/System/System.h Normal file
View File

@ -0,0 +1,101 @@
#pragma once
#include <string>
#include <vector>
#include <functional>
enum SystemPermission {
SYSTEM_PERMISSION_STORAGE,
};
enum PermissionStatus {
PERMISSION_STATUS_UNKNOWN,
PERMISSION_STATUS_DENIED,
PERMISSION_STATUS_PENDING,
PERMISSION_STATUS_GRANTED,
};
// These APIs must be implemented by every port (for example app-android.cpp, SDLMain.cpp).
// Ideally these should be safe to call from any thread.
void SystemToast(const char *text);
void ShowKeyboard();
// Vibrate either takes a number of milliseconds to vibrate unconditionally,
// or you can specify these constants for "standard" feedback. On Android,
// these will only be performed if haptic feedback is enabled globally.
// Also, on Android, these will work even if you don't have the VIBRATE permission,
// while generic vibration will not if you don't have it.
enum {
HAPTIC_SOFT_KEYBOARD = -1,
HAPTIC_VIRTUAL_KEY = -2,
HAPTIC_LONG_PRESS_ACTIVATED = -3,
};
void Vibrate(int length_ms);
void OpenDirectory(const char *path);
void LaunchBrowser(const char *url);
void LaunchMarket(const char *url);
void LaunchEmail(const char *email_address);
void System_InputBoxGetString(const std::string &title, const std::string &defaultValue, std::function<void(bool, const std::string &)> cb);
void System_SendMessage(const char *command, const char *parameter);
PermissionStatus System_GetPermissionStatus(SystemPermission permission);
void System_AskForPermission(SystemPermission permission);
// This will get muddy with multi-screen support :/ But this will always be the type of the main device.
enum SystemDeviceType {
DEVICE_TYPE_MOBILE = 0, // phones and pads
DEVICE_TYPE_TV = 1, // Android TV and similar
DEVICE_TYPE_DESKTOP = 2, // Desktop computer
};
enum SystemProperty {
SYSPROP_NAME,
SYSPROP_LANGREGION,
SYSPROP_CPUINFO,
SYSPROP_BOARDNAME,
SYSPROP_CLIPBOARD_TEXT,
SYSPROP_GPUDRIVER_VERSION,
SYSPROP_HAS_FILE_BROWSER,
SYSPROP_HAS_IMAGE_BROWSER,
SYSPROP_HAS_BACK_BUTTON,
// Available as Int:
SYSPROP_SYSTEMVERSION,
SYSPROP_DISPLAY_XRES,
SYSPROP_DISPLAY_YRES,
SYSPROP_DISPLAY_REFRESH_RATE,
SYSPROP_DISPLAY_LOGICAL_DPI,
SYSPROP_DISPLAY_DPI,
SYSPROP_DISPLAY_COUNT,
SYSPROP_MOGA_VERSION,
// Float only:
SYSPROP_DISPLAY_SAFE_INSET_LEFT,
SYSPROP_DISPLAY_SAFE_INSET_RIGHT,
SYSPROP_DISPLAY_SAFE_INSET_TOP,
SYSPROP_DISPLAY_SAFE_INSET_BOTTOM,
SYSPROP_DEVICE_TYPE,
SYSPROP_APP_GOLD, // To avoid having #ifdef GOLD other than in main.cpp and similar.
// Exposed on Android. Choosing the optimal sample rate for audio
// will result in lower latencies. Buffer size is automatically matched
// by the OpenSL audio backend, only exposed here for debugging/info.
SYSPROP_AUDIO_SAMPLE_RATE,
SYSPROP_AUDIO_FRAMES_PER_BUFFER,
SYSPROP_AUDIO_OPTIMAL_SAMPLE_RATE,
SYSPROP_AUDIO_OPTIMAL_FRAMES_PER_BUFFER,
// Exposed on SDL.
SYSPROP_AUDIO_DEVICE_LIST,
SYSPROP_SUPPORTS_PERMISSIONS,
SYSPROP_SUPPORTS_SUSTAINED_PERF_MODE,
};
std::string System_GetProperty(SystemProperty prop);
int System_GetPropertyInt(SystemProperty prop);
float System_GetPropertyFloat(SystemProperty prop);
bool System_GetPropertyBool(SystemProperty prop);
std::vector<std::string> __cameraGetDeviceList();

View File

@ -5,7 +5,7 @@
#include <cstring>
#include <iostream>
#include "base/display.h"
#include "Common/System/Display.h"
#include "Common/Log.h"
#include "Common/Vulkan/VulkanContext.h"
#include "Common/Vulkan/VulkanDebug.h"

View File

@ -21,7 +21,7 @@
#include <cstring>
#include "Common/Log.h"
#include "base/NativeApp.h"
#include "Common/System/System.h"
#ifndef _WIN32
#include <dlfcn.h>

View File

@ -18,7 +18,7 @@
// Additionally, Common/Vulkan/* , including this file, are also licensed
// under the public domain.
#include "math/math_util.h"
#include "Common/Math/math_util.h"
#include "Common/Log.h"
#include "Common/TimeUtil.h"

View File

@ -15,14 +15,15 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _DOLPHIN_INTEL_CODEGEN_
#define _DOLPHIN_INTEL_CODEGEN_
#pragma once
#include "ppsspp_config.h"
#include <cstddef>
#include "Common.h"
#include "CodeBlock.h"
#include "Common/Common.h"
#include "Common/Log.h"
#include "Common/CodeBlock.h"
#if PPSSPP_ARCH(64BIT)
#define PTRBITS 64
@ -1083,5 +1084,3 @@ public:
};
} // namespace
#endif

View File

@ -16,7 +16,8 @@
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include <cstring>
#include "file/ini_file.h"
#include "Common/Data/Format/IniFile.h"
#include "Core/Compatibility.h"
#include "Core/System.h"

View File

@ -23,26 +23,28 @@
#include <sstream>
#include "ppsspp_config.h"
#include "base/display.h"
#include "base/NativeApp.h"
#include "file/ini_file.h"
#include "Common/Data/Text/I18n.h"
#include "json/json_reader.h"
#include "gfx_es2/gpu_features.h"
#include "net/http_client.h"
#include "Common/Data/Text/Parsers.h"
#include "net/url.h"
#include "Common/Log.h"
#include "Common/Data/Format/IniFile.h"
#include "Common/Data/Format/JSONReader.h"
#include "Common/Data/Text/I18n.h"
#include "Common/Data/Text/Parsers.h"
#include "Common/CPUDetect.h"
#include "Common/FileUtil.h"
#include "Common/KeyMap.h"
#include "Common/LogManager.h"
#include "Common/OSVersion.h"
#include "Common/System/Display.h"
#include "Common/System/System.h"
#include "Common/StringUtils.h"
#include "Common/Vulkan/VulkanLoader.h"
#include "Core/Config.h"
#include "Core/ConfigValues.h"
#include "Core/Loaders.h"
#include "Core/KeyMap.h"
#include "Core/HLE/sceUtility.h"
#include "Core/Instance.h"
#include "GPU/Common/FramebufferManagerCommon.h"

View File

@ -22,11 +22,12 @@
#include <mutex>
#include <condition_variable>
#include "base/NativeApp.h"
#include "base/display.h"
#include "Common/System/NativeApp.h"
#include "Common/System/System.h"
#include "Common/System/Display.h"
#include "Common/TimeUtil.h"
#include "Common/Thread/ThreadUtil.h"
#include "profiler/profiler.h"
#include "Common/Profiler/Profiler.h"
#include "Common/GraphicsContext.h"
#include "Common/Log.h"

View File

@ -453,6 +453,7 @@
<ClCompile Include="HW\BufferQueue.cpp" />
<ClCompile Include="HW\Camera.cpp" />
<ClCompile Include="Instance.cpp" />
<ClCompile Include="KeyMap.cpp" />
<ClCompile Include="MemFault.cpp" />
<ClCompile Include="MIPS\IR\IRAsm.cpp" />
<ClCompile Include="MIPS\IR\IRCompALU.cpp" />
@ -996,6 +997,7 @@
<ClInclude Include="HLE\sceUsbMic.h" />
<ClInclude Include="HW\Camera.h" />
<ClInclude Include="Instance.h" />
<ClInclude Include="KeyMap.h" />
<ClInclude Include="MemFault.h" />
<ClInclude Include="MIPS\IR\IRFrontend.h" />
<ClInclude Include="MIPS\IR\IRInst.h" />

View File

@ -959,6 +959,9 @@
<ClCompile Include="..\ext\libzip\zip_unchange_data.c">
<Filter>Ext\libzip</Filter>
</ClCompile>
<ClCompile Include="KeyMap.cpp">
<Filter>Core</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="ELF\ElfReader.h">
@ -1637,6 +1640,9 @@
<ClInclude Include="..\ext\libzip\zipint.h">
<Filter>Ext\libzip</Filter>
</ClInclude>
<ClInclude Include="KeyMap.h">
<Filter>Core</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="CMakeLists.txt" />

View File

@ -20,7 +20,7 @@
#include <cstdio>
#include <mutex>
#include "profiler/profiler.h"
#include "Common/Profiler/Profiler.h"
#include "Common/Serialize/Serializer.h"
#include "Common/Serialize/SerializeList.h"

View File

@ -19,7 +19,7 @@
#include <string>
#include <cstdio>
#include "Common/CommonTypes.h"
#include "math/expression_parser.h"
#include "Common/Math/expression_parser.h"
struct MemMap;

View File

@ -31,9 +31,11 @@
#include <algorithm>
#include <memory>
#include "Common/Data/Encoding/Utf8.h"
#include "zlib.h"
#include "Common/CommonTypes.h"
#include "Common/Data/Encoding/Utf8.h"
#include "Common/Log.h"
#include "Common/FileUtil.h"
#include "Common/StringUtils.h"
#include "Core/MemMap.h"

View File

@ -17,10 +17,17 @@
#include <cmath>
#include <limits>
#include "Common/Data/Text/Parsers.h"
#include "Common/StringUtils.h"
#include "Core/Debugger/WebSocket/WebSocketUtils.h"
inline void DebuggerJsonAddTicket(JsonWriter &writer, const JsonGet &data) {
const JsonNode *value = data.get("ticket");
if (value)
writer.writeRaw("ticket", json_stringify(value));
}
JsonWriter &DebuggerRequest::Respond() {
writer_.begin();
writer_.writeString("event", name);

View File

@ -17,15 +17,15 @@
#pragma once
#include "ppsspp_config.h"
#include <string>
#include "json/json_reader.h"
#include "json/json_writer.h"
#include "net/websocket_server.h"
#include "Common/Log.h"
#include "ppsspp_config.h"
#include "Common/Data/Format/JSONReader.h"
#include "Common/Data/Format/JSONWriter.h"
#if PPSSPP_PLATFORM(UWP)
// Enum name overlapped with UWP macro, quick hack to disable it
@ -34,12 +34,6 @@
using namespace json;
static inline void DebuggerJsonAddTicket(JsonWriter &writer, const JsonGet &data) {
const JsonNode *value = data.get("ticket");
if (value)
writer.writeRaw("ticket", json_stringify(value));
}
struct DebuggerErrorEvent {
DebuggerErrorEvent(const std::string m, LogTypes::LOG_LEVELS l, const JsonGet data = JsonValue(JSON_NULL))
: message(m), level(l) {

View File

@ -16,12 +16,14 @@
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include <algorithm>
#include "base/NativeApp.h"
#include "Common/Data/Text/I18n.h"
#include "math/math_util.h"
#include "Common/Data/Encoding/Utf8.h"
#include "Common/Data/Text/I18n.h"
#include "Common/Math/math_util.h"
#include "Common/Data/Encoding/Utf8.h"
#include "Common/Serialize/SerializeFuncs.h"
#include "Common/System/System.h"
#include "Common/Serialize/Serializer.h"
#include "Core/Dialog/PSPOskDialog.h"
#include "Core/Util/PPGeDraw.h"
#include "Core/HLE/sceCtrl.h"
@ -29,7 +31,6 @@
#include "Core/HLE/sceUtility.h"
#include "Core/Config.h"
#include "Core/Reporting.h"
#include "Common/Serialize/Serializer.h"
#include "GPU/GPUState.h"
#ifndef _WIN32

View File

@ -8,6 +8,7 @@ extern "C"
#include "ext/libkirk/SHA1.h"
}
#include "Common/Common.h"
#include "Common/Log.h"
#include "Common/Swap.h"
#include "Core/ELF/PrxDecrypter.h"

View File

@ -23,9 +23,10 @@
#include "ppsspp_config.h"
#include "file/file_util.h"
#include "file/free.h"
#include "Common/Data/Encoding/Utf8.h"
#include "Common/File/DiskFree.h"
#include "Common/FileUtil.h"
#include "Common/Log.h"
#include "Common/CommonWindows.h"
#include "Core/FileLoaders/DiskCachingFileLoader.h"
#include "Core/System.h"

View File

@ -18,6 +18,7 @@
#include <algorithm>
#include "Common/Common.h"
#include "Common/Log.h"
#include "Common/StringUtils.h"
#include "Core/FileLoaders/HTTPFileLoader.h"

View File

@ -18,8 +18,10 @@
#include <cstdio>
#include "ppsspp_config.h"
#include "Common/Data/Encoding/Utf8.h"
#include "file/file_util.h"
#include "Common/Data/Encoding/Utf8.h"
#include "Common/Log.h"
#include "Common/FileUtil.h"
#include "Core/FileLoaders/LocalFileLoader.h"

View File

@ -21,6 +21,7 @@
#include "Common/Data/Text/I18n.h"
#include "Common/FileUtil.h"
#include "Common/Log.h"
#include "Common/Swap.h"
#include "Core/Loaders.h"
#include "Core/Host.h"

View File

@ -20,14 +20,14 @@
#include <algorithm>
#include <limits>
#include "file/free.h"
#include "file/zip_read.h"
#include "Common/Data/Text/I18n.h"
#include "Common/Data/Encoding/Utf8.h"
#include "Common/Serialize/Serializer.h"
#include "Common/Serialize/SerializeFuncs.h"
#include "Common/StringUtils.h"
#include "Common/FileUtil.h"
#include "Common/File/DiskFree.h"
#include "Common/File/VFS/VFS.h"
#include "Core/FileSystems/DirectoryFileSystem.h"
#include "Core/FileSystems/ISOFileSystem.h"
#include "Core/HLE/sceKernel.h"

View File

@ -25,7 +25,6 @@
#include "Core/FileSystems/ISOFileSystem.h"
#include "Core/HLE/sceKernel.h"
#include "Core/Reporting.h"
#include "file/zip_read.h"
#include "Common/Data/Encoding/Utf8.h"
#ifdef _WIN32

View File

@ -23,7 +23,8 @@
#include <stdlib.h>
#include <string.h>
#include "Common.h"
#include "Common/Common.h"
#include "Common/Log.h"
/*************************************************************/

View File

@ -20,7 +20,7 @@
#include <vector>
#include <string>
#include "profiler/profiler.h"
#include "Common/Profiler/Profiler.h"
#include "Common/Log.h"
#include "Common/Serialize/SerializeFuncs.h"

View File

@ -17,7 +17,7 @@
#include <set>
#include "file/file_util.h"
#include "file/ini_file.h"
#include "Common/Data/Format/IniFile.h"
#include "Common/FileUtil.h"
#include "Common/Serialize/SerializeFuncs.h"
#include "Core/Config.h"

View File

@ -26,12 +26,11 @@
#include <sys/time.h>
#endif
#include "Common/Data/Text/I18n.h"
#include "profiler/profiler.h"
#include "base/NativeApp.h"
#include "gfx_es2/gpu_features.h"
#include "Common/Data/Text/I18n.h"
#include "Common/Profiler/Profiler.h"
#include "Common/System/System.h"
#include "Common/Serialize/Serializer.h"
#include "Common/Serialize/SerializeFuncs.h"
#include "Common/Serialize/SerializeMap.h"

View File

@ -20,7 +20,7 @@
#include <thread>
#include "Common/Thread/ThreadUtil.h"
#include "profiler/profiler.h"
#include "Common/Profiler/Profiler.h"
#include "Common/FileUtil.h"
#include "Common/Serialize/SerializeFuncs.h"

View File

@ -29,12 +29,20 @@
#include "Core/MemMap.h"
#include "Core/Reporting.h"
//Uncomment if you want to dump JPEGs loaded through sceJpeg to a file
//#define JPEG_DEBUG
// Uncomment if you want to dump JPEGs loaded through sceJpeg to a file
// #define JPEG_DEBUG
#ifdef JPEG_DEBUG
#include "ext/xxhash.h"
#endif
struct u24_be {
unsigned char value[3];
operator unsigned int() {
return 0x00000000 | (value[0] << 16) | (value[1] << 8) | (value[2] << 0);
}
};
static int mjpegWidth, mjpegHeight;
void __JpegInit() {

View File

@ -21,6 +21,7 @@
#include <string>
#include "Common/Common.h"
#include "Common/Log.h"
#include "Common/Swap.h"
class PointerWrap;

View File

@ -32,7 +32,7 @@
#include <mutex>
#include <condition_variable>
#include "profiler/profiler.h"
#include "Common/Profiler/Profiler.h"
#include "Common/Thread/ThreadUtil.h"
#include "Common/Serialize/SerializeFuncs.h"
#include "Common/Log.h"

View File

@ -20,7 +20,7 @@
#include "ppsspp_config.h"
#include "base/NativeApp.h"
#include "Common/System/System.h"
#include "Common/Serialize/Serializer.h"
#include "Common/Serialize/SerializeFuncs.h"
#include "Core/HLE/HLE.h"

View File

@ -16,7 +16,8 @@
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include <ctime>
#include "base/NativeApp.h"
#include "Common/System/System.h"
#include "Common/Serialize/Serializer.h"
#include "Common/Serialize/SerializeFuncs.h"
#include "Core/HLE/HLE.h"

View File

@ -18,7 +18,7 @@
#include <algorithm>
#include <set>
#include "file/ini_file.h"
#include "Common/Data/Format/IniFile.h"
#include "Common/Serialize/Serializer.h"
#include "Common/Serialize/SerializeFuncs.h"

View File

@ -17,7 +17,7 @@
#include <algorithm>
#include "profiler/profiler.h"
#include "Common/Profiler/Profiler.h"
#include "Common/Serialize/SerializeFuncs.h"
#include "Core/MemMapHelpers.h"

View File

@ -35,7 +35,7 @@
#include <cstring>
#include <atomic>
#include "base/NativeApp.h"
#include "Common/System/System.h"
#include "Common/MathUtil.h"
#include "Common/Serialize/Serializer.h"
#include "Common/Log.h"

View File

@ -26,14 +26,15 @@
#include "ppsspp_config.h"
#include "base/NativeApp.h"
#include "file/ini_file.h"
#include "Common/System/NativeApp.h"
#include "Common/System/System.h"
#include "Common/Data/Format/IniFile.h"
#include "Common/Input/InputState.h"
#include "Common/Log.h"
#include "Common/KeyMap.h"
#include "Common/StringUtils.h"
#include "Core/HLE/sceUtility.h"
#include "Core/Config.h"
#include "Core/KeyMap.h"
namespace KeyMap {

View File

@ -18,7 +18,7 @@
#include "ppsspp_config.h"
#if PPSSPP_ARCH(ARM)
#include "profiler/profiler.h"
#include "Common/Profiler/Profiler.h"
#include "Core/Config.h"
#include "Core/Core.h"

View File

@ -19,7 +19,7 @@
#if PPSSPP_ARCH(ARM)
#include <cmath>
#include "math/math_util.h"
#include "Common/Math/math_util.h"
#include "Core/Compatibility.h"
#include "Core/Config.h"

View File

@ -30,7 +30,7 @@
#include <cmath>
#include "math/math_util.h"
#include "Common/Math/math_util.h"
#include "Common/CPUDetect.h"
#include "Core/MemMap.h"

Some files were not shown because too many files have changed in this diff Show More