         **************************************************************
         *         Cosmic Fantasy 2 - Un-Worked Design Patch          *
         *                 Version 0 (21 Mar. 2017)                   *
         *            by Supper (suppertails66@gmail.com)             *
         **************************************************************

This is a patch that fixes several issues introduced in the US version of the PC 
Engine CD/TurboGrafx-CD game Cosmic Fantasy 2 by its publisher, Working Designs. 
The US version of the game increases the stats of several bosses, among a few 
other noticeable changes. This patch aims to restore the game to match the 
original Japanese version as closely as possible.

              ****************************************************
              *                     Changes                      *
              ****************************************************

* Enemy stats are restored to what they were in the Japanese game. The only 
changes in the US version were to the first and last few bosses of the game 
(though some of their stats absolutely skyrocketed).
* Beating the first boss awards 20 EXP in the US version; it now gives nothing, 
per the original game.
* Rim (Babette)'s obscene gesture in her introductory cutscene has been 
restored.

Other changes in the US version (e.g. the dubbing, the erased Japanese text in 
some cutscenes, the horrible horrible made-up script) have been kept.

For specific details on the alterations in the US version, see this page (which 
may not have actually been written yet): 
https://tcrf.net/Cosmic_Fantasy_2#Regional_Differences

              ****************************************************
              *               Patching Instructions              *
              ****************************************************

--- WHAT YOU'LL NEED ---
* A BIN/CUE or ISO/WAV format disc image of the US version of Cosmic Fantasy 2.
* If you're on Windows, the xdelta patching utility (http://xdelta.org/) is 
provided in this distribution. On other platforms, you'll need to acquire 
version 3.0.8 or later on your own.

--- AUTOMATIC PATCHING METHOD (WINDOWS) ---

If you're using Windows, move your disc image files into the same directory as 
the program and do one of these as appropriate:
  * If you have a BIN/CUE disc image, drag and drop the BIN file (or IMG file) 
onto binpatch.bat.
  * If you have an ISO/WAV disc image, drag and drop any of the files onto 
isopatch.bat. Note that your ISO/WAV files must use standard naming and 
numbering, e.g. "File 01.wav", "File 02.iso", etc. If it doesn't, you'll need to 
rename themin this fashion first.

If everything works, this should produce the patched game under the name 
"CosmicFantasy2UnWorked_##". To play it, make sure the file 
"CosmicFantasy2UnWorked.cue" (included with the patch) is in the same directory 
as everything else and then load it in an emulator, or burn it to a CD for use 
on real hardware.

If this doesn't work, try using the manual patching method below to diagnose the 
problem. It's also possible there's an earlier revision of the game, which isn't 
supported by this patch right now; see the "Known Issues" section.

--- MANUAL PATCHING METHOD---

--- CONVERTING FROM BIN/CUE TO ISO ---
If you have a BIN/CUE image (or the equivalent IMG/CUE), you'll need to convert 
it to ISO/WAV before you can patch it. I'd recommend using BinChunker (a.k.a. 
bchunk -- homepage http://he.fi/bchunk/) to do this.

* On Windows, you can use the included bchunk.exe (courtesy of elmer). If you 
don't want to use bchunk, there are also many "shareware"/commercial utilities 
that can do this task, though they may or may not output the same ISO as bchunk.
* On Linux, it should be available from your distro's repos, or of course you 
can build from source.
* On Mac, you can build from source, or perhaps get binaries wherever Mac people 
get their binaries from.

To convert, open a command prompt and navigate to the folder containing the 
BIN/CUE, then run the following command:

bchunk -w CosmicFantasy2US.bin CosmicFantasy2US.cue CosmicFantasy2US_

(substituting the names of your BIN/CUE files, obviously -- remember to put 
quotes around them if they have spaces in them. **Don't rename them** -- this 
will cause the conversion to fail unless you also modify the CUE file itself.) 
This should generate 98 files in total.

--- PATCHING STEPS---
1. First, !!!***verify that your ISO files have the correct MD5 hash***!!! If 
they don't, the patch almost certainly won't work. You can obtain this by using 
the md5sum utility on *nix, or the FCIV utility 
(https://support.microsoft.com/en-us/kb/889768) on Windows. The files that need 
to be patched are tracks 02, 40, and 98 of the disc image. They should have the 
following hashes:

Track 02: da651cb43dc1e9ba51849a6f967cf921
Track 40: c8e94b5fbc6382c3ac8e0039061111e9
Track 98: 06359f1dae7f6ae4b141d6f0e07506fe

(There's a possibility that multiple revisions of the US disc exist. If one or 
more of the hashes doesn't match, check the "Known Issues" section.)

2. Use xdelta to apply the three xdelta patches -- 
CosmicFantasy2UnWorked_Track02.xdelta, CosmicFantasy2UnWorked_Track40.xdelta, 
and CosmicFantasy2UnWorked_Track98.xdelta -- to the corresponding tracks of the 
ISO. If you're using the command line, this would look something like:

xdelta3 -d -s CosmicFantasy2UnWorked_Track02.xdelta CosmicFantasy2US_02.iso 
CosmicFantasy2UnWorked_02.iso
xdelta3 -d -s CosmicFantasy2UnWorked_Track40.xdelta CosmicFantasy2US_40.iso 
CosmicFantasy2UnWorked_40.iso
xdelta3 -d -s CosmicFantasy2UnWorked_Track98.xdelta CosmicFantasy2US_98.iso 
CosmicFantasy2UnWorked_98.iso

If you use a GUI wrapper, it should be self-explanatory, but make sure the 
output files are named "CosmicFantasy2UnWorked_02.iso", etc.

3. Rename all other tracks produced from the BIN/CUE conversion process to 
CosmicFantasy2UnWorked_03.wav, CosmicFantasy2UnWorked_04.iso, etc.

4. A CUE file named CosmicFantasy2UnWorked.cue is included with this patch. Move 
it to the same directory as your ISO and WAV files. To play the game, load the 
CUE in an emulator or burn it to a disc for use on real hardware.

--- TROUBLESHOOTING ---
* If the automatic patching method fails to produce any audio files, make sure 
all your files are named in the format "Filename ##.wav". The patcher expects to 
see a two-digit number directly before the file extension; without that, it 
can't find the tracks.
* If the patched ISO won't run, check the MD5 hashes of your original ISO and 
the patched ISO. The correct hashes are given in the steps above. If either of 
them doesn't match, try a different method for converting the BIN/CUE to ISO, or 
using a BIN/CUE generated by a different program.
* If your ISO has associated sound files in some format other than WAV (or your 
emulator doesn't support WAV files), you'll need to either convert them to WAV 
or modify the CUE file to use a different format. In the latter case, change 
(for example) all occurences of WAVE to MP3, and make sure the filenames are 
correct.

              ****************************************************
              *                  Known Issues                    *
              ****************************************************

* There is a possibility that there are multiple revisions of the US version of 
the game; if so, this patch is based on the later one, and it may or may not 
work on the earlier one. Specifically, there's a treasure chest in the dungeon 
leading to Harp's Hamlet which is empty in the Japanese version. The version of 
the game I used to make this patch instead has Bingleberries in that chest; 
however, it's been reported that some US versions leave the chest empty, which 
is problematic because the "chest is empty" message wasn't translated and causes 
the game to display nonsense.
   If you happen to have a copy of this earlier version, please get in touch 
with me.

              ****************************************************
              *                 Version History                  *
              ****************************************************

Version 0 (3/21/17)
  * Initial release.

              ****************************************************
              *                  Special Thanks                  *
              ****************************************************

* elmer
* Everyone on ROMhacking.net who provided feedback and support
