xboxscene.org forums

Pages: 1 [2]

Author Topic: Compiling My First .xbe  (Read 291 times)

ekszbox

  • Archived User
  • Full Member
  • *
  • Posts: 100
Logged

ressurectionx

  • Archived User
  • Hero Member
  • *
  • Posts: 2778
Compiling My First .xbe
« Reply #16 on: March 16, 2008, 05:25:00 AM »

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.1emulatio...showtopic=24823

Try to make Mortal Kombat standalone games using XBMC as a launcher for MAME-B6.
Logged

ressurectionx

  • Archived User
  • Hero Member
  • *
  • Posts: 2778
Compiling My First .xbe
« Reply #17 on: March 16, 2008, 09:04:00 AM »

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


Logged

ressurectionx

  • Archived User
  • Hero Member
  • *
  • Posts: 2778
Compiling My First .xbe
« Reply #18 on: March 16, 2008, 04:14:00 PM »

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 );
    }
}




Logged

ressurectionx

  • Archived User
  • Hero Member
  • *
  • Posts: 2778
Compiling My First .xbe
« Reply #19 on: March 17, 2008, 02:06:00 PM »

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!
Logged

ressurectionx

  • Archived User
  • Hero Member
  • *
  • Posts: 2778
Compiling My First .xbe
« Reply #20 on: March 18, 2008, 01:38:00 PM »

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
Logged

ressurectionx

  • Archived User
  • Hero Member
  • *
  • Posts: 2778
Compiling My First .xbe
« Reply #21 on: March 20, 2008, 11:21:00 PM »

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
Logged

solarx

  • Archived User
  • Newbie
  • *
  • Posts: 4
Compiling My First .xbe
« Reply #22 on: March 21, 2008, 09:15:00 AM »

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)
Logged
Pages: 1 [2]