How to change this program.
Needed tools:
- Microsoft Xbox (Software) Development Kit (XDK) (a software package)
- What the XDK requires
- Windows 2000 or Windows XP. Windows 98 Second Edition WILL NOT WORK.
- Microsoft Visual Studio (It is not known by the author of this document how well Visual C++ without the rest of Visual Studio.)
The version of Visual C++ needed depends on what version
of the XDK you have.
- XDK version 4361 requires Visual Studio Service Pack 4 or 5 (not 6)
- Some versions (such as v5558 - June 2003) will require Visual Studio .NET or .NET 2003 (not just Visual Studio 6).
- An Xbox to run unsigned code, needed solely for testing
- The source code for this program
- Basic Compression Library (BCL 1.0.6 has been used and tested.)
Step 1: Creating an XBE file
Step 2: Creating a decently small XBE file
Step 3: Modifying the code
Step One: Creating an XBE File
I found the Visual C++ project files useless. Visual C++ 6.0 couldn't load
the project. Visual C++ .NET 2003 (Visual C++ 7.10) had to convert the files
from an old version. When they did, the project was converted partially into
a Windows program, and to make a long story short, it didn't work.
-
New Xbox Project
-
Make new Xbox Game:
- Visual Studio .NET 2003:
File, New, Project. Xbox Project, (give path and name), OK.
The overview screen said I was making an Xbox Game. Finish.
- Visual Studio 6.0: File, New, Project. Xbox Game.
-
Add all source files from the archive and the XDK
- Visual Studio .NET 2003:
-
Copy the files from the collection of source code, into the project's
directory. This should overwrite stdafx.cpp and .h, and XSelector.cpp.
DO NOT OVERWRITE XSelector.vcproj or XSelector.sln!
-
Project, Add Existing Item...
-
Using Visual C++ .NET 2003, I fid the following:
- Unzipped the source code (from XSelector 0.6).
-
Added the following source files:
- Menu.cpp
- Tahoma_14.cpp
- XSelector.cpp
- stdafx.cpp
- utils.cpp
- xbfont5.cpp
- xbfont_mxm.cpp
- xbresource_mxm.cpp
- Header Files:
- Menu.h
- StdString.h
- Tahoma_14.h
- XSelector.h
- stdafx.h
- utils.h
- xbfont5.h
- xbfont_mxm.h
- xbresource_mxm.h
- xntdll.h
- (did not import XKExports.h)
-
View, Solution Explorer. Right click on the "XSelector" (2nd item). Add New
Folder. Name it "Common Items". Right click the new folder. Add, Existing
items:
- \Program Files\ Microsoft Xbox SDK\ Samples\Xbox\Common\Src\xbinput.cpp
- \Program Files\ Microsoft Xbox SDK\Samples\Xbox\Common\Src\xbutil.cpp
- Visual Studio 6.0:
-
Project, Add To Project, Files. Put all files in source code package into
the project's directory. Highlight all of them in Visual C++ except for XKExports.h.
Select OK to add.
- Add \Program Files\ Microsoft Xbox SDK\ Samples\Xbox\Common\Src\xbinput.cpp and xbutil.cpp
Double click on "stdafx.h". Make sure it includes eight files, not just one.
Otherwise, the wrong stdafx.h file is being looked at: Fix this somehow
(it should be in the same Relative Path as stdafx.h)
- Add files from Basic Compression Library 1.0.6
-
Include files:
-
VS .NET 2003:
- Tools, Options, Projects, VC++ Directories. Platform: Xbox. Show Directories
for: Include Files. New Line (Ctrl-Insert, the "New Folder" icon),
\Program Files\ Microsoft Xbox SDK\ Samples\Xbox\Common\Include
- VS 6:
-
Tools, Options, Directories, Xbox, Include Files, click on the "New" icon,
\Program Files\Microsoft Xbox SDK\Samples\Xbox\Common\Include
-
Pre-Compiled Headers off
- Visual Studio .NET
- Project, XSelector Properties.
- Configuration: Make it say "All Configuration" (not "Debug").
- Configuration Properties, C/C++, Precompiled Headers.
- Change Create/Use Precompiled Header to Not Using
Precompiled Headers
-
Visual Studio 6
- Project, Settings.
- Settings for: All Configuration
- Post-Build Setup: ftp -s:textfile (have text file be an FTP script). (This has
nothing to do with Pre-Compiled Headers)
- Ensure all went okay so far.
- You should have this compile perfectly, although in VS Studio .NET 2003 the Link stage may give two
errors (and an error summary):
- error LNK2019: unresolved external symbol "class CStdStr __cdecl operator+(class CStdStr const &,class CStdStr const &)" (??H@YA?AV?$CStdStr@D@@ABV0@0@Z) referenced in function "class CStdStr __cdecl MakeFullDirPath(char const *,char const *,int)" (?MakeFullDirPath@@YA?AV?$CStdStr@D@@PBD0H@Z)
- error LNK2019: unresolved external symbol "class CStdStr __cdecl operator+(char const *,class CStdStr const &)" (??H@YA?AV?$CStdStr@D@@PBDABV0@@Z) referenced in function "unsigned long __cdecl LaunchTitle(char const *,char const *,struct _LAUNCH_DATA *)" (?LaunchTitle@@YAKPBD0PAU_LAUNCH_DATA@@@Z)
- fatal error LNK1120: 2 unresolved externals
Resolution:
- To resolve this, define __SUNPRO_CC_COMPATright
- click on the "Header Files" folder. Select
Add, Add New Item. Click on the "Header File (.h)" icon, and name the file
CStdString.h. Copy and paste the contents of StdString.h into OlStdString.h
and save.
- Once you have the contents saved in OlStdSring.h, delete all of
the contents of StdString.h and then put in the following two lines:
- #define __SUNPRO_CC_COMPAT
- #include "OlStdString.h"
- Save the file with just those two lines.
Update
-
Although I found SUNPRO_CC_COMPAT was not required in VC++ 6,
it did help make the executable smaller. As such, I
have modified other files, so this shouldn't even be
an issue anymore.
Build, Build XSelector.
Now when you build, you should get "error X1001: Could not connect to Xbox".
- Select Project, XSelector Properties.
- Configuration: Make it say "All Configuration" (not "Debug").
- Configuration Properties, Debugging, Remote Settings, Skip Deployment, Yes.
In Visual Studio 6.0, this will appear as
- "Transferring file to Xbox...xe:\Dirctory\Filename.xbe
- error M1001: No address for Xbox has been set"
To solve:
- Visual Studio .NET
- Project, Settings, Debug, General, Remove executable path and file name:
Set to something that doesn't start with xe:\.
- That didn't work. SDK documentation says to run:
cmd.exe, then xbdir -x name xe:\ (where "name" can be an IP address)
(Bad Suggestion: try the name of 127.0.0.1)
- If you are connected to an Xbox running Evolution-X RemoteX 3935, VS 6
won't report any errors, won't report any problems. However, it does
not successfully transfer the X.XBE file. If, on the other hand, you
use xbdir on an IP address that doesn't have an Xbox running Evo-X
RemoteX (like if you refer to your own machine using the common
loopback address of 127.0.0.1), the X.XBE file will still be created
but VS6 will show an error about connecting to the Xbox.
(Either way, the X.XBE file is created on your local hard drive, and
that's what matters.)
- Visual Studio 6
- No workaround for this was found. The XBE file is
created on the local system, though. Adaption was
made to the reality that there would be an error in
the build process every time. It was just hoped, with
each build, that the error would be an error
connecting to the Xbox rather than some other error.
Build, Build Selector.
Now you should see the following three lines (with some other information as well):
- Creating Xbox Image...
- ---------------------- Done ----------------------
- Build: 1 succeeded, 0 failed, 0 skipped
Enjoy the 1,822,720 bytes big XSelector.XBE.
Step Two: Creating A Decently Small XBE File
- Set configuration mode to be release, not debug.
- VS .NET 2003: Project, XSelector Properties. Configuration Manager. Active Solution Configuration. Change from Debug to Release.
- VS 6.0: Build, Set Active Configuration
-
This may change some of the other Project Properties. Hopefully earlier
you did select "All Configurations" so that "Skip Deployment" and
"Use Pre-Compiled Headers" are set correctly.
Project, Properties, Release. Xbox Image. Include Debug Info: No.
- Rebuild
- VS .NET 2003:
- Select Build, Clean XSelector. Then Build, Build XSelector.
- Or just do Build, Rebuild XSelector.
-
Enjoy a 319,488 bytes big XSelector.XBE in the RELEASE (not the DEBUG) directory.
(Note: I also did this:)
Select Project, XSelector Properties. Configuration. Release (not Debug).
Step Three: Making a better XBE file
-
Create a *.XBE designed for a retail Xbox, not a Debug Xbox. This won't matter much
for XBE's run under mod chips, but this will affect XBE's run using the retail
BIOS (such as those that get run from a saved game exploit).
-
Run XBEPatch.EXE file.xbe. This modifies file.xbe (doesn't make a new copy of the file).
-
Make an executable that xbedump.exe will like. (Note: Skip this part if you intend to use xbepack!)
(Note: Skip this part even if you don't intend to use XBEPack. This does make the
XBE un-XBEPackable, and XBEDump's tests aren't worth worrying about. VC++ seemed to
do better at making XBE's that passed XBEDump's tests even without CXBE needed.)
- Download CXBE Relinker (as named on the author's home page, but he says he for some reason likes that the program has the same number of letters as cxbx, and this program is sometimes just called CXBE)
- Make sure you can get an EXE version of your program
- Run CXBE on the *.EXE file
- The resulting *.XBE file passes XBEDump's header size test
-
Sign the code using XBEDump.EXE
- Users of any font-based hack may want the executable signed with the font hack key.
- Users of any audio hack may want the executable signed with an audio hack key.
- Users of game exploits may want the executable signed with a game exploit ("habibi") key.
It seems that the habibi keys and audio hack keys may be at least somewhat interchangable (I think
some audio hack used the habibi key). Or maybe that's just because I have used them so
often that I just forget when I use what.
Note: Don't worry about XBEDump complaining about failing XBE file integrity. XBEDump runs numerous
tests on the XBE file, and there are times when it may see something that it doesn't expect
and so XBEDump will call the file invalid. In reality, XBEDump's tests are imperfect.
-
Run XBEPack. Note that this may make the XBE less compatible.
Creating A Really Small XBE File
- Download XBEPack, version 0.2 (latest). The Win32 port seems to crash on Windows 98 Second Edition.
- I'm hoping that XBEPack will be able to work with this now.