-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathupdater.h
56 lines (39 loc) · 1.17 KB
/
updater.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#pragma once
#include "intrinsics.h"
#include "ggformat.h"
#include "array.h"
#include "str.h"
#define BLAKE2B256_DIGEST_LENGTH 32
enum UpdaterState {
UpdaterState_Init,
UpdaterState_DownloadingVersion,
UpdaterState_DownloadingVersion_Retry,
UpdaterState_DownloadingManifest,
UpdaterState_DownloadingManifest_Retry,
UpdaterState_NeedsUpdate,
UpdaterState_StartUpdate,
// UpdaterState_ReservingSpace,
UpdaterState_DownloadingUpdate,
UpdaterState_InstallingUpdate,
UpdaterState_InstallingUpdateFailed,
UpdaterState_ReadyToPlay,
};
struct Version {
u32 a, b, c, d;
};
inline void format( FormatBuffer * fb, const Version & v, const FormatOpts & opts ) {
str< 128 > s( "{}.{}.{}.{}", v.a, v.b, v.c, v.d );
format( fb, s, opts );
}
typedef void ( * LogCallback )( const char * msg );
void updater_init( bool autostart, LogCallback log_cb, const char * version );
void updater_term();
void updater_start_update();
UpdaterState updater_update();
UpdaterState updater_wait();
Version updater_local_version();
Version updater_remote_version();
u64 updater_update_size();
u64 updater_bytes_downloaded();
float updater_download_progress();
double updater_download_speed();