diff --git a/Form1.cs b/Form1.cs
index b6960e9..3053a49 100644
--- a/Form1.cs
+++ b/Form1.cs
@@ -581,7 +581,7 @@ namespace SCJMapper_V2
{
log.Debug( "Dump - Entry" );
- rtb.Text = String.Format( "\n{2}", DateTime.Now, txMappingName.Text, m_AT.toXML( ) );
+ rtb.Text = String.Format( "\n{2}", DateTime.Now, txMappingName.Text, m_AT.toXML( txMappingName.Text ) );
btDump.BackColor = btClear.BackColor; btDump.UseVisualStyleBackColor = btClear.UseVisualStyleBackColor; // neutral again
btGrab.BackColor = btClear.BackColor; btGrab.UseVisualStyleBackColor = btClear.UseVisualStyleBackColor; // neutral again
diff --git a/Joystick/UICustHeader.cs b/Joystick/UICustHeader.cs
index 6eb8842..ea35abe 100644
--- a/Joystick/UICustHeader.cs
+++ b/Joystick/UICustHeader.cs
@@ -13,10 +13,54 @@ namespace SCJMapper_V2
///
///
///
+ /// or
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
///
- class UICustHeader : List
+ public class UICustHeader
{
+ private static readonly log4net.ILog log = log4net.LogManager.GetLogger( System.Reflection.MethodBase.GetCurrentMethod( ).DeclaringType );
+ List m_stringOptions = new List( );
+
+ public struct DevRec
+ {
+ public String devType;
+ public int instNo;
+ }
+ List m_devInstances = new List( );
+
+ private String m_label = "";
+ private String m_description = "";
+ private String m_image = "";
+
+
+ public int Count
+ {
+ get { return ( m_stringOptions.Count + m_devInstances.Count ); }
+ }
+
+ public String Label
+ {
+ get { return m_label; }
+ set { m_label = value; }
+ }
+
+ public void ClearInstances( )
+ {
+ m_devInstances.Clear();
+ }
+ public void AddInstances( DevRec dr )
+ {
+ m_devInstances.Add( dr );
+ }
+
+
private String[] FormatXml( string xml )
{
try {
@@ -36,8 +80,20 @@ namespace SCJMapper_V2
{
String r = "";
- // and dump the contents
- foreach ( String x in this ) {
+ r += String.Format( "\t\n", m_label, m_description, m_image );
+ if ( m_devInstances.Count > 0 ) {
+ r += String.Format( "\t\t\n" );
+
+ foreach ( DevRec dr in m_devInstances ) {
+ r += String.Format( "\t\t\t<{0} instance=\"{1}\"/>\n", dr.devType, dr.instNo.ToString( ) );
+ }
+
+ r += String.Format( "\t\t\n" );
+ }
+ r += String.Format( "\t\n" );
+
+ // and dump the plain contents if needed
+ foreach ( String x in m_stringOptions ) {
if ( !String.IsNullOrWhiteSpace( x ) ) {
foreach ( String line in FormatXml( x ) ) {
r += String.Format( "\t{0}", line );
@@ -50,6 +106,38 @@ namespace SCJMapper_V2
+ ///
+ /// Read an CustomisationUIHeader from XML - do some sanity check
+ ///
+ /// the XML action fragment
+ /// True if an action was decoded
+ public Boolean Instance_fromXML( XmlReader reader )
+ {
+ reader.Read( );
+
+ while ( !reader.EOF ) {
+ String devType = reader.Name;
+ String instance = reader["instance"];
+ int instNo = 0;
+ if ( !String.IsNullOrWhiteSpace( instance ) ) {
+ if ( !int.TryParse( instance, out instNo ) ) {
+ instNo = 0;
+ }
+ else {
+ DevRec dr = new DevRec( );
+ dr.devType = devType;
+ dr.instNo = instNo;
+ m_devInstances.Add( dr );
+ }
+ }
+ reader.Read( );
+ if ( reader.NodeType == XmlNodeType.EndElement ) break; // expect end of here
+ }//while
+
+ return true;
+ }
+
+
///
/// Read an CustomisationUIHeader from XML - do some sanity check
///
@@ -57,7 +145,49 @@ namespace SCJMapper_V2
/// True if an action was decoded
public Boolean fromXML( String xml )
{
- if ( !this.Contains( xml ) ) this.Add( xml );
+ // if ( !this.Contains( xml ) ) this.Add( xml );
+
+
+ XmlReaderSettings settings = new XmlReaderSettings( );
+ settings.ConformanceLevel = ConformanceLevel.Fragment;
+ settings.IgnoreWhitespace = true;
+ settings.IgnoreComments = true;
+ XmlReader reader = XmlReader.Create( new StringReader( xml ), settings );
+
+ reader.Read( );
+
+ if ( reader.HasAttributes ) {
+ m_label = reader["label"];
+ m_description = reader["description"];
+ if ( String.IsNullOrEmpty( m_description ) ) m_description = "@ui_JoystickDefaultDesc";
+ m_image = reader["image"];
+ if ( String.IsNullOrEmpty( m_image ) ) m_image = "JoystickDefault";
+
+ reader.Read( );
+ // try to disassemble the items
+ /*
+ *
+ *
+ *
+ *
+ */
+ while ( !reader.EOF ) {
+
+ if ( reader.Name == "Devices" ) {
+ Instance_fromXML( reader );
+ }
+ else {
+ //??
+ log.InfoFormat( "UICustHeader.fromXML: unknown node - {0} - stored as is", reader.Name );
+ if ( !m_stringOptions.Contains( xml ) ) m_stringOptions.Add( xml );
+ }
+
+ reader.Read( );
+ if ( reader.NodeType == XmlNodeType.EndElement ) break; // expect end of here
+ }
+
+ }
+
return true;
}
diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs
index f2b8df7..d5de67c 100644
--- a/Properties/AssemblyInfo.cs
+++ b/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion( "2.11.0.44" )]
-[assembly: AssemblyFileVersion( "2.11.0.44" )]
+[assembly: AssemblyVersion( "2.12.0.45" )]
+[assembly: AssemblyFileVersion( "2.12.0.45" )]
diff --git a/SC/SCMappings.cs b/SC/SCMappings.cs
index 42cf866..64d41dc 100644
--- a/SC/SCMappings.cs
+++ b/SC/SCMappings.cs
@@ -14,8 +14,8 @@ namespace SCJMapper_V2
{
private static readonly log4net.ILog log = log4net.LogManager.GetLogger( System.Reflection.MethodBase.GetCurrentMethod( ).DeclaringType );
-
- private const String c_UserMapStartsWith = "layout_my_"; // we only allow those mapping names
+ public const String c_MapStartsWith = "layout_"; // we only allow those mapping names
+ private const String c_UserMapStartsWith = c_MapStartsWith + "my_"; // we only allow those mapping names
static private List m_scMappings = new List( );
diff --git a/SC/SCPath.cs b/SC/SCPath.cs
index 41eff59..cc4b82f 100644
--- a/SC/SCPath.cs
+++ b/SC/SCPath.cs
@@ -232,14 +232,14 @@ namespace SCJMapper_V2
get
{
log.Debug( "SCClientMappingPath - Entry" );
- String scp = SCClientDataPath;
+ String scp = SCClientUSERPath; // AC1.03 new here
if ( String.IsNullOrEmpty( scp ) ) return "";
//
scp = Path.Combine( scp, "Controls" );
scp = Path.Combine( scp, "Mappings" );
if ( Directory.Exists( scp ) ) return scp;
- log.WarnFormat( "SCClientMappingPath - CitizenClient.Data.Controls.Mappings subfolder does not exist: {0}", scp );
+ log.WarnFormat( "SCClientMappingPath - CitizenClient.USER.Controls.Mappings subfolder does not exist: {0}", scp );
return "";
}
}
diff --git a/SCJMapper-V2.csproj b/SCJMapper-V2.csproj
index f913884..d0598d6 100644
--- a/SCJMapper-V2.csproj
+++ b/SCJMapper-V2.csproj
@@ -26,8 +26,8 @@
false
false
true
- 44
- 2.11.0.%2a
+ 45
+ 2.12.0.%2a
false
true
diff --git a/actions/ActionMapsCls.cs b/actions/ActionMapsCls.cs
index ee265a5..9eeff9b 100644
--- a/actions/ActionMapsCls.cs
+++ b/actions/ActionMapsCls.cs
@@ -226,7 +226,7 @@ namespace SCJMapper_V2
/// Dump the ActionMaps as partial XML nicely formatted
///
/// the action as XML fragment
- public String toXML( )
+ public String toXML( String fileName )
{
log.Debug( "toXML - Entry" );
@@ -259,7 +259,19 @@ namespace SCJMapper_V2
r += String.Format( ">\n" );
// and dump the option contents
- if ( m_uiCustHeader.Count > 0 ) r += m_uiCustHeader.toXML( ) + String.Format( "\n" );
+ if ( m_uiCustHeader.Count > 0 ) {
+ // prepare with new data
+ m_uiCustHeader.ClearInstances( );
+ UICustHeader.DevRec dr = new UICustHeader.DevRec( );
+ for ( int i=0; i < JoystickCls.JSnum_MAX; i++ ) {
+ if ( !String.IsNullOrEmpty( jsN[i] ) ) {
+ dr.devType = "joystick"; dr.instNo = i + 1;
+ m_uiCustHeader.AddInstances( dr );
+ }
+ }
+ m_uiCustHeader.Label = fileName.Replace( SCMappings.c_MapStartsWith, "" ); // remove redundant part
+ r += m_uiCustHeader.toXML( ) + String.Format( "\n" );
+ }
if ( m_options.Count > 0 ) r += m_options.toXML( ) + String.Format( "\n" );
if ( m_deviceOptions.Count > 0 ) r += m_deviceOptions.toXML( ) + String.Format( "\n" );
diff --git a/actions/ActionTree.cs b/actions/ActionTree.cs
index 6dee403..242fa26 100644
--- a/actions/ActionTree.cs
+++ b/actions/ActionTree.cs
@@ -257,12 +257,12 @@ namespace SCJMapper_V2
/// Dumps the actions to an XML String
///
/// A string containing the XML
- public String toXML( )
+ public String toXML( String fileName )
{
if ( ActionMaps != null ) {
// must update the devices and instances for inversion before dumping the XML
UpdateDeviceInformation( );
- return ActionMaps.toXML( ); // just propagate if possible
+ return ActionMaps.toXML( fileName ); // just propagate if possible
}
else {
log.Error( "ActionTree-toXML: Program error - ActionMaps not yet created" );
diff --git a/doc/ReadMe.txt b/doc/ReadMe.txt
index 42da3ae..7f521cb 100644
--- a/doc/ReadMe.txt
+++ b/doc/ReadMe.txt
@@ -1,10 +1,10 @@
-SC Joystick Mapper V 2.10 - Build 43
-(c) Cassini, StandardToaster - 04-January-2015
+SC Joystick Mapper V 2.11 - Build 44 BETA
+(c) Cassini, StandardToaster - 14-January-2015
Contains 9 files:
-SCJMapper.exe The program (V2.10)
-SCJMapper.exe.config Program config (V2.10) - MUST be in the same folder as the Exe file
+SCJMapper.exe The program (V2.11)
+SCJMapper.exe.config Program config (V2.11) - 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
@@ -29,6 +29,12 @@ Scanned for viruses before packing...
cassini@burri-web.org
Changelog:
+V 2.11 - BETA Build 44
+- fix - reading of deadzone value (if not a number should not break anymore)
+- fix - writing the proper deadzone XML if first used
+- fix - reading addbind commands from existing mappings will appear now in the tree
+- improvement - better handling of the default mapping name from config file
+- improvement - mapping name added to XML mapping (first line comment extended with mapping name)
V 2.10 - Build 43 - Production
- new feature - added Action Tree context menu for Assign, Clear and Blend
- fix - issue for Js Reassignment if more than one was not yet assigned