Ejemplo n.º 1
0
        public static int JoyInit()
        {
            if (s_initialized)
            {
                JoyReset();
            }
            s_initialized = true;
            int num_joydev = (int)win32.joyGetNumDevs();

#if DEBUG
            cadencii.debug.push_log("winmmhelp.JoyInit");
            cadencii.debug.push_log("    num_joydev=" + num_joydev);
#endif
            if (num_joydev <= 0)
            {
                num_joydev = 0;
                return(num_joydev);
            }
            s_joy_attatched = new bool[num_joydev];
            s_joycaps       = new JOYCAPSW[num_joydev];
            int count = 0;
            for (int k = 0; k < num_joydev; k++)
            {
                JOYINFO ji = new JOYINFO();
                if (win32.joyGetPos((uint)k, ref ji) == win32.JOYERR_NOERROR)
                {
                    s_joy_attatched[k] = true;
                    JOYCAPSW jc = new JOYCAPSW();
                    win32.joyGetDevCapsW((uint)k, ref jc, (uint)Marshal.SizeOf(jc));
                    s_joycaps[k] = jc;
                    count++;
                }
                else
                {
                    s_joy_attatched[k] = false;
                }
            }
            if (count > 0)
            {
                s_joy_available = new int[count];
                int c = -1;
                for (int i = 0; i < num_joydev; i++)
                {
                    if (s_joy_attatched[i])
                    {
                        c++;
                        if (c >= count)
                        {
                            break; //ここに来るのはエラー
                        }
                        s_joy_available[c] = i;
                    }
                }
            }
            s_num_joydev = (uint)count;
            return((int)s_num_joydev);
        }
Ejemplo n.º 2
0
        public static uint joyGetPos(uint uJoyID, ref JOYINFO pji)
        {
            uint ret = MMSYSERR_ERROR;

            if (status_winmm != DllStatus.NotFound)
            {
                try {
                    ret = __joyGetPos(uJoyID, ref pji);
                } catch (DllNotFoundException ex) {
                    status_winmm = DllStatus.NotFound;
                }
            }
            return(ret);
        }
Ejemplo n.º 3
0
        public static int JoyInit() {
            if ( s_initialized ) {
                JoyReset();
            }
            s_initialized = true;
            int num_joydev = (int)win32.joyGetNumDevs();
#if DEBUG
            cadencii.debug.push_log( "winmmhelp.JoyInit" );
            cadencii.debug.push_log( "    num_joydev=" + num_joydev );
#endif
            if ( num_joydev <= 0 ) {
                num_joydev = 0;
                return num_joydev;
            }
            s_joy_attatched = new boolean[num_joydev];
            s_joycaps = new JOYCAPSW[num_joydev];
            int count = 0;
            for ( int k = 0; k < num_joydev; k++ ) {
                JOYINFO ji = new JOYINFO();
                if ( win32.joyGetPos( (uint)k, ref ji ) == win32.JOYERR_NOERROR ) {
                    s_joy_attatched[k] = true;
                    JOYCAPSW jc = new JOYCAPSW();
                    win32.joyGetDevCapsW( (uint)k, ref jc, (uint)Marshal.SizeOf( jc ) );
                    s_joycaps[k] = jc;
                    count++;
                } else {
                    s_joy_attatched[k] = false;
                }
            }
            if ( count > 0 ) {
                s_joy_available = new int[count];
                int c = -1;
                for ( int i = 0; i < num_joydev; i++ ) {
                    if ( s_joy_attatched[i] ) {
                        c++;
                        if ( c >= count ) {
                            break; //ここに来るのはエラー
                        }
                        s_joy_available[c] = i;
                    }
                }
            }
            s_num_joydev = (uint)count;
            return (int)s_num_joydev;
        }
Ejemplo n.º 4
0
 public static uint joyGetPos( uint uJoyID, ref JOYINFO pji ) {
     uint ret = MMSYSERR_ERROR;
     if ( status_winmm != DllStatus.NotFound ) {
         try {
             ret = __joyGetPos( uJoyID, ref pji );
         } catch ( DllNotFoundException ex ) {
             status_winmm = DllStatus.NotFound;
         }
     }
     return ret;
 }
Ejemplo n.º 5
0
 private static extern uint __joyGetPos( uint uJoyID, ref JOYINFO pji );
Ejemplo n.º 6
0
 private static extern uint __joyGetPos(uint uJoyID, ref JOYINFO pji);