ReXGlue SDK
Loading...
Searching...
No Matches
rex Namespace Reference

Namespaces

namespace  apu
namespace  codegen
namespace  gpu
namespace  kernel
namespace  log
namespace  memory
namespace  platform
namespace  ppc

Classes

struct  Achievement
struct  Allowed
class  AppInterfaces
struct  AppSysRequirements
class  BitMap
struct  CLIAction
struct  CLIActionHit
class  CLIArgList
struct  CLIOption
class  Clock
struct  Config
class  ConsoleCommand
struct  DebugOnly
struct  DriverRegistration
struct  EndianValue
struct  Error
class  IAchievementRegistry
class  IAppInfo
struct  IdentityHasher
class  IDriver
class  IDriverContext
class  IDriverModule
class  IGuestInterrupts
class  IInterface
class  IInterfaceFactory
class  ILogger
class  IModule
struct  InputEvent
struct  InputSource
struct  InterfaceType
class  IOverlayRenderer
class  IPhysicalMemory
class  IPhysicalWriteListener
class  IPhysicalWriteWatch
struct  IsBEType
struct  IsBEType< rex::BE< T > >
class  ISettingsRegistry
class  IUIThread
struct  KeyChord
struct  KeyChordTrait
struct  KeyHasher
class  Logger
class  MoveOnly
struct  NativeWindow
class  NonCopyable
struct  NoSave
class  PathSettings
struct  PhysicalRange
struct  PointerDelta
struct  PointerState
class  PropagateConst
struct  Range
class  ScopeGuard
class  SEHException
class  Setting
class  SettingBase
struct  SettingConstraints
class  SettingOwner
class  SettingsRegistry
struct  ThreadStop
struct  TitleInfo
struct  UnknownSetting
struct  Vec2
struct  VideoMode
struct  XXHasher

Concepts

concept  FlagsEnum

Typedefs

using HundredNano = std::ratio<1, 10000000>
using HundredNanoseconds = std::chrono::duration<i64, HundredNano>
using WinSystemClock = detail::NtSystemClock<detail::Domain::kHost>
using XSystemClock = detail::NtSystemClock<detail::Domain::kGuest>
using CreateInterfaceFn = IInterface* (*)(const char* name, u32 version)
using EnumerateInterfacesFn = u32 (*)(InterfaceType* out, u32 capacity)
template<typename T>
using Result = std::expected<T, Error>
using u8 = uint8_t
using u16 = uint16_t
using u32 = uint32_t
using u64 = uint64_t
using i8 = int8_t
using i16 = int16_t
using i32 = int32_t
using i64 = int64_t
using f32 = float
using f64 = double
template<typename T>
using BE = EndianValue<T, std::endian::big>
template<typename T>
using LE = EndianValue<T, std::endian::little>
using GuestAddrT = u32
using host_addr_t = uintptr_t
using be_u8 = u8
using be_u16 = BE<u16>
using be_u32 = BE<u32>
using be_u64 = BE<u64>
using be_i8 = i8
using be_i16 = BE<i16>
using be_i32 = BE<i32>
using be_i64 = BE<i64>
using be_f32 = BE<f32>
using be_f64 = BE<f64>
template<typename Signature>
using MoveOnlyFunction = typename detail::MoveOnlyFunctionFor<Signature>::type

Enumerations

enum class  GraphicsFamily : u8 { kNone , kXenos }
enum class  DriverType : u8 { kGraphics , kAudio , kInput , kUI }
enum class  VirtualKey : u16 {
  kNone , kLButton = 0x01 , kRButton = 0x02 , kCancel = 0x03 ,
  kMButton = 0x04 , kXButton1 = 0x05 , kXButton2 = 0x06 , kBack = 0x08 ,
  kTab = 0x09 , kClear = 0x0C , kReturn = 0x0D , kWheelUp = 0x0E ,
  kWheelDown = 0x0F , kShift = 0x10 , kControl = 0x11 , kMenu = 0x12 ,
  kPause = 0x13 , kCapital = 0x14 , kKana = 0x15 , kHangeul = 0x15 ,
  kHangul = 0x15 , kIMEOn = 0x16 , kJunja = 0x17 , kFinal = 0x18 ,
  kHanja = 0x19 , kKanji = 0x19 , kIMEOff = 0x1A , kEscape = 0x1B ,
  kConvert = 0x1C , kNonConvert = 0x1D , kAccept = 0x1E , kModeChange = 0x1F ,
  kSpace = 0x20 , kPrior = 0x21 , kNext = 0x22 , kEnd = 0x23 ,
  kHome = 0x24 , kLeft = 0x25 , kUp = 0x26 , kRight = 0x27 ,
  kDown = 0x28 , kSelect = 0x29 , kPrint = 0x2A , kExecute = 0x2B ,
  kSnapshot = 0x2C , kInsert = 0x2D , kDelete = 0x2E , kHelp = 0x2F ,
  Digit keys 0 to 9, equal to their ASCII codes 0x30 to 0x39. , k0 = 0x30 , k1 = 0x31 , k2 = 0x32 ,
  k3 = 0x33 , k4 = 0x34 , k5 = 0x35 , k6 = 0x36 ,
  k7 = 0x37 , k8 = 0x38 , k9 = 0x39 , Letter keys A to Z, equal to their uppercase ASCII codes 0x41 to 0x5A. ,
  kA = 0x41 , kB = 0x42 , kC = 0x43 , kD = 0x44 ,
  kE = 0x45 , kF = 0x46 , kG = 0x47 , kH = 0x48 ,
  kI = 0x49 , kJ = 0x4A , kK = 0x4B , kL = 0x4C ,
  kM = 0x4D , kN = 0x4E , kO = 0x4F , kP = 0x50 ,
  kQ = 0x51 , kR = 0x52 , kS = 0x53 , kT = 0x54 ,
  kU = 0x55 , kV = 0x56 , kW = 0x57 , kX = 0x58 ,
  kY = 0x59 , kZ = 0x5A , kLWin = 0x5B , kRWin = 0x5C ,
  kApps = 0x5D , kSleep = 0x5F , kNumpad0 = 0x60 , kNumpad1 = 0x61 ,
  kNumpad2 = 0x62 , kNumpad3 = 0x63 , kNumpad4 = 0x64 , kNumpad5 = 0x65 ,
  kNumpad6 = 0x66 , kNumpad7 = 0x67 , kNumpad8 = 0x68 , kNumpad9 = 0x69 ,
  kMultiply = 0x6A , kAdd = 0x6B , kSeparator = 0x6C , kSubtract = 0x6D ,
  kDecimal = 0x6E , kDivide = 0x6F , kF1 = 0x70 , kF2 = 0x71 ,
  kF3 = 0x72 , kF4 = 0x73 , kF5 = 0x74 , kF6 = 0x75 ,
  kF7 = 0x76 , kF8 = 0x77 , kF9 = 0x78 , kF10 = 0x79 ,
  kF11 = 0x7A , kF12 = 0x7B , kF13 = 0x7C , kF14 = 0x7D ,
  kF15 = 0x7E , kF16 = 0x7F , kF17 = 0x80 , kF18 = 0x81 ,
  kF19 = 0x82 , kF20 = 0x83 , kF21 = 0x84 , kF22 = 0x85 ,
  kF23 = 0x86 , kF24 = 0x87 , kNavigationView = 0x88 , kNavigationMenu = 0x89 ,
  kNavigationUp = 0x8A , kNavigationDown = 0x8B , kNavigationLeft = 0x8C , kNavigationRight = 0x8D ,
  kNavigationAccept = 0x8E , kNavigationCancel = 0x8F , kNumLock = 0x90 , kScroll = 0x91 ,
  kOemNecEqual = 0x92 , kOemFjJisho = 0x92 , kOemFjMasshou = 0x93 , kOemFjTouroku = 0x94 ,
  kOemFjLOya = 0x95 , kOemFjROya = 0x96 , kLShift = 0xA0 , kRShift = 0xA1 ,
  kLControl = 0xA2 , kRControl = 0xA3 , kLMenu = 0xA4 , kRMenu = 0xA5 ,
  kBrowserBack = 0xA6 , kBrowserForward = 0xA7 , kBrowserRefresh = 0xA8 , kBrowserStop = 0xA9 ,
  kBrowserSearch = 0xAA , kBrowserFavorites = 0xAB , kBrowserHome = 0xAC , kVolumeMute = 0xAD ,
  kVolumeDown = 0xAE , kVolumeUp = 0xAF , kMediaNextTrack = 0xB0 , kMediaPrevTrack = 0xB1 ,
  kMediaStop = 0xB2 , kMediaPlayPause = 0xB3 , kLaunchMail = 0xB4 , kLaunchMediaSelect = 0xB5 ,
  kLaunchApp1 = 0xB6 , kLaunchApp2 = 0xB7 , kOem1 = 0xBA , kOemPlus = 0xBB ,
  kOemComma = 0xBC , kOemMinus = 0xBD , kOemPeriod = 0xBE , kOem2 = 0xBF ,
  kOem3 = 0xC0 , kXboxOneGamepadA = 0xC3 , kXboxOneGamepadB = 0xC4 , kXboxOneGamepadX = 0xC5 ,
  kXboxOneGamepadY = 0xC6 , kXboxOneGamepadRightShoulder = 0xC7 , kXboxOneGamepadLeftShoulder = 0xC8 , kXboxOneGamepadLeftTrigger = 0xC9 ,
  kXboxOneGamepadRightTrigger = 0xCA , kXboxOneGamepadDpadUp = 0xCB , kXboxOneGamepadDpadDown = 0xCC , kXboxOneGamepadDpadLeft = 0xCD ,
  kXboxOneGamepadDpadRight = 0xCE , kXboxOneGamepadMenu = 0xCF , kXboxOneGamepadView = 0xD0 , kXboxOneGamepadLeftThumbstickButton = 0xD1 ,
  kXboxOneGamepadRightThumbstickButton = 0xD2 , kXboxOneGamepadLeftThumbstickUp = 0xD3 , kXboxOneGamepadLeftThumbstickDown = 0xD4 , kXboxOneGamepadLeftThumbstickRight = 0xD5 ,
  kXboxOneGamepadLeftThumbstickLeft = 0xD6 , kXboxOneGamepadRightThumbstickUp = 0xD7 , kXboxOneGamepadRightThumbstickDown = 0xD8 , kXboxOneGamepadRightThumbstickRight = 0xD9 ,
  kXboxOneGamepadRightThumbstickLeft = 0xDA , kOem4 = 0xDB , kOem5 = 0xDC , kOem6 = 0xDD ,
  kOem7 = 0xDE , kOem8 = 0xDF , kOemAx = 0xE1 , kOem102 = 0xE2 ,
  kIcoHelp = 0xE3 , kIco00 = 0xE4 , kProcessKey = 0xE5 , kIcoClear = 0xE6 ,
  kPacket = 0xE7 , kOemReset = 0xE9 , kOemJump = 0xEA , kOemPa1 = 0xEB ,
  kOemPa2 = 0xEC , kOemPa3 = 0xED , kOemWsCtrl = 0xEE , kOemCuSel = 0xEF ,
  kOemAttn = 0xF0 , kOemFinish = 0xF1 , kOemCopy = 0xF2 , kOemAuto = 0xF3 ,
  kOemEnlW = 0xF4 , kOemBackTab = 0xF5 , kAttn = 0xF6 , kCrSel = 0xF7 ,
  kExSel = 0xF8 , kErEof = 0xF9 , kPlay = 0xFA , kZoom = 0xFB ,
  kNoName = 0xFC , kPa1 = 0xFD , kOemClear = 0xFE , kXInputPadA = 0x5800 ,
  kXInputPadB = 0x5801 , kXInputPadX = 0x5802 , kXInputPadY = 0x5803 , kXInputPadRShoulder = 0x5804 ,
  kXInputPadLShoulder = 0x5805 , kXInputPadLTrigger = 0x5806 , kXInputPadRTrigger = 0x5807 , kXInputPadDPadUp = 0x5810 ,
  kXInputPadDPadDown = 0x5811 , kXInputPadDPadLeft = 0x5812 , kXInputPadDPadRight = 0x5813 , kXInputPadStart = 0x5814 ,
  kXInputPadBack = 0x5815 , kXInputPadLThumbPress = 0x5816 , kXInputPadRThumbPress = 0x5817 , kXInputPadLThumbUp = 0x5820 ,
  kXInputPadLThumbDown = 0x5821 , kXInputPadLThumbRight = 0x5822 , kXInputPadLThumbLeft = 0x5823 , kXInputPadLThumbUpLeft = 0x5824 ,
  kXInputPadLThumbUpRight = 0x5825 , kXInputPadLThumbDownRight = 0x5826 , kXInputPadLThumbDownLeft = 0x5827 , kXInputPadRThumbUp = 0x5830 ,
  kXInputPadRThumbDown = 0x5831 , kXInputPadRThumbRight = 0x5832 , kXInputPadRThumbLeft = 0x5833 , kXInputPadRThumbUpLeft = 0x5834 ,
  kXInputPadRThumbUpRight = 0x5835 , kXInputPadRThumbDownRight = 0x5836 , kXInputPadRThumbDownLeft = 0x5837
}
enum class  PointerMode : u8 { kFree , kHidden , kLocked }
enum class  MouseButton : u8 {
  kLeft , kRight , kMiddle , kX1 ,
  kX2 , kNone
}
enum class  KeyModifiers : u8 { kNone = 0 , kShift = 1 , kCtrl = 2 , kAlt = 4 }
enum class  InputSourceType : u8 { kKey , kMouseWheel , kPadButton , kPadAxes }
enum class  PadInput : u8 {
  kDpadUp , kDpadDown , kDpadLeft , kDpadRight ,
  kStart , kBack , kLeftStickPress , kRightStickPress ,
  kA , kB , kX , kY ,
  kLeftTrigger , kRightTrigger , kLeftShoulder , kRightShoulder ,
  kLeftStickUp , kLeftStickDown , kLeftStickRight , kLeftStickLeft ,
  kRightStickUp , kRightStickDown , kRightStickRight , kRightStickLeft
}
enum class  PadAxes : u8 { kNone , kLeft , kRight }
enum class  MessageType : u8 { kInfo , kWarning , kError }
enum class  ErrorCategory : u8 {
  kNoError , kIO , kMemory , kFormat ,
  kCrypto , kCompression , kRuntime , kPlatform ,
  kConfig , kValidation , kNotFound , kNotImplemented ,
  kModule
}
enum class  SettingType : u8 {
  kBool , kI32 , kI64 , kU32 ,
  kU64 , kF64 , kString , kPath
}
enum class  SettingLayer : u8 {
  kDefault , kTitle , kFile , kEnvironment ,
  kCommandLine , kRuntime , kLock
}
enum class  SettingLife : u8 { kLive , kRestart , kStartupOnly , kUntilLaunch }

