		      Yume 2000 (Future World Mix) +6 FIX
		      ===================================

This is a fix for the Yume 2000 (Future World Mix) demo by INF to make it run
better on modern computers.

				   How to run
				   ----------

The demo directory contains the original demo (with the original update applied)
and the YUME2K_FIX.EXE which is the fixed version.

You can also patch the executable yourself:

The patch_src directory contains the source for this patch which you can apply
yourself. Download the original demo (and the original update) and run:

   > nasm -f bin yume2k_fix.asm
   > python3 yume2k_fix.py -o <path to YUME2K.EXE>

The patched file will be written to YUME2K_FIX.EXE in the same directory as the
original exe.

I've also made a video capture: https://youtu.be/BPkFzPn3oxk


			      What has been fixed?
			      --------------------

- The crashes (hopefully).
- There is no longer a window border.
- 2x scaling is enabled by default when 640x480 is used.
- The knot deformation effect is no longer framerate dependent
- Added /soundsync option to sync visuals with sound playback instead of time
  elapsed.
- Added /vblank option to wait for vblank to end before copying each frame. This
  is just to reduce the number frames rendered.


				    Details
				    -------

				    Crashes

The crashes are caused by integer underflows several places in the code. This
has been fixed by checking for negative sizes in some functions. The underlying
problem is still there I guess.


				 Window border
				 
The WS_POPUP, WS_CLIPCHILDREN and WS_CLIPSIBLINGS flags have been added to the
style flags in the call to CreateWindowEx to properly create a bordeless window.


				    Scaling

The demo will first try to set the video mode to 320x240 (32, 24 and 16 bit). If
this fails, it tries 640x480. Unfortunately the scaling is left unchanged and
the demo will run in a small 320x240 window if only 640x480 is available.

The fix will change the scaling to 2x (the same as using the /b1 option) if the
mode is automatically set to 640x480 and scaling is set to 0 (the default). If
the mode is set to 640x480 with the /v option, the scaling is left unchanged.

				Knot deformation

The knot deformation effect starting at 37 seconds uses a fixed step for each
frame. It looks like there is some code there to make it not run too fast, but
it does not work.

The entire function has been rewritten to calculate the deformation based on the
current time. It should look about same as the original code in 30 fps.

			       /soundsync option

Use this option to sync the visuals to the sound playback position instead of
time elapsed (from timeGetTime()). Use this if the demo appears to go out of
sync. The resolution seems to a bit worse than timeGetTime() and may be
noticable on higher refresh rates so it is not enabled by default.

				 /vblank option

Run the demo with /vblank to throttle the rendering to the display refresh
rate. If the demo crashes because of other places with integer underflows that
I've not found, try this option. The implementation of this is not optimal so it
may end up dropping frames on slower machines.

See also the source.

				----------------

   Thanks to SLC, Sesse, Minebrandon, Saga Musix, ps and canmon for testing.

				----------------

			   Greetings to Are and Tom!

				----------------

		      - neon/darklite (geir@darkside.no) -

