King's Valley Plus enhancement patch
-------------------------------------------------------------------------------
(c) 2021 by FRS

This patch implements enhancements to the game King's Valley Plus (aka King's
Valley with Edit mode):

- Removes the terrible built-in editor and replaces it with a simple file
  browser to load levels created by the user
- Changes the .DAT extension to .KVG (King's Valley GAME.USR) for the custom
  levels
- Unlocks all the engine features on user levels: 
  - Dual and triple rooms
  - All mummy types instead of only the white mummy
  - Flip doors, with optional auto-inversion
  - Trap doors (one-way doors)
  - Trap walls
  - Fake floors
  - Hard floors
  - Bridges
  - Up to 4 exit doors
  - Fall from the bottom to the top
- Adds Dynamic Vsync, to prevent slowdowns on levels with lots of objects
- Fixes the stair color glitch on the exit door animation
- Enables the turbo when CHGCPU is present on the BIOS
- Eliminates the need for the WORK.DAT configuration file, that was used
  to select for which levels the game would load a GAMExx.DAT level edited
  by the user. The game will now load a GAMExx.KVG whenever it's present
- Fixes a crash that happened when the a destination door that doesn't exist
  was selected, i.e. on a user level
- The game doesn't crash anymore on DOS2/Nextor after quitting the custom
  level module (was: EDIT, now: LOAD)
- Fixes a bug where the game sometimes loaded the incorrect theme for an
  internal level, including on the autoplay demo
- Sets the MSX1 palette on MSX2 or higher
- Changes text PAUSING to PAUSED
- Fixes the release date on the title screen
- Increases the time the title screen stays before the autoplay is activated
- Now you can have as many custom levels as you want, instead of only 9.
- When the game is run under DOS2/Nextor you can organize your levels inside
  folders, and select a folder on startup. Just pass the desired folder as a
  parameter for the KV1PLUS.BAT launcher script. Note: COMMAND >=2.44 is required.
- You can type KV1PLUS /? on DOS2/Nextor to see a help message
- MSX-DOS1 is also supported, but without folders or help message

==============================
How to apply the patch

The DSK image to be patched *must* be a dump from your Konami Game
Collection 1/Disk2 that you actually own.
Check if your DSK file has the following SHA1 checksum:

SHA1(COLLEC12.DSK)= 906f91a8e86dfaf2d2321c27b5b5565b4a67c090

- You can use the following tools to verify the SHA1 checksum:
  - Windows:
    -MD5 & SHA-1 Checksum Utility 1.1
    - HashTab
  - Mac OS-X:
    - DropHash
    - HashTab
    - (or use the same command as Linux, seen below)
  - Linux:
    - Type on a shell: openssl dgst -sha1 MYGAME.DSK

- To apply the patch, get an IPS patcher like IPSWin, LunarIPS or UIPS, and
  follow the instructions contained in the manual of that tool.

* After the patch is applied, you can copy the files to your preferred
  mass storage device (HDD, SD card, CF card, etc) and run the game
  on DOS2/Nextor. Type KV1PLUS /? to see the help for the launcher.

==============================
Special Thanks

- OpenMSX team, for their excellent emulator and debugger
- MRC crew, for the place where MSX hobbyists can meet and exchange ideas
- Sjoerd Mastijn, Aprisobal and ped7g, for the SjASMPlus assembler
- FiXato, for compiling many development tools I use on Mac OS-X
- Sandro Sebastiao Singer, for betatesting

==============================
FAQ
---

Q: Why did you remove the built-in editor? This is an unacceptable heresy,
   and shouldn't have been done!!!
R: The editor was pretty bad, full of bugs and appears to have been
   hastily done by a different person that the one who coded the game.
   It used it's own format for levels (EDATAx) that was different from the
   format used by the game (GAMEXX.DAT), and this was converted on the fly
   to the format used by the game. A pretty poor design decision.

   Also, the editor file format had many limitations like:
   - Just a single room, when the engine GAMEXX.DAT format supports 3 rooms
   - Restricted to only 3 white mummies (very boring)
   - Only a single exit door, instead of 4 supported by GAMEXX.DAT
   - No way to support for any of these features:
     - flip doors
     - trap walls
   - Maximum of 10 custom levels could be saved (EDATA0 to EDATA9)
   - Not to mention the bugs that caused the enemies to not spawn at all, or
     to spawn at the wrong places

  When I started working on this project, my idea was to fix the built-in
  Editor bugs and remove its limitations. But soon it became clear that this
  module design was so crippled that not only this wasn't possible, but the
  Editor stood in the way, making it impossible to load the fully fledged
  GAMEXX.DAT levels.
  It had to be replaced with a new module, capable of dealing with the
  GAMEXX.DAT levels.
  The .DAT extension was renamed to .KVG to make it easier to load/save
  these files on an external editor like Tiled, for which I wrote a
  load/save plugin.

Q: Why do you insist on calling the game "King's Valley Plus" if that's not
   the official name?
A: Konami never gave an official title for this game other than "King's Valley",
   so it's unofficially known for many nicknames, like:
   - King's Valley Plus
   - King's Valley with Editor
   - King's Valley with Edit Mode
   - King's Valley Konami Game Collection 1 edition
  Since the (crappy) built-in Editor was removed, it didn't make sense to
  keep calling it with any names that made reference to the editor.
  And the "Plus" addendum is much easier to say than the whole "Konami
  Game Collection 1 Edition"
  If you prefer, you can also see it like this: the patch upgrades the old
  game, whatever name it had, to a new enhanced version, called
  "King's Valley Plus".   ;)

