Kodi Community Forum
IR-Remote code from XBMC? - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93)
+--- Thread: IR-Remote code from XBMC? (/showthread.php?tid=7470)



- snowmanx - 2004-11-21

why would a program i am writing freeze at this line of code (it compiles nicely, but freezes when i run the program)?

this is the first part of my continuous for() loop in xbapp.cpp
Quote: // run the game loop, animating and rendering frames
   for(;; )
   {
       // this code exists purely to trigger a fastcap profile.
       // it disappears in debug and release builds.
       cxbsimplefastcapprofile profile;
       // a fastcap profile could also be triggered via controller input.
       if ( xbprofiling_isfastcaprequested() )
           profile.beginprofiling();

       //-----------------------------------------
       // handle input
       //-----------------------------------------
xbinput_getinput( m_ir_remote );
log("zeromemory try 1\n");
zeromemory( &m_defaultir_remote, sizeof(m_defaultir_remote) );                   <--------------------- freezes here
log("finished zeromemory try 1\n");

for( dword i=0; i<4; i++ )
{
if( m_ir_remote[i].hdevice)
{
m_defaultir_remote.wbuttons        = m_ir_remote[i].wbuttons;
}
}

       // read the input for all connected gamepads
       xbinput_getinput( m_gamepad );

       // lump inputs of all connected gamepads into one common structure.
       // this is done so apps that need only one gamepad can function with
       // any gamepad.
       zeromemory( &m_defaultgamepad, sizeof(m_defaultgamepad) );

Quote:zeromemory( &m_defaultir_remote, sizeof(m_defaultir_remote) );

i continually log stuff, so i am certain the program is freezing here at that certain zeromemory function. when i completely remove all the remote code from the for loop, it compiles and runs smoothly.  when i just remove the zeromemory line from below the log("zeromemory try 1\n") line the program can't display any text, but it renders the first screen, which is just a gradient background with some boxes.



this is in my xbapp.h
Quote:    // members to init the xinput devices.
   xdevice_prealloc_type* m_inputdevicetypes;
   dword                  m_dwnuminputdevicetypes;
   xbgamepad*             m_gamepad;
   xbgamepad              m_defaultgamepad;

   xbir_remote            m_ir_remote[4];
   xbir_remote            m_defaultir_remote;

i also have the xbirremote.h, xbinputex.h, and xbinputex.cpp straight from the xbmc source. i hope i made this as easy to reaad as possible, thanks for any help!