xboxscene.org forums

Author Topic: Manually Building An Xbe  (Read 63 times)

fghjj

  • Archived User
  • Sr. Member
  • *
  • Posts: 288
Manually Building An Xbe
« on: June 29, 2006, 02:21:00 AM »

CODE
%ProgramFiles%\MS Visual Studio .NET 2003\Common7\IDE\devenv.com xbmc.sln /build release

As for using XDK headers/libs with GCC, I believe I tried that some time ago, but I think what stopped me was that MSVC-specific stuff was used in the header files. I don't know if GCC has a compatibility mode or something.

Anyway, if your fresh-compiled PE (.exe) file meets certain requirements, you can use either imagebld.exe from the XDK or the free, open-source cxbx to make a .xbe out of it (you can find a command-line version of the latter in the OpenXDK CVS).
Logged

ugenn

  • Archived User
  • Newbie
  • *
  • Posts: 31
Manually Building An Xbe
« Reply #1 on: July 05, 2006, 09:50:00 PM »

After messing around with the headers, I'm
somewhat able to use g++ (has to be g++,
unless you don't include xtl.h). The VC linker
is still required to create the XBE though. Would
be great if someone can figure it out.

Here's what I did:
1. convert filenames of include files to lower case.
    Edit include/xbox.h to use lowercase for
    <pshpack1.h> and <poppack.h>
    This is optional, but I'm using a mingw cross
    compiler from Linux, so case sensitivity is a
    problem

2. Replace #endif __cplusplus and
    D3DCOMPILE_NOTINLINE in include/d3d8.h
    D3DCONST with static const (causes linker
    errors)

4. #define __int64 as long long. g++ does not
    support __int64.

5. Remove inline asm in include/winnt.h (or
    replace with gcc inline asm). I don't use those
    functions, so removing didn't cause any
    problems.

6. Compile using the followign compiler options:
    D_STDCALL_SUPPORTED -D_M_IX86 -
    D_WCHAR_T_DEFINED -D__forceinline=inline
    -nostdinc -nostdlib -fno-builtin -fno-exceptions
    -I <xdk include path>

7. Create main "stub" and compile using VC
    compiler. This is a workaround as g++
    'mangles' the 'main' symbol symbol so that
    it becomes ___main causing linker errors at
    the end.
    extern "C" void XMain();
    int main() { XMain(); }
    note: The entry point in the your program now has to be XMain.

Pretty kludgy, but it works for me.
Logged