Final V 2.28.0 Build 62 upload

Build with VS 2017 Community (current SP)
addnl fix of an old Joystick Hat issue
Updated docs and some fixes accord. VStudio code analysis
pull/104/head v2.28beta
bm98 7 years ago
parent ffe5005c2b
commit 25d52b62c7

@ -8,7 +8,7 @@ using System.Windows.Forms;
namespace SCJMapper_V2
{
sealed class AppSettings : ApplicationSettingsBase
sealed class AppSettings : ApplicationSettingsBase, IDisposable
{
FormSettings FS = null;
@ -25,6 +25,22 @@ namespace SCJMapper_V2
}
}
public void Dispose( bool disposing )
{
if ( disposing ) {
// dispose managed resources
if ( FS != null ) FS.Dispose( );
}
// free native resources
}
public void Dispose()
{
Dispose( true );
GC.SuppressFinalize( this );
}
/// <summary>
/// Show the Settings Dialog
/// </summary>

@ -6,6 +6,7 @@ using System.Threading.Tasks;
namespace SCJMapper_V2
{
//[Serializable]
public class CloneableDictionary<TKey, TValue> : Dictionary<TKey, TValue> where TValue : ICloneable
{
public virtual object Clone( )

@ -18,9 +18,10 @@
foreach ( Joystick.JoystickCls js in DeviceInst.JoystickListRef ) js.FinishDX( );
DeviceInst.JoystickListRef.Clear( );
if ( disposing && ( components != null ) ) {
components.Dispose( );
}
if ( disposing && ( components != null ) ) components.Dispose( );
if ( disposing && ( m_AT != null ) ) m_AT.Dispose( );
if ( disposing && ( m_AppSettings != null ) ) m_AppSettings.Dispose( );
base.Dispose( disposing );
}

@ -229,7 +229,7 @@ namespace SCJMapper_V2.Gamepad
m_device = device;
m_gPanel = panel;
MyTabPageIndex = tabIndex;
Activated = false;
m_activated = false;
m_senseLimit = AppConfiguration.AppConfig.gpSenseLimit; // can be changed in the app.config file if it is still too little
@ -242,7 +242,7 @@ namespace SCJMapper_V2.Gamepad
log.Error( "Get GamepadCapabilities failed", ex );
}
m_gPanel.Caption = DevName;
m_gPanel.Caption = m_devName;
int n = 0;
if ( Bit( m_gpCaps.Gamepad.Buttons, GamepadButtonFlags.DPadDown ) ) n++;
if ( Bit( m_gpCaps.Gamepad.Buttons, GamepadButtonFlags.DPadLeft ) ) n++;
@ -274,10 +274,10 @@ namespace SCJMapper_V2.Gamepad
m_gPanel.ButtonE = true; // what else ...
ApplySettings( ); // get whatever is needed here from Settings
ApplySettings_low( ); // get whatever is needed here from Settings
GamepadCls.RegisteredDevices++;
Activated = true;
m_activated = true;
}
@ -293,7 +293,12 @@ namespace SCJMapper_V2.Gamepad
/// <summary>
/// Tells the Joystick to re-read settings
/// </summary>
public override void ApplySettings( )
public override void ApplySettings()
{
ApplySettings_low( );
}
private void ApplySettings_low()
{
appSettings.Reload( );
}

