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 

How to port homebrew form 1.5 to run on 3.x

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



Joined: 16 Dec 2006
Posts: 11

PostPosted: Thu Dec 27, 2007 5:54 pm    Post subject: How to port homebrew form 1.5 to run on 3.x Reply with quote

I am trying to port my homebrew from 1.5 to run in 3.x custom firmware. I follow the method of CpuWhiz on this thread (http://forums.ps2dev.org/viewtopic.php?p=59285&sid=a421ca097c5c1ad8221d2c96f9268c1e)
- Add this 2 line into make file before include..
BUILD_PRX = 1
PSP_FW_VERSION = 371
- use only user mode in main
PSP_MODULE_INFO("My Homebrew", 0, 1, 0);
PSP_HEAP_SIZE_KB(20480);
- bring the EBOOT.PBP to run in 3.x
dont use kxploit or % folder

But it doesn't work for me.
After start my homebrew, i got error message
"The game could not be started" 80020148

Is there another thing to do to compile my source to run for 3.x version? or i miss something
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Thu Dec 27, 2007 8:14 pm    Post subject: Reply with quote

Make sure to use the USER thread attribute in main as well, and get rid of any kernel level calls. Calls that can only be made from kernel mode have to be moved into an external prx as shown in a number of threads in this forum.
Back to top
View user's profile Send private message AIM Address
cp25stack



Joined: 16 Dec 2006
Posts: 11

PostPosted: Thu Dec 27, 2007 8:49 pm    Post subject: Reply with quote

ok
i am just a stupid one...

So,these are all the kernel thread that cant use in 3.xx isn't it
sceKernelExitGame()
sceKernelCreateCallback
sceKernelRegisterExitCallback
sceKernelSleepThreadCB
sceKernelStartThread

but if it yes,
shouldn't it give me an error number 0x8002013C isn't it?
however i should know that those function is kernel call. T T
Back to top
View user's profile Send private message
cp25stack



Joined: 16 Dec 2006
Posts: 11

PostPosted: Thu Dec 27, 2007 10:49 pm    Post subject: Reply with quote

?
even i try to build this simplest hello world program
it still give me the same error code
(copy form ZX)

Does anyone have idea what happen?
i feel like that it should be something wrong...

main.c
==============================================
#include <pspdebug.h>
#include <pspsdk.h>

PSP_MODULE_INFO("MyNameIs", 0x0, 1, 1);
PSP_MAIN_THREAD_ATTR(0);

int
main(int argc, char *argv[])
{
return 0;
}
==============================================

makefile
==============================================
TARGET = MyNameIsFW3x
OBJS = main.o

INCDIR =
CFLAGS = -O2 -G0 -Wall


CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

BUILD_PRX=1
PSP_FW_VERSION=340

LIBDIR =
LDFLAGS =

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = MyNameIsFW3x

PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
==============================================
Back to top
View user's profile Send private message
cp25stack



Joined: 16 Dec 2006
Posts: 11

PostPosted: Fri Dec 28, 2007 12:15 am    Post subject: Reply with quote

errkk

Finally, i can build hello world to run on 3.xx CFW.
from above code, i just trun off these two lines.

BUILD_PRX=1
PSP_FW_VERSION=340

I know it may sound strange to the way we understand
that we should set BUILD_PRX to be on...
But may be it is my toolchain that has some strange setting. dont know? :(
Back to top
View user's profile Send private message
jas0nuk



Joined: 27 Apr 2006
Posts: 137

PostPosted: Fri Dec 28, 2007 10:48 am    Post subject: Reply with quote

Well, removing BUILD_PRX is compiling it as a static user ELF, which is working because the firmware is patched to accept those. You probably didn't port it well enough to work as a PRX :P
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Fri Dec 28, 2007 12:34 pm    Post subject: Reply with quote

You really haven't looked at ANY of the sample code, have you? Look at any 3.xx app and you'll see this line in main:

Code:
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER);


3.xx REQUIRES the app to be user mode.

BUILD_PRX=1 is needed if you plan to load external prx libraries which do kernel mode calls. Otherwise, you don't need that.
Back to top
View user's profile Send private message AIM Address
dot_blank



Joined: 28 Sep 2005
Posts: 498
Location: Brasil

PostPosted: Fri Dec 28, 2007 12:45 pm    Post subject: Reply with quote

PSP_HEAP_SIZE_KB(20480); // too much heap
_________________
10011011 00101010 11010111 10001001 10111010
Back to top
View user's profile Send private message
cp25stack



Joined: 16 Dec 2006
Posts: 11

PostPosted: Sat Dec 29, 2007 12:06 am    Post subject: Reply with quote

Hi
At first, i accepted that didn't look at any of sample code for 3.xx before.
(because i can't fine anyone at that time)
The only one clue that i found is the link in the first post that CpuWhiz
describe about how to port code from 1.5 to 3.x.
As i can understand it is only use usermode in PSP_MODULE_INFO()
and set BUILD_PRX = 1 in make file.
not thing mention about PSP_MAIN_THREAD_ATTR.

Then after many fail to run, i can found the hello world demo for 3.x
(from zx as i post in the secone post, but i change it a littlebit).
But it doesn't work for me too until i remove the line "BUILD_PRX=1".
I dont know what to say that why just those 3-4 lines of code cannot work?
(It has both PSP_MAIN_THREAD_ATTR = user and BUILD_PRX=1 already)

So if it possible, can anyone please give a link or demo of helloworld with makefile
that can suddenly+instant build and run on 3.x please.

PS. for hornesty, i didn't want to blame anyone.I just want to find out the mystery that i found. :)
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sat Dec 29, 2007 5:05 pm    Post subject: Reply with quote

There are a BUNCH of threads in this forum on doing 3.xx homebrew. If you would bother to use search and read old threads, you wouldn't need to start yet another thread on this.
Back to top
View user's profile Send private message AIM Address
cp25stack



Joined: 16 Dec 2006
Posts: 11

PostPosted: Sun Dec 30, 2007 2:09 pm    Post subject: Reply with quote

Ah.. i should know that requesting for something too easy is not
proper in the professional board like this.
But what is the point of the replies like...
"didn't you never read any code, have you try to search?"
It seems like just reply without read the previous posts, situation :(


back to the topic
At first the thread that i had found tell me that..
(http://forums.ps2dev.org/viewtopic.php?p=59285&sid=a421ca097c5c1ad8221d2c96f9268c1e)
==============================================
"3.xx firmwares require your homebrew be in prx format. To get your homebrew in this format, you need to follow a few basic steps:...."
==============================================
It clear to me that i must set BUILD_PRX to 1.
But now J.F. said..
==============================================
"BUILD_PRX=1 is needed if you plan to load external prx libraries which do kernel mode calls. Otherwise, you don't need that."
==============================================
Those info seem to be conflict.
However, as the result of my trial and error, it seems the the later info is right.

Should anyone go back to post/edit that info into the above thread.
I think that is the popular one that can found easily when search about this topic.
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sun Dec 30, 2007 3:51 pm    Post subject: Reply with quote

cp25stack wrote:
Ah.. i should know that requesting for something too easy is not
proper in the professional board like this.
But what is the point of the replies like...
"didn't you never read any code, have you try to search?"
It seems like just reply without read the previous posts, situation :(


back to the topic
At first the thread that i had found tell me that..
(http://forums.ps2dev.org/viewtopic.php?p=59285&sid=a421ca097c5c1ad8221d2c96f9268c1e)
==============================================
"3.xx firmwares require your homebrew be in prx format. To get your homebrew in this format, you need to follow a few basic steps:...."
==============================================
It clear to me that i must set BUILD_PRX to 1.
But now J.F. said..
==============================================
"BUILD_PRX=1 is needed if you plan to load external prx libraries which do kernel mode calls. Otherwise, you don't need that."
==============================================
Those info seem to be conflict.
However, as the result of my trial and error, it seems the the later info is right.

Should anyone go back to post/edit that info into the above thread.
I think that is the popular one that can found easily when search about this topic.


There's no conflict there. While you CAN get away with not using BUILD_PRX=1 by not loading any external kernel mode prxs, the program will still work with it anyway. You were looking at one very general summary in that thread. There are other threads on 3.xx programming that provide sample code and makefiles and such. You seem to have stopped looking after finding a single thread. Please read AS MANY old threads as possible. Some threads have been superseded by others with newer/better info. It's rare that threads get edited - instead, you are expected to find newer posts/threads with the correct info. Other threads will have MORE info, such as examples.
Back to top
View user's profile Send private message AIM Address
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