OSDN Git Service

入力したキーと表示されるキーが異なる現象を修正。
[dtxmania/dtxmania.git] / DTXManiaプロジェクト / コード / ステージ / 04.コンフィグ / CActConfigKeyAssign.cs
index 8335ba5..a2620aa 100644 (file)
@@ -5,6 +5,7 @@ using System.Runtime.InteropServices;
 using System.Drawing;\r
 using FDK;\r
 using SharpDX;\r
+using SharpDX.DirectInput;\r
 \r
 using Rectangle = System.Drawing.Rectangle;\r
 using Color = System.Drawing.Color;\r
@@ -265,16 +266,142 @@ namespace DTXMania
                }\r
 \r
                private bool bキー入力待ち;\r
+\r
                private STKEYLABEL[] KeyLabel = new STKEYLABEL[] {\r
-                       new STKEYLABEL(0x35, "[ESC]"), new STKEYLABEL(1, "[ 1 ]"), new STKEYLABEL(2, "[ 2 ]"), new STKEYLABEL(3, "[ 3 ]"), new STKEYLABEL(4, "[ 4 ]"), new STKEYLABEL(5, "[ 5 ]"), new STKEYLABEL(6, "[ 6 ]"), new STKEYLABEL(7, "[ 7 ]"), new STKEYLABEL(8, "[ 8 ]"), new STKEYLABEL(9, "[ 9 ]"), new STKEYLABEL(0, "[ 0 ]"), new STKEYLABEL(0x53, "[ - ]"), new STKEYLABEL(0x34, "[ = ]"), new STKEYLABEL(0x2a, "[BSC]"), new STKEYLABEL(0x81, "[TAB]"), new STKEYLABEL(0x1a, "[ Q ]"),\r
-                       new STKEYLABEL(0x20, "[ W ]"), new STKEYLABEL(14, "[ E ]"), new STKEYLABEL(0x1b, "[ R ]"), new STKEYLABEL(0x1d, "[ T ]"), new STKEYLABEL(0x22, "[ Y ]"), new STKEYLABEL(30, "[ U ]"), new STKEYLABEL(0x12, "[ I ]"), new STKEYLABEL(0x18, "[ O ]"), new STKEYLABEL(0x19, "[ P ]"), new STKEYLABEL(0x4a, "[ [ ]"), new STKEYLABEL(0x73, "[ ] ]"), new STKEYLABEL(0x75, "[Enter]"), new STKEYLABEL(0x4b, "[L-Ctrl]"), new STKEYLABEL(10, "[ A ]"), new STKEYLABEL(0x1c, "[ S ]"), new STKEYLABEL(13, "[ D ]"),\r
-                       new STKEYLABEL(15, "[ F ]"), new STKEYLABEL(0x10, "[ G ]"), new STKEYLABEL(0x11, "[ H ]"), new STKEYLABEL(0x13, "[ J ]"), new STKEYLABEL(20, "[ K ]"), new STKEYLABEL(0x15, "[ L ]"), new STKEYLABEL(0x7b, "[ ; ]"), new STKEYLABEL(0x26, "[ ' ]"), new STKEYLABEL(0x45, "[ ` ]"), new STKEYLABEL(0x4e, "[L-Shift]"), new STKEYLABEL(0x2b, @"[ \]"), new STKEYLABEL(0x23, "[ Z ]"), new STKEYLABEL(0x21, "[ X ]"), new STKEYLABEL(12, "[ C ]"), new STKEYLABEL(0x1f, "[ V ]"), new STKEYLABEL(11, "[ B ]"),\r
-                       new STKEYLABEL(0x17, "[ N ]"), new STKEYLABEL(0x16, "[ M ]"), new STKEYLABEL(0x2f, "[ , ]"), new STKEYLABEL(0x6f, "[ . ]"), new STKEYLABEL(0x7c, "[ / ]"), new STKEYLABEL(120, "[R-Shift]"), new STKEYLABEL(0x6a, "[ * ]"), new STKEYLABEL(0x4d, "[L-Alt]"), new STKEYLABEL(0x7e, "[Space]"), new STKEYLABEL(0x2d, "[CAPS]"), new STKEYLABEL(0x36, "[F1]"), new STKEYLABEL(0x37, "[F2]"), new STKEYLABEL(0x38, "[F3]"), new STKEYLABEL(0x39, "[F4]"), new STKEYLABEL(0x3a, "[F5]"), new STKEYLABEL(0x3b, "[F6]"),\r
-                       new STKEYLABEL(60, "[F7]"), new STKEYLABEL(0x3d, "[F8]"), new STKEYLABEL(0x3e, "[F9]"), new STKEYLABEL(0x3f, "[F10]"), new STKEYLABEL(0x58, "[NumLock]"), new STKEYLABEL(0x7a, "[Scroll]"), new STKEYLABEL(0x60, "[NPad7]"), new STKEYLABEL(0x61, "[NPad8]"), new STKEYLABEL(0x62, "[NPad9]"), new STKEYLABEL(0x66, "[NPad-]"), new STKEYLABEL(0x5d, "[NPad4]"), new STKEYLABEL(0x5e, "[NPad5]"), new STKEYLABEL(0x5f, "[NPad6]"), new STKEYLABEL(0x68, "[NPad+]"), new STKEYLABEL(90, "[NPad1]"), new STKEYLABEL(0x5b, "[NPad2]"),\r
-                       new STKEYLABEL(0x5c, "[NPad3]"), new STKEYLABEL(0x59, "[NPad0]"), new STKEYLABEL(0x67, "[NPad.]"), new STKEYLABEL(0x40, "[F11]"), new STKEYLABEL(0x41, "[F12]"), new STKEYLABEL(0x42, "[F13]"), new STKEYLABEL(0x43, "[F14]"), new STKEYLABEL(0x44, "[F15]"), new STKEYLABEL(0x48, "[Kana]"), new STKEYLABEL(0x24, "[ ? ]"), new STKEYLABEL(0x30, "[Henkan]"), new STKEYLABEL(0x57, "[MuHenkan]"), new STKEYLABEL(0x8f, @"[ \ ]"), new STKEYLABEL(0x25, "[NPad.]"), new STKEYLABEL(0x65, "[NPad=]"), new STKEYLABEL(0x72, "[ ^ ]"),\r
-                       new STKEYLABEL(40, "[ @ ]"), new STKEYLABEL(0x2e, "[ : ]"), new STKEYLABEL(130, "[ _ ]"), new STKEYLABEL(0x49, "[Kanji]"), new STKEYLABEL(0x7f, "[Stop]"), new STKEYLABEL(0x29, "[AX]"), new STKEYLABEL(100, "[NPEnter]"), new STKEYLABEL(0x74, "[R-Ctrl]"), new STKEYLABEL(0x54, "[Mute]"), new STKEYLABEL(0x2c, "[Calc]"), new STKEYLABEL(0x70, "[PlayPause]"), new STKEYLABEL(0x52, "[MediaStop]"), new STKEYLABEL(0x85, "[Volume-]"), new STKEYLABEL(0x86, "[Volume+]"), new STKEYLABEL(0x8b, "[WebHome]"), new STKEYLABEL(0x63, "[NPad,]"),\r
-                       new STKEYLABEL(0x69, "[ / ]"), new STKEYLABEL(0x80, "[PrtScn]"), new STKEYLABEL(0x77, "[R-Alt]"), new STKEYLABEL(110, "[Pause]"), new STKEYLABEL(70, "[Home]"), new STKEYLABEL(0x84, "[Up]"), new STKEYLABEL(0x6d, "[PageUp]"), new STKEYLABEL(0x4c, "[Left]"), new STKEYLABEL(0x76, "[Right]"), new STKEYLABEL(0x33, "[End]"), new STKEYLABEL(50, "[Down]"), new STKEYLABEL(0x6c, "[PageDown]"), new STKEYLABEL(0x47, "[Insert]"), new STKEYLABEL(0x31, "[Delete]"), new STKEYLABEL(0x4f, "[L-Win]"), new STKEYLABEL(0x79, "[R-Win]"),\r
-                       new STKEYLABEL(0x27, "[APP]"), new STKEYLABEL(0x71, "[Power]"), new STKEYLABEL(0x7d, "[Sleep]"), new STKEYLABEL(0x87, "[Wake]")\r
+                       #region [ *** ]\r
+                       new STKEYLABEL((int)Key.Escape, "[ESC]"),\r
+                       new STKEYLABEL((int)Key.D1, "[ 1 ]"),\r
+                       new STKEYLABEL((int)Key.D2, "[ 2 ]"),\r
+                       new STKEYLABEL((int)Key.D3, "[ 3 ]"),\r
+                       new STKEYLABEL((int)Key.D4, "[ 4 ]"),\r
+                       new STKEYLABEL((int)Key.D5, "[ 5 ]"),\r
+                       new STKEYLABEL((int)Key.D6, "[ 6 ]"),\r
+                       new STKEYLABEL((int)Key.D7, "[ 7 ]"),\r
+                       new STKEYLABEL((int)Key.D8, "[ 8 ]"),\r
+                       new STKEYLABEL((int)Key.D9, "[ 9 ]"),\r
+                       new STKEYLABEL((int)Key.D0, "[ 0 ]"),\r
+                       new STKEYLABEL((int)Key.Minus, "[ - ]"),\r
+                       new STKEYLABEL((int)Key.Equals, "[ = ]"),\r
+                       new STKEYLABEL((int)Key.Back, "[BSC]"),\r
+                       new STKEYLABEL((int)Key.Tab, "[TAB]"),\r
+                       new STKEYLABEL((int)Key.Q, "[ Q ]"),\r
+                       new STKEYLABEL((int)Key.W, "[ W ]"),\r
+                       new STKEYLABEL((int)Key.E, "[ E ]"),\r
+                       new STKEYLABEL((int)Key.R, "[ R ]"),\r
+                       new STKEYLABEL((int)Key.T, "[ T ]"),\r
+                       new STKEYLABEL((int)Key.Y, "[ Y ]"),\r
+                       new STKEYLABEL((int)Key.U, "[ U ]"),\r
+                       new STKEYLABEL((int)Key.I, "[ I ]"),\r
+                       new STKEYLABEL((int)Key.O, "[ O ]"),\r
+                       new STKEYLABEL((int)Key.P, "[ P ]"),\r
+                       new STKEYLABEL((int)Key.LeftBracket, "[ [ ]"),\r
+                       new STKEYLABEL((int)Key.RightBracket, "[ ] ]"),\r
+                       new STKEYLABEL((int)Key.Return, "[Enter]"),\r
+                       new STKEYLABEL((int)Key.LeftControl, "[L-Ctrl]"),\r
+                       new STKEYLABEL((int)Key.A, "[ A ]"),\r
+                       new STKEYLABEL((int)Key.S, "[ S ]"),\r
+                       new STKEYLABEL((int)Key.D, "[ D ]"),\r
+                       new STKEYLABEL((int)Key.F, "[ F ]"),\r
+                       new STKEYLABEL((int)Key.G, "[ G ]"),\r
+                       new STKEYLABEL((int)Key.H, "[ H ]"),\r
+                       new STKEYLABEL((int)Key.J, "[ J ]"),\r
+                       new STKEYLABEL((int)Key.K, "[ K ]"),\r
+                       new STKEYLABEL((int)Key.L, "[ L ]"),\r
+                       new STKEYLABEL((int)Key.Semicolon, "[ ; ]"),\r
+                       new STKEYLABEL((int)Key.Apostrophe, "[ ' ]"),\r
+                       new STKEYLABEL((int)Key.Grave, "[ ` ]"),\r
+                       new STKEYLABEL((int)Key.LeftShift, "[L-Shift]"),\r
+                       new STKEYLABEL((int)Key.Backslash, @"[ \]"),\r
+                       new STKEYLABEL((int)Key.Z, "[ Z ]"),\r
+                       new STKEYLABEL((int)Key.X, "[ X ]"),\r
+                       new STKEYLABEL((int)Key.C, "[ C ]"),\r
+                       new STKEYLABEL((int)Key.V, "[ V ]"),\r
+                       new STKEYLABEL((int)Key.B, "[ B ]"),\r
+                       new STKEYLABEL((int)Key.N, "[ N ]"),\r
+                       new STKEYLABEL((int)Key.M, "[ M ]"),\r
+                       new STKEYLABEL((int)Key.Comma, "[ , ]"),\r
+                       new STKEYLABEL((int)Key.Period, "[ . ]"),\r
+                       new STKEYLABEL((int)Key.Slash, "[ / ]"),\r
+                       new STKEYLABEL((int)Key.RightShift, "[R-Shift]"),\r
+                       new STKEYLABEL((int)Key.Multiply, "[ * ]"),\r
+                       new STKEYLABEL((int)Key.LeftAlt, "[L-Alt]"),\r
+                       new STKEYLABEL((int)Key.Space, "[Space]"),\r
+                       new STKEYLABEL((int)Key.Capital, "[CAPS]"),\r
+                       new STKEYLABEL((int)Key.F1, "[F1]"),\r
+                       new STKEYLABEL((int)Key.F2, "[F2]"),\r
+                       new STKEYLABEL((int)Key.F3, "[F3]"),\r
+                       new STKEYLABEL((int)Key.F4, "[F4]"),\r
+                       new STKEYLABEL((int)Key.F5, "[F5]"),\r
+                       new STKEYLABEL((int)Key.F6, "[F6]"),\r
+                       new STKEYLABEL((int)Key.F7, "[F7]"),\r
+                       new STKEYLABEL((int)Key.F8, "[F8]"),\r
+                       new STKEYLABEL((int)Key.F9, "[F9]"),\r
+                       new STKEYLABEL((int)Key.F10, "[F10]"),\r
+                       new STKEYLABEL((int)Key.NumberLock, "[NumLock]"),\r
+                       new STKEYLABEL((int)Key.ScrollLock, "[Scroll]"),\r
+                       new STKEYLABEL((int)Key.NumberPad7, "[NPad7]"),\r
+                       new STKEYLABEL((int)Key.NumberPad8, "[NPad8]"),\r
+                       new STKEYLABEL((int)Key.NumberPad9, "[NPad9]"),\r
+                       new STKEYLABEL((int)Key.Subtract, "[NPad-]"),\r
+                       new STKEYLABEL((int)Key.NumberPad4, "[NPad4]"),\r
+                       new STKEYLABEL((int)Key.NumberPad5, "[NPad5]"),\r
+                       new STKEYLABEL((int)Key.NumberPad6, "[NPad6]"),\r
+                       new STKEYLABEL((int)Key.Add, "[NPad+]"),\r
+                       new STKEYLABEL((int)Key.NumberPad1, "[NPad1]"),\r
+                       new STKEYLABEL((int)Key.NumberPad2, "[NPad2]"),\r
+                       new STKEYLABEL((int)Key.NumberPad3, "[NPad3]"),\r
+                       new STKEYLABEL((int)Key.NumberPad0, "[NPad0]"),\r
+                       new STKEYLABEL((int)Key.Decimal, "[NPad.]"),\r
+                       new STKEYLABEL((int)Key.F11, "[F11]"),\r
+                       new STKEYLABEL((int)Key.F12, "[F12]"),\r
+                       new STKEYLABEL((int)Key.F13, "[F13]"),\r
+                       new STKEYLABEL((int)Key.F14, "[F14]"),\r
+                       new STKEYLABEL((int)Key.F15, "[F15]"),\r
+                       new STKEYLABEL((int)Key.Kana, "[Kana]"),\r
+                       new STKEYLABEL((int)Key.AbntC1, "[ ? ]"),\r
+                       new STKEYLABEL((int)Key.Convert, "[Henkan]"),\r
+                       new STKEYLABEL((int)Key.NoConvert, "[MuHenkan]"),\r
+                       new STKEYLABEL((int)Key.Backslash, @"[ \ ]"),\r
+                       new STKEYLABEL((int)Key.AbntC2, "[NPad.]"),\r
+                       new STKEYLABEL((int)Key.NumberPadEquals, "[NPad=]"),\r
+                       new STKEYLABEL((int)Key.PreviousTrack, "[ ^ ]"),        // DIK_CIRCUMFLEX = 0x90\r
+                       new STKEYLABEL((int)Key.AT, "[ @ ]"),\r
+                       new STKEYLABEL((int)Key.Colon, "[ : ]"),\r
+                       new STKEYLABEL((int)Key.Underline, "[ _ ]"),\r
+                       new STKEYLABEL((int)Key.Kanji, "[Kanji]"),\r
+                       new STKEYLABEL((int)Key.Stop, "[Stop]"),\r
+                       new STKEYLABEL((int)Key.AX, "[AX]"),\r
+                       new STKEYLABEL((int)Key.NumberPadEnter, "[NPEnter]"),\r
+                       new STKEYLABEL((int)Key.RightControl, "[R-Ctrl]"),\r
+                       new STKEYLABEL((int)Key.Mute, "[Mute]"),\r
+                       new STKEYLABEL((int)Key.Calculator, "[Calc]"),\r
+                       new STKEYLABEL((int)Key.PlayPause, "[PlayPause]"),\r
+                       new STKEYLABEL((int)Key.MediaStop, "[MediaStop]"),\r
+                       new STKEYLABEL((int)Key.VolumeDown, "[Volume-]"),\r
+                       new STKEYLABEL((int)Key.VolumeUp, "[Volume+]"),\r
+                       new STKEYLABEL((int)Key.WebHome, "[WebHome]"),\r
+                       new STKEYLABEL((int)Key.NumberPadComma, "[NPad,]"),\r
+                       new STKEYLABEL((int)Key.Divide, "[ / ]"),\r
+                       new STKEYLABEL((int)Key.PrintScreen, "[PrtScn]"),\r
+                       new STKEYLABEL((int)Key.RightAlt, "[R-Alt]"),\r
+                       new STKEYLABEL((int)Key.Pause, "[Pause]"),\r
+                       new STKEYLABEL((int)Key.Home, "[Home]"),\r
+                       new STKEYLABEL((int)Key.Up, "[Up]"),\r
+                       new STKEYLABEL((int)Key.PageUp, "[PageUp]"),\r
+                       new STKEYLABEL((int)Key.Left, "[Left]"),\r
+                       new STKEYLABEL((int)Key.Right, "[Right]"),\r
+                       new STKEYLABEL((int)Key.End, "[End]"),\r
+                       new STKEYLABEL((int)Key.Down, "[Down]"),\r
+                       new STKEYLABEL((int)Key.PageDown, "[PageDown]"),\r
+                       new STKEYLABEL((int)Key.Insert, "[Insert]"),\r
+                       new STKEYLABEL((int)Key.Delete, "[Delete]"),\r
+                       new STKEYLABEL((int)Key.LeftWindowsKey, "[L-Win]"),\r
+                       new STKEYLABEL((int)Key.RightWindowsKey, "[R-Win]"),\r
+                       new STKEYLABEL((int)Key.Applications, "[APP]"),\r
+                       new STKEYLABEL((int)Key.Power, "[Power]"),\r
+                       new STKEYLABEL((int)Key.Sleep, "[Sleep]"),\r
+                       new STKEYLABEL((int)Key.Wake, "[Wake]"),\r
+                       #endregion\r
                };\r
 \r
                private EPad pad;\r
