//--------------------------------------------------------------------------------------
// XSimError
// 
// Error codes generated by XSim
// 
// Microsoft Game Studios Tools and Technology Group
// Copyright (C) Microsoft Corporation. All rights reserved.
//--------------------------------------------------------------------------------------

#pragma once

#ifndef MAKE_HRESULT
#define MAKE_HRESULT(sev,fac,code) ((HRESULT)(((unsigned long)(sev)<<31)|((unsigned long)(fac)<<16)|((unsigned long)(code))))
#endif

#define XSIM_FACILITY   0x71

// Success codes
#define XSIM_S_OK			                    S_OK

#define XSIM_S_FIRST							MAKE_HRESULT(0, XSIM_FACILITY, 0x0000)
#define XSIM_S_ALREADY_STARTED					XSIM_S_FIRST		+ 1	  // 0x00710001	   // player/recorder already started
#define XSIM_S_ALREADY_STOPPED					XSIM_S_FIRST		+ 2	  // 0x00710002	   // player/recorder already stopped
#define XSIM_S_THREAD_ALREADYRUNNING			XSIM_S_FIRST		+ 3   // 0x00710003    // The thread is already running 
#define XSIM_S_OUTOFINPUTS			            XSIM_S_FIRST		+ 4   // 0x00710004    // The sequence player is out of inputs (queue manager should stop the player)

