diff -Nru mupen64plus-qt-1.11/debian/changelog mupen64plus-qt-1.12/debian/changelog --- mupen64plus-qt-1.11/debian/changelog 2018-02-04 14:46:17.000000000 +0000 +++ mupen64plus-qt-1.12/debian/changelog 2018-08-12 00:19:42.000000000 +0000 @@ -1,3 +1,16 @@ +mupen64plus-qt (1.12-1) unstable; urgency=medium + + * Upstream new release. + * New Uploader. + - Add myself as an Uploader in debian/control. + * Switch to compat level 11. + * Declare compliance with Debian Policy 4.2.0. + * Update VCS location to salsa.debian.org. + * Update years in debian/copyright. + * Update description in debian/control. + + -- Dan Hasting Sat, 11 Aug 2018 19:19:42 -0500 + mupen64plus-qt (1.11-1) unstable; urgency=medium * Team upload. diff -Nru mupen64plus-qt-1.11/debian/control mupen64plus-qt-1.12/debian/control --- mupen64plus-qt-1.11/debian/control 2018-02-04 14:46:17.000000000 +0000 +++ mupen64plus-qt-1.12/debian/control 2018-08-12 00:19:42.000000000 +0000 @@ -1,6 +1,8 @@ Source: mupen64plus-qt Maintainer: Debian Games Team -Uploaders: Sérgio Benjamim +Uploaders: + Sérgio Benjamim , + Dan Hasting , Section: games Priority: optional Build-Depends: debhelper (>= 11), @@ -8,9 +10,9 @@ libquazip5-dev, qt5-qmake, qtbase5-dev -Standards-Version: 4.1.3 -Vcs-Browser: https://anonscm.debian.org/cgit/pkg-games/mupen64plus-qt.git -Vcs-Git: https://anonscm.debian.org/git/pkg-games/mupen64plus-qt.git +Standards-Version: 4.2.0 +Vcs-Browser: https://salsa.debian.org/games-team/mupen64plus-qt +Vcs-Git: https://salsa.debian.org/games-team/mupen64plus-qt.git Homepage: https://github.com/dh4/mupen64plus-qt Package: mupen64plus-qt @@ -19,6 +21,7 @@ libqt5sql5-sqlite, ${misc:Depends}, ${shlibs:Depends} -Description: Basic launcher for Mupen64Plus - Mupen64Plus-Qt is a basic launcher for the standard UI frontend of Mupen64Plus. - It supports downloading game information and cover images from thegamesdb.net. +Description: customizable launcher for Mupen64Plus + Mupen64Plus-Qt is a customizable launcher for the standard console UI frontend + of Mupen64Plus. It supports downloading game information and cover images from + thegamesdb.net. diff -Nru mupen64plus-qt-1.11/debian/copyright mupen64plus-qt-1.12/debian/copyright --- mupen64plus-qt-1.11/debian/copyright 2018-02-04 14:46:17.000000000 +0000 +++ mupen64plus-qt-1.12/debian/copyright 2018-08-12 00:19:42.000000000 +0000 @@ -6,7 +6,7 @@ Files: * -Copyright: 2013-2015 Dan Hasting (aka dh4, Presence) +Copyright: 2013-2018 Dan Hasting (aka dh4, Presence) License: BSD-3-clause Files: debian/* diff -Nru mupen64plus-qt-1.11/dist/debian/control mupen64plus-qt-1.12/dist/debian/control --- mupen64plus-qt-1.11/dist/debian/control 2018-01-25 15:52:14.000000000 +0000 +++ mupen64plus-qt-1.12/dist/debian/control 2018-07-30 18:26:38.000000000 +0000 @@ -15,9 +15,9 @@ libqt5sql5-sqlite, ${misc:Depends}, ${shlibs:Depends} -Description: A basic launcher for Mupen64Plus - Mupen64Plus-Qt is a basic launcher for the mupen64plus-ui-console frontend. - It was adapted from CEN64-Qt to work with Mupen64Plus. +Description: A customizable launcher for Mupen64Plus + Mupen64Plus-Qt is a customizable launcher for the mupen64plus-ui-console + frontend. It was adapted from CEN64-Qt to work with Mupen64Plus. . See the README at https://www.github.com/dh4/mupen64plus-qt for a detailed description of itsfeatures and usage. diff -Nru mupen64plus-qt-1.11/dist/redhat/mupen64plus-qt.spec.in mupen64plus-qt-1.12/dist/redhat/mupen64plus-qt.spec.in --- mupen64plus-qt-1.11/dist/redhat/mupen64plus-qt.spec.in 2018-01-25 15:52:14.000000000 +0000 +++ mupen64plus-qt-1.12/dist/redhat/mupen64plus-qt.spec.in 2018-07-30 18:26:38.000000000 +0000 @@ -3,7 +3,7 @@ Name: mupen64plus-qt-rpm Version: @@VERSION@@ Release: 1 -Summary: A basic launcher for Mupen64Plus +Summary: A customizable launcher for Mupen64Plus Group: Applications/Emulators License: BSD URL: https://github.com/dh4/mupen64plus-qt @@ -12,8 +12,8 @@ Requires: qt5-qtbase, quazip-qt5 %description -Mupen64Plus-Qt is a basic launcher for the mupen64plus-ui-console frontend. It -was adapted from CEN64-Qt to work with Mupen64Plus. +Mupen64Plus-Qt is a customizable launcher for the mupen64plus-ui-console +frontend. It was adapted from CEN64-Qt to work with Mupen64Plus. See the README at https://www.github.com/dh4/mupen64plus-qt for a detailed description of its features and usage. diff -Nru mupen64plus-qt-1.11/README.md mupen64plus-qt-1.12/README.md --- mupen64plus-qt-1.11/README.md 2018-01-25 15:52:14.000000000 +0000 +++ mupen64plus-qt-1.12/README.md 2018-07-30 18:26:38.000000000 +0000 @@ -1,6 +1,6 @@ -# Mupen64Plus-Qt [![Build Status](https://travis-ci.org/dh4/mupen64plus-qt.svg?branch=master)](https://travis-ci.org/dh4/mupen64plus-qt) +# Mupen64Plus-Qt [![Build Status](https://travis-ci.org/dh4/mupen64plus-qt.svg?branch=master)](https://travis-ci.org/dh4/mupen64plus-qt) -A basic cross-platform launcher. This was adapted from CEN64-Qt to work with [Mupen64Plus](http://mupen64plus.org/). +A customizable cross-platform launcher. This was adapted from CEN64-Qt to work with [Mupen64Plus](http://mupen64plus.org/). A discussion thread can be found [here](http://www.emutalk.net/threads/54976-Mupen64Plus-Qt). @@ -169,6 +169,8 @@ Mupen64Plus-Qt supports downloading game information and cover images from [thegamesdb.net](http://thegamesdb.net/). This can be enabled under Settings->Configure->Other. It's recommended you have the data directory set (under Paths) before using this. Once enabled, you'll need to refresh your ROMs list to download the information. Afterwards, images and other information about the game can be added to the views. +***Note:*** TheGamesDB shut off version one of their API which is used in Mupen64Plus-Qt 1.11 and below. You will need version 1.12 to download game information. + #### Updating Game Information If a game is not found or is incorrect, Mupen64Plus-Qt supports refreshing information for a single ROM. Just select the ROM and go to File->Download/Update Info. From here you can enter a different search or the specific ID of the game (from the URL of the game on thegamesdb.net). @@ -187,13 +189,13 @@ The information cache can be found here: -Linux: /home/\/.local/share/mupen64plus-qt/cache/\/ -Windows: cache folder in same directory as executable -> MD5 of game -OSX: /Users/\/Library/Application Support/mupen64plus-qt/cache/\/ +Linux: /home/\/.local/share/mupen64plus-qt/cache_v2/\/ +Windows: cache_v2 folder in same directory as executable -> MD5 of game +OSX: /Users/\/Library/Application Support/mupen64plus-qt/cache_v2/\/ You can find the MD5 of a game by using the table or list view and adding "MD5" to the current information. -Edit data.xml with a text editor and replace any information you want to change. You can also replace boxart-front.{jpg,png} with an image of your choosing. +Edit data.json with a text editor and replace any information you want to change. You can also replace boxart-front.{jpg,png} with an image of your choosing. #### Extending the network timeout to TheGamesDB Binary files /tmp/tmpE0DsiR/v5wJai_grO/mupen64plus-qt-1.11/resources/locale/mupen64plus-qt_fr.qm and /tmp/tmpE0DsiR/G69aU5OcbV/mupen64plus-qt-1.12/resources/locale/mupen64plus-qt_fr.qm differ diff -Nru mupen64plus-qt-1.11/resources/locale/mupen64plus-qt_fr.ts mupen64plus-qt-1.12/resources/locale/mupen64plus-qt_fr.ts --- mupen64plus-qt-1.11/resources/locale/mupen64plus-qt_fr.ts 2018-01-25 15:52:14.000000000 +0000 +++ mupen64plus-qt-1.12/resources/locale/mupen64plus-qt_fr.ts 2018-07-30 18:26:38.000000000 +0000 @@ -63,35 +63,35 @@ EmulatorHandler - - - - + + + + Warning Attention - + <ParentName> quit unexpectedly. Check the log for more information. <ParentName> a quitté de manière inattendue. Consultez les journaux pour plus d'informations. - + View Log... Consulter les journaux... - + <ParentName> executable not found. Executable <ParentName> non trouvé. - + Not a valid ROM File. Fichier ROM invalide. - + ROM file not found. Fichier ROM manquant. @@ -387,155 +387,155 @@ QObject - + GoodName Nom Good - + Filename Nom du fichier - + Filename (extension) Nom du fichier (extension) - + Zip File Fichier Zip - + Internal Name Nom interne - + Size Taille - + MD5 MD5 - + CRC1 CRC1 - + CRC2 CRC2 - + Players Joueurs - + Rumble Rumble - + Save Type Type de sauvegarde - + Game Title Titre du jeu - + Release Date Date de sortie - + Overview Aperçu - + ESRB ESRB - + Genre Genre - + Publisher Éditeur - + Developer Développeur - + Rating Certification - + Game Cover Jaquette - + Unknown ROM ROM inconnue - + Requires catalog file Fichier catalogue demandé - + Not found Non trouvé - + %1 MB %1 - MB - - - + + + Game Information Download Télécharger des informations sur le jeu - + No results found. Aucun résultat. - + No more results found. Pas d'autre résultat. - + Download Complete! Téléchargement terminé ! - A basic launcher for <ParentName> using Qt. + A customizable launcher for <ParentName> using Qt. Une interface élémentaire pour <ParentName>. @@ -552,38 +552,38 @@ RomCollection - - + + Warning Attention - + No ROMs found in Aucune ROM trouvée dans - + No ROMs found. Aucune ROM trouvée. - + Database Not Loaded Base de données non chargée - + Could not connect to Sqlite database. Application may misbehave. Impossible de se connecter à la base de données Sqlite. L'application peut dysfonctionner. - + Loading ROMs... Chargement des ROMS... - + Cancel Annuler @@ -932,114 +932,119 @@ Très grande - + + Super + + + + Black Noir - + White Blanc - + Light Gray Gris clair - + Dark Gray Gris foncé - + Green Vert - + Cyan Cyan - + Blue Bleu - + Purple Violet - + Red Rouge - + Pink Rose - + Orange Orange - + Yellow Jaune - + Brown Marron - - + + Light Lumière - + Normal Normale - - + + Dark Sombre - + ROM Directory Dossiers des ROMS - + <ParentName> Executable Fichier exécutable <ParentName> - + Plugin Directory Dossier des plugins - + Data Directory Dossier des données - + Config Directory Dossier de configuration - + Background Image Image d'arrière-plan @@ -1056,68 +1061,73 @@ TheGamesDBScraper - + <b>NOTE:</b> If you are deleting this game's information because the game doesn't <b>Remarque :</b> Si vous effacez les informations de ce jeu parce que le jeu - + better to create an account on il est préférable de créer un compte - + and add the game so other users can benefit as well. et d’ajouter le jeu afin d’en faire profiter également les autres utilisateurs. - + exist on TheGamesDB and <AppName> pulled the information for different game, it's n’est pas dans TheGamesDB et que <AppName> vous propose des informations pour un autre jeu, - + This will cause <AppName> to not update the information for this game until you <AppName> ne mettra pas à jour les informations jusqu'à ce que vous - + force it with "Download/Update Info..." relanciez le "Télécharger/Mettre à jour les infos..." - + Delete the current information for Effacer les informations actuelles pour - + Delete Game Information Effacer les informations du jeu - + + The following error from TheGamesDB occured while downloading: + + + + Released on: Publié le : - + Does this look correct? Ces informations vous semblent-elles correctes ? - + Request timed out. Check your network settings. Temps dépassé. Vérifier vos paramètres de connexion. - + Continue scraping information? Continuer à récolter des informations ? - - + + Network Error Erreur réseau Erreur réseau diff -Nru mupen64plus-qt-1.11/resources/mupen64plus-qt.6 mupen64plus-qt-1.12/resources/mupen64plus-qt.6 --- mupen64plus-qt-1.11/resources/mupen64plus-qt.6 2018-01-25 15:52:14.000000000 +0000 +++ mupen64plus-qt-1.12/resources/mupen64plus-qt.6 2018-07-30 18:26:38.000000000 +0000 @@ -30,10 +30,10 @@ .\" %%%LICENSE_END .TH "Mupen64Plus-Qt" "6" "September 2015" "Mupen64Plus-Qt" "User Manual" .SH "NAME" -Mupen64Plus-Qt \- a basic launcher for Mupen64Plus +Mupen64Plus-Qt \- a customizable launcher for Mupen64Plus .SH "SYNOPSIS" \fBmupen64plus-qt\fR .SH "DESCRIPTION" -\fBMupen64Plus-Qt\fR is a basic launcher for the mupen64plus-ui-console frontend. It was adapted from CEN64-Qt to work with Mupen64Plus. +\fBMupen64Plus-Qt\fR is a customizable launcher for the mupen64plus-ui-console frontend. It was adapted from CEN64-Qt to work with Mupen64Plus. .TP See the README at https://www.github.com/dh4/mupen64plus-qt for a detailed description of its features and usage. diff -Nru mupen64plus-qt-1.11/resources/mupen64plus-qt.desktop mupen64plus-qt-1.12/resources/mupen64plus-qt.desktop --- mupen64plus-qt-1.11/resources/mupen64plus-qt.desktop 2018-01-25 15:52:14.000000000 +0000 +++ mupen64plus-qt-1.12/resources/mupen64plus-qt.desktop 2018-07-30 18:26:38.000000000 +0000 @@ -3,7 +3,7 @@ Type=Application Name=Mupen64Plus-Qt GenericName=Mupen64Plus Launcher -Comment=A basic launcher for Mupen64plus +Comment=A customizable launcher for Mupen64plus Exec=mupen64plus-qt Icon=mupen64plus-qt Terminal=false diff -Nru mupen64plus-qt-1.11/resources/other/VERSION mupen64plus-qt-1.12/resources/other/VERSION --- mupen64plus-qt-1.11/resources/other/VERSION 2018-01-25 15:52:14.000000000 +0000 +++ mupen64plus-qt-1.12/resources/other/VERSION 2018-07-30 18:26:38.000000000 +0000 @@ -1 +1 @@ -1.11 +1.12 diff -Nru mupen64plus-qt-1.11/src/common.cpp mupen64plus-qt-1.12/src/common.cpp --- mupen64plus-qt-1.11/src/common.cpp 2018-01-25 15:52:14.000000000 +0000 +++ mupen64plus-qt-1.12/src/common.cpp 2018-07-30 18:26:38.000000000 +0000 @@ -72,6 +72,12 @@ } +QString getCacheLocation() +{ + return getDataLocation() + "/cache_v2/"; +} + + QString getDataLocation() { QString dataDir; @@ -168,12 +174,14 @@ if (size == "Medium") return 145; if (size == "Large") return 190; if (size == "Extra Large") return 250; + if (size == "Super") return 360; } else { if (size == "Extra Small") return 47; if (size == "Small") return 71; if (size == "Medium") return 122; if (size == "Large") return 172; if (size == "Extra Large") return 224; + if (size == "Super") return 330; } } else if (which == "width") { if (size == "Extra Small") return 60; @@ -181,12 +189,14 @@ if (size == "Medium") return 160; if (size == "Large") return 225; if (size == "Extra Large") return 300; + if (size == "Super") return 440; } else if (which == "font") { if (size == "Extra Small") return 5; if (size == "Small") return 7; if (size == "Medium") return 10; if (size == "Large") return 12; if (size == "Extra Large") return 13; + if (size == "Super") return 15; } return 0; } @@ -202,12 +212,14 @@ if (size == "Medium") return QSize(69, 50); if (size == "Large") return QSize(103, 75); if (size == "Extra Large") return QSize(138, 100); + if (size == "Super") return QSize(210, 150); } else if (view == "Grid" || view == "List") { if (size == "Extra Small") return QSize(48, 35); if (size == "Small") return QSize(69, 50); if (size == "Medium") return QSize(138, 100); if (size == "Large") return QSize(203, 150); if (size == "Extra Large") return QSize(276, 200); + if (size == "Super") return QSize(425, 300); } return QSize(); diff -Nru mupen64plus-qt-1.11/src/common.h mupen64plus-qt-1.12/src/common.h --- mupen64plus-qt-1.11/src/common.h 2018-01-25 15:52:14.000000000 +0000 +++ mupen64plus-qt-1.12/src/common.h 2018-07-30 18:26:38.000000000 +0000 @@ -88,6 +88,7 @@ QString getTranslation(QString text); QGraphicsDropShadowEffect *getShadow(bool active); QSize getImageSize(QString view); +QString getCacheLocation(); QString getDataLocation(); QString getRomInfo(QString identifier, const Rom *rom, bool removeWarn = false, bool sort = false); QString getVersion(); diff -Nru mupen64plus-qt-1.11/src/dialogs/settingsdialog.cpp mupen64plus-qt-1.12/src/dialogs/settingsdialog.cpp --- mupen64plus-qt-1.11/src/dialogs/settingsdialog.cpp 2018-01-25 15:52:14.000000000 +0000 +++ mupen64plus-qt-1.12/src/dialogs/settingsdialog.cpp 2018-07-30 18:26:38.000000000 +0000 @@ -180,7 +180,9 @@ << (QStringList() << tr("Small") << "Small") << (QStringList() << tr("Medium") << "Medium") << (QStringList() << tr("Large") << "Large") - << (QStringList() << tr("Extra Large") << "Extra Large"); + << (QStringList() << tr("Extra Large") << "Extra Large") + << (QStringList() << tr("Super") << "Super"); + if (SETTINGS.value("Other/downloadinfo", "").toString() == "true") populateTableAndListTab(true); @@ -697,7 +699,6 @@ << "Genre" << "Publisher" << "Developer" - << "Rating" << "Game Cover"; labelOptions << "Game Title" @@ -709,8 +710,7 @@ << "ESRB" << "Genre" << "Publisher" - << "Developer" - << "Rating"; + << "Developer"; } available.sort(); diff -Nru mupen64plus-qt-1.11/src/global.h mupen64plus-qt-1.12/src/global.h --- mupen64plus-qt-1.11/src/global.h 2018-01-25 15:52:14.000000000 +0000 +++ mupen64plus-qt-1.12/src/global.h 2018-07-30 18:26:38.000000000 +0000 @@ -41,7 +41,7 @@ const QString ParentName = "Mupen64Plus"; const QString ParentNameLower = "mupen64plus"; -const QString Description = QObject::tr("A basic launcher for using Qt.").replace("",ParentName); +const QString Description = QObject::tr("A customizable launcher for using Qt.").replace("",ParentName); const QString Copyright = ""; const QString Website = "" + QObject::tr(" website").replace("",ParentName) @@ -50,6 +50,8 @@ + QObject::tr("GitHub repository") + ""; +const QString TheGamesDBAPIKey = "5dd59a89da5c0018b0e9ded34e299cf675e94d51e229a19822074d1a67019f9f"; + #ifdef Q_OS_WIN #define SETTINGS QSettings(AppNameLower+".ini", QSettings::IniFormat) #else diff -Nru mupen64plus-qt-1.11/src/mainwindow.cpp mupen64plus-qt-1.12/src/mainwindow.cpp --- mupen64plus-qt-1.11/src/mainwindow.cpp 2018-01-25 15:52:14.000000000 +0000 +++ mupen64plus-qt-1.12/src/mainwindow.cpp 2018-07-30 18:26:38.000000000 +0000 @@ -90,7 +90,7 @@ connect(romCollection, SIGNAL(romAdded(Rom*, int)), this, SLOT(addToView(Rom*, int))); connect(romCollection, SIGNAL(updateEnded(int, bool)), this, SLOT(enableViews(int, bool))); - romCollection->cachedRoms(); + romCollection->cachedRoms(false, true); mainWidget = new QWidget(this); diff -Nru mupen64plus-qt-1.11/src/roms/romcollection.cpp mupen64plus-qt-1.12/src/roms/romcollection.cpp --- mupen64plus-qt-1.11/src/roms/romcollection.cpp 2018-01-25 15:52:14.000000000 +0000 +++ mupen64plus-qt-1.12/src/roms/romcollection.cpp 2018-07-30 18:26:38.000000000 +0000 @@ -39,12 +39,13 @@ #include #include #include +#include +#include #include #include #include #include -#include RomCollection::RomCollection(QStringList fileTypes, QStringList romPaths, QWidget *parent) : QObject(parent) @@ -215,7 +216,7 @@ } -int RomCollection::cachedRoms(bool imageUpdated) +int RomCollection::cachedRoms(bool imageUpdated, bool onStartup) { emit updateStarted(imageUpdated); @@ -230,6 +231,20 @@ if (romCount == -1) //Nothing cached so try adding ROMs instead return addRoms(); + + //Check if user has data from TheGamesDB API v1 and update them to v2 data + if (onStartup) { + bool onV1 = false; + QDir cacheDir(getCacheLocation()); + + if (!cacheDir.exists() && SETTINGS.value("Other/downloadinfo", "").toString() == "true") + onV1 = true; + + if (onV1) + return addRoms(); + } + + QList roms; QList ddRoms; @@ -378,62 +393,39 @@ } if (SETTINGS.value("Other/downloadinfo", "").toString() == "true") { - QString cacheDir = getDataLocation() + "/cache"; - - QString dataFile = cacheDir + "/" + currentRom->romMD5.toLower() + "/data.xml"; + QString dataFile = getCacheLocation() + currentRom->romMD5.toLower() + "/data.json"; QFile file(dataFile); file.open(QIODevice::ReadOnly); - QString dom = file.readAll(); + QString data = file.readAll(); file.close(); - QDomDocument xml; - xml.setContent(dom); - QDomNode game = xml.elementsByTagName("Game").at(0); + QJsonDocument document = QJsonDocument::fromJson(data.toUtf8()); + QJsonObject json = document.object(); //Remove any non-standard characters - QString regex = "[^A-Za-z 0-9 \\.,\\?'""!@#\\$%\\^&\\*\\(\\)-_=\\+;:<>\\/\\\\|\\}\\{\\[\\]`~]*"; + QString regex = "[^A-Za-z 0-9 \\.,\\?'""!@#\\$%\\^&\\*\\(\\)-_=\\+;:<>\\/\\\\|\\}\\{\\[\\]`~é]*"; - currentRom->gameTitle = game.firstChildElement("GameTitle").text().remove(QRegExp(regex)); + currentRom->gameTitle = json.value("game_title").toString().remove(QRegExp(regex)); if (currentRom->gameTitle == "") currentRom->gameTitle = getTranslation("Not found"); - currentRom->releaseDate = game.firstChildElement("ReleaseDate").text(); - - //Fix missing 0's in date - currentRom->releaseDate.replace(QRegExp("^(\\d)/(\\d{2})/(\\d{4})"), "0\\1/\\2/\\3"); - currentRom->releaseDate.replace(QRegExp("^(\\d{2})/(\\d)/(\\d{4})"), "\\1/0\\2/\\3"); - currentRom->releaseDate.replace(QRegExp("^(\\d)/(\\d)/(\\d{4})"), "0\\1/0\\2/\\3"); - - currentRom->sortDate = currentRom->releaseDate; - currentRom->sortDate.replace(QRegExp("(\\d{2})/(\\d{2})/(\\d{4})"), "\\3-\\1-\\2"); - - currentRom->overview = game.firstChildElement("Overview").text().remove(QRegExp(regex)); - currentRom->esrb = game.firstChildElement("ESRB").text(); - - int count = 0; - QDomNode genreNode = game.firstChildElement("Genres").firstChild(); - while(!genreNode.isNull()) - { - if (count != 0) - currentRom->genre += "/" + genreNode.toElement().text(); - else - currentRom->genre = genreNode.toElement().text(); - - genreNode = genreNode.nextSibling(); - count++; - } - - currentRom->publisher = game.firstChildElement("Publisher").text(); - currentRom->developer = game.firstChildElement("Developer").text(); - currentRom->rating = game.firstChildElement("Rating").text(); + currentRom->releaseDate = json.value("release_date").toString(); + currentRom->sortDate = json.value("release_date").toString(); + currentRom->releaseDate.replace(QRegExp("(\\d{4})-(\\d{2})-(\\d{2})"), "\\2/\\3/\\1"); + + currentRom->overview = json.value("overview").toString().remove(QRegExp(regex)); + currentRom->esrb = json.value("rating").toString(); + + currentRom->genre = json.value("genres").toString(); + currentRom->publisher = json.value("publisher").toString(); + currentRom->developer = json.value("developer").toString(); foreach (QString ext, QStringList() << "jpg" << "png") { - QString imageFile = getDataLocation() + "/cache/" - + currentRom->romMD5.toLower() + "/boxart-front." + ext; + QString imageFile = getCacheLocation() + currentRom->romMD5.toLower() + "/boxart-front." + ext; QFile cover(imageFile); - if (cover.exists()&& currentRom->image.load(imageFile)) { + if (cover.exists() && currentRom->image.load(imageFile)) { currentRom->imageExists = true; break; } diff -Nru mupen64plus-qt-1.11/src/roms/romcollection.h mupen64plus-qt-1.12/src/roms/romcollection.h --- mupen64plus-qt-1.11/src/roms/romcollection.h 2018-01-25 15:52:14.000000000 +0000 +++ mupen64plus-qt-1.12/src/roms/romcollection.h 2018-07-30 18:26:38.000000000 +0000 @@ -47,7 +47,7 @@ Q_OBJECT public: explicit RomCollection(QStringList fileTypes, QStringList romPaths, QWidget *parent = 0); - int cachedRoms(bool imageUpdated = false); + int cachedRoms(bool imageUpdated = false, bool onStartup = false); void updatePaths(QStringList romPaths); QStringList getFileTypes(bool archives = false); diff -Nru mupen64plus-qt-1.11/src/roms/thegamesdbscraper.cpp mupen64plus-qt-1.12/src/roms/thegamesdbscraper.cpp --- mupen64plus-qt-1.11/src/roms/thegamesdbscraper.cpp 2018-01-25 15:52:14.000000000 +0000 +++ mupen64plus-qt-1.12/src/roms/thegamesdbscraper.cpp 2018-07-30 18:26:38.000000000 +0000 @@ -36,6 +36,9 @@ #include #include +#include +#include +#include #include #include #include @@ -44,7 +47,6 @@ #include #include #include -#include TheGamesDBScraper::TheGamesDBScraper(QWidget *parent, bool force) : QObject(parent) @@ -55,6 +57,46 @@ } +QString TheGamesDBScraper::convertIDs(QJsonObject foundGame, QString typeName, QString listName) +{ + QJsonArray idArray = foundGame.value(typeName).toArray(); + + QString cacheFileString = getCacheLocation() + typeName + ".json"; + QFile cacheFile(cacheFileString); + + cacheFile.open(QIODevice::ReadOnly); + QString data = cacheFile.readAll(); + cacheFile.close(); + + QJsonDocument document = QJsonDocument::fromJson(data.toUtf8()); + QJsonObject cache = document.object(); + + QString result = ""; + + foreach (QJsonValue id, idArray) + { + QString entryID = QString::number(id.toInt()); + QString entryName = cache.value(entryID).toObject().value("name").toString(); + + if (entryName == "") { + updateListCache(&cacheFile, listName); + cacheFile.open(QIODevice::ReadOnly); + data = cacheFile.readAll(); + cacheFile.close(); + + document = QJsonDocument::fromJson(data.toUtf8()); + entryName = cache.value(entryID).toObject().value("name").toString(); + } + + if (entryName != "") + result += entryName + ", "; + } + + int pos = result.lastIndexOf(QChar(',')); + return result.left(pos); +} + + void TheGamesDBScraper::deleteGameInfo(QString fileName, QString identifier) { QString text; @@ -73,7 +115,7 @@ QMessageBox::Yes | QMessageBox::No); if (answer == QMessageBox::Yes) { - QString gameCache = getDataLocation() + "/cache/" + identifier.toLower(); + QString gameCache = getCacheLocation() + identifier.toLower(); QString dataFile = gameCache + "/data.xml"; QFile file(dataFile); @@ -110,15 +152,27 @@ bool updated = false; - QString gameCache = getDataLocation() + "/cache/" + identifier.toLower(); + QString gameCache = getCacheLocation() + identifier.toLower(); QDir cache(gameCache); if (!cache.exists()) { cache.mkpath(gameCache); } - //Get game XML info from thegamesdb.net - QString dataFile = gameCache + "/data.xml"; + QFile genres(getCacheLocation() + "genres.json"); + if (!genres.exists()) + updateListCache(&genres, "Genres"); + + QFile developers(getCacheLocation() + "developers.json"); + if (!developers.exists()) + updateListCache(&developers, "Developers"); + + QFile publishers(getCacheLocation() + "publishers.json"); + if (!publishers.exists()) + updateListCache(&publishers, "Publishers"); + + //Get game JSON info from thegamesdb.net + QString dataFile = gameCache + "/data.json"; QFile file(dataFile); if (!file.exists() || file.size() == 0 || force) { @@ -128,44 +182,68 @@ searchName.remove(QRegExp("\\W*(\\(|\\[).+(\\)|\\])\\W*")); //Few game specific hacks - //TODO: Contact thegamesdb.net and see if these can be fixed on their end - if (searchName == "Legend of Zelda, The - Majora's Mask") + if (searchName == "Legend of Zelda, The - Majora's Mask" || + searchName == "ZELDA MAJORA'S MASK") searchName = "Majora's Mask"; - else if (searchName == "Legend of Zelda, The - Ocarina of Time - Master Quest") - searchName = "Master Quest"; else if (searchName == "Legend of Zelda, The - Ocarina of Time" || searchName == "THE LEGEND OF ZELDA") - searchName = "Ocarina of Time"; - else if (searchName.toLower() == "f-zero x") - gameID = "10836"; + searchName = "The Legend of Zelda: Ocarina of Time"; + else if (searchName.toLower().startsWith("tsumi to batsu")) + searchName = "Sin and Punishment"; + else if (searchName.toLower() == "1080 snowboarding") + searchName = "1080: TenEighty Snowboarding"; + else if (searchName == "Extreme-G XG2" || searchName == "Extreme G 2") + searchName = "Extreme-G 2"; + else if (searchName.contains("Pokemon", Qt::CaseInsensitive)) + searchName.replace("Pokemon", "Pokémon", Qt::CaseInsensitive); + else if (searchName.toLower() == "smash brothers") + searchName = "Super Smash Bros."; + else if (searchName.toLower() == "conker bfd") + searchName = "Conker's Bad Fur Day"; + + QString apiFilter = "&filter[platform]=3&include=boxart&fields=game_title,release_date,"; + apiFilter += "developers,publishers,genres,overview,rating,players"; //If user submits gameID, use that if (gameID != "") - url.setUrl("http://thegamesdb.net/api/GetGame.php?id=" - + gameID + "&platform=Nintendo 64"); + url.setUrl("https://api.thegamesdb.net/Games/ByGameID?apikey=" + TheGamesDBAPIKey + "&id=" + + gameID + apiFilter); else - url.setUrl("http://thegamesdb.net/api/GetGame.php?name=" - + searchName + "&platform=Nintendo 64"); + url.setUrl("https://api.thegamesdb.net/Games/ByGameName?apikey=" + TheGamesDBAPIKey + "&name=" + + searchName + apiFilter); + + QString data = getUrlContents(url); - QString dom = getUrlContents(url); + QJsonDocument document = QJsonDocument::fromJson(data.toUtf8()); + QJsonObject json = document.object(); + + if (json.value("code").toInt() != 200 && json.value("code").toInt() != 0) { + QString status = json.value("status").toString(); + QString message; + message = QString(tr("The following error from TheGamesDB occured while downloading:")) + + "

