rendered paste body#include <iostream>
#include <sstream>
using namespace std;
int main (int argc, char * const argv[]) {
char szCurrentOff [9];
char szDestOff [9];
char szHexFixed [9];
char szOption [2];
stringstream ssHexInputFixed, ssByteBuffer, ssFinalHex;
cout << "Enter your current offset: 0x";
cin >> szCurrentOff;
cout << "Enter your destination offset: 0x";
cin >> szDestOff;
cout << "Jump or Call? [j/c]: ";
cin >> szOption;
sprintf(szHexFixed, "%08X", ((strtol(szDestOff, NULL, 16)) - ((strtol(szCurrentOff, NULL, 16)) - 0x5)));
for(int i = 0; i < (8 + 1); i+=2)
{
ssByteBuffer << szHexFixed[8 - i] << szHexFixed[8 - (i - 1)];
ssFinalHex << ssByteBuffer.str().c_str();
ssByteBuffer.str("");
}
if (strcmp(szOption, "j") == 0 || strcmp(szOption, "J") == 0) cout << "Hex: E9" << ssFinalHex.str().c_str() << endl;
if (strcmp(szOption, "c") == 0 || strcmp(szOption, "C") == 0) cout << "Hex: E8" << ssFinalHex.str().c_str() << endl;
return 0;
}