From 27b5afda257c798a5bdd341f78993a434350d137 Mon Sep 17 00:00:00 2001 From: TheIronWolfModding Date: Sun, 10 Nov 2019 08:41:59 -0800 Subject: [PATCH] Plugin: Expose UsubscribedBuffersMask via rF2Extended::mUnsubscribedBuffersMask --- Include/rF2State.h | 2 ++ Include/rFactor2SharedMemoryMap.hpp | 2 +- Monitor/rF2SMMonitor/rF2SMMonitor/MainForm.cs | 2 +- Monitor/rF2SMMonitor/rF2SMMonitor/rF2Data.cs | 2 ++ README.md | 7 ++++++- Source/rFactor2SharedMemoryMap.cpp | 11 ++++++----- 6 files changed, 18 insertions(+), 8 deletions(-) diff --git a/Include/rF2State.h b/Include/rF2State.h index f77792a..38ab87a 100644 --- a/Include/rF2State.h +++ b/Include/rF2State.h @@ -946,6 +946,8 @@ struct rF2Extended : public rF2MappedBufferHeader ULONGLONG mTicksLSIRulesInstructionMessageUpdated; // Ticks when last FCY rules message was updated. Currently, only SCR plugin sets that. char mLSIRulesInstructionMessage[rF2MappedBufferHeader::MAX_RULES_INSTRUCTION_MSG_LEN]; + + long mUnsubscribedBuffersMask; // Currently active UnsbscribedBuffersMask value. This will be allowed for clients to write to in the future, but not yet. }; #pragma pack(pop) diff --git a/Include/rFactor2SharedMemoryMap.hpp b/Include/rFactor2SharedMemoryMap.hpp index 0fc6584..f03aa0e 100644 --- a/Include/rFactor2SharedMemoryMap.hpp +++ b/Include/rFactor2SharedMemoryMap.hpp @@ -28,7 +28,7 @@ Website: thecrewchief.org // Each component can be in [0:99] range. // Note: each time major version changes, that means layout has changed, and clients might need an update. #define PLUGIN_VERSION_MAJOR "3.7" -#define PLUGIN_VERSION_MINOR "0.0" +#define PLUGIN_VERSION_MINOR "1.0" #ifdef VERSION_AVX2 #ifdef VERSION_MT diff --git a/Monitor/rF2SMMonitor/rF2SMMonitor/MainForm.cs b/Monitor/rF2SMMonitor/rF2SMMonitor/MainForm.cs index a5d8f41..a36fa4e 100644 --- a/Monitor/rF2SMMonitor/rF2SMMonitor/MainForm.cs +++ b/Monitor/rF2SMMonitor/rF2SMMonitor/MainForm.cs @@ -695,7 +695,7 @@ void View_Paint(object sender, PaintEventArgs e) this.maxFFBValue = Math.Max(Math.Abs(this.forceFeedback.mForceValue), this.maxFFBValue); gameStateText.Append( - $"Plugin Version: Expected: 3.7.0.0 64bit Actual: {MainForm.GetStringFromBytes(this.extended.mVersion)} {(this.extended.is64bit == 1 ? "64bit" : "32bit")}{(this.extended.mSCRPluginEnabled == 1 ? " SCR Plugin enabled" : "")}{(this.extended.mDirectMemoryAccessEnabled == 1 ? " DMA enabled" : "")} FPS: {this.fps} FFB Curr: {this.forceFeedback.mForceValue:N3} Max: {this.maxFFBValue:N3}"); + $"Plugin Version: Expected: 3.7.1.0 64bit Actual: {MainForm.GetStringFromBytes(this.extended.mVersion)} {(this.extended.is64bit == 1 ? "64bit" : "32bit")}{(this.extended.mSCRPluginEnabled == 1 ? " SCR Plugin enabled" : "")}{(this.extended.mDirectMemoryAccessEnabled == 1 ? " DMA enabled" : "")} UBM: {this.extended.mUnsubscribedBuffersMask} FPS: {this.fps} FFB Curr: {this.forceFeedback.mForceValue:N3} Max: {this.maxFFBValue:N3}"); // Draw header g.DrawString(gameStateText.ToString(), SystemFonts.DefaultFont, brush, currX, currY); diff --git a/Monitor/rF2SMMonitor/rF2SMMonitor/rF2Data.cs b/Monitor/rF2SMMonitor/rF2SMMonitor/rF2Data.cs index 7685cc3..8c27eb8 100644 --- a/Monitor/rF2SMMonitor/rF2SMMonitor/rF2Data.cs +++ b/Monitor/rF2SMMonitor/rF2SMMonitor/rF2Data.cs @@ -945,6 +945,8 @@ public struct rF2Extended public Int64 mTicksLSIRulesInstructionMessageUpdated; // Ticks when last FCY rules message was updated. Currently, only SCR plugin sets that. [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = rFactor2Constants.MAX_RULES_INSTRUCTION_MSG_LEN)] public byte[] mLSIRulesInstructionMessage; + + public long mUnsubscribedBuffersMask; // Currently active UnsbscribedBuffersMask value. This will be allowed for clients to write to in the future, but not yet. } } } \ No newline at end of file diff --git a/README.md b/README.md index 240f8cf..a85c680 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,11 @@ If you would like to support this project, you can donate [here.](http://thecrew # Release history +**11/10/2019 - v3.7.1.0** + + Plugin: + * Expose `UsubscribedBuffersMask` via `rF2Extended::mUnsubscribedBuffersMask`. This can be used by clients to validate UBM, and might be made client writable in the future. + **11/08/2019 - v3.7.0.0** Plugin: @@ -96,7 +101,7 @@ MultiRules = 8, ForceFeedback = 16, Graphics = 32` -So, to unsubscribe from `Multi Rules` and `Graphics` buffeers set `UnsubscribedBuffersMask` to 40 (8 + 32). +So, to unsubscribe from `Multi Rules` and `Graphics` buffers set `UnsubscribedBuffersMask` to 40 (8 + 32). **05/01/2019 - v3.6.0.0** diff --git a/Source/rFactor2SharedMemoryMap.cpp b/Source/rFactor2SharedMemoryMap.cpp index 7329b86..8321ecd 100644 --- a/Source/rFactor2SharedMemoryMap.cpp +++ b/Source/rFactor2SharedMemoryMap.cpp @@ -294,23 +294,24 @@ void SharedMemoryPlugin::Startup(long version) DEBUG_MSG3(DebugLevel::CriticalInfo, "Size of the Extended buffer:", sizeSz, "bytes."); } + mExtStateTracker.mExtended.mUnsubscribedBuffersMask = SharedMemoryPlugin::msUnsubscribedBuffersMask; if (SharedMemoryPlugin::msDirectMemoryAccessRequested) { if (!mDMR.Initialize()) { DEBUG_MSG(DebugLevel::Errors, "ERROR: Failed to initialize DMA, disabling DMA."); // Disable DMA on failure. SharedMemoryPlugin::msDirectMemoryAccessRequested = false; - mExtStateTracker.mExtended.mDirectMemoryAccessEnabled = false; // No flip necessary as this defaults to false anyway. + mExtStateTracker.mExtended.mDirectMemoryAccessEnabled = false; } else { mExtStateTracker.mExtended.mDirectMemoryAccessEnabled = true; mExtStateTracker.mExtended.mSCRPluginEnabled = mDMR.IsSCRPluginEnabled(); mExtStateTracker.mExtended.mSCRPluginDoubleFileType = mDMR.GetSCRPluginDoubleFileType(); - - mExtended.BeginUpdate(); - memcpy(mExtended.mpBuff, &(mExtStateTracker.mExtended), sizeof(rF2Extended)); - mExtended.EndUpdate(); } + + mExtended.BeginUpdate(); + memcpy(mExtended.mpBuff, &(mExtStateTracker.mExtended), sizeof(rF2Extended)); + mExtended.EndUpdate(); } }