Large diffs are not rendered by default.

@@ -6,8 +6,7 @@ set(SOURCES
AppDelegate.mm
ViewController.h
ViewController.m
UI.h
UI.mm
MacUI.mm
${STORYBOARDS}
)

@@ -31,10 +30,8 @@ target_link_libraries(MacUpdater PRIVATE
"-framework AppKit"
"-framework CoreData"
"-framework Foundation"
uicommon
mbedtls
z
ed25519
uicommon
updatercommon
)

# Compile storyboards (Adapted from https://gitlab.kitware.com/cmake/community/wikis/doc/tutorials/OSX-InterfaceBuilderFiles)
@@ -2,9 +2,10 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.

#include "MacUpdater/UI.h"
#include "MacUpdater/ViewController.h"

#include "UpdaterCommon/UI.h"

#include <Cocoa/Cocoa.h>

#include <functional>
@@ -105,3 +106,7 @@ void run_on_main(std::function<void()> fnc)
{
run_on_main([&] { [GetView() SetTotalProgress:(double)current total:(double)total]; });
}

void UI::Stop()
{
}

This file was deleted.

Large diffs are not rendered by default.

@@ -45,25 +45,16 @@
<ProjectReference Include="..\..\..\Externals\cpp-optparse\cpp-optparse.vcxproj">
<Project>{c636d9d1-82fe-42b5-9987-63b7d4836341}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\Externals\curl\curl.vcxproj">
<Project>{bb00605c-125f-4a21-b33b-7bf418322dcb}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\externals\ed25519\ed25519.vcxproj">
<Project>{5bdf4b91-1491-4fb0-bc27-78e9a8e97dc3}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\Externals\mbedtls\mbedTLS.vcxproj">
<Project>{bdb6578b-0691-4e80-a46c-df21639fd3b8}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\Externals\zlib\zlib.vcxproj">
<Project>{ff213b23-2c26-4214-9f88-85271e557e87}</Project>
</ProjectReference>
<ProjectReference Include="..\Common\Common.vcxproj">
<Project>{2e6c348c-c75c-4d94-8d1e-9c1fcbf3efe4}</Project>
</ProjectReference>
<ProjectReference Include="..\UpdaterCommon\UpdaterCommon.vcxproj">
<Project>{B001D13E-7EAB-4689-842D-801E5ACFFAC5}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Main.cpp" />
<ClCompile Include="UI.cpp" />
<ClCompile Include="WinUI.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
@@ -72,14 +63,11 @@
<ItemGroup>
<SourceFiles Include="$(TargetPath)" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="UI.h" />
</ItemGroup>
<ItemGroup>
<Manifest Include="Updater.exe.manifest" />
</ItemGroup>
<Target Name="AfterBuild" Inputs="@(SourceFiles)" Outputs="@(SourceFiles -> '$(BinaryOutputDir)%(Filename)%(Extension)')">
<Message Text="Copy: @(SourceFiles) -&gt; $(BinaryOutputDir)" Importance="High" />
<Copy SourceFiles="@(SourceFiles)" DestinationFolder="$(BinaryOutputDir)" />
</Target>
</Project>
</Project>
@@ -2,12 +2,9 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="Main.cpp" />
<ClCompile Include="UI.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="UI.h" />
<ClCompile Include="WinUI.cpp" />
</ItemGroup>
<ItemGroup>
<Manifest Include="Updater.exe.manifest" />
</ItemGroup>
</Project>
</Project>
@@ -2,13 +2,14 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.

#include "Updater/UI.h"
#include "UpdaterCommon/UI.h"

#include <string>

#include <Windows.h>
#include <CommCtrl.h>
#include <ShObjIdl.h>

#include <string>

#include "Common/Flag.h"
#include "Common/StringUtil.h"

@@ -0,0 +1,8 @@
add_library(updatercommon
UpdaterCommon.cpp)

target_link_libraries(updatercommon PRIVATE
uicommon
mbedtls
z
ed25519)
@@ -4,7 +4,7 @@

#pragma once

#include <Windows.h>
#include <string>

namespace UI
{
@@ -21,4 +21,6 @@ void SetTotalProgress(int current, int total);
void SetCurrentMarquee(bool marquee);
void ResetCurrentProgress();
void SetCurrentProgress(int current, int total);

void SetVisible(bool visible);
} // namespace UI

Large diffs are not rendered by default.

@@ -0,0 +1,60 @@
// Copyright 2019 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.

#pragma once

#include <array>
#include <cstdio>
#include <map>
#include <optional>
#include <string>
#include <vector>

#include "Common/CommonTypes.h"

extern FILE* log_fp;

struct Manifest
{
using Filename = std::string;
using Hash = std::array<u8, 16>;
std::map<Filename, Hash> entries;
};

// Represent the operations to be performed by the updater.
struct TodoList
{
struct DownloadOp
{
Manifest::Filename filename;
Manifest::Hash hash;
};
std::vector<DownloadOp> to_download;

struct UpdateOp
{
Manifest::Filename filename;
std::optional<Manifest::Hash> old_hash;
Manifest::Hash new_hash;
};
std::vector<UpdateOp> to_update;

struct DeleteOp
{
Manifest::Filename filename;
Manifest::Hash old_hash;
};
std::vector<DeleteOp> to_delete;

void Log() const;
};

void FatalError(const std::string& message);
std::optional<Manifest> FetchAndParseManifest(const std::string& url);
TodoList ComputeActionsToDo(Manifest this_manifest, Manifest next_manifest);
std::optional<std::string> FindOrCreateTempDir(const std::string& base_path);
void CleanUpTempDir(const std::string& temp_dir, const TodoList& todo);
bool PerformUpdate(const TodoList& todo, const std::string& install_base_path,
const std::string& content_base_url, const std::string& temp_path);
void FlushLog();
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{B001D13E-7EAB-4689-842D-801E5ACFFAC5}</ProjectGuid>
<RootNamespace>UpdaterCommon</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
<UseDebugLibraries>true</UseDebugLibraries>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
<UseDebugLibraries>false</UseDebugLibraries>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\VSProps\Base.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemGroup>
<ProjectReference Include="..\Common\Common.vcxproj">
<Project>{2e6c348c-c75c-4d94-8d1e-9c1fcbf3efe4}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\Externals\curl\curl.vcxproj">
<Project>{bb00605c-125f-4a21-b33b-7bf418322dcb}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\externals\ed25519\ed25519.vcxproj">
<Project>{5bdf4b91-1491-4fb0-bc27-78e9a8e97dc3}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\Externals\mbedtls\mbedTLS.vcxproj">
<Project>{bdb6578b-0691-4e80-a46c-df21639fd3b8}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\Externals\zlib\zlib.vcxproj">
<Project>{ff213b23-2c26-4214-9f88-85271e557e87}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ClCompile Include="UpdaterCommon.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

Large diffs are not rendered by default.