Skip to content

Commit f858bc2

Browse files
committed
Fixed aiming bug and other fixes
1 parent 0abf9cb commit f858bc2

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

Source/DSAdvance/DSAdvance.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ void DefMainText(int ControllerCount, int EmuMode, int AimMode, bool ChangeModes
275275
if (EmuMode == XboxGamepadEnabled)
276276
printf(" Emulation: Xbox gamepad");
277277
else if (EmuMode == XboxGamepadOnlyDriving)
278-
printf(" Emulation: Xbox gamepad (only driving & mouse aiming)");
278+
printf(" Emulation: Xbox gamepad (only driving) & mouse aiming");
279279
else
280280
printf(" Emulation: -");
281281
printf(", press \"ALT\" + \"Q\" to switch.\n");
@@ -291,7 +291,7 @@ void DefMainText(int ControllerCount, int EmuMode, int AimMode, bool ChangeModes
291291

292292
int main(int argc, char **argv)
293293
{
294-
SetConsoleTitle("DSAdvance 0.6.1");
294+
SetConsoleTitle("DSAdvance 0.6.2");
295295
// Config parameters
296296
CIniReader IniFile("Config.ini");
297297

@@ -320,10 +320,10 @@ int main(int argc, char **argv)
320320

321321
bool AimMode = IniFile.ReadBoolean("Motion", "AimMode", false);
322322
float MotionWheelAngle = IniFile.ReadFloat("Motion", "WheelAngle", 75);
323-
float MotionSensX = IniFile.ReadFloat("Motion", "MouseSensX", 3);
324-
float MotionSensY = IniFile.ReadFloat("Motion", "MouseSensY", 3);
325-
float JoySensX = IniFile.ReadFloat("Motion", "JoySensX", 3) * 10.0f;
326-
float JoySensY = IniFile.ReadFloat("Motion", "JoySensY", 3) * 10.0f;
323+
float MotionSensX = IniFile.ReadFloat("Motion", "MouseSensX", 3) / 10.0f;;
324+
float MotionSensY = IniFile.ReadFloat("Motion", "MouseSensY", 3) / 10.0f;;
325+
float JoySensX = IniFile.ReadFloat("Motion", "JoySensX", 3);
326+
float JoySensY = IniFile.ReadFloat("Motion", "JoySensY", 3);
327327

328328
GamepadSearch();
329329
GamepadOutState.PlayersCount = 0;
@@ -339,7 +339,7 @@ int main(int argc, char **argv)
339339
int XboxGamepadEmuMode = XboxGamepadEnabled;
340340
bool XboxGamepadReset = false;
341341

342-
bool BTReset = true; // Problems with BlueTooth, on first connection. Reconnecting fixes the problem.
342+
bool GamepadReset = true; // Problems with BlueTooth, on first connection. Reset fixes this problem.
343343
int controllersCount = JslConnectDevices();
344344
int deviceID[4];
345345
JslGetConnectedDeviceHandles(deviceID, controllersCount);
@@ -378,7 +378,7 @@ int main(int argc, char **argv)
378378
printf("Y=%6.2f\n", abs(InputState.stickRY));
379379
}
380380

381-
if ( ((GetAsyncKeyState(VK_CONTROL) & 0x8000) != 0 && (GetAsyncKeyState('R') & 0x8000) != 0 && SkipPollCount == 0 ) || BTReset)
381+
if ( ((GetAsyncKeyState(VK_CONTROL) & 0x8000) != 0 && (GetAsyncKeyState('R') & 0x8000) != 0 && SkipPollCount == 0 ) || GamepadReset)
382382
{
383383
controllersCount = JslConnectDevices();
384384
JslGetConnectedDeviceHandles(deviceID, controllersCount);
@@ -387,7 +387,7 @@ int main(int argc, char **argv)
387387
GamepadSearch();
388388
GamepadSetState(GamepadOutState);
389389
SkipPollCount = SkipPollTimeOut;
390-
BTReset = false;
390+
GamepadReset = false;
391391
DefMainText(controllersCount, XboxGamepadEmuMode, AimMode, ChangeModesWithoutPress);
392392
}
393393

@@ -399,6 +399,7 @@ int main(int argc, char **argv)
399399
vigem_target_x360_unregister_notification(x360);
400400
vigem_target_remove(client, x360);
401401
} else if (XboxGamepadEmuMode == XboxGamepadEnabled || XboxGamepadEmuMode == XboxGamepadOnlyDriving) {
402+
if (XboxGamepadEmuMode == XboxGamepadOnlyDriving) AimMode = 1;
402403
ret = vigem_target_add(client, x360);
403404
ret = vigem_target_x360_register_notification(client, x360, &notification, nullptr);
404405
}
@@ -462,7 +463,7 @@ int main(int argc, char **argv)
462463
GamepadOutState.LEDBlue = 255; GamepadOutState.LEDRed = 0; GamepadOutState.LEDGreen = 0;
463464
// Show battery level
464465
GetBatteryInfo(); BackOutStateCounter = 40; GamepadOutState.PlayersCount = CurGamepad.BatteryLevel; GamepadSetState(GamepadOutState); // JslSetPlayerNumber(deviceID[0], 5);
465-
if (ResetOnDefaultMode) BTReset = true;
466+
if (ResetOnDefaultMode && SkipPollCount == 0) { SkipPollCount = SkipPollTimeOut; GamepadReset = true; }
466467
} else { // Touch sticks mode
467468
GamepadMode = TouchpadSticksMode;
468469
JslSetRumble(0, 255, 255);
@@ -474,8 +475,7 @@ int main(int argc, char **argv)
474475
if (TouchState.t0Y > 0.1 && TouchState.t0Y < 0.5) { // Motion AIM always
475476
GamepadMode = MotionAimingMode;
476477
GamepadOutState.LEDBlue = 255; GamepadOutState.LEDRed = 0; GamepadOutState.LEDGreen = 255;
477-
}
478-
else { // Motion AIM with L2 trigger
478+
} else { // Motion AIM with L2 trigger
479479
GamepadMode = MotionAimingModeOnlyPressed;
480480
GamepadOutState.LEDBlue = 0; GamepadOutState.LEDRed = 0; GamepadOutState.LEDGreen = 255;
481481
}
@@ -545,8 +545,8 @@ int main(int argc, char **argv)
545545
if (GamepadMode == MotionDrivingMode) // Motion racing [O--]
546546
report.sThumbLX = ToLeftStick(OffsetYPR(RadToDeg(MotionAngles.Roll), RadToDeg(AnglesOffset.Roll)) * -1, MotionWheelAngle);
547547
else if (GamepadMode == MotionAimingMode || GamepadMode == MotionAimingModeOnlyPressed) { // Motion aiming [--X}]
548-
float DeltaX = OffsetYPR(MotionAngles.Yaw, AnglesOffset.Yaw) * -1;
549-
float DeltaY = OffsetYPR(MotionAngles.Pitch, AnglesOffset.Pitch) * -1;
548+
float DeltaX = OffsetYPR(RadToDeg(MotionAngles.Yaw), RadToDeg(AnglesOffset.Yaw)) * -1;
549+
float DeltaY = OffsetYPR(RadToDeg(MotionAngles.Pitch), RadToDeg(AnglesOffset.Pitch)) * -1;
550550
if (GamepadMode == MotionAimingMode || (GamepadMode == MotionAimingModeOnlyPressed && InputState.lTrigger > 0) )
551551
if (AimMode)
552552
MouseMove(RadToDeg(DeltaX) * MotionSensX, RadToDeg(DeltaY) * MotionSensY);

0 commit comments

Comments
 (0)