Captain Blood IKBD clock (was Re: [hatari-devel] Zombi)

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Le 11/05/2012 08:42, Thomas Huth a écrit :
Am Thu, 10 May 2012 23:28:41 +0200
schrieb Nicolas Pomarède<npomarede@xxxxxxxxxxxx>:

On 10/05/2012 23:18, Thomas Huth wrote:
...

Anyway, I think I've got a clue what might be wrong with the game:
It initially sets a new date/time stamp with the IKBD clock-set
command - which we do not support in Hatari yet. So when it later
reads back the time from the IKBD, it gets a time stamp that is far
away from the time expected by the program - so it thinks too much
time has passed and you die.

I am just trying to implement a fix for this ... but that might
require a new variable in the IKBD code that has to be saved in the
memory snapshots, too. So this will break the compatibility of the
snapshots with version 1.6.0 and 1.6.1 ... Nicolas, would that be
ok for 1.6.2 or do you prefer to keep 1.6.2 compatible with the two
previous versions?

   Thomas

If we can't avoid extending the ikbd memory state, then it's fine
with me if the snapshot changes.

Ok, I've implemented IKBD set-clock now, so Zombi is working now. I
had to save a new variable to the memory snapshots, so they are
incompatible with 1.6.0 now. Anyway, looking at the release notes,
there are really a lot of changes already, ... Nicolas, did you maybe
also consider to name the next release 1.7.0 already instead of 1.6.2?

  Regards,
   Thomas

Hello

as reported on atari-forum, captain blood doesn't work properly under Hatari.

At the top of the screen, under the X/Y coordinate of the planet, there's a minutes/seconds counter (click in bottom left corner to close the planet view and see it)

When the game starts under Hatari, the values are 69.28, then the seconds wrap at 69.87 and continue at 70.28 (it should wrap at 59 seconds)

I made some investigations, and the game is using minute/second as returned by the IKBD's ReadClock functions, so getting seconds > 60 is clearly a bug in our implementation.

The game uses ReadClock, which means that even if you pause the game, time is still counting in real time.

As with zombi, the game uses SetClock at the beginning with "99 12 31 00 00 00", which ensures minute/second are 0 at the start of the game. In our case, as we are in the year 2012, I think something is not correct in the way nTimeOffset is computed for year "99".


Also, independantly of this bug, the ikbd's year is returned as :

IKBD_ToBCD(SystemTime->tm_year)

which is wrong for tm_year >= 100. 2012 gives tm_year = 112 and a BCD value of 0xB2. The correct way would be to return :

IKBD_ToBCD( SystemTime->tm_year % 100 )

which correctly returns 0x12. But even with this modification, time is still wrong in Captain Blood.


Thomas, do you have any idea on how to fix this in a way that doesn't break Zombi too ?


Nicolas






Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/