Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
nmlgc committed Jul 6, 2013
0 parents commit fce2dc6
Show file tree
Hide file tree
Showing 93 changed files with 9,457 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Set default behaviour, in case users don't have core.autocrlf set.
* text eol=lf

# Explicitly declare text files we want to always be normalized and converted
# to native line endings on checkout.
*.c text
*.cpp text
*.h text

# Denote all files that are truly binary and should not be modified.
*.png binary
*.ico binary
131 changes: 131 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# This file includes
# ------------------
# C.gitignore
# Global/CSVS.gitignore
# Global/VisualStudio.gitignore
# ------------------


# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Compiled Dynamic libraries
*.so
*.dylib

# Compiled Static libraries
*.lai
*.la
*.a

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.sln.docstates

# Build results

[Dd]ebug/
[Rr]elease/

build/


[Tt]est[Rr]esult
[Bb]uild[Ll]og.*

*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.vspscc
*.vssscc
.builds

*.pidb

*.log
*.scc
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf

# Visual Studio profiler
*.psess
*.vsp

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*/

*.[Rr]e[Ss]harper

# NCrunch
*.ncrunch*
.*crunch*.local.xml

# Installshield output folder
[Ee]xpress

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish

# Publish Web Output
*.Publish.xml

# Others
[Bb]in
[Oo]bj
sql
TestResults
[Tt]est[Rr]esult*
*.Cache
ClientBin
[Ss]tyle[Cc]op.*
~$*
*.dbmdl

*.[Pp]ublish.xml

Generated_Code #added for RIA/Silverlight projects

# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML

# NuGet
packages/
14 changes: 14 additions & 0 deletions COPYING
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004

Copyright (C) 2004 Sam Hocevar <[email protected]>

Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. You just DO WHAT THE FUCK YOU WANT TO.

Binary file added gfx/abstractcactus/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gfx/abstractcactus/icon_01.ico
Binary file not shown.
Binary file added gfx/abstractcactus/icon_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gfx/abstractcactus/icon_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gfx/abstractcactus/logo_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gfx/abstractcactus/logo_02.ico
Binary file not shown.
Binary file added gfx/abstractcactus/logo_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gfx/abstractcactus/logo_03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 71 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
Touhou Community Reliant Automatic Patcher
------------------------------------------

### Description ###

Basically, this is an almost-generic, easily expandable and customizable framework to patch Windows applications in memory, specifically tailored towards the translation of Japanese games.

