Skip to content

Commit 73d3a40

Browse files
committed
Merge branch 'thumbbehavior'
2 parents abf0ca3 + 3a9709f commit 73d3a40

File tree

4 files changed

+16
-15
lines changed

4 files changed

+16
-15
lines changed

XMapLib/DelayManager.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,10 @@ namespace sds::Utilities
1919
DelayManager& operator=(const DelayManager& other) = default;
2020
DelayManager& operator=(DelayManager&& other) = default;
2121
~DelayManager() = default;
22-
/// <summary>
23-
/// Operator<< overload for std::ostream specialization,
22+
/// <summary>Operator<< overload for std::ostream specialization,
2423
/// writes more detailed delay details for debugging.
2524
/// Thread-safe, provided all writes to the ostream object
26-
/// are wrapped with std::osyncstream!
27-
/// </summary>
25+
/// are wrapped with std::osyncstream!</summary>
2826
friend std::ostream& operator<<(std::ostream& os, const DelayManager& obj) noexcept
2927
{
3028
std::osyncstream ss(os);
@@ -35,9 +33,7 @@ namespace sds::Utilities
3533
<< "[/DelayManager]";
3634
return os;
3735
}
38-
/// <summary>
39-
/// Check for elapsed.
40-
/// </summary>
36+
/// <summary>Check for elapsed.</summary>
4137
bool IsElapsed() noexcept
4238
{
4339
if (std::chrono::high_resolution_clock::now() > (m_start_time + std::chrono::microseconds(m_duration)))
@@ -47,6 +43,7 @@ namespace sds::Utilities
4743
}
4844
return false;
4945
}
46+
/// <summary>Reset delay for elapsing.</summary>
5047
void Reset(size_t microsec_delay) noexcept
5148
{
5249
m_start_time = std::chrono::high_resolution_clock::now();

XMapLib/MouseMapper.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ namespace sds
4949
/// This will start processing if the stick is something other than "NEITHER"
5050
/// **Arbitrary values outside of the enum constants will not be processed successfully.**</summary>
5151
/// <param name="info"> a StickMap enum</param>
52-
void SetStick(const StickMap info)
52+
void SetStick(const StickMap info) noexcept
5353
{
5454
if (m_stickmap_info != info)
5555
{
@@ -74,7 +74,7 @@ namespace sds
7474
/// <summary>Setter for sensitivity value.</summary>
7575
/// <returns> returns a std::string containing an error message
7676
/// if there is an error, empty string otherwise. </returns>
77-
std::string SetSensitivity(const int new_sens)
77+
std::string SetSensitivity(const int new_sens) noexcept
7878
{
7979
if (!MouseSettings::IsValidSensitivityValue(new_sens))
8080
{
@@ -115,7 +115,7 @@ namespace sds
115115
}
116116
protected:
117117
/// <summary>Worker thread, protected visibility, gets updated data from ProcessState() function to use.
118-
/// Accesses the std::atomic m_thread_x and m_thread_y members.</summary>
118+
/// Accesses the std::atomic m_thread_x and m_thread_y members. chrono lib instances may throw exceptions.</summary>
119119
void workThread(sds::LambdaArgs::LambdaArg1& stopCondition, sds::LambdaArgs::LambdaArg2&, int&)
120120
{
121121
ThumbstickToDelay xThread(this->GetSensitivity(), m_local_player, m_stickmap_info, true);

XMapLib/MouseMoveThread.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace sds
2525
([this](sds::LambdaArgs::LambdaArg1& stopCondition, sds::LambdaArgs::LambdaArg2& mut, auto& protectedData) { workThread(stopCondition, mut, protectedData); });
2626
}
2727
public:
28-
MouseMoveThread()
28+
MouseMoveThread() noexcept
2929
{
3030
InitWorkThread();
3131
m_workThread->StartThread();
@@ -37,7 +37,7 @@ namespace sds
3737
MouseMoveThread& operator=(MouseMoveThread&& other) = delete;
3838
/// <summary>Called to update mouse mover thread with new microsecond delay values,
3939
/// and whether the axis to move should move positive or negative.</summary>
40-
void UpdateState(const size_t x, const size_t y, const bool isXPositive, const bool isYPositive, const bool isXMoving, const bool isYMoving)
40+
void UpdateState(const size_t x, const size_t y, const bool isXPositive, const bool isYPositive, const bool isXMoving, const bool isYMoving) noexcept
4141
{
4242
m_x_axis_delay = x;
4343
m_y_axis_delay = y;

XMapLibSharp/Form1.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ right click -> outlining -> collapse to definitions */
1818
public partial class Form1 : Form
1919
{
2020
private const int DelayRedrawMs = 1000; // a whole second
21-
private const string ErrNotRunning = "Started, but not running.";
22-
private const string ErrPresetButtonStatus = "Error toggling preset button selected status.";
2321
private const string ErrUpdatingMaps = "Error updating maps!";
2422
private const string MsgStartMouse = "Start Mouse Processing";
2523
private const string MsgStopMouse = "Stop Mouse Processing";
@@ -82,7 +80,7 @@ private void InitDataGridView()
8280
dataGridView1.Columns.Add(col5);
8381
this.dataGridView1.DataSource = _currentKeymaps;
8482
}
85-
83+
/// <summary>Init preset buttons and add to the GUI</summary>
8684
private void InitPresetButtons()
8785
{
8886
_presets = KeymapPresetOperations.BuildPresetButtons();
@@ -102,30 +100,36 @@ private void InitPresetButtons()
102100
KeymapPresetOperations.ChangeButtonTextForSelected(btn, true);
103101
}
104102
}
103+
/// <summary>Starts running the background thread that updates the GUI elements.</summary>
105104
private void InitBackgroundWorker()
106105
{
107106
bgWorkThread.RunWorkerAsync(SynchronizationContext.Current);
108107
}
108+
/// <summary>Helper to update the datagridview to a new List of keymaps.</summary>
109109
private void UpdateKeymapDatagrid(List<XMapLibKeymap> newMaps)
110110
{
111111
dataGridView1.AutoGenerateColumns = false;
112112
_currentKeymaps = newMaps;
113113
dataGridView1.DataSource = newMaps;
114114
}
115+
/// <summary>Updates mouse sensitivity trackbar value based on mapper's internal reported value.</summary>
115116
private void UpdateMouseSensitivityTrackbar()
116117
{
117118
trackBar1.Value = _mapper.GetMouseSensitivity();
118119
}
120+
/// <summary>Helper to update the status of the controller being connected.</summary>
119121
private void UpdateControllerConnectedButton()
120122
{
121123
bool isConnected = _mapper.IsControllerConnected();
122124
button2.Text = isConnected ? MsgController : MsgNocontroller;
123125
button2.BackColor = isConnected ? _clrNormal : _clrInfo;
124126
}
127+
/// <summary>Helper to update the sensitivity value displayed on the button.</summary>
125128
private void UpdateMouseSensitivityButton()
126129
{
127130
btnSensitivityIndicator.Text = MsgSensbegin + " " + _mapper.GetMouseSensitivity().ToString() + MsgSensmax;
128131
}
132+
/// <summary>Helper to update the status of the mouse movement processing based on the mapper's internal status and update the button text.</summary>
129133
private void UpdateIsMouseRunning()
130134
{
131135
bool isRunning = _mapper.IsMouseRunning();

0 commit comments

Comments
 (0)