Functions

template<typename T>
constexpr bool is_pow2 (T value)
template<typename T>
T next_pow2 (T value)
constexpr u32 MakeBitmask (u32 a, u32 b)
constexpr u32 select_bits (u32 value, u32 a, u32 b)
template<class T>
constexpr u32 BitCount (T v)
u8 lzcnt (u8 v)
u8 lzcnt (u16 v)
u8 lzcnt (u32 v)
u8 lzcnt (u64 v)
u8 tzcnt (u8 v)
u8 tzcnt (u16 v)
u8 tzcnt (u32 v)
u8 tzcnt (u64 v)
u8 lzcnt (i8 v)
u8 lzcnt (i16 v)
u8 lzcnt (i32 v)
u8 lzcnt (i64 v)
u8 tzcnt (i8 v)
u8 tzcnt (i16 v)
u8 tzcnt (i32 v)
u8 tzcnt (i64 v)
bool bit_scan_forward (u32 v, u32 *out_first_set_index)
bool bit_scan_forward (u64 v, u32 *out_first_set_index)
bool bit_scan_forward (i32 v, u32 *out_first_set_index)
bool bit_scan_forward (i64 v, u32 *out_first_set_index)
template<typename T>
T log2_floor (T v)
template<typename T>
T log2_ceil (T v)
template<typename T>
T RotateLeft (T v, u8 sh)
template<typename Block>
std::pair< size_t, size_t > GetNextRangeUnset (const Block *bits, size_t first, size_t length)
template<typename Block>
void SetRange (Block *bits, size_t first, size_t length)
template<FlagsEnum E>
constexpr E operator| (E lhs, E rhs)
template<FlagsEnum E>
constexpr E operator& (E lhs, E rhs)
template<FlagsEnum E>
constexpr E operator^ (E lhs, E rhs)
template<FlagsEnum E>
constexpr E operator~ (E value)
template<FlagsEnum E>
constexpr E & operator|= (E &lhs, E rhs)
template<FlagsEnum E>
constexpr E & operator&= (E &lhs, E rhs)
template<FlagsEnum E>
constexpr E & operator^= (E &lhs, E rhs)
template<FlagsEnum E>
constexpr bool HasFlags (E value, E flags)
template<typename Dst, typename Src>
void Reinterpret (Dst &REX_RESTRICT_VAR dst, const Src &REX_RESTRICT_VAR src)
template<typename Dst, typename Src>
Dst Reinterpret (const Src &REX_RESTRICT_VAR src)
bool AreBitsEqual (std::span< const f32 > a, std::span< const f32 > b)
u64 DecodeFATTimestamp (u32 date, u32 time)
std::string_view GetGraphicsFamilyName (GraphicsFamily family)
std::vector< std::string > GetDriverModules (DriverType type, std::string_view names, GraphicsFamily family=GraphicsFamily::kNone, IInterfaceFactory *connected=nullptr)
Result< std::vector< std::unique_ptr< IDriver > > > SelectDrivers (IInterfaceFactory &factory, DriverType type, std::string_view names, IDriverContext &context)
u64 HashXXH3 (std::span< const u8 > data)
std::string HashBytes (std::string_view data)
std::string HashFile (const std::filesystem::path &path)
size_t hash_combine (size_t hash)
template<typename T, typename... Ts>
size_t hash_combine (size_t hash, const T &v, const Ts &... vs)
Result< void > Init (const Config &config)
void Stop ()
void Shutdown ()
VirtualKey ParseVirtualKey (std::string_view name)
std::string VirtualKeyToString (VirtualKey key)
constexpr bool IsSameInput (const InputSource &left, const InputSource &right)
std::string_view GetPadButtonName (PadInput button)
Result< InputSource > ParseInputSource (std::string_view text)
std::string InputSourceToString (const InputSource &source)
Result< KeyChord > ParseKeyChord (std::string_view text)
Result< std::vector< KeyChord > > ParseKeyChordList (std::string_view text)
std::string KeyChordToString (KeyChord chord)
Logger & GetLogger ()
template<typename T, size_t N>
constexpr size_t CountOf (T(&)[N]) noexcept
template<typename T>
constexpr T RoundUpPow2 (T value, T alignment)
template<typename T, typename V>
constexpr T RoundUp (T value, V multiple)
template<typename T, typename V>
constexpr T RoundUpNonZero (T value, V multiple)
template<typename T>
T clamp_float (T value, T min_value, T max_value)
template<typename T>
T saturate (T value)
template<typename T>
constexpr void reduce_fraction (T &numerator, T &denominator)
template<typename T>
constexpr void reduce_fraction (std::pair< T, T > &fraction)
constexpr u64 mul_div (u64 value, u64 numerator, u64 denominator)
template<typename T>
T SatAdd (T a, T b)
template<typename T>
T SatSub (T a, T b)
template<typename... Interfaces, typename Module>
IInterface * FindModuleInterface (Module &module, std::string_view name, u32 version)
PathSettings & GetPathSettings ()
void ShowMessageBox (MessageType type, std::string_view message)
void InitializeSEHThread ()
void InitializeSEH ()
template<typename T>
Result< T > Ok (T &&value)
Result< void > Ok ()
template<typename T = void>
auto Err (Error error)
template<typename T = void>
auto Err (ErrorCategory category, std::string message, int code=0)
SettingsRegistry & GetSettingsRegistry ()
template<class T>
constexpr T byte_swap (T value) noexcept
constexpr size_t operator""_KiB (unsigned long long int x)
constexpr size_t operator""_MiB (unsigned long long int x)
constexpr size_t operator""_GiB (unsigned long long int x)
constexpr size_t operator""_TiB (unsigned long long int x)
constexpr size_t operator""_PiB (unsigned long long int x)

Variables

template<typename E>
constexpr bool is_flags_enum = false
template<>
constexpr bool is_flags_enum< KeyModifiers > = true
constexpr u8 kPadButtonCount = 24
constexpr const char * kCreateInterfaceSymbol = "ReXCreateInterface"
constexpr const char * kEnumerateInterfacesSymbol = "ReXEnumerateInterfaces"
constexpr const char * kBuildIdentitySymbol = "ReXBuildIdentity"
constexpr SettingLife kRestart = SettingLife::kRestart
constexpr SettingLife kStartupOnly = SettingLife::kStartupOnly
constexpr SettingLife kUntilLaunch = SettingLife::kUntilLaunch
constexpr struct rex::NoSave kNoSave
constexpr struct rex::DebugOnly kDebugOnly
constexpr struct rex::KeyChordTrait kKeyChord
template<typename T>
constexpr bool is_be_type_v = IsBEType<T>::value

Detailed Description

Xenia : Xbox 360 Emulator Research Project *

Copyright 2013 Ben Vanik. All rights reserved. * Released under the BSD license - see LICENSE in the root for more details. *

Modified
Tom Clay, 2026 - Adapted for ReXGlue runtime

Typedef Documentation

◆ be_i8

using rex::be_i8 = i8

Single byte, which needs no byte swap.

◆ be_u8

using rex::be_u8 = u8

Single byte, which needs no byte swap.

◆ CreateInterfaceFn

using rex::CreateInterfaceFn = IInterface* (*)(const char* name, u32 version)

The type of ReXCreateInterface. Returns null when the module serves no such interface.

◆ EnumerateInterfacesFn

using rex::EnumerateInterfacesFn = u32 (*)(InterfaceType* out, u32 capacity)

The type of ReXEnumerateInterfaces. Returns the total count and writes at most capacity.

◆ HundredNano

using rex::HundredNano = std::ratio<1, 10000000>

Ratio of 1 FILETIME tick, 100ns, to 1 second.

◆ HundredNanoseconds

using rex::HundredNanoseconds = std::chrono::duration<i64, HundredNano>

Duration in 100ns FILETIME ticks.

◆ MoveOnlyFunction

template<typename Signature>
using rex::MoveOnlyFunction = typename detail::MoveOnlyFunctionFor<Signature>::type

Owning holder for a callable that may be move only.

Template Parameters
SignatureThe call signature, R(Args...) or R(Args...) const.

◆ Result

template<typename T>
using rex::Result = std::expected<T, Error>

Value or Error returned by an operation that can fail.

Template Parameters
TThe success value type, or void.
Result<u32> result = ReadCount();
if (!result) {
REXLOG_ERROR("{}", result.error().GetDescription());
}
std::expected< T, Error > Result
Definition result.h:98

◆ WinSystemClock

using rex::WinSystemClock = detail::NtSystemClock<detail::Domain::kHost>

Unscaled host FILETIME clock. It converts to and from std::chrono::sys_time.

◆ XSystemClock

using rex::XSystemClock = detail::NtSystemClock<detail::Domain::kGuest>

Scaled guest FILETIME clock. Convert it with clock_cast to WinSystemClock.

Enumeration Type Documentation

◆ DriverType

enum class rex::DriverType : u8
strong
Enumerator
kGraphics 

rex::gpu::IGraphicsDriver, run by GraphicsSystem.

kAudio 

rex::apu::IAudioDriver, run by AudioSystem.

kInput 

rex::hid::IInputDriver, run by InputSystem. Several may be active.

kUI 

rex::ui::IUIDriver, run by UISystem.

◆ ErrorCategory

enum class rex::ErrorCategory : u8
strong

Broad classification of an error. Codes go in Error::code.

Enumerator
kMemory 

Memory allocation or mapping.

kFormat 

File format parsing (XEX, PE, ELF).

kCrypto 

Cryptography (decryption, signature).

kRuntime 

rex::kernel::TitleRuntime execution.

kValidation 

Validation, for example unresolved functions.

kModule 

Module loading, connection or initialization.

◆ GraphicsFamily

enum class rex::GraphicsFamily : u8
strong

The graphics family a title needs. It names the modules rexgpu-<family>-<name>.

◆ InputSourceType

enum class rex::InputSourceType : u8
strong

The types of input a binding can name. Mouse buttons are keys with their VirtualKey.

Enumerator
kKey 

A keyboard key or mouse button, code is a VirtualKey.

kMouseWheel 

A mouse wheel direction, sign gives the direction.

kPadButton 

A pad button or a stick direction as a button, code is a PadInput.

kPadAxes 

A whole pad stick, code is a PadAxes.

◆ MessageType

enum class rex::MessageType : u8
strong

