1 | 1. Problem description:
|
---|
2 |
|
---|
3 | Some Humogonous scumm games don't show the ingame cursor on the wii port of scummvm.
|
---|
4 | This happens with the stable 1.2.0 build and also with the svn builds.
|
---|
5 |
|
---|
6 | 2. Cause of problem:
|
---|
7 |
|
---|
8 | The Wii port has the separate cursor palette enabled.
|
---|
9 | The _cursorPalette is used as a buffer.
|
---|
10 | When the system switches to the _texMouse.palette (setCursorPalette) and the _cursorPaletteDisabled == true,
|
---|
11 | than the _texMouse.palette is copied to the _cursorPalette.
|
---|
12 | The disableCursorPalette function copies the _cursorPalette back to to the _texMouse.palette when the cursor
|
---|
13 | palette is disabled.
|
---|
14 |
|
---|
15 | I did some loggings of the functions and there appearance during the startup of a humogonous game:
|
---|
16 |
|
---|
17 | =~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2010.11.26 10:28:09 =~=~=~=~=~=~=~=~=~=~=~=
|
---|
18 | startup as 'scummvm_stripped.dol'
|
---|
19 | chdir to default
|
---|
20 | initSize 320*200*8 (000 -> 000 match: 1)
|
---|
21 | window caption: ScummVM 1.3.0svn (Nov 26 2010 10:26:51)
|
---|
22 | switching to palette based cursor
|
---|
23 | setCursorPalette with _cusorPaletteDisabled = TRUE
|
---|
24 | disabling cursor palette
|
---|
25 | User picked target 'PuttTime-nl-1' (gameid 'putttime')...
|
---|
26 | Looking for a plugin supporting this gameid... SCUMM Engine [all games]
|
---|
27 | Starting 'Putt-Putt Travels Through Time'
|
---|
28 | disabling cursor palette
|
---|
29 | window caption: Putt-Putt Travels Through Time (Dutch)
|
---|
30 | switchVideoMode 0
|
---|
31 | initSize 640*480*8 (000 -> 000 match: 1)
|
---|
32 | enabling cursor palette
|
---|
33 | setCursorPalette with _cusorPaletteDisabled = FALSE
|
---|
34 | disabling cursor palette
|
---|
35 | Set palette
|
---|
36 | disabling cursor palette
|
---|
37 | Set palette
|
---|
38 | Set palette
|
---|
39 | disabling cursor palette
|
---|
40 | Set palette
|
---|
41 | Set palette
|
---|
42 | disabling cursor palette
|
---|
43 | Set palette
|
---|
44 | Set palette
|
---|
45 | Set palette
|
---|
46 | Set palette
|
---|
47 | Set palette
|
---|
48 | Set palette
|
---|
49 | Set palette
|
---|
50 | Set palette
|
---|
51 | Set palette
|
---|
52 | Set palette
|
---|
53 | disabling cursor palette
|
---|
54 | disabling cursor palette
|
---|
55 | ...
|
---|
56 |
|
---|
57 |
|
---|
58 | As you can see, the cursor palette is enabled before the actual colors are set with the setCursorPalette.
|
---|
59 | Due to that issue, the _cursorPalette isn't updated in the SetCursorPalette function.
|
---|
60 |
|
---|
61 | 3. My solution:
|
---|
62 |
|
---|
63 | The _cursorPalette is suposed to have the same entries as the normal in game palette.(In a different format)
|
---|
64 | So, I changed the SetPalette function a little:
|
---|
65 |
|
---|
66 |
|
---|
67 |
|
---|
68 | osystem_gfx.cpp:
|
---|
69 |
|
---|
70 |
|
---|
71 | void OSystem_Wii::setPalette(const byte *colors, uint start, uint num) {
|
---|
72 | #ifdef USE_RGB_COLOR
|
---|
73 | assert(_pfGame.bytesPerPixel == 1);
|
---|
74 | #endif
|
---|
75 |
|
---|
76 | const byte *s = colors;
|
---|
77 | u16 *d = _texGame.palette;
|
---|
78 |
|
---|
79 | for (uint i = 0; i < num; ++i) {
|
---|
80 | d[start + i] = Graphics::RGBToColor<Graphics::ColorMasks<565> >(s[0], s[1], s[2]);
|
---|
81 | s += 4;
|
---|
82 | }
|
---|
83 |
|
---|
84 | gfx_tex_flush_palette(&_texGame);
|
---|
85 |
|
---|
86 | // Obcd
|
---|
87 | /* this background cursor palette should always be equal to the game screen palette */
|
---|
88 | s = colors;
|
---|
89 | d = _cursorPalette;
|
---|
90 | for (uint i = 0; i < num; ++i) {
|
---|
91 | d[start + i] = Graphics::ARGBToColor<Graphics::ColorMasks<3444> >(0xff, s[0], s[1], s[2]);
|
---|
92 | s += 4;
|
---|
93 | }
|
---|
94 | if (_cursorPaletteDisabled) //There should be a direct reflection to the current showed cursor
|
---|
95 | {
|
---|
96 | assert(_texMouse.palette);
|
---|
97 | u16*f = _cursorPalette;
|
---|
98 | d = _texMouse.palette;
|
---|
99 | memcpy(d + start, f + start, num * 2);
|
---|
100 | _cursorPaletteDirty = true;
|
---|
101 | }
|
---|
102 | /*
|
---|
103 |
|
---|
104 | if (_cursorPaletteDisabled) {
|
---|
105 | assert(_texMouse.palette);
|
---|
106 |
|
---|
107 | s = colors;
|
---|
108 | d = _texMouse.palette;
|
---|
109 |
|
---|
110 | for (uint i = 0; i < num; ++i) {
|
---|
111 | d[start + i] = Graphics::ARGBToColor<Graphics::ColorMasks<3444> >(0xff, s[0], s[1], s[2]);
|
---|
112 | s += 4;
|
---|
113 | }
|
---|
114 |
|
---|
115 | _cursorPaletteDirty = true;
|
---|
116 | }
|
---|
117 | */
|
---|
118 | }
|
---|
119 |
|
---|
120 | It seemed like the most logical place to do things....
|
---|
121 |
|
---|
122 | regards. |
---|