Help - Search - Members - Calendar
Full Version: Compiling My First .xbe
Scenyx Entertainment Community > Xbox1 Forums > Software Forums > Development
ressurectionx
Does anybody post here anymore?

I've got everything up now. XDK Dashboard - check, Visual Studio .NET 2003 - check, XDK 5933 - check....

So... I have a version of MAME binaries I was trying to compile first. I figured I'd start with compiling because I can teach myself all the coding I want, but if I can't compile a build and upload it then it's worthless to me. Ummmmmm.... yeah. Over 7,000 errors and nearly 1,000 warnings. Not good. Maybe a little to advanced for me to start out with. I figure since it's binaries of a well known version of MAME already being used on the XBox, this shouldn't be happening, but I know so little about it at this point that I couldn't even begin to speculate why.

So, I decided to get back to basics. Using the XDK help provided with XDK 5933 I found a help item which gives instructions to take a crappy little source in their help files that you can compile into an .xbe and get to run on your XBox. I figured what better way to start teaching myself how to do this, right?

Well... the instructions are different than the actual menu options available. At one point it actually tells you to use an option named "Build xxxxx .xbe". Ain't no such thing, at least I don't see it anywhere.

I've been at this for about 4 days now and I'm getting frustrated enough to give up. I can't seem to find any decent documentation for programming and compiling for the XBox and all of the help threads in the stickied thread above are apparently closed for business now that it's 2008 and almost 5 years after most of those posts. The only one that is still alive is http://www.xbdev.net/ and they don't tell me anything about compiling.

Anybody have any input on how to compile or any good links to XDK programming that I can use to get started? I can give exact examples of the problems I'm having when I'm at home, but I'd like to see first if anybody is still here that knows anything about XBox development. Doesn't look like anyone hardly posts here anymore.

Thanks ahead of time,
~Rx
korn_16_f_t_l
would love to help u out on this one but im not quite that far yet im workin on my primary xbox right now
but i do plan to be at the XDK stage eventually if u get to frustrated put it down and go on to ure
2nd project or somthing itll come to ya outta no where that how i figure out most things
ressurectionx
Cool man. Looking forward to hearing what you have to say about it when you get set up. I can always go back to my PSX compatibility list in the mean time. I haven't given up yet, but it's just getting real frustrating. It's been about 8 years since I coded anything. Everything is so much different today. Better, I'm sure.... but without somebody to point you in the right direction it's a little overwhelming.
ressurectionx
Maybe I'm not using the right part of the program. Here's the helpfile for XBE Step by Step.

There is not a single instruction that I can follow correctly because my options given to me are different than what the instructions are telling me. I can open up an XBox game, but I have to open an XBox project first, and then specify XBox game. Under "Writing some code" I can eventually open the "Vertices.cpp", but I have to follow different instructions given. By the time I get to the part where it tells me to link a library those commands don't even exist.

"Select Project / Link from the Visual C++ IDE menu and add "d3d8d.lib" to the Object/Library Modules."

There is no "Link" option under "Project"

I can't even compile a BS help file. Anybody around here who can help? I saw about 50 views on this topic. Love to hear what you have to say.


QUOTE
XBE Step by Step
Once you have properly installed the Xbox SDK, you can start developing Xbox titles. The steps below will take you through the process of creating and running an XBE.

Set up the Development Environment
As long as you have properly installed the Xbox SDK on your development system and used the recovery CD to image your target machine, there is nothing further to install. Make sure that you have set your target system's machine name (per the XDK Launcher topic) so that your development system can find your target system on the network.

Create the Xbox Game Project
Launch the Visual C++ IDE on your development system and create a new Xbox Game project. Select File / New / Projects / Xbox Game from the Visual C++ IDE menu. Enter "first" for the Project Name, enter "C:\first" for the Location, select OK, and then click OK again. You now have a new Xbox Game project.

Write Some Code
You will need some source code to compile. To save time, just add the Vertices tutorial source to your project by selecting Project / Add to Project / Files. Navigate to the "\Samples\Xbox\Graphics\Tutorials\Tut02_Vertices" directory (under the Xbox SDK directory) and select "Vertices.cpp". Click OK to add the file to your project.