Severity of a message box, which picks its icon.

◆ MouseButton

enum class rex::MouseButton : u8
strong
Enumerator
kNone 

A button the SDK has no name for, which only moves the pointer.

◆ PadInput

enum class rex::PadInput : u8
strong

Pad buttons in the order input sources and capture masks number them.

◆ PointerMode

enum class rex::PointerMode : u8
strong
Enumerator
kFree 

The arrow shows and moves freely.

kHidden 

The arrow hides, the title draws its own.

kLocked 

The arrow hides and stays in the window, motion arrives as deltas.

◆ SettingLayer

enum class rex::SettingLayer : u8
strong

Where a setting's value came from, lowest first. A higher layer wins. kLock refuses writes.

Enumerator
kTitle 

Code before the title launches, OnInit included.

kFile 

The player's config file.

kEnvironment 

A REX_<SCOPE>_<NAME> environment variable.

kCommandLine 

A –scope.name option.

kRuntime 

The console, the settings overlay, or code from launch until unload.

kLock 

Locked by the project's code.

◆ SettingLife

enum class rex::SettingLife : u8
strong
Enumerator
kLive 

Any time. Readers see the change on their next read.

kRestart 

Any time, applied on the next start. The registry lists it as pending.

kStartupOnly 

Until the modules init, just before OnInit.

◆ SettingType

enum class rex::SettingType : u8
strong
Enumerator
kPath 

std::filesystem::path. A value may name other paths as {scope.name}.

◆ VirtualKey

enum class rex::VirtualKey : u16
strong

Windows and XInput virtual keys. Platform keys translate to it for keystrokes and UI events.

Enumerator
kNone 

Not a valid key, MapVirtualKey has no translation.

kCancel 

Control break.

kXButton1 

First extra mouse button.

kXButton2 

Second extra mouse button.

kShift 

Either Shift key.

kMenu 

Alt.

kCapital 

Caps Lock.

kKana 

IME Kana mode, Japanese keyboards.

kHangeul 

IME Hangul mode, same code as kKana.

kHangul 

IME Hangul mode, same code as kKana.

kHanja 

IME Hanja mode, Korean keyboards.

kKanji 

IME Kanji mode, same code as kHanja.

kModeChange 

IME mode change request.

kPrior 

Page Up.

kNext 

Page Down.

kSnapshot 

Print Screen key.

kApps 

Applications key that opens the context menu.

kMultiply 

Numeric keypad multiply key.

kAdd 

Numeric keypad add key.

kSeparator 

Numeric keypad separator key.

kSubtract 

Numeric keypad subtract key.

kDecimal 

Numeric keypad decimal key.

kDivide 

Numeric keypad divide key.

kNavigationView 

VK_NAVIGATION_* added in _WIN32_WINNT 0x0604, reserved in WinUser.h.

kScroll 

Scroll Lock key.

kOemNecEqual 

NEC PC-9800 keyboard. '=' key on the numpad.

kOemFjJisho 

Fujitsu/OASYS keyboard. 'Dictionary' key.

kOemFjMasshou 

'Unregister word' key.

kOemFjTouroku 

'Register word' key.

kOemFjLOya 

'Left OYAYUBI' key.

kOemFjROya 

'Right OYAYUBI' key.

kLShift 

Left and right Alt, Ctrl and Shift. Windows uses them only as parameters to GetAsyncKeyState and GetKeyState.

kOem1 

';:' for the US.

kOemPlus 

'+' for any country.

kOemComma 

',' for any country.

kOemMinus 

'-' for any country.

kOemPeriod 

'.' for any country.

kOem2 

'/?' for the US.

kOem3 

The grave accent and tilde key for the US.

kXboxOneGamepadA 

VK_GAMEPAD_* codes added in _WIN32_WINNT 0x0604, reserved in WinUser.h.

kOem4 

'[{' for the US.

kOem5 

'|' for the US.

kOem6 

']}' for the US.

kOem7 

''"' for the US.

kOem8 

Miscellaneous character key, varies by keyboard.

kOemAx 

'AX' key on the Japanese AX keyboard.

kOem102 

"<>" or "\|" on the RT 102 key keyboard.

kIcoHelp 

Help key on the Olivetti keyboard (ICO).

kIco00 

00 key on the ICO.

kIcoClear 

Clear key on the ICO.

kPacket 

Passes Unicode characters as keystrokes. The low word of a 32 bit key value for non keyboard input methods.

kOemReset 

Nokia/Ericsson.

kOemEnlW 

OEM Enlarge Window key.

kNoName 

Reserved code with no key.

kOemClear 

Clear key, OEM specific.

kXInputPadA 

VK_PAD_* from XInput.h for XInputGetKeystroke.

Function Documentation

◆ AreBitsEqual()

bool rex::AreBitsEqual ( std::span< const f32 > a,
std::span< const f32 > b )
inline

Compares two runs of floats by bit pattern, so a NaN equals itself.

Returns
True when both runs have the same length and the same bits.

◆ bit_scan_forward() [1/4]

bool rex::bit_scan_forward ( i32 v,
u32 * out_first_set_index )
inline

Finds the lowest set bit, like the x86 BSF instruction.

Parameters
vThe value to scan, read as unsigned.
out_first_set_indexReceives the index of the lowest set bit.
Returns
False when v is 0, leaving out_first_set_index invalid.

◆ bit_scan_forward() [2/4]

bool rex::bit_scan_forward ( i64 v,
u32 * out_first_set_index )
inline

Finds the lowest set bit, like the x86 BSF instruction.

Parameters
vThe value to scan, read as unsigned.
out_first_set_indexReceives the index of the lowest set bit.
Returns
False when v is 0, leaving out_first_set_index invalid.

◆ bit_scan_forward() [3/4]

bool rex::bit_scan_forward ( u32 v,
u32 * out_first_set_index )
inline

Finds the lowest set bit, like the x86 BSF instruction.

Parameters
out_first_set_indexReceives the index of the lowest set bit.
Returns
False when v is 0, leaving out_first_set_index invalid.

◆ bit_scan_forward() [4/4]

bool rex::bit_scan_forward ( u64 v,
u32 * out_first_set_index )
inline

Finds the lowest set bit, like the x86 BSF instruction.

Parameters
out_first_set_indexReceives the index of the lowest set bit.
Returns
False when v is 0, leaving out_first_set_index invalid.

◆ BitCount()

