| CODE |
#include "launch.h"
#include // sprintf(..) /* Description: Launch another XBE by unmounting then remounting D:
Detail: If you want to launch another XBE (say you have a menu program) - you have to first map the D: drive to the location of the XBE you are launching or else it won't be able to find its media files.
You have to first unmount the D: drive, then re-mount it to the correct device and subdirectory. Then simply call your XBE. */
#ifdef _XBOX
// Hidden Kernal Functions #define IN typedef struct _UNICODE_STRING {unsigned short Length; unsigned short MaximumLength; PSTR Buffer;} UNICODE_STRING,*PUNICODE_STRING; extern "C" XBOXAPI DWORD WINAPI IoCreateSymbolicLink(IN PUNICODE_STRING SymbolicLinkName,IN PUNICODE_STRING DeviceName); extern "C" XBOXAPI DWORD WINAPI IoDeleteSymbolicLink(IN PUNICODE_STRING SymbolicLinkName); extern "C" XBOXAPI DWORD WINAPI XapiMapLetterToDirectory(IN LPCSTR pcDriveString,IN LPCSTR pcPathString,IN DWORD pcszTitleId,IN bool fCreateDirectory,IN LPCSTR pcszTitleName,IN bool fUpdateTimestamp);
// Unmount the old D: drive static void UnmountD() { char szDestinationDrive[16]; strcpy(szDestinationDrive,"\\??\\D:");
UNICODE_STRING LinkName = { strlen(szDestinationDrive), strlen(szDestinationDrive) + 1, szDestinationDrive};
IoDeleteSymbolicLink(&LinkName); }
// Mount the D: drive to a given device and directory // szDevice = "Cdrom0" or "Harddisk0\Partition6" // szDir = "" or "Game1" static void MountD(char* szDevice, char* szDir) { char szSourceDevice[256]; char szDestinationDrive[16];
strcpy(szDestinationDrive,"\\??\\D:"); sprintf(szSourceDevice,"\\Device\\%s",szDevice); if (*szDir != 0x00 && *szDir != '\\') { strcat(szSourceDevice, "\\"); strcat(szSourceDevice, szDir); }
UNICODE_STRING LinkName = { strlen(szDestinationDrive), strlen(szDestinationDrive) + 1, szDestinationDrive }; UNICODE_STRING DeviceName = { strlen(szSourceDevice), strlen(szSourceDevice) + 1, szSourceDevice };
IoCreateSymbolicLink(&LinkName, &DeviceName); }
// szDevice = the device where the XBE is "Cdrom0" // szDir = the subdirectory where your xbe is "Games\Game1" // szFile = the name of your XBE (without the path) - "Game1.xbe" void RunXbe (char* szDevice, char* szDir, char* szFile) { char szXbePath[64]; wsprintf(szXbePath,"D:\\",szFile);
UnmountD(); MountD(szDevice, szDir); XLaunchNewImage(szXbePath, NULL ); }
#else
void RunXbe (char* szDevice, char* szDir, char* szFile) { //Start a standard exe here for pc version  }
#endif //_XBOX |
Now i call the function no problems at all and can pass my variables accross but i get a error. .xbe could not be booted.. I know its something so small.. any whizzes around?? Im not that bad a coder on xbox but this ones got me stumped..
My app is nearly finished too but i need to get this working!!
Heres how i call it:
Im just trying to call another xbe for a test.. Its really the same app at the moment!
anyway, thanks for any help guys,
l8r
forahobby
http://www.xbox-hq.com