Skip to content

Commit

Permalink
big database update
Browse files Browse the repository at this point in the history
various improvements and support for trcustoms
  • Loading branch information
noisecode3 committed Sep 11, 2024
1 parent e7a9954 commit ffe58fb
Show file tree
Hide file tree
Showing 9 changed files with 932 additions and 446 deletions.
15 changes: 10 additions & 5 deletions src/Data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,13 @@ QVector<ListItemData> Data::getListItems()
for (int i=0; i < rowCount; i++)
{
QSqlQuery query(db);
query.prepare("SELECT Level.*, Info.*, Picture.* "
query.prepare("SELECT Level.*, Info.*, Picture.*, Author.* "
"FROM Level "
"JOIN Info ON Level.infoID = Info.InfoID "
"JOIN Screens ON Level.LevelID = Screens.levelID "
"JOIN Picture ON Screens.pictureID = Picture.PictureID "
"JOIN AuthorList ON Level.LevelID = AuthorList.levelID "
"JOIN Author ON AuthorList.authorID = Author.AuthorID "
"WHERE Level.LevelID = :id "
"GROUP BY Level.LevelID "
"ORDER BY MIN(Picture.PictureID) ASC");
Expand All @@ -62,7 +64,7 @@ QVector<ListItemData> Data::getListItems()
{
items.append(ListItemData(
query.value("Info.title").toString(),
query.value("Info.author").toString(),
query.value("Author.value").toString(),
query.value("Info.type").toInt(),
query.value("Info.class").toInt(),
query.value("Info.release").toString(),
Expand Down Expand Up @@ -156,9 +158,10 @@ int Data::getType(const int id)
ZipData Data::getDownload(const int id)
{
QSqlQuery query(db);
query.prepare("SELECT Zip.name, Zip.size, Zip.md5sum, Zip.url "
query.prepare("SELECT Zip.* "
"FROM Level "
"JOIN Zip ON Level.zipID = Zip.ZipID "
"JOIN ZipList ON Level.LevelID = ZipList.levelID "
"JOIN Zip ON ZipList.zipID = Zip.ZipID "
"WHERE Level.LevelID = :id");
query.bindValue(":id", id);

Expand All @@ -170,7 +173,9 @@ ZipData Data::getDownload(const int id)
query.value("Zip.name").toString(),
query.value("Zip.size").toFloat(),
query.value("Zip.md5sum").toString(),
query.value("Zip.url").toString());
query.value("Zip.url").toString(),
query.value("Zip.version").toInt(),
query.value("Zip.release").toString());
}
}
else
Expand Down
18 changes: 14 additions & 4 deletions src/Data.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,25 @@ struct ZipData
* @details
*/
ZipData() {}
ZipData(QString zipName, float zipSize, QString md5sum, QString url):
ZipData(
QString zipName,
float zipSize,
QString md5sum,
QString url,
int version,
QString release) :
name(zipName),
megabyteSize(zipSize),
md5sum(md5sum),
url(url) {}
url(url),
version(version),
release(release) {}
QString name;
float megabyteSize;
QString md5sum;
QString url;
int version;
QString release;
};

struct ListItemData
Expand Down Expand Up @@ -87,7 +97,7 @@ struct ListItemData
duration(duration)
{
QPixmap pixmap;
pixmap.loadFromData(imageData, "JPG");
pixmap.loadFromData(imageData, "WEBP");
picture.addPixmap(pixmap);
// Scale the pixmap while maintaining aspect ratio
QSize newSize = pixmap.size().scaled(640, 480, Qt::KeepAspectRatio);
Expand Down Expand Up @@ -124,7 +134,7 @@ struct InfoData
{
QPixmap pixmap;
QIcon final;
pixmap.loadFromData(image, "JPG");
pixmap.loadFromData(image, "WEBP");
final.addPixmap(pixmap);
this->imageList.push_back(final);
}
Expand Down
32 changes: 26 additions & 6 deletions utils/README
Original file line number Diff line number Diff line change
@@ -1,41 +1,50 @@
This is a test database.
I will list the games in the database here by id number.
Only the ones that I can play through without getting stuck
because of a bug will stay in the database. You can access the
files here like this ~/.local/share/TombRaiderLinuxLauncher/5.TRLE
If the directory 5.TRLE would be missing it will attempt to try
installing it. If you use you own database you can update it
with updateDB_1.0.0.py.

You can access the game files here ~/.local/share/TombRaiderLinuxLauncher/ID.TRLE
where ID is the number listed here.
If you use you own database you can update it
with updateDB_1.0.0.py then updateDB_1.1.0.py.
I can implement in app json scraping from trcustoms.org to get new levels
It has a nice json api with minimal compact data for info and nice
picture urls with md5sums. There can be and index database that
get new level id numbers from trcustoms.org or trle.net with very minimal traffic.


1.The Infada Cult
https://www.trle.net/sc/levelfeatures.php?lid=3573
https://trcustoms.org/levels/3574
have played through
no problems

2.Templars Secret
https://www.trle.net/sc/levelfeatures.php?lid=3082
https://trcustoms.org/levels/3025
have played through
no problems

3.Secret of the Skull Temple
https://www.trle.net/sc/levelfeatures.php?lid=3377
https://trcustoms.org/levels/3310
have played through
lags sometimes
plying with lutris and dgvoodoo, can help

4.The Rescue 1-4
https://www.trle.net/sc/levelfeatures.php?lid=318
https://trcustoms.org/levels/317
have not played through all of the game
no problems

5.War of the Worlds
https://www.trle.net/sc/levelfeatures.php?lid=3430
https://trcustoms.org/levels/3363
have not played through all of the game
plying with lutris and dgvoodoo, fix flashlight bug

6.The Hidden Dagger II - Dragon's Legacy
https://www.trle.net/sc/levelfeatures.php?lid=3621
https://trcustoms.org/levels/3642
Starts the game and first map, backgrund audio is missing

Note: I got the build fix here https://github.com/noisecode3/ogg-winmm
Expand All @@ -47,11 +56,13 @@ with updateDB_1.0.0.py.

7.Create a Classic 2021 - The City of Petra
https://www.trle.net/sc/levelfeatures.php?lid=3417
https://trcustoms.org/levels/3350
have not played through all of the game
no problems

8.Into the Realm of Eternal Darkness
https://www.trle.net/sc/levelfeatures.php?lid=3557
https://trcustoms.org/levels/3541
have not played through all of the game
no problems
I manage to port this one to Linux native thru TR1X
Expand All @@ -71,9 +82,18 @@ with updateDB_1.0.0.py.

9.The Experiment 3/1 - Under the Moonlight
https://www.trle.net/sc/levelfeatures.php?lid=1388
https://trcustoms.org/levels/1360
have not played through all of the game
no problems

10.The Ancient Knowledge
https://www.trle.net/sc/levelfeatures.php?lid=1964
https://trcustoms.org/levels/1947
have not played through all of the game
no problems

11.Tomb Raider - Biohazard
https://www.trle.net/sc/levelfeatures.php?lid=3372
https://trcustoms.org/levels/3305
have not played through all of the game
background audio seem to have broke
Loading

0 comments on commit ffe58fb

Please sign in to comment.