// Error codes
#define XSIM_E_FIRST_ERROR                      MAKE_HRESULT(SEVERITY_ERROR, XSIM_FACILITY, 0x0000) 
#define XSIM_E_FAIL                             XSIM_E_FIRST_ERROR +  1   // 0x80710001    // Unspecified failure
#define XSIM_E_MEMORY                           XSIM_E_FIRST_ERROR +  2   // 0x80710002    // Out of memory   
#define XSIM_E_THREAD                           XSIM_E_FIRST_ERROR +  3   // 0x80710003    // Threading error 
#define XSIM_E_SEQUENCE_PARSE_ERROR             XSIM_E_FIRST_ERROR +  4   // 0x80710004    // Error parsing text sequence
#define XSIM_E_OPEN_FILE_FAILED                 XSIM_E_FIRST_ERROR +  5   // 0x80710005    // Couldn't open file
#define XSIM_E_READ_FILE_FAILED                 XSIM_E_FIRST_ERROR +  6   // 0x80710006    // Couldn't read from file
#define XSIM_E_WRITE_FILE_FAILED                XSIM_E_FIRST_ERROR +  7   // 0x80710007    // Couldn't write to file
#define XSIM_E_INVALID_FILE                     XSIM_E_FIRST_ERROR +  8   // 0x80710008    // Invalid file format
#define XSIM_E_XML_PARSE_ERROR                  XSIM_E_FIRST_ERROR +  9   // 0x80710009    // RandomState XML file parse error
#define XSIM_E_UNSPECIFIED_INITIAL_STATE        XSIM_E_FIRST_ERROR + 10   // 0x8071000A    // RandomState no initial state specified
#define XSIM_E_NO_CURRENT_STATE                 XSIM_E_FIRST_ERROR + 11   // 0x8071000B    // RandomState no current state set
#define XSIM_E_NO_CURRENT_CHOICE                XSIM_E_FIRST_ERROR + 12   // 0x8071000C    // RandomState no current choice set
#define XSIM_E_NO_STATES                        XSIM_E_FIRST_ERROR + 13   // 0x8071000D    // RandomState no states defined
#define XSIM_E_NO_CHOICES                       XSIM_E_FIRST_ERROR + 14   // 0x8071000E    // RandomState no choices defined in state
#define XSIM_E_NO_ACTION                        XSIM_E_FIRST_ERROR + 15   // 0x8071000F    // RandomState no action define in choice
#define XSIM_E_ASYNC_REQUIRES_BUFFER            XSIM_E_FIRST_ERROR + 16   // 0x80710010    // Asynchronous read/writes require bufsize > 0
#define XSIM_E_INVALID_HANDLE                   XSIM_E_FIRST_ERROR + 17   // 0x80710011    // Invalid handle
#define XSIM_E_NOT_INITIALIZED                  XSIM_E_FIRST_ERROR + 18   // 0x80710012    // XSimInitialize() hasn't been called
#define XSIM_E_INVALIDARG                       XSIM_E_FIRST_ERROR + 19   // 0x80710013    // Invalid argument (NULL pointer, etc)
#define XSIM_E_OUT_OF_HANDLES                   XSIM_E_FIRST_ERROR + 20   // 0x80710014    // No free handles remaining
#define XSIM_E_INVALID_USER_INDEX               XSIM_E_FIRST_ERROR + 21   // 0x80710015    // Specified a user index greater than XUSER_MAX_COUNT-1
#define XSIM_E_INVALID_PLAYER                   XSIM_E_FIRST_ERROR + 22   // 0x80710016    // Attempted an operation with component that wasn't a player
#define XSIM_E_INVALID_RECORDER                 XSIM_E_FIRST_ERROR + 23   // 0x80710017    // Attempted an operation with component that wasn't a recorder
#define XSIM_E_PLAYER_IN_USE                    XSIM_E_FIRST_ERROR + 24   // 0x80710018    // Attempted to start a player that is already in use on another port
#define XSIM_E_RECORDER_IN_USE                  XSIM_E_FIRST_ERROR + 25   // 0x80710019    // Attempted to start a player that is already in use on another port
#define XSIM_E_NO_CONNECTION                    XSIM_E_FIRST_ERROR + 26   // 0x8071001A    // Attempted to send a message to the XSim debugger extension DLL without a connection handle
#define XSIM_E_NOTIMPL                          XSIM_E_FIRST_ERROR + 27   // 0x8071001B    // Feature not implemented
#define XSIM_E_INVALID_MSG                      XSIM_E_FIRST_ERROR + 28   // 0x8071001C    // XSim Debugger extension received a debug channel message it did not understand
#define XSIM_E_NOT_SYNCHRONOUS                  XSIM_E_FIRST_ERROR + 29   // 0x8071001D    // A player or recorder was told to start synchronously on the console, but it's not a remote player!
#define XSIM_E_INVALID_STATE_NAME               XSIM_E_FIRST_ERROR + 30   // 0x8071001E    // RandomState Invalid state name  
#define XSIM_E_BUFFER_TOO_SMALL                 XSIM_E_FIRST_ERROR + 31   // 0x8071001F    // Buffer too small 
#define XSIM_E_INVALID_SYNCMODE                 XSIM_E_FIRST_ERROR + 32   // 0x80710020    // Invalid sync mode for FileRecorder or FilePlayer
#define XSIM_E_INVALID_PRESSDURATION            XSIM_E_FIRST_ERROR + 33   // 0x80710021    // Invalid press duruation supplied to queue manager
#define XSIM_E_USER_INDEX_NOT_ACQUIRED          XSIM_E_FIRST_ERROR + 34   // 0x80710022    // Attempted to use a player/recorder on an unbound user index
#define XSIM_E_ALREADY_ACQUIRED                 XSIM_E_FIRST_ERROR + 35   // 0x80710023    // Attempted to acquire a controller that is already acquired
#define XSIM_E_NOT_ACQUIRED                     XSIM_E_FIRST_ERROR + 36   // 0x80710024    // Attempted to release a controller that is not acquired
#define XSIM_E_ALREADY_INITIALIZED              XSIM_E_FIRST_ERROR + 37   // 0x80710025    // XSimInitialize() has already been called
#define XSIM_E_FILENOTFOUND                     XSIM_E_FIRST_ERROR + 38   // 0x80710026    // The file specified for the fileplayer or filerecorder was not found on the console
#define XSIM_E_CANNOTACCESS                     XSIM_E_FIRST_ERROR + 39   // 0x80710027    // The default console is locked and/or the automation PC does not have permission connect to it
#define XSIM_E_SINGLE_PLAYER_ONLY               XSIM_E_FIRST_ERROR + 40   // 0x80710028    // Only one player is allowed to be playing at any time
#define XSIM_E_SINGLE_RECORDER_ONLY             XSIM_E_FIRST_ERROR + 41   // 0x80710029    // Only one recorder is allowed to be recording at any time
#define XSIM_E_CONNECTIONLOST                   XSIM_E_FIRST_ERROR + 42   // 0x8071002A    // The connection was lost to the console.  Check network cables, etc. shut down, restart, retry
#define XSIM_E_EXTENSION_NOTFOUND               XSIM_E_FIRST_ERROR + 43   // 0x8071002B    // XSim.xex was not found on your Xbox

