Make 'Ys I & II Eternal Story' playable.
Posted on 2006-02-11 00:00:00
I made some debugging today and gained a better understanding of the problem that makes the movie playing unstable. The program maintains 2 block positions which are used to compute the position of data writing in the buffer using this formula:

Position = ((BlockPos0 + BlockPos1) * 0x800 + DataStored) % 0x80000

So, at one time, the system stream parser call the user-defined handler to dump the video data into the video buffer, and writes it at the position computed using the formula. Then the next time this handler is called, the variables BlockPos0 and BlockPos1 have totally different values which causes the position not to be adjacent to the end of the previously written data but rather at a completely different place.

I checked out what was changing these values and it seems that the user-defined handler used to resume the data transfer to the in-FIFO when it was previously aborted (used when transfering the default quantisation matrix for example) is causing the problem. It also only occurs on a very specific condition which would probably explain why it was kinda random.

I don't really understand the formulae behind the change of the BlockPos0 and BlockPos1 values, so I have no clue if the change is meaningful. In any case, I'll be working on fixing this tomorrow.