OSDN Git Service

088リリース用にバージョン情報を更新。
[dtxmania/dtxmania.git] / DTXManiaプロジェクト / コード / 全体 / CDTXMania.cs
index 4786b18..2bd0eaa 100644 (file)
@@ -6,6 +6,7 @@ using System.Drawing;
 using System.Diagnostics;\r
 using System.Runtime.InteropServices;\r
 using System.IO;\r
+using System.Threading;\r
 using SlimDX;\r
 using SlimDX.Direct3D9;\r
 using FDK;\r
@@ -17,7 +18,8 @@ namespace DTXMania
        {\r
                // プロパティ\r
 \r
-               public static readonly string VERSION = "085(101102)";\r
+               public static readonly string VERSION = "088(110211)";\r
+//             public static readonly string VERSION = "086(101120)";\r
                public static readonly string SLIMDXDLL = "c_net20x86_Jun2010";\r
                public static readonly string D3DXDLL = "d3dx9_43.dll";         // June 2010\r
         //public static readonly string D3DXDLL = "d3dx9_42.dll";      // February 2010\r
@@ -265,7 +267,6 @@ namespace DTXMania
                        set;\r
                }\r
 \r
-\r
                // コンストラクタ\r
 \r
                public CDTXMania()\r
@@ -289,7 +290,6 @@ namespace DTXMania
                                        ConfigIni.nウインドウwidth = this.Window.ClientSize.Width;\r
                                        ConfigIni.nウインドウheight = this.Window.ClientSize.Height;\r
                                }\r
-//                             base.GraphicsDeviceManager.ToggleFullScreen();\r
                                base.GraphicsDeviceManager.ChangeDevice( settings );\r
                                if (ConfigIni.bウィンドウモード == true)        // #23510 2010.10.27 yyagi: to resume window size from backuped value\r
                                {\r
@@ -766,6 +766,18 @@ namespace DTXMania
                                                        {\r
                                                                Trace.TraceInformation( "----------------------" );\r
                                                                Trace.TraceInformation( "■ 演奏(ドラム画面)" );\r
+#if false              // #23625 2011.1.11 Config.iniからダメージ/回復値の定数変更を行う場合はここを有効にする 087リリースに合わせ機能無効化\r
+for (int i = 0; i < 5; i++)\r
+{\r
+       for (int j = 0; j < 2; j++)\r
+       {\r
+               stage演奏ドラム画面.fDamageGaugeDelta[i, j] = ConfigIni.fGaugeFactor[i, j];\r
+       }\r
+}\r
+for (int i = 0; i < 3; i++) {\r
+       stage演奏ドラム画面.fDamageLevelFactor[i] = ConfigIni.fDamageLevelFactor[i];\r
+}              \r
+#endif\r
                                                                r直前のステージ = r現在のステージ;\r
                                                                r現在のステージ = stage演奏ドラム画面;\r
                                                        }\r
@@ -773,6 +785,18 @@ namespace DTXMania
                                                        {\r
                                                                Trace.TraceInformation( "----------------------" );\r
                                                                Trace.TraceInformation( "■ 演奏(ギター画面)" );\r
+#if false              // #23625 2011.1.11 Config.iniからダメージ/回復値の定数変更を行う場合はここを有効にする 087リリースに合わせ機能無効化\r
+for (int i = 0; i < 5; i++)\r
+{\r
+       for (int j = 0; j < 2; j++)\r
+       {\r
+               stage演奏ギター画面.fDamageGaugeDelta[i, j] = ConfigIni.fGaugeFactor[i, j];\r
+       }\r
+}\r
+for (int i = 0; i < 3; i++) {\r
+       stage演奏ギター画面.fDamageLevelFactor[i] = ConfigIni.fDamageLevelFactor[i];\r
+}              \r
+#endif\r
                                                                r直前のステージ = r現在のステージ;\r
                                                                r現在のステージ = stage演奏ギター画面;\r
                                                        }\r
@@ -1033,21 +1057,30 @@ namespace DTXMania
                        }\r
 \r
                        this.Device.EndScene();\r
-                       if( this.b次のタイミングで全画面・ウィンドウ切り替えを行う )\r
+                       #region [ 全画面・ウインドウ切り替え ]\r
+                       if ( this.b次のタイミングで全画面・ウィンドウ切り替えを行う )\r
                        {\r
                                ConfigIni.b全画面モード = !ConfigIni.b全画面モード;\r
                                app.t全画面・ウィンドウモード切り替え();\r
                                this.b次のタイミングで全画面・ウィンドウ切り替えを行う = false;\r
                        }\r
