PlayStation Portable (PSP) : Getting start develop game with NetBeans and devkitPSP



Why PSP?

        I'm interesting in console game development long time ago but MOST!! limitation not allow Thailand indie game developer to do such a thing like this, so when i got a chance to do, i'll do my best for make me close to a little my dream. If you were not interest in old-fashion of this Sony's device, just skip this tutorial. It's not useful for you and waste your time.

        Thanks an awesome man, here: http://forums.qj.net/psp-development-forum/81882-tutorial-setting-up-code-blocks-devkitpsp.html , this link really help me a lot for create game on psp, It's seem to be 100% possibility develop on latest version of NetBeans, PSP and Yosemite

Pre-require

        You need at least 2 images for display icon and background of game but i'm making 3 images. The third is optional for info.
- icon_80x80.png
- bg_480x272.png
- info_310x180.png  (optional)

You must download NetBeans and install from their instruction ( eg. C / C++ ).
http://netbeans.org/downloads/

And download devkitPSP compress file then extract file : e.g. devkitPSP_r16-1-osx.tar.bz2
https://sourceforge.net/projects/devkitpro/files/devkitPSP/

I'm not focus on pre-require, you can easy done install NetBeans and extract devkitPSP.


Setup NetBeans environment

        Launch NetBeans then goto NetBeans > Preferences..., Goto category "C / C++" and tab "Build Tools", under tool collection click to hilight "GNU". Click on "Duplicate..." the dialog will shows up, then just only rename on text field tool collection name: "GNU DevkitPSP" (this name not affective anything, so decide as what you want). Then click "OK". Click "GNU_DevkitPSP" and click "Default", then click "Apply". First, you need to modified "Base Directory:" but leave "/usr/bin", then click "$PATH" and add this line ";/Users/poraweeraksasin/Documents/devkitPSP/bin" (base on your devkitPSP path) after ${PATH} as below image and click "OK".

 [5.1 Modify Clean, Build, Compile Commands Path:]

[5.2 Modify Run Commands Path:]

        Next you need to modified as below detail with full path (the path base on your mac and where you place devkitPSP).

Base Directory: /usr/bin
C Compiler: /Users/poraweeraksasin/Documents/devkitPSP/bin/psp-gcc
C++ Compiler: /Users/poraweeraksasin/Documents/devkitPSP/bin/psp-g++
Fortran Compiler:  <blank>
Assembler: /Users/poraweeraksasin/Documents/devkitPSP/bin/psp-ar
Make Command: /usr/bin/make
Debugger Command: <blank>
QMake Command: <blank>
CMake Command: <blank>

Then click "Apply".


Create first Hello PSP project

        On NetBeans goto File > New Project..., On "Categories:" choose "C / C++" and "Projects:" choose "C / C++ Application" then click "Next >". Adjust project name and location as you want, for example my config as below.

Project Name: HelloPSP
Project Location: /Users/poraweeraksasin/NetbeansProjects
Project Folder: /Users/poraweeraksasin/NetbeansProjects/HelloPSP
Project Makefile Name: Makefile
[/] Create Main File: main C
Build Host: localhost
Tool Collection: Default_(GNU_DevkitPSP (GNU Mac))

Then click "Finish".


        Under Project HelloPSP > Source Files, double-click file "main.c" and write code as below.

[ start code ]

// Hello World - A simple "Hello World" Application.

#include <pspkernel.h>
#include <pspdebug.h>
#include <pspdisplay.h>

PSP_MODULE_INFO("Hello World", 0, 1, 1);

// Exit callback
int ExitCallback(int Arg1, int Arg2, void *Common)
{
    sceKernelExitGame();
    return 0;
}

// Callback thread
int CallbackThread(SceSize Args, void *Argp)
{
    int CallbackId;

    CallbackId = sceKernelCreateCallback("Exit Callback", ExitCallback, NULL);
    sceKernelRegisterExitCallback(CallbackId);

    sceKernelSleepThreadCB();

    return 0;
}

// Sets up the callback thread and returns its thread id
int SetupCallbacks(void)
{
    int ThreadId = 0;

    ThreadId = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
    if (ThreadId >= 0)
    {
        sceKernelStartThread(ThreadId, 0, 0);
    }

    return ThreadId;
}

int main(int argc, char ** argv)
{
    pspDebugScreenInit();
    SetupCallbacks();

    pspDebugScreenPrintf ("Hello PSP");
    sceDisplayWaitVblankStart();

    sceKernelSleepThread();

    return 0;
}

[ end - code ]

Config setting & Build

        Right-click on Project "HelloPSP > Properties", goto "Build > C Compiler" and click "..." after "Include Directories", then click "Add" and browse to your devkitPSP path as below.

