-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new file: source/ChickenatorFOVFix/ChickenatorFOVFix.cpp
- Loading branch information
1 parent
e04577f
commit 852d1ad
Showing
1 changed file
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#include <iostream> | ||
#include <iomanip> | ||
#include <fstream> | ||
#include <conio.h> // For getch() | ||
#include <cstdint> // For uint8_t | ||
#include <limits> | ||
|
||
using namespace std; | ||
|
||
int main() | ||
{ | ||
cout << "The Chickenator (2003) FOV Fixer by AlphaYellow, 2024\n\n----------------\n\n"; | ||
float width, height, fov; | ||
|
||
do | ||
{ | ||
cout << "Enter the desired width: "; | ||
cin >> width; | ||
|
||
if (cin.fail()) | ||
{ | ||
cin.clear(); // Clear error flags | ||
cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); // Ignore invalid input | ||
width = -1; // Ensure the loop continues | ||
cout << "Invalid input. Please enter a numeric value." << std::endl; | ||
} | ||
else if (width <= 0 || width > 65535) | ||
{ | ||
cout << "Please enter a positive number for width less than 65536." << std::endl; | ||
} | ||
} while (width <= 0 || width > 65535); | ||
|
||
do | ||
{ | ||
cout << "\nEnter the desired height: "; | ||
cin >> height; | ||
|
||
if (cin.fail()) | ||
{ | ||
cin.clear(); // Clear error flags | ||
cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); // Ignore invalid input | ||
height = -1; // Ensure the loop continues | ||
cout << "Invalid input. Please enter a numeric value." << endl; | ||
} | ||
else if (height <= 0 || height > 65535) | ||
{ | ||
std::cout << "Please enter a positive number for height less than 65536." << endl; | ||
} | ||
} while (height <= 0 || height > 65535); | ||
|
||
fstream file("chickenator.exe", ios::in | ios::out | ios::binary); | ||
|
||
fov = (4.0f / 3.0f) / (width / height); | ||
file.seekp(0x00127080); | ||
file.write(reinterpret_cast<const char *>(&fov), sizeof(fov)); | ||
|
||
// Confirmation message | ||
cout << "\nSuccessfully changed field of view in the executable.\n" << endl; | ||
|
||
// Closes the file | ||
file.close(); | ||
|
||
cout << "Press enter to exit the program..."; | ||
cin.ignore(numeric_limits<streamsize>::max(), '\n'); // Clears the input buffer | ||
cin.get(); | ||
|
||
return 0; | ||
} |