Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: rRootage fast porting tutorial

                  
   
  1. #1
    PSP Coder deniska's Avatar
    Join Date
    Jul 2005
    Posts
    1,557
    Rep Power
    76

    Default rRootage fast porting tutorial

    I am writing this in response to some accusations of me stealing someone else's code.
    I am not gonna name names and point fingers. I just want to clear up my name... and hopefully this information will be usefull to people who want to get in to psp homebrew scene.
    So you deside as to whether I needed to steal anything or could do it myself in 20 minutes, using basic C/C++ knowlege and common sense.
    So here we go...

    1) Get the original rRootage distribution from: www.asahi-net.or.jp/~cs8k-cyu/windows/rr_e.html (google it if the link does not work)

    2) Unzip it and get the source folder. The attached readme file mentions that you'll be needing SDL, OpenGL, bulletML oggVorbis. So if you don't have those yet, get the psp versions: SDL, SDL_mixer, PSPGL, libBUletML, libTremor. Of course you'll need the latest versions of those. you'll need PSPSDK and Cygwin as well. (Read other tutorials if you need help setting up anything from the list above)

    3) Ok, so you have the environment setup :-) Let's compile it:
    Your basic make file should look something like this:

    Code:
    TARGET = rr
    PSPSDK = $(shell psp-config --pspsdk-path)
    PSPBIN = $(shell psp-config --psp-prefix)/bin
    SDL_CONFIG = $(PSPBIN)/sdl-config
    O = o
    OBJS =  $(TARGET).$(O) foe.$(O) foecommand.$(O) barragemanager.$(O) boss.$(O) ship.$(O) laser.$(O) \
            frag.$(O) background.$(O) letterrender.$(O) shot.$(O) \
            screen.$(O) vector.$(O) degutil.$(O) rand.$(O) mt19937int.$(O) \
            soundmanager.$(O) attractmanager.$(O)
    
    DEFAULT_CFLAGS = $(shell $(SDL_CONFIG) --cflags)
    
    MORE_CFLAGS = -g -O2
    
    CFLAGS = $(DEFAULT_CFLAGS) $(MORE_CFLAGS)
    CXXFLAGS = $(DEFAULT_CFLAGS) $(MORE_CFLAGS) -fno-exceptions
    
    LIBS = -lbulletml -lSDL_mixer -lvorbisidec  -lstdc++   -lGLU -lGL -lglut -lpsprtc $(shell $(SDL_CONFIG) --libs)
    
    EXTRA_TARGETS = EBOOT.PBP
    
    include $(PSPSDK)/lib/build.mak
    so save it as "Makefile" in the src directory and type "make"
    It will do some compiling but will return with something like:

    foecommand.h:30: error: conflicting return type specified for 'virtual double FoeCommand::getBulletDirection()'
    /usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/include/bulletml/bulletmlrunner.h:72: error: overriding 'virtual float BulletMLRunner::getBulletDirection()'

    Note that it's complaining about type mismatch double vs float in bulletml lib.

    So let's go to foecommand.h and change all "double" to "float"
    (if you use "vi", :s/double/float/g 5000 will fix it for you in a blink ;-)

    Now, of course, you'll have to do the same for the corresponding foecommand.cc


    Let's try to "make" again.... and bingo!!! you have your firmware version1.0 executable!!!! type "make kxploit" if you need the 1.5 version folders

    Well, you are done! with your working 0.01 version!!!
    Test it!!! make sure you copy all the game files/folders from the original distribution.
    You'll notice that it's running slow with the ms access light blinking...
    Well look for new files on your ms ;-) You'll probably find log.txt in which pspgl
    is dumping it's complaints about the errors it encountes... read it...
    If you recall the original version - it runs at 640x480 resolution which it a bit big for PSP.. so try to see if it is hardcodded somethere in the code ;-) and fix it.. Look for key assgnments (grep -i key) and see where they defined..
    Since they did not seem to work in your first version, u'll need to fix that part.. view the readme.psp in SDL distribution on details...

    Obviously as you go along, you'll encounter some new problems and I don't want to spoit the fun by givving out solutions ;-)

    But as you see it is very simple to get things going with out stealing someone elses code ;-) with some experience you can produce a functional port in ~60 min...

    So what's the trick??? Finding easily portable free code.. You'll need some experience with that ;-)
    You best bet would be to look for something that has already been ported to some other lowres console or use platform independent libraries like SDL..
    Try to search thru the games at www.libsdl.org for ideas...

    Also, the trick is in tweaking the game for performance.. for example, you can use same sequence to port NOIZ2SA and will be done in ~ 20 minutes.. but it took me much more time to come up with the fast & attractive tate version... I had to re-write all SDL calls (partly because psp SDL was not that well when I started codding that game.. i had to re-write most of the IO functions too and compile my own version of bulletML)

    I hope this was educating..

    Regards,

    DENIS

    PS:
    Some other porting ideas:
    Dodgin' Diamonds - very easy..
    Rise of Triad - more advanced - I'll try to finish this one when I have time...


    [Jan 3, 2006 Edit]
    Ok, some people got stuck with psp libraries installation so here is some hints:
    1) Install as many cygwin libraries as you can (This is kinda dumb but at least you will not be missing anything and stock with some weird build errors)
    If you are pressed with HD space, you defenetely want X11 stuff (startx will give you anice xterm with copy/ paste functionality), libtool, gnu make, svn, wget, bison, etc..
    2) to get the fresh source for the libs do:
    svn co svn://svn.ps2dev.org/psp/trunk/SDL _this will get you the source for SDL.. Change "SDL" to libTremor, SDL_mixer, SDL_gfx and it will get you the source for those libs, creating new folders in your current directory.
    NOTE: make sure your current path don't have spaces in it. This may screw up some cygwin calls...

    Once you get the library, "cd" in to that directory and view README.PSP (or just README if README.PSP is not there)
    README.PSP usually has the command sequence for installing the library as well as any prerequisites.
    For example libTremor has following:

    LDFLAGS="-L`psp-config --pspsdk-path`/lib -lc -lpspuser" ./autogen.sh \
    --host psp --prefix=`psp-config --psp-prefix`
    make
    make install

    So just copy those lines in to cygwin prompt..
    Having 2 xterm windows can be handy.. so prowided that you have X11 stuff installed, type
    startx &
    xterm &

    Happy codding ;-)

    DENIS

  2. #2
    DCEmu Newbie
    Join Date
    Mar 2005
    Posts
    51
    Rep Power
    0

    Default

    Thanks very much for your excellent porting guide!
    This has inspired me to port an SDL game.
    I have my first port running on PSP. Unfortunately it crashes on startup but I am working to solve that!

    I have a question regarding porting of SDL games. Do you need to do some kind of mapping of the controls? If so how / where is this done? For example, if I want the X button on PSP to shoot, up button to make the sprite go up, etc, etc.

    Also, could you explain for a psp-dev newbie, what each of the libraries offer you:

    LIBS = -lbulletml -lSDL_mixer -lvorbisidec -lstdc++ -lGLU -lGL -lglut -lpsprtc $(shell $(SDL_CONFIG) --libs)

    I know that vorbis is an audio decoder, and stdc++ is self-explanatory. Could you summarise the others so that I can judge whether or not they're needed in my own porting project?

    Cheers,
    Reakt

  3. #3
    PSP Coder deniska's Avatar
    Join Date
    Jul 2005
    Posts
    1,557
    Rep Power
    76

    Default

    Sorry for a brief response, but I don't have much time now...

    SDL_JoystickGetButton(stick, 2) will give you [X] event..

    int btn;

    btn=SDL_JoystickGetButton(stick, 2);

    if (btn) {
    do_something();
    }

    Refer to PSP SDL readme for other mappings ...

    as to libraries:

    SDL_mixer - SDL music/sound lib
    bulletml - barrage definition lib - (unless you port some other Kenta Cho's shotter, chances are you don't need it..)

    In general, there is no harm in keeping extra libs in your linker path..
    You can always delete some and check if it still compiles ;-)

    Good luck with your project..

  4. #4
    DCEmu Newbie
    Join Date
    Mar 2005
    Posts
    51
    Rep Power
    0

    Default

    Cheers for the pointers. Reading the docs I found you can also register to receive notification of Joystick Events, that way I can handle the joystick input at the same place the keyboard input is handled.

    I got my game to start up and run. It's full screen. All the sprites are there but it looks strange - like sprites are overlapping each other. It's as if there's too much on the small screen. Any idea what I need to do to try to resolve this?

  5. #5
    DCEmu Newbie
    Join Date
    Jan 2006
    Posts
    2
    Rep Power
    0

    Default

    Hi.
    Very good tutorial deniska but I canīt find the psp versions of SDL, SDL_mixer, PSPGL, libBUletML and libTremor. Can someone tell me where to get these? I searched in google but I didnīt find anything.
    Sry for my English but Iīm German.
    Thanks, ctfreak

  6. #6
    DCEmu Newbie
    Join Date
    Jun 2005
    Posts
    28
    Rep Power
    0

    Default

    Imagine games like Resident evil and Resident evil 2 on the psp.

    That would be awesome!!!

    I'll try giving it a shot.

  7. #7
    DCEmu Rookie
    Join Date
    Jul 2005
    Posts
    167
    Rep Power
    69

    Default

    teach a man to fish...

    thank you, sir. i am considering doing this even though i know $#@! ALL about coding... might be a good learning experience.

  8. #8
    DCEmu Rookie Zaibach333's Avatar
    Join Date
    Oct 2005
    Location
    Minnesota, US
    Posts
    168
    Rep Power
    68

    Default

    I'm interested in this pspgl you speak of, I'm not quite sure what sdl is. the standard library?

    correctme if that's a stupid statement. anyway I'm really interested in opengl for psp

  9. #9
    DCEmu Rookie Mr.Modem's Avatar
    Join Date
    Aug 2005
    Posts
    153
    Rep Power
    69

    Default

    PSPGL is like OpenGl for PSP and SDL is an open source cross-platform 2d graphics library.

  10. #10
    DCEmu Newbie
    Join Date
    Jan 2006
    Posts
    2
    Rep Power
    0

    Default

    Iīm interested in trying this.
    Can anyone say where to get the psp versions of SDL, SDL_mixer, PSPGL, libBUletML and libTremor?
    I didnīt find them.
    Sry for my English cause Iīm German.

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •