Porting Homeworld from PC to PSP...help :)

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

Moderators: cheriff, TyRaNiD

Post Reply
User avatar
Jack_6428
Posts: 3
Joined: Thu Jun 25, 2009 8:00 am
Contact:

Porting Homeworld from PC to PSP...help :)

Post by Jack_6428 »

Hi guys, last week i got the idea to port this great RTS from PC to the PSP...

I think it could be possible...since the Homeworld source-code is said to be quite user friendly. Basically fans ported the game to Linux and MAC OS. I thought, why not port it to the PSP ? To have a great game on the go ? Since there is no real space game on the system.

About the game:

Code: Select all

http://en.wikipedia.org/wiki/Homeworld
In terms of hardware, Homeworld system requierments are:
PII 233 or equivalent
RAM: 32 MB
Video Memory: 4 MB
Hard Drive Space: 150 MB

Recommended specs are:
PII 350 or equivalent
RAM: 64 MB
Video Memory: 12 MB
Hard Drive Space: 400 MB

The PSP's hardware is (the port would work on all PSP's apart from Phat):
CPU: 333Mhz
RAM: 64MB Main Memory, 4 MB embedded DRAM
Video Memory: 2MB
Resolution: 480x272
Hard Drive Space: Depends on Memory Stick, maximum is 16GB

For controls:
Best way would be to make the Analog stick perform as a mouse, and adapt the micro-management system to the PSP

You could also allow the user to assign shortcuts to the digital pad, ex:

Default:
Up - Launch Menu
Left - Build Menu
Right - Research Menu
Down - Game View

Custom:
Up - Sphere formation
Left - Claw Formation
Right - Wall Formation
Down - Custom Formation

and etc.

You could require that the user must be holding down the L or R triggers to rotate the camera, and assign the ^/X/O/[] buttons as so:

Default Config:
L - Focus on current ship
R - Orbit Camera
X - Left Click
O - Right Click/Context Menu
[] - Move Command
^ - Attack Command

Custom Config:
L - Left Click
R - Right Click/Context Menu
X - Attack Command
O - Orbit Camera
[] - Focus on Current Ship
^ - Move Command

As for rendering options, D3D will be probably unavailable. DirectX is not coded into the infrastructure and I believe the system either uses OpenGL or a custom API. Best bet is to go with Software rendering in the meantime (the game allows it).

I think if we lowered the resolution of the movies and audio (compressing, etc.), lowered texture quality a bit...the PSP should handle the game well. Mainly, the source code is available for free...

Right now i have these things to work with:
PC
PSP-2000 with CFW (warranty is way over due)
Homeworld game for PC
Homeworld game sourcecode with manuals/documents
Random tools and apps which will be needed for work

What do you guys think ? Possible ? I would love to have one of my favourite games on the PSP... I think it could get finished by Christmas if everything goes according to plan...perhaps later..So far over the net i found 3 people who are willing to help... if someone here helped aswell..we could become a team and work on it together...

Ive set up my blog for that with the thought:

Code: Select all

http://www.moddb.com/members/jack-6428/blog
THANKS for any replies and help!
User avatar
Wally
Posts: 663
Joined: Mon Sep 26, 2005 11:25 am

Post by Wally »

FYI: The slim has 4MB of VRAM :)


I think it'd be a great game to be ported, perhaps maybe a lot of optimisation could push the game to work on the PSP, you never know these days as machines are more powerful than they are back then.

Then again, you'd have to consider the endianess. PSP is Little Endian and PC is big endian, you'd have to reverse everything.

It'd be a big job but most likely possible
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

You should probably work from the SDL version: http://www.homeworldsdl.org/
jsharrad
Posts: 100
Joined: Thu Oct 20, 2005 3:06 am

Post by jsharrad »

PC is big endian? What now? :P

Maybe PowerPC. :)
m0skit0
Posts: 191
Joined: Tue Jun 02, 2009 8:58 pm

Post by m0skit0 »

Seems a good idea, but no feasible, I fear. Linux and Mac runs over the same architecture than Windows. PSP is another matter, running on RISC and different architecture than a PC. It would involve a lot of work, specially for low-level routines (if any).
Wally wrote:PSP is Little Endian and PC is big endian
I guess you meant PSP is big-endian and PC is little-endian ;) Anyway, normally high-level code abstracts such considerations, so this shouldn't pose much problem.

