// Check if the mode is one we can handle uint32 depth = p96GetModeIDAttr(mode_id, P96IDA_DEPTH); uint32 format = p96GetModeIDAttr(mode_id, P96IDA_RGBFORMAT);
// Yes, get width and height ScreenWidth = p96GetModeIDAttr(mode_id, P96IDA_WIDTH); ScreenHeight = p96GetModeIDAttr(mode_id, P96IDA_HEIGHT);
palette[0]=(255<<16); // number of colors to get palette[0]+=0; // first color.
if (wbscreen = LockPubScreen("Workbench")) { if (GetScreenAttr( wbscreen , SA_Colors32, &palette, sizeof(palette) )) { printf("default palette found\n"); } else { printf("default palette NOT found\n"); }
palette[0]=(255<<16); // number of colors to get
palette[0]+=0; // first color.
This is not correct. The format for SA_Colors32 is
number of colors, first color, r, g ,b, ... number of colors, first color, r, g ,b, ... number of colors, first color, r, g ,b, ... until number of colors is 0.
So you are missing the trailing zero.
This should work:
ULONG palette[2+(255*3)];
palette[0]=(255<<16) | 0; // number of colors to get | first color
BTW, if you specify SA_LikeWorkbench, your screen will get the wb default palette anyway, and you can override any features of the WB you don't want with other tags.
You say that it does not work but could you explain what the problem is. Still a crash ?
I don't know but in the call to p96OpenScreenTags, I see "P96SA_Colors32, &palette". As "palette" is already the address of the array, I would write "P96SA_Colors32, palette". But maybe I am wrong, it's time to go to bed here !