PDA

View Full Version : Hires library issue


pitchou
04-14-2003, 06:33 AM
Hi all,

I'm trying to use the sony hires library :


UInt16 hrRefNum;
UInt32 width;
UInt32 height;
UInt32 depth;
Boolean enableColorP;
Err error;

width = hrWidth; height = hrHeight;
depth = 8; // (in color mode of 256 colors)
enableColorP = true;
SysLibLoad('libr', sonySysFileCHRLib, &hrRefNum);
SysLibFind(sonySysLibNameHR, &hrRefNum);

if (HROpen(hrRefNum)!=errNone)
FrmCustomAlert(AlertMsg, "erreur HR", "", "");
else
HRWinScreenMode(hrRefNum, winScreenModeSet, &width, &height, &depth, &enableColorP);



The library loads correctly, in can also close it, my source can be compiled (prc-tools) but when I launch the program (either on the simulator or on a "real" clié os5), I get an error :

I:\Snoopy\ARM\Core\Emul68K\Src\Emul68KCommon.c, Line:527, Odd address

Question 2, Sony sdk documentation refers to a "Vsk" lib, but it seems that I can't use it (then I use "Silk"). Vsk is supposed to be a v2, are you able to use it ?

Thanks for your help,

PitchOu

CliePet
04-14-2003, 10:52 AM
I don't think this is the problem, but your library check code is a little dubious

> SysLibLoad('libr', sonySysFileCHRLib, &hrRefNum);
> SysLibFind(sonySysLibNameHR, &hrRefNum);

it should be more like:
if (SysLibFind(sonySysLibNameHR, &hrRefNum) != 0 &&
SysLibLoad('libr', sonySysFileCHRLib, &hrRefNum) != 0)
{ report error - no HR Library }


Ie. don't call SysLibLoad unless SysLibFind fails.

------
re: odd address assert

Isolate to see if the call to HRWinScreenMode that is causing the problem

If so print out the addresses of the "width", "height", "depth" and "enableColorP" variables before the call.

If any of those are odd, then there is your problem (smells like a linker alignment error - but I don't use rpc-tools so I don't know how they do it)

----
re: Vsk / Silk

What model do you have (NX or NZ ?). I suspect an NX

The old Silk library is supported by the older (68K) CLIEs, like the NR70

The newer Vsk (virtual silk) library is supported by the newer Palm 5 OS models like the NZ, I don't know about the NX

If you want to be more general, you should handle both - the documentation tell you how to check for Vsk before Silk

pitchou
04-14-2003, 02:54 PM
>it should be more like:
>if (SysLibFind(sonySysLibNameHR, &hrRefNum) != 0 &&
>SysLibLoad('libr', sonySysFileCHRLib, &hrRefNum) != 0)
>{ report error - no HR Library }
>Ie. don't call SysLibLoad unless SysLibFind fails.

ok !

>Isolate to see if the call to HRWinScreenMode that is causing the problem
I'm now sure the problem comes from here ...

>If so print out the addresses of the "width", "height", "depth" and "enableColorP" variables before the call.


UInt32 width = 320;
UInt32 height = 320;
UInt32 depth =8;
char buffer[50];

and then

sprintf(&buffer[0], "width:%ld, height:%ld, depth:%ld", width, height, depth);
FrmCustomAlert(AlertMsg, &buffer[0], "", "");


the values are ok, but a call to HRWinScreenMode crashes the simulator :

HRWinScreenMode(hrRefNum, winScreenModeSet, &width, &height, &depth, &enableColorP);


(enableColorP is a Boolean and set to true)

I also tried to get the current screen parameters with winScreenModeGet, but the result (crash ...) is the same !

----
>re: Vsk / Silk

>What model do you have (NX or NZ ?). I suspect an NX

it's a nz90 :-))

>The old Silk library is supported by the older (68K) CLIEs, like the NR70
>The newer Vsk (virtual silk) library is supported by the newer Palm 5 OS models like the NZ, I don't know about the NX
>
>If you want to be more general, you should handle both - the documentation tell you how to check for Vsk before Silk


Actually when compiling, the compiler doesn't find any reference to any vsk function ....

Cheers,

PitchOu

CliePet
04-14-2003, 08:05 PM
> I'm trying to use the sony hires library : ...

Try using:

HRWinScreenMode(hrRefNum, winScreenModeSet, &width, &height, &depth, NULL);

// ignore last arg

If that doesn't work, try:
depth = 16;

These should work. If not I suspect something with the linkage specific to prc-tools (I use CodeWarrior and haven't seen these problems).

If it still doesn't work, email me the source code and I can try it out on CodeWarrior -- cliepet@aibohack.com

------
re: Vsk

This is a new Sony specific feature.
If you can't find 'VskSetState' in your SonySilkLib.h file, you have the old version.

You can download the lastest (Palm OS 5 compatible) set of Sony extensions from

http://www.us.sonypdadev.com/develop_tool/sdk_50.html