The Vertices tutorial relies on d3d8d.lib. To make sure that library gets linked into your program, you'll need to change the project settings. Select Project / Link from the Visual C++ IDE menu and add "d3d8d.lib" to the Object/Library Modules. Before you click OK to accept the changes, you'll need to edit a few more settings.

Click the Xbox Image tab of the Project Settings dialog box. Select Title Info for the Category. Enter "0x00000001" for Title ID, enter "My First XBE" for Title Name, and enter "Joe Publisher" for Publisher Name.

That's it. You can now click OK and accept these project settings.

Build the XBE
Select Build / Build first.xbe from the Visual C++ IDE menu to build your XBE. You should have 0 errors and 0 warnings.

Copy the XBE to the Target System
Assuming the machine name of your target system is "xdk-target", you can copy your XBE to the target system by opening a Windows command prompt and issuing the following commands:

xbmkdir -x xdk-target xE:\first
xbcp C:\first\Debug\first.xbe xE:\first
xbreboot

The call to XbReboot is optional—if the XDK Launcher is running on the target system, you don't need to do a remote reboot.

Launch the XBE
On the target system, navigate to your newly created XBE ("My First XBE (FIRST)") in the XDK Launcher and select it by pressing the A button on the controller. You should see a colorful triangle. You have just created your first Xbox executable.


ressurectionx
Okay..... new question.

