ps2dev / ps2toolchain

This program will automatically build and install a compiler and other tools used in the creation of homebrew software for the Sony PlayStation® 2 videogame system.
BSD 2-Clause "Simplified" License
239 stars 73 forks source link

How do I use LoadElfFromFile or Partition? #97

Closed PS-2Online closed 2 years ago

PS-2Online commented 2 years ago

In elf-loader.h, there are some interesting functions to run elf files (I think?) Does anyone know how to properly use this? I put the patch declaration and the correct arguments but I had a problem with compiling. Everything worked fine until it said -elf-loader is not a library. I included the correct .h file and it began to compile, I included the -elf-loader in EE_LIBS but it says it cannot find the library. Is there something I did wrong? If not, is there an alternative to opening elf files that I can use. Thanks and God bless.

PS-2Online commented 2 years ago

All glory to God. Havs made progress. Found out how to make the load elf work. Just include -lelf-loader in make file! But now I have a new problem, what do I put with arguments?

PS-2Online commented 2 years ago

There is an argc which says to put number of arguments (no idea) and argv, pointer to array of arguments (no idea either.) PLEASE HELP. THANKS AND GOD BLESS. Note: I am trying to load from cdfs:/

PS-2Online commented 2 years ago

For anyone needing to load an elf from file it works but unfortunately not with cdfs... To use elf-loader, first, call LoadElfFromFile("mass:/SWBFRONT.ELF", 0, 0);

In your #include put

Next, go to your make file and in EE_LIBS add -lelf-loader

Finally run make on your program and watch some colors pop on your screen and play your game.

PS-2Online commented 2 years ago

Actually pretty simple. Wish this sdk had a bit better documentation for those of us that speak English and not 0's and 1's jk

PS-2Online commented 2 years ago

)

PS-2Online commented 2 years ago

)

terremoth commented 2 years ago

Actually pretty simple. Wish this sdk had a bit better documentation for those of us that speak English and not 0's and 1's jk

Yeah, I feel that. I wish I (and some other people) could help developing features to this whole SDK, but is far too big and too complex to understand alone, and have very (almost none) documentation of the things, neither some "how-to's" scenarios to learn. There are just some examples/samples folders, but some of them doesn't work properly, and some things work you don't know why it works. Hope one day they could make something like that for very beginners.

To develop some basic games/applications there are https://github.com/DanielSant0s/Enceladus (to make apps with Lua programming) and https://github.com/DanielSant0s/AthenaEnv (to make apps with JavaScript).

cosmito commented 2 years ago

Once I found this website (from @sp193 I believe) which hosts quite some insightful and useful information. Take a look at https://sites.google.com/view/ysai187/home/projects/initializing-the-ps2psx for example. Myself more than 10 years ago from trial and error and taking some snippets from examples, found a way to sucessfully initialize cdfs: so I could load files from my ELF and I made a small example. But at that time I didn't knew about Woon Yung's website, so pls have a look there first. My example might not even work with current sdk, but if you still need it I can try to dig it out.