 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
PosX100
Joined: 15 Aug 2007 Posts: 98
|
Posted: Fri Mar 21, 2008 3:22 am Post subject: Sdl application not starting (error code : 8002013C) |
|
|
What title says.
This is the first time that an application not starting.
I've been searching on forums for more than a hour, but i couldn't find a solution.
CFW : 3.71 m33-4 (kernel : 1.5)
My code:
| Code: |
#include <SDL/SDL.h>
#include <pspkernel.h>
#include <pspctrl.h>
#include <pspdebug.h>
//#include <pspaudio.h>
//#include <pspaudiolib.h>
#include <pspdisplay.h>
#include <psppower.h>
PSP_MODULE_INFO("SDLtest 1", 0x0, 1, 1);
PSP_HEAP_SIZE_MAX();//PSP_HEAP_SIZE_KB(-1);
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER);
PSP_MAIN_THREAD_STACK_SIZE_KB(32);
/* Exit callback */
int exit_callback(int arg1, int arg2, void *common) {
sceKernelExitGame();
return 0;
}
/* Callback thread */
int CallbackThread(SceSize args, void *argp) {
int cbid;
cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();
return 0;
}
/* Sets up the callback thread and returns its thread id */
int SetupCallbacks(void) {
int thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
if(thid >= 0) {
sceKernelStartThread(thid, 0, 0);
}
return thid;
}
int main()//(int argc, char *argv[])
{
SetupCallbacks();
scePowerSetClockFrequency(333, 333, 166);
pspDebugScreenInit();
pspDebugScreenSetBackColor(0xFFFFFFFF);
pspDebugScreenSetTextColor(0);
pspDebugScreenClear();
pspDebugScreenPrintf("HELLO...\n");
atexit(SDL_Quit);
pspDebugScreenPrintf("INIT :%d\n",SDL_Init(SDL_INIT_VIDEO));
SDL_ShowCursor(0);
SDL_Surface* screen=NULL;
screen=SDL_SetVideoMode( 480, 272, 32, SDL_HWSURFACE|SDL_DOUBLEBUF);
pspDebugScreenPrintf("SCREEN : %d \n",(screen!=NULL));
SDL_Surface* img=loadImage("bg.bmp");
pspDebugScreenPrintf("IMG: %d \n",(img!=NULL));
bool running=true;
SDL_Event se;
while(running)
{
while(SDL_PollEvent(&se))
{
switch(se.type)
{
case SDL_QUIT : {running=false;break;}
}
}
SDL_FillRect(screen,NULL,SDL_MapRGB(screen->format,0,0,0));
if(img)renderSurface(0,0,img,screen);
if(screen)refreshSurface(screen);
}
SDL_FreeSurface(screen);screen=NULL;
SDL_FreeSurface(img);img=NULL;
SDL_Quit();
return 0;
}
|
The most weird thing is , that the application doesn't even print debug messages. |
|
| Back to top |
|
 |
PosX100
Joined: 15 Aug 2007 Posts: 98
|
Posted: Sat Mar 22, 2008 3:47 pm Post subject: Re: Sdl application not starting (error code : 8002013C) |
|
|
| Argh...all i had to do was to set heap size > 20480 ...im retard ..T_T.. |
|
| Back to top |
|
 |
danzel
Joined: 04 Nov 2005 Posts: 182
|
Posted: Sat Mar 22, 2008 11:38 pm Post subject: |
|
|
So you changed PSP_HEAP_SIZE_MAX(); to something like PSP_HEAP_SIZE_KB(20*1024); ?
I noticed this with my SDL app also, I thought it was one of the weird memory initialization things I had done. Interested to know why this happens. |
|
| Back to top |
|
 |
Insert_witty_name
Joined: 10 May 2006 Posts: 376
|
Posted: Sun Mar 23, 2008 12:02 am Post subject: |
|
|
PSP_HEAP_SIZE_MAX() failed on one of my apps too (non SDL).
From the little testing I did, it looks like threads can't be created as there is no memory available.
This probably extends further than threads too. |
|
| Back to top |
|
 |
TyRaNiD
Joined: 18 Jan 2004 Posts: 918
|
Posted: Sun Mar 23, 2008 2:04 am Post subject: |
|
|
| Indeed it will, if there is no memory for the thread stack it will not work at all. This whole use all memory crap was probably a bad idea to begin with ;) |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Sun Mar 23, 2008 4:41 am Post subject: |
|
|
Well, what we need is a way to allocate all memory minus a certain amount. For example, you normally want all memory for the main thread, minus a small amount for any other threads (if there are any). This means that currently devs have to guess the amount by trying values until the program fails. It would be nice if we could specify something like _MAX(-1024); where that gives the main heap all the memory minus one megabyte. That would really be handy for programs targetting the phat and slim since you currently have to either use one value for both (wasting slim memory), or two separate versions of the program with two different heap sizes.
EDIT: Or another idea is a set of memory allocators that work on memory NOT in the main heap. Creating heaps is so MacOS 6 anyway. :P :) |
|
| Back to top |
|
 |
PosX100
Joined: 15 Aug 2007 Posts: 98
|
Posted: Sun Mar 23, 2008 7:09 pm Post subject: |
|
|
| danzel wrote: | So you changed PSP_HEAP_SIZE_MAX(); to something like PSP_HEAP_SIZE_KB(20*1024); ?
I noticed this with my SDL app also, I thought it was one of the weird memory initialization things I had done. Interested to know why this happens. |
Yep, thats what i did.
By the way...how does the memory allocation works?
It allocates a big buffer for just one application?
Because , if thats the case , (even if im not pro or something) it sounds
weird.
OS doesn't handle memory allocation/deallocation requests?? |
|
| Back to top |
|
 |
|
|
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
|