[Tutorial PSP]-Compiling Quake For The PlayStation Portable.

Post tutorials on how to do certain tasks within game or engine code here.
Team Xlink
Posts: 368
Joined: Thu Jun 25, 2009 4:45 am
Location: Michigan

[Tutorial PSP]-Compiling Quake For The PlayStation Portable.

Post by Team Xlink »

Hello.

Compiling Quake for the PlayStation Portable is a challenging task.

I am going to make it easy for everyone.

I am going to list the common problems and solutions and what works and does not.
------------
[Tutorial]
------------

-----------------------------------------------------------
Compiling Quake For The PlayStation Portable.
-----------------------------------------------------------
-----------------
By Team Xlink
-----------------

----------------
**NOTICE**
----------------
I have provided a download link for Cygwin and the PSP Toolchain already setup.

This will save you around 5 hours.

It takes Four hours to compile the PSP ToolChain on good modern Hardware.

The time varies for Cygwin, because not all of the download locations have all of the required packages and are slow.

The download I have provided has everything up to date as of

April 8th 2009

----------
Tutorial
----------
-------------
Easy Way
-------------

-------------
Step One.
-------------

Download the Archive available from this link:

EDIT: New URL, thank you for the reupload Baker.

http://quake-1.com/cache/cygwin.rar

-------------
Step Two.
-------------

Once that is complete Open up the win-rar archive.

It should contain a Cygwin Folder.

Extract that to the root of your main Part ion.

---------------
Step Three.
---------------

To attempt to compile go to your Cygwin Directory and double click the .bat file.

It will open up a cmd window.

To compile something you would navigate to a directory via:

Code: Select all

cd kurok
Where kurok is the directory name and cd is basically the go to command.

To compile from a something form the standard file name of makefile you would navigate to the directory and type make.

If the make file is named differently you would type this

Code: Select all

make -f makefilenormal
Where makefilenormal is the name of the makefile.



-----------------
On To Quake
-----------------
-----------------------------------------
Please Read This It is Important
-----------------------------------------

There are two Routes you can take at this point I will provide instructions for both.

-------------
Kurok PSP
-------------

-------------
Step One:
-------------

Useing an SVN client, such as Tortoise SVN

Go to this Link

http://bladebattles.com/kurok/SVN/

Then export it to this directory

Main Parition You Installed Cygwin On:/Cygwin/home/user/kurok

-------------
Step Two:
-------------

This is the error you will get eventually:

Code: Select all

../psp/video_hardware.cpp:39:38: error: m33libs/include/kubridge.h: No such file or directory
The source code calls for files that are in the wrong spot.

Navigate to this directory in your Kurok folder:

Code: Select all

\psp\m33libs
Make two new folders one named:

Code: Select all

lib
And the other named:

Code: Select all

include
Add this file to the " lib" folder:

Code: Select all

libpspkubridge.a
Add this file to the include folder:

Code: Select all

kubridge.h
--------------------------------------------

You could now try to compile Kurok

Once again it will give you errors.
--------------------------------------------

--------------
Step Three:
--------------

You will get this error:

Code: Select all

../psp/video_hardware.cpp:220: error: 'INT_MAX' was not declared in this scope
To fix that error:

Open up

Code: Select all

video_hardware.cpp
At the very top of the file insert this code:

Code: Select all

#include <limits.h>
What this does is it includes limits.h
Limits.h is not a file that is in your kurok source directory.
Basically it is required to declare

Code: Select all

INT_MAX
---------------------------------------
You could try to compile it now.

If you do you will get errors:
---------------------------------------

-------------
Step Four:
-------------

You will get this error:

../psp/network_psp.cpp:154: error: cannot convert 'char*' to 'SceNetApctlInfo*'
for argument '2' to 'int sceNetApctlGetInfo(int, SceNetApctlInfo*)'

Replace This code:

Code: Select all

if (sceNetApctlGetInfo(8, szMyIPAddr) != 0)
strcpy(szMyIPAddr, "unknown IP address");
With this code:

Code: Select all

if (sceNetApctlGetInfo(8, (union SceNetApctlInfo*)szMyIPAddr) != 0) 

That is the End of the Kurok PSP Version
-----------------------------------------
Time for the Quake PSP Version


--------------
Quake PSP
--------------

-------------
Step One:
-------------

Go to this Link

http://psp-quake.svn.sourceforge.net/vi ... z?view=tar

and download it.

Then export it to this directory