/Users/poraweeraksasin/Documents/devkitPSP/include
/Users/poraweeraksasin/Documents/devkitPSP/psp/include
/Users/poraweeraksasin/Documents/devkitPSP/psp/sdk/include

Then click "OK" and click "Apply". Goto "Build > Linker" and click "..." after "Additional Library Directories", then click "Add" and browse to your devkitPSP path as below.

/Users/poraweeraksasin/Documents/devkitPSP/lib
/Users/poraweeraksasin/Documents/devkitPSP/psp/lib
/Users/poraweeraksasin/Documents/devkitPSP/psp/sdk/lib

Then click "OK" and click "Apply". You're stay at "Build > Linker" and click "..." after "Libraries", then click "Add Option..." then choose "Other Option" and fill textfield with below option.

-lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lpsplibc -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -lpsphttp -lpspssl -lpspgum -lpspgu -lm

Then click "OK"(Select Option dialog). Click "OK"(Debug - libraries dialog) and click "Apply".


        You're stay at "Build > Linker" and click "..." after "Output", then add ".elf" after your project name like sample below.

${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/hellopsp.elf

Then click "OK"(Debug - Output dialog) and click "Apply". Right-click on Project "HelloPSP > Build", wait a sec. then "BUILD SUCCESSFUL (total time: XXXms)", your first project build success. BTW along setting from 1 - 5, it's active only one mode "debug" or "release". So you need to do same thing twice both debug and release mode.


Create build script & Eboot

        I'm prepare graphics for create info of eboot, so you need to create dummy graphics refer to sample image below and put them together under "/Users/poraweeraksasin/NetBeansProjects/Eboot" folder. Open text editor (i'm using Sublime Text) and create new text file name "Eboot.sh" save to "/Users/poraweeraksasin/NetBeansProjects/Eboot" and type below code like this:

[ start code ]

#Create EBOOT file
#EBOOT.PBP PARAM.SFO icon0.png NULL NULL pic1.png NULL DATA.PSP NULL
echo "-- Create EBOOT --"
#!/bin/bash
# init
function pause(){
   read -p "$*"
}

DEV_KIT="/Users/poraweeraksasin/Documents/devkitPSP/bin"

PSP_MSKFO="mksfo"
PSP_FIX_IMPORT="psp-fixup-imports"
PSP_STRIP="psp-strip"
PSP_PACK="pack-pbp"

ELF_PATH="/Users/poraweeraksasin/NetBeansProjects/HelloPSP/dist/Debug/GNU_DevkitPSP-MacOSX"
ELF_NAME="hellopsp.elf"
TITLE_NAME="NetBeansPSP"
SFO_NAME="hellopsp.sfo"
ICON_PATH="/Users/poraweeraksasin/NetBeansProjects/Eboot/IC_80x80.png"
INF_IMG_PATH="/Users/poraweeraksasin/NetBeansProjects/Eboot/PV_310x180.png"
BG_PATH="/Users/poraweeraksasin/NetBeansProjects/Eboot/BG_480x272.png"

"$DEV_KIT"/${PSP_MSKFO} $TITLE_NAME $SFO_NAME
"$DEV_KIT"/${PSP_FIX_IMPORT} "$ELF_PATH"/${ELF_NAME}
"$DEV_KIT"/${PSP_STRIP} "$ELF_PATH"/${ELF_NAME} -o stripped.elf
"$DEV_KIT"/${PSP_PACK} "$ELF_PATH"/EBOOT.PBP $SFO_NAME $ICON_PATH NULL $INF_IMG_PATH $BG_PATH NULL stripped.elf NULL
rm $SFO_NAME
rm stripped.elf
pause 'Press [Enter] key to exit...'

[ end code ]


        Open Terminal and type: "cd /Users/poraweeraksasin/NetBeansProjects/Eboot" and press "Enter". Then type "sh Eboot.sh" and press "Enter", let's see your result.


Your "EBOOT.PBP" file was success created. Create new folder name "ANetBeansPSP"(decide name as you want) and copy "EBOOT.PBP" then paste into folder.



Install and Run on PSP

        PSP goto Settings > USB Connection, press "x", connect PSP via psp usb data cable to mac. Open drive from psp, copy folder "ANetBeansPSP" and paste into PSP/Game folder. Eject drive psp from mac, goto Game > Memory Stick, press "x" then see your result should be like this:


Test Environment
- Mac OS X Yosemite
- PlayStation Portable (PSP) E1000 **Need playable Eboots and CFW
- Memory Stick PRO Duo 32GB for PSP
- PSP USB Data Cable
- NetBeans 8.2
- devkitPSP r16-1

