From a5fd6aed43707e226df47df85ebc5d53ad68a35b Mon Sep 17 00:00:00 2001 From: Uriel Date: Thu, 7 Mar 2024 21:55:02 -0300 Subject: [PATCH] add automatic tracker toggle for SteamVR (#132) --- .../generated/all_generated.h | 14 +++++++++-- .../rpc/SteamVRTrackersSetting.java | 15 ++++++++---- .../rpc/SteamVRTrackersSettingT.java | 6 +++++ .../rpc/SteamVRTrackersSetting.kt | 14 ++++++++--- .../rpc/steam_vrtrackers_setting_generated.rs | 17 +++++++++++++ .../rpc/steam-vrtrackers-setting.ts | 24 +++++++++++++++---- schema/rpc.fbs | 1 + 7 files changed, 77 insertions(+), 14 deletions(-) diff --git a/protocol/cpp/include/solarxr_protocol/generated/all_generated.h b/protocol/cpp/include/solarxr_protocol/generated/all_generated.h index 868a4bbb..4b15130c 100644 --- a/protocol/cpp/include/solarxr_protocol/generated/all_generated.h +++ b/protocol/cpp/include/solarxr_protocol/generated/all_generated.h @@ -5163,7 +5163,8 @@ struct SteamVRTrackersSetting FLATBUFFERS_FINAL_CLASS : private flatbuffers::Tab VT_FEET = 8, VT_KNEES = 10, VT_ELBOWS = 12, - VT_HANDS = 14 + VT_HANDS = 14, + VT_AUTOMATICTRACKERTOGGLE = 16 }; bool waist() const { return GetField(VT_WAIST, 0) != 0; @@ -5183,6 +5184,9 @@ struct SteamVRTrackersSetting FLATBUFFERS_FINAL_CLASS : private flatbuffers::Tab bool hands() const { return GetField(VT_HANDS, 0) != 0; } + bool automaticTrackerToggle() const { + return GetField(VT_AUTOMATICTRACKERTOGGLE, 0) != 0; + } bool Verify(flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && VerifyField(verifier, VT_WAIST, 1) && @@ -5191,6 +5195,7 @@ struct SteamVRTrackersSetting FLATBUFFERS_FINAL_CLASS : private flatbuffers::Tab VerifyField(verifier, VT_KNEES, 1) && VerifyField(verifier, VT_ELBOWS, 1) && VerifyField(verifier, VT_HANDS, 1) && + VerifyField(verifier, VT_AUTOMATICTRACKERTOGGLE, 1) && verifier.EndTable(); } }; @@ -5217,6 +5222,9 @@ struct SteamVRTrackersSettingBuilder { void add_hands(bool hands) { fbb_.AddElement(SteamVRTrackersSetting::VT_HANDS, static_cast(hands), 0); } + void add_automaticTrackerToggle(bool automaticTrackerToggle) { + fbb_.AddElement(SteamVRTrackersSetting::VT_AUTOMATICTRACKERTOGGLE, static_cast(automaticTrackerToggle), 0); + } explicit SteamVRTrackersSettingBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); @@ -5235,8 +5243,10 @@ inline flatbuffers::Offset CreateSteamVRTrackersSetting( bool feet = false, bool knees = false, bool elbows = false, - bool hands = false) { + bool hands = false, + bool automaticTrackerToggle = false) { SteamVRTrackersSettingBuilder builder_(_fbb); + builder_.add_automaticTrackerToggle(automaticTrackerToggle); builder_.add_hands(hands); builder_.add_elbows(elbows); builder_.add_knees(knees); diff --git a/protocol/java/src/solarxr_protocol/rpc/SteamVRTrackersSetting.java b/protocol/java/src/solarxr_protocol/rpc/SteamVRTrackersSetting.java index 8b04ae80..ac459fbd 100644 --- a/protocol/java/src/solarxr_protocol/rpc/SteamVRTrackersSetting.java +++ b/protocol/java/src/solarxr_protocol/rpc/SteamVRTrackersSetting.java @@ -21,6 +21,7 @@ public final class SteamVRTrackersSetting extends Table { public boolean knees() { int o = __offset(10); return o != 0 ? 0!=bb.get(o + bb_pos) : false; } public boolean elbows() { int o = __offset(12); return o != 0 ? 0!=bb.get(o + bb_pos) : false; } public boolean hands() { int o = __offset(14); return o != 0 ? 0!=bb.get(o + bb_pos) : false; } + public boolean automaticTrackerToggle() { int o = __offset(16); return o != 0 ? 0!=bb.get(o + bb_pos) : false; } public static int createSteamVRTrackersSetting(FlatBufferBuilder builder, boolean waist, @@ -28,8 +29,10 @@ public static int createSteamVRTrackersSetting(FlatBufferBuilder builder, boolean feet, boolean knees, boolean elbows, - boolean hands) { - builder.startTable(6); + boolean hands, + boolean automaticTrackerToggle) { + builder.startTable(7); + SteamVRTrackersSetting.addAutomaticTrackerToggle(builder, automaticTrackerToggle); SteamVRTrackersSetting.addHands(builder, hands); SteamVRTrackersSetting.addElbows(builder, elbows); SteamVRTrackersSetting.addKnees(builder, knees); @@ -39,13 +42,14 @@ public static int createSteamVRTrackersSetting(FlatBufferBuilder builder, return SteamVRTrackersSetting.endSteamVRTrackersSetting(builder); } - public static void startSteamVRTrackersSetting(FlatBufferBuilder builder) { builder.startTable(6); } + public static void startSteamVRTrackersSetting(FlatBufferBuilder builder) { builder.startTable(7); } public static void addWaist(FlatBufferBuilder builder, boolean waist) { builder.addBoolean(0, waist, false); } public static void addChest(FlatBufferBuilder builder, boolean chest) { builder.addBoolean(1, chest, false); } public static void addFeet(FlatBufferBuilder builder, boolean feet) { builder.addBoolean(2, feet, false); } public static void addKnees(FlatBufferBuilder builder, boolean knees) { builder.addBoolean(3, knees, false); } public static void addElbows(FlatBufferBuilder builder, boolean elbows) { builder.addBoolean(4, elbows, false); } public static void addHands(FlatBufferBuilder builder, boolean hands) { builder.addBoolean(5, hands, false); } + public static void addAutomaticTrackerToggle(FlatBufferBuilder builder, boolean automaticTrackerToggle) { builder.addBoolean(6, automaticTrackerToggle, false); } public static int endSteamVRTrackersSetting(FlatBufferBuilder builder) { int o = builder.endTable(); return o; @@ -75,6 +79,8 @@ public void unpackTo(SteamVRTrackersSettingT _o) { _o.setElbows(_oElbows); boolean _oHands = hands(); _o.setHands(_oHands); + boolean _oAutomaticTrackerToggle = automaticTrackerToggle(); + _o.setAutomaticTrackerToggle(_oAutomaticTrackerToggle); } public static int pack(FlatBufferBuilder builder, SteamVRTrackersSettingT _o) { if (_o == null) return 0; @@ -85,7 +91,8 @@ public static int pack(FlatBufferBuilder builder, SteamVRTrackersSettingT _o) { _o.getFeet(), _o.getKnees(), _o.getElbows(), - _o.getHands()); + _o.getHands(), + _o.getAutomaticTrackerToggle()); } } diff --git a/protocol/java/src/solarxr_protocol/rpc/SteamVRTrackersSettingT.java b/protocol/java/src/solarxr_protocol/rpc/SteamVRTrackersSettingT.java index b3964b78..1db6b232 100644 --- a/protocol/java/src/solarxr_protocol/rpc/SteamVRTrackersSettingT.java +++ b/protocol/java/src/solarxr_protocol/rpc/SteamVRTrackersSettingT.java @@ -14,6 +14,7 @@ public class SteamVRTrackersSettingT { private boolean knees; private boolean elbows; private boolean hands; + private boolean automaticTrackerToggle; public boolean getWaist() { return waist; } @@ -39,6 +40,10 @@ public class SteamVRTrackersSettingT { public void setHands(boolean hands) { this.hands = hands; } + public boolean getAutomaticTrackerToggle() { return automaticTrackerToggle; } + + public void setAutomaticTrackerToggle(boolean automaticTrackerToggle) { this.automaticTrackerToggle = automaticTrackerToggle; } + public SteamVRTrackersSettingT() { this.waist = false; @@ -47,6 +52,7 @@ public SteamVRTrackersSettingT() { this.knees = false; this.elbows = false; this.hands = false; + this.automaticTrackerToggle = false; } } diff --git a/protocol/kotlin/src/solarxr_protocol/rpc/SteamVRTrackersSetting.kt b/protocol/kotlin/src/solarxr_protocol/rpc/SteamVRTrackersSetting.kt index e124ffd2..71bbefaa 100644 --- a/protocol/kotlin/src/solarxr_protocol/rpc/SteamVRTrackersSetting.kt +++ b/protocol/kotlin/src/solarxr_protocol/rpc/SteamVRTrackersSetting.kt @@ -46,6 +46,11 @@ class SteamVRTrackersSetting : Table() { val o = __offset(14) return if(o != 0) 0.toByte() != bb.get(o + bb_pos) else false } + val automaticTrackerToggle : Boolean + get() { + val o = __offset(16) + return if(o != 0) 0.toByte() != bb.get(o + bb_pos) else false + } companion object { @JvmStatic fun validateVersion() = Constants.FLATBUFFERS_22_10_26() @@ -57,8 +62,9 @@ class SteamVRTrackersSetting : Table() { return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)) } @JvmStatic - fun createSteamVRTrackersSetting(builder: FlatBufferBuilder, waist: Boolean, chest: Boolean, feet: Boolean, knees: Boolean, elbows: Boolean, hands: Boolean) : Int { - builder.startTable(6) + fun createSteamVRTrackersSetting(builder: FlatBufferBuilder, waist: Boolean, chest: Boolean, feet: Boolean, knees: Boolean, elbows: Boolean, hands: Boolean, automaticTrackerToggle: Boolean) : Int { + builder.startTable(7) + addAutomaticTrackerToggle(builder, automaticTrackerToggle) addHands(builder, hands) addElbows(builder, elbows) addKnees(builder, knees) @@ -68,7 +74,7 @@ class SteamVRTrackersSetting : Table() { return endSteamVRTrackersSetting(builder) } @JvmStatic - fun startSteamVRTrackersSetting(builder: FlatBufferBuilder) = builder.startTable(6) + fun startSteamVRTrackersSetting(builder: FlatBufferBuilder) = builder.startTable(7) @JvmStatic fun addWaist(builder: FlatBufferBuilder, waist: Boolean) = builder.addBoolean(0, waist, false) @JvmStatic @@ -82,6 +88,8 @@ class SteamVRTrackersSetting : Table() { @JvmStatic fun addHands(builder: FlatBufferBuilder, hands: Boolean) = builder.addBoolean(5, hands, false) @JvmStatic + fun addAutomaticTrackerToggle(builder: FlatBufferBuilder, automaticTrackerToggle: Boolean) = builder.addBoolean(6, automaticTrackerToggle, false) + @JvmStatic fun endSteamVRTrackersSetting(builder: FlatBufferBuilder) : Int { val o = builder.endTable() return o diff --git a/protocol/rust/src/generated/solarxr_protocol/rpc/steam_vrtrackers_setting_generated.rs b/protocol/rust/src/generated/solarxr_protocol/rpc/steam_vrtrackers_setting_generated.rs index 64228682..614989eb 100644 --- a/protocol/rust/src/generated/solarxr_protocol/rpc/steam_vrtrackers_setting_generated.rs +++ b/protocol/rust/src/generated/solarxr_protocol/rpc/steam_vrtrackers_setting_generated.rs @@ -31,6 +31,7 @@ impl<'a> SteamVRTrackersSetting<'a> { pub const VT_KNEES: flatbuffers::VOffsetT = 10; pub const VT_ELBOWS: flatbuffers::VOffsetT = 12; pub const VT_HANDS: flatbuffers::VOffsetT = 14; + pub const VT_AUTOMATICTRACKERTOGGLE: flatbuffers::VOffsetT = 16; #[inline] pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { @@ -42,6 +43,7 @@ impl<'a> SteamVRTrackersSetting<'a> { args: &'args SteamVRTrackersSettingArgs ) -> flatbuffers::WIPOffset> { let mut builder = SteamVRTrackersSettingBuilder::new(_fbb); + builder.add_automaticTrackerToggle(args.automaticTrackerToggle); builder.add_hands(args.hands); builder.add_elbows(args.elbows); builder.add_knees(args.knees); @@ -94,6 +96,13 @@ impl<'a> SteamVRTrackersSetting<'a> { // which contains a valid value in this slot unsafe { self._tab.get::(SteamVRTrackersSetting::VT_HANDS, Some(false)).unwrap()} } + #[inline] + pub fn automaticTrackerToggle(&self) -> bool { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(SteamVRTrackersSetting::VT_AUTOMATICTRACKERTOGGLE, Some(false)).unwrap()} + } } impl flatbuffers::Verifiable for SteamVRTrackersSetting<'_> { @@ -109,6 +118,7 @@ impl flatbuffers::Verifiable for SteamVRTrackersSetting<'_> { .visit_field::("knees", Self::VT_KNEES, false)? .visit_field::("elbows", Self::VT_ELBOWS, false)? .visit_field::("hands", Self::VT_HANDS, false)? + .visit_field::("automaticTrackerToggle", Self::VT_AUTOMATICTRACKERTOGGLE, false)? .finish(); Ok(()) } @@ -120,6 +130,7 @@ pub struct SteamVRTrackersSettingArgs { pub knees: bool, pub elbows: bool, pub hands: bool, + pub automaticTrackerToggle: bool, } impl<'a> Default for SteamVRTrackersSettingArgs { #[inline] @@ -131,6 +142,7 @@ impl<'a> Default for SteamVRTrackersSettingArgs { knees: false, elbows: false, hands: false, + automaticTrackerToggle: false, } } } @@ -165,6 +177,10 @@ impl<'a: 'b, 'b> SteamVRTrackersSettingBuilder<'a, 'b> { self.fbb_.push_slot::(SteamVRTrackersSetting::VT_HANDS, hands, false); } #[inline] + pub fn add_automaticTrackerToggle(&mut self, automaticTrackerToggle: bool) { + self.fbb_.push_slot::(SteamVRTrackersSetting::VT_AUTOMATICTRACKERTOGGLE, automaticTrackerToggle, false); + } + #[inline] pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> SteamVRTrackersSettingBuilder<'a, 'b> { let start = _fbb.start_table(); SteamVRTrackersSettingBuilder { @@ -188,6 +204,7 @@ impl core::fmt::Debug for SteamVRTrackersSetting<'_> { ds.field("knees", &self.knees()); ds.field("elbows", &self.elbows()); ds.field("hands", &self.hands()); + ds.field("automaticTrackerToggle", &self.automaticTrackerToggle()); ds.finish() } } diff --git a/protocol/typescript/src/solarxr-protocol/rpc/steam-vrtrackers-setting.ts b/protocol/typescript/src/solarxr-protocol/rpc/steam-vrtrackers-setting.ts index 915cef23..a9290123 100644 --- a/protocol/typescript/src/solarxr-protocol/rpc/steam-vrtrackers-setting.ts +++ b/protocol/typescript/src/solarxr-protocol/rpc/steam-vrtrackers-setting.ts @@ -52,8 +52,13 @@ hands():boolean { return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; } +automaticTrackerToggle():boolean { + const offset = this.bb!.__offset(this.bb_pos, 16); + return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; +} + static startSteamVRTrackersSetting(builder:flatbuffers.Builder) { - builder.startObject(6); + builder.startObject(7); } static addWaist(builder:flatbuffers.Builder, waist:boolean) { @@ -80,12 +85,16 @@ static addHands(builder:flatbuffers.Builder, hands:boolean) { builder.addFieldInt8(5, +hands, +false); } +static addAutomaticTrackerToggle(builder:flatbuffers.Builder, automaticTrackerToggle:boolean) { + builder.addFieldInt8(6, +automaticTrackerToggle, +false); +} + static endSteamVRTrackersSetting(builder:flatbuffers.Builder):flatbuffers.Offset { const offset = builder.endObject(); return offset; } -static createSteamVRTrackersSetting(builder:flatbuffers.Builder, waist:boolean, chest:boolean, feet:boolean, knees:boolean, elbows:boolean, hands:boolean):flatbuffers.Offset { +static createSteamVRTrackersSetting(builder:flatbuffers.Builder, waist:boolean, chest:boolean, feet:boolean, knees:boolean, elbows:boolean, hands:boolean, automaticTrackerToggle:boolean):flatbuffers.Offset { SteamVRTrackersSetting.startSteamVRTrackersSetting(builder); SteamVRTrackersSetting.addWaist(builder, waist); SteamVRTrackersSetting.addChest(builder, chest); @@ -93,6 +102,7 @@ static createSteamVRTrackersSetting(builder:flatbuffers.Builder, waist:boolean, SteamVRTrackersSetting.addKnees(builder, knees); SteamVRTrackersSetting.addElbows(builder, elbows); SteamVRTrackersSetting.addHands(builder, hands); + SteamVRTrackersSetting.addAutomaticTrackerToggle(builder, automaticTrackerToggle); return SteamVRTrackersSetting.endSteamVRTrackersSetting(builder); } @@ -103,7 +113,8 @@ unpack(): SteamVRTrackersSettingT { this.feet(), this.knees(), this.elbows(), - this.hands() + this.hands(), + this.automaticTrackerToggle() ); } @@ -115,6 +126,7 @@ unpackTo(_o: SteamVRTrackersSettingT): void { _o.knees = this.knees(); _o.elbows = this.elbows(); _o.hands = this.hands(); + _o.automaticTrackerToggle = this.automaticTrackerToggle(); } } @@ -125,7 +137,8 @@ constructor( public feet: boolean = false, public knees: boolean = false, public elbows: boolean = false, - public hands: boolean = false + public hands: boolean = false, + public automaticTrackerToggle: boolean = false ){} @@ -136,7 +149,8 @@ pack(builder:flatbuffers.Builder): flatbuffers.Offset { this.feet, this.knees, this.elbows, - this.hands + this.hands, + this.automaticTrackerToggle ); } } diff --git a/schema/rpc.fbs b/schema/rpc.fbs index a40425dd..5295677e 100644 --- a/schema/rpc.fbs +++ b/schema/rpc.fbs @@ -154,6 +154,7 @@ table SteamVRTrackersSetting { knees: bool; elbows: bool; hands: bool; + automaticTrackerToggle: bool; } table FilteringSettings {