Main Parition You Installed Cygwin On:/Cygwin/home/user/


--------------
Step Two:
--------------


You will get this error:


../psp/video_hardware.cpp:220: error: 'INT_MAX' was not declared in this scope


To fix that error:

Open up

Code: Select all

video_hardware.cpp

At the very top of the file insert this code:

Code: Select all

#include <limits.h>
What this does is it includes limits.h
Limits.h is not a file that is in your kurok source directory.
Basically it is required to declare

Code: Select all

INT_MAX 
--------------
Step Three
--------------

You will get this error:

Code: Select all

../psp/network_infrastructure.cpp:126: error: cannot convert 'char*' to 'SceNetA
pctlInfo*' for argument '2' to 'int sceNetApctlGetInfo(int, SceNetApctlInfo*)'



Replace This code:

Code: Select all

if (sceNetApctlGetInfo(8, szMyIPAddr) != 0)
strcpy(szMyIPAddr, "unknown IP address");
With this code:

Code: Select all

if (sceNetApctlGetInfo(8, (union SceNetApctlInfo*)szMyIPAddr) != 0) 

That is all there is too it!

Feel free to post your comments, questions or suggestions.
Last edited by Team Xlink on Tue May 29, 2012 8:41 pm, edited 16 times in total.
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: [Tutorial]-Compiling Quake For The PlayStation Portable.

Post by Baker »

Team Xlink wrote:Hello.

Compiling Quake for the PlayStation Portable is a challenging task.

I am going to make it easy for everyone.

I am going to list the common problems and solutions and what works and does not.
Nice tutorial sir. If only someone had written something like this in December or January, I could have spent oh so many countless hours actually coding.

Nevertheless, I bet this really helps out some people looking to code on the PSP.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
Team Xlink
Posts: 368
Joined: Thu Jun 25, 2009 4:45 am
Location: Michigan

Re: [Tutorial]-Compiling Quake For The PlayStation Portable.

Post by Team Xlink »

Baker wrote:
Team Xlink wrote:Hello.

Compiling Quake for the PlayStation Portable is a challenging task.

I am going to make it easy for everyone.

I am going to list the common problems and solutions and what works and does not.
Nice tutorial sir. If only someone had written something like this in December or January, I could have spent oh so many countless hours actually coding.

Nevertheless, I bet this really helps out some people looking to code on the PSP.


Thank you!

I actually re-downloaded all of the stock code while I wrote this tutorial to make sure I didn't skip any steps when writing.

I am really not sure if this code even does what it is supposed to tho.

Code: Select all

if (sceNetApctlGetInfo!=0)
strcpy(szMyIPAddr, "unknown IP address"); 
I think I am going to start making PSP Specific Engine tutorials.

The problem with PC tutorials is any hardware related code won't work on the PSP for the most part, because they don't use the same hardware.

Then there is the fact that many People who try Engine Coding for Quake on the psp, don't know the hardware differences.


This is really off topic, but I have just realized that I have made a really bad name for myself among these forums
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: [Tutorial]-Compiling Quake For The PlayStation Portable.

Post by Baker »

Team Xlink wrote: This is really off topic, but I have just realized that I have made a really bad name for myself among these forums
LIES!

Everyone starts off knowing less and ends up knowing more.

3 years ago, I knew embarrassing little about Quake modding -- whether engine or QC -- and was referred to as a "help vampire", haha.

Today, instead of knowing "embarrassing little" about Quake modding I just know "less embarrassing little" about Quake modding.

Which just goes to show that even the less talented amongst us can benefit from just listening to people like Spike, FrikaC, MH, Urre, etc. talk about Quake modding.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: [Tutorial]-Compiling Quake For The PlayStation Portable.

Post by Spike »

Team Xlink wrote: I am really not sure if this code even does what it is supposed to tho.

Code: Select all

if (sceNetApctlGetInfo!=0)
strcpy(szMyIPAddr, "unknown IP address"); 
sceNetApctlGetInfo is a function. Your change highlighted above will _always_ result in 'true' inside that condition.
Which is not what you want.

Acording to google, that second parameter is a union, and can be one of multiple types, including a 64char string ('name').

It looks like the correct fix is to use a cast - eg:

if (sceNetApctlGetInfo(8, (union SceNetApctlInfo*)szMyIPAddr) != 0)

And suppossedly that should fix it.


