Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DONTMERGE: DRAGONS: Incomplete attempt at improving big-endian compatibility #2784

Draft
wants to merge 1 commit into
base: master
from

Conversation

@dwatteau
Copy link
Contributor

@dwatteau dwatteau commented Feb 18, 2021

Hi,

This is related to https://bugs.scummvm.org/ticket/11710.

DRAGONS has some important rendering issues with big-endian systems. I have a PowerBook G4 running Debian unstable on ppc32 (big-endian), so I tried having a look at this. (I'm doing my tests with Blazing Dragons (Sony Playstation/French), for reference.)

This first commit is incomplete, and has been mostly done through naive trial-and-error, so see this more as an attempt at showing where the problem lies. Feel free to improve on it or to rewrite it completely in a better way :)

It seems that, in this engine, screen content must be written in native endianness here, not in little-endian. So, I've just introduced a naive WRITE_SCREEN macro that choses WRITE_LE_UINT16 or WRITE_BE_UINT16, depending on your platform. Probably not the best way to handle this, but once again, let's suggest something and improve it.

The first commit I'm including in this PR appears to fix most scenes, cutscenes, and the bag.

Shadows, menus, and text are still wrong (I think I'm just missing something for the menus, and for the fonts/shadows it looks like some possible alpha blending problem). Audio hasn't been tested yet (Fluidsynth gives me some really strange initialisation errors, but it's maybe a problem with Debian unstable -- I'll look at this a bit later).

By the way, I also see these (char) casts in this engine:

sound.cpp:      second = (char)iVar3 + (char)(iVar3 / 10) * 6;
sound.cpp:      sector = (char)iVar2 + (char)(iVar2 / 10) * 6;
sound.cpp:      minute = (char)iVar1 + (char)(iVar1 / 10) * 6;
talk.cpp:                               talkDialogEntry->yPosMaybe = talkDialogEntry->yPosMaybe + (char)sVar2;

on PowerPC, char is unsigned by default, and I'm not sure the char here are used in a "pure character" way? Otherwise, we might want to use signed char, int8 or uint8 instead. But I don't really understand this part yet.

We can arrange for some more tests through Discord or whatever, if you like.

It seems that screen content must be written in native endianness
here, not in little-endian.

This appears to fix most scenes, cutscenes, and the bag.

Shadows, menus, and text are still wrong. Audio hasn't been tested
yet.

See https://bugs.scummvm.org/ticket/11710.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

1 participant