From abef6da56913f1c55528103e60a50451a39628b1 Mon Sep 17 00:00:00 2001 From: WlodekM Date: Sun, 16 Jun 2024 10:35:45 +0300 Subject: initial commit --- src/Resources.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/Resources.h (limited to 'src/Resources.h') diff --git a/src/Resources.h b/src/Resources.h new file mode 100644 index 0000000..b320a13 --- /dev/null +++ b/src/Resources.h @@ -0,0 +1,37 @@ +#ifndef CC_RESOURCES_H +#define CC_RESOURCES_H +#include "Core.h" +/* Implements checking, fetching, and patching the default game assets. + Copyright 2014-2023 ClassiCube | Licensed under BSD-3 +*/ +struct HttpRequest; +typedef void (*FetcherErrorCallback)(struct HttpRequest* req); + +/* Number of resources that need to be downloaded */ +extern int Resources_MissingCount; +/* Total size of resources that need to be downloaded */ +extern int Resources_MissingSize; +/* Whether required resources need to be downloaded */ +extern cc_bool Resources_MissingRequired; +/* Checks existence of all assets */ +void Resources_CheckExistence(void); + +/* Whether fetcher is currently downloading resources */ +extern cc_bool Fetcher_Working; +/* Whether fetcher has finished (downloaded all resources, or an error) */ +extern cc_bool Fetcher_Completed; +/* Number of resources that have been downloaded so far */ +extern int Fetcher_Downloaded; +/* Whether a resource failed to download */ +extern cc_bool Fetcher_Failed; +/* Callback function invoked if a resource fails to download */ +extern FetcherErrorCallback Fetcher_ErrorCallback; + +/* Finds name of resource associated with given http request. */ +const char* Fetcher_RequestName(int reqID); +/* Starts asynchronous download of missing resources. */ +void Fetcher_Run(void); +/* Checks if any resources have finished downloading. */ +/* If any have, performs required patching and saving. */ +void Fetcher_Update(void); +#endif -- cgit 1.4.1-2-gfad0