I might be wrong, but hey.
Check to make sure it really gives a proper x.x.x.x ip, rather than a single int.
Chances are the changes you had to make were due to different versions of the psp sdk.
Downsider
Posts: 621
Joined: Tue Sep 16, 2008 1:35 am

Post by Downsider »

oo Well I was about to reformat and starting backing shit up, looked at my Cygwin folder which is a massive 2.74 GB, for reasons unknown to me (Probably fucked something up :/), so I guess this is a livesaver :)
Team Xlink
Posts: 368
Joined: Thu Jun 25, 2009 4:45 am
Location: Michigan

Post by Team Xlink »

Downsider wrote:oo Well I was about to reformat and starting backing shit up, looked at my Cygwin folder which is a massive 2.74 GB, for reasons unknown to me (Probably fucked something up :/), so I guess this is a livesaver :)
Thank you Downsider!
Tomaz
Posts: 67
Joined: Fri Nov 05, 2004 8:21 pm

Post by Tomaz »

Erm.. Im sorry but... Have you checked out the latest SVN source?
Both the lightmaps.h and the sceNetApctlGetInfo are fixed.

Hell... the code using sceNetApctlGetInfo was removed from the SVN 1.5 years ago...

Not to mention the fact that some of your solutions are plain wrong, such as the case with sceNetApctlGetInfo which Spike explained.

I dont wanna be harsh but, when writing a tutorial, isnt it a good idea if you know what you talk about FIRST?

Perhaps maybe learn programming at least?
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Post by Baker »

Tomaz wrote:Erm.. Im sorry but... Have you checked out the latest SVN source?
Both the lightmaps.h and the sceNetApctlGetInfo are fixed.

Hell... the code using sceNetApctlGetInfo was removed from the SVN 1.5 years ago...

Not to mention the fact that some of your solutions are plain wrong, such as the case with sceNetApctlGetInfo which Spike explained.

I dont wanna be harsh but, when writing a tutorial, isnt it a good idea if you know what you talk about FIRST?

Perhaps maybe learn programming at least?
Mostly correct information is better than none and this place is great at getting a good peer-review.

My head uses the standard "Are you adding to the community's general body of information?" while your standard might be "Is the tutorial professional grade and perfect?" For a 13-year-old game, maybe the latter isn't quite realistic as Quake isn't the hot property it was in 1999-2001 for modders.

Case in point, my alpha transparency tutorial was imperfect but you told me what was wrong with it and I then was able to fix my engine. That tutorial I wrote was then used as a guideline for Avirox implementing a prototype of alpha transparency support to ezQuake which is in ezQuake 2.0 I believe.

Compiling for a PSP is very difficult to setup and very little quality information exists on the topic. This tutorial by Team Xlink is a big step in explaining the process.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
Tomaz
Posts: 67
Joined: Fri Nov 05, 2004 8:21 pm

Post by Tomaz »

In my world, a tutorial with incorrect information is not a tutorial, it just gives false information which I think is worse than no information.

But sure, I can point out a few misstakes.

First, downloading his "pre setup" Cygwin most likely wont even start since the computer will be missing Enviroment variables and whatnot ( at least I have never been able to run an "old" Cygwin on a reinstalled computer, which was always fixed by isntalling a new minimalistic Cygwin and copying my old backup over it )

The entire bat file history is just so wrong in so many ways since all you need to do to compile is start cygwin and browse to the Kurok folder and typ "make" or "make -f MakefileNormal" depending on if you wanna compile for the "normal" or "slim" PSP.

The m33libs/include history is also wrong, which I personally blame on the original author for Kurok, but the last "fix" is also wrong. The header file should go into m33libs/include but the two .a files should go in m33libs/lib.

Create lightmaps.h, erm.. its already there. Was added to the SVN 2 days before the tuorial was written. Not to mention that the entire explenation on what the code does is wrong.
Variables that are used by more then one source file are usually put in there own source file.

The source file usually ends with the .h extension because it is a header file.
This might just be me but .c / .cpp file is source, .h is header. Do not confuse source files with header files. And those 2 variables are already declared in video_hardware_model.cpp. Adding the 2 externs does not define a variable, it tells the other source files ( .c / .cpp ) that include this header, that those 2 variables are declared somewhere, in which .c / .cpp file it is decalred doesnt matter.

Then there is some ranting about more errors, which there isnt.
Something about INT_MAX but it compiles just fine here, lots of warnings, but that again I blame the original author of Kurok.

