xbox-scene.com - your xbox news information source
Quick Links: Main Forums | Xbox360 Forums | Xbox1 Forums | PS3 Forums
Xbox-Scene Forum Help  Search Xbox-Scene Forums   Xbox-Scene Forum Members   Xbox-Scene Calendar

Giganews Usenet Offers: +1150 days binary retention, 99%+ Completion, and Unlimited Speed/Access!

360 ODD Emulators: X360 Key $99 | Wasabi360 FAT $99 | Wasabi360 Slim $99
C4E's iXtreme Burner MAX Drive: LiteOn iHAS124 DROPPED TO JUST $17


Welcome Guest ( Log In | Register )

 Forum Rules Rules
2 Pages V  1 2 >  
Reply to this topicStart new topic
> Very Simple Guide To Xbox App/emulator Porting
nes6502
post Jun 22 2006, 02:00 PM
Post #1


X-S Freak
*****

Group: Members
Posts: 1799
Joined: 29-October 04
Member No.: 161612



The reason I wrote this guide was to explain the process of porting a game or an emulator to the Xbox. You don’t have to be a coding master. All you need is the tools to build an Xbox application, basic knowledge of C (and or C++), and some determination. I am not the authority on the subject, but I have ported an emulator to the Xbox, and I am writing from this experience. This is a VERY high level view. But the framework is here.

Why am I writing this and posting it in the emulators forum? I realize that many emulator users read this forum and might want their favorite application/game/emulator ported to the Xbox. In reality, the only way it may ever get ported is if they do it themselves. I have wanted ZSNES on the Xbox (native port) since I started using the Xbox, and I realised that the only way it was going to happen was if I did it myself. So I did. I had never ported anything to the Xbox (or any console) before and I am not an expert coder. With determination I was able to do it, and i think it turned out well. So if you want your favorite app/emulator/game on the Xbox, instead of waiting for a day that may never come, people might want to try and do it themselves. This is a basic guide for those people that don't know where to begin.

Tools:

1) XDK
2) Visual Studio 2003. NET
3) You do not need a debug XBOX (even though it is helpful). Without one, you will be burning CD’s every time you want to test a change.

Step 1) Decide what you want to port. For this example I will talk about ZSNES. ZSNES is written in C and Assembly. I’m pretty familiar with C and not very familiar with Assembly.

Step 2) Download the source code. It’s easiest if you can compile it on Windows first. After following the instructions, I was able to compile the windows version of ZSNES.

Step 3) Create a new Xbox application workspace in VS 2003. Add all the C/C++ files to the project. If there are assembly files (like in ZSNES), just add the “obj” files for the ASM ones generated from Step 2 to the project.

Step 4) Compile the Xbox project. This is where the fun starts. There will be lots of compile errors because the PC version is likely using code, functions, libraries that are not supported on the Xbox. For example, ZSNES uses DirectDraw code to draw the screen. There is no DirectDraw support on the Xbox, so I had to learn how to do the same thing with Direct3D. Basically: how to set the color of each pixel on the screen. Once I replaced all the DirectDraw code, that entire group of errors went away.

Another example is the input. ZSNES assumes there is a mouse used. I commented out all the code that used a mouse because there isn’t one on the Xbox. Another example is the keyboard. Since there is no Xbox keyboard, I replaced all the keyboard code with Xbox controller code. ZSNES still thinks there is a keyboard attached and checks to see if any buttons are pressed. I just monitor buttons on the Xbox controller, and when one is pressed, I tell ZSNES that one of the keyboard keys was pressed.

Step 5) Compile again. Now continue replacing code that gives errors with code that doesn’t.

Step 6) Repeat Step 5 until all errors are gone. Once all the errors are fixed, VS will generate an “xbe” file that can be run on the Xbox.

A great starting point is the Genadrive source code. It is easy to read and easy to compile. Try compiling it and running it on the Xbox. Then study what it is doing to draw pixels on the screen, read the controller, read files in a directory for the ROM browser, etc.. In fact I used this as my base for ZsnexBox and basically built around it, added to it, etc...This is the only thing I’ve ported to the Xbox and I am not a coding expert. You don’t have to be. If you have a basic understanding of C, the tools needed to compile the application, and the willingness to learn things you need (like basic Direct3D), then there is nothing stopping you from porting anything you want.

This post has been edited by nes6502: Jun 22 2006, 02:07 PM
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
wizzel
post Jun 23 2006, 12:12 AM
Post #2