@ -414,6 +414,12 @@ namespace SCJMapper_V2.Joystick
}
public override bool Activated
{
get { return Activated_low; }
set { Activated_low = value; }
}
private bool Activated_low
{
get { return m_activated; }
set {
@ -441,14 +447,14 @@ namespace SCJMapper_V2.Joystick
m_xmlInstance = joystickNum+1; // initial assignment (is 1 based..)
m_jPanel = panel;
MyTabPageIndex = tabIndex;
Activated = false;
Activated_low = false;
m_senseLimit = AppConfiguration.AppConfig.jsSenseLimit; // can be changed in the app.config file if it is still too little
// Set BufferSize in order to use buffered data.
m_device.Properties.BufferSize = 128;
m_jPanel.Caption = DevName;
m_jPanel.Caption = m_device.Properties.ProductName;
m_jPanel.nAxis = AxisCount.ToString( );
m_jPanel.nButtons = ButtonCount.ToString( );
m_jPanel.nPOVs = POVCount.ToString( );
@ -481,10 +487,10 @@ namespace SCJMapper_V2.Joystick
log.Error( "Get JS Objects failed", ex );
}
ApplySettings( ); // get whatever is needed here from Settings
ApplySettings_low( ); // get whatever is needed here from Settings
JoystickCls.RegisteredDevices++;
Activated = true;
Activated_low = true;
}
@ -505,7 +511,12 @@ namespace SCJMapper_V2.Joystick
/// <summary>
/// Tells the Joystick to re-read settings
/// </summary>
public override void ApplySettings( )
public override void ApplySettings()
{
ApplySettings_low( );
}
private void ApplySettings_low( )
{
appSettings.Reload( );
@ -521,6 +532,10 @@ namespace SCJMapper_V2.Joystick
case 6: igs = appSettings.IgnoreJS6; break;
case 7: igs = appSettings.IgnoreJS7; break;
case 8: igs = appSettings.IgnoreJS8; break;
case 9: igs = appSettings.IgnoreJS9; break;
case 10: igs = appSettings.IgnoreJS10; break;
case 11: igs = appSettings.IgnoreJS11; break;
case 12: igs = appSettings.IgnoreJS12; break;
default: break;
}
if ( string.IsNullOrWhiteSpace( igs ) ) return; // no setting - all allowed
@ -668,9 +683,9 @@ namespace SCJMapper_V2.Joystick
int[] pov = m_state.PointOfViewControllers;
int[] ppov = m_prevState.PointOfViewControllers;
if ( pov[0] >= 0 ) if ( pov[0] != ppov[0] ) m_lastItem = "hat1_" + HatDir( pov[0] );
if ( pov[1] >= 0 ) if ( pov[1] != ppov[1] ) m_lastItem = "hat2_" + HatDir( pov[0] );
if ( pov[2] >= 0 ) if ( pov[2] != ppov[2] ) m_lastItem = "hat3_" + HatDir( pov[0] );
if ( pov[3] >= 0 ) if ( pov[3] != ppov[3] ) m_lastItem = "hat4_" + HatDir( pov[0] );
if ( pov[1] >= 0 ) if ( pov[1] != ppov[1] ) m_lastItem = "hat2_" + HatDir( pov[1] );
if ( pov[2] >= 0 ) if ( pov[2] != ppov[2] ) m_lastItem = "hat3_" + HatDir( pov[2] );
if ( pov[3] >= 0 ) if ( pov[3] != ppov[3] ) m_lastItem = "hat4_" + HatDir( pov[3] );
bool[] buttons = m_state.Buttons;
bool[] prevButtons = m_prevState.Buttons;

@ -7,12 +7,9 @@ using System.Windows.Forms;
namespace SCJMapper_V2.Joystick
{
public class JoystickList : List<JoystickCls>
public class JoystickList : List<JoystickCls>, IDisposable
{
private FormReassign FR = null;
public JsReassingList JsReassingList { get; set; } // index - oldJs, newJs
public List<int> NewJsList { get; set; } // index is this[idx]
#region Static Parts
/// <summary>
/// Reassigns the mapping color based on the jsAssignment list given
@ -38,7 +35,6 @@ namespace SCJMapper_V2.Joystick
}
}
static private Color DeviceColor( int dxnumber )
{
int devNumber = 0; // this runs asynch due to the gamepad tab somewhere inbetween..
@ -54,6 +50,30 @@ namespace SCJMapper_V2.Joystick
return Color.Pink; // error but we should see the pink...
}
#endregion
private FormReassign FR = null;
public JsReassingList JsReassingList { get; set; } // index - oldJs, newJs
public List<int> NewJsList { get; set; } // index is this[idx]
protected virtual void Dispose( bool disposing )
{
if ( disposing ) {
// dispose managed resources
if ( FR != null ) FR.Dispose( );
}
// free native resources
}
public void Dispose()
{
Dispose( true );
GC.SuppressFinalize( this );
}
/// <summary>
/// Deactivate all joysticks

@ -282,6 +282,12 @@ namespace SCJMapper_V2.Keyboard
public override bool Activated
{
get { return Activated_low; }
set { Activated_low = value; }
}
private bool Activated_low
{
get { return m_activated; }
set
@ -302,7 +308,7 @@ namespace SCJMapper_V2.Keyboard
m_device = device;
m_hwnd = hwnd;
Activated = false;
Activated_low = false;
// Set BufferSize in order to use buffered data.
m_device.Properties.BufferSize = 128;
@ -321,7 +327,7 @@ namespace SCJMapper_V2.Keyboard
KeyboardCls.RegisteredDevices++;
Activated = true;
Activated_low = true;
}

@ -161,6 +161,12 @@ namespace SCJMapper_V2.Mouse
public override bool Activated
{
get { return Activated_low; }
set { Activated_low = value; }
}
private bool Activated_low
{
get { return m_activated; }
set
@ -181,7 +187,7 @@ namespace SCJMapper_V2.Mouse
m_device = device;
m_hwnd = hwnd;
Activated = false;
Activated_low = false;
m_senseLimit = AppConfiguration.AppConfig.msSenseLimit; // can be changed in the app.config file if it is still too little
@ -202,7 +208,7 @@ namespace SCJMapper_V2.Mouse
MouseCls.RegisteredDevices++;
Activated = true;
Activated_low = true;
}

@ -13,9 +13,8 @@
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose( bool disposing )
{
if ( disposing && ( components != null ) ) {
components.Dispose( );
}
if ( disposing && ( components != null ) ) components.Dispose( );
if ( disposing && ( m_bSeries != null ) ) m_bSeries.Dispose( );
base.Dispose( disposing );
}

@ -13,9 +13,8 @@
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose( bool disposing )
{
if ( disposing && ( components != null ) ) {
components.Dispose( );
}
if ( disposing && ( components != null ) ) components.Dispose( );
if ( disposing && ( m_bSeries != null ) ) m_bSeries.Dispose( );
base.Dispose( disposing );
}

@ -20,7 +20,6 @@ namespace SCJMapper_V2.Options
private Label[] lblIn = null;
private Label[] lblOut = null;
private bool m_formLoaded = false;
// Col Index of the ListView items
private const int LV_DevCtrl = 1;
@ -102,7 +101,6 @@ namespace SCJMapper_V2.Options
#endif
// helpers
m_formLoaded = false;
lblIn = new Label[] { null, lblLiveIn1, lblLiveIn2, lblLiveIn3, null, null }; // goes with PtNo 1..
lblOut = new Label[] { null, lblLiveOut1, lblLiveOut2, lblLiveOut3, lblLiveOutExponent }; // goes with PtNo 1..
@ -133,7 +131,6 @@ namespace SCJMapper_V2.Options
DeviceTabsSetup( );
PrepOptionsTab( );
m_formLoaded = true;
log.Debug( "Load - Exit" );
}

@ -23,10 +23,6 @@ namespace SCJMapper_V2.CryXMLlib
/// </summary>
internal class CryXmlBinContext // CBinaryXmlData
{
~CryXmlBinContext( )
{
pBinaryNodes = null; // TODO check later for proper dealloc
}
public CryXMLNode[] pNodes = null; // gets a copy of all Node entries
public CryXMLAttribute[] pAttributes= null; // gets a copy of all Attribute entries

@ -37,10 +37,6 @@ namespace SCJMapper_V2.CryXMLlib
{
p = p_.p;
}
~CryXmlNodeRef( )
{
p = null;
}
// conversions

@ -19,14 +19,20 @@ namespace SCJMapper_V2.SC
if ( inLine.StartsWith( "Executable:" ) ) return String.Format( "\t{0}\n", inLine );
if ( inLine.StartsWith( "ProductVersion" ) ) return String.Format( "\t{0}\n", inLine );
if ( inLine.StartsWith( "Windows:" ) ) return String.Format( "\t{0}\n", inLine );
if ( inLine.StartsWith( "Current display mode" ) ) return String.Format( "\t{0}\n", inLine );
if ( inLine.Contains( "physical memory" ) ) return String.Format( "\t{0}\n", inLine );
if ( inLine.StartsWith( "--- Dedicated video memory" ) ) return String.Format( "\t{0}\n", inLine );
if ( inLine.StartsWith( "- Final rating" ) ) return String.Format( "\t{0}\n", inLine );
if ( inLine.Contains( "> Creating" ) ) return String.Format( "\t{0}\n", inLine );
if ( inLine.Contains( "64 bit" ) ) return String.Format( "\t{0}\n", inLine );
if ( inLine.Contains( "keyboard" ) ) return String.Format( "\t{0}\n", inLine );
if ( inLine.Contains( "display mode" ) ) return String.Format( "\t{0}\n", inLine );
if ( inLine.StartsWith( "- Connected" ) ) return String.Format( "\t{0}\n", inLine );
if ( inLine.StartsWith( "Reset controls" ) ) return String.Format( "\t{0}\n", inLine );
if ( inLine.Contains( "Enjoy" ) ) return String.Format( "\t{0}\n", inLine );
return retVal;
}

@ -195,8 +195,7 @@ namespace SCJMapper_V2
case ActionDevice.AD_Mouse: return MouseCls.BlendedInput;
default: return "";
}
}
else {
} else {
return input; // just return
}
}
@ -227,7 +226,7 @@ namespace SCJMapper_V2
static public System.Drawing.Color DeviceColor( string devInput )
{
// background is along the input
ActionDevice aDevice = ADeviceFromInput( devInput);
ActionDevice aDevice = ADeviceFromInput( devInput );
switch ( aDevice ) {
case ActionDevice.AD_Gamepad: return GamepadCls.XiColor( );
case ActionDevice.AD_Joystick: {
@ -260,12 +259,12 @@ namespace SCJMapper_V2
/// Clone this object
/// </summary>
/// <returns>A deep Clone of this object</returns>
private ActionCls MyClone( )
private ActionCls MyClone()
{
ActionCls newAc = (ActionCls)this.MemberwiseClone();
ActionCls newAc = (ActionCls)this.MemberwiseClone( );
// more objects to deep copy
newAc.defActivationMode = ( ActivationMode )this.defActivationMode.Clone();
newAc.inputList = this.inputList.Select( x => ( ActionCommandCls )x.Clone( ) ).ToList( );
newAc.defActivationMode = (ActivationMode)this.defActivationMode.Clone( );
newAc.inputList = this.inputList.Select( x => (ActionCommandCls)x.Clone( ) ).ToList( );
return newAc;
}
@ -278,7 +277,7 @@ namespace SCJMapper_V2
/// <returns>The action copy with reassigned input</returns>
public ActionCls ReassignJsN( JsReassingList newJsList )
{
ActionCls newAc = this.MyClone();
ActionCls newAc = this.MyClone( );
// creates a copy of the list with reassigned jsN devs
newAc.inputList.Clear( ); // get rid of cloned list
@ -293,7 +292,7 @@ namespace SCJMapper_V2
/// <summary>
/// ctor
/// </summary>
public ActionCls( )
public ActionCls()
{
key = "";
actionDevice = ActionDevice.AD_Unknown;
@ -346,7 +345,7 @@ namespace SCJMapper_V2
if ( removeIt >= 0 ) inputList.RemoveAt( removeIt );
}
/// <summary>
/// Merge action is simply copying the new input control
/// </summary>
@ -371,7 +370,7 @@ namespace SCJMapper_V2
if ( accIndex < 0 ) return;
// Apply the input to the ActionTree
this.inputList[accIndex].DevInput = BlendInput( devInput, this.actionDevice );
if ( IsBlendedInput( this.inputList[accIndex].DevInput ) || string.IsNullOrEmpty(devInput) ) {
if ( IsBlendedInput( this.inputList[accIndex].DevInput ) || string.IsNullOrEmpty( devInput ) ) {
this.inputList[accIndex].ActivationMode = new ActivationMode( ActivationMode.Default ); // reset activation mode if the input is empty
}
}
@ -418,7 +417,7 @@ namespace SCJMapper_V2
/// Dump the action as partial XML nicely formatted
/// </summary>
/// <returns>the action as XML fragment</returns>
public string toXML( )
public string toXML()
{
string r = ""; string
bindCmd = "rebind";
@ -458,8 +457,7 @@ namespace SCJMapper_V2
if ( reader.HasAttributes ) {
name = reader["name"];
reader.ReadStartElement( "action" ); // Checks that the current content node is an element with the given Name and advances the reader to the next node
}
else {
} else {
return false;
}
}
@ -474,8 +472,7 @@ namespace SCJMapper_V2
if ( string.IsNullOrEmpty( device ) ) {
// AC2 style - derive the device (Device.DeviceClass)
device = DeviceClassFromInput( input );
}
else {
} else {
// AC1 style - need to reformat mouse and keyboard according to AC2 style now
if ( KeyboardCls.IsDeviceClass( device ) ) input = KeyboardCls.FromAC1( input );
else if ( MouseCls.IsDeviceClass( device ) ) input = MouseCls.FromAC1( input );
@ -487,14 +484,13 @@ namespace SCJMapper_V2
// if no ActivationMode is given, create one with multitap 1 or may be 2...
string actModeName = reader["ActivationMode"];
ActivationMode actMode = null;
if ( ! string.IsNullOrEmpty( actModeName ) ) {
if ( !string.IsNullOrEmpty( actModeName ) ) {
actMode = ActivationModes.Instance.ActivationModeByName( actModeName ); // should be a valid ActivationMode for this action
}
else {
} else {
actMode = new ActivationMode( ActivationMode.Default ); // no specific name given, use default
string multiTap = reader["multiTap"];
if ( !string.IsNullOrEmpty( multiTap ) ) {
actMode.MultiTap = int.Parse(multiTap); // modify with given multiTap
actMode.MultiTap = int.Parse( multiTap ); // modify with given multiTap
}
}
@ -505,8 +501,7 @@ namespace SCJMapper_V2
// advances the reader to the next node
reader.ReadStartElement( "rebind" );
}
}
else if ( reader.Name.ToLowerInvariant( ) == "addbind" ) {
} else if ( reader.Name.ToLowerInvariant( ) == "addbind" ) {
if ( reader.HasAttributes ) {
device = reader["device"];
string input = reader["input"];
@ -515,8 +510,7 @@ namespace SCJMapper_V2
if ( string.IsNullOrEmpty( device ) ) {
// AC2 style - derive the device (Device.DeviceClass)
device = DeviceClassFromInput( input );
}
else {
} else {
// AC1 style - need to reformat according to AC2 style now
if ( KeyboardCls.IsDeviceClass( device ) ) input = KeyboardCls.FromAC1( input );
else if ( MouseCls.IsDeviceClass( device ) ) input = MouseCls.FromAC1( input );
@ -530,8 +524,7 @@ namespace SCJMapper_V2
ActivationMode actMode = null;
if ( !string.IsNullOrEmpty( actModeName ) ) {
actMode = ActivationModes.Instance.ActivationModeByName( actModeName ); // should be a valid ActivationMode for this action
}
else {
} else {
actMode = new ActivationMode( ActivationMode.Default ); // no specific name given, use default
string multiTap = reader["multiTap"];
if ( !string.IsNullOrEmpty( multiTap ) ) {
@ -542,8 +535,7 @@ namespace SCJMapper_V2
// advances the reader to the next node
reader.ReadStartElement( "addbind" );
}
}
else {
} else {
return false;
}
} while ( reader.Name == "addbind" );

@ -20,7 +20,7 @@ namespace SCJMapper_V2
/// Maintains the action tree and its GUI representation, the TreeView
/// - the TreeView is managed primary in memory (Master Tree) and copied to the GUI tree via the Filter functions
/// </summary>
class ActionTree
class ActionTree : IDisposable
{
private static readonly log4net.ILog log = log4net.LogManager.GetLogger( System.Reflection.MethodBase.GetCurrentMethod( ).DeclaringType );
@ -103,6 +103,21 @@ namespace SCJMapper_V2
IgnoreMaps = ""; // nothing to ignore
}
protected virtual void Dispose( bool disposing )
{
if ( disposing ) {
// dispose managed resources
if (m_MasterTree !=null ) m_MasterTree.Dispose( );
}
// free native resources
}
public void Dispose()
{
Dispose( true );
GC.SuppressFinalize( this );
}
/// <summary>
/// Copy return the complete ActionTree while reassigning JsN

@ -894,14 +894,6 @@
<action name="edit_loadout" onPress="1" keyboard="l" />
</actionmap>
<actionmap name="multiplayer" version="25" UILabel="@ui_CGEAGeneral" UICategory="@ui_CCEAGeneral" >
<action name="respawn" onPress="1" keyboard="x" xboxpad="x" joystick=" " UILabel="@ui_CIRespawn" UIDescription="@ui_CIRespawnDesc" />
<action name="force_respawn" ActivationMode="delayed_press" keyboard="ralt+backspace" xboxpad="shoulderl+shoulderr+x" joystick=" " UILabel="@ui_CIForceRespawn" UIDescription="@ui_CIForceRespawnDesc" />
<action name="retry" onPress="1" keyboard="x" xboxpad="x" />
<action name="ready" onPress="1" keyboard="x" xboxpad="x" />
<action name="edit_loadout" onPress="1" keyboard="l" />
</actionmap>
<actionmap name="spectator" version="1" UILabel="@ui_CGEASpectator" UICategory="@ui_CCEASpectator" >
<action name="spectate_next_target" onPress="1" mouse="mouse2" xboxpad="shoulderr" joystick="button1" UILabel="@ui_CISpectatorTargetNext" UIDescription="@ui_CISpectatorTargetNextDesc" />
<action name="spectate_prev_target" onPress="1" mouse="mouse1" xboxpad="shoulderl" joystick="button2" UILabel="@ui_CISpectatorTargetPrev" UIDescription="@ui_CISpectatorTargetPrevDesc" />

@ -1,10 +1,10 @@
SC Joystick Mapper V 2.27 - Build 61 BETA
(c) Cassini, StandardToaster - 25-Dec-2016
SC Joystick Mapper V 2.28 - Build 62 BETA
(c) Cassini, StandardToaster - 28-Apr-2017
Contains 9 files:
SCJMapper.exe The program (V2.27)
SCJMapper.exe.config Program config (V2.27) - MUST be in the same folder as the Exe file
SCJMapper.exe The program (V2.28)
SCJMapper.exe.config Program config (V2.28) - MUST be in the same folder as the Exe file
SharpDX.DirectInput.dll Managed DirectInput Assembly - MUST be in the same folder as the Exe file
SharpDX.dll Managed DirectX Assembly - MUST be in the same folder as the Exe file
OpenTK.dll Managed OpenGL Assembly - MUST be in the same folder as the Exe file
@ -13,10 +13,10 @@ Ionic.Zip.Reduced.dll Managed Zip Assembly - MUST be in th
log4net.dll Managed Logging Assembly - MUST be in the same folder as the Exe file
log4net.config.OFF Config file for logging - To use it - rename as log4net.config and run the program
then look for trace.log in the same folder
SCJMapper_QGuide V2.27beta.pdf Quick Guide
SCJMapper_QGuide V2.28beta.pdf Quick Guide
ReadMe.txt This file
graphics folder Skybox Images - graphics folder MUST be in the same folder as the Exe file
graphics folder Skybox Images (V2.28) - graphics folder MUST be in the same folder as the Exe file
Read the Guide first RTFM ;-)
@ -29,6 +29,19 @@ Scanned for viruses before packing...
cassini@burri-web.org
Changelog:
V 2.28 - BETA Build 62
- add #48 - Tune Strafe controls
- add - "Options ..." dialog to edit all devince and control options
- add - 2 more three 3D scenes for Tuning
- improvement #49 - Mapping area: Current mapping is shown
- improvement - Gamepad support improved, Tab is now always the most left one if gamepads are enabled
- improvement - Dump Log: added some more interesting captures from the game log file
- improvement - Tuning is now closer to CIG implementation, remove Sensitivity, add Saturation instead
- fix #51 - accepting multiple actionmaps in default profile (collects only the first one found)
- fix - bug re- joystick hats (affected No 2..4)
- fixes and refacturing while encountered...
- update - fallback default profile from SC 2.6.3 alpha
- update - doc SCJMapper_QGuide V2.28beta.pdf
V 2.27 - BETA Build 61
- add - Collapse/Expand in context menu in Mapping tree
- improvement - actionmaps are taken from the defaultProfile and will no longer need a program update

Binary file not shown.
Loading…
Cancel
Save