diff --git a/ff8_launch/ff8_launch.vcxproj b/ff8_launch/ff8_launch.vcxproj index 94722b0..db38b67 100644 --- a/ff8_launch/ff8_launch.vcxproj +++ b/ff8_launch/ff8_launch.vcxproj @@ -5,16 +5,16 @@ Debug Win32 - - Release + + Debug_JP Win32 Debug x64 - - Release + + Debug_JP x64 @@ -24,6 +24,7 @@ {1e5bdc80-729a-4815-a3ee-a59a81090285} ff8launch 10.0 + ff8jp_launchPatch @@ -32,7 +33,7 @@ v143 Unicode - + Application false v143 @@ -45,7 +46,7 @@ v143 Unicode - + Application false v143 @@ -60,26 +61,26 @@ - + - + true - + false true - + false @@ -94,14 +95,15 @@ true - + Level3 true true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + false + WIN32;NDEBUG;_CONSOLE;JAPANESE_PATCH%(PreprocessorDefinitions) true + stdcpp20 Console @@ -122,7 +124,7 @@ true - + Level3 true diff --git a/ff8_launch/main.cpp b/ff8_launch/main.cpp index 262cda2..fb85af5 100644 --- a/ff8_launch/main.cpp +++ b/ff8_launch/main.cpp @@ -1,9 +1,45 @@ +#include +#include +#include +#include +#include #include +#include int main() { - HMODULE mod= LoadLibraryA("FFVIII_JP.dll"); - FARPROC prc = GetProcAddress(mod, "runGame"); - prc(); + std::filesystem::path pt("FFVIII.exe"); + if(!std::filesystem::exists(pt)) + { + MessageBoxW(NULL, L"FFVIII.exe ファイルが見つかりません", + L"エラー", MB_OK); + return ERROR_FILE_NOT_FOUND; + } + std::ifstream ifs; + ifs.open(L"FFVIII.exe", std::ios::binary | std::ios::in); + if(!ifs.is_open()) + { + MessageBoxW(NULL, L"FFVIII.exe ファイルは存在しますが開けません", + L"エラー", MB_OK); + return ERROR_FILE_CORRUPT; + } + + std::vector buffer; + buffer.assign(std::istreambuf_iterator(ifs), + std::istreambuf_iterator()); + + ifs.close(); + + buffer[0x94B] = 0x89; + buffer[0x94B+1] = 0xC8; + buffer[0x94B+2] = 0x90; + + std::ofstream ofs; + ofs.open(L"FFVIII_JP.exe", std::ios::binary | std::ios::out | std::ios::trunc); + ofs.write((const char*) & buffer[0], buffer.size()); + ofs.close(); + + MessageBoxW(NULL, L"やった! パッチは「FFVIII_JP.exe」という名前の新しいファイルを作成しました. ファイルを実行してみてください", L"YATTA!", MB_OK); + return 0; } \ No newline at end of file