X-S Enthusiast


Group: Members
Posts: 25
Joined: 24-May 06
From: Germany
Member No.: 283489
Xbox Version: v1.6
360 version: unknown



...and i thought i was a nOOb.
Now all i know is that i must be a super-duper multi-nOOb. ph34r.gif

It reminds me of coding my first CGA-emulator for the HGC Graphics Card
on the PC way back in the early 80s. laugh.gif

Especially the "until all errors are gone"-part. biggrin.gif

Anyway, nice (interesting) guide, nes! happy.gif
Keep on rocking!

This post has been edited by wizzel: Jun 23 2006, 12:17 AM
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Albino
post Jun 23 2006, 12:52 AM
Post #3


X-S Expert
***

Group: Members
Posts: 739
Joined: 27-November 03
From: West Yorkshire, UK
Member No.: 77186
Xbox Version: v1.0



I've always fancied a go at something and when I get some free time, I may have a crack at mame with a newer core, these old ones and running clrmamepro do my nut in. No doubt I will fail misserbly but I've gotta have something to do instead of my degree when I go to uni in september. I like the "repeat step 5 until all errors are gone" it reminds me of disassembling and recompiling my acpi under linux.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
nes6502
post Jun 23 2006, 01:05 AM
Post #4


X-S Freak
*****

Group: Members
Posts: 1799
Joined: 29-October 04
Member No.: 161612



Yes. Step 6 is the hard one. In fact I gave up many times when doing ZsnexBox. I was overwhelmed by the code. I thought there was no way I could pull it off. Especially since it's all assembly. But the reality is, I didn't have to change much of anything in the assembly. I just had to replace the video and input code (and change the sound code a bit).

In fact, many of the errors in the "Step 6 Loop" were easy to fix. I just commented the code out. This is whey there is no ZSNES movie support, no ZSNES png support, or jma support.

I havn't figured out how to "fix" those errors yet.

ZSNES was not considered (I don't think) by many as an "easy" port. It was my first port and I pulled it off. So I don't want pople to get bogged down with the complexity of the source material. You won't have to change or even understand 99% of it.

If they can use Direct3D to set a pixel color, play a streaming wav with DirectSound, and have an intro level C or C++ skill level, they can port anything (with enough determination).

This post has been edited by nes6502: Jun 23 2006, 01:11 AM
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Diontae18
post Jun 23 2006, 01:13 AM
Post #5


X-S Expert
***

Group: Members
Posts: 724
Joined: 12-April 04
From: Nibelheim
Member No.: 113799
Xbox Version: unk
360 version: unknown



Man I had those tools on my hdd forever, but only used them for XBMC.
This oughta be linked from VampX's great emu guide, or pinned. This lil' guide will become very useful for me, and I'm sure a lot of others. Thanks nes6502.
pop.gif
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
XaRaNn
post Jun 23 2006, 04:32 PM
Post #6


X-S X-perience
**

Group: Members
Posts: 461
Joined: 14-August 03
Member No.: 56002
Xbox Version: v1.1



I second the pinning of this thread.

Many people probably get turned off by xbox porting since it seems like a huge task, when they could probably get it done with some determination and help on the big problems.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
GogoAckman
post Jun 23 2006, 04:51 PM
Post #7


X-S Expert
***

Group: Members
Posts: 520
Joined: 21-April 04
From: Brussels
Member No.: 115468
Xbox Version: v1.4
360 version: none



QUOTE
Many people probably get turned off by xbox porting since it seems like a huge task, when they could probably get it done with some determination and help on the big problems.


True, but you should first thank xport, lantus and tmaul for their efforts in the first place, it is easy now to take a code from their emus and implant it to another code.
There s a lack in the scene, help between devs, I am always open to help someone and asked for devs to help me but there seems to be a competitions between devs and that s not serving the goal achievement.

Remember, that simple way can be the hardest too tongue.gif .
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
nes6502
post Jun 23 2006, 05:25 PM
Post #8


X-S Freak
*****

Group: Members
Posts: 1799
Joined: 29-October 04
Member No.: 161612



I can only speak from my experience. I have mainly asked for help from Xport. But I have also gotten help from GogoAckman and Cacharus.

The available code is a good point. There is a lot of code that has already been written that can almost be plugged in with little change. Even though the Xport code I use only makes up about 1% of ZsnexBox, it was a 1% that saved me a lot of time, research, and effort (like screenshot saving, zip file contents, mounting partitions, HD support).
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Carcharius
post Jun 23 2006, 06:57 PM
Post #9


X-S Expert
***

Group: Members
Posts: 635
Joined: 11-May 03
Member No.: 37299



QUOTE(nes6502 @ Jun 23 2006, 05:32 PM) *

I can only speak from my experience. I have mainly asked for help from Xport. But I have also gotten help from GogoAckman and Cacharus.

*cough* Carcharius *cough* tongue.gif
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
nes6502
post Jun 23 2006, 07:06 PM
Post #10


X-S Freak
*****

Group: Members
Posts: 1799
Joined: 29-October 04
Member No.: 161612



QUOTE(Carcharius @ Jun 23 2006, 07:04 PM) *

*cough* Carcharius *cough* tongue.gif


Sorry, I allways mispell your name. Never was a good speller
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
manlol
post Jun 24 2006, 10:52 AM
Post #11


X-S Enthusiast


Group: Members
Posts: 9
Joined: 4-December 05
Member No.: 261687



Thanks for the excellent guide nes, two questions:

1. I'm not able to get a copy of VS2003, will MS Visual C++ 6.0 Standard Edition suffice?

2. Will it be difficult to port a game which uses the Allegro library? I've always wanted to play Liquid War on my xbox.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
VampX
post Jun 24 2006, 12:14 PM
Post #12


X-S Legend
*********

Group: Moderator
Posts: 5149
Joined: 11-November 03
Member No.: 73629
Xbox Version: v1.2
360 version: none



QUOTE(Diontae18 @ Jun 23 2006, 02:20 AM) *

This oughta be linked from VampX's great emu guide, or pinned.


Since there are like as many xbox developers as there are people that can't figure out pcsxbox right?
PIN PIN PIN THERE'S ROOM NOW!!! tongue.gif


ofcourse this is going to be in the new revision of the pinned thread, but lets refrain from pinning everything again ohmy.gif

This post has been edited by VampX: Jun 24 2006, 12:14 PM
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
nes6502
post Jun 24 2006, 02:15 PM
Post #13


X-S Freak
*****

Group: Members
Posts: 1799
Joined: 29-October 04
Member No.: 161612



QUOTE(manlol @ Jun 24 2006, 10:59 AM) *

Thanks for the excellent guide nes, two questions:

1. I'm not able to get a copy of VS2003, will MS Visual C++ 6.0 Standard Edition suffice?

2. Will it be difficult to port a game which uses the Allegro library? I've always wanted to play Liquid War on my xbox.



Only VS 2003 .NET will work easilly. I'm sure it's possible to use 2005 and 6.0 but I don't know how to configure them to build the xbe. 6.0 should work depending on which version of the XDK you have (versions before 5993. But the easiest way is to use XDK 5993 with VS 2003 .NET.

For Allegro, you'll have to rewrite all the graphics code in Direct3D. So it won't be any harder than anything else that doesn't allready use Direct3D (like OpenGl, DirectDraw, etc)

This post has been edited by nes6502: Jun 24 2006, 02:19 PM
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Retroplay
post Jun 24 2006, 09:23 PM
Post #14


X-S Expert
***

Group: Members
Posts: 593
Joined: 12-December 03
From: Denmark
Member No.: 81445
Xbox Version: v1.1
360 version: v3.0 (falcon)



What about the directX sdk?
No need to install that then?

I really have to start getting into this smile.gif

This post has been edited by Retroplay: Jun 24 2006, 09:24 PM
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
GogoAckman
post Jun 24 2006, 10:02 PM
Post #15


X-S Expert
***

Group: Members
Posts: 520
Joined: 21-April 04
From: Brussels
Member No.: 115468
Xbox Version: v1.4
360 version: none



QUOTE(Retroplay @ Jun 24 2006, 10:30 PM) *

What about the directX sdk?
No need to install that then?

I really have to start getting into this smile.gif


No, the xbox uses direct3d8 version, and even a reprogrammed version of direct3d (textures and some functions differ from PC d3d, but you can have a lot of informations in the help section of the xdk smile.gif ).
User is offlineProfile CardPM
Go to the top of the page
+Quote Post





2 Pages V  1 2 >
Reply to this topicStart new topic

 

Lo-Fi Version Time is now: 22nd May 2013 - 03:56 PM