Comments (4)
As noted here, the client has no need for anything a platform offers other than its existence on the system & where games are located, so an API would be a waste.
And as mentioned in various places, we're already looking into plugins.
from client.
Another thing to add, we will be implementing various features into plugins when a plugin API is created, including the game finding code. We don't want to waste resources creating it when we will be replacing it in the future.
from client.
As noted here, the client has no need for anything a platform offers other than its
existence on the system & where games are located, so an API would be a waste.
Then this (internal!) API just consists of two functions, getRoot()
and findGames()
. Maybe API is a misleading term for this - I meant that you should put the distribution-platform-specific code into seperate files.
Another thing to add, we will be implementing various features into plugins when a plugin API is created, including the game finding code. We don't want to waste resources creating it when we will be replacing it in the future.
I wasn't referring to implementing a fully featured plugin API for this - but seperating code for the different platforms from start could make it easier if you ever decide to implement them as plugins. It's just a simple copy&paste operation into separate files. findOriginGames()
and findSteamGames()
are even seperate functions now, but IMHO it's better to put them into dedicated files. It already becomes hard to read now, even though Uplay, GOG and others are still missing.
Anyway, just my 2 cents.
PS: Here's an example:
// Origin.cpp
bool originGetRoot(void)
{
QDir originRoot(qgetenv("APPDATA").append("/Origin"));
if (originRoot.exists())
{
return originRoot;
}
return NULL;
}
void originFindGames(void)
{
/* Don't know about this function signature, could also
take "QDir root" as argument instead */
QDir root = originGetRoot();
if (root != NULL) {
//insert code here
}
}
// Steam.cpp
bool steamGetRoot(void)
{
bool steamFound = false;
QDir steamRoot;
steamRoot.setPath("");
#if defined(_WIN32) || defined(_WIN64)
QSettings settings("HKEY_CURRENT_USER\\Software\\Valve\\Steam",
QSettings::NativeFormat);
QString steamPath = settings.value("SteamPath").toString();
steamRoot = QDir(steamPath);
steamFound = steamRoot != QDir::currentPath();
#elif defined(__APPLE__)
// TODO: however OS X handles steam
#elif defined(__linux__)
steamRoot = QDir(QDir::home().filePath(".steam/steam"));
steamFound = true;
#else
// TODO?
#endif
if (steamFound && steamRoot.exists())
{
return steamRoot;
}
// Steam was not found, probably not installed.
return NULL:
}
void SteamFindGames(void) {
//insert code here
}
from client.
This was mentioned before internally, however we decided that, because only the Library will need to call these functions, they belong to the Library class. Creating entire files/classes(2 files each if you do the standard practice) dedicated to 2 functions that don't need to be separated and are going to be refactored out isn't the best way of decreasing code complexity. If you use an editor with a navigate to symbol button of some sort, the "messiness" of the code is more of a non-issue.
from client.
Related Issues (20)
- Potential registry/QDir issue HOT 2
- Some DB connections are not being closed. HOT 3
- Create Library UI Programmatically HOT 1
- Memory Leak when creating AddGameWizard HOT 8
- Compilation error HOT 1
- Compilation error HOT 6
- Invalid Magic Value HOT 3
- Database error reported by /u/TIFUbyredditting HOT 1
- Idea for adding non-game platforms games.
- I don't have a libraryFolders.vdf file. HOT 1
- Windows tray icon doesn't work on mingw
- Possible issue RE: differences in registry keys on 32 bit versions of Windows HOT 4
- Some Steam games crash if not launched via Steam HOT 6
- Reopen issue #5
- Add Mozilla Persona HOT 2
- Move BorderlessWindow to a submodule HOT 1
- Slack test
- Steam games with multiple exe's are ignored
- Reduce Semaphore Buildtimes HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from client.