Skip to content

v0.3: C++ 20, New pipeline API, DS4 and X360 emulation, more transformations

Compare
Choose a tag to compare
@fredemmott fredemmott released this 09 Jan 15:20
· 61 commits to master since this release
38198e3

This is a major release, including:

  • API improvements
  • DS4 and X360 emulation
  • Many new actions

API Changes

This release is a rewrite of the API, giving more flexibility; additionally, C++20 is now required. If your profile or extensions have any errors, I strongly recommend building with Clang instead of Visual Studio while debugging; Visual Studio 2019 and 2022 work, however when something is broken, Clang gives significantly clearer and more detailed error messages for some C++20 features.

v0.2 Example

#include "easymode.h"

int main() {
  auto [p, stick, vjoy] = create_profile(VPC_RIGHT_WARBRD, VJOY_1);
  p->passthrough(stick, vjoy);
  p->map(stick.Button1, vjoy.Button1);
  p->map(
    stick.XAxis,
    SquareDeadzone(
      10,
      AxisCurve(
        -0.5,
        vjoy.XAxis)));
  p->run();
  return 0;
}

v0.3 Example

#include "easymode.h"

int main() {
  auto [p, stick, vjoy] = create_profile(VPC_RIGHT_WARBRD, VJOY_1);
  stick >> vjoy;
  stick.Button1 >> vjoy.Button1;
  stick.XAxis
    >> SquareDeadzone(10_percent)
    >> AxisCurve(-0.5)
    >> vjoy.XAxis;
  p.run();
  return 0;
}

Action API changes

This section is only relevant if you are implementing your own actions.

  • std::function (e.g. lambdas) remains supported
  • the Action class has been removed, and separated to Source<T> and Sink<T>
  • inputs are a Source<T> (e.g. stick.Button1 is a Source<Button>) and outputs are a Sink<T> (e.g. vjoy.Button1 is a Sink<Button>)
  • most actions are both sinks and sources, but the T can vary; for example, ButtonToAxis is a Sink<Button> and a Source<Axis>
  • ButtonSink, ButtonSource, AxisSource ... are defined as aliases for Sink<Button> etc for convenience

DS4 and X360 controller emulation

If ViGEmBus is installed, DS4 and X360 controllers can be emulated in addition to VJoy devices.

For example:

auto [p, stick, x360] = create_profile(VPC_RIGHT_WARBRD, VIGEM_X360_PAD);
stick.Button1 >> x360.ButtonX;

For a full example, see my BF2042 profile.

Additional Actions

v0.2 included:

  • AxisCurve
  • AxisToButtons
  • AxisToHat
  • ShortPressLongPress
  • SquareDeadzone

v0.3 adds:

  • AxisTrimmer
  • ButtonToAxis
  • HatToButtons
  • LatchedToMomentaryButton
  • MomentaryToLatchedButton

Learn More