Did anybody here ever post about anything other than getting XDK on their XBox? I have gone through 24 pages of the development scene (all the way back to June of '05) and 2/3rds of the posts are about XDK. Was this forum ever used for actual developing of games or porting or is it just people who got as far as I have and quit?

If there is somewhere else that I would be better off going please let me know.


Semi-useful links I've found so far for my own future reference:

Development FAQ:
http://forums.xbox-scene.com/index.php?showtopic=559728

Faq about getting the XDK to work:
http://forums.xbox-scene.com/index.php?showtopic=517226

Where to get started programming for the XBox:
http://forums.xbox-scene.com/index.php?showtopic=45477

Help My Project Builds....but, Black Screen:
http://forums.xbox-scene.com/index.php?showtopic=440552

Need a little explanations and Help: (Regarding debug screenshots)
http://forums.xbox-scene.com/index.php?showtopic=439141

How do I launch a Game from XDK Launcher? An error occured loading an XBOX .exe:
http://forums.xbox-scene.com/index.php?showtopic=431764


Other Cool XBox things:
Sleep Timer in XBMC
http://forums.xbox-scene.com/index.php?showtopic=441349
openxdkman
Coders who used to have fun with xbox1 are now playing with ps3's and 360's. It's normal...

I still have things to do with xbox1 myself, but I'm on openxdk side. I can't help with (dark) xdk side.
ressurectionx
Thanks for the reply openxdkman. I was starting to think it was a ghost town in here....

I'm pretty much ob'd to the Dark Side at this particular moment in time, but if I ever do see the light I'll look you up and hopefully you'll still be around to lend a few helpful words of advice cool.gif



Got to page 28 and found a few more worthwhile reads....

Compiling Oxdk With Visual C++"
http://forums.xbox-scene.com/index.php?showtopic=399456

Creating A Game, Help!:
http://forums.xbox-scene.com/index.php?showtopic=399234

XDI (XBOX Debug Installer) Released, yay! (Supposedly this works on v1.6 XBoxes on the 3rd page on.)
http://forums.xbox-scene.com/index.php?showtopic=392292

Need Help: Changing from Vectors to lists, polymorphism problems:
http://forums.xbox-scene.com/index.php?showtopic=395058

Let XDK Boot Software from the F Drive:
http://forums.xbox-scene.com/index.php?showtopic=392586
ekszbox
QUOTE(ressurectionx @ Mar 8 2008, 02:37 AM) *


"Select Project / Link from the Visual C++ IDE menu and add "d3d8d.lib" to the Object/Library Modules."

There is no "Link" option under "Project"


Click the project in the 'Solution Explorer' (On the right of the IDE)
Project -> 'projectname' Properties -> Linker -> Input

By the way the d3d8d.lib should be included by default.


Your compile problems with arcades are possibly due to files like xbapp/xbfont/xbinput etc. not being found, if that's the case then try the following:

Note: While there may be better ways to fix this, here is how I've managed tacked said problem before.


Add this directory:
Microsoft Xbox SDK\Samples\Xbox\Common\Include

To here:
Project -> 'projectname' C/C++ -> General -> Additional Include Directories
(Remember to first click the project in the 'Solution Explorer' or make sure it's already selected)


If that doesn't fix it, then try this afterwards:

-Remove all the common include files from the project (using solution explorer)
Don't forget to make a note of all the ones you removed.

-Right click the folder in solution explorer that the common files were in
-Click add -> add existing item
-Add all the cpp/h files from here:
Microsoft Xbox SDK\Samples\Xbox\Common\Include
Microsoft Xbox SDK\Samples\Xbox\Common\Src




KM



solarx
My problem is I can't get remote debugging to work. I have XDK 5933 and I think I have it all installed correctly.. I'm using a font hack to run PBL which loads my debug bios which in turn runs the XDK dash. I can compile the XDK samples inside Visual Studio .NET and it even gets as far as deploying it to the Xbox (after setting up the Xbox in the Xbox neighborhood) but then it hangs and eventually gives an error that it cannot start the program. I can go to the Xbox and start it manually on the debug dash but then when I try to attach to the process from Visual Studio I get an error that it cannot attach.

Everything works in Xbox neighborhood, I can even launch titles remotely, but not from Visual Studio, and I cannot attach to it to debug at all.

I have tried a bunch of different debug BIOS's but the result is the same every time. Is there some debug server I don't have installed correctly or something like that?

Thanks in advance for any help.
ressurectionx
Hey ekzsbox,

As always, thanks for the help man. I'll give that a shot when I have more than a few minutes to devote to it. Probably on Sunday....

Hey solarx,

Looks like you're a few steps ahead of me there. I'll let you know what I know when I get to that point. Maybe ekzsbox has had similar problems at some point or can give you some advice. Good luck... and let us know what you did to fix it if you figure it out before I get to that point.

Maybe you can give me a step-by-step on compiling the XDK samples since you've gotten that far cool.gif

~Rx
solarx
PC installation:

I'm using the 5933 XDK. I have Vista on this PC so to avoid any problems with that I installed Windows XP SP2 inside VMware, but if you have an XP PC that would be just as good. The readme states that you need either 'Visual Studio .NET Professional' (2002, .NET 1.0) or 'Visual Studio .NET 2003 Professional' (.NET 1.1). Now being that I was experimenting with this stuff I figured I'd try using VS 2005 or VS 2008 but the installer doesn't recognize them. I tried VS 2003 next and it worked, however I was having the remote debug problem. Thinking that it might be because I was using 2003 I uninstalled everything and installed VS 2002. I also applied a service pack to it, and immediately after I found out that the XDK will not install anymore, it needs the original unpatched version, so don't install any service packs. So anyhow, after uninstalling everything again I reinstalled VS 2002, installed the XDK, then ran the shortcut that said something like ..setup xbox shell extension.. and that created the Xbox neighborhood icon for me. At that point I could add my xbox by typing its IP address (name didn't work). After successfully setting all this up, start VS 2002 and open "C:\Program Files\Microosft Xbox SDK\Samples\Xbox\Graphics\Tutorials\Tut01_CreateDevice\createdevice.sln". You should be able to just hit F5 and see it build (it will say it's out of date first). See screenshot linked at bottom.. I would recommend using VS 2002 because when I was doing it with VS 2003 it prompted me to upgrade every sample I opened, so I guess it was meant to be used with 2002.

Xbox installation:

I basically used the chart in here: http://www.hydras-world.com/index.php?page=xboxretailtodebug
My XDK came with 2 files.. XDKSetup5933.exe ( this is what I installed on the PC ) and XDKRecovery5933External.exe ( this is what I had to unpack with winrar and it contains the Xbox files )

IPB Image
ressurectionx
Cool. Thanks for the explanation. I don't have time to reply now, but I will tonight. I am using 2003 myself with service pack 1. I found out that if you use the command prompt in the directory it's in and type the name of the .exe file with an "/s" after it, it will install the XDK with a service pack. Everything I've read says to use 2003, so I would try it with that. Who knows though? Maybe you were able to do it because you had 2002 instead. The instructions for XDK don't match up with the options available to you in the tool bar, so maybe XDK's help files were written for 2002 and that would be easier.

Gotta run. Talk to you later. We'll figure this all out.

~Rx
ekszbox
To solarx,
I've had that problem before, i think it might be a connection issue.
See if you can still connect to the xbox via Xbox Neighborhood, if not check out the debug dashboard/PC network settings.
If that's not the issue, maybe it's your debug BIOS or the XDKRecovery files.

I think RX had issues using the files from 'XDKRecovery5933External', if all else fails maybe try 'Complex BiOS Retail To Debug 4627' instead.


KM
solarx
ekszbox:

I installed 'COMPLEX BiOS Retail to Debug 4627' like you're saying on my Xbox (this package did not come with the PC portion of the XDK). I converted the provided BIOS to BFM by unpacking and repacking it using xbtool and loaded it with PBL after carefully copying the necessary Xdk dash files to C and E (while maintaining my current font exploit/evox). The XDK dash looks different but I can still manage it with the 5933 XDK Xbox Neighborhood. Unfortunately everything is the same including the problem with remote debugging.

The thing is, even though Visual Studio is having problems starting the application, I can right click the .xbe in Xbox Neighborhood and select 'Launch' and this works fine, I can see it running on my Xbox. I can even go to Processes... on the menu inside Visual Studio and see the xbe running on the xbox (after selectin Xbox Consoles transport). When I try to 'Attach' to the process I get an error that it cannot attach, no further details. I can actually sit there and refresh Xbox Neighborhood while Visual Studio is "copying files to the xbox" and see it working, so I think the connection is ok.

I think my problem is either with the 5933 XDK on the PC or with the way I'm booting my Xbox. Unfortunately I don't have a modchip so I'm trying to do this with a softmod. I don't remember exactly which but I'm using a font exploit which in the end runs PBL metoo and I can add the debug BIOS as an AltRomfile so that when I boot with the tray open it comes up to the XDK dash, otherwise it goes to Evox.
ressurectionx
I've got mine on a softmodded 1.0 myself. I chose not to do the dual boot though. I have this XBox set up exactly the same way as the one I use for all of my emulators. It's Krazies Ndure exploit with XBMC as the dashboard. When I want to run the XDK all I have to do is run the default.xbe from the C:\ Drive and it boots right up through the PBL.

Not sure if it works any better than yours though at this point, since I haven't yet been able to compile a single .xbe yet to test it.

Sounds like we've all got the same software though pretty much. Don't imagine that the software is the problem.
solarx
As an update, I uninstalled my 5933 XDK on the dev PC and installed the 5849 XDK. Still using the Complex 4627 stuff on the Xbox itself (but it made no difference when I was using the 5933 stuff on Xbox aside from the way the dash looks).

I still can't remote debug, everything is pretty much the same. Does anybody know how to get a more meaningful error message from Visual Studio, or what all is required for remote debugging? Is there another component that must be installed on the Xbox, like a debug server or something? I can still Launch things in Xbox neighborhood and I can even sync the clock and everything, just can't start a program from Visual Studio or attach.

IPB Image
ressurectionx
Another forum that might be of help to us for compiling MAME...

MAME compiling board
http://www.mameworld.info/ubbthreads/postl...Board=compiling



Nevermind these... just personal notes for myself while I'm at it. I can't email to my personal address at work anymore with the new security initiatives and I'm too lazy to write all this down.

Ultimate XPort Emulators SKIN PACK & Wide Icons:
http://www.1emulation.com/forums/index.php?showtopic=24823

Try to make Mortal Kombat standalone games using XBMC as a launcher for MAME-B6.
ressurectionx
Hey ekszbox,

I followed your steps and the XBE help file and this is what I get when I try to compile. Maybe you can tell me what I'm doing wrong by looking at the output?


------ Build started: Project: Newest, Configuration: Debug Xbox ------
Compiling...
stdafx.cpp
Compiling...
vertices.cpp
Compiling...
Newest.cpp
Linking...
vertices.obj : error LNK2005: "long __cdecl InitD3D(void)" (?InitD3D@@YAJXZ) already defined in Newest.obj
vertices.obj : error LNK2005: "long __cdecl InitVB(void)" (?InitVB@@YAJXZ) already defined in Newest.obj
vertices.obj : error LNK2005: "void __cdecl Render(void)" (?Render@@YAXXZ) already defined in Newest.obj
vertices.obj : error LNK2005: _main already defined in Newest.obj
vertices.obj : error LNK2005: "struct D3DVertexBuffer * g_pVB" (?g_pVB@@3PAUD3DVertexBuffer@@A) already defined in Newest.obj
vertices.obj : error LNK2005: "struct D3DDevice * g_pd3dDevice" (?g_pd3dDevice@@3PAUD3DDevice@@A) already defined in Newest.obj
vertices.obj : error LNK2005: "struct Direct3D * g_pD3D" (?g_pD3D@@3PAUDirect3D@@A) already defined in Newest.obj
Debug/Newest.exe : fatal error LNK1169: one or more multiply defined symbols found

Build log was saved at "file://c:\Builds\Newest\Newest\Debug\BuildLog.htm"
Newest - 8 error(s), 0 warning(s)
---------------------- Done ----------------------

Build: 0 succeeded, 1 failed, 0 skipped


solarx
This is how I create a project step by step..

Open Visual Studio and on the Start Page click 'New Project'

Navigate to 'Visual C++ Projects' and scroll down to 'Xbox Project'.

IPB Image

When presented with the creation wizard, click 'Application Settings' on the left pane and check the 'Empty Project' checkbox on the right pane. If you don't, it just creates a sample application showing vertices.

IPB Image

Now right click on the 'Source Files' folder in the solution explorer and add a new .cpp file.

Include the header <xtl.h> and write some DirectX code. I wrote a real basic test that just shows a blue screen but it initializes DirectX and all..

IPB Image

Use the menu and select Build -> Build Solution. If the Xbox Neighborhood is set up right it should build and deploy to your Xbox.

IPB Image

I can't start it from Visual Studio so I had to actually use the XDK Launcher on the Xbox to start it and I got a blue screen to show up.

IPB Image

Here is the test code (this is not robust code and is not intended to demonstrate proper DirectX usage):

CODE

#include <xtl.h>

void main()
{
    LPDIRECT3D8 D3D;
    D3DPRESENT_PARAMETERS d3dpp;
    LPDIRECT3DDEVICE8 D3DDev = NULL;

    D3D = Direct3DCreate8(D3D_SDK_VERSION);
    if(D3D == NULL)
        return;

    ZeroMemory( &d3dpp, sizeof(d3dpp) );
    d3dpp.BackBufferWidth = 640;
    d3dpp.BackBufferHeight = 480;
    d3dpp.BackBufferFormat = D3DFMT_LIN_X8R8G8B8;
    d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;

    D3D->CreateDevice
    (
        0,
        D3DDEVTYPE_HAL,
        NULL,
        D3DCREATE_HARDWARE_VERTEXPROCESSING,
        &d3dpp,
        &D3DDev
    );

    if(D3DDev == NULL)
        return;

    for(;;)
    {
        D3DDev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 20, 150), 1.0f, 0);
        D3DDev->Present(NULL, NULL, NULL, NULL);
    }
}



