diff options
author | John Ankarström <john@ankarstrom.se> | 2022-08-24 03:01:10 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-08-24 03:01:10 +0200 |
commit | ccb7d14a8b1ad6d80308c14a3f0b209d66c3c88d (patch) | |
tree | db79708df0f22a9cb721bbadb644bbcb5f6e975b /c/data.h | |
parent | 9c237e1537238ebe95289ed6df82f6d43c482944 (diff) | |
download | EpisodeBrowser-ccb7d14a8b1ad6d80308c14a3f0b209d66c3c88d.tar.gz |
Add FetchScreenwriters. Improve thread communication.
Diffstat (limited to 'c/data.h')
-rw-r--r-- | c/data.h | 22 |
1 files changed, 14 insertions, 8 deletions
@@ -10,8 +10,11 @@ #include "win.h" /* Fetch data from the web. */ -void FetchData(); -void WaitFetchData(bool* bDone) noexcept; +void FetchData(unsigned char* sig); +void FetchScreenwriters(unsigned char* sig); + +/* Wait for thread. */ +void WaitFor(void (*f)(unsigned char*)); /* The structs ending with A are written as-is to disk. As such, they * should be regarded as immutable. If the format needs to be changed @@ -54,7 +57,7 @@ struct CfgA unsigned short cEp = 4096; unsigned short iFocus = 0; unsigned short heightDlv = 0; - wchar_t limitScreenwriter[64] = {0}; + wchar_t limitScreenwriter[64] = {0}; /* TODO: 64 -> 48 */ wchar_t root[260] = {0}; wchar_t glob[64] = {0}; wchar_t url[192] = {0}; @@ -76,6 +79,11 @@ constexpr inline bool HasVersion<T, decltype((void) T::version, 0)> = true; template <typename T> struct FileView { + HANDLE hf; + HANDLE hm; + T* view; + size_t c; + static FileView Initialized(const wchar_t* filename, size_t c, size_t cInit = 0) { bool bExisting = GetFileAttributes(filename) != INVALID_FILE_ATTRIBUTES; @@ -150,6 +158,9 @@ struct FileView return t; } + T* begin() { return *view; } + T* end() { return view[c-1]; } + inline operator T*() noexcept { return view; @@ -159,11 +170,6 @@ struct FileView { return view; } - - HANDLE hf; - HANDLE hm; - T* view; - size_t c; }; inline int FromWeb(const int iEp, ElvDataA& e, DlvDataA& d) noexcept |