Commit Graph

75496 Commits

Author SHA1 Message Date
Alexander Tkachev
2d3cfffa84 KYRA: Fix openSaveForWriting() to return OutSaveFile 2016-08-24 16:07:55 +06:00
Alexander Tkachev
65e87c6c70 CLOUD: Update save's timestamp on rewrite
This commit moves save/load timestamps static methods into
DefaultSaveFileManager and fixes a few related bugs.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
aee713141b CLOUD: Make OutSaveFile start saves sync
It had to become a proxy class in order to do that.
finalize() starts the saves sync.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
81106b0444 CLOUD: Update local server's style.css 2016-08-24 16:07:55 +06:00
Alexander Tkachev
8484273f36 CLOUD: Fix "-Wcast-qual"
The passed buffer is not changed, so could be `const`.

You might see that `postFields.c_str()` is `buffer`. Yet, as it's
`postFields`, it's used for POST in curl_easy_setopt(), which copies the
passed buffer. When `buffer` is used for upload, it's an actual bytes
buffer, kept in CurlRequest.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
caa53d9f6c CLOUD: Fix "-Wconversion-null"
That `false` came from TranslationManager's function, which was
returning bool, not a pointer. Somehow missed that line.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
39eb76f8c2 CLOUD: Fix "zero-length format string" warning 2016-08-24 16:07:55 +06:00
Alexander Tkachev
04cef8928c CLOUD: Fix "type qualifiers ignored" warning 2016-08-24 16:07:55 +06:00
Alexander Tkachev
b908b286b9 CLOUD: Fix "signed/unsigned integers" warning
The "comparison between signed and unsigned integer expressions" one.

Note that in UploadRequests size() and pos() are acutally signed,
because they could return -1. This commit implies that Requests are
working with such Streams which doesn't.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
1addefad7e CLOUD: Use correct redirect_uris
Usage of #ifdef there (and in StorageWizardDialog) means that ScummVM
doesn't support both local webserver and scummvm.org paths at the same
time. It's either built with SDL_net (thus supporting localhost path) or
without it (thus using scummvm.org).
2016-08-24 16:07:55 +06:00
Alexander Tkachev
6ac69729d5 CLOUD: Add some mutexes in LocalWebserver 2016-08-24 16:07:55 +06:00
Alexander Tkachev
5e70f64e10 CLOUD: Embed cloud icons as byte arrays 2016-08-24 16:07:55 +06:00
Alexander Tkachev
a56c7a3bd6 CLOUD: Update IndexPageHandler to search wwwroot.zip
Now it also searches for that in themepath, not with SearchMan only.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
c2c2ba908f GUI: Hide StorageWizardDialog fields if server present 2016-08-24 16:07:55 +06:00
Alexander Tkachev
5176eaba81 CLOUD: Add wwwroot
wwwroot.zip contains ScummVM local webserver's resources, such as
template html pages, styles and images.

One can make it from wwwroot directory contents by running
make_archive.py script.

It's added to scummvm.rc, so it's included in the executable (it works
with MinGW, but I was unable to do that in VS yet).

IndexPageHandler is the one who returns these resources. It uses
index.html for "/". I'm replacing "{message}" with translated message,
so that's the way I thought the templates should work.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
43071c0972 CLOUD: Update LocalWebserver
* fix handling connections;
* fix idling strategy;
* add setClientGetHandler() for SeekableReadStream;
* add determineMimeType().
2016-08-24 16:07:55 +06:00
Alexander Tkachev
0def9c50a7 CLOUD: Fix Client
Cleanup in open()
2016-08-24 16:07:55 +06:00
Alexander Tkachev
5ac3adbd4f CLOUD: Add IndexPageHandler
This commit also adds LocalWebserver's stopOnIdle().
That means server is not stopped immediately, but only when all clients
are served.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
733d998e6a CLOUD: Minor Client fix 2016-08-24 16:07:55 +06:00
Alexander Tkachev
3946f23d17 CLOUD: Prepare code for path handlers
LocalWebserver would storage the handlers.

