The reason I wrote this guide was to explain the process of porting a game or an emulator to the Xbox. You dont 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 CDs 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. Im pretty familiar with C and not very familiar with Assembly.
Step 2) Download the source code. Its 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 isnt 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 doesnt.
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 Ive ported to the Xbox and I am not a coding expert. You dont 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:43 PM