template<class T>
u32 rex::BitCount ( T v)
constexpr

Returns the number of set bits in a value.

Template Parameters
TUnsigned integer type.

◆ byte_swap()

template<class T>
T rex::byte_swap ( T value)
constexprnoexcept

Reverses the byte order of a trivially copyable value of 1, 2, 4 or 8 bytes.

◆ clamp_float()

template<typename T>
T rex::clamp_float ( T value,
T min_value,
T max_value )

Clamps a floating point value. NaN becomes min_value, or max_value when min_value is NaN too. A result at a zero bound takes the sign of that bound.

Template Parameters
TFloating point type. The lower clamp narrows through f32.

◆ DecodeFATTimestamp()

u64 rex::DecodeFATTimestamp ( u32 date,
u32 time )
inline

Converts a FAT date and time to Windows FILETIME ticks.

Parameters
dateFAT date, 7 bits of years since 1980, 4 bits of month, 5 bits of day.
timeFAT time, 5 bits of hours, 6 bits of minutes, 5 bits of 2 second units.
Returns
100 nanosecond intervals since 1601-01-01 UTC. An out of range field carries into the next field.

◆ Err() [1/2]

template<typename T = void>
auto rex::Err ( Error error)
inline

Builds a failed result.

Template Parameters
TThe success value type of the result, void by default.

◆ Err() [2/2]

template<typename T = void>
auto rex::Err ( ErrorCategory category,
std::string message,
int code = 0 )
inline

Builds a failed result from the parts of an Error.

Template Parameters
TThe success value type of the result, void by default.
Parameters
codeCode from the platform or a library.

◆ FindModuleInterface()

template<typename... Interfaces, typename Module>
IInterface * rex::FindModuleInterface ( Module & module,
std::string_view name,
u32 version )

Finds an interface among those a module class derives from, for QueryInterface.

Template Parameters
InterfacesThe interfaces the module serves besides IModule.
Parameters
versionThe version, matched exactly.
Returns
The interface, or null when the module serves none by that name and version.

◆ GetDriverModules()

std::vector< std::string > rex::GetDriverModules ( DriverType type,
std::string_view names,
GraphicsFamily family = GraphicsFamily::kNone,
IInterfaceFactory * connected = nullptr )
nodiscard

Names the modules that serve the drivers of a type, in list order.

Parameters
namesDriver names separated by commas. Empty names, "none" and repeats are skipped.
familyThe family of a graphics driver, kNone for the other types.
connectedConnected modules. Their registered names are skipped. Null skips none.
Returns
The module names in list order.

◆ GetGraphicsFamilyName()

std::string_view rex::GetGraphicsFamilyName ( GraphicsFamily family)
nodiscard

Returns the module name text of a graphics family, empty for kNone.

◆ GetLogger()

Logger & rex::GetLogger ( )

Returns the process logger, starting it on the first call.

◆ GetNextRangeUnset()

template<typename Block>
std::pair< size_t, size_t > rex::GetNextRangeUnset ( const Block * bits,
size_t first,
size_t length )

Finds the first run of clear bits in a range.

Template Parameters
BlockUnsigned word type of the bit array.
Parameters
bitsThe bit array.
firstIndex of the first bit to search.
lengthNumber of bits to search starting at first.
Returns
The start and length in bits of the first clear run, or a length of 0 when none exists.

◆ GetPadButtonName()

std::string_view rex::GetPadButtonName ( PadInput button)

Returns the name of a pad button in binding text, or empty for a value outside PadInput.

◆ GetPathSettings()

PathSettings & rex::GetPathSettings ( )

Returns the path settings. The first call registers them.

◆ HasFlags()

template<FlagsEnum E>
bool rex::HasFlags ( E value,
E flags )
nodiscardconstexpr

Reports whether a set holds every flag of another set.

◆ hash_combine() [1/2]

size_t rex::hash_combine ( size_t hash)
inline

Ends the hash_combine recursion.

Returns
The hash value unchanged.

◆ hash_combine() [2/2]

template<typename T, typename... Ts>
size_t rex::hash_combine ( size_t hash,
const T & v,
const Ts &... vs )

Mixes the std::hash of each value into a hash value.

◆ HashBytes()

std::string rex::HashBytes ( std::string_view data)

128 bit XXH3 digest for fingerprints and cache keys, not for security use.

Parameters
dataThe bytes to hash.
Returns
The digest as a 32 character lowercase hex string.

◆ HashFile()

std::string rex::HashFile ( const std::filesystem::path & path)

128 bit XXH3 digest over the contents of a file.

Returns
The digest as a 32 character lowercase hex string, or an empty string when the path is not a regular file or cannot be opened or read.

◆ HashXXH3()

u64 rex::HashXXH3 ( std::span< const u8 > data)

64 bit XXH3 hash for hash tables and keys, not for security use.

Parameters
dataThe bytes to hash.

◆ Init()

Result< void > rex::Init ( const Config & config)
nodiscard

Loads and connects the listed modules in order, loads the plugins, then inits every module. A module that requires an interface only a later module serves fails at Connect. A failure shuts down and disconnects the modules in reverse. After Stop, Init runs the pending Shutdown first.

Returns
Success, or the reason a module could not load, connect or init.

◆ InputSourceToString()

std::string rex::InputSourceToString ( const InputSource & source)

Writes a source as binding text, modifiers in the order Shift, Ctrl, Alt and then the name.

Returns
The text ParseInputSource reads back, or empty when the source names nothing.

◆ is_pow2()

template<typename T>
bool rex::is_pow2 ( T value)
constexpr

Reports whether a value is a power of 2 or 0.

◆ IsSameInput()

bool rex::IsSameInput ( const InputSource & left,
const InputSource & right )
constexpr

Compares what two sources read, ignoring the stick row slot.

Returns
True when type, code, modifiers and sign are equal.

◆ KeyChordToString()

std::string rex::KeyChordToString ( KeyChord chord)

Writes a chord as text, modifiers in the order Shift, Ctrl, Alt and then the key name.

Returns
The text ParseKeyChord reads back, or empty when the key is VirtualKey::kNone or has no name.

◆ log2_ceil()

template<typename T>
T rex::log2_ceil ( T v)
inline

Returns the base 2 logarithm of a value rounded up.

Parameters
vA value greater than 0.

◆ log2_floor()

template<typename T>
T rex::log2_floor ( T v)
inline

Returns the base 2 logarithm of a value rounded down.