-                       if( this.b次のタイミングで垂直帰線同期切り替えを行う )\r
+                       #endregion\r
+                       #region [ 垂直基線同期切り替え ]\r
+                       if ( this.b次のタイミングで垂直帰線同期切り替えを行う )\r
                        {\r
+                               bool bIsMaximized = this.Window.IsMaximized;                                                                                    // #23510 2010.11.3 yyagi: to backup current window mode before changing VSyncWait\r
                                currentClientSize = this.Window.ClientSize;                                                                                             // #23510 2010.11.3 yyagi: to backup current window size before changing VSyncWait\r
                                DeviceSettings currentSettings = app.GraphicsDeviceManager.CurrentSettings;\r
                                currentSettings.EnableVSync = ConfigIni.b垂直帰線待ちを行う;\r
                                app.GraphicsDeviceManager.ChangeDevice( currentSettings );\r
                                this.b次のタイミングで垂直帰線同期切り替えを行う = false;\r
                                base.Window.ClientSize = new Size(currentClientSize.Width, currentClientSize.Height);   // #23510 2010.11.3 yyagi: to resume window size after changing VSyncWait\r
+                               if (bIsMaximized)\r
+                               {\r
+                                       this.Window.WindowState = FormWindowState.Maximized;                                                            // #23510 2010.11.3 yyagi: to resume window mode after changing VSyncWait\r
+                               }\r
                        }\r
+                       #endregion\r
                }\r
 \r
 \r
@@ -1096,7 +1129,17 @@ namespace DTXMania
 \r
                private void t起動処理()\r
                {\r
+                       #region [ strEXEのあるフォルダを決定する ]\r
+                       //-----------------\r
+// BEGIN #23629 2010.11.13 from: デバッグ時は Application.ExecutablePath が ($SolutionDir)/bin/x86/Debug/ などになり System/ の読み込みに失敗するので、カレントディレクトリを採用する。(プロジェクトのプロパティ→デバッグ→作業ディレクトリが有効になる)\r
+#if DEBUG\r
                        strEXEのあるフォルダ = Environment.CurrentDirectory + @"\";\r
+#else\r
+                       strEXEのあるフォルダ = Path.GetDirectoryName( Application.ExecutablePath ) + @"\";       // #23629 2010.11.9 yyagi: set correct pathname where DTXManiaGR.exe is.\r
+#endif\r
+// END #23629 2010.11.13 from\r
+                       //-----------------\r
+                       #endregion\r
 \r
                        #region [ Config.ini の読込み ]\r
                        //---------------------\r
@@ -1110,7 +1153,7 @@ namespace DTXMania
                                }\r
                                catch\r
                                {\r
-                                       ConfigIni = new CConfigIni();   // 存在してなければ新規生成\r
+                                       //ConfigIni = new CConfigIni(); // 存在してなければ新規生成\r
                                }\r
                        }\r
                        //---------------------\r
@@ -1122,7 +1165,7 @@ namespace DTXMania
                        {\r
                                Trace.Listeners.Add( new CTraceLogListener( new StreamWriter( "DTXManiaLog.txt", false, Encoding.GetEncoding( "shift-jis" ) ) ) );\r
                        }\r
-                       Trace.WriteLine( "" );\r
+                       Trace.WriteLine("");\r
                        Trace.WriteLine( "DTXMania powered by YAMAHA Silent Session Drums" );\r
                        Trace.WriteLine( string.Format( "Release: {0}", VERSION ) );\r
                        Trace.WriteLine( "" );\r
@@ -1138,7 +1181,6 @@ namespace DTXMania
                        bコンパクトモード = false;\r
                        strコンパクトモードファイル = "";\r
                        string[] commandLineArgs = Environment.GetCommandLineArgs();\r
-                       \r
                        if( ( commandLineArgs != null ) && ( commandLineArgs.Length > 1 ) )\r
                        {\r
                                bコンパクトモード = true;\r
@@ -1156,14 +1198,15 @@ namespace DTXMania
                        {\r
                                currentClientSize = new Size(ConfigIni.nウインドウwidth, ConfigIni.nウインドウheight);\r
                        }\r
-                       base.Window.MaximizeBox = false;\r
+                       base.Window.MaximizeBox = true;                                                 // #23510 2010.11.04 yyagi: to support maximizing window\r
                        base.Window.FormBorderStyle = FormBorderStyle.Sizable;  // #23510 2010.10.27 yyagi: changed from FixedDialog to Sizable, to support window resize\r
                        base.Window.ShowIcon = true;\r
                        base.Window.Icon = Properties.Resources.dtx;\r
                        base.Window.KeyDown += new KeyEventHandler( this.Window_KeyDown );\r
-                       base.Window.ApplicationActivated += new EventHandler( this.Window_ApplicationActivated );\r
+                       base.Window.MouseDoubleClick += new MouseEventHandler(this.Window_MouseDoubleClick);    // #23510 2010.11.13 yyagi: to go fullscreen mode\r
+                       base.Window.ResizeEnd += new EventHandler(this.Window_ResizeEnd);                                               // #23510 2010.11.20 yyagi: to set resized window size in Config.ini\r
+                       base.Window.ApplicationActivated += new EventHandler(this.Window_ApplicationActivated);\r
                        base.Window.ApplicationDeactivated += new EventHandler( this.Window_ApplicationDeactivated );\r
-//                     base.Window.Resize += new EventHandler(Window_Resize);\r
                        //---------------------\r
                        #endregion\r
                        #region [ Direct3D9 デバイスの生成 ]\r
@@ -1173,11 +1216,21 @@ namespace DTXMania
                        settings.BackBufferWidth = 640;\r
                        settings.BackBufferHeight = 480;\r
                        settings.EnableVSync = ConfigIni.b垂直帰線待ちを行う;\r
-                       base.GraphicsDeviceManager.ChangeDevice( settings );\r
+                       try\r
+                       {\r
+                               base.GraphicsDeviceManager.ChangeDevice(settings);\r
+                       }\r
+                       catch (DeviceCreationException e)\r
+                       {\r
+                               Trace.TraceError(e.ToString());\r
+                               MessageBox.Show(e.Message + e.ToString(), "DTXMania failed to boot: DirectX9 Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
+                               Environment.Exit(-1);\r
+                       }\r
+\r
                        base.IsFixedTimeStep = false;\r
-                       base.Window.ClientSize = new Size(ConfigIni.nウインドウwidth, ConfigIni.nウインドウheight);   // #23510 2010.10.31 yyagi\r
-            base.InactiveSleepTime = TimeSpan.FromMilliseconds((float)(ConfigIni.n非フォーカス時スリープms));       // #23568 2010.11.3 yyagi: to support valiable sleep value when !IsActive\r
-            // #23568 2010.11.4 ikanick changed ( 1 -> ConfigIni )\r
+                       base.Window.ClientSize = new Size(ConfigIni.nウインドウwidth, ConfigIni.nウインドウheight);   // #23510 2010.10.31 yyagi: to recover window size. width and height are able to get from Config.ini.\r
+                       base.InactiveSleepTime = TimeSpan.FromMilliseconds((float)(ConfigIni.n非フォーカス時スリープms));    // #23568 2010.11.3 yyagi: to support valiable sleep value when !IsActive\r
+                                                                                                                                                                                                                               // #23568 2010.11.4 ikanick changed ( 1 -> ConfigIni )\r
                        //---------------------\r
                        #endregion\r
 \r
@@ -1700,12 +1753,10 @@ namespace DTXMania
                                #region [ Config.iniの出力 ]\r
                                //---------------------\r
                                Trace.TraceInformation("Config.ini を出力します。");\r
-                               // #23510 2010.10.31 yyagi\r
-                               // #23510 2010.11.02 yyagi change conditions from (base.windows.clientsize.width > 0) to (ConfigIni.bウインドウモード) to detect whether fullscreenmode or not correctly\r
-                               // とりあえずここでConfigへの変数書き戻しを行っているが、\r
-                               // 一段落したらリサイズイベントの処理中に入れ込んでしまう予定。\r
-                                       ConfigIni.nウインドウwidth  = (ConfigIni.bウィンドウモード) ? base.Window.ClientSize.Width : currentClientSize.Width;      // #23510 2010.10.31 yyagi add\r
-                                       ConfigIni.nウインドウheight = (ConfigIni.bウィンドウモード) ? base.Window.ClientSize.Height : currentClientSize.Height;\r
+                               if ( ConfigIni.bIsSwappedGuitarBass )                   // #24063 2011.1.16 yyagi ギターベースがスワップしているときは元に戻す\r
+                               {\r
+                                       // ConfigIni.SwapGuitarBassKeyAssign();\r
+                               }\r
                                string str = strEXEのあるフォルダ + "Config.ini";\r
                                Trace.Indent();\r
                                try\r
@@ -1713,9 +1764,9 @@ namespace DTXMania
                                        ConfigIni.t書き出し( str );\r
                                        Trace.TraceInformation( "保存しました。({0})", new object[] { str } );\r
                                }\r
-                               catch( Exception exception7 )\r
+                               catch( Exception e )\r
                                {\r
-                                       Trace.TraceError( exception7.Message );\r
+                                       Trace.TraceError( e.Message );\r
                                        Trace.TraceError( "Config.ini の出力に失敗しました。({0})", new object[] { str } );\r
                                }\r
                                finally\r
@@ -1740,28 +1791,28 @@ namespace DTXMania
                }\r
                private void Window_KeyDown( object sender, KeyEventArgs e )\r
                {\r
-                       if( e.KeyCode == Keys.Menu )\r
+                       if (e.KeyCode == Keys.Menu)\r
                        {\r
+                               e.Handled = true;\r
                                e.SuppressKeyPress = true;\r
                        }\r
-                       else if( ( e.KeyCode == Keys.Return ) && e.Alt )\r
+                       else if ((e.KeyCode == Keys.Return) && e.Alt)\r
                        {\r
-                               if( ConfigIni != null )\r
+                               if (ConfigIni != null)\r
                                {\r
                                        ConfigIni.bウィンドウモード = !ConfigIni.bウィンドウモード;\r
                                        this.t全画面・ウィンドウモード切り替え();\r
                                }\r
+                               e.Handled = true;\r
                                e.SuppressKeyPress = true;\r
                        }\r
                }\r
                private CScoreIni tScoreIniへBGMAdjustとHistoryとPlayCountを更新(string str新ヒストリ行)\r
                {\r
-                       bool flag;\r
-                       bool flag2;\r
-                       bool flag3;\r
-                       string str = DTX.strファイル名の絶対パス + ".score.ini";\r
-                       CScoreIni ini = new CScoreIni( str );\r
-                       if( !File.Exists( str ) )\r
+                       bool bIsUpdatedDrums, bIsUpdatedGuitar, bIsUpdatedBass;\r
+                       string strFilename = DTX.strファイル名の絶対パス + ".score.ini";\r
+                       CScoreIni ini = new CScoreIni( strFilename );\r
+                       if( !File.Exists( strFilename ) )\r
                        {\r
                                ini.stファイル.Title = DTX.TITLE;\r
                                ini.stファイル.Name = DTX.strファイル名;\r
@@ -1775,18 +1826,18 @@ namespace DTXMania
                                }\r
                        }\r
                        ini.stファイル.BGMAdjust = DTX.nBGMAdjust;\r
