File tree Expand file tree Collapse file tree 2 files changed +8
-9
lines changed
Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Original file line number Diff line number Diff line change 1919#include < QByteArray>
2020#include < QDebug>
2121
22-
2322/* *
2423 * @brief Look for a bit pattern that set 16:9 aspect ratio for Tomb Raider 4.
2524 *
3231 */
3332qint64 findReplacePattern (QFile* const file) {
3433 qint64 status = 0 ; // Initialize the status variable
35- QByteArray fileContent = file. readAll ();
36- file. close ();
34+ QByteArray fileContent = file-> readAll ();
35+ file-> close ();
3736
3837 // Define the pattern to find and replace
3938 QByteArray pattern = QByteArray::fromHex (" abaaaa3f0ad7a33b" );
@@ -50,17 +49,17 @@ qint64 findReplacePattern(QFile* const file) {
5049 fileContent.replace (index, pattern.size (), replacement);
5150
5251 // Reopen the file for writing
53- if (!file. open (QIODevice::WriteOnly)) { // flawfinder: ignore
52+ if (!file-> open (QIODevice::WriteOnly)) { // flawfinder: ignore
5453 qCritical () << " Error opening file for writing!" ;
5554 status = 2 ;
56- } else if (file. write (fileContent) == -1 ) {
55+ } else if (file-> write (fileContent) == -1 ) {
5756 qCritical () << " Error writing to file!" ;
5857 status = 3 ;
5958 } else {
6059 qDebug () << " Widescreen patch applied successfully!" ;
6160 }
6261
63- file. close ();
62+ file-> close ();
6463 return status;
6564}
6665
@@ -91,7 +90,7 @@ qint64 widescreen_set(const QString& path) {
9190 }
9291
9392 // Perform the pattern replacement and propagate the status
94- status = findReplacePattern (file);
93+ status = findReplacePattern (& file);
9594
9695 return status; // Single return point
9796}
Original file line number Diff line number Diff line change @@ -36,8 +36,8 @@ int main(int argc, char *argv[]) {
3636
3737 // Add custom -w option for widescreen
3838 parser.addOption (QCommandLineOption (
39- QStringList {" w" , " widescreen" }
40- " Set widescreen bit on original games, probably not useful for TRLE"
39+ QStringList {" w" , " widescreen" },
40+ " Set widescreen bit on original games, probably not useful for TRLE" ,
4141 " PATH" ));
4242
4343 // Process arguments
You can’t perform that action at this time.
0 commit comments