Parameters
vA value greater than 0.

◆ lzcnt() [1/8]

u8 rex::lzcnt ( i16 v)
inline

Returns the number of leading zero bits in a signed 16 bit value, or 16 when v is 0.

Parameters
vThe value to scan, read as unsigned.

◆ lzcnt() [2/8]

u8 rex::lzcnt ( i32 v)
inline

Returns the number of leading zero bits in a signed 32 bit value, or 32 when v is 0.

Parameters
vThe value to scan, read as unsigned.

◆ lzcnt() [3/8]

u8 rex::lzcnt ( i64 v)
inline

Returns the number of leading zero bits in a signed 64 bit value, or 64 when v is 0.

Parameters
vThe value to scan, read as unsigned.

◆ lzcnt() [4/8]

u8 rex::lzcnt ( i8 v)
inline

Returns the number of leading zero bits in a signed 8 bit value, or 8 when v is 0.

Parameters
vThe value to scan, read as unsigned.

◆ lzcnt() [5/8]

u8 rex::lzcnt ( u16 v)
inline

Returns the number of leading zero bits in a 16 bit value, or 16 when v is 0.

◆ lzcnt() [6/8]

u8 rex::lzcnt ( u32 v)
inline

Returns the number of leading zero bits in a 32 bit value, or 32 when v is 0.

◆ lzcnt() [7/8]

u8 rex::lzcnt ( u64 v)
inline

Returns the number of leading zero bits in a 64 bit value, or 64 when v is 0.

◆ lzcnt() [8/8]

u8 rex::lzcnt ( u8 v)
inline

Returns the number of leading zero bits in an 8 bit value, or 8 when v is 0.

◆ MakeBitmask()

u32 rex::MakeBitmask ( u32 a,
u32 b )
constexpr

Returns a mask with a contiguous range of bits set.

Parameters
aIndex of the lowest set bit.
bIndex of the highest set bit.

◆ mul_div()

u64 rex::mul_div ( u64 value,
u64 numerator,
u64 denominator )
constexpr

Multiplies a value by a fraction using a 128 bit product.

Parameters
denominatorThe fraction denominator, not 0.
Returns
The floor of value * numerator / denominator, saturated at the u64 maximum. A 0 denominator also returns the u64 maximum.

◆ next_pow2()

template<typename T>
T rex::next_pow2 ( T value)

Returns the smallest power of 2 greater than or equal to a value.

Template Parameters
TUnsigned integer type up to 32 bits.

◆ Ok() [1/2]

Result< void > rex::Ok ( )
inlinenodiscard

Builds a successful result with no value.

◆ Ok() [2/2]

template<typename T>
Result< T > rex::Ok ( T && value)
inlinenodiscard

Builds a successful result holding a value.

Parameters
valueThe value, forwarded into the result.

◆ operator""_GiB()

size_t rex::operator""_GiB ( unsigned long long int x)
constexpr

Returns a size in bytes from a count of gibibytes.

◆ operator""_KiB()

size_t rex::operator""_KiB ( unsigned long long int x)
constexpr

Returns a size in bytes from a count of kibibytes.

◆ operator""_MiB()

size_t rex::operator""_MiB ( unsigned long long int x)
constexpr

Returns a size in bytes from a count of mebibytes.

◆ operator""_PiB()

size_t rex::operator""_PiB ( unsigned long long int x)
constexpr

Returns a size in bytes from a count of pebibytes.

◆ operator""_TiB()

size_t rex::operator""_TiB ( unsigned long long int x)
constexpr

Returns a size in bytes from a count of tebibytes.

◆ operator&=()

template<FlagsEnum E>
E & rex::operator&= ( E & lhs,
E rhs )
constexpr

Keeps only the flags of a set that another set holds, in place.

Returns
lhs.

◆ operator^=()

template<FlagsEnum E>
E & rex::operator^= ( E & lhs,
E rhs )
constexpr

Toggles flags of a set in place.

Returns
lhs.

◆ operator|=()

template<FlagsEnum E>
E & rex::operator|= ( E & lhs,
E rhs )
constexpr

Adds flags to a set in place.

Returns
lhs.

◆ ParseInputSource()

Result< InputSource > rex::ParseInputSource ( std::string_view text)
nodiscard

Parses one input such as "Shift+W", "LMB", "WheelUp", "PadA" or "LStick". Key text follows ParseKeyChord and pad names take no modifiers. Names are case sensitive.

Returns
The source, or ErrorCategory::kConfig naming text when it is empty, a bare modifier or names nothing.

◆ ParseKeyChord()

Result< KeyChord > rex::ParseKeyChord ( std::string_view text)
nodiscard

Parses a chord such as "F3", "Shift+Up" or "Ctrl+Alt+K". The prefixes Shift, Ctrl, Control and Alt come in any order, then exactly one key name that ParseVirtualKey accepts. Names are case sensitive. An empty string is the unbound chord.

Returns
The chord, or ErrorCategory::kConfig naming text when the key is unknown, missing or a bare modifier.

◆ ParseKeyChordList()

Result< std::vector< KeyChord > > rex::ParseKeyChordList ( std::string_view text)
nodiscard

Parses a comma separated list of chords such as "Q,I" or "Shift+W, A". Spaces and tabs around an item are discarded and empty items are skipped.

Returns
The chords in order, or the error of the first item ParseKeyChord rejects.

◆ ParseVirtualKey()

VirtualKey rex::ParseVirtualKey ( std::string_view name)

Parses a key name.

Parameters
nameA key name such as "F3", "Backtick", "A" or "Escape".
Returns
The key, or VirtualKey::kNone for an unknown name.

◆ reduce_fraction() [1/2]

template<typename T>
void rex::reduce_fraction ( std::pair< T, T > & fraction)
constexpr

Divides a fraction by the greatest common divisor of its terms.

Parameters
fractionThe numerator and denominator, reduced in place.

◆ reduce_fraction() [2/2]

template<typename T>
void rex::reduce_fraction ( T & numerator,
T & denominator )
constexpr

Divides a fraction by the greatest common divisor of its terms.

Parameters
numeratorThe numerator, reduced in place.
denominatorThe denominator, reduced in place.

◆ Reinterpret() [1/2]

template<typename Dst, typename Src>
Dst rex::Reinterpret ( const Src &REX_RESTRICT_VAR src)

Returns the bits of a trivially copyable object as another type of the same size.

