Auto-updater

This commit is contained in:
RipleyTom 2019-09-11 09:55:43 +02:00 committed by Megamouse
parent 56e6dd1c46
commit 9f9ac4b696
31 changed files with 2068 additions and 52 deletions

2
.gitignore vendored
View file

@ -97,3 +97,5 @@ CMakeLists.txt.user
# macOS
.DS_Store
# 7zlib
/3rdparty/7z/**/*.lib

242
3rdparty/7z/7zlib/7zlib.vcxproj vendored Normal file
View file

@ -0,0 +1,242 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\7z.h" />
<ClInclude Include="..\7zAlloc.h" />
<ClInclude Include="..\7zBuf.h" />
<ClInclude Include="..\7zCrc.h" />
<ClInclude Include="..\7zFile.h" />
<ClInclude Include="..\7zTypes.h" />
<ClInclude Include="..\7zVersion.h" />
<ClInclude Include="..\Aes.h" />
<ClInclude Include="..\Alloc.h" />
<ClInclude Include="..\Bcj2.h" />
<ClInclude Include="..\Bra.h" />
<ClInclude Include="..\Compiler.h" />
<ClInclude Include="..\CpuArch.h" />
<ClInclude Include="..\Delta.h" />
<ClInclude Include="..\DllSecur.h" />
<ClInclude Include="..\LzFind.h" />
<ClInclude Include="..\LzFindMt.h" />
<ClInclude Include="..\LzHash.h" />
<ClInclude Include="..\Lzma2Dec.h" />
<ClInclude Include="..\Lzma2DecMt.h" />
<ClInclude Include="..\Lzma2Enc.h" />
<ClInclude Include="..\Lzma86.h" />
<ClInclude Include="..\LzmaDec.h" />
<ClInclude Include="..\LzmaEnc.h" />
<ClInclude Include="..\LzmaLib.h" />
<ClInclude Include="..\MtCoder.h" />
<ClInclude Include="..\MtDec.h" />
<ClInclude Include="..\Ppmd.h" />
<ClInclude Include="..\Ppmd7.h" />
<ClInclude Include="..\Precomp.h" />
<ClInclude Include="..\RotateDefs.h" />
<ClInclude Include="..\Sha256.h" />
<ClInclude Include="..\Sort.h" />
<ClInclude Include="..\Threads.h" />
<ClInclude Include="..\Xz.h" />
<ClInclude Include="..\XzCrc64.h" />
<ClInclude Include="..\XzEnc.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\7zAlloc.c" />
<ClCompile Include="..\7zArcIn.c" />
<ClCompile Include="..\7zBuf.c" />
<ClCompile Include="..\7zBuf2.c" />
<ClCompile Include="..\7zCrc.c" />
<ClCompile Include="..\7zCrcOpt.c" />
<ClCompile Include="..\7zDec.c" />
<ClCompile Include="..\7zFile.c" />
<ClCompile Include="..\7zStream.c" />
<ClCompile Include="..\Aes.c" />
<ClCompile Include="..\AesOpt.c" />
<ClCompile Include="..\Alloc.c" />
<ClCompile Include="..\Bcj2.c" />
<ClCompile Include="..\Bcj2Enc.c" />
<ClCompile Include="..\Bra.c" />
<ClCompile Include="..\Bra86.c" />
<ClCompile Include="..\BraIA64.c" />
<ClCompile Include="..\CpuArch.c" />
<ClCompile Include="..\Delta.c" />
<ClCompile Include="..\DllSecur.c" />
<ClCompile Include="..\LzFind.c" />
<ClCompile Include="..\LzFindMt.c" />
<ClCompile Include="..\Lzma2Dec.c" />
<ClCompile Include="..\Lzma2DecMt.c" />
<ClCompile Include="..\Lzma2Enc.c" />
<ClCompile Include="..\Lzma86Dec.c" />
<ClCompile Include="..\Lzma86Enc.c" />
<ClCompile Include="..\LzmaDec.c" />
<ClCompile Include="..\LzmaEnc.c" />
<ClCompile Include="..\LzmaLib.c" />
<ClCompile Include="..\MtCoder.c" />
<ClCompile Include="..\MtDec.c" />
<ClCompile Include="..\Ppmd7.c" />
<ClCompile Include="..\Ppmd7Dec.c" />
<ClCompile Include="..\Ppmd7Enc.c" />
<ClCompile Include="..\Sha256.c" />
<ClCompile Include="..\Sort.c" />
<ClCompile Include="..\Threads.c" />
<ClCompile Include="..\Xz.c" />
<ClCompile Include="..\XzCrc64.c" />
<ClCompile Include="..\XzCrc64Opt.c" />
<ClCompile Include="..\XzDec.c" />
<ClCompile Include="..\XzEnc.c" />
<ClCompile Include="..\XzIn.c" />
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<ProjectGuid>{5B146DEA-9ACE-4D32-A7FD-3F42464DD69C}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>My7zlib</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(ProjectDir)$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

264
3rdparty/7z/7zlib/7zlib.vcxproj.filters vendored Normal file
View file

@ -0,0 +1,264 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\7z.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\7zAlloc.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\7zBuf.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\7zCrc.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\7zFile.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\7zTypes.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\7zVersion.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Aes.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Alloc.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Bcj2.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Bra.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Compiler.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\CpuArch.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Delta.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\DllSecur.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\LzFind.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\LzFindMt.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\LzHash.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Lzma2Dec.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Lzma2DecMt.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Lzma2Enc.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Lzma86.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\LzmaDec.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\LzmaEnc.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\LzmaLib.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\MtCoder.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\MtDec.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Ppmd.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Ppmd7.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Precomp.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\RotateDefs.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Sha256.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Sort.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Threads.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Xz.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\XzCrc64.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\XzEnc.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\7zAlloc.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\7zArcIn.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\7zBuf.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\7zBuf2.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\7zCrc.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\7zCrcOpt.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\7zDec.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\7zFile.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\7zStream.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Aes.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\AesOpt.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Alloc.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Bcj2.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Bcj2Enc.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Bra.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Bra86.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\BraIA64.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\CpuArch.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Delta.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\DllSecur.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\LzFind.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\LzFindMt.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Lzma2Dec.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Lzma2DecMt.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Lzma2Enc.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Lzma86Dec.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Lzma86Enc.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\LzmaDec.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\LzmaEnc.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\LzmaLib.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\MtCoder.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\MtDec.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Ppmd7.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Ppmd7Dec.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Ppmd7Enc.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Sha256.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Sort.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Threads.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Xz.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\XzCrc64.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\XzCrc64Opt.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\XzDec.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\XzEnc.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\XzIn.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View file

@ -31,9 +31,55 @@ target_link_libraries(3rdparty_zlib INTERFACE ${ZLIB_LIBRARY})
target_include_directories(3rdparty_zlib INTERFACE ${ZLIB_INCLUDE_DIR})
# 7z sdk
add_library(3rdparty_7z INTERFACE)
if(WIN32)
add_library(3rdparty_7z STATIC EXCLUDE_FROM_ALL
7z/Sha256.c
7z/Ppmd7Dec.c
7z/XzDec.c
7z/XzEnc.c
7z/Lzma2Dec.c
7z/XzCrc64.c
7z/DllSecur.c
7z/Lzma2DecMt.c
7z/BraIA64.c
7z/7zFile.c
7z/7zStream.c
7z/Lzma86Enc.c
7z/Threads.c
7z/7zAlloc.c
7z/LzmaEnc.c
7z/MtCoder.c
7z/Lzma86Dec.c
7z/Sort.c
7z/LzFindMt.c
7z/7zDec.c
7z/Bcj2.c
7z/Ppmd7.c
7z/Bra86.c
7z/Bcj2Enc.c
7z/7zBuf.c
7z/Aes.c
7z/AesOpt.c
7z/XzCrc64Opt.c
7z/7zArcIn.c
7z/Lzma2Enc.c
7z/Bra.c
7z/7zCrcOpt.c
7z/7zBuf2.c
7z/LzFind.c
7z/Ppmd7Enc.c
7z/CpuArch.c
7z/Delta.c
7z/XzIn.c
7z/Alloc.c
7z/Xz.c
7z/LzmaDec.c
7z/LzmaLib.c
7z/7zCrc.c
7z/MtDec.c)
target_include_directories(3rdparty_7z INTERFACE 7z)
else()
add_library(3rdparty_7z INTERFACE)
endif()
# libPNG

View file

@ -1067,7 +1067,7 @@ fs::file::file(const std::string& path, bs_t<open_mode> mode)
m_file = std::make_unique<windows_file>(handle);
#else
int flags = 0;
int flags = O_CLOEXEC; // Ensures all files are closed on execl for auto updater
if (mode & fs::read && mode & fs::write) flags |= O_RDWR;
else if (mode & fs::read) flags |= O_RDONLY;

View file

@ -329,25 +329,34 @@ logs::file_writer::file_writer(const std::string& name)
{
if (!m_file.open(buf_name, fs::read + fs::rewrite + fs::lock))
{
if (fs::g_tls_error == fs::error::acces)
{
if (fs::exists(buf_name))
{
fmt::throw_exception("Another instance of %s is running. Close it or kill its process, if necessary.", name);
}
else
{
fmt::throw_exception("Cannot create %s.log (access denied)."
#ifdef _WIN32
"\nNote that %s cannot be installed in Program Files or similar directory with limited permissions."
#else
"\nPlease, check %s permissions in '~/.config/'."
// Windows does not close all handles before starting a new process with execl
// We delay another check for rpcs3 restart after an update
// TODO: cleaner solution?
std::this_thread::sleep_for(500ms);
if (!m_file.open(buf_name, fs::read + fs::rewrite + fs::lock))
#endif
, name, name);
{
if (fs::g_tls_error == fs::error::acces)
{
if (fs::exists(buf_name))
{
fmt::throw_exception("Another instance of %s is running. Close it or kill its process, if necessary.", name);
}
else
{
fmt::throw_exception("Cannot create %s.log (access denied)."
#ifdef _WIN32
"\nNote that %s cannot be installed in Program Files or similar directory with limited permissions."
#else
"\nPlease, check %s permissions in '~/.config/'."
#endif
, name, name);
}
}
}
fmt::throw_exception("Cannot create %s.log (error %s)", name, fs::g_tls_error);
fmt::throw_exception("Cannot create %s.log (error %s)", name, fs::g_tls_error);
}
}
// Check free space

View file

@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2027
# Visual Studio Version 16
VisualStudioVersion = 16.0.29306.81
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asmjit", "asmjitsrc\asmjit.vcxproj", "{AC40FF01-426E-4838-A317-66354CEFAE88}"
EndProject
@ -79,6 +79,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libusb", "libusb", "{6D8E86
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libusb-1.0 (static)", "3rdparty\libusb_static.vcxproj", "{349EE8F9-7D25-4909-AAF5-FF3FADE72187}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "7z", "7z", "{CB3DD03E-074E-4FA5-B253-51A3372D1768}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "7zlib", "3rdparty\7z\7zlib\7zlib.vcxproj", "{5B146DEA-9ACE-4D32-A7FD-3F42464DD69C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug - LLVM|x64 = Debug - LLVM|x64
@ -247,6 +251,16 @@ Global
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release - LLVM|x64.Build.0 = Release|x64
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release|x64.ActiveCfg = Release|x64
{349EE8F9-7D25-4909-AAF5-FF3FADE72187}.Release|x64.Build.0 = Release|x64
{5B146DEA-9ACE-4D32-A7FD-3F42464DD69C}.Debug - LLVM|x64.ActiveCfg = Debug|x64
{5B146DEA-9ACE-4D32-A7FD-3F42464DD69C}.Debug - LLVM|x64.Build.0 = Debug|x64
{5B146DEA-9ACE-4D32-A7FD-3F42464DD69C}.Debug - MemLeak|x64.ActiveCfg = Debug|x64
{5B146DEA-9ACE-4D32-A7FD-3F42464DD69C}.Debug - MemLeak|x64.Build.0 = Debug|x64
{5B146DEA-9ACE-4D32-A7FD-3F42464DD69C}.Debug|x64.ActiveCfg = Debug|x64
{5B146DEA-9ACE-4D32-A7FD-3F42464DD69C}.Debug|x64.Build.0 = Debug|x64
{5B146DEA-9ACE-4D32-A7FD-3F42464DD69C}.Release - LLVM|x64.ActiveCfg = Release|x64
{5B146DEA-9ACE-4D32-A7FD-3F42464DD69C}.Release - LLVM|x64.Build.0 = Release|x64
{5B146DEA-9ACE-4D32-A7FD-3F42464DD69C}.Release|x64.ActiveCfg = Release|x64
{5B146DEA-9ACE-4D32-A7FD-3F42464DD69C}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -268,6 +282,7 @@ Global
{A107C21C-418A-4697-BB10-20C3AA60E2E4} = {FA1E6C16-CA63-45F8-8D52-E21DF396BE36}
{939FE206-1182-ABC3-1234-FEAB88E98404} = {D16E245C-CC5A-4B9A-8BAB-1176F02C1631}
{349EE8F9-7D25-4909-AAF5-FF3FADE72187} = {6D8E86F7-84A0-45BA-ACC3-F02FC5545B3B}
{5B146DEA-9ACE-4D32-A7FD-3F42464DD69C} = {CB3DD03E-074E-4FA5-B253-51A3372D1768}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {06CC7920-E085-4B81-9582-8DE8AAD42510}

449
rpcs3/Crypto/sha256.cpp Normal file
View file

@ -0,0 +1,449 @@
/*
* FIPS-180-2 compliant SHA-256 implementation
*
* Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: GPL-2.0
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* This file is part of mbed TLS (https://tls.mbed.org)
*/
/*
* The SHA-256 Secure Hash Standard was published by NIST in 2002.
*
* http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf
*/
#include "sha256.h"
#include <string.h>
#if defined(MBEDTLS_SELF_TEST)
#if defined(MBEDTLS_PLATFORM_C)
#include "mbedtls/platform.h"
#else
#include <stdio.h>
#include <stdlib.h>
#define mbedtls_printf printf
#define mbedtls_calloc calloc
#define mbedtls_free free
#endif /* MBEDTLS_PLATFORM_C */
#endif /* MBEDTLS_SELF_TEST */
#define SHA256_VALIDATE_RET(cond)
#define SHA256_VALIDATE(cond)
#if !defined(MBEDTLS_SHA256_ALT)
/*
* 32-bit integer manipulation macros (big endian)
*/
#ifndef GET_UINT32_BE
#define GET_UINT32_BE(n,b,i) \
do { \
(n) = ( (uint32_t) (b)[(i) ] << 24 ) \
| ( (uint32_t) (b)[(i) + 1] << 16 ) \
| ( (uint32_t) (b)[(i) + 2] << 8 ) \
| ( (uint32_t) (b)[(i) + 3] ); \
} while( 0 )
#endif
#ifndef PUT_UINT32_BE
#define PUT_UINT32_BE(n,b,i) \
do { \
(b)[(i) ] = (unsigned char) ( (n) >> 24 ); \
(b)[(i) + 1] = (unsigned char) ( (n) >> 16 ); \
(b)[(i) + 2] = (unsigned char) ( (n) >> 8 ); \
(b)[(i) + 3] = (unsigned char) ( (n) ); \
} while( 0 )
#endif
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize_sha256(void* v, size_t n)
{
volatile unsigned char* p = (volatile unsigned char*)v;
while (n--)
*p++ = 0;
}
void mbedtls_sha256_init( mbedtls_sha256_context *ctx )
{
SHA256_VALIDATE( ctx != NULL );
memset( ctx, 0, sizeof( mbedtls_sha256_context ) );
}
void mbedtls_sha256_free( mbedtls_sha256_context *ctx )
{
if( ctx == NULL )
return;
mbedtls_zeroize_sha256(ctx, sizeof(mbedtls_sha256_context));
}
void mbedtls_sha256_clone( mbedtls_sha256_context *dst,
const mbedtls_sha256_context *src )
{
SHA256_VALIDATE( dst != NULL );
SHA256_VALIDATE( src != NULL );
*dst = *src;
}
/*
* SHA-256 context setup
*/
int mbedtls_sha256_starts_ret( mbedtls_sha256_context *ctx, int is224 )
{
SHA256_VALIDATE_RET( ctx != NULL );
SHA256_VALIDATE_RET( is224 == 0 || is224 == 1 );
ctx->total[0] = 0;
ctx->total[1] = 0;
if( is224 == 0 )
{
/* SHA-256 */
ctx->state[0] = 0x6A09E667;
ctx->state[1] = 0xBB67AE85;
ctx->state[2] = 0x3C6EF372;
ctx->state[3] = 0xA54FF53A;
ctx->state[4] = 0x510E527F;
ctx->state[5] = 0x9B05688C;
ctx->state[6] = 0x1F83D9AB;
ctx->state[7] = 0x5BE0CD19;
}
else
{
/* SHA-224 */
ctx->state[0] = 0xC1059ED8;
ctx->state[1] = 0x367CD507;
ctx->state[2] = 0x3070DD17;
ctx->state[3] = 0xF70E5939;
ctx->state[4] = 0xFFC00B31;
ctx->state[5] = 0x68581511;
ctx->state[6] = 0x64F98FA7;
ctx->state[7] = 0xBEFA4FA4;
}
ctx->is224 = is224;
return( 0 );
}
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
void mbedtls_sha256_starts( mbedtls_sha256_context *ctx,
int is224 )
{
mbedtls_sha256_starts_ret( ctx, is224 );
}
#endif
#if !defined(MBEDTLS_SHA256_PROCESS_ALT)
static const uint32_t K[] =
{
0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5,
0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5,
0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3,
0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174,
0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC,
0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA,
0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7,
0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967,
0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13,
0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85,
0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3,
0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070,
0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5,
0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3,
0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208,
0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2,
};
#define SHR(x,n) (((x) & 0xFFFFFFFF) >> (n))
#define ROTR(x,n) (SHR(x,n) | ((x) << (32 - (n))))
#define S0(x) (ROTR(x, 7) ^ ROTR(x,18) ^ SHR(x, 3))
#define S1(x) (ROTR(x,17) ^ ROTR(x,19) ^ SHR(x,10))
#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
#define F0(x,y,z) (((x) & (y)) | ((z) & ((x) | (y))))
#define F1(x,y,z) ((z) ^ ((x) & ((y) ^ (z))))
#define R(t) \
( \
W[t] = S1(W[(t) - 2]) + W[(t) - 7] + \
S0(W[(t) - 15]) + W[(t) - 16] \
)
#define P(a,b,c,d,e,f,g,h,x,K) \
do \
{ \
temp1 = (h) + S3(e) + F1((e),(f),(g)) + (K) + (x); \
temp2 = S2(a) + F0((a),(b),(c)); \
(d) += temp1; (h) = temp1 + temp2; \
} while( 0 )
int mbedtls_internal_sha256_process( mbedtls_sha256_context *ctx,
const unsigned char data[64] )
{
uint32_t temp1, temp2, W[64];
uint32_t A[8];
unsigned int i;
SHA256_VALIDATE_RET( ctx != NULL );
SHA256_VALIDATE_RET( (const unsigned char *)data != NULL );
for( i = 0; i < 8; i++ )
A[i] = ctx->state[i];
#if defined(MBEDTLS_SHA256_SMALLER)
for( i = 0; i < 64; i++ )
{
if( i < 16 )
GET_UINT32_BE( W[i], data, 4 * i );
else
R( i );
P( A[0], A[1], A[2], A[3], A[4], A[5], A[6], A[7], W[i], K[i] );
temp1 = A[7]; A[7] = A[6]; A[6] = A[5]; A[5] = A[4]; A[4] = A[3];
A[3] = A[2]; A[2] = A[1]; A[1] = A[0]; A[0] = temp1;
}
#else /* MBEDTLS_SHA256_SMALLER */
for( i = 0; i < 16; i++ )
GET_UINT32_BE( W[i], data, 4 * i );
for( i = 0; i < 16; i += 8 )
{
P( A[0], A[1], A[2], A[3], A[4], A[5], A[6], A[7], W[i+0], K[i+0] );
P( A[7], A[0], A[1], A[2], A[3], A[4], A[5], A[6], W[i+1], K[i+1] );
P( A[6], A[7], A[0], A[1], A[2], A[3], A[4], A[5], W[i+2], K[i+2] );
P( A[5], A[6], A[7], A[0], A[1], A[2], A[3], A[4], W[i+3], K[i+3] );
P( A[4], A[5], A[6], A[7], A[0], A[1], A[2], A[3], W[i+4], K[i+4] );
P( A[3], A[4], A[5], A[6], A[7], A[0], A[1], A[2], W[i+5], K[i+5] );
P( A[2], A[3], A[4], A[5], A[6], A[7], A[0], A[1], W[i+6], K[i+6] );
P( A[1], A[2], A[3], A[4], A[5], A[6], A[7], A[0], W[i+7], K[i+7] );
}
for( i = 16; i < 64; i += 8 )
{
P( A[0], A[1], A[2], A[3], A[4], A[5], A[6], A[7], R(i+0), K[i+0] );
P( A[7], A[0], A[1], A[2], A[3], A[4], A[5], A[6], R(i+1), K[i+1] );
P( A[6], A[7], A[0], A[1], A[2], A[3], A[4], A[5], R(i+2), K[i+2] );
P( A[5], A[6], A[7], A[0], A[1], A[2], A[3], A[4], R(i+3), K[i+3] );
P( A[4], A[5], A[6], A[7], A[0], A[1], A[2], A[3], R(i+4), K[i+4] );
P( A[3], A[4], A[5], A[6], A[7], A[0], A[1], A[2], R(i+5), K[i+5] );
P( A[2], A[3], A[4], A[5], A[6], A[7], A[0], A[1], R(i+6), K[i+6] );
P( A[1], A[2], A[3], A[4], A[5], A[6], A[7], A[0], R(i+7), K[i+7] );
}
#endif /* MBEDTLS_SHA256_SMALLER */
for( i = 0; i < 8; i++ )
ctx->state[i] += A[i];
return( 0 );
}
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
void mbedtls_sha256_process( mbedtls_sha256_context *ctx,
const unsigned char data[64] )
{
mbedtls_internal_sha256_process( ctx, data );
}
#endif
#endif /* !MBEDTLS_SHA256_PROCESS_ALT */
/*
* SHA-256 process buffer
*/
int mbedtls_sha256_update_ret( mbedtls_sha256_context *ctx,
const unsigned char *input,
size_t ilen )
{
int ret;
size_t fill;
uint32_t left;
SHA256_VALIDATE_RET( ctx != NULL );
SHA256_VALIDATE_RET( ilen == 0 || input != NULL );
if( ilen == 0 )
return( 0 );
left = ctx->total[0] & 0x3F;
fill = 64 - left;
ctx->total[0] += (uint32_t) ilen;
ctx->total[0] &= 0xFFFFFFFF;
if( ctx->total[0] < (uint32_t) ilen )
ctx->total[1]++;
if( left && ilen >= fill )
{
memcpy( (void *) (ctx->buffer + left), input, fill );
if( ( ret = mbedtls_internal_sha256_process( ctx, ctx->buffer ) ) != 0 )
return( ret );
input += fill;
ilen -= fill;
left = 0;
}
while( ilen >= 64 )
{
if( ( ret = mbedtls_internal_sha256_process( ctx, input ) ) != 0 )
return( ret );
input += 64;
ilen -= 64;
}
if( ilen > 0 )
memcpy( (void *) (ctx->buffer + left), input, ilen );
return( 0 );
}
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
void mbedtls_sha256_update( mbedtls_sha256_context *ctx,
const unsigned char *input,
size_t ilen )
{
mbedtls_sha256_update_ret( ctx, input, ilen );
}
#endif
/*
* SHA-256 final digest
*/
int mbedtls_sha256_finish_ret( mbedtls_sha256_context *ctx,
unsigned char output[32] )
{
int ret;
uint32_t used;
uint32_t high, low;
SHA256_VALIDATE_RET( ctx != NULL );
SHA256_VALIDATE_RET( (unsigned char *)output != NULL );
/*
* Add padding: 0x80 then 0x00 until 8 bytes remain for the length
*/
used = ctx->total[0] & 0x3F;
ctx->buffer[used++] = 0x80;
if( used <= 56 )
{
/* Enough room for padding + length in current block */
memset( ctx->buffer + used, 0, 56 - used );
}
else
{
/* We'll need an extra block */
memset( ctx->buffer + used, 0, 64 - used );
if( ( ret = mbedtls_internal_sha256_process( ctx, ctx->buffer ) ) != 0 )
return( ret );
memset( ctx->buffer, 0, 56 );
}
/*
* Add message length
*/
high = ( ctx->total[0] >> 29 )
| ( ctx->total[1] << 3 );
low = ( ctx->total[0] << 3 );
PUT_UINT32_BE( high, ctx->buffer, 56 );
PUT_UINT32_BE( low, ctx->buffer, 60 );
if( ( ret = mbedtls_internal_sha256_process( ctx, ctx->buffer ) ) != 0 )
return( ret );
/*
* Output final state
*/
PUT_UINT32_BE( ctx->state[0], output, 0 );
PUT_UINT32_BE( ctx->state[1], output, 4 );
PUT_UINT32_BE( ctx->state[2], output, 8 );
PUT_UINT32_BE( ctx->state[3], output, 12 );
PUT_UINT32_BE( ctx->state[4], output, 16 );
PUT_UINT32_BE( ctx->state[5], output, 20 );
PUT_UINT32_BE( ctx->state[6], output, 24 );
if( ctx->is224 == 0 )
PUT_UINT32_BE( ctx->state[7], output, 28 );
return( 0 );
}
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
void mbedtls_sha256_finish( mbedtls_sha256_context *ctx,
unsigned char output[32] )
{
mbedtls_sha256_finish_ret( ctx, output );
}
#endif
#endif /* !MBEDTLS_SHA256_ALT */
/*
* output = SHA-256( input buffer )
*/
int mbedtls_sha256_ret( const unsigned char *input,
size_t ilen,
unsigned char output[32],
int is224 )
{
int ret;
mbedtls_sha256_context ctx;
SHA256_VALIDATE_RET( is224 == 0 || is224 == 1 );
SHA256_VALIDATE_RET( ilen == 0 || input != NULL );
SHA256_VALIDATE_RET( (unsigned char *)output != NULL );
mbedtls_sha256_init( &ctx );
if( ( ret = mbedtls_sha256_starts_ret( &ctx, is224 ) ) != 0 )
goto exit;
if( ( ret = mbedtls_sha256_update_ret( &ctx, input, ilen ) ) != 0 )
goto exit;
if( ( ret = mbedtls_sha256_finish_ret( &ctx, output ) ) != 0 )
goto exit;
exit:
mbedtls_sha256_free( &ctx );
return( ret );
}
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
void mbedtls_sha256( const unsigned char *input,
size_t ilen,
unsigned char output[32],
int is224 )
{
mbedtls_sha256_ret( input, ilen, output, is224 );
}
#endif

281
rpcs3/Crypto/sha256.h Normal file
View file

@ -0,0 +1,281 @@
/**
* \file sha256.h
*
* \brief This file contains SHA-224 and SHA-256 definitions and functions.
*
* The Secure Hash Algorithms 224 and 256 (SHA-224 and SHA-256) cryptographic
* hash functions are defined in <em>FIPS 180-4: Secure Hash Standard (SHS)</em>.
*/
/*
* Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved
* SPDX-License-Identifier: GPL-2.0
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* This file is part of Mbed TLS (https://tls.mbed.org)
*/
#ifndef MBEDTLS_SHA256_H
#define MBEDTLS_SHA256_H
#include <stddef.h>
#include <stdint.h>
/* MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED is deprecated and should not be used. */
#define MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED -0x0037 /**< SHA-256 hardware accelerator failed */
#define MBEDTLS_ERR_SHA256_BAD_INPUT_DATA -0x0074 /**< SHA-256 input data was malformed. */
#ifdef __cplusplus
extern "C" {
#endif
#if !defined(MBEDTLS_SHA256_ALT)
// Regular implementation
//
/**
* \brief The SHA-256 context structure.
*
* The structure is used both for SHA-256 and for SHA-224
* checksum calculations. The choice between these two is
* made in the call to mbedtls_sha256_starts_ret().
*/
typedef struct mbedtls_sha256_context
{
uint32_t total[2]; /*!< The number of Bytes processed. */
uint32_t state[8]; /*!< The intermediate digest state. */
unsigned char buffer[64]; /*!< The data block being processed. */
int is224; /*!< Determines which function to use:
0: Use SHA-256, or 1: Use SHA-224. */
}
mbedtls_sha256_context;
#else /* MBEDTLS_SHA256_ALT */
#include "sha256_alt.h"
#endif /* MBEDTLS_SHA256_ALT */
/**
* \brief This function initializes a SHA-256 context.
*
* \param ctx The SHA-256 context to initialize. This must not be \c NULL.
*/
void mbedtls_sha256_init( mbedtls_sha256_context *ctx );
/**
* \brief This function clears a SHA-256 context.
*
* \param ctx The SHA-256 context to clear. This may be \c NULL, in which
* case this function returns immediately. If it is not \c NULL,
* it must point to an initialized SHA-256 context.
*/
void mbedtls_sha256_free( mbedtls_sha256_context *ctx );
/**
* \brief This function clones the state of a SHA-256 context.
*
* \param dst The destination context. This must be initialized.
* \param src The context to clone. This must be initialized.
*/
void mbedtls_sha256_clone( mbedtls_sha256_context *dst,
const mbedtls_sha256_context *src );
/**
* \brief This function starts a SHA-224 or SHA-256 checksum
* calculation.
*
* \param ctx The context to use. This must be initialized.
* \param is224 This determines which function to use. This must be
* either \c 0 for SHA-256, or \c 1 for SHA-224.
*
* \return \c 0 on success.
* \return A negative error code on failure.
*/
int mbedtls_sha256_starts_ret( mbedtls_sha256_context *ctx, int is224 );
/**
* \brief This function feeds an input buffer into an ongoing
* SHA-256 checksum calculation.
*
* \param ctx The SHA-256 context. This must be initialized
* and have a hash operation started.
* \param input The buffer holding the data. This must be a readable
* buffer of length \p ilen Bytes.
* \param ilen The length of the input data in Bytes.
*
* \return \c 0 on success.
* \return A negative error code on failure.
*/
int mbedtls_sha256_update_ret( mbedtls_sha256_context *ctx,
const unsigned char *input,
size_t ilen );
/**
* \brief This function finishes the SHA-256 operation, and writes
* the result to the output buffer.
*
* \param ctx The SHA-256 context. This must be initialized
* and have a hash operation started.
* \param output The SHA-224 or SHA-256 checksum result.
* This must be a writable buffer of length \c 32 Bytes.
*
* \return \c 0 on success.
* \return A negative error code on failure.
*/
int mbedtls_sha256_finish_ret( mbedtls_sha256_context *ctx,
unsigned char output[32] );
/**
* \brief This function processes a single data block within
* the ongoing SHA-256 computation. This function is for
* internal use only.
*
* \param ctx The SHA-256 context. This must be initialized.
* \param data The buffer holding one block of data. This must
* be a readable buffer of length \c 64 Bytes.
*
* \return \c 0 on success.
* \return A negative error code on failure.
*/
int mbedtls_internal_sha256_process( mbedtls_sha256_context *ctx,
const unsigned char data[64] );
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
#if defined(MBEDTLS_DEPRECATED_WARNING)
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
#else
#define MBEDTLS_DEPRECATED
#endif
/**
* \brief This function starts a SHA-224 or SHA-256 checksum
* calculation.
*
* \deprecated Superseded by mbedtls_sha256_starts_ret() in 2.7.0.
*
* \param ctx The context to use. This must be initialized.
* \param is224 Determines which function to use. This must be
* either \c 0 for SHA-256, or \c 1 for SHA-224.
*/
MBEDTLS_DEPRECATED void mbedtls_sha256_starts( mbedtls_sha256_context *ctx,
int is224 );
/**
* \brief This function feeds an input buffer into an ongoing
* SHA-256 checksum calculation.
*
* \deprecated Superseded by mbedtls_sha256_update_ret() in 2.7.0.
*
* \param ctx The SHA-256 context to use. This must be
* initialized and have a hash operation started.
* \param input The buffer holding the data. This must be a readable
* buffer of length \p ilen Bytes.
* \param ilen The length of the input data in Bytes.
*/
MBEDTLS_DEPRECATED void mbedtls_sha256_update( mbedtls_sha256_context *ctx,
const unsigned char *input,
size_t ilen );
/**
* \brief This function finishes the SHA-256 operation, and writes
* the result to the output buffer.
*
* \deprecated Superseded by mbedtls_sha256_finish_ret() in 2.7.0.
*
* \param ctx The SHA-256 context. This must be initialized and
* have a hash operation started.
* \param output The SHA-224 or SHA-256 checksum result. This must be
* a writable buffer of length \c 32 Bytes.
*/
MBEDTLS_DEPRECATED void mbedtls_sha256_finish( mbedtls_sha256_context *ctx,
unsigned char output[32] );
/**
* \brief This function processes a single data block within
* the ongoing SHA-256 computation. This function is for
* internal use only.
*
* \deprecated Superseded by mbedtls_internal_sha256_process() in 2.7.0.
*
* \param ctx The SHA-256 context. This must be initialized.
* \param data The buffer holding one block of data. This must be
* a readable buffer of size \c 64 Bytes.
*/
MBEDTLS_DEPRECATED void mbedtls_sha256_process( mbedtls_sha256_context *ctx,
const unsigned char data[64] );
#undef MBEDTLS_DEPRECATED
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
/**
* \brief This function calculates the SHA-224 or SHA-256
* checksum of a buffer.
*
* The function allocates the context, performs the
* calculation, and frees the context.
*
* The SHA-256 result is calculated as
* output = SHA-256(input buffer).
*
* \param input The buffer holding the data. This must be a readable
* buffer of length \p ilen Bytes.
* \param ilen The length of the input data in Bytes.
* \param output The SHA-224 or SHA-256 checksum result. This must
* be a writable buffer of length \c 32 Bytes.
* \param is224 Determines which function to use. This must be
* either \c 0 for SHA-256, or \c 1 for SHA-224.
*/
int mbedtls_sha256_ret( const unsigned char *input,
size_t ilen,
unsigned char output[32],
int is224 );
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
#if defined(MBEDTLS_DEPRECATED_WARNING)
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
#else
#define MBEDTLS_DEPRECATED
#endif
/**
* \brief This function calculates the SHA-224 or SHA-256 checksum
* of a buffer.
*
* The function allocates the context, performs the
* calculation, and frees the context.
*
* The SHA-256 result is calculated as
* output = SHA-256(input buffer).
*
* \deprecated Superseded by mbedtls_sha256_ret() in 2.7.0.
*
* \param input The buffer holding the data. This must be a readable
* buffer of length \p ilen Bytes.
* \param ilen The length of the input data in Bytes.
* \param output The SHA-224 or SHA-256 checksum result. This must be
* a writable buffer of length \c 32 Bytes.
* \param is224 Determines which function to use. This must be either
* \c 0 for SHA-256, or \c 1 for SHA-224.
*/
MBEDTLS_DEPRECATED void mbedtls_sha256( const unsigned char *input,
size_t ilen,
unsigned char output[32],
int is224 );
#undef MBEDTLS_DEPRECATED
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
#ifdef __cplusplus
}
#endif
#endif /* mbedtls_sha256.h */

View file

@ -61,6 +61,7 @@ target_sources(rpcs3_emu PRIVATE
../Crypto/lz.cpp
../Crypto/md5.cpp
../Crypto/sha1.cpp
../Crypto/sha256.cpp
../Crypto/unedat.cpp
../Crypto/unpkg.cpp
../Crypto/unself.cpp

View file

@ -344,10 +344,10 @@ public:
bool InstallPkg(const std::string& path);
private:
static std::string GetEmuDir();
void LimitCacheSize();
public:
static std::string GetEmuDir();
static std::string GetHddDir();
static std::string GetHdd1Dir();
static std::string GetSfoDirFromGamePath(const std::string& game_path, const std::string& user, const std::string& title_id = "");

View file

@ -141,6 +141,7 @@
"show_boot_game": "Shows a confirmation dialog when a game was booted while another game is running.",
"show_pkg_install": "Shows a dialog when packages were installed successfully.",
"show_pup_install": "Shows a dialog when firmware was installed successfully.",
"check_update_start": "Check if an update is available on startup.",
"useRichPresence": "Enables use of Discord Rich Presence to show what game you are playing on Discord.\nRequires a restart of RPCS3 to completely close the connection.",
"discordState": "Tell your friends what you are doing.",
"custom_colors": "Prioritize custom user interface colors over properties set in stylesheet."

View file

@ -347,6 +347,9 @@
<ClCompile Include="Crypto\sha1.cpp">
<PrecompiledHeader>NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="Crypto\sha256.cpp">
<PrecompiledHeader>NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="Crypto\unedat.cpp" />
<ClCompile Include="Crypto\unpkg.cpp" />
<ClCompile Include="Crypto\unself.cpp" />
@ -424,6 +427,7 @@
<ClInclude Include="Crypto\lz.h" />
<ClInclude Include="Crypto\md5.h" />
<ClInclude Include="Crypto\sha1.h" />
<ClInclude Include="Crypto\sha256.h" />
<ClInclude Include="Crypto\unedat.h" />
<ClInclude Include="Crypto\unpkg.h" />
<ClInclude Include="Crypto\unself.h" />

View file

@ -83,6 +83,9 @@
<ClCompile Include="Crypto\sha1.cpp">
<Filter>Crypto</Filter>
</ClCompile>
<ClCompile Include="Crypto\sha256.cpp">
<Filter>Crypto</Filter>
</ClCompile>
<ClCompile Include="Crypto\unedat.cpp">
<Filter>Crypto</Filter>
</ClCompile>
@ -844,6 +847,9 @@
<ClInclude Include="Crypto\sha1.h">
<Filter>Crypto</Filter>
</ClInclude>
<ClInclude Include="Crypto\sha256.h">
<Filter>Crypto</Filter>
</ClInclude>
<ClInclude Include="Crypto\unedat.h">
<Filter>Crypto</Filter>
</ClInclude>

View file

@ -117,7 +117,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">
<LibraryPath>$(SolutionDir)lib\Release-x64;$(SolutionDir)lib\$(Configuration)-$(Platform)\;$(UniversalCRT_LibraryPath_x64);$(LibraryPath)</LibraryPath>
<IncludePath>..\3rdparty\hidapi\hidapi;.\;..\;..\asmjit\src;..\3rdparty\yaml-cpp\include;..\3rdparty\ffmpeg\WindowsInclude;..\3rdparty\cereal\include;..\3rdparty\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);$(UniversalCRT_IncludePath);..\3rdparty\minidx12\Include;..\3rdparty\GSL\include;..\3rdparty\libpng;..\3rdparty\GL;..\3rdparty\stblib;..\3rdparty\OpenAL\include;..\3rdparty\pugixml\src;..\3rdparty\Optional;..\3rdparty\discord-rpc\include;..\3rdparty\zlib</IncludePath>
<IncludePath>..\3rdparty\7z;..\3rdparty\hidapi\hidapi;.\;..\;..\asmjit\src;..\3rdparty\yaml-cpp\include;..\3rdparty\ffmpeg\WindowsInclude;..\3rdparty\cereal\include;..\3rdparty\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);$(UniversalCRT_IncludePath);..\3rdparty\minidx12\Include;..\3rdparty\GSL\include;..\3rdparty\libpng;..\3rdparty\GL;..\3rdparty\stblib;..\3rdparty\OpenAL\include;..\3rdparty\pugixml\src;..\3rdparty\Optional;..\3rdparty\discord-rpc\include;..\3rdparty\zlib</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
@ -192,8 +192,8 @@
<WarningLevel>Level3</WarningLevel>
</ClCompile>
<Link>
<AdditionalDependencies>gdi32.lib;..\hidapi.lib;..\libusb-1.0.lib;winmm.lib;OpenAL.lib;XAudio.lib;D3D12GSRender.lib;GLGSRender.lib;shlwapi.lib;VKGSRender.lib;vulkan-1.lib;glslang.lib;OSDependent.lib;OGLCompiler.lib;SPIRV.lib;HLSL.lib;Advapi32.lib;user32.lib;zlib.lib;..\libpng16.lib;asmjit.lib;yaml-cpp.lib;discord-rpc.lib;emucore.lib;dxgi.lib;$(QTDIR)\lib\qtmain.lib;shell32.lib;opengl32.lib;$(QTDIR)\lib\Qt5OpenGL.lib;$(QTDIR)\lib\Qt5Widgets.lib;$(QTDIR)\lib\Qt5Gui.lib;$(QTDIR)\lib\Qt5Qml.lib;$(QTDIR)\lib\Qt5Network.lib;$(QTDIR)\lib\Qt5Core.lib;Qt5Core.lib;Qt5Gui.lib;Qt5Widgets.lib;Qt5WinExtras.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(VULKAN_SDK)\Lib;..\3rdparty\OpenAL\libs\Win64;..\Vulkan\glslang-build\hlsl\Release;..\Vulkan\glslang-build\SPIRV\Release;..\Vulkan\glslang-build\OGLCompilersDLL\Release;..\Vulkan\glslang-build\glslang\OSDependent\Windows\Release;..\Vulkan\glslang-build\glslang\Release;..\lib\$(CONFIGURATION)-$(PLATFORM);..\3rdparty\minidx12\Lib;..\3rdparty\discord-rpc\lib;$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>gdi32.lib;..\hidapi.lib;..\libusb-1.0.lib;winmm.lib;OpenAL.lib;XAudio.lib;D3D12GSRender.lib;GLGSRender.lib;shlwapi.lib;VKGSRender.lib;vulkan-1.lib;glslang.lib;OSDependent.lib;OGLCompiler.lib;SPIRV.lib;HLSL.lib;Advapi32.lib;user32.lib;zlib.lib;..\libpng16.lib;asmjit.lib;yaml-cpp.lib;discord-rpc.lib;emucore.lib;dxgi.lib;$(QTDIR)\lib\qtmain.lib;shell32.lib;opengl32.lib;$(QTDIR)\lib\Qt5OpenGL.lib;$(QTDIR)\lib\Qt5Widgets.lib;$(QTDIR)\lib\Qt5Gui.lib;$(QTDIR)\lib\Qt5Qml.lib;$(QTDIR)\lib\Qt5Network.lib;$(QTDIR)\lib\Qt5Core.lib;Qt5Core.lib;Qt5Gui.lib;Qt5Widgets.lib;Qt5WinExtras.lib;7zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\3rdparty\7z\7zlib\x64\Release\;$(VULKAN_SDK)\Lib;..\3rdparty\OpenAL\libs\Win64;..\Vulkan\glslang-build\hlsl\Release;..\Vulkan\glslang-build\SPIRV\Release;..\Vulkan\glslang-build\OGLCompilersDLL\Release;..\Vulkan\glslang-build\glslang\OSDependent\Windows\Release;..\Vulkan\glslang-build\glslang\Release;..\lib\$(CONFIGURATION)-$(PLATFORM);..\3rdparty\minidx12\Lib;..\3rdparty\discord-rpc\lib;$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalOptions>"/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions)</AdditionalOptions>
<DataExecutionPrevention>true</DataExecutionPrevention>
<GenerateDebugInformation>Debug</GenerateDebugInformation>
@ -506,6 +506,11 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="QTGeneratedFiles\Debug - LLVM\moc_update_manager.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="QTGeneratedFiles\Debug - LLVM\moc_user_manager_dialog.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@ -691,6 +696,11 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="QTGeneratedFiles\Debug\moc_update_manager.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="QTGeneratedFiles\Debug\moc_user_manager_dialog.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
@ -896,6 +906,11 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="QTGeneratedFiles\Release - LLVM\moc_update_manager.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="QTGeneratedFiles\Release - LLVM\moc_user_manager_dialog.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
@ -1081,6 +1096,11 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="QTGeneratedFiles\Release\moc_update_manager.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="QTGeneratedFiles\Release\moc_user_manager_dialog.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@ -1110,6 +1130,7 @@
<ClCompile Include="rpcs3qt\input_dialog.cpp" />
<ClCompile Include="rpcs3qt\osk_dialog_frame.cpp" />
<ClCompile Include="rpcs3qt\skylander_dialog.cpp" />
<ClCompile Include="rpcs3qt\update_manager.cpp" />
<ClCompile Include="rpcs3qt\_discord_utils.cpp" />
<ClCompile Include="rpcs3qt\find_dialog.cpp" />
<ClCompile Include="rpcs3qt\game_compatibility.cpp" />
@ -1653,6 +1674,24 @@
</CustomBuild>
<ClInclude Include="rpcs3qt\stylesheets.h" />
<ClInclude Include="rpcs3qt\skylander_dialog.h" />
<CustomBuild Include="rpcs3qt\update_manager.h">
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">Moc%27ing %(Identity)...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">.\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -DWITH_DISCORD_RPC -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DNDEBUG -DQT_WINEXTRAS_LIB "-DBRANCH=$(BRANCH)" -D%(PreprocessorDefinitions) "-I.\..\3rdparty\libusb\libusb" "-I$(VULKAN_SDK)\Include" "-I.\..\3rdparty\minidx12\Include" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtANGLE" "-I$(QTDIR)\include\QtQml" "-I$(QTDIR)\include\QtNetwork" "-I$(QTDIR)\include\QtCore" "-I.\release" "-I$(QTDIR)\mkspecs\win32-msvc2015" "-I.\QTGeneratedFiles\$(ConfigurationName)" "-I.\QTGeneratedFiles" "-I$(QTDIR)\include\QtWinExtras"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Moc%27ing %(Identity)...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_WINEXTRAS_LIB -D%(PreprocessorDefinitions) "-I.\..\3rdparty\libusb\libusb" "-I$(VULKAN_SDK)\Include" "-I.\..\3rdparty\minidx12\Include" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtANGLE" "-I$(QTDIR)\include\QtQml" "-I$(QTDIR)\include\QtNetwork" "-I$(QTDIR)\include\QtCore" "-I.\debug" "-I$(QTDIR)\mkspecs\win32-msvc2015" "-I.\QTGeneratedFiles\$(ConfigurationName)" "-I.\QTGeneratedFiles" "-I$(QTDIR)\include\QtWinExtras"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Moc%27ing %(Identity)...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -DWITH_DISCORD_RPC -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DNDEBUG -DQT_WINEXTRAS_LIB -D%(PreprocessorDefinitions) "-I.\..\3rdparty\libusb\libusb" "-I$(VULKAN_SDK)\Include" "-I.\..\3rdparty\minidx12\Include" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtANGLE" "-I$(QTDIR)\include\QtQml" "-I$(QTDIR)\include\QtNetwork" "-I$(QTDIR)\include\QtCore" "-I.\release" "-I$(QTDIR)\mkspecs\win32-msvc2015" "-I.\QTGeneratedFiles\$(ConfigurationName)" "-I.\QTGeneratedFiles" "-I$(QTDIR)\include\QtWinExtras"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">Moc%27ing %(Identity)...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">.\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_WINEXTRAS_LIB -D%(PreprocessorDefinitions) "-I.\..\3rdparty\libusb\libusb" "-I$(VULKAN_SDK)\Include" "-I.\..\3rdparty\minidx12\Include" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtANGLE" "-I$(QTDIR)\include\QtQml" "-I$(QTDIR)\include\QtNetwork" "-I$(QTDIR)\include\QtCore" "-I.\debug" "-I$(QTDIR)\mkspecs\win32-msvc2015" "-I.\QTGeneratedFiles\$(ConfigurationName)" "-I.\QTGeneratedFiles" "-I$(QTDIR)\include\QtWinExtras"</Command>
</CustomBuild>
<ClInclude Include="rpcs3qt\_discord_utils.h" />
<ClInclude Include="rpcs3qt\find_dialog.h" />
<ClInclude Include="rpcs3qt\custom_table_widget_item.h" />

View file

@ -114,6 +114,9 @@
<Filter Include="Gui\skylanders">
<UniqueIdentifier>{c25f8f80-cc74-4760-8488-a291b3026b1d}</UniqueIdentifier>
</Filter>
<Filter Include="Gui\update manager">
<UniqueIdentifier>{ccb05d09-d394-493b-8b08-bde054969da0}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="\rpcs3qt\*.cpp">
@ -749,6 +752,21 @@
<ClCompile Include="rpcs3qt\skylander_dialog.cpp">
<Filter>Gui\skylanders</Filter>
</ClCompile>
<ClCompile Include="rpcs3qt\update_manager.cpp">
<Filter>Gui\update manager</Filter>
</ClCompile>
<ClCompile Include="QTGeneratedFiles\Release - LLVM\moc_update_manager.cpp">
<Filter>Generated Files\Release - LLVM</Filter>
</ClCompile>
<ClCompile Include="QTGeneratedFiles\Debug\moc_update_manager.cpp">
<Filter>Generated Files\Debug</Filter>
</ClCompile>
<ClCompile Include="QTGeneratedFiles\Release\moc_update_manager.cpp">
<Filter>Generated Files\Release</Filter>
</ClCompile>
<ClCompile Include="QTGeneratedFiles\Debug - LLVM\moc_update_manager.cpp">
<Filter>Generated Files\Debug - LLVM</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="\rpcs3qt\*.h">
@ -993,6 +1011,9 @@
<CustomBuild Include="headless_application.h">
<Filter>rpcs3</Filter>
</CustomBuild>
<CustomBuild Include="rpcs3qt\update_manager.h">
<Filter>Gui\update manager</Filter>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<Image Include="rpcs3.ico" />

View file

@ -1,6 +1,7 @@
#include "stdafx.h"
#include "rpcs3_version.h"
#include "git-version.h"
#include "Utilities/StrUtil.h"
namespace rpcs3
{
@ -9,6 +10,15 @@ namespace rpcs3
return RPCS3_GIT_BRANCH;
}
std::pair<std::string, std::string> get_commit_and_hash()
{
const auto commit_and_hash = fmt::split(RPCS3_GIT_BRANCH, {"-"});
if (commit_and_hash.size() != 2)
return std::make_pair("0", "00000000");
return std::make_pair(commit_and_hash[0], commit_and_hash[1]);
}
// TODO: Make this accessible from cmake and keep in sync with MACOSX_BUNDLE_BUNDLE_VERSION.
// Currently accessible by Windows and Linux build scripts, see implementations when doing MACOSX
const extern utils::version version{ 0, 0, 7, utils::version_type::alpha, 1, RPCS3_GIT_VERSION };

View file

@ -6,6 +6,7 @@
namespace rpcs3
{
std::string get_branch();
std::pair<std::string, std::string> get_commit_and_hash();
extern const utils::version version;
}

View file

@ -42,6 +42,7 @@
trophy_manager_dialog.cpp
trophy_notification_frame.cpp
trophy_notification_helper.cpp
update_manager.cpp
user_account.cpp
user_manager_dialog.cpp
vfs_dialog.cpp

View file

@ -127,10 +127,7 @@ void game_compatibility::RequestCompatibility(bool online)
QNetworkReply* network_reply = m_network_access_manager->get(m_network_request);
// Show Progress
m_progress_dialog = new progress_dialog(tr(".Please wait."), tr("Abort"), 0, 100);
m_progress_dialog->setWindowTitle(tr("Downloading Database"));
m_progress_dialog->setFixedWidth(QLabel("This is the very length of the progressbar due to hidpi reasons.").sizeHint().width());
m_progress_dialog->setValue(0);
m_progress_dialog = new progress_dialog(tr("Downloading Database"), tr(".Please wait."), tr("Abort"), 0, 100);
m_progress_dialog->show();
// Animate progress dialog a bit more

View file

@ -1252,8 +1252,7 @@ void game_list_frame::BatchCreatePPUCaches()
return;
}
progress_dialog* pdlg = new progress_dialog(tr("Creating all PPU caches"), tr("Cancel"), 0, total, this);
pdlg->setWindowTitle(tr("PPU Cache Batch Creation"));
progress_dialog* pdlg = new progress_dialog(tr("PPU Cache Batch Creation"), tr("Creating all PPU caches"), tr("Cancel"), 0, total, this);
pdlg->setAutoClose(false);
pdlg->setAutoReset(false);
pdlg->show();
@ -1298,8 +1297,7 @@ void game_list_frame::BatchRemovePPUCaches()
return;
}
progress_dialog* pdlg = new progress_dialog(tr("Removing all PPU caches"), tr("Cancel"), 0, total, this);
pdlg->setWindowTitle(tr("PPU Cache Batch Removal"));
progress_dialog* pdlg = new progress_dialog(tr("PPU Cache Batch Removal"), tr("Removing all PPU caches"), tr("Cancel"), 0, total, this);
pdlg->setAutoClose(false);
pdlg->setAutoReset(false);
pdlg->show();
@ -1340,8 +1338,7 @@ void game_list_frame::BatchRemoveSPUCaches()
return;
}
progress_dialog* pdlg = new progress_dialog(tr("Removing all SPU caches"), tr("Cancel"), 0, total, this);
pdlg->setWindowTitle(tr("SPU Cache Batch Removal"));
progress_dialog* pdlg = new progress_dialog(tr("SPU Cache Batch Removal"), tr("Removing all SPU caches"), tr("Cancel"), 0, total, this);
pdlg->setAutoClose(false);
pdlg->setAutoReset(false);
pdlg->show();
@ -1385,8 +1382,7 @@ void game_list_frame::BatchRemoveCustomConfigurations()
return;
}
progress_dialog* pdlg = new progress_dialog(tr("Removing all custom configurations"), tr("Cancel"), 0, total, this);
pdlg->setWindowTitle(tr("Custom Configuration Batch Removal"));
progress_dialog* pdlg = new progress_dialog(tr("Custom Configuration Batch Removal"), tr("Removing all custom configurations"), tr("Cancel"), 0, total, this);
pdlg->setAutoClose(false);
pdlg->setAutoReset(false);
pdlg->show();
@ -1431,8 +1427,7 @@ void game_list_frame::BatchRemoveCustomPadConfigurations()
return;
}
progress_dialog* pdlg = new progress_dialog(tr("Removing all custom pad configurations"), tr("Cancel"), 0, total, this);
pdlg->setWindowTitle(tr("Custom Pad Configuration Batch Removal"));
progress_dialog* pdlg = new progress_dialog(tr("Custom Pad Configuration Batch Removal"), tr("Removing all custom pad configurations"), tr("Cancel"), 0, total, this);
pdlg->setAutoClose(false);
pdlg->setAutoReset(false);
pdlg->show();
@ -1474,8 +1469,7 @@ void game_list_frame::BatchRemoveShaderCaches()
return;
}
progress_dialog* pdlg = new progress_dialog(tr("Removing all shader caches"), tr("Cancel"), 0, total, this);
pdlg->setWindowTitle(tr("Shader Cache Batch Removal"));
progress_dialog* pdlg = new progress_dialog(tr("Shader Cache Batch Removal"), tr("Removing all shader caches"), tr("Cancel"), 0, total, this);
pdlg->setAutoClose(false);
pdlg->setAutoReset(false);
pdlg->show();

View file

@ -207,6 +207,7 @@ namespace gui
const gui_save m_enableUIColors = gui_save(meta, "enableUIColors", false);
const gui_save m_richPresence = gui_save(meta, "useRichPresence", true);
const gui_save m_discordState = gui_save(meta, "discordState", "");
const gui_save m_check_upd_start = gui_save(meta, "checkUpdateStart", true);
const gui_save gs_disableMouse = gui_save(gs_frame, "disableMouse", false);
const gui_save gs_resize = gui_save(gs_frame, "resize", false);

View file

@ -172,6 +172,13 @@ void main_window::Init()
// Fix possible hidden game list columns. The game list has to be visible already. Use this after show()
m_gameListFrame->FixNarrowColumns();
#if defined(_WIN32) || defined(__linux__)
if (guiSettings->GetValue(gui::m_check_upd_start).toBool())
{
m_updater.check_for_updates(true, this);
}
#endif
}
// returns appIcon
@ -423,8 +430,7 @@ void main_window::InstallPkg(const QString& dropPath, bool is_bulk)
const std::string fileName = sstr(QFileInfo(filePath).fileName());
const std::string path = sstr(filePath);
progress_dialog pdlg(tr("Installing package ... please wait ..."), tr("Cancel"), 0, 1000, this);
pdlg.setWindowTitle(tr("RPCS3 Package Installer"));
progress_dialog pdlg(tr("RPCS3 Package Installer"), tr("Installing package ... please wait ..."), tr("Cancel"), 0, 1000, this);
pdlg.show();
// Synchronization variable
@ -563,8 +569,7 @@ void main_window::InstallPup(const QString& dropPath)
return;
}
progress_dialog pdlg(tr("Installing firmware version %1\nPlease wait...").arg(qstr(version_string)), tr("Cancel"), 0, static_cast<int>(updatefilenames.size()), this);
pdlg.setWindowTitle(tr("RPCS3 Firmware Installer"));
progress_dialog pdlg(tr("RPCS3 Firmware Installer"), tr("Installing firmware version %1\nPlease wait...").arg(qstr(version_string)), tr("Cancel"), 0, static_cast<int>(updatefilenames.size()), this);
pdlg.show();
// Synchronization variable
@ -1411,6 +1416,20 @@ void main_window::CreateConnects()
}
});
connect(ui->updateAct, &QAction::triggered, [=]()
{
#if !defined(_WIN32) && !defined(__linux__)
QMessageBox::warning(this, tr("Auto-updater"), tr("The auto-updater currently isn't available for your os."));
return;
#endif
if(!Emu.IsStopped())
{
QMessageBox::warning(this, tr("Auto-updater"), tr("Please stop the emulation before trying to update."));
return;
}
m_updater.check_for_updates(false, this);
});
connect(ui->aboutAct, &QAction::triggered, [this]
{
about_dialog dlg(this);

View file

@ -15,6 +15,7 @@
#include "debugger_frame.h"
#include "game_list_frame.h"
#include "gui_settings.h"
#include "update_manager.h"
#include <memory>
@ -144,4 +145,6 @@ private:
game_list_frame* m_gameListFrame = nullptr;
std::shared_ptr<gui_settings> guiSettings;
std::shared_ptr<emu_settings> emuSettings;
update_manager m_updater;
};

View file

@ -141,7 +141,7 @@
<x>0</x>
<y>0</y>
<width>1058</width>
<height>22</height>
<height>20</height>
</rect>
</property>
<property name="contextMenuPolicy">
@ -298,7 +298,7 @@
<property name="title">
<string>Help</string>
</property>
<addaction name="actionCheck_for_Updates"/>
<addaction name="updateAct"/>
<addaction name="separator"/>
<addaction name="aboutAct"/>
<addaction name="aboutQtAct"/>
@ -638,10 +638,7 @@
<string>RAP Files</string>
</property>
</action>
<action name="actionCheck_for_Updates">
<property name="enabled">
<bool>false</bool>
</property>
<action name="updateAct">
<property name="text">
<string>Check for Updates</string>
</property>

View file

@ -2,10 +2,12 @@
#include <QLabel>
progress_dialog::progress_dialog(const QString &labelText, const QString &cancelButtonText, int minimum, int maximum, QWidget *parent, Qt::WindowFlags flags)
progress_dialog::progress_dialog(const QString &windowTitle, const QString &labelText, const QString &cancelButtonText, int minimum, int maximum, QWidget *parent, Qt::WindowFlags flags)
: QProgressDialog(labelText, cancelButtonText, minimum, maximum, parent, flags)
{
setWindowTitle(windowTitle);
setFixedWidth(QLabel("This is the very length of the progressdialog due to hidpi reasons.").sizeHint().width());
setValue(0);
setWindowModality(Qt::WindowModal);
connect(this, &QProgressDialog::canceled, this, &QProgressDialog::deleteLater);

View file

@ -17,7 +17,7 @@
class progress_dialog : public QProgressDialog
{
public:
progress_dialog(const QString &labelText, const QString &cancelButtonText, int minimum, int maximum, QWidget *parent = Q_NULLPTR, Qt::WindowFlags flags = Qt::WindowFlags());
progress_dialog(const QString &windowTitle, const QString &labelText, const QString &cancelButtonText, int minimum, int maximum, QWidget *parent = Q_NULLPTR, Qt::WindowFlags flags = Qt::WindowFlags());
~progress_dialog();
void SetValue(int progress);

View file

@ -1311,6 +1311,8 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
SubscribeTooltip(ui->cb_show_pup_install, json_gui["show_pup_install"].toString());
SubscribeTooltip(ui->cb_check_update_start, json_gui["check_update_start"].toString());
SubscribeTooltip(ui->useRichPresence, json_gui["useRichPresence"].toString());
SubscribeTooltip(ui->discordState, json_gui["discordState"].toString());
@ -1372,6 +1374,8 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
ui->cb_show_pkg_install->setChecked(xgui_settings->GetValue(gui::ib_pkg_success).toBool());
ui->cb_show_pup_install->setChecked(xgui_settings->GetValue(gui::ib_pup_success).toBool());
ui->cb_check_update_start->setChecked(xgui_settings->GetValue(gui::m_check_upd_start).toBool());
bool enableUIColors = xgui_settings->GetValue(gui::m_enableUIColors).toBool();
ui->cb_custom_colors->setChecked(enableUIColors);
ui->pb_gl_icon_color->setEnabled(enableUIColors);
@ -1447,6 +1451,10 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
{
xgui_settings->SetValue(gui::ib_pup_success, val);
});
connect(ui->cb_check_update_start, &QCheckBox::clicked, [=](bool val)
{
xgui_settings->SetValue(gui::m_check_upd_start, val);
});
connect(ui->cb_custom_colors, &QCheckBox::clicked, [=](bool val)
{

View file

@ -2514,6 +2514,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cb_check_update_start">
<property name="text">
<string>Check for updates on startup</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_17">
<property name="orientation">

View file

@ -0,0 +1,560 @@
#include "stdafx.h"
#include "update_manager.h"
#include "rpcs3_version.h"
#include "Utilities/StrUtil.h"
#include "Crypto/sha256.h"
#include "Emu/System.h"
#include <QMessageBox>
#include <sstream>
#include <iomanip>
#if defined(_WIN32)
#include <windows.h>
#include <CpuArch.h>
#include <7z.h>
#include <7zAlloc.h>
#include <7zBuf.h>
#include <7zCrc.h>
#include <7zFile.h>
#include <7zVersion.h>
#define PATH_MAX MAX_PATH
#else
#include <unistd.h>
#include <sys/stat.h>
#endif
update_manager::update_manager()
{
m_manager.setRedirectPolicy(QNetworkRequest::NoLessSafeRedirectPolicy);
}
void update_manager::check_for_updates(bool automatic, QWidget* parent)
{
if (QSslSocket::supportsSsl() == false)
{
LOG_ERROR(GENERAL, "Can't update! Please make sure your system supports SSL.");
if (!automatic)
QMessageBox::warning(parent, tr("Auto-updater"), tr("Can't update! Please make sure your system supports SSL."));
return;
}
m_parent = parent;
const std::string request_url = m_update_url + rpcs3::get_commit_and_hash().second;
QNetworkReply* reply_json = m_manager.get(QNetworkRequest(QUrl(QString::fromStdString(request_url))));
m_progress_dialog = new progress_dialog(tr("Checking For Updates"), tr("Please wait..."), tr("Abort"), 0, 100, parent);
m_progress_dialog->setAutoClose(false);
m_progress_dialog->setAutoReset(false);
m_progress_dialog->show();
connect(m_progress_dialog, &QProgressDialog::canceled, reply_json, &QNetworkReply::abort);
connect(m_progress_dialog, &QProgressDialog::finished, m_progress_dialog, &QProgressDialog::deleteLater);
// clang-format off
connect(reply_json, &QNetworkReply::downloadProgress, [&](qint64 bytesReceived, qint64 bytesTotal)
{
m_progress_dialog->setMaximum(bytesTotal);
m_progress_dialog->setValue(bytesReceived);
});
connect(reply_json, QOverload<QNetworkReply::NetworkError>::of(&QNetworkReply::error), this, &update_manager::handle_error);
connect(reply_json, &QNetworkReply::finished, [=]()
{
handle_reply(reply_json, &update_manager::handle_json, automatic, "Retrieved Json Info");
});
// clang-format on
}
void update_manager::handle_error(QNetworkReply::NetworkError error)
{
if (error != QNetworkReply::NoError)
{
QNetworkReply* reply = qobject_cast<QNetworkReply *>(sender());
if(!reply)
return;
m_progress_dialog->close();
reply->deleteLater();
if (error != QNetworkReply::OperationCanceledError)
{
QString error = reply->errorString();
LOG_ERROR(GENERAL, "[Auto-updater] Network Error: %s", error.toStdString());
}
}
}
bool update_manager::handle_reply(QNetworkReply* reply, std::function<bool(update_manager& man, const QByteArray&, bool)> func, bool automatic, const std::string& message)
{
if (auto error = reply->error(); error != QNetworkReply::NoError)
return false;
// Read data from network reply
const QByteArray data = reply->readAll();
reply->deleteLater();
LOG_NOTICE(GENERAL, "[Auto-updater] %s", message);
if (!func(*this, data, automatic))
{
m_progress_dialog->close();
if (!automatic)
QMessageBox::warning(m_parent, tr("Auto-updater"), tr("An error occured during the auto-updating process.\nCheck the log for more information."));
}
return true;
}
bool update_manager::handle_json(const QByteArray& data, bool automatic)
{
const QJsonObject json_data = QJsonDocument::fromJson(data).object();
int return_code = json_data["return_code"].toInt(-255);
bool hash_found = true;
if (return_code < 0)
{
std::string error_message;
switch (return_code)
{
case -1: error_message = "Hash not found(Custom/PR build)"; break;
case -2: error_message = "Server Error - Maintenance Mode"; break;
case -3: error_message = "Server Error - Illegal Search"; break;
case -255: error_message = "Server Error - Return code not found"; break;
default: error_message = "Server Error - Unknown Error"; break;
}
if (return_code != -1)
LOG_ERROR(GENERAL, "[Auto-updater] error: %s return code: %d", error_message, return_code);
else
LOG_WARNING(GENERAL, "[Auto-updater] error: %s return code: %d", error_message, return_code);
// If a user clicks "Check for Updates" with a custom build ask him if he's sure he wants to update to latest version
if (!automatic && return_code == -1)
{
if (QMessageBox::question(m_progress_dialog, tr("Auto-updater"), tr("You're currently using a custom or PR build.\n\nDo you want to update to the latest official rpcs3 version?"),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
{
m_progress_dialog->close();
return true;
}
hash_found = false;
}
else
{
return false;
}
}
const auto& latest = json_data["latest_build"];
if (!latest.isObject())
{
LOG_ERROR(GENERAL, "[Auto-updater] Json doesn't contain latest_build section");
return false;
}
QString os;
#ifdef _WIN32
os = "windows";
#elif defined(__linux__)
os = "linux";
#else
LOG_ERROR(GENERAL, "[Auto-updater] Your os isn't currently supported by the auto-updater");
return false;
#endif
// Check that every bit of info we need is there
if (!latest[os].isObject() || !latest[os]["download"].isString() || !latest[os]["size"].isDouble() || !latest[os]["checksum"].isString() || !latest["version"].isString() ||
!latest["datetime"].isString() ||
(hash_found && (!json_data["current_build"].isObject() || !json_data["current_build"]["version"].isString() || !json_data["current_build"]["datetime"].isString())))
{
LOG_ERROR(GENERAL, "[Auto-updater] Some information seems unavailable");
return false;
}
if (hash_found && return_code == 0)
{
LOG_SUCCESS(GENERAL, "[Auto-updater] RPCS3 is up to date!");
m_progress_dialog->close();
if (!automatic)
QMessageBox::information(m_parent, tr("Auto-updater"), tr("Your version is already up to date!"));
return true;
}
if (hash_found)
{
// Calculates how old the build is
std::string cur_date = json_data["current_build"]["datetime"].toString().toStdString();
std::string lts_date = latest["datetime"].toString().toStdString();
tm cur_tm, lts_tm;
QString timediff = "";
auto time_from_str = [](const std::string& str, const std::string& format, tm* tm) -> bool
{
std::istringstream input(str);
input.imbue(std::locale(setlocale(LC_ALL, nullptr)));
input >> std::get_time(tm, format.c_str());
if (input.fail())
return false;
return true;
};
if (time_from_str(cur_date, "%Y-%m-%d %H:%M:%S", &cur_tm) && time_from_str(lts_date, "%Y-%m-%d %H:%M:%S", &lts_tm))
{
time_t cur_time = mktime(&cur_tm);
time_t lts_time = mktime(&lts_tm);
s64 u_timediff = (s64)std::difftime(lts_time, cur_time);
timediff = tr("Your version is %1 day(s), %2 hour(s) and %3 minute(s) old.").arg(u_timediff / (60 * 60 * 24)).arg((u_timediff / (60 * 60)) % 24).arg((u_timediff / 60) % 60);
}
const QString to_show = tr("A new version of RPCS3 is available!\n\nCurrent version: %1\nLatest version: %2\n%3\n\nDo you want to update?")
.arg(json_data["current_build"]["version"].toString())
.arg(latest["version"].toString())
.arg(timediff);
if (QMessageBox::question(m_progress_dialog, tr("Update Available"), to_show, QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
{
m_progress_dialog->close();
return true;
}
}
m_expected_hash = latest[os]["checksum"].toString().toStdString();
m_expected_size = latest[os]["size"].toInt();
m_progress_dialog->setWindowTitle(tr("Downloading Update"));
// Download RPCS3
m_progress_dialog->setValue(0);
QNetworkReply* reply_rpcs3 = m_manager.get(QNetworkRequest(QUrl(latest[os]["download"].toString())));
connect(m_progress_dialog, &QProgressDialog::canceled, reply_rpcs3, &QNetworkReply::abort);
// clang-format off
connect(reply_rpcs3, &QNetworkReply::downloadProgress, [&](qint64 bytesReceived, qint64 bytesTotal)
{
m_progress_dialog->setMaximum(bytesTotal);
m_progress_dialog->setValue(bytesReceived);
});
connect(reply_rpcs3, QOverload<QNetworkReply::NetworkError>::of(&QNetworkReply::error), this, &update_manager::handle_error);
connect(reply_rpcs3, &QNetworkReply::finished, [=]()
{
handle_reply(reply_rpcs3, &update_manager::handle_rpcs3, automatic, "Retrieved RPCS3");
});
// clang-format on
return true;
}
bool update_manager::handle_rpcs3(const QByteArray& rpcs3_data, bool automatic)
{
if (m_expected_size != rpcs3_data.size())
{
LOG_ERROR(GENERAL, "[Auto-updater] Download size mismatch: %d expected: %d", rpcs3_data.size(), m_expected_size);
return false;
}
u8 res_hash[32];
mbedtls_sha256_context ctx;
mbedtls_sha256_init(&ctx);
mbedtls_sha256_starts_ret(&ctx, 0);
mbedtls_sha256_update_ret(&ctx, (const unsigned char*)rpcs3_data.data(), rpcs3_data.size());
mbedtls_sha256_finish_ret(&ctx, res_hash);
std::string res_hash_string("0000000000000000000000000000000000000000000000000000000000000000");
for (size_t index = 0; index < 32; index++)
{
constexpr auto pal = "0123456789ABCDEF";
res_hash_string[index * 2] = pal[res_hash[index] >> 4];
res_hash_string[(index * 2) + 1] = pal[res_hash[index] & 15];
}
if (m_expected_hash != res_hash_string)
{
LOG_ERROR(GENERAL, "[Auto-updater] Hash mismatch: %s expected: %s", res_hash_string, m_expected_hash);
return false;
}
std::string replace_path;
#ifdef __linux__
const char* appimage_path = ::getenv("APPIMAGE");
if (appimage_path != nullptr)
{
replace_path = appimage_path;
LOG_NOTICE(GENERAL, "[Auto-updater] Found appimage path: %s", appimage_path);
}
else
{
LOG_WARNING(GENERAL, "[Auto-updater] Failed to find AppImage path");
char exe_path[PATH_MAX];
ssize_t len = ::readlink("/proc/self/exe", exe_path, sizeof(exe_path) - 1);
if (len == -1)
{
LOG_ERROR(GENERAL, "[Auto-updater] Failed to find executable path");
return false;
}
exe_path[len] = '\0';
LOG_TRACE(GENERAL, "[Auto-updater] Found exec path: %s", exe_path);
replace_path = exe_path;
}
m_progress_dialog->setWindowTitle(tr("Updating RPCS3"));
// Move the appimage/exe and replace with new appimage
fs::rename(replace_path, "/tmp/rpcs3_old", true);
fs::file new_appimage(replace_path, fs::read + fs::write + fs::create + fs::trunc);
if (!new_appimage)
{
LOG_ERROR(GENERAL, "[Auto-updater] Failed to create new AppImage file: %s", replace_path);
return false;
}
if (new_appimage.write(rpcs3_data.data(), rpcs3_data.size()) != rpcs3_data.size())
{
LOG_ERROR(GENERAL, "[Auto-updater] Failed to write new AppImage file: %s", replace_path);
return false;
}
if (fchmod(new_appimage.get_handle(), S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) == -1)
{
LOG_ERROR(GENERAL, "[Auto-updater] Failed to chmod rwxrxrx %s", replace_path);
return false;
}
new_appimage.close();
LOG_SUCCESS(GENERAL, "[Auto-updater] Successfully updated %s!", replace_path);
#elif defined(_WIN32)
char temp_path[PATH_MAX];
GetTempPathA(sizeof(temp_path) - 1, temp_path);
temp_path[PATH_MAX - 1] = 0;
std::string tmpfile_path = temp_path;
tmpfile_path += "\\rpcs3_update.7z";
fs::file tmpfile(tmpfile_path, fs::read + fs::write + fs::create + fs::trunc);
if (!tmpfile)
{
LOG_ERROR(GENERAL, "[Auto-updater] Failed to create temporary file: %s", tmpfile_path);
return false;
}
if (tmpfile.write(rpcs3_data.data(), rpcs3_data.size()) != rpcs3_data.size())
{
LOG_ERROR(GENERAL, "[Auto-updater] Failed to write temporary file: %s", tmpfile_path);
return false;
}
tmpfile.close();
m_progress_dialog->setWindowTitle(tr("Updating RPCS3"));
// 7z stuff (most of this stuff is from 7z Util sample and has been reworked to be more stl friendly)
ISzAlloc allocImp;
ISzAlloc allocTempImp;
CFileInStream archiveStream;
CLookToRead2 lookStream;
CSzArEx db;
SRes res;
UInt16 temp_u16[PATH_MAX];
u8 temp_u8[PATH_MAX];
const size_t kInputBufSize = ((size_t)1 << 18);
const ISzAlloc g_Alloc = {SzAlloc, SzFree};
allocImp = g_Alloc;
allocTempImp = g_Alloc;
if (InFile_Open(&archiveStream.file, tmpfile_path.c_str()))
{
LOG_ERROR(GENERAL, "[Auto-updater] Failed to open temporary storage file: %s", tmpfile_path);
return false;
}
FileInStream_CreateVTable(&archiveStream);
LookToRead2_CreateVTable(&lookStream, False);
lookStream.buf = NULL;
res = SZ_OK;
{
lookStream.buf = (Byte*)ISzAlloc_Alloc(&allocImp, kInputBufSize);
if (!lookStream.buf)
res = SZ_ERROR_MEM;
else
{
lookStream.bufSize = kInputBufSize;
lookStream.realStream = &archiveStream.vt;
LookToRead2_Init(&lookStream);
}
}
CrcGenerateTable();
SzArEx_Init(&db);
auto error_free7z = [&]() {
SzArEx_Free(&db, &allocImp);
ISzAlloc_Free(&allocImp, lookStream.buf);
File_Close(&archiveStream.file);
switch (res)
{
case SZ_OK: break;
case SZ_ERROR_UNSUPPORTED: LOG_ERROR(GENERAL, "[Auto-updater] 7z decoder doesn't support this archive"); break;
case SZ_ERROR_MEM: LOG_ERROR(GENERAL, "[Auto-updater] 7z decoder failed to allocate memory"); break;
case SZ_ERROR_CRC: LOG_ERROR(GENERAL, "[Auto-updater] 7z decoder CRC error"); break;
default: LOG_ERROR(GENERAL, "[Auto-updater] 7z decoder error: %d", (u64)res); break;
}
};
if (res != SZ_OK)
{
error_free7z();
return false;
}
res = SzArEx_Open(&db, &lookStream.vt, &allocImp, &allocTempImp);
if (res != SZ_OK)
{
error_free7z();
return false;
}
UInt32 blockIndex = 0xFFFFFFFF;
Byte* outBuffer = 0;
size_t outBufferSize = 0;
// Creates temp folder for moving active files
std::string tmp_folder = Emulator::GetEmuDir() + m_tmp_folder;
fs::create_dir(tmp_folder);
for (UInt32 i = 0; i < db.NumFiles; i++)
{
size_t offset = 0;
size_t outSizeProcessed = 0;
size_t len;
unsigned isDir = SzArEx_IsDir(&db, i);
len = SzArEx_GetFileNameUtf16(&db, i, NULL);
if (len >= PATH_MAX)
{
LOG_ERROR(GENERAL, "[Auto-updater] 7z decoder error: filename longer or equal to PATH_MAX");
error_free7z();
return false;
}
SzArEx_GetFileNameUtf16(&db, i, temp_u16);
memset(temp_u8, 0, sizeof(temp_u8));
// Simplistic conversion to UTF-8
for (size_t index = 0; index < len; index++)
{
if (temp_u16[index] > 0xFF)
{
LOG_ERROR(GENERAL, "[Auto-updater] 7z decoder error: Failed to convert utf-16 to utf-8");
error_free7z();
return false;
}
temp_u8[index] = (u8)temp_u16[index];
}
temp_u8[len] = 0;
std::string name((char*)temp_u8);
name = Emulator::GetEmuDir() + name;
if (!isDir)
{
res = SzArEx_Extract(&db, &lookStream.vt, i, &blockIndex, &outBuffer, &outBufferSize, &offset, &outSizeProcessed, &allocImp, &allocTempImp);
if (res != SZ_OK)
break;
}
if (size_t pos = name.find_last_of('/'); pos != std::string::npos)
{
LOG_TRACE(GENERAL, "[Auto-updater] Creating path: %s", name.substr(0, pos));
fs::create_path(name.substr(0, pos));
}
if (isDir)
{
LOG_TRACE(GENERAL, "[Auto-updater] Creating dir: %s", name);
fs::create_dir(name);
continue;
}
fs::file outfile(name, fs::read + fs::write + fs::create + fs::trunc);
if (!outfile)
{
// File failed to open, probably because in use, rename existing file and try again
const auto pos = name.find_last_of('/');
std::string filename;
if (pos == std::string::npos)
filename = name;
else
filename = name.substr(pos + 1);
// Moving to temp is not an option on windows as it will fail if the disk is different
// So we create a folder in config dir and move stuff there
const std::string rename_target = tmp_folder + filename;
LOG_TRACE(GENERAL, "[Auto-updater] Renaming %s to %s", name, rename_target);
if (!fs::rename(name, rename_target, true))
{
LOG_ERROR(GENERAL, "[Auto-updater] Failed to rename %s to %s", name, rename_target);
res = SZ_ERROR_FAIL;
break;
}
outfile.open(name, fs::read + fs::write + fs::create + fs::trunc);
if (!outfile)
{
LOG_ERROR(GENERAL, "[Auto-updater] can not open output file %s", name);
res = SZ_ERROR_FAIL;
break;
}
}
if (outfile.write(outBuffer + offset, outSizeProcessed) != outSizeProcessed)
{
LOG_ERROR(GENERAL, "[Auto-updater] can not write output file: %s", name);
res = SZ_ERROR_FAIL;
break;
}
outfile.close();
}
error_free7z();
if (res)
return false;
replace_path = Emulator::GetEmuDir() + "rpcs3.exe";
#endif
m_progress_dialog->close();
QMessageBox::information(m_parent, tr("Auto-updater"), tr("Update successful!"));
int ret = execl(replace_path.c_str(), replace_path.c_str(), nullptr);
if (ret == -1)
{
LOG_ERROR(GENERAL, "[Auto-updater] Relaunching failed with result: %d(%s)", ret, strerror(errno));
return false;
}
return true;
}

View file

@ -0,0 +1,36 @@
#pragma once
#include <QtCore>
#include <QtNetwork>
#include "progress_dialog.h"
class update_manager : public QObject
{
Q_OBJECT
private:
const std::string m_update_url = "https://update.rpcs3.net/?api=v1&c=";
const std::string m_tmp_folder = "/rpcs3_old/";
private:
progress_dialog* m_progress_dialog = nullptr;
QWidget* m_parent = nullptr;
QNetworkAccessManager m_manager;
QNetworkReply* reply_rpcs3 = nullptr;
std::string m_expected_hash;
u64 m_expected_size = 0;
private:
bool handle_reply(QNetworkReply* reply, std::function<bool(update_manager& man, const QByteArray&, bool)> func, bool automatic, const std::string& message);
bool handle_json(const QByteArray& json_data, bool automatic);
bool handle_rpcs3(const QByteArray& rpcs3_data, bool automatic);
public:
update_manager();
void check_for_updates(bool automatic, QWidget* parent = nullptr);
private Q_SLOTS:
void handle_error(QNetworkReply::NetworkError error);
};