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

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

Moderators: cheriff, TyRaNiD

Post Reply
cp25stack
Posts: 11
Joined: Sat Dec 16, 2006 3:52 pm

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

Post by cp25stack »

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? ... 96f9268c1e)
- 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
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

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.
cp25stack
Posts: 11
Joined: Sat Dec 16, 2006 3:52 pm

Post by cp25stack »

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
cp25stack
Posts: 11
Joined: Sat Dec 16, 2006 3:52 pm

Post by cp25stack »

?
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
==============================================
cp25stack
Posts: 11
Joined: Sat Dec 16, 2006 3:52 pm

Post by cp25stack »

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? :(
jas0nuk
Posts: 137
Joined: Thu Apr 27, 2006 8:00 am

Post by jas0nuk »

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
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

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: Select all

PSP_MAIN_THREAD_ATTR&#40;PSP_THREAD_ATTR_USER&#41;;
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.
User avatar
dot_blank
Posts: 498
Joined: Wed Sep 28, 2005 8:47 am
Location: Brasil

Post by dot_blank »

PSP_HEAP_SIZE_KB(20480); // too much heap
10011011 00101010 11010111 10001001 10111010
cp25stack
Posts: 11
Joined: Sat Dec 16, 2006 3:52 pm

Post by cp25stack »

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. :)
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

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.
cp25stack
Posts: 11
Joined: Sat Dec 16, 2006 3:52 pm

Post by cp25stack »

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? ... 96f9268c1e)
==============================================
"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.
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

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? ... 96f9268c1e)
==============================================
"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.
Post Reply