Q: I dislike this or that change you made. Can you make a custom-tailored version
   just for me?
A: I wish I had that much free time at my hands. But:
   - This is not a fast food chain
   - I'm just sharing what I created for me, with those who also want to enjoy it
   - Patches are not new games. Each change must be carefully done in order to not
     break anything, or unwanted collateral effects might pop-up anywhere.

Q: Will the patched game run on non-turbo machines?
A: Yes, just as usual

Q: I applied the patch and the resulting DSK doesn't work! What is wrong?
A: You're probably trying to apply the patch on a DSK that has an incorrect
   checksum. Also, check if you're using the recommended patch tools

Q: I'm trying to run the patched DSK on SofaRunIt (or any other MSX floppy emulator)
   and it doesn't work!
A: There's no need to use floppy disk emulators. Just copy all files contained in
   the DSK to a folder in your mass storage device (SD card, CF card, HDD etc) and
   it will work much better, and even have (a simple) subfolders support


===========================================================================
	                     License
                           Terms of use
---------------------------------------------------------------------------

1) This patch is gratis for non-commercial purposes, and the author retains
   its copyright. You only can run and make backup copies of the patch
   while observing the non-commercial restriction.

2) You are only allowed redistribute the patch files (online or on a removable
   media) under the following conditions:
   2.1) No commercial transaction of any kind is involved
   2.2) All the included files are distributed together inside the same
   compressed file.
   2.3) This README must be included unmodified inside the same compressed file.

3) If you want to use this patch for commercial purposes you MUST contact me
   first to negotiate the terms and conditions. Send an e-mail to
   sdsnatcheralpha@gmail.com to contact me.

4) You cannot distribute games with this patch pre-applied.

5) This patch is provided ‘as-is’, without any express or implied warranty.
   In no event will the author be held liable for any damages resulting from the
   use of this patch or the software patched with it.

6) USE THIS SOFTWARE SOLELY AT YOUR OWN RISK.


===========================================================================
                          Donations
---------------------------------------------------------------------------
 If you like the enhancements and fixes here presented and want to show your
 appreciation by donating any amount, or MSX software/hardware, it will be very
 welcome and will help future developments.
 Donations can be done via PayPal to sdsnatcheralpha@gmail.com, and for MSX
 hardware, try contacting me on this e-mail address too.

 Have a look at my wishlist in the following link:
 http://frs.badcoffee.info/wishlist.html