Then comes the fun part, the fix for SceNetApctlInfo, first off the fix is so wrong on so many levels that I'm not even sure I want to try to correct it. I'm sure the code compiles just fine, to bad all it does is check if that function exist, and not run it and then check the result of running it.

I saw now that half of the instructions were for yet another engine that I have yet not tried. Still Kurok compiled fine without any errors.

Happy with this more "elaborated" answer? Maybe its more clear now "why" I suggested that one should at least have some knowledge of what one is doing before writing tutorials about it.

And yes, I've done lots of Quake engine coding, other coding in general AND do professional PSP coding at work, so I know what I'm talking about.

EDIT:

Just tested psp-quake as well, just as I expected that also compiles without errors without doing anything.

Then there can be questions about why the code has so many warnings which is a no-brainer to fix, but that again is to blame the original author.
Team Xlink
Posts: 368
Joined: Thu Jun 25, 2009 4:45 am
Location: Michigan

Post by Team Xlink »

Thank you for the feedback!

I was unaware of the lightmaps.h being added to the SVN. It wasn't in there before.

The Pre-Setup build is actually a fully portable build I carry it around on a SD card when I travel, I have also set friends up like this.


The .bat file is because not everyone knows how to do this:

Code: Select all

cd kurok/psp
About the header file info, to get it to compile I had to make a new file for it, I should have worded that better then
I did.

I was completely unsure about the Network fix that is why I said you could either comment it out or put in that, I also said:
I am not sure if this is the correct code to fix the problem, I was just screwing around and it compiled:
Also, You didn't get those errors?

I re-downloaded the svn source and It gave me those errors, I do know that the instructions for fixing INT_MAX do work and they are the proper way to fix it.

Thank you for the feedback!

Also, since it gave you no errors when compiling directly from the SVN, do you mind me asking what your using to compile it exactly?

If it is a setup problem then I would love to be able to get my cygwin setup properly to correct those errors.
Tomaz
Posts: 67
Joined: Fri Nov 05, 2004 8:21 pm

Post by Tomaz »

To get it to compile, well, I just use my 2 year old Cygwin install, but I ran the Cygwin setup earlier today and updated everything to latest, thats it, I'm not sure how old my PSPSDK is tho but as far as I can tell from the SVN for it nothing important have changed. It does after all take 5 hours to build that darn SDK so I have no plans to update to the latest.

And yes, the INT_MAX fix is correct, it just wasnt needed since there were no errors.
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Post by Baker »

Tomaz wrote:In my world, a tutorial with incorrect information is not a tutorial, it just gives false information which I think is worse than no information.

...
Just tested psp-quake as well, just as I expected that also compiles without errors without doing anything.
Ah, ok so the instructions compile a still-born binary. Now I understand what you mean in better context. I didn't derived that from your comments.
And yes, I've done lots of Quake engine coding, other coding in general AND do professional PSP coding at work, so I know what I'm talking about.
From what I can tell, much of the PSP Quake environment is younger kids (15-19 years old) with little structure and project experience. This is part of the reason why many of the PSP Quake projects lose their source code, have poor documentation and don't have a roadmap for completion (GDD), etc.

Everyone here knows you are a seasoned heavyweight with serious credentials and these guys can benefit from your help .. and it looks like they already have.

/Me exits conversation, just wanted to defend Team Xlink for making a benign attempt to add to the pool of knowledge.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
Team Xlink
Posts: 368
Joined: Thu Jun 25, 2009 4:45 am
Location: Michigan

Post by Team Xlink »

Well, I got all of those errors directly from compiling the SVN.


I guess I am going to redo my Cygwin setup.


Also you do Professional PSP Coding at work?

You use Cygwin?

So do you use the same software/hardware that is available to the average non profit PSP Coder?

I have another question about Cygwin, the last time I redid my installation was on April 8th 2009, I had to spend a few days because of errors and bad links and other problems, so I am wondering,

What link do you choose in the Cygwin Setup to download all of the files?

Also, is there a current up to date list for which binaries are required?

I hate windows, but I use it for compatibility, I usually had some distro of Linux installed on my Computer, but it just became harder to work on the stuff I needed to work on.
Tomaz
Posts: 67
Joined: Fri Nov 05, 2004 8:21 pm

Post by Tomaz »

No I dont use Cygwin to do real PSP work, you can but you dont need to.

And no its not the same hardware or the same SdK when doing the real thing.

I use the swedish link ftp.sunet.se, never fails and I got 100mbit connection towards it. Regarding binaries, no idea.
Post Reply