[Claritin Clear!] Importing Vars from export modules

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
KickinAezz
Posts: 328
Joined: Sun Jun 03, 2007 10:05 pm

[Claritin Clear!] Importing Vars from export modules

Post by KickinAezz »

What would I use in place of IMPORT_FUNC?

Checked pspimport.s, it only lets you import functions...

EDIT 1:
======
Will using libsFindExportAddrByNid to find the real address and creating a pointer to it work?
Last edited by KickinAezz on Mon Sep 17, 2007 8:57 am, edited 8 times in total.
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

As I understand it, you don't. Importing variables isn't supported right now. The way to handle that is to make accessor functions. If you have a variable called myDumbVar, access it by making functions like

Code: Select all

int GetMyDumbVar(void)
{
    return myDumbVar;
}

void SetMyDumbVar(int val)
{
    myDumbVar = val;
}
KickinAezz
Posts: 328
Joined: Sun Jun 03, 2007 10:05 pm

Post by KickinAezz »

I would definately do such basic things if it was my module.

but I was referring to FW modules like Vshmain, which happens to export one of its vars, which I am curious to play around with.
User avatar
dot_blank
Posts: 498
Joined: Wed Sep 28, 2005 8:47 am
Location: Brasil

Post by dot_blank »

but not supported in PSPSDK currently tho thats what he means
accesor functions is all you can do for now and there is no loss if you just inline the calls
10011011 00101010 11010111 10001001 10111010
KickinAezz
Posts: 328
Joined: Sun Jun 03, 2007 10:05 pm

Post by KickinAezz »

dot_blank wrote:but not supported in PSPSDK currently tho thats what he means
accesor functions is all you can do for now and there is no loss if you just inline the calls

oh! Hope to see some progress in future. Meanwhile,

[Q] Will that libsFind... func work? coz, it returns 0 as address.

[Q] And what did u mean by inline something?
Becz what u said wasnt clear.
KickinAezz
Posts: 328
Joined: Sun Jun 03, 2007 10:05 pm

Post by KickinAezz »

^above
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

As has been said a couple times now, you cannot import variables. It's just not in the SDK. For your OWN stuff, you use accessor functions and make them inline for no loss in speed (or very little loss). If you wish to add importing variables to the SDK, feel free.
KickinAezz
Posts: 328
Joined: Sun Jun 03, 2007 10:05 pm

Post by KickinAezz »

J.F. wrote:As has been said a couple times now, you cannot import variables. It's just not in the SDK. For your OWN stuff, you use accessor functions and make them inline for no loss in speed (or very little loss). If you wish to add importing variables to the SDK, feel free.
psss... :(
KickinAezz
Posts: 328
Joined: Sun Jun 03, 2007 10:05 pm

Post by KickinAezz »

1 last thing, wont that function work either?

and I ve asked this several times too. No one specifically said anything.
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

It isn't strictly a simple change to the SDK it requires slightly more complex changes to the actual toolchain. From what I recall an import entry for variables contains a list of fixups for the use in the code to point to the correct data. You might be able to get a lazy implementation by hard coding a single pointer reference but that is kinda nasty.

But yah feel free :P
KickinAezz
Posts: 328
Joined: Sun Jun 03, 2007 10:05 pm

Post by KickinAezz »

TyRaNiD wrote: You might be able to get a lazy implementation by hard coding a single pointer reference but that is kinda nasty.
But yah feel free :P

Last last thing. You dint actually say if it would work. [ but why? ]. I am afraid my effort is futile.
Let me know if it is suppozd to work. :)

Thanks.
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Well libs find probably wont work without modification only because it probably doesn't look for variables :) You _should_ be able to write something which does what you want it to in theory using similar code. Never found any of the variables anything exports to be obviously useful :)
Post Reply