It's work :)
Credits:
http://forums.qj.net/psp-development-forum/81882-tutorial-setting-up-code-blocks-devkitpsp.html

Comments

  1. This is great! We need to revive older consoles! It's especially good to see that someone is working on a portable system! PC is running most of the show for in-home entertainment, but mobile is lacking. Sure we have smart phones, but its filled with bloatware. If we can take back these old portable consoles, be could have our freedom back!

    ReplyDelete
    Replies
    1. Wow seem you have an incredible thing on hands, right?, please share your awesome project when you're already. :)

      Delete
    2. I have been on and off debating on trying to revive old consoles, but kept getting busy with real life. But! I'm now righting a document to explain why we need this, and how this could become real.
      https://docs.google.com/document/d/13iOTdVqi1p4EiDj7BMDb3Jzdt_ZFfUnIBkT3HoydJyA/edit?usp=sharing

      Delete
    3. I'm really agree with your idea, then can you create campaign?, and lead massive people who love PSP back to join as a group of development team.

      Delete
    4. I still need to set things up, and plan get a solid baseline done, but yes! It would be a while before I am ready to do any of this, as I have to relearn the little PSP dev stuff I knew, and grow my knowledge around the system.
      You can share the link to anyone you want, too. The document is set to allow comments to anyone with that link. Hope for the best :)

      Delete
  2. I like to read the articles , A PlayStation network card, allows you to purchase products and items from online stores of PlayStation which you can freely use if you have a PSN card

    ReplyDelete
  3. Thanks, i'm not focus only popular technology, i need to do various thing like journey of my life. Some tech getting old and remind childhood life is better than now. Done something that never done before is key message of goal.

    ReplyDelete
  4. This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free. ds4windows

    ReplyDelete
  5. This is my first visit to your web journal! We are a group of volunteers and new activities in the same specialty. Website gave us helpful data to work. source: ds4windows

    ReplyDelete
  6. Nice post! This is a very nice blog that I will definitively come back to more times this year! Thanks for informative post. xosokienthiet

    ReplyDelete
  7. Wow i can say that this is another great article as expected of this blog.Bookmarked this site.. buy a photo booth

    ReplyDelete
  8. I like your post. It is good to see you verbalize from the heart and clarity on this important subject can be easily observed... free to play

    ReplyDelete
  9. Stop looking all over the internet anymore about the easiest way to grow your business. I have a few suggestions for you regarding this topic and trust me, it won’t... Real Estate

    ReplyDelete
  10. I am incapable of reading articles online very often, but I’m happy I did today. It is very well written, and your points are well-expressed. I request you warmly, please, don’t ever stop writing. asikqq

    ReplyDelete
  11. I am thankful to you for sharing this plethora of useful information. I found this resource utmost beneficial for me. Thanks a lot for hard work. sa gaming

    ReplyDelete
  12. I would like to say that this blog really convinced me to do it! Thanks, very good post. Gogy

    ReplyDelete
  13. This is a great post. I like this topic.This site has lots of advantage.I found many interesting things from this site. It helps me in many ways.Thanks for posting this again. Friv 2020

    ReplyDelete
  14. Thanks for a very interesting blog. What else may I get that kind of info written in such a perfect approach? I’ve a undertaking that I am simply now operating on, and I have been at the look out for such info. watch anime online

    ReplyDelete
  15. This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here keep up the good work BandarQ Online

    ReplyDelete
  16. Wow i can say that this is another great article as expected of this blog.Bookmarked this site.. reddit mlb streams

    ReplyDelete
  17. You there, this is really good post here. Thanks for taking the time to post such valuable information. Quality content is what always gets the visitors coming. coin master free spins

    ReplyDelete
  18. Positive site, where did u come up with the information on this posting? I'm pleased I discovered it though, ill be checking back soon to find out what additional posts you include. visit the page

    ReplyDelete
  19. I have read all the comments and suggestions posted by the visitors for this article are very fine,We will wait for your next article so only.Thanks! Online games

    ReplyDelete
  20. When you use a genuine service, you will be able to provide instructions, share materials and choose the formatting style. dounscrambler>>homepage

    ReplyDelete
  21. Took me time to read all the comments, but I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commenters here! It’s always nice when you can not only be informed, but also entertained! linkw88moinhat.com

    ReplyDelete
  22. This is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information. Keep it up. Keep blogging. Looking to reading your next post. the consumer guide

    ReplyDelete
  23. Many people dream of hitting a big jackpot while playing online casino games, but frankly, very few of us will ever experience the thrill and satisfaction of winning that million dollar cash prize. Even though the progressive jackpots featured in online casinos, or in a network of casinos, will pay out eventually - the chances of winning such a jackpot still are very slim. poker online indonesia

    ReplyDelete

Post a Comment