xboxscene.org forums

Pages: [1] 2

Author Topic: How to compile OpenXDK's with M$ Visual C++  (Read 91 times)

bob1122

  • Archived User
  • Jr. Member
  • *
  • Posts: 55
How to compile OpenXDK's with M$ Visual C++
« on: December 18, 2004, 08:33:00 PM »

ok well first off if this is worthy of a pin then i will edit it to make it more clear but if not than f#@$ it ....

Requirments:

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
MS Visual Studio 6 with C++
OpenXDK BINARIES (version 5 worked for me in this tutorial but as i said if it is pinned i will try to figure out for 6  yay )    http://openxdk.sourceforge.net/ we love u  caustik beerchug.gif  and edward  beerchug.gif  
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\

Allright well this is actually quite easy to do and i cannot believe that other people have not figured it out before me! but you dont care so here's the guide

1. Get your good 'ol "M$ Visual Studio 6.0 " in Visual C++ mode (must have c++ installed and working  beerchug.gif )  

2. up on top u have ur menus click the Tools scroll down one then get yourself into Options

3. You have your options up right ... well click the Directories tab.

4. now for you to get to work...
make sure that

Platform :  is Win32.... ( if u have xbox then you dont need to read this! )
and it says Show Directories For:   Include Files

now what your gonna do is click the weird box thingy beside the X  (its tag's New)
then in the box that just appered your gonna put the directory of the all the folders in the OpenXDK BINARIES folder that u extracted from the version 5 release of openxdk binaries it to.... im to lazy to specify which ones but when i put all off them it worked fine for me.....

5. now test it out then use cxbe  (instructions for cxbe are at http://www.openxdk.org/ ) to make it a Xbe

6. Have fun programing and Support OpenXDK

Note : Check my signature i know it works for that kind of xbox

Please note :  if your having problems running it on your xbox its probably because your  using x2 bios ..... iND-BiOS works for me and m7 works for other people to ....

Have fun coding and if you like this tutorial and your a code programer y doesnt someone make a good DISC player with it or a DISC Ripper. That should get some more people going to the OpenXDK side of things smile.gif

Logged

bob1122

  • Archived User
  • Jr. Member
  • *
  • Posts: 55
How to compile OpenXDK's with M$ Visual C++
« Reply #1 on: December 18, 2004, 08:36:00 PM »

could a moderator rename the title to


"How to compile OpenXDK's with M$ Visual C++"
and the Details as " A little Tutorial"

Thanks allot
Logged

HoRnEyDvL

  • Administrator
  • Sr. Member
  • *****
  • Posts: 462
How to compile OpenXDK's with M$ Visual C++
« Reply #2 on: December 18, 2004, 10:31:00 PM »

Pinned smile.gif nice guide, Also renamed.  Hope to see some open source legal apps been developed now.
Logged

bob1122

  • Archived User
  • Jr. Member
  • *
  • Posts: 55
How to compile OpenXDK's with M$ Visual C++
« Reply #3 on: December 19, 2004, 10:42:00 AM »

thanks and 50% of the reason for me writing this is because i could not get cygwin working and didnt feel like running linux again .... so i figured out how to do it for M$ compilers yay.... Now all those genius brains out there can go to work laugh.gif
Logged

freakdave

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 284
How to compile OpenXDK's with M$ Visual C++
« Reply #4 on: December 23, 2004, 04:13:00 PM »

It would be very cool if someone would post a (noob-proof) step by step tutorial and a download with a little code sample(preferably some very simple SDL examples) including all corresponding/appropriate project files.

Okay,so here's my problem:
I've started a win32 project > console application > empty project (I'm using the latest VS.net)
Code Generation : Single Threaded
All includes and libraries are properly set up in the options.
I've already fixed the 'typedef int bool' bug in types.h
Oh,and i'm using OpenXDK 0.06 (i hope this ain't the problem)..

My code :
CODE

#pragma comment(lib, "libhal.a")
#pragma comment(lib, "libopenxdk.a")
#pragma comment(lib, "libSDL.a")
#pragma comment(lib, "libSDL.la")
#pragma comment(lib, "libSDLmain.a")
#pragma comment(lib, "libusb.a")
#pragma comment(lib, "libxboxkrnl.a")

#pragma comment(lib, "crt0.o")
#pragma comment(lib, "libc.a")
#pragma comment(lib, "libg.a")
#pragma comment(lib, "libm.a")
#pragma comment(lib, "libnosys.a")