ressurectionx
I effin did it man! cool.gif

Wish I knew what the hell I did so I could tell you solarx (And so I can do it again!). I tried compiling a ton and I finally got the vertecies to make it to debug on the console.

I tried your instructions earlier and I was getting 1 damn build error, but I used the instructions with the vertices.cpp like the XDK help file said to. I had to remove the "stdafx.cpp" and the "stdafx.h" and change the header on the main file to "#include <xtl.h>" instead of "#include <stdafx.h>".

Then I did Build Solution. Build succeeded.

QUOTE
------ Build started: Project: Try 3, Configuration: Debug Xbox ------
Project up-to-date
---------------------- Done ----------------------

Build: 1 succeeded, 0 failed, 0 skipped



I also tried Rebuild Solution. I'm not sure what this error means, but I always get it on a rebuild:

QUOTE
------ Rebuild All started: Project: Try 3, Configuration: Debug Xbox ------
Deleting intermediate files and output files for project 'Try 3', configuration 'Debug|Xbox'.
Compiling...
vertices.cpp
Linking...
Creating Xbox Image...
IMAGEBLD : warning IM1040: mismatched map file 'c:\Builds\First\Try 3\Debug\Try 3.map'
Copying files to the Xbox...

Build log was saved at "file://c:\Builds\First\Try 3\Debug\BuildLog.htm"
Try 3 - 0 error(s), 1 warning(s)
---------------------- Done ----------------------

