Skip to content

Commit

Permalink
Plugin: Expose UsubscribedBuffersMask via rF2Extended::mUnsubscribedB…
Browse files Browse the repository at this point in the history
…uffersMask
  • Loading branch information
TheIronWolfModding committed Nov 10, 2019
1 parent 600bb1c commit 27b5afd
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 8 deletions.
2 changes: 2 additions & 0 deletions Include/rF2State.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion Include/rFactor2SharedMemoryMap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Monitor/rF2SMMonitor/rF2SMMonitor/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions Monitor/rF2SMMonitor/rF2SMMonitor/rF2Data.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
}
}
}
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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**

Expand Down
11 changes: 6 additions & 5 deletions Source/rFactor2SharedMemoryMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

Expand Down

0 comments on commit 27b5afd

Please sign in to comment.