#include

 void XBoxStartup()

{
    HalReturnToFirmware(ReturnFirmwareFatal);
    return;
}


Compiling this sample gives me this error:

CODE
OXDK_TEST error LNK2019: Nicht aufgelöstes externes Symbol '_main', verwiesen in Funktion '_mainCRTStartup'

OXDK_TEST fatal error LNK1120: 1 unaufgelöste externe Verweise

in english : unresolved external symbol in function and 1 unresolved external reference(XBoxStartup?)
So how can i fix this ?
Any help would be greatly appreciated.
Logged

d0wnlab

  • Archived User
  • Sr. Member
  • *
  • Posts: 326
How to compile OpenXDK's with M$ Visual C++
« Reply #5 on: December 23, 2004, 11:41:00 PM »

It's 2am but I might as well post the best hint I have..

I'm pretty sure what happens in the xbe startup is that,

crt0 contains the actual startup main() function (edit: or, actually, WinMainCRTStartup.. look at the linker options below..) .  It calls your provided XBoxStartup() after setting up the environment.  So, the corresponding error is that crt0 not linking to your current code properly, or that your linker is looking for a main() (which prolly doesn't exist) instead of a WinMainCRTStartup() (which exists in crt0.a)  Check your project linker options?  I dunno, the translation is kinda vague.

why this is? beyond my knowledge, I don't use VC or windows or.. anything like that.. so..

Just a question.. is anyone sure this works?  When I'm using mingw32 gcc I include parameters such as:

(cflags) -ffreestanding -nostdlib -fno-builtin -fno-exceptions -mno-cygwin -march=i386
(linker flags)

CLINK = -nostdlib
ALIGN = -Wl,--file-alignment,0x20 -Wl,--section-alignment,0x20
SHARED = -shared
ENTRYPOINT = -Wl,--entry,_WinMainCRTStartup
STRIP = -Wl,--strip-all
LD_FLAGS = $(CLINK) $(ALIGN) $(SHARED) $(ENTRYPOINT) $(STRIP)
LD_DIRS = -L/usr/local/openxdk/i386-pc-xbox/lib -L/usr/local/openxdk/lib
LD_LIBS  = $(LD_DIRS) -lSDL_image -lSDL -lm -lopenxdk -lhal -lc -lhal -lc -lusb -lxboxkrnl

(for an exact copy check the makefile in the samples src directory in the openxdk tree)

I'm just wondering if you're really going to get this working without realigning your startup and whatnot..

also freakdave just fyi, C++ isn't fully supported yet, there's no new and delete operators.  You should be able to compile with a c++ compiler anyways just stay in C.  Might help to pragma "C" around it all too or whatever..  I dunno.  Good luck, I'm interested in how it goes..

also imho, it's easier just using cygwin or mingw32 & msys (msys rocks; native bash for windows)..
Logged

bob1122

  • Archived User
  • Jr. Member
  • *
  • Posts: 55
How to compile OpenXDK's with M$ Visual C++
« Reply #6 on: December 26, 2004, 08:54:00 AM »

QUOTE(TNHitokiri @ Dec 24 2004, 07:44 PM)
Is there a way to make this work with Visual Studio .Net ?
Logged

bob1122

  • Archived User
  • Jr. Member
  • *
  • Posts: 55
How to compile OpenXDK's with M$ Visual C++
« Reply #7 on: December 26, 2004, 09:01:00 AM »

aww ..... i cant upload .... hey hornydevil can i be a a leader here?
Logged

bitblaster

  • Archived User
  • Newbie
  • *
  • Posts: 44
How to compile OpenXDK's with M$ Visual C++
« Reply #8 on: January 09, 2005, 06:58:00 AM »

he just said yes it will work with .NET

My question:

Can I compile .XBE's with just my PC alone or do I need that second tool?
Logged

bob1122

  • Archived User
  • Jr. Member
  • *
  • Posts: 55
How to compile OpenXDK's with M$ Visual C++
« Reply #9 on: January 27, 2005, 07:53:00 PM »

allright u shaddy obisities, here ya go

how to compile xbe with .net

--------------------------------------------------------------------
 OpenXDK - MS Visual Studio .NET - Installation Instructions
--------------------------------------------------------------------

 This document describes the process which should be used if you
 wish to develop "homebrew" software for the XBox using OpenXDK.

 Information is as precise and correct as I can make it, but feel
 free to submit suggestions. After all, OpenXDK is an open source
 project, and our success relies on community contributions.

------------------------------------------------------------------
 Table of Contents
------------------------------------------------------------------

 1) Installation

    a) Download
    cool.gif Unzip
    c) Build

 2) Development

    a) Creating a New Project
    cool.gif Removing "Debug" Configuration
    c) Setting Compiler and Linker Options
    d) Setting Required Directories
    e) Configuring CXBE for Custom Build
    f) Adding XBoxStartup
    g) Building Your Project

