Develop and Download Open Source Software

Browse Subversion Repository

Diff of /trunk/DTXManiaプロジェクト/コード/全体/CDTXMania.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 48 by kairera0467, Wed Mar 20 10:53:32 2013 UTC revision 49 by kairera0467, Thu Mar 21 01:10:59 2013 UTC
# Line 11  using System.Threading; Line 11  using System.Threading;
11  using System.Runtime.Serialization.Formatters.Binary;  using System.Runtime.Serialization.Formatters.Binary;
12  using SlimDX;  using SlimDX;
13  using SlimDX.Direct3D9;  using SlimDX.Direct3D9;
 using SlimDX.Windows;  
14  using FDK;  using FDK;
15  using SampleFramework;  using SampleFramework;
16  using DTXMania.Properties;  using DTXMania.Properties;
# Line 319  namespace DTXMania Line 318  namespace DTXMania
318                          get;                          get;
319                          set;                          set;
320                  }                  }
321          //public Device D3D9Device          //              public static CTimer ct;
         //{  
         //    get { return this._D3D9Device; }  
         //    protected set { this._D3D9Device = value; }  
         //}  
           
         public static void t初期化(CApp app)  
         {  
             //CDTXMania.App = app;  
             //CDTXMania.SoundDevice = null;                                                     // ユーザ依存  
             //CDTXMania.rc演奏用タイマ = null;                            // Global.Bass 依存(つまりユーザ依存)  
         }  
   
322          public IntPtr WindowHandle                                      // 2012.10.24 yyagi; to add ASIO support          public IntPtr WindowHandle                                      // 2012.10.24 yyagi; to add ASIO support
323          {          {
324              get { return base.Window.Handle; }              get { return base.Window.Handle; }
# Line 365  namespace DTXMania Line 352  namespace DTXMania
352                      currentClientSize = this.Window.ClientSize;                      currentClientSize = this.Window.ClientSize;
353                      ConfigIni.nウインドウwidth = this.Window.ClientSize.Width;                      ConfigIni.nウインドウwidth = this.Window.ClientSize.Width;
354                      ConfigIni.nウインドウheight = this.Window.ClientSize.Height;                      ConfigIni.nウインドウheight = this.Window.ClientSize.Height;
355                      // FDK.CTaskBar.ShowTaskBar( false );  //                  FDK.CTaskBar.ShowTaskBar( false );
356                  }                  }
357  #if !WindowedFullscreen  #if !WindowedFullscreen
358                  base.GraphicsDeviceManager.ChangeDevice(settings);                  base.GraphicsDeviceManager.ChangeDevice(settings);
# Line 388  namespace DTXMania Line 375  namespace DTXMania
375  #endif  #endif
376                      base.Window.ClientSize =                      base.Window.ClientSize =
377                          new Size(currentClientSize.Width, currentClientSize.Height);                          new Size(currentClientSize.Width, currentClientSize.Height);
378                      // FDK.CTaskBar.ShowTaskBar( true );  //                  FDK.CTaskBar.ShowTaskBar( true );
379                  }                  }
380  #if WindowedFullscreen  #if WindowedFullscreen
381                                  else                                  else
# Line 487  namespace DTXMania Line 474  namespace DTXMania
474              this.Device.SetRenderState(RenderState.AlphaTestEnable, true);              this.Device.SetRenderState(RenderState.AlphaTestEnable, true);
475              this.Device.SetRenderState(RenderState.AlphaRef, 10);              this.Device.SetRenderState(RenderState.AlphaRef, 10);
476    
477              if (CDTXMania.ConfigIni.b縮小文字のアンチエイリアスを有効にする == true)              //if (CDTXMania.ConfigIni.b縮小文字のアンチエイリアスを有効にする == true)
478              {              //{
479                  this.Device.SetRenderState(RenderState.MultisampleAntialias, true);              //    this.Device.SetRenderState(RenderState.MultisampleAntialias, true);
480                  this.Device.SetSamplerState(0, SamplerState.MinFilter, TextureFilter.Linear);              //    this.Device.SetSamplerState(0, SamplerState.MinFilter, TextureFilter.Linear);
481                  this.Device.SetSamplerState(0, SamplerState.MagFilter, TextureFilter.Linear);              //    this.Device.SetSamplerState(0, SamplerState.MagFilter, TextureFilter.Linear);
482              }              //}
483    
484              this.Device.SetRenderState<Compare>(RenderState.AlphaFunc, Compare.Greater);              this.Device.SetRenderState<Compare>(RenderState.AlphaFunc, Compare.Greater);
485              this.Device.SetRenderState(RenderState.AlphaBlendEnable, true);              this.Device.SetRenderState(RenderState.AlphaBlendEnable, true);
# Line 572  namespace DTXMania Line 559  namespace DTXMania
559    
560                          if( Timer != null )                          if( Timer != null )
561                                  Timer.t更新();                                  Timer.t更新();
   
562              if (CSound管理.rc演奏用タイマ != null)              if (CSound管理.rc演奏用タイマ != null)
563                  CSound管理.rc演奏用タイマ.t更新();                  CSound管理.rc演奏用タイマ.t更新();
564    
# Line 617  namespace DTXMania Line 603  namespace DTXMania
603    
604                                  CScoreIni scoreIni = null;                                  CScoreIni scoreIni = null;
605    
606                  if (Control.IsKeyLocked(Keys.CapsLock)) // #30925 2013.3.11 yyagi; capslock=ON時は、EnumSongsしないようにして、起動負荷とASIOの音切れの関係を確認する                  //if (Control.IsKeyLocked(Keys.CapsLock)) // #30925 2013.3.11 yyagi; capslock=ON時は、EnumSongsしないようにして、起動負荷とASIOの音切れの関係を確認する
607                  {                                       // → songs.db等の書き込み時だと音切れするっぽい                  //{                                       // → songs.db等の書き込み時だと音切れするっぽい
608                      CDTXMania.stage選曲.bIsEnumeratingSongs = false;                  //    CDTXMania.stage選曲.bIsEnumeratingSongs = false;
609                      actEnumSongs.On非活性化();                  //    actEnumSongs.On非活性化();
610                      EnumSongs.SongListEnumCompletelyDone();                  //    EnumSongs.SongListEnumCompletelyDone();
611                  }                  //}
   
