Skip to content

Commit

Permalink
fix syntax errors
Browse files Browse the repository at this point in the history
  • Loading branch information
noisecode3 committed Dec 14, 2024
1 parent bc72e8b commit 2bc4d4c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
13 changes: 6 additions & 7 deletions src/binary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <QByteArray>
#include <QDebug>


/**
* @brief Look for a bit pattern that set 16:9 aspect ratio for Tomb Raider 4.
*
Expand All @@ -32,8 +31,8 @@
*/
qint64 findReplacePattern(QFile* const file) {
qint64 status = 0; // Initialize the status variable
QByteArray fileContent = file.readAll();
file.close();
QByteArray fileContent = file->readAll();
file->close();

// Define the pattern to find and replace
QByteArray pattern = QByteArray::fromHex("abaaaa3f0ad7a33b");
Expand All @@ -50,17 +49,17 @@ qint64 findReplacePattern(QFile* const file) {
fileContent.replace(index, pattern.size(), replacement);

// Reopen the file for writing
if (!file.open(QIODevice::WriteOnly)) { // flawfinder: ignore
if (!file->open(QIODevice::WriteOnly)) { // flawfinder: ignore
qCritical() << "Error opening file for writing!";
status = 2;
} else if (file.write(fileContent) == -1) {
} else if (file->write(fileContent) == -1) {
qCritical() << "Error writing to file!";
status = 3;
} else {
qDebug() << "Widescreen patch applied successfully!";
}

file.close();
file->close();
return status;
}

Expand Down Expand Up @@ -91,7 +90,7 @@ qint64 widescreen_set(const QString& path) {
}

// Perform the pattern replacement and propagate the status
status = findReplacePattern(file);
status = findReplacePattern(&file);

return status; // Single return point
}
Expand Down
4 changes: 2 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ int main(int argc, char *argv[]) {

// Add custom -w option for widescreen
parser.addOption(QCommandLineOption(
QStringList {"w", "widescreen"}
"Set widescreen bit on original games, probably not useful for TRLE"
QStringList {"w", "widescreen"},
"Set widescreen bit on original games, probably not useful for TRLE",
"PATH"));

// Process arguments
Expand Down

0 comments on commit 2bc4d4c

Please sign in to comment.