Client now has methods like path() or query() to access different parts
of the request.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
ceb86a0dd8 CLOUD: Clarify calculatedChecksum's initial value 2016-08-24 16:07:55 +06:00
Peter Bozsó
434b740f4d CLOUD: Remove a couple of unnecessary whitespaces 2016-08-24 16:07:55 +06:00
Alexander Tkachev
892c1bf84c CLOUD: Add HTTP response codes in GetClientHandler 2016-08-24 16:07:55 +06:00
Alexander Tkachev
6e1b667dd6 CLOUD: Minor Client fix 2016-08-24 16:07:55 +06:00
Alexander Tkachev
13c54f6685 CLOUD: Add GetClientHandler
That ClientHandler is made for responding GET requests. It calculates
stream's length, it allows to specify response code and headers, it can
be used to transfer any ReadStream.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
99c51380fd CLOUD: Add ClientState::BAD_REQUEST 2016-08-24 16:07:55 +06:00
Alexander Tkachev
6126435b64 CLOUD: Add Networking::Client
Keeps current client's state
2016-08-24 16:07:55 +06:00
Alexander Tkachev
0af97e59bc CLOUD: Add LocalWebserver
Available as LocalServer singleton. It's being started and stopped by
StorageWizardDialog. It doesn't handle clients yet, though.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
9f7bea156a CLOUD: Init SDL_Net 2016-08-24 16:07:55 +06:00
Alexander Tkachev
e2b3a9366e CONFIGURE: Add --with-sdlnet-prefix option 2016-08-24 16:07:55 +06:00
Alexander Tkachev
f571f3dd28 CLOUD: Add comments for StorageWizardDialog methods 2016-08-24 16:07:55 +06:00
Alexander Tkachev
a83e91e1ca CLOUD: Update StorageWizardDialog's code check
Now the code contains its own crc16 in it, plus the way checksum is
calculated has changed.

Some online tool calls this exact way of calculating crc16
"CRC16_CCITT_FALSE".
2016-08-24 16:07:55 +06:00
Peter Bozsó
c1ffb09fb0 CLOUD: Fix configuration handling in CloudManager 2016-08-24 16:07:55 +06:00
Alexander Tkachev
3db4915b66 CLOUD: Add checks in StorageWizardDialog
It now calculates the checksums for code pieces to determine whether
it's correct and CRC-32 for user to compare with one shown on site.
2016-08-24 16:07:55 +06:00
Peter Bozsó
a8eebbe851 CLOUD: Get rid of CloudConfigHelper, use kCloudDomain where approriate 2016-08-24 16:07:55 +06:00
Alexander Tkachev
8a84263d2b CLOUD: Do saves sync on Storage connect 2016-08-24 16:07:55 +06:00
Alexander Tkachev
0aea8db7e1 CLOUD: Make Storage::savesSync() restart
If Storage::syncSaves() is called when sync is running, another sync
would be automatically scheduled in the end of the current one.

That could be helpful when we want to specify that we changed something
during sync (created new save slot, for example).
2016-08-24 16:07:55 +06:00
Alexander Tkachev
ca0b58513d CLOUD: Add CloudConfigHelper to module.mk 2016-08-24 16:07:55 +06:00
Peter Bozsó
219e565c32 CLOUD: Introduce CloudConfigHelper 2016-08-24 16:07:55 +06:00
Peter Bozsó
bfc5cab9e8 CLOUD: Fix end of namespace comment in CloudManager 2016-08-24 16:07:55 +06:00
Peter Bozsó
fd6be018a3 CLOUD: Fix include in CloudManager 2016-08-24 16:07:55 +06:00
Peter Bozsó
fc3e7dec1a CLOUD: Introduce kStoragePrefix in CloudManager 2016-08-24 16:07:55 +06:00
Peter Bozsó
98788a5e7d CLOUD: Remove unnecessary blank lines in switch statement 2016-08-24 16:07:55 +06:00
Peter Bozsó
1403cf006c CLOUD: Make enum StorageIDs' name singular 2016-08-24 16:07:55 +06:00
Peter Bozsó
c068b74f30 CLOUD: Force handling of all StorageIDs values in CloudManager::getStorageConfigName() 2016-08-24 16:07:55 +06:00
Alexander Tkachev
dbafbf2569 CLOUD: Fix getAccessToken()
KEY and SECRET should now load before getAccessToken() uses them, so it
should work now.
2016-08-24 16:07:55 +06:00
Peter Bozsó
2a2beaebc5 Fix DropboxStorage::codeFlowComplete() 2016-08-24 16:07:55 +06:00
Peter Bozsó
bad2ec3ef4 CLOUD: Fix initialization of NetworkReadStream
"networkreadstream.cpp:51:2: error: delegating constructors are permitted only in C++11"
2016-08-24 16:07:55 +06:00
Peter Bozsó
a966de42a9 CLOUD: Fix compilation error in savesyncrequest.h
"savessyncrequest.h:35:35: error: use of undeclared identifier 'UINT_MAX'"
2016-08-24 16:07:55 +06:00
Alexander Tkachev
a651a983dd GUI: Add warning message for game's savepath 2016-08-24 16:07:55 +06:00