Download the leaked sdk from a torrent site (It isn't hard to find).
Be aware the leaked version is quite outdated (Pre NXE) but for all intents and purposes it's fully functional and supported.
You will need to get a hold of Visual Studio 2005 SP1, install this first then install the SDK.
Browse to directory where you installed the SDK and check out source\samples\ for a wealth of information and coding examples. Please note that as far as I'm aware the SDK that was leaked to torrent sites does not include any documentation other than the samples.
When compiling the samples or any of your own code please set the release configurations to Release_LTCG NOT Debug or a lot of programs won't run on a retail console.Here's a basic layout of a program:
CODE
#include "stdafx.h"
#include
#include
VOID __cdecl main()
{
// Do some shit here
}
Chances are you don't have a dev box so you have no way of debugging, I suggest you write a simple logging function for this, I have written the one below...
CODE
void debugLog(char* output)
{
ofstream writeLog;
writeLog.open("game:\\debug.log",ofstream::app);
if (writeLog.is_open())
{
writeLog.write(output,strlen(output));
writeLog.write("\n",1);
}
writeLog.close();
}
CODE
debugLog("Executable not found on specified path:");
This will create a debug.log in the same directory as the .xex you're running. Extremely useful for figuring out how far your codes getting etc. and where it's getting caught up. You could call the function before and after every variable you set etc. if need be.
Of course chances are whatever you're coding is going to need to access files and directories elsewhere on the Xbox so we can use the following code for that (This is a very convoluted way of doing it, you can strip out a lot of the code if you want but this works - Taken from
here with the addition if returning the result so you can check if a mount or unmount was successful - returns S_OK if successful)...
CODE
/*
List of physical drive
"\\Device\\Flash"
"\\Device\\Mu1"
"\\Device\\Mu0"
"\\Device\\Cdrom0"
"\\Device\\Harddisk0\\Partition0"
"\\Device\\Harddisk0\\Partition1"
"\\Device\\Harddisk0\\Partition2"
"\\Device\\Harddisk0\\Partition3"
"\\Device\\Mass0"
"\\Device\\Mass1"
"\\Device\\Mass2"
*/
#define DEVICE_NAND_FLASH 0
#define DEVICE_MEMORY_UNIT0 1
#define DEVICE_MEMORY_UNIT1 2
#define DEVICE_CDROM0 3
#define DEVICE_HARDISK0_PART0 4
#define DEVICE_HARDISK0_PART1 5
#define DEVICE_HARDISK0_PART2 6
#define DEVICE_HARDISK0_PART3 7
#define DEVICE_USB0 8
#define DEVICE_USB1 9
#define DEVICE_USB2 10
typedef struct _STRING {
USHORT Length;
USHORT MaximumLength;
PCHAR Buffer;
} STRING;
extern "C" int __stdcall ObCreateSymbolicLink( STRING*, STRING*);
extern "C" int __stdcall ObDeleteSymbolicLink( STRING* );
HRESULT Monter( int periphPhys, char* lettreLecteur )
{
char lecteurCible[16];
sprintf_s( lecteurCible,"\\??\\%s", lettreLecteur );
char * periphOriginal;
switch( periphPhys )
{
case DEVICE_NAND_FLASH:
periphOriginal = "\\Device\\Flash";
break;
case DEVICE_MEMORY_UNIT0:
periphOriginal = "\\Device\\Mu0";
break;
case DEVICE_MEMORY_UNIT1:
periphOriginal = "\\Device\\Mu1";
break;
case DEVICE_CDROM0:
periphOriginal = "\\Device\\Cdrom0";
break;
case DEVICE_HARDISK0_PART0:
periphOriginal = "\\Device\\Harddisk0\\Partition0";
break;
case DEVICE_HARDISK0_PART1:
periphOriginal = "\\Device\\Harddisk0\\Partition1";
break;
case DEVICE_HARDISK0_PART2:
periphOriginal = "\\Device\\Harddisk0\\Partition2";
break;
case DEVICE_HARDISK0_PART3:
periphOriginal = "\\Device\\Harddisk0\\Partition3";
break;
case DEVICE_USB0:
periphOriginal = "\\Device\\Mass0";
break;
case DEVICE_USB1:
periphOriginal = "\\Device\\Mass1";
break;
case DEVICE_USB2:
periphOriginal = "\\Device\\Mass2";
break;
STRING PeriphOriginal = { strlen( periphOriginal ), strlen( periphOriginal ) + 1, periphOriginal };
STRING LienSymbolique = { strlen( lecteurCible ), strlen( lecteurCible ) + 1, lecteurCible };
return ( HRESULT ) ObCreateSymbolicLink( &LienSymbolique, &PeriphOriginal );
}
HRESULT Demonter( char* lettreLecteur )
{
char lecteurCible[16];
sprintf_s( lecteurCible,"\\??\\%s", lettreLecteur );
STRING LienSymbolique = { strlen(lecteurCible), strlen(lecteurCible) + 1, lecteurCible };
return ( HRESULT ) ObDeleteSymbolicLink( &LienSymbolique );
}
Monter(DEVICE_HARDISK0_PART1, "hdd1:");
// Function to launch new executable from code
XLaunchNewImage("hdd1:\\xexalancer.xex", NULL);
Right so now you can mount whatever hardware you need to, launch new executables from code and have a way of debugging your application.
So how do we output to the screen?
There are a number of frameworks included in the sample code, if you just want debugging text output on the screen I suggest you look at the ATGConsole framework. If you want a pretty GUI like XexLoader or Snes360 than you want to build an XUI.
The best place to start learning about XUI is by compiling and running the XuiTutorial sample (Remember set release configurations to Release_LTCG NOT Debug)
The 3 basics of XUI are:
1: Create your GUI in the Xbox UI Authoring tool (New Document) - File -> Export to binary when done.
2: Create a skin in the Xbox UI Authoring tool (New Skin) - I suggest for now you skip this step and use the default skin included in the XuiTutorial - To date all publicly released apps are using the default skin (Grey controls, green highlighted etc).
3: Load these files in code and start manipulating them. You will see how everything is done in the XuiTutorial sample.
That's all the basics for now, remember most of this is trial and error, you need at least a basic understanding of c++ and OO to do this. Knowledge of Directx9 is also an advantage (Windows/Xbox 360 implementation are extremely similar).
To speed things up you may like to create a QuickBoot container that boots usb:\dev\default.xex (as an example) so you can launch straight in to whatever you're coding without going through XexLoader. You may also like to get a usb extension cable that permanently stays plugged in to your 360 so there's no mechanical wear on the ports when you move your usb stick between Xbox and PC so often.
I'll attempt to answer any questions.
This post has been edited by dstruktiv: Jan 8 2010, 07:26 AM