Advertisement
Faschz

OoT - Coordinate Code Creator

Feb 25th, 2017
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.33 KB | None | 0 0
  1. //For Ben
  2. #include <iostream>
  3. #include <iomanip>
  4. #include <fstream>
  5.  
  6. using namespace std;
  7.  
  8. void getCodes(float, float, float);
  9.  
  10. int main(){
  11.     float x;
  12.     float y;
  13.     float z;
  14.    
  15.     cout << "X: ";
  16.     cin >> x;
  17.     cout << "Y: ";
  18.     cin >> y;
  19.     cout << "Z: ";
  20.     cin >> z;
  21.    
  22.     cout << endl;
  23.    
  24.     getCodes(x, y, z);
  25.     cout << "Saved to 'codes.txt'" << endl;
  26.    
  27.     system("pause");
  28.     return 0;
  29. }
  30.  
  31. void getCodes(float x, float y, float z){
  32.     ofstream codes;
  33.     codes.open("codes.txt");
  34.    
  35.     int i = *(reinterpret_cast<int*>(&x));
  36.     codes << "D01C84B5 0020" << endl;
  37.     codes << "811DAA54 " << hex << setw(4) << setfill('0') << (i>>16 & 0xFFFF) << endl;
  38.     codes << "D01C84B5 0020" << endl;
  39.     codes << "811DAA56 " << hex << setw(4) << setfill('0') << (i & 0xFFFF) << endl;
  40.    
  41.     int j = *(reinterpret_cast<int*>(&y));
  42.     codes << "D01C84B5 0020" << endl;
  43.     codes << "811DAA58 " << hex << setw(4) << setfill('0') << (j>>16 & 0xFFFF) << endl;
  44.     codes << "D01C84B5 0020" << endl;
  45.     codes << "811DAA5A " << hex << setw(4) << setfill('0') << (j & 0xFFFF) << endl;
  46.    
  47.     int k = *(reinterpret_cast<int*>(&z));
  48.     codes << "D01C84B5 0020" << endl;
  49.     codes << "811DAA5C " << hex << setw(4) << setfill('0') << (k>>16 & 0xFFFF) << endl;
  50.     codes << "D01C84B5 0020" << endl;
  51.     codes << "811DAA5E " << hex << setw(4) << setfill('0') << (k & 0xFFFF) << endl;
  52.    
  53.     codes.close();
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement