Skip to content

Converting Package to UPM #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed DirectInput-SampleScene.unitypackage
Binary file not shown.
2 changes: 1 addition & 1 deletion Plugin.meta → Editor.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions Editor/mrtimcakes.directinput.Editor.asmdef
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "mrtimcakes.directinput.Editor",
"rootNamespace": "DirectInputManager.Editor",
"references": [],
"includePlatforms": [],
"excludePlatforms": [
"Android",
"EmbeddedLinux",
"iOS",
"LinuxStandalone64",
"CloudRendering",
"macOSStandalone",
"Switch",
"PS4",
"PS5",
"QNX",
"ReservedCFE",
"tvOS",
"WSA",
"VisionOS",
"WebGL",
"WindowsStandalone32Server",
"WindowsStandalone64Server",
"GameCoreXboxOne",
"XboxOne",
"GameCoreScarlett"
],
"allowUnsafeCode": false,
"overrideReferences": true,
"precompiledReferences": [
""
],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
7 changes: 7 additions & 0 deletions Editor/mrtimcakes.directinput.Editor.asmdef.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion LICENSE.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Runtime.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions Plugin/DirectInputLogger.cs → Runtime/DirectInputLogger.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
/*
*
* Logger for Direct Input by ImDanOush (ATG-Simulator.com), Good for debugs and logs
*
* Logger for Direct Input by ImDanOush (ATG-Simulator.com), Good for debugs and logs
*
*/
using UnityEngine;
using System.Collections.Generic;
using System.Linq;

public class DirectInputLogger : MonoBehaviour
namespace DirectInputManager
{
public class DirectInputLogger : MonoBehaviour
{
public static DirectInputLogger Instance { get; private set; }
private static List<LogEntry> visualLogs = new();
private static Vector2 logScrollPosition;
Expand Down Expand Up @@ -207,3 +209,5 @@ private void OnGUI()
GUI.color = originalColor;
}
}
}

11 changes: 11 additions & 0 deletions Runtime/DirectInputLogger.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 17 additions & 13 deletions Plugin/DirectInputManager.cs → Runtime/DirectInputManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
using System.Linq;
using System.Security.Cryptography;
using System.Diagnostics;
using System.IO;
using System.Text;
using UnityEditor.PackageManager;
using UnityEngine;
#if UNITY_STANDALONE_WIN
using UnityEngine;
#endif
Expand All @@ -19,7 +22,7 @@ class Native
#if UNITY_STANDALONE_WIN
const string DLLFile = @"DirectInputForceFeedback.dll";
#else
const string DLLFile = @"..\..\..\..\..\Plugin\DLL\DirectInputForceFeedback.dll";
private const string DLLFile = "DirectInputForceFeedback";
#endif
[DllImport(DLLFile, CharSet = CharSet.Ansi, EntryPoint = "UpdateConstantForce")]
internal static extern int UpdateConstantForceSimple([MarshalAs(UnmanagedType.LPStr)] string guidInstance, int magnitude);
Expand Down Expand Up @@ -128,8 +131,9 @@ public class DIManager
//////////////////////////////////////////////////////////////
// Cross Platform "Macros" - Allows lib to work in Visual Studio & Unity
//////////////////////////////////////////////////////////////

#if UNITY_STANDALONE_WIN
//Need this to work when target build is set to android, adding Android temporarily
//TODO: FIX Unity_Android
#if UNITY_STANDALONE_WIN || UNITY_ANDROID
private static uint ClampAgnostic(uint value, uint min, uint max) => (uint)Mathf.Clamp(value, min, max);
private static int ClampAgnostic(int value, int min, int max) => Mathf.Clamp(value, min, max);

Expand Down Expand Up @@ -603,7 +607,7 @@ private static async void ScanDevicesForChanges()

/// <summary>
/// Update existing effect with new DICONDITION array<br/><br/>
///
///
/// DICondition[DeviceFFBEffectAxesCount]:<br/><br/>
/// deadband: Inacive Zone [-10,000 - 10,000]<br/>
/// offset: Move Effect Center[-10,000 - 10,000]<br/>
Expand Down Expand Up @@ -937,7 +941,7 @@ public static bool UpdateCustomForceSimple(string guidInstance, int[] forceData,
/// <returns>
/// Bool if GUID was found <br/>
/// OUT ADI of device if found
/// </returns>
/// </returns>
public static bool GetADI(DeviceInfo device, out ActiveDeviceInfo ADI) => GetADI(device.guidInstance, out ADI);

//////////////////////////////////////////////////////////////
Expand All @@ -946,7 +950,7 @@ public static bool UpdateCustomForceSimple(string guidInstance, int[] forceData,

/// <summary>
/// Update existing effect with new DICONDITION array<br/><br/>
///
///
/// DICondition[DeviceFFBEffectAxesCount]:<br/><br/>
/// deadband: Inacive Zone [-10,000 - 10,000]<br/>
/// offset: Move Effect Center[-10,000 - 10,000]<br/>
Expand Down Expand Up @@ -1317,22 +1321,22 @@ public struct DICondition
/// </summary>
public int offset;
/// <summary>
/// Coefficient constant on the positive side of the offset, in the range
/// Coefficient constant on the positive side of the offset, in the range
/// from - 10,000 through 10,000.
/// </summary>
public int positiveCoefficient;
/// <summary>
/// Coefficient constant on the negative side of the offset, in the range
/// Coefficient constant on the negative side of the offset, in the range
/// from - 10,000 through 10,000. If the device does not support separate
/// positive and negative coefficients, the value of lNegativeCoefficient
/// is ignored, and the value of lPositiveCoefficient is used as both the
/// positive and negative coefficients, the value of lNegativeCoefficient
/// is ignored, and the value of lPositiveCoefficient is used as both the
/// positive and negative coefficients.
/// </summary>
public int negativeCoefficient;
/// <summary>
/// Maximum force output on the positive side of the offset, in the range
/// from 0 through 10,000.
///
///
/// If the device does not support force saturation, the value of this
/// member is ignored.
/// </summary>
Expand All @@ -1343,14 +1347,14 @@ public struct DICondition
///
/// If the device does not support force saturation, the value of this member
/// is ignored.
///
///
/// If the device does not support separate positive and negative saturation,
/// the value of dwNegativeSaturation is ignored, and the value of dwPositiveSaturation
/// is used as both the positive and negative saturation.
/// </summary>
public uint negativeSaturation;
/// <summary>
/// Range about the center of the axis that is ignored by the effect.
/// Range about the center of the axis that is ignored by the effect.
/// This value is in the range from 0 through 10,000.
/// </summary>
public int deadband; // Changed from uint to int to match native LONG type
Expand Down
11 changes: 11 additions & 0 deletions Runtime/DirectInputManager.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Runtime/Plugins.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Runtime/Plugins/DLL.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

69 changes: 69 additions & 0 deletions Runtime/Plugins/DLL/DirectInputForceFeedback.dll.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading