Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Dominik_78

Why do I get a page fault with this in 9X

This topic is 5742 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi as the topic says, I get on Win98 a page fault if I run my app the second time on one boot. The first time is okay. on Win2k and WinXP it is fine as often as I want to run it. As you might see I took the mose right out of the Action Mapper Demo from the DX SDK 8.1 for Init I use:
  
HRESULT CSSDirectInput::InitInput( HWND hWnd )
{
	GUID g_guidApp = { 0x67131586, 0x2934, 0x4857, { 0x8a, 0x2e, 0xd9, 0x9d, 0xc2, 0xc8, 0x20, 0x68 } };
    HRESULT hr;
    // Setup action format for the actual gameplay

    ZeroMemory( &m_diafGame, sizeof(DIACTIONFORMAT) );
    m_diafGame.dwActionSize		= sizeof(DIACTION);
    m_diafGame.dwDataSize		= NUMBER_OF_GAMEACTIONS * sizeof(DWORD);
    m_diafGame.dwNumActions		= NUMBER_OF_GAMEACTIONS;
    m_diafGame.rgoAction		= g_rgGameAction;
    m_diafGame.guidActionMap	= g_guidApp;
    m_diafGame.dwGenre			= DIVIRTUAL_SPACESIM; 
    m_diafGame.dwBufferSize		= 16;
    m_diafGame.lAxisMin			= -100;
    m_diafGame.lAxisMax			= 100;
    _tcscpy( m_diafGame.tszActionMap, _T("MY Mapper") );
    m_diafGame.dwSize			= sizeof(DIACTIONFORMAT);

    // Create a new input device manager

    m_pInputDeviceManager = new CInputDeviceManager();

    hr = m_pInputDeviceManager->Create( hWnd, NULL, m_diafGame, StaticInputAddDeviceCB, this );
    if (FAILED(hr)) return DXTRACE_ERR_NOMSGBOX( TEXT("m_pInputDeviceManager->Create"), hr );
    return S_OK;
}
  
for pooling I use
        
    if( NULL == m_pInputDeviceManager )
        return;

    // Get access to the list of semantically-mapped input devices

    CInputDeviceManager::DeviceInfo* pDeviceInfos;
    DWORD dwNumDevices;
    m_pInputDeviceManager->GetDevices( &pDeviceInfos, &dwNumDevices );

    // Loop through all devices and check game input

    for( DWORD i=0; i<dwNumDevices; i++ )
    {
        DIDEVICEOBJECTDATA rgdod[10];
        DWORD   dwItems = 10;
        HRESULT hr;
        LPDIRECTINPUTDEVICE8 pdidDevice = pDeviceInfos[i].pdidDevice;
        SSInputDeviceState* pInputDeviceState = (SSInputDeviceState*) pDeviceInfos[i].pParam;

        hr = pdidDevice->Acquire();
        hr = pdidDevice->Poll();
        hr = pdidDevice->GetDeviceData( sizeof(DIDEVICEOBJECTDATA), rgdod, &dwItems, 0 );
        if( FAILED(hr) )
            continue;

        // Get the sematics codes for the game menu

        for( DWORD j=0; j<dwItems; j++ )
        {
}
}
  
for deinit I use
        
    if( NULL == m_pInputDeviceManager )
        return;

    // Get access to the list of semantically-mapped input devices

    // to delete all InputDeviceState structs

    CInputDeviceManager::DeviceInfo* pDeviceInfos;
    DWORD dwNumDevices;
    m_pInputDeviceManager->GetDevices( &pDeviceInfos, &dwNumDevices );

    for( DWORD i=0; i<dwNumDevices; i++ )
    {
        SSInputDeviceState* pInputDeviceState = (SSInputDeviceState*) pDeviceInfos[i].pParam;
        SAFE_DELETE( pInputDeviceState );
        pDeviceInfos[i].pParam = NULL;
    }

    // Cleanup DirectX input objects

    SAFE_DELETE( m_pInputDeviceManager );
  
Is there anything wrong with this? thank you. Dominik [edited by - Dominik_78 on February 2, 2003 2:35:45 PM]

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!