" + status + "

"; + showError(message); + if (force) parent->setEnabled(true); + return; + } + + QJsonValue games = json.value("data").toObject().value("games"); + QJsonArray gamesArray = games.toArray(); - QDomDocument xml; - xml.setContent(dom); - QDomNode node = xml.elementsByTagName("Data").at(0).firstChildElement("Game"); int count = 0, found = 0; - while(!node.isNull()) + foreach (QJsonValue game, gamesArray) { - QDomElement element = node.firstChildElement("GameTitle").toElement(); + QJsonValue title = game.toObject().value("game_title"); if (force) { //from user dialog - QDomElement date = node.firstChildElement("ReleaseDate").toElement(); + QJsonValue date = game.toObject().value("release_date"); - QString check = "Game: " + element.text(); + QString check = "Game: " + title.toString(); check.remove(QRegExp(QString("[^A-Za-z 0-9 \\.,\\?'""!@#\\$%\\^&\\*\\") - + "(\\)-_=\\+;:<>\\/\\\\|\\}\\{\\[\\]`~]*")); - if (date.text() != "") check += "\n" + tr("Released on: ") + date.text(); + + "(\\)-_=\\+;:<>\\/\\\\|\\}\\{\\[\\]`~é]*")); + if (date.toString() != "") check += "\n" + tr("Released on: ") + date.toString(); check += "\n\n" + tr("Does this look correct?"); int answer = QMessageBox::question(parent, QObject::tr("Game Information Download"), @@ -179,21 +257,57 @@ } else { //We only want one game, so search for a perfect match in the GameTitle element. //Otherwise this will default to 0 (the first game found) - if(element.text() == searchName) + if(title.toString().toLower() == searchName.toLower()) found = count; } - node = node.nextSibling(); count++; } if (!force || updated) { - file.open(QIODevice::WriteOnly); - QTextStream stream(&file); + QJsonObject foundGame = gamesArray.at(found).toObject(); + QJsonObject saveData; + + QString gameID = QString::number(foundGame.value("id").toInt()); + QJsonObject boxart = json.value("include").toObject().value("boxart").toObject(); + + QString thumbURL = boxart.value("base_url").toObject().value("thumb").toString(); + QJsonArray imgArray = boxart.value("data").toObject().value(gameID).toArray(); + + QString frontImg = ""; + + foreach (QJsonValue img, imgArray) + { + QString type = img.toObject().value("type").toString(); + QString side = img.toObject().value("side").toString(); + QString filename = img.toObject().value("filename").toString(); + + if (type == "boxart" && side == "front") + frontImg = thumbURL + filename; + } + + //Convert IDs from API to text names + QString genresString = convertIDs(foundGame, "genres", "Genres"); + QString developerString = convertIDs(foundGame, "developers", "Developers"); + QString publisherString = convertIDs(foundGame, "publishers", "Publishers"); + + QString players = QString::number(foundGame.value("players").toInt()); + if (players == "0") players = ""; + + saveData.insert("game_title", foundGame.value("game_title").toString()); + saveData.insert("release_date", foundGame.value("release_date").toString()); + saveData.insert("rating", foundGame.value("rating").toString()); + saveData.insert("overview", foundGame.value("overview").toString()); + saveData.insert("players", players); + saveData.insert("boxart", frontImg); + saveData.insert("genres", genresString); + saveData.insert("developer", developerString); + saveData.insert("publisher", publisherString); - QDomNodeList gameList = xml.elementsByTagName("Game"); - gameList.at(found).save(stream, QDomNode::EncodingFromDocument); + QJsonDocument document(saveData); + file.open(QIODevice::WriteOnly); + file.write(document.toJson()); file.close(); } @@ -220,24 +334,15 @@ if ((!coverJPG.exists() && !coverPNG.exists()) || (force && updated)) { file.open(QIODevice::ReadOnly); - QString dom = file.readAll(); + QString data = file.readAll(); file.close(); - QDomDocument xml; - xml.setContent(dom); - QDomNode node = xml.elementsByTagName("Game").at(0).firstChildElement("Images").firstChild(); - - while(!node.isNull()) - { - QDomElement element = node.toElement(); - if(element.tagName() == "boxart" && element.attribute("side") == "front") - boxartURL = element.attribute("thumb"); - - node = node.nextSibling(); - } + QJsonDocument document = QJsonDocument::fromJson(data.toUtf8()); + QJsonObject json = document.object(); + QString boxartURL = json.value("boxart").toString(); if (boxartURL != "") { - QUrl url("http://thegamesdb.net/banners/" + boxartURL); + QUrl url(boxartURL); //Delete current box art QFile::remove(coverFile + "jpg"); @@ -314,3 +419,19 @@ keepGoing = false; } } + + +void TheGamesDBScraper::updateListCache(QFile *file, QString list) +{ + if (keepGoing) { + QUrl url; + url.setUrl("https://api.thegamesdb.net/" + list + "?apikey=" + TheGamesDBAPIKey); + QString data = getUrlContents(url); + QJsonDocument document = QJsonDocument::fromJson(data.toUtf8()); + QJsonDocument result(document.object().value("data").toObject().value(list.toLower()).toObject()); + + file->open(QIODevice::WriteOnly); + file->write(result.toJson()); + file->close(); + } +} diff -Nru mupen64plus-qt-1.11/src/roms/thegamesdbscraper.h mupen64plus-qt-1.12/src/roms/thegamesdbscraper.h --- mupen64plus-qt-1.11/src/roms/thegamesdbscraper.h 2018-01-25 15:52:14.000000000 +0000 +++ mupen64plus-qt-1.12/src/roms/thegamesdbscraper.h 2018-07-30 18:26:38.000000000 +0000 @@ -32,6 +32,7 @@ #ifndef THEGAMESDBSCRAPER_H #define THEGAMESDBSCRAPER_H +#include #include class QUrl; @@ -46,8 +47,10 @@ void downloadGameInfo(QString identifier, QString searchName, QString gameID = ""); private: + QString convertIDs(QJsonObject foundGame, QString typeName, QString listName); QByteArray getUrlContents(QUrl url); void showError(QString error); + void updateListCache(QFile *file, QString list); bool force; bool keepGoing; diff -Nru mupen64plus-qt-1.11/VERSION mupen64plus-qt-1.12/VERSION --- mupen64plus-qt-1.11/VERSION 2018-01-25 15:52:14.000000000 +0000 +++ mupen64plus-qt-1.12/VERSION 2018-07-30 18:26:38.000000000 +0000 @@ -1 +1 @@ -1.11 +1.12