It is mainly developed to facilitate self-updating, multilingual translation of the [Touhou Project] (http://en.wikipedia.org/wiki/Touhou_Project) games on [Touhou Patch Center] (http://thpatch.net/), but can theoretically be used for just about any other patch for these games, without going through that site.

#### Main features of the base engine #####

* Easy **DLL injection** of the main engine and plug-ins into the target process.

* Using **JSON for all patch configuration data**, making the patches themselves open-source by design. By recursively merging JSON objects, this gives us...

* **Patch stacking** - apply any number of patches at the same time, sorted by a priority list. Supports wildcard-based blacklisting of files in certain patches through the run configuration.

* Automatically adds **transparent Unicode filename support** via Win32 API wrappers to the target program's process, without the need for programs like [AppLocale] (http://en.wikipedia.org/wiki/AppLocale).

* Patches can support **multiple builds and versions** of a single program, identified by a combination of SHA-256 hashes and .EXE file sizes.

* **Binary hacks** for arbitrary in-memory modifications of the original program (mostly used for custom assembly).

* **Breakpoints** to call a custom DLL function at any instruction of the original code. This function can read and modify the current CPU register state.

* **File breakpoints** to replace data files in memory with replacements from patches.

* Wildcard-based **file format patching hooks** called on file replacements - can apply patches to data files according to a (stackable!) JSON description.

* ... and all that without any significant impact on performance. ☺

### Modules included ###

* `win32_utf8`: A UTF-8 wrapper library around the Win32 API calls we require. This is a stand-alone project and can (and should) be freely used in other applications, too.
* `thcrap`: The main patch engine.
* `thcrap_loader`: A command-line loader to call the injection functions of `thcrap` on a newly created process.
* `thcrap_configure`: A rather cheap command-line patch configuration utility. Will eventually be replaced with a GUI tool.
* `thcrap_tsa`: A thcrap plug-in containing patch hooks for games using the STG engine by Team Shanghai Alice.
* `thcrap_update`: A thcrap plug-in containing updating functionality for patches.

### Building ###

As of now, all subprojects only include a Visual C++ 2010 project file for building. SP1 is recommended, if only for correct version identification in Explorer. Build configurations for different systems are always welcome.

The only dependency is [Jansson] (http://www.digip.org/jansson/), which is required for every module apart from `win32_utf8`. Compile it from the [latest source] (https://github.com/akheron/jansson), then add its include and library directories to every project.

### License ###

The Touhou Community Reliant Patcher and all accompanying modules are licensed under the Do What The Fuck You Want To Public License ([WTFPL] (http://www.wtfpl.net/)), unless stated otherwise. This should eliminate any confusion about licensing terms, as well as any possible inquiries on that matter.

This license is very appropriate given the subject matter. We realize that the Touhou fandom itself thrives by everyone just *doing what the fuck they want to*, ripping off everyone else in the process and not respecting the ego of individuals. Having benefited from that mindset ourselves, we indeed embrace this state of affairs.

Thus, in such a non-serious, fragmented global environment that would not even exist without piracy of the source material, the very idea of a license seems both hypocritical and pointless. It can only possibly have a negative impact on the people who *choose* to respect it in the first place.

Even if we *did* choose a more restrictive license, our chances of actually *enforcing* it are very slim, especially once language barriers come into play (hello, Chinese hackers).

But really, we don't want our ego to stand in the way of you doing awesome stuff with this. Repackage a custom build with nice artwork to promote your own community? Awesome! Rebrand the project to focus on visual novel translation via private servers? Awesome! Change large sections of the code on your own, creating a superior project with better PR and greater reach in the process? Awesome, we might even jump ship and support yours instead!

That said, we *do* appreciate attribution. ☺

### Contributing ###

This project is actively developed, and contributions are always welcome.

We track the development status of future features on the GitHub Issues page of this repository. Feel free to chip in, discuss implementation details and contribute code - we would *really* appreciate being able to share the workload between a number of developers.

If, for whatever reason, you don't want to go through GitHub, you can also contact Nmlgc by mail under [email protected].

### Plug-in development ###

At this stage, we recommend that you regularly send us pull requests for whatever custom plug-ins you develop around the base engine. The API of the base engine is far from finalized and may be subject to change. In case we *do* end up changing something, these changes can then directly be reflected in your project.
27 changes: 27 additions & 0 deletions thcrap.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)'=='Debug'">
<Import Project="thcrap_d.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)'=='Release'">
<Import Project="thcrap_r.props" />
</ImportGroup>
<PropertyGroup>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<TreatSpecificWarningsAsErrors>4013;4028;4133</TreatSpecificWarningsAsErrors>
<PreprocessorDefinitions>BUILDER_NAME_W=L"$(USERNAME)";UNICODE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)thcrap\src\;$(SolutionDir)win32_utf8\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>$(OutputPath);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
</Project>
68 changes: 68 additions & 0 deletions thcrap.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual C++ Express 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "thcrap_loader", "thcrap_loader/thcrap_loader.vcxproj", "{2DB35726-8702-4CC8-9394-3D4FFF47F7DD}"
ProjectSection(ProjectDependencies) = postProject
{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942} = {8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}
{8D7455CC-BE95-4F59-9047-D390454C7261} = {8D7455CC-BE95-4F59-9047-D390454C7261}
{C8DB0AF8-1441-4ECD-BD63-30922EF17701} = {C8DB0AF8-1441-4ECD-BD63-30922EF17701}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "thcrap", "thcrap/thcrap.vcxproj", "{8D7455CC-BE95-4F59-9047-D390454C7261}"
ProjectSection(ProjectDependencies) = postProject
{A185D5A7-3E03-4C87-9774-65C014631F5B} = {A185D5A7-3E03-4C87-9774-65C014631F5B}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "thcrap_tsa", "thcrap_tsa/thcrap_tsa.vcxproj", "{C8DB0AF8-1441-4ECD-BD63-30922EF17701}"
ProjectSection(ProjectDependencies) = postProject
{8D7455CC-BE95-4F59-9047-D390454C7261} = {8D7455CC-BE95-4F59-9047-D390454C7261}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "thcrap_update", "thcrap_update/thcrap_update.vcxproj", "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}"
ProjectSection(ProjectDependencies) = postProject
{8D7455CC-BE95-4F59-9047-D390454C7261} = {8D7455CC-BE95-4F59-9047-D390454C7261}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "thcrap_configure", "thcrap_configure/thcrap_configure.vcxproj", "{F85D84FC-6CEA-44CD-8A55-015AE9EFD02A}"
ProjectSection(ProjectDependencies) = postProject
{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942} = {8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}
{8D7455CC-BE95-4F59-9047-D390454C7261} = {8D7455CC-BE95-4F59-9047-D390454C7261}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "win32_utf8", "win32_utf8/win32_utf8.vcxproj", "{A185D5A7-3E03-4C87-9774-65C014631F5B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2DB35726-8702-4CC8-9394-3D4FFF47F7DD}.Debug|Win32.ActiveCfg = Debug|Win32
{2DB35726-8702-4CC8-9394-3D4FFF47F7DD}.Debug|Win32.Build.0 = Debug|Win32
{2DB35726-8702-4CC8-9394-3D4FFF47F7DD}.Release|Win32.ActiveCfg = Release|Win32
{2DB35726-8702-4CC8-9394-3D4FFF47F7DD}.Release|Win32.Build.0 = Release|Win32
{8D7455CC-BE95-4F59-9047-D390454C7261}.Debug|Win32.ActiveCfg = Debug|Win32
{8D7455CC-BE95-4F59-9047-D390454C7261}.Debug|Win32.Build.0 = Debug|Win32
{8D7455CC-BE95-4F59-9047-D390454C7261}.Release|Win32.ActiveCfg = Release|Win32
{8D7455CC-BE95-4F59-9047-D390454C7261}.Release|Win32.Build.0 = Release|Win32
{C8DB0AF8-1441-4ECD-BD63-30922EF17701}.Debug|Win32.ActiveCfg = Debug|Win32
{C8DB0AF8-1441-4ECD-BD63-30922EF17701}.Debug|Win32.Build.0 = Debug|Win32
{C8DB0AF8-1441-4ECD-BD63-30922EF17701}.Release|Win32.ActiveCfg = Release|Win32
{C8DB0AF8-1441-4ECD-BD63-30922EF17701}.Release|Win32.Build.0 = Release|Win32
{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}.Debug|Win32.ActiveCfg = Debug|Win32
{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}.Debug|Win32.Build.0 = Debug|Win32
{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}.Release|Win32.ActiveCfg = Release|Win32
{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}.Release|Win32.Build.0 = Release|Win32
{F85D84FC-6CEA-44CD-8A55-015AE9EFD02A}.Debug|Win32.ActiveCfg = Debug|Win32
{F85D84FC-6CEA-44CD-8A55-015AE9EFD02A}.Debug|Win32.Build.0 = Debug|Win32
{F85D84FC-6CEA-44CD-8A55-015AE9EFD02A}.Release|Win32.ActiveCfg = Release|Win32
{F85D84FC-6CEA-44CD-8A55-015AE9EFD02A}.Release|Win32.Build.0 = Release|Win32
{A185D5A7-3E03-4C87-9774-65C014631F5B}.Debug|Win32.ActiveCfg = Debug|Win32
{A185D5A7-3E03-4C87-9774-65C014631F5B}.Debug|Win32.Build.0 = Debug|Win32
{A185D5A7-3E03-4C87-9774-65C014631F5B}.Release|Win32.ActiveCfg = Release|Win32
{A185D5A7-3E03-4C87-9774-65C014631F5B}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
15 changes: 15 additions & 0 deletions thcrap/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Touhou Community Reliant Automatic Patcher
*
* ----
*
* Local compiler configuration header.
*/

#pragma once

/* Define to __attribute__((packed)) if supported by your C compiler. */
#define PACK_ATTRIBUTE

/* Define to 1 if your C compiler supports the packing pragma. */
#define PACK_PRAGMA 1
Loading

1 comment on commit fce2dc6

@wmichaelv
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kudos for this team. : D

Please sign in to comment.