forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Slim extra memory Question

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Wed Sep 30, 2009 11:22 am    Post subject: Slim extra memory Question Reply with quote

Hi,
If you set the extra memory flag in the make file to use the slim RAM,
will the program fail to load on a PSP1000 straight away even if the extra RAM was not used?

If not, when will the program fail to load on a PSP1000... when a 40Mb array is defined, or when you go to use it?
_________________
If not actually, then potentially.
Back to top
View user's profile Send private message
Salvy



Joined: 30 Jun 2009
Posts: 9

PostPosted: Wed Sep 30, 2009 1:40 pm    Post subject: Reply with quote

You could take a look at Daedalusx64 source.
J.F did a great job enabling Slim extra RAM and such without breaking any phat functionality.
Back to top
View user's profile Send private message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Wed Sep 30, 2009 3:23 pm    Post subject: Reply with quote

It will work fine on both. The only thing that changes is the amount of memory you can allocate dynamically. Mallocs will simple fail after there is no more free memory.

Since malloc uses the heap defined at compile time, you should use a negative value such as PSP_HEAP_SIZE_KB(-1024) instead of a hardcoded value. So you'll have 23MiB on Phat and 55MiB on the Slim with 1MiB for stacks etc in either case.

Or you could not use that heap at all and create one to use at runtime with the sce* functions after detecting Phat or Slim. Since extra memory isn't hardful, just use the PSP_HEAP_SIZE_KB method and allocate extra in your code depending on the model.

If you declare the 40MiB array at compile time then it will obviously fail on the Phat since 40MiB is statically allocated. The program will not work at all. If you have a pointer to the array, then only the 40MiB malloc will fail but you can handle the error.
Back to top
View user's profile Send private message
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Thu Oct 01, 2009 2:16 pm    Post subject: Reply with quote

Thanks for that.. helpful since I still don't plan on getting one.
_________________
If not actually, then potentially.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group