### Jump Mode Configuration Example Source: https://context7.com/rawaccelofficial/rawaccel/llms.txt Example JSON configuration for the jump acceleration mode, specifying parameters like 'mode', 'Gain / Velocity', 'Cap / Jump', and 'smooth'. ```json { "Whole or horizontal accel parameters": { "mode": "jump", "Gain / Velocity": true, "Cap / Jump": { "x": 5, "y": 1.5 }, "smooth": 0.5 } } ``` -------------------------------- ### Applying Settings via Command Line Source: https://context7.com/rawaccelofficial/rawaccel/llms.txt Command-line examples for applying settings from a JSON file or generating a default settings file. ```bash # Apply settings from file writer.exe settings.json # Generate default settings file writer.exe # Creates settings.json with default configuration ``` -------------------------------- ### RawAccel Profile JSON Configuration Example Source: https://context7.com/rawaccelofficial/rawaccel/llms.txt Illustrates how to configure RawAccel profiles using a JSON format. This example shows settings for domain/range weights, acceleration parameters, and output DPI. ```json { "Driver settings": { "profiles": [{ "name": "default", "Stretches domain for horizontal vs vertical inputs": { "x": 1, "y": 1 }, "Stretches accel range for horizontal vs vertical inputs": { "x": 1, "y": 1 }, "Whole or horizontal accel parameters": { "mode": "classic", "acceleration": 0.005, "exponentClassic": 2 }, "Input speed calculation parameters": { "Whole/combined accel (set false for 'by component' mode)": true, "lpNorm": 2 }, "Output DPI": 1000, "Y/X output DPI ratio (vertical sens multiplier)": 1, "Degrees of rotation": 0, "Degrees of angle snapping": 0 }] } } ``` -------------------------------- ### Applying and Retrieving Driver Settings Source: https://context7.com/rawaccelofficial/rawaccel/llms.txt Example of loading settings from a JSON file, activating the configuration, and retrieving current driver settings. Ensure settings.json exists or is generated. ```csharp // Load and apply settings from file var (config, error) = DriverConfig.Convert(File.ReadAllText("settings.json")); if (error == null) { config.Activate(); // Writes to driver with 1-second delay } // Get current driver settings var active = DriverConfig.GetActive(); Console.WriteLine(active.ToJSON()); // Reset driver to defaults DriverConfig.Deactivate(); ``` -------------------------------- ### Classic Acceleration Configuration Source: https://context7.com/rawaccelofficial/rawaccel/llms.txt Example JSON configuration for the classic acceleration mode. Specifies parameters such as mode, gain, offset, acceleration, exponent, and cap settings. ```json { "profiles": [{ "name": "classic_example", "Whole or horizontal accel parameters": { "mode": "classic", "Gain / Velocity": true, "inputOffset": 0, "acceleration": 0.005, "exponentClassic": 2, "Cap / Jump": { "x": 15, "y": 1.5 }, "Cap mode": "output" } }] } ``` -------------------------------- ### LUT Mode Configuration Example Source: https://context7.com/rawaccelofficial/rawaccel/llms.txt Example JSON configuration for the LUT acceleration mode, specifying 'mode', 'Gain / Velocity', and the 'data' array representing the curve points. Ensure the 'data' array contains pairs of x and y values. ```json { "Whole or horizontal accel parameters": { "mode": "lut", "Gain / Velocity": true, "data": [1.5, 0.85, 4.37, 3.31, 13.51, 15.17, 140, 354.7] } } ``` -------------------------------- ### Synchronous Acceleration Configuration Source: https://context7.com/rawaccelofficial/rawaccel/llms.txt Example JSON configuration for the synchronous acceleration mode. Specifies mode, gain, sync speed, motivity, gamma, and smooth settings. ```json { "Whole or horizontal accel parameters": { "mode": "synchronous", "Gain / Velocity": false, "syncSpeed": 5, "motivity": 1.5, "gamma": 1, "smooth": 0.5 } } ``` -------------------------------- ### Power Acceleration Configuration Source: https://context7.com/rawaccelofficial/rawaccel/llms.txt Example JSON configuration for the power acceleration mode. Includes mode, gain, output offset, scale, exponent, and cap settings. ```json { "Whole or horizontal accel parameters": { "mode": "power", "Gain / Velocity": true, "outputOffset": 1, "scale": 1, "exponentPower": 0.05, "Cap / Jump": { "x": 15, "y": 1.5 }, "Cap mode": "output" } } ``` -------------------------------- ### RawAccel Device Configuration JSON Example Source: https://context7.com/rawaccelofficial/rawaccel/llms.txt Demonstrates the JSON structure for configuring individual devices. This includes settings for default device behavior and specific configurations for a 'Logitech G Pro' mouse. ```json { "defaultDeviceConfig": { "disable": false, "DPI (normalizes input speed unit: counts/ms -> in/s)": 0, "Polling rate Hz (keep at 0 for automatic adjustment)": 0 }, "devices": [{ "name": "Logitech G Pro", "profile": "gaming", "id": "HID\VID_046D&PID_C539", "config": { "disable": false, "DPI (normalizes input speed unit: counts/ms -> in/s)": 800 } }] } ``` -------------------------------- ### Raw Accel Configuration File Example Source: https://context7.com/rawaccelofficial/rawaccel/llms.txt This JSON object demonstrates a complete Raw Accel settings file. It includes definitions for acceleration modes, cap modes, device configurations, and detailed profile settings for mouse acceleration curves, DPI adjustments, and rotation. Ensure all keys and values conform to the expected schema for proper loading. ```json { "### Accel modes ###": "classic | jump | natural | synchronous | power | lut | noaccel", "### Cap modes ###": "in_out | input | output", "version": "1.7.0", "defaultDeviceConfig": { "disable": false, "DPI (normalizes input speed unit: counts/ms -> in/s)": 0, "Polling rate Hz (keep at 0 for automatic adjustment)": 0 }, "profiles": [ { "name": "default", "Stretches domain for horizontal vs vertical inputs": { "x": 1, "y": 1 }, "Stretches accel range for horizontal vs vertical inputs": { "x": 1, "y": 1 }, "Whole or horizontal accel parameters": { "mode": "synchronous", "Gain / Velocity": false, "syncSpeed": 8, "motivity": 1.6, "gamma": 1, "smooth": 0.5 }, "Vertical accel parameters": { "mode": "noaccel" }, "Input speed calculation parameters": { "Whole/combined accel (set false for 'by component' mode)": true, "lpNorm": 2 }, "Output DPI": 800, "Y/X output DPI ratio (vertical sens multiplier)": 1, "Degrees of rotation": 0, "Degrees of angle snapping": 0, "Input Speed Cap": 0 } ], "devices": [] } ``` -------------------------------- ### Natural Acceleration Configuration Source: https://context7.com/rawaccelofficial/rawaccel/llms.txt Example JSON configuration for the natural acceleration mode. Includes mode, gain, offset, decay rate, and limit settings. ```json { "Whole or horizontal accel parameters": { "mode": "natural", "Gain / Velocity": true, "inputOffset": 0, "decayRate": 0.1, "limit": 1.5 } } ``` -------------------------------- ### ManagedAccel C# Usage Example Source: https://context7.com/rawaccelofficial/rawaccel/llms.txt Demonstrates how to use the `ManagedAccel` C++/CLI wrapper in C# to perform mouse acceleration calculations. It shows the creation of a profile and calling the `Accelerate` method. ```csharp // C# usage example var profile = new Profile { argsX = new AccelArgs { mode = AccelMode.classic, gain = true, acceleration = 0.005, exponentClassic = 2 }, outputDPI = 800 }; var accel = new ManagedAccel(profile); var (outX, outY) = accel.Accelerate(x: 10, y: 5, dpi_factor: 1.0, time: 1.0); ``` -------------------------------- ### Natural Acceleration Formula Source: https://context7.com/rawaccelofficial/rawaccel/llms.txt Implements natural acceleration with a concave curve. It starts at sensitivity 1 and approaches a limit using exponential decay. Requires parameters like offset, decay rate, and limit. ```cpp // common/accel-natural.hpp namespace rawaccel { template<> struct natural : natural_base { double constant; double operator()(double x, const accel_args&) const { if (x <= offset) return 1; double offset_x = offset - x; double decay = exp(accel * offset_x); double output = limit * (decay / accel - offset_x) + constant; return output / x + 1; } }; } ``` -------------------------------- ### Command-Line Driver Configuration Writer Source: https://context7.com/rawaccelofficial/rawaccel/llms.txt Applies settings from a JSON file directly to the driver. If no argument is provided and settings.json does not exist, a default configuration file is generated. ```csharp // writer/Program.cs static void Main(string[] args) { VersionHelper.ValidOrThrow(); if (args.Length != 1) { if (File.Exists("settings.json")) Exit("Usage: writer.exe "); else { File.WriteAllText("settings.json", DriverConfig.GetDefault().ToJSON()); Exit("(generated default settings file 'settings.json')"); } } else { var result = DriverConfig.Convert(File.ReadAllText(args[0])); if (result.Item2 == null) result.Item1.Activate(); else Exit($"Bad settings:\n\n{result.Item2}"); } } ``` -------------------------------- ### Classic Acceleration Formula Source: https://context7.com/rawaccelofficial/rawaccel/llms.txt Implements the classic acceleration formula used in games like Quake 3/Quake Live. Requires specific acceleration parameters like offset, acceleration rate, and exponent. ```cpp // common/accel-classic.hpp namespace rawaccel { // Classic acceleration: accel * (speed - offset)^exponent / speed struct classic_base { double base_fn(double x, double accel_raised, const accel_args& args) const { return accel_raised * pow(x - args.input_offset, args.exponent_classic) / x; } }; } ``` -------------------------------- ### RawAccel Device Configuration Structures Source: https://context7.com/rawaccelofficial/rawaccel/llms.txt Defines the C++ structures for per-device settings, allowing unique configurations for individual mice. Includes options for disabling acceleration, DPI normalization, and polling rate overrides. ```cpp // common/rawaccel.hpp namespace rawaccel { struct device_config { bool disable = false; bool set_extra_info = false; bool poll_time_lock = false; int dpi = 0; // Set for DPI normalization int polling_rate = 0; // Override automatic detection time_clamp clamp; }; struct device_settings { wchar_t name[MAX_NAME_LEN] = {}; wchar_t profile[MAX_NAME_LEN] = {}; wchar_t id[MAX_DEV_ID_LEN] = {}; device_config config; }; } ``` -------------------------------- ### Input Speed Calculation Parameters Source: https://context7.com/rawaccelofficial/rawaccel/llms.txt JSON configuration for input speed calculation, including options for whole/combined acceleration, LP norm, and smoothing halflife periods. ```json { "Input speed calculation parameters": { "Whole/combined accel (set false for 'by component' mode)": true, "lpNorm": 2, "Time in ms after which an input is weighted at half its original value.": 0, "Time in ms after which scale is weighted at half its original value.": 0, "Time in ms after which an output is weighted at half its original value.": 0 } } ``` -------------------------------- ### Power Acceleration Formula Source: https://context7.com/rawaccelofficial/rawaccel/llms.txt Replicates Source Engine acceleration (`m_customaccel 3`). Output is calculated as `(scale * speed)^exponent` or a capped value. Requires scale, exponent, and cap parameters. ```cpp // common/accel-power.hpp namespace rawaccel { template <> struct power : power_base { double operator()(double speed, const accel_args& args) const { if (speed < cap.x) { return base_fn(speed, args); } else { return cap.y + constant_b / speed; } } }; } ``` -------------------------------- ### DriverConfig Class for Configuration Management Source: https://context7.com/rawaccelofficial/rawaccel/llms.txt Handles serialization and driver communication for complete configurations. Use Activate to apply settings and GetActive to retrieve current settings. ```cpp // wrapper/wrapper.cpp public ref class DriverConfig { public: void Activate() { // Marshal profiles and device settings to native buffer std::byte* buffer = new std::byte[total_size]; // ... populate buffer ... ra::write(buffer); } static DriverConfig^ GetActive() { auto bytes = ra::read(); // Unmarshal from native buffer to managed objects return cfg; } static Tuple^ Convert(String^ json) { auto cfg = JsonConvert::DeserializeObject(json); auto message = cfg->Errors(); if (message != nullptr) return gcnew Tuple(nullptr, message); return gcnew Tuple(cfg, nullptr); } String^ ToJSON() { return ToJObject()->ToString(); } }; ``` -------------------------------- ### Driver IOCTL Write and Reset Functions Source: https://context7.com/rawaccelofficial/rawaccel/llms.txt Provides C++ functions to write acceleration settings to the driver and to reset all settings. The write function calculates the required buffer size based on the provided settings, and the reset function sends an empty io_base structure. ```cpp // common/rawaccel-io.hpp namespace rawaccel { inline void write(const void* buffer) { auto* base_ptr = static_cast(buffer); auto size = sizeof(io_base); size += base_ptr->modifier_data_size * sizeof(modifier_settings); size += base_ptr->device_data_size * sizeof(device_settings); io_control(WRITE, const_cast(buffer), DWORD(size), NULL, 0); } inline void reset() { io_base base_data{}; // Clears all modifier/device data and disables all devices io_control(WRITE, &base_data, sizeof(io_base), NULL, 0); } } ``` -------------------------------- ### Speed Processor Configuration and Calculation Source: https://context7.com/rawaccelofficial/rawaccel/llms.txt Initializes the speed processor with various distance modes and applies exponential moving averages for input smoothing. Handles different distance metrics based on input parameters. ```cpp // common/rawaccel.hpp namespace rawaccel { struct speed_processor { void init(speed_args in_args) { if (!in_args.whole) { speed_flags.dist_mode = distance_mode::separate; } else if (in_args.lp_norm >= MAX_NORM) { speed_flags.dist_mode = distance_mode::max; } else if (in_args.lp_norm != 2) { speed_flags.dist_mode = distance_mode::Lp; } else { speed_flags.dist_mode = distance_mode::euclidean; } if (in_args.input_speed_smooth_halflife > 0) smoother_x.input_speed_smoother.init(halflife, trend_halflife); } double calc_speed_whole(vec2d in, milliseconds time) { double speed = (dist_mode == distance_mode::euclidean) ? magnitude(in) : lp_distance(in, args.lp_norm); if (should_smooth_input) speed = smoother_x.input_speed_smoother.smooth(speed, time); return speed; } }; } ``` -------------------------------- ### Simplified Whole Mode Formula Source: https://github.com/rawaccelofficial/rawaccel/blob/master/doc/Guide.md A conceptual representation of the 'Whole' mode formula, highlighting the application of domain-weighted Lp space speed and directional weight to the sensitivity calculation. ```math (out_x, out_y) = (in_x * sens_x, in_y * sens_y) * \left(\left(f\left( \text{domain-weighted } L^p \text{ space speed}\right) - 1\right) * (\text{directional weight}) + 1\right) ``` -------------------------------- ### Driver IOCTL Definitions and Read Function Source: https://context7.com/rawaccelofficial/rawaccel/llms.txt Defines constants for driver IOCTL codes (READ, WRITE, GET_VERSION) and provides a C++ function to read acceleration settings from the driver. This function allocates memory to hold the base, modifier, and device settings. ```cpp // common/rawaccel-io.hpp namespace rawaccel { constexpr ULONG READ = CTL_CODE(0x8888u, 0x888, METHOD_BUFFERED, FILE_ANY_ACCESS); constexpr ULONG WRITE = CTL_CODE(0x8888u, 0x889, METHOD_BUFFERED, FILE_ANY_ACCESS); constexpr ULONG GET_VERSION = CTL_CODE(0x8888u, 0x88a, METHOD_BUFFERED, FILE_ANY_ACCESS); inline std::unique_ptr read() { io_base base_data; io_control(READ, NULL, 0, &base_data, sizeof(io_base)); size_t size = sizeof(base_data); size += sizeof(modifier_settings) * base_data.modifier_data_size; size += sizeof(device_settings) * base_data.device_data_size; auto bytes = std::make_unique(size); io_control(READ, NULL, 0, bytes.get(), DWORD(size)); return bytes; } } ``` -------------------------------- ### ManagedAccel C++/CLI Wrapper Class Source: https://context7.com/rawaccelofficial/rawaccel/llms.txt Provides a managed interface in C++/CLI for RawAccel calculations. The `ManagedAccel` class handles acceleration computations using provided profile settings. ```cpp // wrapper/wrapper.cpp public ref class ManagedAccel { public: ManagedAccel(Profile^ settings) { Settings = settings; } Tuple^ Accelerate(int x, int y, double dpi_factor, double time) { vec2d in_out_vec = { (double)x, (double)y }; instance->mod.modify(in_out_vec, speed_instance->speed_calculator, instance->settings, dpi_factor, time); return gcnew Tuple(in_out_vec.x, in_out_vec.y); } property Profile^ Settings { /* get/set */ } }; ``` -------------------------------- ### By Component Mode with Different Functions Source: https://github.com/rawaccelofficial/rawaccel/blob/master/doc/Guide.md An extension of the 'By Component' mode where different sensitivity functions, f(v) and g(v), can be applied to the horizontal and vertical input components respectively. ```math (out_x, out_y) = (in_x * f(in_x) * sens_x, in_y * g(in_y) * sens_y)) ``` -------------------------------- ### Synchronous Acceleration Formula Source: https://context7.com/rawaccelofficial/rawaccel/llms.txt Creates logarithmically symmetrical sensitivity changes around a 'sync speed'. Based on human perception of proportional differences. Requires sync speed, motivity, gamma, and sharpness parameters. ```cpp // common/accel-synchronous.hpp namespace rawaccel { template <> struct activation_framework { double operator()(double x, const accel_args&) const { if (x == syncspeed) return 1.0; double log_x = log(x); double log_diff = log_x - log_syncspeed; if (log_diff > 0) { double log_space = gamma_const * log_diff; double exponent = pow(tanh(pow(log_space, sharpness)), sharpness_recip); return exp(exponent * log_motivity); } else { double log_space = -gamma_const * log_diff; double exponent = -pow(tanh(pow(log_space, sharpness)), sharpness_recip); return exp(exponent * log_motivity); } } }; } ``` -------------------------------- ### Whole Mode with Anisotropic Settings Source: https://github.com/rawaccelofficial/rawaccel/blob/master/doc/Guide.md The full sensitivity calculation for 'Whole' mode, incorporating domain-weighted Lp norm speed and directional weighting, adjusted by range and sensitivity multipliers. ```math (out_x, out_y) = (in_x * sens_x, in_y * sens_y) \left(\left(f\left(\left(((domain_x * in_x)^p + (domain_y * in_y)^p)\right)^\frac{1}{p}\right) - 1\right) \left(\frac{2}{\pi} \arctan(| \frac{in_y}{in_x} |) (range_y - range_x) + range_x\right) + 1\right) ``` -------------------------------- ### Look-Up Table (LUT) Acceleration Logic Source: https://context7.com/rawaccelofficial/rawaccel/llms.txt Implements the LUT acceleration mode, allowing custom curves defined by points that are linearly interpolated. This C++ struct uses binary search to find the correct interpolation segment. ```cpp // common/accel-lookup.hpp namespace rawaccel { struct lookup { double operator()(double x, const accel_args& args) const { auto* points = reinterpret_cast*>(args.data); // Binary search for interpolation point while (lo <= hi) { int mid = (lo + hi) / 2; if (x < points[mid].x) hi = mid - 1; else if (x > points[mid].x) lo = mid + 1; else return points[mid].y / (velocity ? x : 1); } // Linear interpolation between points double t = (x - points[lo-1].x) / (points[lo].x - points[lo-1].x); return lerp(points[lo-1].y, points[lo].y, t) / (velocity ? x : 1); } }; } ``` -------------------------------- ### Input Modification Logic in C++ Source: https://context7.com/rawaccelofficial/rawaccel/llms.txt This C++ snippet outlines the input modification flow within the Raw Accel modifier class. It details steps like rotation, angle snapping, speed clamping, acceleration curve application, and DPI adjustments. Ensure correct data types and function implementations for 'rotate', 'atan', 'fabs', 'calc_speed_whole', and the callback function 'cb_x'. ```cpp // common/rawaccel.hpp namespace rawaccel { class modifier { public: void modify(vec2d& in, speed_processor& sp, const modifier_settings& settings, double dpi_factor, milliseconds time) const { auto& args = settings.prof; // 1. Apply rotation if (flags.apply_rotate) in = rotate(in, data.rot_direction); // 2. Calculate reference angle for anisotropy if (flags.compute_ref_angle && in.y != 0) reference_angle = atan(fabs(in.y / in.x)); // 3. Apply angle snapping if (flags.apply_snap) { /* snap to axis */ } // 4. Clamp speed if enabled if (flags.clamp_speed) { /* apply min/max */ } // 5. Calculate weighted velocity vec2d abs_weighted_vel = { fabs(in.x * ips_factor * args.domain_weights.x), fabs(in.y * ips_factor * args.domain_weights.y) }; // 6. Apply acceleration curve double speed = sp.calc_speed_whole(abs_weighted_vel, time); double scale = (*cb_x)(data.accel_x, args.accel_x, speed, weight); in.x *= scale; in.y *= scale; // 7. Apply output DPI adjustment in.x *= output_dpi_adjustment_factor * dpi_factor; in.y *= output_dpi_adjustment_factor * dpi_factor * args.yx_output_dpi_ratio; } }; } ``` -------------------------------- ### RawAccel Profile Structure Definition Source: https://context7.com/rawaccelofficial/rawaccel/llms.txt Defines the structure for acceleration parameters, sensitivity multipliers, and anisotropic weights within a RawAccel profile. This C++ struct outlines all configurable aspects of mouse acceleration. ```cpp // common/rawaccel-base.hpp namespace rawaccel { struct profile { wchar_t name[MAX_NAME_LEN] = L"default"; vec2d domain_weights = { 1, 1 }; // Stretches domain for H/V vec2d range_weights = { 1, 1 }; // Stretches accel range for H/V accel_args accel_x; // Horizontal/whole accel params accel_args accel_y; // Vertical accel params (by-component mode) speed_args speed_processor_args; double output_dpi = 1000; // Sensitivity multiplier double yx_output_dpi_ratio = 1; // Y/X sensitivity ratio double degrees_rotation = 0; // Input rotation double degrees_snap = 0; // Angle snapping double speed_min = 0; double speed_max = 0; // Speed cap }; } ``` -------------------------------- ### Jump Mode Acceleration Logic Source: https://context7.com/rawaccelofficial/rawaccel/llms.txt Defines the jump acceleration mode logic, applying different sensitivities above and below a threshold with optional smoothing. This C++ template is used for calculating acceleration values based on input. ```cpp // common/accel-jump.hpp namespace rawaccel { template<> struct jump : jump_base { double C; double operator()(double x, const accel_args&) const { if (x <= 0) return 1; if (is_smooth()) return 1 + (smooth_antideriv(x) + C) / x; if (x < step.x) return 1; else return 1 + step.y * (x - step.x) / x; } }; } ``` -------------------------------- ### Whole Mode Sensitivity Calculation Source: https://github.com/rawaccelofficial/rawaccel/blob/master/doc/Guide.md This formula applies sensitivity calculations to the magnitude of the input vector, affecting both components uniformly based on the overall movement. ```math (out_x, out_y) = (in_x * sens_x, in_y * sens_y) * f(\sqrt{in_x^2 + in_y^2}) ``` -------------------------------- ### By Component Mode Sensitivity Calculation Source: https://github.com/rawaccelofficial/rawaccel/blob/master/doc/Guide.md This formula applies sensitivity calculations independently to the horizontal and vertical components of the input vector, allowing for distinct curves for each axis. ```math (out_x, out_y) = (in_x * f(in_x) * sens_x, in_y * f(in_y) * sens_y)) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.