mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 21:31:53 +00:00
BACKENDS: Change DLC::DLCDesc to struct, deallocate DLCMan._dlcs
This commit is contained in:
parent
b9e5694f39
commit
24a7e4cf73
@ -26,7 +26,7 @@
|
||||
|
||||
namespace DLC {
|
||||
|
||||
class DLCDesc {
|
||||
struct DLCDesc {
|
||||
|
||||
public:
|
||||
enum State {
|
||||
@ -46,9 +46,9 @@ public:
|
||||
Common::String extra;
|
||||
Common::String engineid;
|
||||
Common::String guioptions;
|
||||
uint32 size;
|
||||
uint32 idx;
|
||||
State state;
|
||||
uint32 size = 0;
|
||||
uint32 idx = 0;
|
||||
State state = State::kAvailable;
|
||||
};
|
||||
|
||||
|
||||
|
@ -42,6 +42,12 @@ DLCManager::DLCManager(): CommandSender(nullptr) {
|
||||
_store = new DLC::ScummVMCloud::ScummVMCloud();
|
||||
}
|
||||
|
||||
DLCManager::~DLCManager() {
|
||||
for (uint32 i = 0; i < _dlcs.size(); ++i) {
|
||||
delete _dlcs[i];
|
||||
}
|
||||
}
|
||||
|
||||
void DLCManager::init() {}
|
||||
|
||||
void DLCManager::getAllDLCs() {
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
Common::Queue<DLCDesc*> _queuedDownloadTasks;
|
||||
|
||||
DLCManager();
|
||||
virtual ~DLCManager() {}
|
||||
virtual ~DLCManager();
|
||||
|
||||
void init();
|
||||
|
||||
|
@ -54,23 +54,25 @@ void ScummVMCloud::jsonCallbackGetAllDLCs(Networking::JsonResponse response) {
|
||||
for (uint32 i = 0; i < items.size(); ++i) {
|
||||
if (!Networking::CurlJsonRequest::jsonIsObject(items[i], "ScummVMCloud")) continue;
|
||||
Common::JSONObject item = items[i]->asObject();
|
||||
Common::String id = item.getVal("id")->asString();
|
||||
Common::String name = item.getVal("name")->asString();
|
||||
Common::String url = item.getVal("url")->asString();
|
||||
Common::String platform = item.getVal("platform")->asString();
|
||||
Common::String gameid = item.getVal("gameid")->asString();
|
||||
Common::String description = item.getVal("description")->asString();
|
||||
Common::String language = item.getVal("language")->asString();
|
||||
Common::String extra = item.getVal("extra")->asString();
|
||||
Common::String engineid = item.getVal("engineid")->asString();
|
||||
Common::String guioptions = item.getVal("guioptions")->asString();
|
||||
uint32 size;
|
||||
|
||||
DLC::DLCDesc *dlc = new DLC::DLCDesc();
|
||||
dlc->id = item.getVal("id")->asString();
|
||||
dlc->name = item.getVal("name")->asString();
|
||||
dlc->url = item.getVal("url")->asString();
|
||||
dlc->platform = item.getVal("platform")->asString();
|
||||
dlc->gameid = item.getVal("gameid")->asString();
|
||||
dlc->description = item.getVal("description")->asString();
|
||||
dlc->language = item.getVal("language")->asString();
|
||||
dlc->extra = item.getVal("extra")->asString();
|
||||
dlc->engineid = item.getVal("engineid")->asString();
|
||||
dlc->guioptions = item.getVal("guioptions")->asString();
|
||||
if (item.getVal("size")->isString()) {
|
||||
size = item.getVal("size")->asString().asUint64();
|
||||
dlc->size = item.getVal("size")->asString().asUint64();
|
||||
} else {
|
||||
size = item.getVal("size")->asIntegerNumber();
|
||||
dlc->size = item.getVal("size")->asIntegerNumber();
|
||||
}
|
||||
DLCMan._dlcs.push_back(new DLCDesc{name, id, url, platform, gameid, description, language, extra, engineid, guioptions, size, i, DLCDesc::kAvailable});
|
||||
dlc->idx = i;
|
||||
DLCMan._dlcs.push_back(dlc);
|
||||
}
|
||||
}
|
||||
// send refresh DLC list command to GUI
|
||||
|
Loading…
Reference in New Issue
Block a user