a few questions about programming the ps2

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
ubergeek42
Posts: 83
Joined: Wed Jul 13, 2005 12:25 am

a few questions about programming the ps2

Post by ubergeek42 »

is there an easy way to find out where the elf file is running from(like its exact path)?(or can a file be loaded relative to the elfs path?)
i noticed that i don't need the memory card modules loaded to load a file from the memory card? does this also apply to the cd drive? hdd?(pretty sure i need a module for that one)

also i was looking through the memory card example code, and it seems to me that there are a 2 different kinds of modules i can load? when i tried to use the X prefixed modules, they loaded, but the call to mcInit(MC_TYPE_XMC) fails. this works fine with the normal mc modules.

same thing goes for the pad example, if i define NEW_PADMAN, the modules load, but it doesn't get further then that. but it works fine if i simple use ROM_PADMAN.

so i guess im trying to ask what the difference between the modules is.

also, ive got a small question about gsKit, how come
gsGlobal->PSM = GS_PSM_CT32;
has to be defined in order to change the background color? this isn't defined in the font example, but the call to clearscreen still gets called and a color is passed, even though this color has no effect on the cleared color.(or am i doing something wrong?)

ok looks like ive got one last question, doe the gsKit_scale function apply to fonts? could you give me an example of how to use this? im not sure i fully understand the last parameter

thanks in advance for the help.
radad
Posts: 246
Joined: Wed May 19, 2004 4:54 pm
Location: Melbourne, Australia

Post by radad »

To find out where the elf is launched from you can look at arg 0 passed into main. Just like on the PC it is the full path of the elf file.

You probably didn't need to load the memory card module to load files from the memory card because the program you used to load your elf already loaded them.

The problem with trying to load the X version of the modules is probably because the non X version is already loaded. You can't load both.

What you need to do is to flush out the existing modules at the start of your program and reload the ones you want. Have a look at the ResetIOP stuff.
User avatar
Drakonite
Site Admin
Posts: 990
Joined: Sat Jan 17, 2004 1:30 am
Contact:

Post by Drakonite »

Like radad said, argv is where to get your path info from. However keep in mind that some of the rarer boot methods (i.e. reload1) won't give sensible information. There are all sorts of crap in ps2link dealing with that... Just beware to check the info given to make sure it looks valid, and should probably have a default to fall back on in most cases...

Again, like radad said chances are the non-X versions are already loaded and causing problems. You can reset the IOP and reload everything, but this carries with it a host of problems. (If you reset the IOP it kills ps2link, which makes debugging apps with ps2link that reset IOP near impossible) I put quite a bit of work recently into getting ps2link to not use modules with X counter parts to make it possible to debug them with it.

There are other problems with X modules, such as they are not present on older PS2s, and not all libs are compatible (libpadx needs to be used instead of libpad for instance).

If you don't even know what the differences are, you really shouldn't be using the X modules... Just stick with the non-X versions unless you need support for something only the X modules can provide.

gsKit_scale is depricated IIRC. If you get the newest svn of gsKit there are TONS of changes (and improvements) since the last release.
(or am i doing something wrong?)
You are probably doing something wrong, but since none of us can see your source even if we wanted to there is nothing we can say about it.
Shoot Pixels Not People!
Makeshift Development
User avatar
Drakonite
Site Admin
Posts: 990
Joined: Sat Jan 17, 2004 1:30 am
Contact:

Post by Drakonite »

Whao, just noticed you were talking about NEW_PADMAN and ROM_PADMAN... sounds like you are using some old stuff? ... make sure you are using the newest ps2sdk. No guarentee anyone can/will help you if you aren't ;)
Shoot Pixels Not People!
Makeshift Development
ubergeek42
Posts: 83
Joined: Wed Jul 13, 2005 12:25 am

Post by ubergeek42 »

ok i just checked out the latest ps2sdk, and there are still refrences to NEW_PADMAN and ROM_PADMAN in the pad sample,

http://svn.ps2dev.org/filedetails.php?r ... rev=0&sc=0

or should i be looking at the padx folder that exists?(i noticed that folder exists in the ps2sdk source, but it doesn't have samples to go with it)

thanks for the heads up on the new gskit, checked it out and compiled it. ok now ive got a new question, if gskit_scale is depreciated, how would i change the size of a font that i want to put on the screen?

<EDIT>
(ok well from that checkout arises a new problem, the "basic" sample program works, but only for about 4-5 seconds, then the 2 transparent objects begin flashing?, this was after switching the code to ntsc(to match my console). the sample code is here:http://svn.ps2dev.org/filedetails.php?r ... rev=0&sc=0)

is there a list of things somewhere that tell me what i need to change to get my old code compiling correctly? i already discovered that i need to call the queueexec function, but it seems to me like what i am drawing(moving squares), the screen doesn't seem likes its being cleared each time, as the squares are leaving a trail behind them.

<END EDIT>

and how would i go about making my own font(.fnt) file?

<EDIT: THIS IS NO LONGER A PROBLEM SINCE UPDATING MY GSKIT>
also when i was asking about doing something wrong i was using the font example code, which is found here:
http://svn.ps2dev.org/filedetails.php?r ... rev=0&sc=0
all i tried to do was change the color passed to the clear function to one of the other defined colors, but it didn't do anything untill i added that one line of code i specified above. But since i was using an old gskit, i think that may have been that problem.

<END EDIT>

thanks for the help guys.
User avatar
Drakonite
Site Admin
Posts: 990
Joined: Sat Jan 17, 2004 1:30 am
Contact:

Post by Drakonite »

Ok, sorry. There used to be references to NEW_PADMAN and ROM_PADMAN in the libs as well...

Why is it you are wanting to use XPADMAN ? I would strongly recommend against it unless something you are doing requires it, which I doubt you are.
Shoot Pixels Not People!
Makeshift Development
ubergeek42
Posts: 83
Joined: Wed Jul 13, 2005 12:25 am

Post by ubergeek42 »

i was more curious as to what more it offered over the normal ones, but its apparently not worth using, at this time.
User avatar
Drakonite
Site Admin
Posts: 990
Joined: Sat Jan 17, 2004 1:30 am
Contact:

Post by Drakonite »

XPADMAN and friends are required as part of the recipe for mtap support, but other than that, AFAIK there is no reason to use XPADMAN
Shoot Pixels Not People!
Makeshift Development
Post Reply