How to make a game save file editor 간단한 게임 에디터 만들기
C, C++ 2019. 6. 30. 12:11 |반응형
Explains how to make a game(Prince of Persia) save file editor with C++.
C++를 이용한 간단한 게임 세이브 파일 에디터 소스.
#include <iostream>
#include <fstream>
using namespace std;
int main(int argc, char* argv[])
{
if (argc != 3)
{
cout << "Usage : " << argv[0] << " [save file name] [energy]" << endl;
cout << "Example: " << argv[0] << " prince.sav 8" << endl;
return -1;
}
short value = atoi(argv[2]); // 2 byte value (for 16 bit old dos game)
ofstream fout(argv[1], ios_base::binary | ios_base::out | ios_base::in);
if (!fout.is_open())
{
cout << "Can't find " << argv[1] << endl;
return -1;
}
fout.seekp(0x06, ios_base::beg); // Prince's energy saved at 0x06~0x07 (2 byte)
fout.write((char*)& value, sizeof(short)); // 2 byte
fout.close();
cout << "Success!" << endl;
return 0;
}
반응형
'C, C++' 카테고리의 다른 글
| Integrated Color Picker for Visual Studio IDE and Editor (0) | 2019.07.05 |
|---|---|
| How to open a command prompt on the project's path in Visual Studio (2) | 2019.07.03 |
| Qt 스프라이트 애니매이션 (0) | 2019.02.21 |
| Qt 설치 및 간단한 사용 예 (4) | 2019.01.16 |
| How to install and use JsonCpp - JsonCpp 설치 및 사용 (2) | 2019.01.08 |