Rebuild All: 1 succeeded, 0 failed, 0 skipped



Then I go to Debug ---> Start

My XBox flashes for a second, and then I have a picture of a blue background with a triangle that is red on top and blends to green on the bottom.

Also, my Development Environment has two new windows at the bottom of the screen with nothing in them named "Autos" and "Call Stack".


This is the .cpp I'm using in the "Source Files" in solution explorer. It's called "vertices.cpp" (Sorry ahead of time that it's not color coded like yours is. I really like your pictures and code quotes. If you tell me how to do that, I will do it for you guys to see in the future)

QUOTE
//-----------------------------------------------------------------------------
// File: Vertices.cpp
//
// Desc: In this tutorial, we are rendering some vertices. This introduces the
// concept of the vertex buffer, a Direct3D object used to store
// vertices. Vertices can be defined any way we want by defining a
// custom structure and a custom FVF (flexible vertex format). In this
// tutorial, we are using vertices that are transformed (meaning they
// are already in 2D viewport coordinates) and lit (meaning we are not
// using Direct3D lighting, but are supplying our own colors).
//
// Copyright © Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#include <xtl.h>




//-----------------------------------------------------------------------------
// Global variables
//-----------------------------------------------------------------------------
LPDIRECT3D8 g_pD3D = NULL; // Used to create the D3DDevice
LPDIRECT3DDEVICE8 g_pd3dDevice = NULL; // Our rendering device
LPDIRECT3DVERTEXBUFFER8 g_pVB = NULL; // Buffer to hold vertices

// A structure for our custom vertex type
struct CUSTOMVERTEX
{
FLOAT x, y, z, rhw; // The transformed position for the vertex
DWORD color; // The vertex color
};

// Our custom FVF, which describes our custom vertex structure
#define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZRHW|D3DFVF_DIFFUSE)




//-----------------------------------------------------------------------------
// Name: InitD3D()
// Desc: Initializes Direct3D
//-----------------------------------------------------------------------------
HRESULT InitD3D()
{
// Create the D3D object.
if( NULL == ( g_pD3D = Direct3DCreate8( D3D_SDK_VERSION ) ) )
return E_FAIL;

// Set up the structure used to create the D3DDevice.
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory( &d3dpp, sizeof(d3dpp) );
d3dpp.BackBufferWidth = 640;
d3dpp.BackBufferHeight = 480;
d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;
d3dpp.BackBufferCount = 1;
d3dpp.EnableAutoDepthStencil = TRUE;
d3dpp.AutoDepthStencilFormat = D3DFMT_D24S8;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;

// Create the Direct3D device.
if( FAILED( g_pD3D->CreateDevice( 0, D3DDEVTYPE_HAL, NULL,
D3DCREATE_HARDWARE_VERTEXPROCESSING,
&d3dpp, &g_pd3dDevice ) ) )
return E_FAIL;

// After creating the device, initial state would normally be set here.

return S_OK;
}




//-----------------------------------------------------------------------------
// Name: InitVB()
// Desc: Creates a vertex buffer and fills it with our vertices. The vertex
// buffer is basically just a chuck of memory that holds vertices. After
// creating it, we must Lock()/Unlock() it to fill it. For indices, D3D
// also uses index buffers. The special thing about vertex and index
// buffers is that the ycan be created in device memory, allowing some
// cards to process them in hardware, resulting in a dramatic
// performance gain.
//-----------------------------------------------------------------------------
HRESULT InitVB()
{
// Initialize three vertices for rendering a triangle
CUSTOMVERTEX g_Vertices[] =
{
{ 320.0f, 150.0f, 0.5f, 1.0f, 0xffff0000, }, // x, y, z, rhw, color
{ 420.0f, 330.0f, 0.5f, 1.0f, 0xff00ff00, },
{ 220.0f, 330.0f, 0.5f, 1.0f, 0xff00ffff, },
};

// Create the vertex buffer. Here we are allocating enough memory
// (from the default pool) to hold all our 3 custom vertices. We also
// specify the FVF, so the vertex buffer knows what data it contains.
if( FAILED( g_pd3dDevice->CreateVertexBuffer( 3*sizeof(CUSTOMVERTEX),
D3DUSAGE_WRITEONLY,
D3DFVF_CUSTOMVERTEX,
D3DPOOL_MANAGED, &g_pVB ) ) )
return E_FAIL;

// Now we fill the vertex buffer. To do this, we need to Lock() the VB to
// gain access to the vertices. This mechanism is required because vertex
// buffers may be in device memory.
CUSTOMVERTEX* pVertices;
if( FAILED( g_pVB->Lock( 0, 0, (BYTE**)&pVertices, 0 ) ) )
return E_FAIL;
memcpy( pVertices, g_Vertices, 3*sizeof(CUSTOMVERTEX) );
g_pVB->Unlock();

return S_OK;
}




//-----------------------------------------------------------------------------
// Name: Render()
// Desc: Draws the scene
//-----------------------------------------------------------------------------
VOID Render()
{
// Clear the backbuffer to a blue color
g_pd3dDevice->Clear( 0L, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER,
D3DCOLOR_XRGB(0,0,255), 1.0f, 0L );

// Draw the triangles in the vertex buffer. This is broken into a few
// steps. We are passing the vertices down a "stream", so first we need
// to specify the source of that stream, which is our vertex buffer. Then
// we need to let D3D know what vertex shader to use. Full, custom vertex
// shaders are an advanced topic, but in many cases the vertex shader is
// just the FVF, so that D3D knows what type of vertices we are dealing
// with. Finally, we call DrawPrimitive() which does the actual rendering
// of our geometry (in this case, just one triangle).
g_pd3dDevice->SetStreamSource( 0, g_pVB, sizeof(CUSTOMVERTEX) );
g_pd3dDevice->SetVertexShader( D3DFVF_CUSTOMVERTEX );
g_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, 1 );
}




//-----------------------------------------------------------------------------
// Name: main()
// Desc: The application's entry point
//-----------------------------------------------------------------------------
void __cdecl main()
{
// Initialize Direct3D
if( FAILED( InitD3D() ) )
return;

// Initialize the vertex buffer
InitVB();

while( TRUE )
{
// Render the scene
Render();

// Present the backbuffer contents to the display
g_pd3dDevice->Present( NULL, NULL, NULL, NULL );
}
}




ressurectionx
Hey Solarx,

Before you delete anything or try anything else, try this.

I noticed that my XBox sometimes takes a different IP address in XDK for some reason. It was originally 192.168.1.103 and now it's 192.168.1.100. Since I've gotten a compile to work, I've still never gotten XDK to transfer the new build to the XBox. I always had to go into XBMC and manually FTP the build over.

So I deleted the XBox from my XBox neighborhood and added a new one. This time I put the IP address 192.168.1.100 instead of a name. (that was what the XDK dash was saying the IP was)

After that, my builds transfer flawlessly. Really effing cool and simple updating changes this way. I never would have imagined how easy it is to make little changes with it properly configured.

Good luck!
solarx
I resolved the problem. After ressurectionx's suggestion I rechecked the networking. The workstation I was debugging from was behind NAT from the point of view of the Xbox. NAT is a way to allow a gateway to present a single address to the external side, while gatewaying for many hosts on its internal side. Anyway it didn't even occur to me that I had set it up in such a way, but while that type of gatewaying is useful for almost all casual network usage, it does not allow a host to connect back to the originator by virtue of the originator not having a network address visible to the external host.. In my case I had set up my VMware machines to be NAT'd onto my network but you could end up with this sort of situation by using a wireless router in its default configuration as well. NAT is very common since web browsing works just fine through it.

