This week I worked on the backend part for integrating DLC downloader in ScummVM. In the backend, I need to implement download-related functions like requesting a download, getting downloaded progress, getting downloadable games list (with information like name, size, id, etc.), getting downloaded location, handling errors, etc.
Since every distribution stores have its own API/SDKs for implementing these functionalities, I required a way to make the ScummVM know which implementation to run. We can do this via dynamic polymorphism. In my case, I had to create a new abstract class called Store
containing prototype for store-specific functions. Using Store
, we can derive different classes like PlayStore
with implementations specific to the distribution stores.
I need a way to use these download-related functions in my downloader GUI or even in the background. For this, I have created a new class called DLC
Manager
, which gets instantiated as DLCMan
on startup (in scummvm_main()
). DLCMan
will provide the interface for all the functions I will require for the DLC downloader, handling errors appropriately and also showing what went wrong in a message modal.
Here’s the complete overview:
Additionally, in the non-android ScummVM executable, I was able to hide the “Download Games” button, which opens the DLC browser. I have introduced a new OSystem
feature, kFeatureDLC
, that would determine whether the ScummVM executable supports downloading DLC. If it doesn’t, then I have to hide DLC-related widgets.
You can check all the code changes here.
The backend code is pretty complex. Initially, it was very intimidating to get something done. Thanks to my mentors, I’ve made some decent progress in sorting out the classes and functions. I learned some advanced C++ concepts as well. Hopefully, by next week I will be able to implement the download-related functions for Android Play Store.