1515using System . Text . RegularExpressions ;
1616using System . Timers ;
1717using System . Windows . Forms ;
18- //using VJoyLibrary; // deprecated - vjoy by Headsoft
1918using WiimoteLib ;
2019
2120namespace WiiBalanceWalker
@@ -28,7 +27,6 @@ public partial class FormMain : Form
2827 ActionList actionList = new ActionList ( ) ;
2928 Wiimote wiiDevice = new Wiimote ( ) ;
3029 DateTime jumpTime = DateTime . UtcNow ;
31- //VJoy joyDevice = null; // deprecated - vjoy by Headsoft
3230
3331 bool setCenterOffset = false ;
3432 bool resetCenterOffsetPossible = false ;
@@ -50,10 +48,6 @@ private void FormMain_Load(object sender, EventArgs e)
5048
5149 infoUpdateTimer . Elapsed += new ElapsedEventHandler ( infoUpdateTimer_Elapsed ) ;
5250
53- // Setup a timer which prevents a VJoy popup message. // deprecated - Headsoft vJoy
54-
55- // joyResetTimer.Elapsed += new ElapsedEventHandler(joyResetTimer_Elapsed); // deprecated - Headsoft vJoy
56-
5751 // Load trigger settings.
5852
5953 numericUpDown_TLR . Value = Properties . Settings . Default . TriggerLeftRight ;
@@ -200,7 +194,6 @@ private void button_Connect_Click(object sender, EventArgs e)
200194 if ( checkBox_AutoTare . Checked )
201195 zeroout . PerformClick ( ) ;
202196
203-
204197 break ;
205198 }
206199 }
@@ -247,9 +240,6 @@ private void InfoUpdate()
247240 var rwBottomRight = wiiDevice . WiimoteState . BalanceBoardState . SensorValuesKg . BottomRight ;
248241 var aButton = wiiDevice . WiimoteState . ButtonState . A ;
249242
250- float temp = rwTopLeft + rwTopRight + rwBottomLeft + rwBottomRight ; // todo temp, I already see it's working fine so should be deleted.
251- sumup . Text = temp . ToString ( "0.0" ) ; // todo
252-
253243 // The alternative .SensorValuesRaw is meaningless in terms of actual weight. not adjusted with 0KG, 17KG and 34KG calibration data.
254244
255245 //var rwTopLeft = wiiDevice.WiimoteState.BalanceBoardState.SensorValuesRaw.TopLeft - wiiDevice.WiimoteState.BalanceBoardState.CalibrationInfo.Kg0.TopLeft;
@@ -468,11 +458,6 @@ private void InfoUpdate()
468458
469459 if ( Double . IsNaN ( joyX ) ) joyX = 0.0 ; // send the dead center value if not enough weight is on the board
470460 if ( Double . IsNaN ( joyY ) ) joyY = 0.0 ;
471-
472- // Set new values.
473- //joyDevice.SetXAxis(0, (short)joyX); // deprecated - headsoft vJoy
474- //joyDevice.SetYAxis(0, (short)joyY);
475- //joyDevice.Update(0);
476461 }
477462
478463 if ( ! checkBox_Send4LoadSensors . Checked )
@@ -483,36 +468,10 @@ private void InfoUpdate()
483468
484469 if ( checkBox_ShowValuesInConsole . Checked )
485470 {
486- //Console.WriteLine(values, "formMain");
487471 BalanceWalker . FormMain . consoleBoxWriteLine ( values ) ;
488472 }
489473 VJoyFeeder . Setjoystick ( ( int ) joyX , ( int ) joyY , ( int ) ( rwTopLeft * 100 ) , ( int ) ( rwTopRight * 100 ) , ( int ) ( rwBottomLeft * 100 ) , ( int ) ( rwBottomRight * 100 ) , aButton ) ;
490474 }
491-
492- /*
493- // Deprecated - Headsoft's vjoy code
494- {
495- // Uses Int16 ( -32767 to +32767 ) where 0 is the center. Multiplied by 2 because realistic usage is between the 30-70% ratio.
496-
497- var joyX = (brX * 655.34 + -32767.0) * 2.0;
498- var joyY = (brY * 655.34 + -32767.0) * 2.0;
499-
500- // Limit values to Int16, you cannot just (cast) or Convert.ToIn16() as the value '+ - sign' may invert.
501-
502- if (joyX < short.MinValue) joyX = short.MinValue;
503- if (joyY < short.MinValue) joyY = short.MinValue;
504-
505- if (joyX > short.MaxValue) joyX = short.MaxValue;
506- if (joyY > short.MaxValue) joyY = short.MaxValue;
507-
508- // Set new values.
509-
510- joyDevice.SetXAxis(0, (short)joyX);
511- joyDevice.SetYAxis(0, (short)joyY);
512- joyDevice.Update(0);
513- } // Deprecated - Headsoft's vjoy code
514- */
515-
516475 }
517476
518477 private void checkBox_EnableJoystick_CheckedChanged ( object sender , EventArgs e )
@@ -534,46 +493,6 @@ private void checkBox_EnableJoystick_CheckedChanged(object sender, EventArgs e)
534493 checkBox_SendCGtoXY . Enabled = status ;
535494 checkBox_Send4LoadSensors . Enabled = status ;
536495 }
537- /* {
538- // Start joystick emulator.
539-
540- try
541- {
542- joyDevice = new VJoy();
543- joyDevice.Initialize();
544- joyDevice.Reset();
545- joyDevice.Update(0);
546- }
547- catch (Exception ex)
548- {
549- // VJoy.DLL missing from .EXE folder or project built as 'Any CPU' and DLL is 32-bit only.
550-
551- infoUpdateTimer.Enabled = false;
552- MessageBox.Show(ex.Message, "VJoy Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
553- }
554-
555- joyResetTimer.Enabled = true;
556-
557- // Show reminder ( if not being changed by load settings ) and save settings.
558-
559- var isChecked = ((CheckBox)sender).Checked;
560- if (isChecked)
561- {
562- if (Properties.Settings.Default.EnableJoystick == false)
563- {
564- MessageBox.Show("Actions still apply! Set 'Do Nothing' for any movement conflicts.\r\n\r\nRequires Headsoft VJoy driver to be installed.", "Reminder", MessageBoxButtons.OK, MessageBoxIcon.Information);
565- }
566- }
567- Properties.Settings.Default.EnableJoystick = isChecked;
568- Properties.Settings.Default.Save();
569- }*/ // Deprecated - Headsoft's vjoy code
570-
571-
572-
573- /* void joyResetTimer_Elapsed(object sender, ElapsedEventArgs e) // Deprecated - Headsoft vjoy
574- {
575- joyDevice.Initialize();
576- }*/
577496
578497 private void FormMain_FormClosing ( object sender , FormClosingEventArgs e )
579498 {
0 commit comments