So to make a long story short, the Xbox needs to be able to connect back to the debugger host. Everything works fine with the Xbox neighborhood since this is done all through the connection from the workstation to the Xbox but debugging probably uses UDP (connectionless) or a reverse TCP connection, I didn't look into it, but it does work by placing the workstation on the same ethernet segment as the Xbox. I can even add the Xbox by name in Xbox neighborhood now (which uses some kind of broadcast windows name resolution or something I guess).

Anyway I guess I had it right the first time I set it up, I just didn't know that debugging communicated differently from the Xbox neighborhood.

I can debug remotely now!

IPB Image
ressurectionx
Pretty sweet solarx.

Now I'm looking at yours though and I don't think mine is set up perfectly yet. I have most of the functionality I think, but I have blank windows where the "Autos" and "Call Stack" on the bottom are.

My problem is, when I start a debug it gives me a "No Symbolic Information" error in a pop up. It says "'devenv.exe' does not contain debugging information. (No symbols loaded.) Click OK to debug anyway. "

Any idea how to fix that?

Right now when I make minor changes to the MAME GUI, they are reflected when I use a build command. Looks like it's connecting right and sending builds across, but it's not doing the debug because of the "Symbolic Information"

Thanks
solarx
Well.. I'm not exactly sure why that's happening, maybe the focus is on the wrong window or something - it's trying to debug devenv.exe which is the Visual Studio .NET IDE itself.

