MemoryReadWriteStream now returns int32, not uint32. It actually doesn't
ever return -1 to indicate that an error occured, so uint32 was a better
choice, but that's what is used in WriteStream base class now.
That method is abstract, so that's also why OutSaveFile had to override
it.
Commit adds kFeatureClipboardSupport. hasTextInClipboard() and
getTextFromClipboard().
OSystem_SDL has this feature if SDL2 is used.
EditableWidget and StorageWizardDialog use g_system to access clipboard
now.
MetaEngines don't get "locked" files in the list, so won't try to open
these.
Save/Load dialog updates save list every time SavesSyncRequest tells it
to.
It has its own GoogleDriveTokenRefresher and knows how to do info().
This commit also contains JSON int -> long long int fix and
CurlJsonRequest '\n' -> ' ' fix.
Can be used with Callback<T> (means it's still type safe). It's used to
pass not only Request id to user's callback, but also a value user
wanted.
void *data field is removed from RequestInfo.
DumpFile::open() with createPath=true create would create the missing
directories from the path before opening a file. Thus, one can easily
create a file and avoid "can't open a file" error.
Knows how to OAuth already.
This commit also adds CloudManager::addStorage(), so OneDriveStorage can
add newly created Storage and CloudManager can save it in the
configuration file.
In this commit CloudManager starts supporting multiple Storage. Now, in
its init() it loads all the Storages and determines the current one.
It now also has save() method. In that method all Storages are saved
with their new saveConfig() method.
CloudManager::save() not called from anywhere, though. The only one
Storage that could be added is DropboxStorage in case you have no
cloud-related config keys or you have no storages connected.
This commit also adds GlobalFunctionCallback, because it was needed in
order to replace plain C pointers to functions (which were used in
Request) into our object-oriented BaseCallback pointers.
These callbacks can call object's methods, not some global C functions.
DropboxStorage::info2() and DropboxStorage::infoMethodCallback()
demonstrate the idea.
Originally, I intended to add Storage API, StorageFile and StorageInfo
stubs. When I tried to implement a simple info() call, I ended up fixing
Request to contain some pointer field and all callbacks to have Request*
parameter. And, now I have to place callback pointer into Request. which
calls another callback.
And, eventually, these "simple" callbacks would again require another
pointer (to some caller class).
This commit adds:
* ConfMan's new "cloud" domain;
* CloudManager's init() method, where it loads keys from "cloud" configs
domain;
* CurlJsonRequest's addHeader() and addPostField() methods;
* temporary Storage's printInfo() method;
* DropboxStorage's implementation of printInfo(), which is using access
token and user id;
* DropboxStorage's loadFromConfig() static method to load access token
and user id from configs and create a Storage instance with those;
* temporary DropboxStorage's authThroughConsole() static method, which
guides user through auth process from the console.
So, in CloudManager's init() implementation ScummVM checks that there is
"current_storage_type" key in "cloud" domain of configs, and loads
corresponding storage if there is such key.
If there is no such key, ScummVM offers user to auth with Dropbox.
That's done through console, and thus it's temporary (it also requires
restarting ScummVM twice and manually editing config.ini file).
Now we can do REST API request by creating CurlJsonRequest and waiting
for it to call our callback. Passed pointer is Common::JSONValue.
This commit also does some minor variable renaming fixes.
Now it is based on MemoryReadWriteStream, which is introduced by this
commit. This stream is using ring buffer and is dynamically increasing
its size when necessary.
This commit introduces Common::CloudManager, which can be accessed from
OSystem.
The backend for this manager is Cloud::Manager (defined in
backends/cloud/manager.h). It should load all users storages from
configs and provide access to current Storage instance. For now it just
creates a new one.
Cloud::Storage (backends/cloud/storage.h) provides an API to interact
with cloud storage, for example, create new directory or sync files.
Right now it's not ready and has only two dummy methods: listDirectory()
and syncSaves().
There is Cloud::Dropbox::DropboxStorage backend
(backends/cloud/dropbox/dropboxstorage.h) for Cloud::Storage. Right now
it implements both listDirectory() and syncSaves() with starting timer
task and handling it by printing out some JSON examples.
This commit also adds CloudThread class, which work() method is called
every second by TimerManager.
Right now it prints JSON examples on the console, so that's why it's
introduced with SimpleJSON library.