Opened 9 years ago

Closed 9 years ago

Last modified 13 months ago

#9265 closed patch (fixed)

Wii port +humogonous games +missing cursor

Reported by: SF/obcd Owned by: dhewg
Priority: normal Component: Port: Wii
Keywords: Cc:
Game:

Description

1. Problem description:

Some Humogonous scumm games don't show the ingame cursor on the wii port of scummvm.
This happens with the stable 1.2.0 build and also with the svn builds.

2. Cause of problem:

The Wii port has the separate cursor palette enabled.
The _cursorPalette is used as a buffer.
When the system switches to the _texMouse.palette (setCursorPalette) and the _cursorPaletteDisabled == true,
than the _texMouse.palette is copied to the _cursorPalette.
The disableCursorPalette function copies the _cursorPalette back to to the _texMouse.palette when the cursor
palette is disabled.

I did some loggings of the functions and there appearance during the startup of a humogonous game:

=~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2010.11.26 10:28:09 =~=~=~=~=~=~=~=~=~=~=~=
startup as 'scummvm_stripped.dol'
chdir to default
initSize 320*200*8 (000 -> 000 match: 1)
window caption: ScummVM 1.3.0svn (Nov 26 2010 10:26:51)
switching to palette based cursor
setCursorPalette with _cusorPaletteDisabled = TRUE
disabling cursor palette
User picked target 'PuttTime-nl-1' (gameid 'putttime')...
Looking for a plugin supporting this gameid... SCUMM Engine [all games]
Starting 'Putt-Putt Travels Through Time'
disabling cursor palette
window caption: Putt-Putt Travels Through Time (Dutch)
switchVideoMode 0
initSize 640*480*8 (000 -> 000 match: 1)
enabling cursor palette
setCursorPalette with _cusorPaletteDisabled = FALSE
disabling cursor palette
Set palette
disabling cursor palette
Set palette
Set palette
disabling cursor palette
Set palette
Set palette
disabling cursor palette
Set palette
Set palette
Set palette
Set palette
Set palette
Set palette
Set palette
Set palette
Set palette
Set palette
disabling cursor palette
disabling cursor palette
...

As you can see, the cursor palette is enabled before the actual colors are set with the setCursorPalette.
Due to that issue, the _cursorPalette isn't updated in the SetCursorPalette function.

3. My solution:

The _cursorPalette is suposed to have the same entries as the normal in game palette.(In a different format)
So, I changed the SetPalette function a little:

osystem_gfx.cpp:

void OSystem_Wii::setPalette(const byte *colors, uint start, uint num) {
#ifdef USE_RGB_COLOR
assert(_pfGame.bytesPerPixel == 1);
#endif

const byte *s = colors;
u16 *d = _texGame.palette;

for (uint i = 0; i < num; ++i) {
d[start + i] = Graphics::RGBToColor<Graphics::ColorMasks<565> >(s[0], s[1], s[2]);
s += 4;
}

gfx_tex_flush_palette(&_texGame);

// Obcd
/* this background cursor palette should always be equal to the game screen palette */
s = colors;
d = _cursorPalette;
for (uint i = 0; i < num; ++i) {
d[start + i] = Graphics::ARGBToColor<Graphics::ColorMasks<3444> >(0xff, s[0], s[1], s[2]);
s += 4;
}
if (_cursorPaletteDisabled) //There should be a direct reflection to the current showed cursor
{
assert(_texMouse.palette);
u16*f = _cursorPalette;
d = _texMouse.palette;
memcpy(d + start, f + start, num * 2);
_cursorPaletteDirty = true;
}
/*

if (_cursorPaletteDisabled) {
assert(_texMouse.palette);

s = colors;
d = _texMouse.palette;

for (uint i = 0; i < num; ++i) {
d[start + i] = Graphics::ARGBToColor<Graphics::ColorMasks<3444> >(0xff, s[0], s[1], s[2]);
s += 4;
}

_cursorPaletteDirty = true;
}
*/
}

It seemed like the most logical place to do things....

regards.

Ticket imported from: #3123860. Ticket imported from: patches/1370.

Attachments (1)

bugfix.txt (3.4 KB ) - added by SF/obcd 9 years ago.
The above text…

Download all attachments as: .zip

Change History (5)

by SF/obcd, 9 years ago

Attachment: bugfix.txt added

The above text...

comment:1 by fingolfin, 9 years ago

Owner: set to dhewg

comment:2 by dhewg, 9 years ago

Resolution: fixed
Status: newclosed

comment:3 by dhewg, 9 years ago

thanks, you nailed it
fixed with 50129178efcd2a6defae679f059bd9de796a3122
and sorry for the, uhm... minor delay ;)

comment:4 by digitall, 13 months ago

Component: Port: Wii
Note: See TracTickets for help on using tickets.