Skip to content

Commit

Permalink
launch patch for JP
Browse files Browse the repository at this point in the history
  • Loading branch information
makipl committed Jun 21, 2022
1 parent 0d54bb6 commit 313aea6
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 17 deletions.
30 changes: 16 additions & 14 deletions ff8_launch/ff8_launch.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<ProjectConfiguration Include="Debug_JP|Win32">
<Configuration>Debug_JP</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<ProjectConfiguration Include="Debug_JP|x64">
<Configuration>Debug_JP</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
Expand All @@ -24,6 +24,7 @@
<ProjectGuid>{1e5bdc80-729a-4815-a3ee-a59a81090285}</ProjectGuid>
<RootNamespace>ff8launch</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>ff8jp_launchPatch</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
Expand All @@ -32,7 +33,7 @@
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_JP|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
Expand All @@ -45,7 +46,7 @@
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_JP|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
Expand All @@ -60,26 +61,26 @@
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug_JP|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug_JP|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_JP|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_JP|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
Expand All @@ -94,14 +95,15 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug_JP|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>false</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;JAPANESE_PATCH%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
Expand All @@ -122,7 +124,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug_JP|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
Expand Down
42 changes: 39 additions & 3 deletions ff8_launch/main.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,45 @@
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <iterator>
#include <windows.h>
#include <filesystem>

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<unsigned char> buffer;
buffer.assign(std::istreambuf_iterator<char>(ifs),
std::istreambuf_iterator<char>());

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;
}

0 comments on commit 313aea6

Please # to comment.