Can you please post a link with Homeworld's source code? Just to check it out. Thanks!
The Incredible Bill Gates wrote:The obvious mathematical breakthrough would be development of an easy way to factor large prime numbers.
User avatar
Jack_6428
Posts: 3
Joined: Thu Jun 25, 2009 8:00 am
Contact:

Post by Jack_6428 »

m0skit0 wrote:Seems a good idea, but no feasible, I fear. Linux and Mac runs over the same architecture than Windows. PSP is another matter, running on RISC and different architecture than a PC. It would involve a lot of work, specially for low-level routines (if any).

Can you please post a link with Homeworld's source code? Just to check it out. Thanks!
Here is the sourcecode released by Relic in late 2001:

Code: Select all

http://files.filefront.com/Homeworld+Source+Code/;2142242;/fileinfo.html
I know it wont be easy to port, but at the same time i know its possible.
I got everything I need to make it happen, now i only need people who will help out. If anyone from here is interested..feel free to say :)

J.F. wrote: You should probably work from the SDL version: http://www.homeworldsdl.org/
Hm, yeah, i could try that one... thx for reminding me
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

The PSP is little endian, so it shouldn't be any trouble with PC apps that don't have proper endian support.

The SDL source has the best chance of being compiled easily on the PSP as the PSP has SDL already. In fact, one of the folks here recently added a few more SDL libs to the ones converted over to the PSP.
User avatar
Jack_6428
Posts: 3
Joined: Thu Jun 25, 2009 8:00 am
Contact:

Post by Jack_6428 »

J.F. wrote:The PSP is little endian, so it shouldn't be any trouble with PC apps that don't have proper endian support.

The SDL source has the best chance of being compiled easily on the PSP as the PSP has SDL already. In fact, one of the folks here recently added a few more SDL libs to the ones converted over to the PSP.
that is great to hear ! :)
whistler
Posts: 39
Joined: Tue Mar 04, 2008 7:08 am

Post by whistler »

J.F. wrote:The PSP is little endian
You sure? I thought the psp was big endian, anyway the pc is little endian thats for sure
m0skit0 wrote: Can you please post a link with Homeworld's source code? Just to check it out. Thanks!
if your interested in porting to the psp then j.f's link to the sdl version would be worth checking
http://www.homeworldsdl.org/
m0skit0
Posts: 191
Joined: Tue Jun 02, 2009 8:58 pm

Post by m0skit0 »

J.F. wrote:The PSP is little endian
Man, I repeat: PSP IS BIG-ENDIAN.

That said, almost all RISC processors are big-endian. But MIPS is both-endian anyway xD
The Incredible Bill Gates wrote:The obvious mathematical breakthrough would be development of an easy way to factor large prime numbers.
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

m0skit0 wrote:
J.F. wrote:The PSP is little endian
Man, I repeat: PSP IS BIG-ENDIAN.

That said, almost all RISC processors are big-endian. But MIPS is both-endian anyway xD
Wrongo, boyo! PSP has been and always shall be, little endian. Where did you get the weird idea that the PSP was big endian?? The only MIPS system I've ever seen that was big endian is the N64. The PSX is little endian, the PS2 is little endian, and so is the PSP.

As to RISC processors being big endian, that varies with the family and manufacturer. PPCs are normally big endian, but some can be run as little endian (support removed for that in the Cell architecture). MIPS has been traditionally bi endian, but the majority of systems use it in little endian mode. SH is big endian. ARM is little endian.

Rather than get in a big argument, lemme just point to some code... look at lines from the sysdeps.h file in Basilisk II:

Code: Select all

/* Set endian and addressing definitions */
#undef WORDS_BIGENDIAN
#define DIRECT_ADDRESSING 1

...

/* little-endian CPUs which can not do unaligned accesses (this needs optimization) */
//static inline uae_u32 do_get_mem_long&#40;uae_u32 *a&#41; &#123;uint8 *b = &#40;uint8 *&#41;a; return &#40;b&#91;0&#93; << 24&#41; | &#40;b&#91;1&#93; << 16&#41; | &#40;b&#91;2&#93; << 8&#41; | b&#91;3&#93;;&#125;
static inline uae_u32 do_get_mem_word&#40;uae_u16 *a&#41; &#123;uint8 *b = &#40;uint8 *&#41;a; return &#40;b&#91;0&#93; << 8&#41; | b&#91;1&#93;;&#125;
//static inline void do_put_mem_long&#40;uae_u32 *a, uae_u32 v&#41; &#123;uint8 *b = &#40;uint8 *&#41;a; b&#91;0&#93; = v >> 24; b&#91;1&#93; = v >> 16; b&#91;2&#93; = v >> 8; b&#91;3&#93; = v;&#125;
static inline void do_put_mem_word&#40;uae_u16 *a, uae_u32 v&#41; &#123;uint8 *b = &#40;uint8 *&#41;a; b&#91;0&#93; = v >> 8; b&#91;1&#93; = v;&#125;

