Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
180 user(s) are online (118 user(s) are browsing Forums)

Members: 1
Guests: 179

emeck, more...

Headlines

 
  Register To Post  

DSI error: P96SA_Colors32 :-(
Home away from home
Home away from home


See User information
This code does not work, it crashes, when p96OpenScreenTag() tries to read the palette.
how do I fix this?

GetScreenAttr() works fine i get colors, and returns ok.


ULONG palette[1+(255*3)];
 
struct Screen *wbscreen;

 if (! 
IP96) return FALSE;

 
// Check if the mode is one we can handle
 
uint32 depth p96GetModeIDAttr(mode_idP96IDA_DEPTH);
 
uint32 format p96GetModeIDAttr(mode_idP96IDA_RGBFORMAT);


 
// Yes, get width and height
 
ScreenWidth p96GetModeIDAttr(mode_idP96IDA_WIDTH);
 
ScreenHeight p96GetModeIDAttr(mode_idP96IDA_HEIGHT);

 
palette[0]=(255<<16); // number of colors to get
 
palette[0]+=0;  // first color.

 
if (wbscreen LockPubScreen("Workbench"))
 {
  if (
GetScreenAttrwbscreen SA_Colors32, &palettesizeof(palette) ))
  {
   
printf("default palette found\n");
  }
  else
  {
   
printf("default palette NOT found\n");
  }
  
  
UnlockScreen(wbscreen);
 }

 
printf("Colors: %d\n",palette[0]>>16);
 
printf("First color: %d\n",palette[0] & 0xFFFF );

 
// Open screen
 
the_screen p96OpenScreenTags(
  
P96SA_Colors32, &palette,
  
P96SA_DisplayIDmode_id,

  
P96SA_QuietTRUE,
//  P96SA_NoMemory, TRUE,
  
P96SA_NoSpriteFALSE,
  
P96SA_ExclusiveTRUE,

  
TAG_END
 
);

 if (!
the_screen) return FALSE;

(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top
Re: DSI error: P96SA_Colors32 :-(
Just can't stay away
Just can't stay away


See User information
@LiveForIt

EDIT: uh never mind. Need to make some coffee.

Go to top
Re: DSI error: P96SA_Colors32 :-(
Not too shy to talk
Not too shy to talk


See User information
@LiveForIt

ULONG palette[1+(255*3)];

 
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

 
palette[1+3*255] = 0;  // no more colors.


Bye,
Thomas

Go to top
Re: DSI error: P96SA_Colors32 :-(
Home away from home
Home away from home


See User information
@thomas

Thanks this cured the problem

palette[1+3*255] = 0; // no more colors.

now this does not work?


if (wbscreen LockPubScreen("Workbench"))
 {
    if (
GetScreenAttrwbscreen SA_Colors32, &palettesizeof(palette) ))
    {
       
printf("default palette found\n");
    }
    else
    {
       
printf("default palette NOT found\n");
    }
  
    
UnlockScreen(wbscreen);
 }


(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top
Re: DSI error: P96SA_Colors32 :-(
Not too shy to talk
Not too shy to talk


See User information
@LiveForIt

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.

Go to top
Re: DSI error: P96SA_Colors32 :-(
Not too shy to talk
Not too shy to talk


See User information
@LiveForIt

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 !

Go to top
Re: DSI error: P96SA_Colors32 :-(
Home away from home
Home away from home


See User information
@corto

can't get this line working.

GetScreenAttr( wbscreen , SA_Colors32, &palette, sizeof(palette) );

Returns whit out success.

(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top
Re: DSI error: P96SA_Colors32 :-(
Home away from home
Home away from home


See User information
@xeron

ok, it works thanks

(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2023 The XOOPS Project