@@ -211,6 +211,8 @@ public byte[] GetData() {
211211
212212 bool toRumble = Boolean . Parse ( ConfigurationSettings . AppSettings [ "EnableRumble" ] ) ;
213213
214+ public MainForm form ;
215+
214216 public Joycon ( IntPtr handle_ , bool imu , bool localize , float alpha , bool left , int id = 0 , bool isPro = false , bool usb = false ) {
215217 handle = handle_ ;
216218 imu_enabled = imu ;
@@ -243,7 +245,7 @@ public void ReceiveRumble(object sender, Nefarius.ViGEm.Client.Targets.Xbox360.X
243245 public void DebugPrint ( String s , DebugType d ) {
244246 if ( debug_type == DebugType . NONE ) return ;
245247 if ( d == DebugType . ALL || d == debug_type || debug_type == DebugType . ALL ) {
246- Console . WriteLine ( s ) ;
248+ form . console . Text += s + " \r \n " ;
247249 }
248250 }
249251 public bool GetButtonDown ( Button b ) {
@@ -285,7 +287,7 @@ public int Attach(byte leds_ = 0x0) {
285287 Subcommand ( 0x03 , new byte [ ] { 0x3f } , 1 , false ) ;
286288
287289 a = Enumerable . Repeat ( ( byte ) 0 , 64 ) . ToArray ( ) ;
288- Console . WriteLine ( "Using USB." ) ;
290+ form . console . Text += "Using USB.\r \n " ;
289291
290292 a [ 0 ] = 0x80 ;
291293 a [ 1 ] = 0x01 ;
@@ -378,7 +380,7 @@ private int ReceiveRaw() {
378380 }
379381
380382 if ( ts_en == raw_buf [ 1 ] ) {
381- Console . WriteLine ( "Duplicate timestamp enqueued." ) ;
383+ form . console . Text += "Duplicate timestamp enqueued.\r \n " ;
382384 DebugPrint ( string . Format ( "Duplicate timestamp enqueued. TS: {0:X2}" , ts_en ) , DebugType . THREADING ) ;
383385 }
384386 ts_en = raw_buf [ 1 ] ;
@@ -399,7 +401,7 @@ private void Poll() {
399401 attempts = 0 ;
400402 } else if ( attempts > 1000 ) {
401403 state = state_ . DROPPED ;
402- Console . WriteLine ( "Dropped" ) ;
404+ //form.console.Text += "Dropped\r\n" ;
403405 DebugPrint ( "Connection lost. Is the Joy-Con connected?" , DebugType . ALL ) ;
404406 break ;
405407 } else {
@@ -609,7 +611,7 @@ public void Begin() {
609611 PollThreadObj = new Thread ( new ThreadStart ( Poll ) ) ;
610612 PollThreadObj . Start ( ) ;
611613
612- Console . WriteLine ( "Starting poll thread." ) ;
614+ form . console . Text += "Starting poll thread.\r \n " ;
613615 }
614616 }
615617
@@ -675,13 +677,13 @@ private void dump_calibration_data() {
675677 bool found = false ;
676678 for ( int i = 0 ; i < 9 ; ++ i ) {
677679 if ( buf_ [ i ] != 0xff ) {
678- Console . WriteLine ( "Using user stick calibration data." ) ;
680+ form . console . Text += "Using user stick calibration data.\r \n " ;
679681 found = true ;
680682 break ;
681683 }
682684 }
683685 if ( ! found ) {
684- Console . WriteLine ( "Using factory stick calibration data." ) ;
686+ form . console . Text += "Using factory stick calibration data.\r \n " ;
685687 buf_ = ReadSPI ( 0x60 , ( isLeft ? ( byte ) 0x3d : ( byte ) 0x46 ) , 9 ) ; // get user calibration data if possible
686688 }
687689 stick_cal [ isLeft ? 0 : 2 ] = ( UInt16 ) ( ( buf_ [ 1 ] << 8 ) & 0xF00 | buf_ [ 0 ] ) ; // X Axis Max above center
@@ -698,13 +700,13 @@ private void dump_calibration_data() {
698700 found = false ;
699701 for ( int i = 0 ; i < 9 ; ++ i ) {
700702 if ( buf_ [ i ] != 0xff ) {
701- Console . WriteLine ( "Using user stick calibration data." ) ;
703+ form . console . Text += "Using user stick calibration data.\r \n " ;
702704 found = true ;
703705 break ;
704706 }
705707 }
706708 if ( ! found ) {
707- Console . WriteLine ( "Using factory stick calibration data." ) ;
709+ form . console . Text += "Using factory stick calibration data.\r \n " ;
708710 buf_ = ReadSPI ( 0x60 , ( ! isLeft ? ( byte ) 0x3d : ( byte ) 0x46 ) , 9 ) ; // get user calibration data if possible
709711 }
710712 stick2_cal [ ! isLeft ? 0 : 2 ] = ( UInt16 ) ( ( buf_ [ 1 ] << 8 ) & 0xF00 | buf_ [ 0 ] ) ; // X Axis Max above center
0 commit comments