-                       CScoreIni.t更新条件を取得する( out flag, out flag2, out flag3 );\r
-                       if( ( flag || flag2 ) || flag3 )\r
+                       CScoreIni.t更新条件を取得する( out bIsUpdatedDrums, out bIsUpdatedGuitar, out bIsUpdatedBass );\r
+                       if( bIsUpdatedDrums || bIsUpdatedGuitar || bIsUpdatedBass )\r
                        {\r
-                               if( flag )\r
+                               if( bIsUpdatedDrums )\r
                                {\r
                                        ini.stファイル.PlayCountDrums++;\r
                                }\r
-                               if( flag2 )\r
+                               if( bIsUpdatedGuitar )\r
                                {\r
                                        ini.stファイル.PlayCountGuitar++;\r
                                }\r
-                               if( flag3 )\r
+                               if( bIsUpdatedBass )\r
                                {\r
                                        ini.stファイル.PlayCountBass++;\r
                                }\r
@@ -1804,7 +1855,7 @@ namespace DTXMania
                        }\r
                        if( ConfigIni.bScoreIniを出力する )\r
                        {\r
-                               ini.t書き出し( str );\r
+                               ini.t書き出し( strFilename );\r
                        }\r
 \r
                        return ini;\r
@@ -1878,6 +1929,16 @@ namespace DTXMania
                                this.t指定フォルダ内でのプラグイン検索と生成( dir + "\\", strプラグイン型名 );\r
                }\r
                //-----------------\r
+               private void Window_MouseDoubleClick( object sender, MouseEventArgs e)  // #23510 2010.11.13 yyagi: to go full screen mode\r
+               {\r
+                       ConfigIni.bウィンドウモード = false;\r
+                       this.t全画面・ウィンドウモード切り替え();\r
+               }\r
+               private void Window_ResizeEnd(object sender, EventArgs e)                               // #23510 2010.11.20 yyagi: to get resized window size\r
+               {\r
+                       ConfigIni.nウインドウwidth = (ConfigIni.bウィンドウモード) ? base.Window.ClientSize.Width : currentClientSize.Width;       // #23510 2010.10.31 yyagi add\r
+                       ConfigIni.nウインドウheight = (ConfigIni.bウィンドウモード) ? base.Window.ClientSize.Height : currentClientSize.Height;\r
+               }\r
                #endregion\r
        }\r
 }\r