◆ Reinterpret() [2/2]

template<typename Dst, typename Src>
void rex::Reinterpret ( Dst &REX_RESTRICT_VAR dst,
const Src &REX_RESTRICT_VAR src )

Copies the bits of one trivially copyable object into another of the same size.

◆ RotateLeft()

template<typename T>
T rex::RotateLeft ( T v,
u8 sh )
inline

Rotates a value left.

Template Parameters
TUnsigned integer type.
Parameters
shRotation amount in bits, between 1 and the bit width of T minus 1.

◆ RoundUp()

template<typename T, typename V>
T rex::RoundUp ( T value,
V multiple )
constexpr

Rounds up to any multiple. 0 stays 0, as with RoundUpPow2.

Parameters
multipleThe multiple to round to, any positive value.

◆ RoundUpNonZero()

template<typename T, typename V>
T rex::RoundUpNonZero ( T value,
V multiple )
constexpr

Rounds up to any multiple. 0 becomes one multiple, so a size of 0 takes space.

Parameters
multipleThe multiple to round to, any positive value.
Returns
value rounded up to a multiple of multiple, never 0.

◆ RoundUpPow2()

template<typename T>
T rex::RoundUpPow2 ( T value,
T alignment )
constexpr

Rounds up to a power of 2 alignment. 0 stays 0.

Parameters
alignmentPower of 2 alignment.

◆ SatAdd()

template<typename T>
T rex::SatAdd ( T a,
T b )
inline

Saturating addition, from https://locklessinc.com/articles/sat_arithmetic/

Returns
a + b clamped to the range of T.

◆ SatSub()

template<typename T>
T rex::SatSub ( T a,
T b )
inline

Saturating subtraction, from https://locklessinc.com/articles/sat_arithmetic/

Returns
a - b clamped to the range of T.

◆ saturate()

template<typename T>
T rex::saturate ( T value)

Clamps to [0, 1] with shading language rules. NaN becomes +0.

◆ select_bits()

u32 rex::select_bits ( u32 value,
u32 a,
u32 b )
constexpr

Returns a range of bits of a value, shifted down to bit 0.

Parameters
aIndex of the lowest bit to extract.
bIndex of the highest bit to extract.

◆ SelectDrivers()

Result< std::vector< std::unique_ptr< IDriver > > > rex::SelectDrivers ( IInterfaceFactory & factory,
DriverType type,
std::string_view names,
IDriverContext & context )
nodiscard

Creates and initializes the drivers of a type, in list order.

Parameters
factoryThe factory that finds the connected modules.
namesDriver names separated by commas. Empty, or only "none", selects no driver.
contextThe context each driver initializes with.
Returns
The drivers in list order, or an error naming the driver that is missing or failed, after the earlier ones shut down.

◆ SetRange()

template<typename Block>
void rex::SetRange ( Block * bits,
size_t first,
size_t length )

Sets every bit in a range.

Template Parameters
BlockUnsigned word type of the bit array.
Parameters
bitsThe bit array.
firstIndex of the first bit to set.
lengthNumber of bits to set starting at first.

◆ ShowMessageBox()

void rex::ShowMessageBox ( MessageType type,
std::string_view message )

Shows a native message box and blocks until it closes. On POSIX it writes to stderr instead.

Parameters
typeThe icon and severity.
messageThe UTF-8 text.

◆ Shutdown()

void rex::Shutdown ( )

Runs Stop if needed, unloads the modules and ends the settings and logger sessions.

◆ Stop()

void rex::Stop ( )

Shuts down and disconnects every module in reverse order and makes AppInterfaces::Get return null. The libraries, settings and logger stay open until Shutdown. Does nothing when called again or before Init.

◆ tzcnt() [1/8]

u8 rex::tzcnt ( i16 v)
inline

Returns the number of trailing zero bits in a signed 16 bit value, or 16 when v is 0.

Parameters
vThe value to scan, read as unsigned.

◆ tzcnt() [2/8]

u8 rex::tzcnt ( i32 v)
inline

Returns the number of trailing zero bits in a signed 32 bit value, or 32 when v is 0.

Parameters
vThe value to scan, read as unsigned.

◆ tzcnt() [3/8]

u8 rex::tzcnt ( i64 v)
inline

Returns the number of trailing zero bits in a signed 64 bit value, or 64 when v is 0.

Parameters
vThe value to scan, read as unsigned.

◆ tzcnt() [4/8]

u8 rex::tzcnt ( i8 v)
inline

Returns the number of trailing zero bits in a signed 8 bit value, or 8 when v is 0.

Parameters
vThe value to scan, read as unsigned.

◆ tzcnt() [5/8]

u8 rex::tzcnt ( u16 v)
inline

Returns the number of trailing zero bits in a 16 bit value, or 16 when v is 0.

◆ tzcnt() [6/8]

u8 rex::tzcnt ( u32 v)
inline

Returns the number of trailing zero bits in a 32 bit value, or 32 when v is 0.

◆ tzcnt() [7/8]

u8 rex::tzcnt ( u64 v)
inline

Returns the number of trailing zero bits in a 64 bit value, or 64 when v is 0.

◆ tzcnt() [8/8]

u8 rex::tzcnt ( u8 v)
inline

Returns the number of trailing zero bits in an 8 bit value, or 8 when v is 0.

◆ VirtualKeyToString()

std::string rex::VirtualKeyToString ( VirtualKey key)
Returns
The name ParseVirtualKey accepts, or empty for a key with no name.

Variable Documentation

◆ is_flags_enum

template<typename E>
bool rex::is_flags_enum = false
inlineconstexpr

Opts an enum into the flag operators.

template <>
constexpr bool is_flags_enum
Definition bit.h:422

◆ kBuildIdentitySymbol

const char* rex::kBuildIdentitySymbol = "ReXBuildIdentity"
inlineconstexpr

The symbol a module exports to report the SDK build it was compiled against. The loader logs the text and does not compare it. A module loads on the interface names and versions it serves and requires.

◆ kCreateInterfaceSymbol

const char* rex::kCreateInterfaceSymbol = "ReXCreateInterface"
inlineconstexpr

The symbol a module exports to hand over its interfaces.

◆ kEnumerateInterfacesSymbol

const char* rex::kEnumerateInterfacesSymbol = "ReXEnumerateInterfaces"
inlineconstexpr

The symbol a module exports to list its interfaces.