Skip to content

Commit

Permalink
add TR4 and a map for it
Browse files Browse the repository at this point in the history
  • Loading branch information
noisecode3 committed Feb 11, 2024
1 parent c0fddbe commit 6323508
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 9 deletions.
17 changes: 17 additions & 0 deletions src/FileManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,23 @@ bool FileManager::checkDir(const QString& file, bool lookGameDir )
return directory.exists();
}

bool FileManager::checkFile(const QString& file, bool lookGameDir )
{
QString path;
if (!lookGameDir)
{
path = levelDir_m.absolutePath() + QDir::separator() + file;
}
else {
path = gameDir_m.absolutePath() + QDir::separator() + file;
}
QFile fFile(path);
return fFile.exists();

}



int FileManager::checkFileInfo(const QString& file, bool lookGameDir)
{
const QString& path = (lookGameDir ? gameDir_m.absolutePath() + QDir::separator()+file : levelDir_m.absolutePath() + QDir::separator()+file);
Expand Down
1 change: 1 addition & 0 deletions src/FileManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class FileManager : public QObject
const QString calculateMD5(const QString& file, bool lookGameDir);
void extractZip(const QString& zipFile, const QString& extractPath);
bool checkDir(const QString& file, bool lookGameDir);
bool checkFile(const QString& file, bool lookGameDir );
int checkFileInfo(const QString& file, bool lookGameDir=true);
int removeFileOrDirectory(const QString &file, bool lookGameDir);
int createDirectory(const QString &file, bool gameDir);
Expand Down
2 changes: 1 addition & 1 deletion src/Model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ bool Model::getGame(int id)
downloader.setUrl(zipData.url);
downloader.setSaveFile(zipData.name);

if (fileManager.checkFileInfo(zipData.name,false))
if (fileManager.checkFile(zipData.name,false))
{
qDebug() << "File exists:" << zipData.name;
if(fileManager.calculateMD5(zipData.name,false) != zipData.md5sum)
Expand Down
37 changes: 29 additions & 8 deletions src/TombRaiderLinuxLauncher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,9 @@ TombRaiderLinuxLauncher::TombRaiderLinuxLauncher(QWidget *parent)
}


void TombRaiderLinuxLauncher::checkCommonFiles()
{
int dirStaus = controller.checkGameDirectory(3);
// should go to Controller->Model->FileManager->Model->Controller
//FolderNames folder;
int TombRaiderLinuxLauncher::testallGames(int id){
// this should be in model if it works
int dirStaus = controller.checkGameDirectory(id);
if (dirStaus)
{
if(dirStaus == 1)// The path is a symbolic link.
Expand All @@ -57,15 +55,16 @@ void TombRaiderLinuxLauncher::checkCommonFiles()
else if(dirStaus == 2)// The path is not a symbolic link.
{
//this means we backup the game to levelPath IF that is whats inside

QMessageBox msgBox;
msgBox.setWindowTitle("Confirmation");
msgBox.setText("TombRaider III found, you want to proceed?\nThis will erase saved games and is only for testing");
msgBox.setText("TombRaider "+QString::number(id)+" found, you want to proceed?");
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::No);
int result = msgBox.exec();
if (result == QMessageBox::Yes) {
qDebug() << "User clicked Yes.";
controller.setupOg(3);
controller.setupOg(id);
}
else
{
Expand All @@ -77,8 +76,15 @@ void TombRaiderLinuxLauncher::checkCommonFiles()
//it has been replaced by a file from somewhere else or the user
// or is missing
}
generateList();
}
return -1;
}

void TombRaiderLinuxLauncher::checkCommonFiles()
{
testallGames(3);
testallGames(4);
generateList();
}

void TombRaiderLinuxLauncher::generateList()
Expand Down Expand Up @@ -112,6 +118,21 @@ void TombRaiderLinuxLauncher::generateList()
//ui->listWidgetModds->addItem(wi);
}
}
if (Ending == ".TR4")
{
if(file.fileName() == "Original.TR4")
{
QListWidgetItem *wi = new QListWidgetItem(QIcon(pictures+"Tomb_Raider_IIII.jpg"),"Tomb Raider IV Original");
wi->setData(Qt::UserRole, QVariant(-4));
ui->listWidgetModds->addItem(wi);
}
else
{
qDebug() << "No link or id implementation";
//QListWidgetItem *wi = new QListWidgetItem(QIcon(pictures+"Tomb_Raider_III_unkown.jpg"),file.fileName());
//ui->listWidgetModds->addItem(wi);
}
}
}

QVector<ListItemData> list;
Expand Down
4 changes: 4 additions & 0 deletions src/TombRaiderLinuxLauncher.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ public slots:
*
*/
void generateList();
/**
*
*/
int testallGames(int id);

Controller& controller = Controller::getInstance();
QSettings settings;
Expand Down
1 change: 1 addition & 0 deletions utils/data3.json

Large diffs are not rendered by default.

Binary file modified utils/tombll.db
Binary file not shown.

0 comments on commit 6323508

Please sign in to comment.