// these don't seem to be used
//static inline uae_u32 do_byteswap_32&#40;uae_u32 v&#41;
//	&#123; return &#40;&#40;&#40;v >> 24&#41; & 0xff&#41; | &#40;&#40;v >> 8&#41; & 0xff00&#41; | &#40;&#40;v & 0xff&#41; << 24&#41; | &#40;&#40;v & 0xff00&#41; << 8&#41;&#41;; &#125;
static inline uae_u32 do_byteswap_16&#40;uae_u32 v&#41;
	&#123; return &#40;&#40;&#40;v >> 8&#41; & 0xff&#41; | &#40;&#40;v & 0xff&#41; << 8&#41;&#41;; &#125;


/* PSP optimized CPU defines */
static inline uae_u32 do_get_mem_long&#40;uae_u32 *a&#41; &#123;uint32 retval; __asm__ &#40;"ulw %0,%1" &#58; "=r" &#40;retval&#41; &#58; "m" &#40;*a&#41;&#41;; return __builtin_allegrex_wsbw&#40;retval&#41;;&#125;
static inline void do_put_mem_long&#40;uae_u32 *a, uae_u32 v&#41; &#123;__asm__ &#40;"usw %1,%0" &#58; "=m" &#40;*a&#41; &#58; "r" &#40;__builtin_allegrex_wsbw&#40;v&#41;&#41;&#41;;&#125;

// doesn't seem to be used
#define HAVE_OPTIMIZED_BYTESWAP_32
static inline uae_u32 do_byteswap_32&#40;uae_u32 v&#41; &#123;return __builtin_allegrex_wsbw&#40;v&#41;;&#125;
Does BII work on the PSP? Damn skippy! The system it's emulating is the big endian 680x0 CISC. As such, on little endian systems, the words and longs must be byte swapped. Look at the code above - it's byte swapping! Imagine that! Notice in the first couple lines the WORDS_BIGENDIAN is undefined... because the PSP is little endian. Nuf said...
hlide
Posts: 739
Joined: Sun Sep 10, 2006 2:31 am

Post by hlide »

Wally wrote:Then again, you'd have to consider the endianess. PSP is Little Endian and PC is big endian.
you are not well informed :P. PC and PSP are little endian.
hlide
Posts: 739
Joined: Sun Sep 10, 2006 2:31 am

Post by hlide »

m0skit0 wrote:
J.F. wrote:The PSP is little endian
Man, I repeat: PSP IS BIG-ENDIAN.

That said, almost all RISC processors are big-endian. But MIPS is both-endian anyway xD
Man, you're totally wrong, PSP is little endian like PC.
m0skit0
Posts: 191
Joined: Tue Jun 02, 2009 8:58 pm

Post by m0skit0 »

Yes, you're right. I mistaken concepts, sorry :P
The Incredible Bill Gates wrote:The obvious mathematical breakthrough would be development of an easy way to factor large prime numbers.
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

No problem. It really doesn't affect a lot of what you do on the PSP, but if you want to work on an emulator or something that reads files written in big endian format, THEN it makes a difference. I think that's half the reason Sony used little endian for their MIPS instead of big endian - it makes PC ports easier as the PC is little endian as well. If a program either makes no attempt to handle endian issues, or misses a place in the code, it won't cause the port to fail.
User avatar
Wally
Posts: 663
Joined: Mon Sep 26, 2005 11:25 am

Post by Wally »

hlide wrote:
m0skit0 wrote:
J.F. wrote:The PSP is little endian
Man, I repeat: PSP IS BIG-ENDIAN.

That said, almost all RISC processors are big-endian. But MIPS is both-endian anyway xD
Man, you're totally wrong, PSP is little endian like PC.
No wonder I was totally confused :(
Kreationz
Posts: 52
Joined: Sun May 18, 2008 11:01 am

Post by Kreationz »

Then you have endian issues like we do with DX64 and Strmnnrmn porting it to a big endian system and the fact we're emulating a big endian system(the N64) that has a few endianess quirks on a little endian system(PSP) that also has it's own quirks. In the end it all makes for a wonderful mess...

Good luck on porting this I enjoyed the game. I'll have take a look at the source myself as well.
Post Reply