Autos are variables local to the function that's executing, it's just an easy way to see the value of all the variables.. you can expand them, drag them to the watches window, etc.

Call stack shows you how you got to where you are, the bottom most item is your entry point and the top most item is where you are right now. Both of these things only matter if execution is stopped, so you have to set a break point first, then you can step forward line by line by hitting F10.

There are other debugger windows you can open too, look around on the menus.

Try doing your build as normal, then just start the program on the Xbox using the XDK launcher or Xbox Neighborhood. Then on the menu in Visual Studio, go to Debug -> Processes... , change the Transport dropdown to Xbox Consoles, select your Xbox in the Name dropdown and select the running xbe process that shows up. Click Attach.. and you should be able to hit the Pause (II) button on the toolbar to break, or just set a breakpoint in the rendering loop code somewhere by clicking on the left side of the code editor window on the line you want. Once reached, the process will stop and the debugger should show you any automatic variables in your Autos window, call stack, etc.
ressurectionx
My thinking here actually was that it was telling me that the Development Environment couldn't find the proper debugging information/symbols needed to launch the debug when connected to the XBox. Maybe in my options somewhere I need to point to the location of these 'symbols'. I will try your idea on Sunday when I get a few days off and see if that works.

In the meantime if you can think of any options I may have forgotten to add which might have this debugging information let me know.

How's things going on your end now that you got it up and working right?


Thanks again,
~Rx
solarx
I haven't really had time to sit down and work on it lately aside from a few little hacks here and there.. Make sure you're compiling in Debug mode too (there's a dropdown in the middle of the toolbar in VS, or use the Configuration Manager)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.