612                                  #region [ 曲検索スレッドの起動/終了 ]                                       // ここに"Enumerating Songs..."表示を集約                                  #region [ 曲検索スレッドの起動/終了 ]                                       // ここに"Enumerating Songs..."表示を集約
613                  if (!CDTXMania.bコンパクトモード)                  if (!CDTXMania.bコンパクトモード)
614                  {                  {
# Line 1059  namespace DTXMania Line 1044  namespace DTXMania
1044                                                          CDTXMania.Pad.st検知したデバイス.Clear();       // 入力デバイスフラグクリア(2010.9.11)                                                          CDTXMania.Pad.st検知したデバイス.Clear();       // 入力デバイスフラグクリア(2010.9.11)
1045    
1046                                                          r現在のステージ.On非活性化();                                                          r現在のステージ.On非活性化();
 #if dshow  
                             stage演奏ドラム画面.actFOStageClear.On活性化(CDTXMania.app.D3D9Device);  
 #endif  
1047                                                          if( !ConfigIni.bギタレボモード )                                                          if( !ConfigIni.bギタレボモード )
1048                                                          {                                                          {
1049                                                                  Trace.TraceInformation( "----------------------" );                                                                  Trace.TraceInformation( "----------------------" );
# Line 1589  for (int i = 0; i < 3; i++) { Line 1571  for (int i = 0; i < 3; i++) {
1571          private System.Drawing.Font ftDeclaration;          private System.Drawing.Font ftDeclaration;
1572                  private MouseButtons mb = System.Windows.Forms.MouseButtons.Left;                  private MouseButtons mb = System.Windows.Forms.MouseButtons.Left;
1573          private string strWindowTitle = "";          private string strWindowTitle = "";
         //private volatile Device _D3D9Device = null;  
1574    
1575                  private void t起動処理()                  private void t起動処理()
1576                  {                  {
# Line 1696  for (int i = 0; i < 3; i++) { Line 1677  for (int i = 0; i < 3; i++) {
1677                          base.Window.ResizeEnd += new EventHandler(this.Window_ResizeEnd);                                               // #23510 2010.11.20 yyagi: to set resized window size in Config.ini                          base.Window.ResizeEnd += new EventHandler(this.Window_ResizeEnd);                                               // #23510 2010.11.20 yyagi: to set resized window size in Config.ini
1678                          base.Window.ApplicationActivated += new EventHandler(this.Window_ApplicationActivated);                          base.Window.ApplicationActivated += new EventHandler(this.Window_ApplicationActivated);
1679                          base.Window.ApplicationDeactivated += new EventHandler( this.Window_ApplicationDeactivated );                          base.Window.ApplicationDeactivated += new EventHandler( this.Window_ApplicationDeactivated );
1680                Trace.TraceInformation("ウィンドウの初期化に成功しました。");
1681                          //---------------------                          //---------------------
1682                          #endregion                          #endregion
1683                          #region [ Direct3D9Exを使うかどうか判定 ]                          #region [ Direct3D9Exを使うかどうか判定 ]
# Line 1705  for (int i = 0; i < 3; i++) { Line 1687  for (int i = 0; i < 3; i++) {
1687              //2013.03.09.kairera0467              //2013.03.09.kairera0467
1688              //おそらくこれがSSTでいう「tDirect3Dデバイスを生成・変更・リセットする」へ渡す設定に相当しているのだと思われ。              //おそらくこれがSSTでいう「tDirect3Dデバイスを生成・変更・リセットする」へ渡す設定に相当しているのだと思われ。
1689                          DeviceSettings settings = new DeviceSettings();                          DeviceSettings settings = new DeviceSettings();
             //CD3DSettings newD3DSettings = new CD3DSettings();  
1690  #if WindowedFullscreen  #if WindowedFullscreen
1691              settings.Windowed = true; // #30666 2013.2.2 yyagi: Fullscreenmode is "Maximized window" mode                          settings.Windowed = true;                                                               // #30666 2013.2.2 yyagi: Fullscreenmode is "Maximized window" mode
1692  #else  #else
1693                          settings.Windowed = ConfigIni.bウィンドウモード;                          settings.Windowed = ConfigIni.bウィンドウモード;
1694  #endif  #endif
# Line 1715  for (int i = 0; i < 3; i++) { Line 1696  for (int i = 0; i < 3; i++) {
1696                          settings.BackBufferHeight = SampleFramework.GameWindowSize.Height;                          settings.BackBufferHeight = SampleFramework.GameWindowSize.Height;
1697  //                      settings.BackBufferCount = 3;  //                      settings.BackBufferCount = 3;
1698                          settings.EnableVSync = ConfigIni.b垂直帰線待ちを行う;                          settings.EnableVSync = ConfigIni.b垂直帰線待ちを行う;
1699              // settings.BackBufferFormat = Format.A8R8G8B8;  //                      settings.BackBufferFormat = Format.A8R8G8B8;
1700  //               settings.MultisampleType = MultisampleType.FourSamples;  //                      settings.MultisampleType = MultisampleType.FourSamples;
1701                   //settings.MultisampleQuality = 4;  //                      settings.MultisampleQuality = 4;
1702                  // settings.MultisampleType = MultisampleType.None;  //                      settings.MultisampleType = MultisampleType.None;
1703                  // settings.MultisampleQuality = 0;  //                      settings.MultisampleQuality = 0;
1704                            
1705                          try                          try
1706                          {                          {
1707                                  base.GraphicsDeviceManager.ChangeDevice(settings);                                  base.GraphicsDeviceManager.ChangeDevice(settings);
# Line 1731  for (int i = 0; i < 3; i++) { Line 1712  for (int i = 0; i < 3; i++) {
1712                                  MessageBox.Show(e.Message + e.ToString(), "DTXMania failed to boot: DirectX9 Initialize Error", MessageBoxButtons.OK, MessageBoxIcon.Error);                                  MessageBox.Show(e.Message + e.ToString(), "DTXMania failed to boot: DirectX9 Initialize Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
1713                                  Environment.Exit(-1);                                  Environment.Exit(-1);
1714                          }                          }
1715                            
1716                          base.IsFixedTimeStep = false;                          base.IsFixedTimeStep = false;
1717  //                      base.TargetElapsedTime = TimeSpan.FromTicks( 10000000 / 75 );  //                      base.TargetElapsedTime = TimeSpan.FromTicks( 10000000 / 75 );
1718                          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.                          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.
1719                          base.InactiveSleepTime = TimeSpan.FromMilliseconds((float)(ConfigIni.n非フォーカス時スリープms));    // #23568 2010.11.3 yyagi: to support valiable sleep value when !IsActive                          base.InactiveSleepTime = TimeSpan.FromMilliseconds((float)(ConfigIni.n非フォーカス時スリープms));    // #23568 2010.11.3 yyagi: to support valiable sleep value when !IsActive
1720                                                                                                  // #23568 2010.11.4 ikanick changed ( 1 -> ConfigIni )                                                                                                                                                                                                                                  // #23568 2010.11.4 ikanick changed ( 1 -> ConfigIni )
   
             /*  
             this.D3D9Device = new Device(               // 失敗したら異常系とみなし、そのまま例外をthrow。  
                     new Direct3D(),  
                     newD3DSettings.nAdaptor,  
                     newD3DSettings.DeviceType,  
                     newD3DSettings.PresentParameters.DeviceWindowHandle,  
                     newD3DSettings.CreateFlags,  
                     newD3DSettings.PresentParameters);  
             */  
1721  #if WindowedFullscreen  #if WindowedFullscreen
1722              this.t全画面・ウィンドウモード切り替え(); // #30666 2013.2.2 yyagi: finalize settings for "Maximized window mode"                          this.t全画面・ウィンドウモード切り替え();                               // #30666 2013.2.2 yyagi: finalize settings for "Maximized window mode"
1723  #endif  #endif
1724              actFlushGPU = new CActFlushGPU();              Trace.TraceInformation("D3D9デバイスの生成に成功しました。");
1725                            actFlushGPU = new CActFlushGPU();
1726                          //---------------------                          //---------------------
1727                          #endregion                          #endregion
1728    
# Line 1921  for (int i = 0; i < 3; i++) { Line 1893  for (int i = 0; i < 3; i++) {
1893                              soundDeviceType = ESoundDeviceType.Unknown;                              soundDeviceType = ESoundDeviceType.Unknown;
1894                              break;                              break;
1895                      }                      }
1896                      Sound管理 = new CSound管理(base.Window.Handle,                      Sound管理 = new CSound管理( base.Window.Handle,
1897                                                  soundDeviceType,                                                  soundDeviceType,
1898                                                  CDTXMania.ConfigIni.nWASAPIBufferSizeMs,                                                  CDTXMania.ConfigIni.nWASAPIBufferSizeMs,
1899                                                  CDTXMania.ConfigIni.nASIOBufferSizeMs,                                                  CDTXMania.ConfigIni.nASIOBufferSizeMs,
# Line 1933  for (int i = 0; i < 3; i++) { Line 1905  for (int i = 0; i < 3; i++) {
1905                  }                  }
1906              }              }
1907              catch (Exception e)              catch (Exception e)
1908                          {              {
1909                  Trace.TraceError("DirectSound の初期化に失敗しました。(" + e.Message + ")");                  Trace.TraceError(e.Message);
1910                                  throw;                  throw;
1911                          }              }
1912                          finally              finally
1913                          {              {
1914                                  Trace.Unindent();                  Trace.Unindent();
1915                          }              }
1916                          //---------------------                          //---------------------
1917                          #endregion                          #endregion
1918                          #region [ Songs管理 の初期化 ]                          #region [ Songs管理 の初期化 ]

Legend:
Removed from v.48  
changed lines
  Added in v.49

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26