------------------------------------------------------------------
 Information
------------------------------------------------------------------

 1) Installation

    a) Download

    To download the latest OpenXDK files, go to the OpenXDK web site
    displayed below, and locate the appropriate download file(s).

    http://openxdk.sourceforge.net/

    Hint: You want "OpenXDK" and perhaps one of the Samples.

    cool.gif Unzip

    OpenXDK is distributed in .zip format. After downloading OpenXDK,
    the next step is to decompress the .zip file into a directory of
    your choice. The preferred directory is C:\OpenXDK, but you may
    put these files wherever you wish. The only requirment is that
    you must remember where this directory is.

    c) Build

    Building OpenXDK is very easy. The decompressed folder (C:\OpenXDK)
    contains a file called OpenXDK.sln. To build OpenXDK, simply open
    this workspace with MS Visual Studio .NET, and then build the
    projects.

    Note: To build, click Build->Build Solution.

 2) Development

    a) Creating a New Project

    There are some specific steps that must be taken when creating a
    project for use with OpenXDK. Primarily, Compiler and Linker options
    must be tweaked, and 3 directories must be added to the compiler's
    search path. The details on how to configure these options are
    explained in detail below.

    The first step is to create a new project. This can be done by
    opening MS Visual Studio .NET and creating a new Win32
    project and workspace. This can be done via File->New->Project.
    The type of project you will want to create is "Win32 Project".
    It does not matter where you put your project files, as we will add
    the necessary directories for includes, lib, and binaries later
    in this tutorial.

    After you click OK, you will be asked what type of windows
    application you would like to create. You should click on the tab
    marked "Application Settings", and make sure "Windows Application"
    in chosen, then check the box next to "Empty Project". Then, click
    "Finish".

    Now that you have a new project, you will need to modify a few of
    the default options before your .exe will relink correctly. The
    exact options that need to be changed are described next.

    cool.gif Removing "Debug" Configuration

    Since you can not use "Debug" configuration with OpenXDK, it is
    recommended that you remove this configuration completely. To do
    this, use the menu Build->Configuration Manager, and in the drop
    down boxed titled "Active Solution Configuration", choose "<Edit...>"
    In the window that comes up, select "Debug", and push "Remove".
    Then click Yes on the confirmation dialog that comes up next. Once
    this is done you can close the "Edit Solution Configurations" dialog,
    and the "Configurations Manager" dialog.

    c) Setting Compiler and Linker Options.

    Compiler options are accessed through the menu Project->Properties.

    The first set of options we are concerned about are located under
    the "C/C++" folder. First, switch to the category titled "Code Generation"
    and set "Enable C++ Exceptions" to "no". Then, set "Buffer Security ChecK"
    to "no". Optionally, you might want to go to the category marked
    "Optimization" and switch "Optimize for Processor" to "Pentium Pro and Above".

    The next set of options we need to change are located under the
    "Linker" folder. Switch to the category titled "Input". You will need
    to set the box marked "Ignore All Default Libraries" to "Yes". Then,
    under "Additional Dependencies", you should paste the following:

    xboxkrnl.lib xlibc.lib xhal.lib xvga.lib

    Next, you will need to add a few linker options by switching to the
    category titled "Command Line" and typing directly into the box marked
    "Additional Options". Add the following text to the very end of the
    existing text:

    /align:0x20 /driver /fixed:no

    Failure to do this correctly will result in linker errors, and you
    will not be able to compile your .xbe correctly. You can copy and
    paste the text exactly as it is above, but you must be absolutely
    certain to paste the text at the very end of the text in the box.

    After you have added these settings, just click "OK".

    d) Setting Required Directories

    In order for your code to compile and link correctly, you will need
    to add a few paths to your configuration. To add these directories,
    you can use the menu Tools->Options. Then, click over to the folder
    named "Projects". Click on the category marked "VC++ Directories" and
    add the following paths to the appropriate directory list. (You change
    between directory lists using the drop down under "Show Directories for:"

    "Include files" -> C:\OpenXDK\include\
    "Library files" -> C:\OpenXDK\lib\
    "Executable files" -> C:\OpenXDK\bin\

    You must be sure to add these directories to the correct choice under
    the drop down box titled "Show directories for:". Your paths may be
    different, depending on where you chose to unzip the OpenXDK files.

    After you have added these settings, just click "OK".

    e) Configuring CXBE for Custom Build

    Now, you must configure your project to use CXBE as a custom build step.
    This is the process that is used to convert your .exe file to an .xbe
    file that is compatible with the XBox. To configure this setting, you can
    use the menu Project->Properties, then switch to "Custom Build Step".

    Inside the box marked "Description", you can put whatever you like, but
    I usually use the following text:

    Relinking $(InputName).exe -> default.xbe

    Inside the box marked "Command Line" you will need to use the following text:

    cxbe -TITLE:"CXBX Demo" -OUT:"$(TargetDir)default.xbe" "$(TargetPath)"

    You will probably want to replace the phrase "CXBX Demo" with the title
    you want to use for your program.

    Inside the box marked "Outputs" you will need to use the following text:

    $(TargetDir)\default.xbe

    After you have added these settings, just click "OK".

    f) Adding XBoxStartup

    The last requirement to complete your project configuration is to include
    a valid entry point for your application. Typically, the below code is a
    good place to start development from:

#include <openxdk.h>

void XBoxStartup()
{
    HalReturnToFirmware(ReturnFirmwareFatal);
    return;
}

    Note: After you run the above code, your xbox will go to the "fatal" boot
    screen. It is ok, nothing is harmed, it is simply a demonstration of what
    OpenXDK can do. (Your Xbox will be back to normal after rebooting).

    g) Building Your Project

    If everything went well, you now have a valid project, and you can
    immediately start developing. Try building your project containing
    only the simple entry point as shown above, and if all goes well,
    your build will succeed and the file "default.xbe" will be created.

    You should be able to run this executable on a modded xbox.








bob1122 have fun reading . and someone let me edit my post
Logged

d0wnlab

  • Archived User
  • Sr. Member
  • *
  • Posts: 326
How to compile OpenXDK's with M$ Visual C++
« Reply #10 on: January 27, 2005, 08:19:00 PM »

see bob this is why i disliked you posting this in the first place.

the above information is totally wrong, and will not work.  All it does is gets peoples hopes up to use openxdk with visual studio and it won't work, and then they don't bother trying cygwin because they already tried and failed with visual studio.  to begin with there is no .sln project file in openxdk anymore, hasn't been for a long time.  Namely, it was gotten rid of when the openxdk moved from Visual Studio to gcc toolchains.  Long since gone.  Check the cvs.  It ain't there.

your libraries are all wrong too.. we don't use the xlib* libs anymore (if ever, im unsure..)

In fact I'm pretty sure you cut and pasted this from somewhere else because quite simply I've never seen you make sentences this well, and most of it matches info from years ago.
Logged

nangsyde

  • Archived User
  • Newbie
  • *
  • Posts: 12
How to compile OpenXDK's with M$ Visual C++
« Reply #11 on: January 28, 2005, 01:42:00 AM »

QUOTE(d0wnlab @ Jan 28 2005, 04:50 AM)
In fact I'm pretty sure you cut and pasted this from somewhere else because quite simply I've never seen you make sentences this well
Logged

xenonmodz

  • Archived User
  • Jr. Member
  • *
  • Posts: 82
How to compile OpenXDK's with M$ Visual C++
« Reply #12 on: February 02, 2005, 08:20:00 AM »

hahah nice d0wnlab
Logged

bob1122

  • Archived User
  • Jr. Member
  • *
  • Posts: 55
How to compile OpenXDK's with M$ Visual C++
« Reply #13 on: February 04, 2005, 08:23:00 PM »

QUOTE(d0wnlab @ Jan 28 2005, 03:25 AM)
see bob this is why i disliked you posting this in the first place.



what are you a moderator
Logged

fghjj

  • Archived User
  • Sr. Member
  • *
  • Posts: 288
How to compile OpenXDK's with M$ Visual C++
« Reply #14 on: February 05, 2005, 12:28:00 PM »

QUOTE(bob1122 @ Feb 5 2005, 03:29 AM)
what are you a moderator
Logged
Pages: [1] 2