Exemplo n.º 1
0
 /**
  * Scans the pool object and pulls out information about the abc file
  * placing it in the AbcFile
  */
 void Debugger::scanResources(AbcFile* file, PoolObject* pool)
 {
     // walk all methods
     for(uint32_t i=0, n = pool->methodCount(); i<n; i++)
     {
         MethodInfo* f = pool->getMethodInfo(i);
         if (f->hasMethodBody())
         {
             // yes there is code for this method
             if (f->abc_body_pos())
             {
                 // if body_pos is null we havent got the body yet or
                 // this is an interface method
                 scanCode(file, pool, f);
             }
         }
     }
 }
Exemplo n.º 2
0
HRESULT
ProcessKeyboardDI8( TDI8Data* data )
{        
        DIDEVICEOBJECTDATA* eventptr;
        UInt32 i=0;

        /* Check for keyboard input and fill buffer */
        DWORD dwItems( KEYBOARD_BUFFERSIZE );
        data->hr = data->pDIKeybrd->GetDeviceData( sizeof( DIDEVICEOBJECTDATA ) ,
                                                   &data->keyboardBuffer[ 0 ]   ,  /* our event buffer */
                                                   &dwItems                     ,  /* in the buffer size, out the read count */
                                                   0                            ); /* remove items when read */
        
        data->hr = data->pDIKeybrd->Acquire();
        
        if ( SUCCEEDED( data->hr ) )
        {
                for ( i=0; i<dwItems; ++i )
                {
                        UINT scanCode(0);
                        eventptr = &data->keyboardBuffer[ i ];
                        MapDIKeyToScancode( eventptr->dwOfs, &scanCode );

                        if ( KEYBOOL( eventptr->dwData ) )
                        { 
                              //  data->callbacks.onKeyboardKeyDown( data->callbacks.userData, scanCode );
                              
                           /*     UINT scanCode(0);
                                BYTE charCode(0);
                                if ( 0 != MapDIKeyToScancode( eventptr->dwOfs, &scanCode ) )
                                {
                                        if ( 0 != MapScanCodeToChar( scanCode, &charCode ) )
                                        {
                                                data->callbacks.onKeyboardKeyDown( data->callbacks.userData, charCode );
                                        }
                                } */
                                                            
                               
                              data->callbacks.onKeyboardKeyDown( data->callbacks.userData, 0, (KeyCode)scanCode, data->keyModState );
                        }
                        else
                        {
                               // UINT scanCode(0);
                              //  MapDIKeyToScancode( eventptr->dwOfs, &scanCode );                                 
                              //  data->callbacks.onKeyboardKeyUp( data->callbacks.userData, scanCode );
                              
                              data->callbacks.onKeyboardKeyUp( data->callbacks.userData, 0, (KeyCode)scanCode, data->keyModState );
                        }
                }
                return S_OK;
        }
        else
        {
                if ( data->hr == DIERR_INPUTLOST )
                {
                        // we lost contact with the device, attempt to recover
                        data->hr = data->pDIKeybrd->Acquire();
                        while( data->hr == DIERR_INPUTLOST )
                        {
                                data->hr = data->pDIKeybrd->Acquire();
                        }
                }
                else
                if ( data->hr == DI_BUFFEROVERFLOW )
                {
                        /* Check for keyboard input and fill buffer */
                        UInt8 keystatebuffer[ 256 ];
                        data->hr = data->pDIKeybrd->GetDeviceState( 256                    ,
                                                                   (LPVOID) &keystatebuffer ); 
                                                
                        if ( SUCCEEDED( data->hr ) ) 
                        { 
                                /* compare the current state with our buffered state and attempt to compensate event wise */
                                UInt32 i;
                                for ( i=0; i<256; ++i )
                                {
                                        if ( keystatebuffer[ i ] != data->keystatebuffer[ i ] )
                                        {
                                                if ( KEYBOOL( keystatebuffer[ i ] ) )
                                                {
                                                        data->keybuffer[ i ] = 1;
                                                        data->callbacks.onKeyboardKeyDown( data->callbacks.userData, 0, (KeyCode)i, data->keyModState );        
                                                }
                                                else
                                                {
                                                        data->keybuffer[ i ] = 0;
                                                        data->callbacks.onKeyboardKeyUp( data->callbacks.userData, 0, (KeyCode)i, data->keyModState );
                                                }                                                        
                                        }
                                }          
                        }                        
                }
                return E_FAIL;                        
        }      
}