@@ -420,18 +547,24 @@ namespace DTXMania
 \r
                private bool tキーチェックとアサイン_Keyboard()\r
                {\r
-                       for (int i = 0; i < 0x100; i++)\r
+                       for (int i = 0; i < 256; i++)\r
                        {\r
-                               if (i != (int)SharpDX.DirectInput.Key.Escape &&\r
-                                       i != (int)SharpDX.DirectInput.Key.Up &&\r
-                                       i != (int)SharpDX.DirectInput.Key.Down &&\r
-                                       i != (int)SharpDX.DirectInput.Key.Left &&\r
-                                       i != (int)SharpDX.DirectInput.Key.Right &&\r
-                                       i != (int)SharpDX.DirectInput.Key.Delete &&\r
+                               if (i != (int)Key.Escape &&\r
+                                       i != (int)Key.Up &&\r
+                                       i != (int)Key.Down &&\r
+                                       i != (int)Key.Left &&\r
+                                       i != (int)Key.Right &&\r
+                                       i != (int)Key.Delete &&\r
                                         CDTXMania.Instance.Input管理.Keyboard.bキーが押された(i))\r
                                {\r
                                        CDTXMania.Instance.Skin.sound決定音.t再生する();\r
+\r
+                                       // #xxxxx: 2017.5.7 from: アサイン済みのキーと今回割り当てるキーが同じである場合は、削除されないようコードを未使用値(ここでは-1)にする。\r
+                                       if( i == CDTXMania.Instance.ConfigIni.KeyAssign[ pad ][ ptr ].コード )\r
+                                               CDTXMania.Instance.ConfigIni.KeyAssign[ pad ][ ptr ].コード = -1;\r
+\r
                                        CDTXMania.Instance.ConfigIni.t指定した入力が既にアサイン済みである場合はそれを全削除する(EInputDevice.Keyboard, 0, i);\r
+\r
                                        CDTXMania.Instance.ConfigIni.KeyAssign[pad][ptr].入力デバイス = EInputDevice.Keyboard;\r
                                        CDTXMania.Instance.ConfigIni.KeyAssign[pad][ptr].ID = 0;\r
                                        CDTXMania.Instance.ConfigIni.KeyAssign[pad][ptr].コード = i;\r