2 using System.Collections.Generic;
\r
3 using System.Globalization;
\r
5 using System.Windows.Forms;
\r
6 using System.Drawing;
\r
7 using System.Diagnostics;
\r
8 using System.Runtime.InteropServices;
\r
10 using System.Threading;
\r
11 using System.Runtime.Serialization.Formatters.Binary;
\r
13 using SlimDX.Direct3D9;
\r
15 using SampleFramework;
\r
19 internal class CDTXMania : Game
\r
22 #region [ properties ]
\r
23 public static readonly string VERSION = "099g(191022)";
\r
24 public static readonly string SLIMDXDLL = "c_net20x86_Jun2010";
\r
25 public static readonly string D3DXDLL = "d3dx9_43.dll"; // June 2010
\r
26 //public static readonly string D3DXDLL = "d3dx9_42.dll"; // February 2010
\r
27 //public static readonly string D3DXDLL = "d3dx9_41.dll"; // March 2009
\r
29 public static CDTXMania app
\r
34 public static C文字コンソール act文字コンソール
\r
39 public static bool bコンパクトモード
\r
44 public static CConfigIni ConfigIni
\r
49 public static CDTX DTX
\r
57 if( ( dtx != null ) && ( app != null ) )
\r
60 app.listトップレベルActivities.Remove( dtx );
\r
63 if( ( dtx != null ) && ( app != null ) )
\r
65 app.listトップレベルActivities.Add( dtx );
\r
69 public static CFPS FPS
\r
74 public static CInput管理 Input管理
\r
80 public static int nPerfect範囲ms
\r
84 if( stage選曲.r確定された曲 != null )
\r
86 C曲リストノード c曲リストノード = stage選曲.r確定された曲.r親ノード;
\r
87 if( ( ( c曲リストノード != null ) && ( c曲リストノード.eノード種別 == C曲リストノード.Eノード種別.BOX ) ) && ( c曲リストノード.nPerfect範囲ms >= 0 ) )
\r
89 return c曲リストノード.nPerfect範囲ms;
\r
92 return ConfigIni.nヒット範囲ms.Perfect;
\r
95 public static int nGreat範囲ms
\r
99 if( stage選曲.r確定された曲 != null )
\r
101 C曲リストノード c曲リストノード = stage選曲.r確定された曲.r親ノード;
\r
102 if( ( ( c曲リストノード != null ) && ( c曲リストノード.eノード種別 == C曲リストノード.Eノード種別.BOX ) ) && ( c曲リストノード.nGreat範囲ms >= 0 ) )
\r
104 return c曲リストノード.nGreat範囲ms;
\r
107 return ConfigIni.nヒット範囲ms.Great;
\r
110 public static int nGood範囲ms
\r
114 if( stage選曲.r確定された曲 != null )
\r
116 C曲リストノード c曲リストノード = stage選曲.r確定された曲.r親ノード;
\r
117 if( ( ( c曲リストノード != null ) && ( c曲リストノード.eノード種別 == C曲リストノード.Eノード種別.BOX ) ) && ( c曲リストノード.nGood範囲ms >= 0 ) )
\r
119 return c曲リストノード.nGood範囲ms;
\r
122 return ConfigIni.nヒット範囲ms.Good;
\r
125 public static int nPoor範囲ms
\r
129 if( stage選曲.r確定された曲 != null )
\r
131 C曲リストノード c曲リストノード = stage選曲.r確定された曲.r親ノード;
\r
132 if( ( ( c曲リストノード != null ) && ( c曲リストノード.eノード種別 == C曲リストノード.Eノード種別.BOX ) ) && ( c曲リストノード.nPoor範囲ms >= 0 ) )
\r
134 return c曲リストノード.nPoor範囲ms;
\r
137 return ConfigIni.nヒット範囲ms.Poor;
\r
141 public static CPad Pad
\r
146 public static Random Random
\r
151 public static CSkin Skin
\r
156 public static CSongs管理 Songs管理
\r
159 set; // 2012.1.26 yyagi private解除 CStage起動でのdesirialize読み込みのため
\r
161 public static CEnumSongs EnumSongs
\r
166 public static CActEnumSongs actEnumSongs
\r
171 public static CActFlushGPU actFlushGPU
\r
177 public static CSound管理 Sound管理
\r
182 public static CStage起動 stage起動
\r
187 public static CStageタイトル stageタイトル
\r
192 // public static CStageオプション stageオプション
\r
197 public static CStageコンフィグ stageコンフィグ
\r
202 public static CStage選曲 stage選曲
\r
207 public static CStage曲読み込み stage曲読み込み
\r
212 public static CStage演奏ギター画面 stage演奏ギター画面
\r
217 public static CStage演奏ドラム画面 stage演奏ドラム画面
\r
222 public static CStage結果 stage結果
\r
227 public static CStageChangeSkin stageChangeSkin
\r
232 public static CStage終了 stage終了
\r
237 public static CStage r現在のステージ = null;
\r
238 public static CStage r直前のステージ = null;
\r
239 public static string strEXEのあるフォルダ
\r
244 public static string strコンパクトモードファイル
\r
249 public static CTimer Timer
\r
254 public static Format TextureFormat = Format.A8R8G8B8;
\r
255 internal static IPluginActivity act現在入力を占有中のプラグイン = null;
\r
256 public bool bApplicationActive
\r
261 public bool b次のタイミングで垂直帰線同期切り替えを行う
\r
266 public bool b次のタイミングで全画面・ウィンドウ切り替えを行う
\r
271 public Device Device
\r
273 get { return base.GraphicsDeviceManager.Direct3D9.Device; }
\r
275 public CPluginHost PluginHost
\r
280 public List<STPlugin> listプラグイン = new List<STPlugin>();
\r
281 public struct STPlugin
\r
283 public IPluginActivity plugin;
\r
284 public string strプラグインフォルダ;
\r
285 public string strアセンブリ簡易名;
\r
286 public Version Version;
\r
288 private static Size currentClientSize // #23510 2010.10.27 add yyagi to keep current window size
\r
293 // public static CTimer ct;
\r
294 public IntPtr WindowHandle // 2012.10.24 yyagi; to add ASIO support
\r
296 get { return base.Window.Handle; }
\r
298 public static CDTXVmode DTXVmode // #28821 2014.1.23 yyagi
\r
309 CDTXMania.app = this;
\r
316 public void t全画面・ウィンドウモード切り替え()
\r
318 #if WindowedFullscreen
\r
319 if ( ConfigIni != null )
\r
321 DeviceSettings settings = base.GraphicsDeviceManager.CurrentSettings.Clone();
\r
322 if ( ( ConfigIni != null ) && ( ConfigIni.bウィンドウモード != settings.Windowed ) )
\r
325 #if !WindowedFullscreen
\r
326 settings.Windowed = ConfigIni.bウィンドウモード;
\r
328 if ( ConfigIni.bウィンドウモード == false ) // #23510 2010.10.27 yyagi: backup current window size before going fullscreen mode
\r
330 currentClientSize = this.Window.ClientSize;
\r
331 ConfigIni.nウインドウwidth = this.Window.ClientSize.Width;
\r
332 ConfigIni.nウインドウheight = this.Window.ClientSize.Height;
\r
333 // FDK.CTaskBar.ShowTaskBar( false );
\r
335 #if !WindowedFullscreen
\r
336 base.GraphicsDeviceManager.ChangeDevice( settings );
\r
338 if ( ConfigIni.bウィンドウモード == true ) // #23510 2010.10.27 yyagi: to resume window size from backuped value
\r
340 #if WindowedFullscreen
\r
341 // #30666 2013.2.2 yyagi Don't use Fullscreen mode becasue NVIDIA GeForce is
\r
342 // tend to delay drawing on Fullscreen mode. So DTXMania uses Maximized window
\r
343 // in spite of using fullscreen mode.
\r
344 app.Window.WindowState = FormWindowState.Normal;
\r
345 app.Window.FormBorderStyle = FormBorderStyle.Sizable;
\r
346 app.Window.WindowState = FormWindowState.Normal;
\r
348 base.Window.ClientSize =
\r
349 new Size( currentClientSize.Width, currentClientSize.Height );
\r
350 // FDK.CTaskBar.ShowTaskBar( true );
\r
352 #if WindowedFullscreen
\r
355 app.Window.WindowState = FormWindowState.Normal;
\r
356 app.Window.FormBorderStyle = FormBorderStyle.None;
\r
357 app.Window.WindowState = FormWindowState.Maximized;
\r
359 if ( ConfigIni.bウィンドウモード )
\r
361 if ( !this.bマウスカーソル表示中 )
\r
364 this.bマウスカーソル表示中 = true;
\r
367 else if ( this.bマウスカーソル表示中 )
\r
370 this.bマウスカーソル表示中 = false;
\r
376 #region [ #24609 リザルト画像をpngで保存する ] // #24609 2011.3.14 yyagi; to save result screen in case BestRank or HiSkill.
\r
378 /// リザルト画像のキャプチャと保存。
\r
380 /// <param name="strFilename">保存するファイル名(フルパス)</param>
\r
381 public bool SaveResultScreen( string strFullPath )
\r
383 string strSavePath = Path.GetDirectoryName( strFullPath );
\r
384 if ( !Directory.Exists( strSavePath ) )
\r
388 Directory.CreateDirectory( strSavePath );
\r
396 // http://www.gamedev.net/topic/594369-dx9slimdxati-incorrect-saving-surface-to-file/
\r
397 using ( Surface pSurface = CDTXMania.app.Device.GetRenderTarget( 0 ) )
\r
399 Surface.ToFile( pSurface, strFullPath, ImageFileFormat.Png );
\r
407 protected override void Initialize()
\r
411 //swlist1 = new List<int>( 8192 );
\r
412 //swlist2 = new List<int>( 8192 );
\r
413 //swlist3 = new List<int>( 8192 );
\r
414 //swlist4 = new List<int>( 8192 );
\r
415 //swlist5 = new List<int>( 8192 );
\r
416 if ( this.listトップレベルActivities != null )
\r
418 foreach( CActivity activity in this.listトップレベルActivities )
\r
419 activity.OnManagedリソースの作成();
\r
422 foreach( STPlugin st in this.listプラグイン )
\r
424 Directory.SetCurrentDirectory( st.strプラグインフォルダ );
\r
425 st.plugin.OnManagedリソースの作成();
\r
426 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
428 #if GPUFlushAfterPresent
\r
429 FrameEnd += dtxmania_FrameEnd;
\r
432 #if GPUFlushAfterPresent
\r
433 void dtxmania_FrameEnd( object sender, EventArgs e ) // GraphicsDeviceManager.game_FrameEnd()後に実行される
\r
434 { // → Present()直後にGPUをFlushする
\r
435 // → 画面のカクツキが頻発したため、ここでのFlushは行わない
\r
436 actFlushGPU.On進行描画(); // Flush GPU
\r
439 protected override void LoadContent()
\r
441 if ( ConfigIni.bウィンドウモード )
\r
443 if( !this.bマウスカーソル表示中 )
\r
446 this.bマウスカーソル表示中 = true;
\r
449 else if( this.bマウスカーソル表示中 )
\r
452 this.bマウスカーソル表示中 = false;
\r
454 this.Device.SetTransform(TransformState.View, Matrix.LookAtLH(new Vector3(0f, 0f, (float)(-SampleFramework.GameWindowSize.Height / 2 * Math.Sqrt(3.0))), new Vector3(0f, 0f, 0f), new Vector3(0f, 1f, 0f)));
\r
455 this.Device.SetTransform(TransformState.Projection, Matrix.PerspectiveFovLH(C変換.DegreeToRadian((float)60f), ((float)this.Device.Viewport.Width) / ((float)this.Device.Viewport.Height), -100f, 100f));
\r
456 this.Device.SetRenderState(RenderState.Lighting, false);
\r
457 this.Device.SetRenderState( RenderState.ZEnable, false );
\r
458 this.Device.SetRenderState( RenderState.AntialiasedLineEnable, false );
\r
459 this.Device.SetRenderState( RenderState.AlphaTestEnable, true );
\r
460 this.Device.SetRenderState( RenderState.AlphaRef, 10 );
\r
462 this.Device.SetRenderState( RenderState.MultisampleAntialias, true );
\r
463 this.Device.SetSamplerState( 0, SamplerState.MinFilter, TextureFilter.Linear );
\r
464 this.Device.SetSamplerState( 0, SamplerState.MagFilter, TextureFilter.Linear );
\r
466 this.Device.SetRenderState<Compare>( RenderState.AlphaFunc, Compare.Greater );
\r
467 this.Device.SetRenderState( RenderState.AlphaBlendEnable, true );
\r
468 this.Device.SetRenderState<Blend>( RenderState.SourceBlend, Blend.SourceAlpha );
\r
469 this.Device.SetRenderState<Blend>( RenderState.DestinationBlend, Blend.InverseSourceAlpha );
\r
470 this.Device.SetTextureStageState( 0, TextureStage.AlphaOperation, TextureOperation.Modulate );
\r
471 this.Device.SetTextureStageState( 0, TextureStage.AlphaArg1, 2 );
\r
472 this.Device.SetTextureStageState( 0, TextureStage.AlphaArg2, 1 );
\r
474 if( this.listトップレベルActivities != null )
\r
476 foreach( CActivity activity in this.listトップレベルActivities )
\r
477 activity.OnUnmanagedリソースの作成();
\r
480 foreach( STPlugin st in this.listプラグイン )
\r
482 Directory.SetCurrentDirectory( st.strプラグインフォルダ );
\r
483 st.plugin.OnUnmanagedリソースの作成();
\r
484 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
487 protected override void UnloadContent()
\r
489 if( this.listトップレベルActivities != null )
\r
491 foreach( CActivity activity in this.listトップレベルActivities )
\r
492 activity.OnUnmanagedリソースの解放();
\r
495 foreach( STPlugin st in this.listプラグイン )
\r
497 Directory.SetCurrentDirectory( st.strプラグインフォルダ );
\r
498 st.plugin.OnUnmanagedリソースの解放();
\r
499 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
502 protected override void OnExiting( EventArgs e )
\r
504 CPowerManagement.tEnableMonitorSuspend(); // スリープ抑止状態を解除
\r
506 base.OnExiting( e );
\r
508 protected override void Update( GameTime gameTime )
\r
511 protected override void Draw( GameTime gameTime )
\r
513 if (Sound管理 == null)
\r
517 Sound管理.t再生中の処理をする();
\r
519 if( Timer != null )
\r
521 if (CSound管理.rc演奏用タイマ != null)
\r
522 CSound管理.rc演奏用タイマ.t更新();
\r
524 if( Input管理 != null )
\r
525 Input管理.tポーリング( this.bApplicationActive, CDTXMania.ConfigIni.bバッファ入力を行う );
\r
530 //if( Pad != null ) ポーリング時にクリアしたらダメ!曲の開始時に1回だけクリアする。(2010.9.11)
\r
531 // Pad.st検知したデバイス.Clear();
\r
533 if( this.Device == null )
\r
536 if ( this.bApplicationActive ) // DTXMania本体起動中の本体/モニタの省電力モード移行を抑止
\r
537 CPowerManagement.tDisableMonitorSuspend();
\r
539 // #xxxxx 2013.4.8 yyagi; sleepの挿入位置を、EndScnene~Present間から、BeginScene前に移動。描画遅延を小さくするため。
\r
541 if ( ConfigIni.nフレーム毎スリープms >= 0 ) // #xxxxx 2011.11.27 yyagi
\r
543 Thread.Sleep( ConfigIni.nフレーム毎スリープms );
\r
547 #region [ DTXCreatorからの指示 ]
\r
548 if ( this.Window.IsReceivedMessage ) // ウインドウメッセージで、
\r
550 string strMes = this.Window.strMessage;
\r
551 this.Window.IsReceivedMessage = false;
\r
553 if ( strMes != null )
\r
555 DTXVmode.ParseArguments( strMes );
\r
557 if ( DTXVmode.Enabled )
\r
560 strコンパクトモードファイル = DTXVmode.filename;
\r
561 if ( DTXVmode.Command == CDTXVmode.ECommand.Preview )
\r
563 // preview soundの再生
\r
564 string strPreviewFilename = DTXVmode.previewFilename;
\r
565 //Trace.TraceInformation( "Preview Filename=" + DTXVmode.previewFilename );
\r
568 if ( this.previewSound != null )
\r
570 this.previewSound.tサウンドを停止する();
\r
571 this.previewSound.Dispose();
\r
572 this.previewSound = null;
\r
574 this.previewSound = CDTXMania.Sound管理.tサウンドを生成する( strPreviewFilename );
\r
575 this.previewSound.n音量 = DTXVmode.previewVolume;
\r
576 this.previewSound.n位置 = DTXVmode.previewPan;
\r
577 this.previewSound.t再生を開始する();
\r
578 Trace.TraceInformation( "DTXCからの指示で、サウンドを生成しました。({0})", strPreviewFilename );
\r
582 Trace.TraceError( "DTXCからの指示での、サウンドの生成に失敗しました。({0})", strPreviewFilename );
\r
583 if ( this.previewSound != null )
\r
585 this.previewSound.Dispose();
\r
587 this.previewSound = null;
\r
595 this.Device.BeginScene();
\r
596 this.Device.Clear( ClearFlags.ZBuffer | ClearFlags.Target, Color.Black, 1f, 0 );
\r
598 if( r現在のステージ != null )
\r
600 this.n進行描画の戻り値 = ( r現在のステージ != null ) ? r現在のステージ.On進行描画() : 0;
\r
602 #region [ プラグインの進行描画 ]
\r
603 //---------------------
\r
604 foreach( STPlugin sp in this.listプラグイン )
\r
606 Directory.SetCurrentDirectory( sp.strプラグインフォルダ );
\r
608 if( CDTXMania.act現在入力を占有中のプラグイン == null || CDTXMania.act現在入力を占有中のプラグイン == sp.plugin )
\r
609 sp.plugin.On進行描画( CDTXMania.Pad, CDTXMania.Input管理.Keyboard );
\r
611 sp.plugin.On進行描画( null, null );
\r
613 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
615 //---------------------
\r
619 CScoreIni scoreIni = null;
\r
621 if ( Control.IsKeyLocked( Keys.CapsLock ) ) // #30925 2013.3.11 yyagi; capslock=ON時は、EnumSongsしないようにして、起動負荷とASIOの音切れの関係を確認する
\r
622 { // → songs.db等の書き込み時だと音切れするっぽい
\r
623 actEnumSongs.On非活性化();
\r
624 EnumSongs.SongListEnumCompletelyDone();
\r
625 CDTXMania.stage選曲.bIsEnumeratingSongs = false;
\r
627 #region [ 曲検索スレッドの起動/終了 ] // ここに"Enumerating Songs..."表示を集約
\r
628 if ( !CDTXMania.bコンパクトモード )
\r
630 actEnumSongs.On進行描画(); // "Enumerating Songs..."アイコンの描画
\r
632 switch ( r現在のステージ.eステージID )
\r
634 case CStage.Eステージ.タイトル:
\r
635 case CStage.Eステージ.コンフィグ:
\r
636 case CStage.Eステージ.選曲:
\r
637 case CStage.Eステージ.曲読み込み:
\r
638 if ( EnumSongs != null )
\r
640 #region [ (特定条件時) 曲検索スレッドの起動・開始 ]
\r
641 if ( r現在のステージ.eステージID == CStage.Eステージ.タイトル &&
\r
642 r直前のステージ.eステージID == CStage.Eステージ.起動 &&
\r
643 this.n進行描画の戻り値 == (int) CStageタイトル.E戻り値.継続 &&
\r
644 !EnumSongs.IsSongListEnumStarted )
\r
646 actEnumSongs.On活性化();
\r
647 CDTXMania.stage選曲.bIsEnumeratingSongs = true;
\r
648 EnumSongs.Init( CDTXMania.Songs管理.listSongsDB, CDTXMania.Songs管理.nSongsDBから取得できたスコア数 ); // songs.db情報と、取得した曲数を、新インスタンスにも与える
\r
649 EnumSongs.StartEnumFromDisk(); // 曲検索スレッドの起動・開始
\r
650 if ( CDTXMania.Songs管理.nSongsDBから取得できたスコア数 == 0 ) // もし初回起動なら、検索スレッドのプライオリティをLowestでなくNormalにする
\r
652 EnumSongs.ChangeEnumeratePriority( ThreadPriority.Normal );
\r
657 #region [ 曲検索の中断と再開 ]
\r
658 if ( r現在のステージ.eステージID == CStage.Eステージ.選曲 && !EnumSongs.IsSongListEnumCompletelyDone )
\r
660 switch ( this.n進行描画の戻り値 )
\r
663 //if ( CDTXMania.stage選曲.bIsEnumeratingSongs )
\r
664 if ( !CDTXMania.stage選曲.bIsPlayingPremovie )
\r
666 EnumSongs.Resume(); // #27060 2012.2.6 yyagi 中止していたバックグランド曲検索を再開
\r
667 EnumSongs.IsSlowdown = false;
\r
671 // EnumSongs.Suspend(); // #27060 2012.3.2 yyagi #PREMOVIE再生中は曲検索を低速化
\r
672 EnumSongs.IsSlowdown = true;
\r
674 actEnumSongs.On活性化();
\r
678 EnumSongs.Suspend(); // #27060 バックグラウンドの曲検索を一時停止
\r
679 actEnumSongs.On非活性化();
\r
685 #region [ 曲探索中断待ち待機 ]
\r
686 if ( r現在のステージ.eステージID == CStage.Eステージ.曲読み込み && !EnumSongs.IsSongListEnumCompletelyDone &&
\r
687 EnumSongs.thDTXFileEnumerate != null ) // #28700 2012.6.12 yyagi; at Compact mode, enumerating thread does not exist.
\r
689 EnumSongs.WaitUntilSuspended(); // 念のため、曲検索が一時中断されるまで待機
\r
693 #region [ 曲検索が完了したら、実際の曲リストに反映する ]
\r
694 // CStage選曲.On活性化() に回した方がいいかな?
\r
695 if ( EnumSongs.IsSongListEnumerated )
\r
697 actEnumSongs.On非活性化();
\r
698 CDTXMania.stage選曲.bIsEnumeratingSongs = false;
\r
700 bool bRemakeSongTitleBar = ( r現在のステージ.eステージID == CStage.Eステージ.選曲 ) ? true : false;
\r
701 CDTXMania.stage選曲.Refresh( EnumSongs.Songs管理, bRemakeSongTitleBar );
\r
702 EnumSongs.SongListEnumCompletelyDone();
\r
710 switch ( r現在のステージ.eステージID )
\r
712 case CStage.Eステージ.何もしない:
\r
715 case CStage.Eステージ.起動:
\r
717 //-----------------------------
\r
718 if( this.n進行描画の戻り値 != 0 )
\r
723 Trace.TraceInformation( "----------------------" );
\r
724 Trace.TraceInformation( "■ タイトル" );
\r
726 r直前のステージ = r現在のステージ;
\r
727 r現在のステージ = stageタイトル;
\r
732 Trace.TraceInformation( "----------------------" );
\r
733 Trace.TraceInformation( "■ 曲読み込み" );
\r
734 stage曲読み込み.On活性化();
\r
735 r直前のステージ = r現在のステージ;
\r
736 r現在のステージ = stage曲読み込み;
\r
739 foreach( STPlugin pg in this.listプラグイン )
\r
741 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
742 pg.plugin.Onステージ変更();
\r
743 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
746 this.tガベージコレクションを実行する();
\r
748 //-----------------------------
\r
752 case CStage.Eステージ.タイトル:
\r
754 //-----------------------------
\r
755 switch( this.n進行描画の戻り値 )
\r
757 case (int)CStageタイトル.E戻り値.GAMESTART:
\r
759 //-----------------------------
\r
761 Trace.TraceInformation( "----------------------" );
\r
762 Trace.TraceInformation( "■ 選曲" );
\r
764 r直前のステージ = r現在のステージ;
\r
765 r現在のステージ = stage選曲;
\r
766 //-----------------------------
\r
770 #region [ OPTION: 廃止済 ]
\r
771 // case 2: // #24525 OPTIONとCONFIGの統合に伴い、OPTIONは廃止
\r
773 // //-----------------------------
\r
774 // r現在のステージ.On非活性化();
\r
775 // Trace.TraceInformation( "----------------------" );
\r
776 // Trace.TraceInformation( "■ オプション" );
\r
777 // stageオプション.On活性化();
\r
778 // r直前のステージ = r現在のステージ;
\r
779 // r現在のステージ = stageオプション;
\r
780 // //-----------------------------
\r
785 case (int)CStageタイトル.E戻り値.CONFIG:
\r
787 //-----------------------------
\r
789 Trace.TraceInformation( "----------------------" );
\r
790 Trace.TraceInformation( "■ コンフィグ" );
\r
791 stageコンフィグ.On活性化();
\r
792 r直前のステージ = r現在のステージ;
\r
793 r現在のステージ = stageコンフィグ;
\r
794 //-----------------------------
\r
798 case (int)CStageタイトル.E戻り値.EXIT:
\r
800 //-----------------------------
\r
802 Trace.TraceInformation( "----------------------" );
\r
803 Trace.TraceInformation( "■ 終了" );
\r
805 r直前のステージ = r現在のステージ;
\r
806 r現在のステージ = stage終了;
\r
807 //-----------------------------
\r
812 foreach( STPlugin pg in this.listプラグイン )
\r
814 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
815 pg.plugin.Onステージ変更();
\r
816 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
819 //this.tガベージコレクションを実行する(); // #31980 2013.9.3 yyagi タイトル画面でだけ、毎フレームGCを実行して重くなっていた問題の修正
\r
820 //-----------------------------
\r
824 // case CStage.Eステージ.オプション:
\r
826 // //-----------------------------
\r
827 // if( this.n進行描画の戻り値 != 0 )
\r
829 // switch( r直前のステージ.eステージID )
\r
831 // case CStage.Eステージ.タイトル:
\r
833 // //-----------------------------
\r
834 // r現在のステージ.On非活性化();
\r
835 // Trace.TraceInformation( "----------------------" );
\r
836 // Trace.TraceInformation( "■ タイトル" );
\r
837 // stageタイトル.On活性化();
\r
838 // r直前のステージ = r現在のステージ;
\r
839 // r現在のステージ = stageタイトル;
\r
841 // foreach( STPlugin pg in this.listプラグイン )
\r
843 // Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
844 // pg.plugin.Onステージ変更();
\r
845 // Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
848 // this.tガベージコレクションを実行する();
\r
850 // //-----------------------------
\r
853 // case CStage.Eステージ.選曲:
\r
855 // //-----------------------------
\r
856 // r現在のステージ.On非活性化();
\r
857 // Trace.TraceInformation( "----------------------" );
\r
858 // Trace.TraceInformation( "■ 選曲" );
\r
859 // stage選曲.On活性化();
\r
860 // r直前のステージ = r現在のステージ;
\r
861 // r現在のステージ = stage選曲;
\r
863 // foreach( STPlugin pg in this.listプラグイン )
\r
865 // Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
866 // pg.plugin.Onステージ変更();
\r
867 // Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
870 // this.tガベージコレクションを実行する();
\r
872 // //-----------------------------
\r
876 // //-----------------------------
\r
880 case CStage.Eステージ.コンフィグ:
\r
882 //-----------------------------
\r
883 if( this.n進行描画の戻り値 != 0 )
\r
885 switch( r直前のステージ.eステージID )
\r
887 case CStage.Eステージ.タイトル:
\r
889 //-----------------------------
\r
891 Trace.TraceInformation( "----------------------" );
\r
892 Trace.TraceInformation( "■ タイトル" );
\r
894 r直前のステージ = r現在のステージ;
\r
895 r現在のステージ = stageタイトル;
\r
897 foreach( STPlugin pg in this.listプラグイン )
\r
899 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
900 pg.plugin.Onステージ変更();
\r
901 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
904 this.tガベージコレクションを実行する();
\r
906 //-----------------------------
\r
909 case CStage.Eステージ.選曲:
\r
911 //-----------------------------
\r
913 Trace.TraceInformation( "----------------------" );
\r
914 Trace.TraceInformation( "■ 選曲" );
\r
916 r直前のステージ = r現在のステージ;
\r
917 r現在のステージ = stage選曲;
\r
919 foreach( STPlugin pg in this.listプラグイン )
\r
921 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
922 pg.plugin.Onステージ変更();
\r
923 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
926 this.tガベージコレクションを実行する();
\r
928 //-----------------------------
\r
932 //-----------------------------
\r
936 case CStage.Eステージ.選曲:
\r
938 //-----------------------------
\r
939 switch( this.n進行描画の戻り値 )
\r
941 case (int) CStage選曲.E戻り値.タイトルに戻る:
\r
943 //-----------------------------
\r
945 Trace.TraceInformation( "----------------------" );
\r
946 Trace.TraceInformation( "■ タイトル" );
\r
948 r直前のステージ = r現在のステージ;
\r
949 r現在のステージ = stageタイトル;
\r
951 foreach( STPlugin pg in this.listプラグイン )
\r
953 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
954 pg.plugin.Onステージ変更();
\r
955 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
958 this.tガベージコレクションを実行する();
\r
960 //-----------------------------
\r
963 case (int) CStage選曲.E戻り値.選曲した:
\r
965 //-----------------------------
\r
967 Trace.TraceInformation( "----------------------" );
\r
968 Trace.TraceInformation( "■ 曲読み込み" );
\r
969 stage曲読み込み.On活性化();
\r
970 r直前のステージ = r現在のステージ;
\r
971 r現在のステージ = stage曲読み込み;
\r
973 foreach( STPlugin pg in this.listプラグイン )
\r
975 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
976 pg.plugin.Onステージ変更();
\r
977 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
980 this.tガベージコレクションを実行する();
\r
982 //-----------------------------
\r
985 // case (int) CStage選曲.E戻り値.オプション呼び出し:
\r
987 // //-----------------------------
\r
988 // r現在のステージ.On非活性化();
\r
989 // Trace.TraceInformation( "----------------------" );
\r
990 // Trace.TraceInformation( "■ オプション" );
\r
991 // stageオプション.On活性化();
\r
992 // r直前のステージ = r現在のステージ;
\r
993 // r現在のステージ = stageオプション;
\r
995 // foreach( STPlugin pg in this.listプラグイン )
\r
997 // Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
998 // pg.plugin.Onステージ変更();
\r
999 // Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
1002 // this.tガベージコレクションを実行する();
\r
1004 // //-----------------------------
\r
1007 case (int) CStage選曲.E戻り値.コンフィグ呼び出し:
\r
1009 //-----------------------------
\r
1010 r現在のステージ.On非活性化();
\r
1011 Trace.TraceInformation( "----------------------" );
\r
1012 Trace.TraceInformation( "■ コンフィグ" );
\r
1013 stageコンフィグ.On活性化();
\r
1014 r直前のステージ = r現在のステージ;
\r
1015 r現在のステージ = stageコンフィグ;
\r
1017 foreach( STPlugin pg in this.listプラグイン )
\r
1019 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
1020 pg.plugin.Onステージ変更();
\r
1021 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
1024 this.tガベージコレクションを実行する();
\r
1026 //-----------------------------
\r
1029 case (int) CStage選曲.E戻り値.スキン変更:
\r
1032 //-----------------------------
\r
1033 r現在のステージ.On非活性化();
\r
1034 Trace.TraceInformation( "----------------------" );
\r
1035 Trace.TraceInformation( "■ スキン切り替え" );
\r
1036 stageChangeSkin.On活性化();
\r
1037 r直前のステージ = r現在のステージ;
\r
1038 r現在のステージ = stageChangeSkin;
\r
1040 //-----------------------------
\r
1043 //-----------------------------
\r
1047 case CStage.Eステージ.曲読み込み:
\r
1049 //-----------------------------
\r
1050 DTXVmode.Refreshed = false; // 曲のリロード中に発生した再リロードは、無視する。
\r
1051 if( this.n進行描画の戻り値 != 0 )
\r
1053 CDTXMania.Pad.st検知したデバイス.Clear(); // 入力デバイスフラグクリア(2010.9.11)
\r
1054 r現在のステージ.On非活性化();
\r
1055 #region [ ESC押下時は、曲の読み込みを中止して選曲画面に戻る ]
\r
1056 if ( this.n進行描画の戻り値 == (int) E曲読込画面の戻り値.読込中止 )
\r
1058 //DTX.t全チップの再生停止();
\r
1060 Trace.TraceInformation( "曲の読み込みを中止しました。" );
\r
1061 this.tガベージコレクションを実行する();
\r
1062 Trace.TraceInformation( "----------------------" );
\r
1063 Trace.TraceInformation( "■ 選曲" );
\r
1065 r直前のステージ = r現在のステージ;
\r
1066 r現在のステージ = stage選曲;
\r
1067 foreach ( STPlugin pg in this.listプラグイン )
\r
1069 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
1070 pg.plugin.Onステージ変更();
\r
1071 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
1077 if( !ConfigIni.bギタレボモード )
\r
1079 Trace.TraceInformation( "----------------------" );
\r
1080 Trace.TraceInformation( "■ 演奏(ドラム画面)" );
\r
1081 #if false // #23625 2011.1.11 Config.iniからダメージ/回復値の定数変更を行う場合はここを有効にする 087リリースに合わせ機能無効化
\r
1082 for (int i = 0; i < 5; i++)
\r
1084 for (int j = 0; j < 2; j++)
\r
1086 stage演奏ドラム画面.fDamageGaugeDelta[i, j] = ConfigIni.fGaugeFactor[i, j];
\r
1089 for (int i = 0; i < 3; i++) {
\r
1090 stage演奏ドラム画面.fDamageLevelFactor[i] = ConfigIni.fDamageLevelFactor[i];
\r
1093 r直前のステージ = r現在のステージ;
\r
1094 r現在のステージ = stage演奏ドラム画面;
\r
1098 Trace.TraceInformation( "----------------------" );
\r
1099 Trace.TraceInformation( "■ 演奏(ギター画面)" );
\r
1100 #if false // #23625 2011.1.11 Config.iniからダメージ/回復値の定数変更を行う場合はここを有効にする 087リリースに合わせ機能無効化
\r
1101 for (int i = 0; i < 5; i++)
\r
1103 for (int j = 0; j < 2; j++)
\r
1105 stage演奏ギター画面.fDamageGaugeDelta[i, j] = ConfigIni.fGaugeFactor[i, j];
\r
1108 for (int i = 0; i < 3; i++) {
\r
1109 stage演奏ギター画面.fDamageLevelFactor[i] = ConfigIni.fDamageLevelFactor[i];
\r
1112 r直前のステージ = r現在のステージ;
\r
1113 r現在のステージ = stage演奏ギター画面;
\r
1116 foreach( STPlugin pg in this.listプラグイン )
\r
1118 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
1119 pg.plugin.Onステージ変更();
\r
1120 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
1123 this.tガベージコレクションを実行する();
\r
1125 //-----------------------------
\r
1129 case CStage.Eステージ.演奏:
\r
1131 //-----------------------------
\r
1132 //long n1 = FDK.CSound管理.rc演奏用タイマ.nシステム時刻ms;
\r
1133 //long n2 = FDK.CSound管理.SoundDevice.n経過時間ms;
\r
1134 //long n3 = FDK.CSound管理.SoundDevice.tmシステムタイマ.nシステム時刻ms;
\r
1135 //long n4 = FDK.CSound管理.rc演奏用タイマ.n現在時刻;
\r
1136 //long n5 = FDK.CSound管理.SoundDevice.n経過時間を更新したシステム時刻ms;
\r
1138 //swlist1.Add( Convert.ToInt32(n1) );
\r
1139 //swlist2.Add( Convert.ToInt32(n2) );
\r
1140 //swlist3.Add( Convert.ToInt32( n3 ) );
\r
1141 //swlist4.Add( Convert.ToInt32( n4 ) );
\r
1142 //swlist5.Add( Convert.ToInt32( n5 ) );
\r
1144 #region [ DTXVモード中にDTXCreatorから指示を受けた場合の処理 ]
\r
1145 if ( DTXVmode.Enabled && DTXVmode.Refreshed )
\r
1147 DTXVmode.Refreshed = false;
\r
1149 if ( DTXVmode.Command == CDTXVmode.ECommand.Stop )
\r
1151 if ( !ConfigIni.bギタレボモード )
\r
1153 CDTXMania.stage演奏ドラム画面.t停止();
\r
1157 CDTXMania.stage演奏ギター画面.t停止();
\r
1159 if ( previewSound != null )
\r
1161 this.previewSound.tサウンドを停止する();
\r
1162 this.previewSound.Dispose();
\r
1163 this.previewSound = null;
\r
1168 // for ( int i = 0; i < swlist1.Count; i++ )
\r
1170 // int d1 = swlist1[ i ];
\r
1171 // int d2 = swlist2[ i ];
\r
1172 // int d3 = swlist3[ i ];
\r
1173 // int d4 = swlist4[ i ];
\r
1174 // int d5 = swlist5[ i ];
\r
1176 // int dif = d1 - lastd;
\r
1178 // if ( 16 <= dif && dif <= 17 )
\r
1185 // Trace.TraceInformation( "frame {0:D4}: {1:D3} ( {2:D3}, {3:D3} - {7:D3}, {4:D3} ) {5}, n現在時刻={6}", f, dif, d1, d2, d3, s, d4, d5 );
\r
1189 // swlist1.Clear();
\r
1190 // swlist2.Clear();
\r
1191 // swlist3.Clear();
\r
1192 // swlist4.Clear();
\r
1193 // swlist5.Clear();
\r
1197 else if ( DTXVmode.Command == CDTXVmode.ECommand.Play )
\r
1199 if ( DTXVmode.NeedReload )
\r
1201 if ( !ConfigIni.bギタレボモード )
\r
1203 CDTXMania.stage演奏ドラム画面.t再読込();
\r
1207 CDTXMania.stage演奏ギター画面.t再読込();
\r
1210 CDTXMania.ConfigIni.bDrums有効 = !DTXVmode.GRmode;
\r
1211 CDTXMania.ConfigIni.bGuitar有効 = true;
\r
1212 CDTXMania.ConfigIni.bTimeStretch = DTXVmode.TimeStretch;
\r
1213 CSound管理.bIsTimeStretch = DTXVmode.TimeStretch;
\r
1214 if ( CDTXMania.ConfigIni.b垂直帰線待ちを行う != DTXVmode.VSyncWait )
\r
1216 CDTXMania.ConfigIni.b垂直帰線待ちを行う = DTXVmode.VSyncWait;
\r
1217 CDTXMania.app.b次のタイミングで垂直帰線同期切り替えを行う = true;
\r
1222 if ( !ConfigIni.bギタレボモード )
\r
1224 CDTXMania.stage演奏ドラム画面.t演奏位置の変更( CDTXMania.DTXVmode.nStartBar );
\r
1228 CDTXMania.stage演奏ギター画面.t演奏位置の変更( CDTXMania.DTXVmode.nStartBar );
\r
1235 switch( this.n進行描画の戻り値 )
\r
1237 case (int) E演奏画面の戻り値.再読込・再演奏:
\r
1238 #region [ DTXファイルを再読み込みして、再演奏 ]
\r
1241 r現在のステージ.On非活性化();
\r
1242 stage曲読み込み.On活性化();
\r
1243 r直前のステージ = r現在のステージ;
\r
1244 r現在のステージ = stage曲読み込み;
\r
1245 this.tガベージコレクションを実行する();
\r
1249 //case (int) E演奏画面の戻り値.再演奏:
\r
1250 #region [ 再読み込み無しで、再演奏 ]
\r
1254 case (int) E演奏画面の戻り値.継続:
\r
1257 case (int) E演奏画面の戻り値.演奏中断:
\r
1258 #region [ 演奏キャンセル ]
\r
1259 //-----------------------------
\r
1260 scoreIni = this.tScoreIniへBGMAdjustとHistoryとPlayCountを更新( "Play canceled" );
\r
1264 //for (int i = 0; i < swlist1.Count; i++)
\r
1266 // int d1 = swlist1[ i ];
\r
1267 // int d2 = swlist2[ i ];
\r
1268 // int d3 = swlist3[ i ];
\r
1269 // int d4 = swlist4[ i ];
\r
1271 // int dif = d1 - lastd;
\r
1273 // if ( 16 <= dif && dif <= 17 )
\r
1280 // Trace.TraceInformation( "frame {0:D4}: {1:D3} ( {2:D3}, {3:D3}, {4:D3} ) {5}, n現在時刻={6}", f, dif, d1, d2, d3, s, d4 );
\r
1284 //swlist1.Clear();
\r
1285 //swlist2.Clear();
\r
1286 //swlist3.Clear();
\r
1287 //swlist4.Clear();
\r
1289 #region [ プラグイン On演奏キャンセル() の呼び出し ]
\r
1290 //---------------------
\r
1291 foreach( STPlugin pg in this.listプラグイン )
\r
1293 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
1294 pg.plugin.On演奏キャンセル( scoreIni );
\r
1295 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
1297 //---------------------
\r
1302 r現在のステージ.On非活性化();
\r
1305 base.Window.Close();
\r
1309 Trace.TraceInformation( "----------------------" );
\r
1310 Trace.TraceInformation( "■ 選曲" );
\r
1312 r直前のステージ = r現在のステージ;
\r
1313 r現在のステージ = stage選曲;
\r
1315 #region [ プラグイン Onステージ変更() の呼び出し ]
\r
1316 //---------------------
\r
1317 foreach( STPlugin pg in this.listプラグイン )
\r
1319 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
1320 pg.plugin.Onステージ変更();
\r
1321 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
1323 //---------------------
\r
1326 this.tガベージコレクションを実行する();
\r
1329 //-----------------------------
\r
1332 case (int) E演奏画面の戻り値.ステージ失敗:
\r
1333 #region [ 演奏失敗(StageFailed) ]
\r
1334 //-----------------------------
\r
1335 scoreIni = this.tScoreIniへBGMAdjustとHistoryとPlayCountを更新( "Stage failed" );
\r
1337 #region [ プラグイン On演奏失敗() の呼び出し ]
\r
1338 //---------------------
\r
1339 foreach( STPlugin pg in this.listプラグイン )
\r
1341 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
1342 pg.plugin.On演奏失敗( scoreIni );
\r
1343 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
1345 //---------------------
\r
1350 r現在のステージ.On非活性化();
\r
1353 base.Window.Close();
\r
1357 Trace.TraceInformation( "----------------------" );
\r
1358 Trace.TraceInformation( "■ 選曲" );
\r
1360 r直前のステージ = r現在のステージ;
\r
1361 r現在のステージ = stage選曲;
\r
1363 #region [ プラグイン Onステージ変更() の呼び出し ]
\r
1364 //---------------------
\r
1365 foreach( STPlugin pg in this.listプラグイン )
\r
1367 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
1368 pg.plugin.Onステージ変更();
\r
1369 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
1371 //---------------------
\r
1374 this.tガベージコレクションを実行する();
\r
1377 //-----------------------------
\r
1380 case (int) E演奏画面の戻り値.ステージクリア:
\r
1382 //-----------------------------
\r
1383 CScoreIni.C演奏記録 c演奏記録_Drums, c演奏記録_Guitar, c演奏記録_Bass;
\r
1384 CDTX.CChip[] chipArray = new CDTX.CChip[ 10 ];
\r
1385 if( ConfigIni.bギタレボモード )
\r
1387 stage演奏ギター画面.t演奏結果を格納する( out c演奏記録_Drums, out c演奏記録_Guitar, out c演奏記録_Bass );
\r
1391 stage演奏ドラム画面.t演奏結果を格納する( out c演奏記録_Drums, out c演奏記録_Guitar, out c演奏記録_Bass, out chipArray );
\r
1394 if ( CDTXMania.ConfigIni.bIsSwappedGuitarBass ) // #24063 2011.1.24 yyagi Gt/Bsを入れ替えていたなら、演奏結果も入れ替える
\r
1396 CScoreIni.C演奏記録 t;
\r
1398 c演奏記録_Guitar = c演奏記録_Bass;
\r
1401 CDTXMania.DTX.SwapGuitarBassInfos(); // 譜面情報も元に戻す
\r
1402 CDTXMania.ConfigIni.SwapGuitarBassInfos_AutoFlags(); // #24415 2011.2.27 yyagi
\r
1403 // リザルト集計時のみ、Auto系のフラグも元に戻す。
\r
1404 // これを戻すのは、リザルト集計後。
\r
1405 } // "case CStage.Eステージ.結果:"のところ。
\r
1407 double ps = 0.0, gs = 0.0;
\r
1408 if ( !c演奏記録_Drums.b全AUTOである && c演奏記録_Drums.n全チップ数 > 0) {
\r
1409 ps = c演奏記録_Drums.db演奏型スキル値;
\r
1410 gs = c演奏記録_Drums.dbゲーム型スキル値;
\r
1412 else if ( !c演奏記録_Guitar.b全AUTOである && c演奏記録_Guitar.n全チップ数 > 0) {
\r
1413 ps = c演奏記録_Guitar.db演奏型スキル値;
\r
1414 gs = c演奏記録_Guitar.dbゲーム型スキル値;
\r
1418 ps = c演奏記録_Bass.db演奏型スキル値;
\r
1419 gs = c演奏記録_Bass.dbゲーム型スキル値;
\r
1421 string str = "Cleared";
\r
1422 switch( CScoreIni.t総合ランク値を計算して返す( c演奏記録_Drums, c演奏記録_Guitar, c演奏記録_Bass ) )
\r
1424 case (int)CScoreIni.ERANK.SS:
\r
1425 str = string.Format( "Cleared (SS: {0:F2})", ps );
\r
1428 case (int) CScoreIni.ERANK.S:
\r
1429 str = string.Format( "Cleared (S: {0:F2})", ps );
\r
1432 case (int) CScoreIni.ERANK.A:
\r
1433 str = string.Format( "Cleared (A: {0:F2})", ps );
\r
1436 case (int) CScoreIni.ERANK.B:
\r
1437 str = string.Format( "Cleared (B: {0:F2})", ps );
\r
1440 case (int) CScoreIni.ERANK.C:
\r
1441 str = string.Format( "Cleared (C: {0:F2})", ps );
\r
1444 case (int) CScoreIni.ERANK.D:
\r
1445 str = string.Format( "Cleared (D: {0:F2})", ps );
\r
1448 case (int) CScoreIni.ERANK.E:
\r
1449 str = string.Format( "Cleared (E: {0:F2})", ps );
\r
1452 case (int)CScoreIni.ERANK.UNKNOWN: // #23534 2010.10.28 yyagi add: 演奏チップが0個のとき
\r
1453 str = "Cleared (No chips)";
\r
1457 scoreIni = this.tScoreIniへBGMAdjustとHistoryとPlayCountを更新( str );
\r
1459 #region [ プラグイン On演奏クリア() の呼び出し ]
\r
1460 //---------------------
\r
1461 foreach( STPlugin pg in this.listプラグイン )
\r
1463 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
1464 pg.plugin.On演奏クリア( scoreIni );
\r
1465 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
1467 //---------------------
\r
1470 r現在のステージ.On非活性化();
\r
1471 Trace.TraceInformation( "----------------------" );
\r
1472 Trace.TraceInformation( "■ 結果" );
\r
1473 stage結果.st演奏記録.Drums = c演奏記録_Drums;
\r
1474 stage結果.st演奏記録.Guitar = c演奏記録_Guitar;
\r
1475 stage結果.st演奏記録.Bass = c演奏記録_Bass;
\r
1476 stage結果.r空うちドラムチップ = chipArray;
\r
1478 r直前のステージ = r現在のステージ;
\r
1479 r現在のステージ = stage結果;
\r
1481 #region [ プラグイン Onステージ変更() の呼び出し ]
\r
1482 //---------------------
\r
1483 foreach( STPlugin pg in this.listプラグイン )
\r
1485 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
1486 pg.plugin.Onステージ変更();
\r
1487 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
1489 //---------------------
\r
1493 //-----------------------------
\r
1496 //-----------------------------
\r
1500 case CStage.Eステージ.結果:
\r
1502 //-----------------------------
\r
1503 if( this.n進行描画の戻り値 != 0 )
\r
1505 if ( CDTXMania.ConfigIni.bIsSwappedGuitarBass ) // #24415 2011.2.27 yyagi Gt/Bsを入れ替えていたなら、Auto状態をリザルト画面終了後に元に戻す
\r
1507 CDTXMania.ConfigIni.SwapGuitarBassInfos_AutoFlags(); // Auto入れ替え
\r
1510 DTX.t全チップの再生一時停止();
\r
1512 r現在のステージ.On非活性化();
\r
1515 Trace.TraceInformation( "----------------------" );
\r
1516 Trace.TraceInformation( "■ 選曲" );
\r
1518 r直前のステージ = r現在のステージ;
\r
1519 r現在のステージ = stage選曲;
\r
1521 foreach( STPlugin pg in this.listプラグイン )
\r
1523 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
1524 pg.plugin.Onステージ変更();
\r
1525 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
1528 this.tガベージコレクションを実行する();
\r
1532 base.Window.Close();
\r
1535 //-----------------------------
\r
1539 case CStage.Eステージ.ChangeSkin:
\r
1541 //-----------------------------
\r
1542 if ( this.n進行描画の戻り値 != 0 )
\r
1544 r現在のステージ.On非活性化();
\r
1545 Trace.TraceInformation( "----------------------" );
\r
1546 Trace.TraceInformation( "■ 選曲" );
\r
1548 r直前のステージ = r現在のステージ;
\r
1549 r現在のステージ = stage選曲;
\r
1550 this.tガベージコレクションを実行する();
\r
1552 //-----------------------------
\r
1556 case CStage.Eステージ.終了:
\r
1558 //-----------------------------
\r
1559 if( this.n進行描画の戻り値 != 0 )
\r
1563 //-----------------------------
\r
1568 this.Device.EndScene(); // Present()は game.csのOnFrameEnd()に登録された、GraphicsDeviceManager.game_FrameEnd() 内で実行されるので不要
\r
1569 // (つまり、Present()は、Draw()完了後に実行される)
\r
1570 #if !GPUFlushAfterPresent
\r
1571 actFlushGPU.On進行描画(); // Flush GPU // EndScene()~Present()間 (つまりVSync前) でFlush実行
\r
1573 if ( Sound管理.GetCurrentSoundDeviceType() != "DirectSound" )
\r
1575 Sound管理.t再生中の処理をする(); // サウンドバッファの更新; 画面描画と同期させることで、スクロールをスムーズにする
\r
1579 #region [ 全画面・ウインドウ切り替え ]
\r
1580 if ( this.b次のタイミングで全画面・ウィンドウ切り替えを行う )
\r
1582 ConfigIni.b全画面モード = !ConfigIni.b全画面モード;
\r
1583 app.t全画面・ウィンドウモード切り替え();
\r
1584 this.b次のタイミングで全画面・ウィンドウ切り替えを行う = false;
\r
1587 #region [ 垂直基線同期切り替え ]
\r
1588 if ( this.b次のタイミングで垂直帰線同期切り替えを行う )
\r
1590 bool bIsMaximized = this.Window.IsMaximized; // #23510 2010.11.3 yyagi: to backup current window mode before changing VSyncWait
\r
1591 currentClientSize = this.Window.ClientSize; // #23510 2010.11.3 yyagi: to backup current window size before changing VSyncWait
\r
1592 DeviceSettings currentSettings = app.GraphicsDeviceManager.CurrentSettings;
\r
1593 currentSettings.EnableVSync = ConfigIni.b垂直帰線待ちを行う;
\r
1594 app.GraphicsDeviceManager.ChangeDevice( currentSettings );
\r
1595 this.b次のタイミングで垂直帰線同期切り替えを行う = false;
\r
1596 base.Window.ClientSize = new Size(currentClientSize.Width, currentClientSize.Height); // #23510 2010.11.3 yyagi: to resume window size after changing VSyncWait
\r
1599 this.Window.WindowState = FormWindowState.Maximized; // #23510 2010.11.3 yyagi: to resume window mode after changing VSyncWait
\r
1607 #region [ 汎用ヘルパー ]
\r
1608 //-----------------
\r
1609 public static CTexture tテクスチャの生成( string fileName )
\r
1611 return tテクスチャの生成( fileName, false );
\r
1613 public static CTexture tテクスチャの生成( string fileName, bool b黒を透過する )
\r
1615 if ( app == null )
\r
1621 return new CTexture( app.Device, fileName, TextureFormat, b黒を透過する );
\r
1623 catch ( CTextureCreateFailedException )
\r
1625 Trace.TraceError( "テクスチャの生成に失敗しました。({0})", fileName );
\r
1628 catch ( FileNotFoundException )
\r
1630 Trace.TraceError( "テクスチャファイルが見つかりませんでした。({0})", fileName );
\r
1634 public static void tテクスチャの解放( ref CTexture tx )
\r
1636 CDTXMania.t安全にDisposeする( ref tx );
\r
1639 public static CTexture tテクスチャの生成( byte[] txData )
\r
1641 return tテクスチャの生成( txData, false );
\r
1643 public static CTexture tテクスチャの生成( byte[] txData, bool b黒を透過する )
\r
1645 if ( app == null )
\r
1651 return new CTexture( app.Device, txData, TextureFormat, b黒を透過する );
\r
1653 catch ( CTextureCreateFailedException )
\r
1655 Trace.TraceError( "テクスチャの生成に失敗しました。(txData)" );
\r
1660 public static CTexture tテクスチャの生成( Bitmap bitmap )
\r
1662 return tテクスチャの生成( bitmap, false );
\r
1664 public static CTexture tテクスチャの生成( Bitmap bitmap, bool b黒を透過する )
\r
1666 if ( app == null )
\r
1672 return new CTexture( app.Device, bitmap, TextureFormat, b黒を透過する );
\r
1674 catch ( CTextureCreateFailedException )
\r
1676 Trace.TraceError( "テクスチャの生成に失敗しました。(txData)" );
\r
1681 /// <summary>プロパティ、インデクサには ref は使用できないので注意。</summary>
\r
1682 public static void t安全にDisposeする<T>( ref T obj )
\r
1684 if ( obj == null )
\r
1687 var d = obj as IDisposable;
\r
1692 obj = default( T );
\r
1694 //-----------------
\r
1697 #region [ private ]
\r
1698 //-----------------
\r
1699 private bool bマウスカーソル表示中 = true;
\r
1700 private bool b終了処理完了済み;
\r
1701 private static CDTX dtx;
\r
1702 private List<CActivity> listトップレベルActivities;
\r
1703 private int n進行描画の戻り値;
\r
1704 private MouseButtons mb = System.Windows.Forms.MouseButtons.Left;
\r
1705 private string strWindowTitle
\r
1709 if ( DTXVmode.Enabled )
\r
1711 return "DTXViewer release " + VERSION;
\r
1715 return "DTXMania .NET style release " + VERSION;
\r
1719 private CSound previewSound;
\r
1721 private void t起動処理()
\r
1723 #region [ strEXEのあるフォルダを決定する ]
\r
1724 //-----------------
\r
1725 // BEGIN #23629 2010.11.13 from: デバッグ時は Application.ExecutablePath が ($SolutionDir)/bin/x86/Debug/ などになり System/ の読み込みに失敗するので、カレントディレクトリを採用する。(プロジェクトのプロパティ→デバッグ→作業ディレクトリが有効になる)
\r
1727 strEXEのあるフォルダ = Environment.CurrentDirectory + @"\";
\r
1728 //strEXEのあるフォルダ = Path.GetDirectoryName( Environment.GetCommandLineArgs()[ 0 ] ) + @"\";
\r
1730 strEXEのあるフォルダ = Path.GetDirectoryName( Application.ExecutablePath ) + @"\"; // #23629 2010.11.9 yyagi: set correct pathname where DTXManiaGR.exe is.
\r
1732 // END #23629 2010.11.13 from
\r
1733 //-----------------
\r
1736 #region [ Config.ini の読込み ]
\r
1737 //---------------------
\r
1738 ConfigIni = new CConfigIni();
\r
1739 string path = strEXEのあるフォルダ + "Config.ini";
\r
1740 if( File.Exists( path ) )
\r
1744 ConfigIni.tファイルから読み込み( path );
\r
1748 //ConfigIni = new CConfigIni(); // 存在してなければ新規生成
\r
1751 this.Window.EnableSystemMenu = CDTXMania.ConfigIni.bIsEnabledSystemMenu; // #28200 2011.5.1 yyagi
\r
1752 // 2012.8.22 Config.iniが無いときに初期値が適用されるよう、この設定行をifブロック外に移動
\r
1754 //---------------------
\r
1756 #region [ ログ出力開始 ]
\r
1757 //---------------------
\r
1758 Trace.AutoFlush = true;
\r
1759 if( ConfigIni.bログ出力 )
\r
1763 Trace.Listeners.Add( new CTraceLogListener( new StreamWriter( System.IO.Path.Combine( strEXEのあるフォルダ, "DTXManiaLog.txt" ), false, Encoding.GetEncoding( "Shift_JIS" ) ) ) );
\r
1765 catch ( System.UnauthorizedAccessException ) // #24481 2011.2.20 yyagi
\r
1767 int c = (CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "ja")? 0 : 1;
\r
1768 string[] mes_writeErr = {
\r
1769 "DTXManiaLog.txtへの書き込みができませんでした。書き込みできるようにしてから、再度起動してください。",
\r
1770 "Failed to write DTXManiaLog.txt. Please set it writable and try again."
\r
1772 MessageBox.Show( mes_writeErr[c], "DTXMania boot error", MessageBoxButtons.OK, MessageBoxIcon.Error );
\r
1773 Environment.Exit(1);
\r
1776 Trace.WriteLine("");
\r
1777 Trace.WriteLine( "DTXMania powered by YAMAHA Silent Session Drums" );
\r
1778 Trace.WriteLine( string.Format( "Release: {0}", VERSION ) );
\r
1779 Trace.WriteLine( "" );
\r
1780 Trace.TraceInformation( "----------------------" );
\r
1781 Trace.TraceInformation( "■ アプリケーションの初期化" );
\r
1782 Trace.TraceInformation( "OS Version: " + Environment.OSVersion );
\r
1783 Trace.TraceInformation( "ProcessorCount: " + Environment.ProcessorCount.ToString() );
\r
1784 Trace.TraceInformation( "CLR Version: " + Environment.Version.ToString() );
\r
1785 //---------------------
\r
1787 #region [ DTXVmodeクラス の初期化 ]
\r
1788 //---------------------
\r
1789 //Trace.TraceInformation( "DTXVモードの初期化を行います。" );
\r
1793 DTXVmode = new CDTXVmode();
\r
1794 DTXVmode.Enabled = false;
\r
1795 //Trace.TraceInformation( "DTXVモードの初期化を完了しました。" );
\r
1799 //Trace.Unindent();
\r
1801 //---------------------
\r
1803 #region [ コンパクトモードスイッチの有無、もしくは、DTXViewerとしての起動 ]
\r
1804 //---------------------
\r
1805 bコンパクトモード = false;
\r
1806 strコンパクトモードファイル = "";
\r
1807 string[] commandLineArgs = Environment.GetCommandLineArgs();
\r
1808 if( ( commandLineArgs != null ) && ( commandLineArgs.Length > 1 ) )
\r
1813 for ( int i = 1; i < commandLineArgs.Length; i++ )
\r
1817 arg += " " + "\"" + commandLineArgs[ i ] + "\"";
\r
1821 arg += commandLineArgs[ i ];
\r
1824 DTXVmode.ParseArguments( arg );
\r
1826 if ( DTXVmode.Enabled )
\r
1828 DTXVmode.Refreshed = false; // 初回起動時は再読み込みに走らせない
\r
1829 strコンパクトモードファイル = DTXVmode.filename;
\r
1830 switch ( DTXVmode.soundDeviceType ) // サウンド再生方式の設定
\r
1832 case ESoundDeviceType.DirectSound:
\r
1833 ConfigIni.nSoundDeviceType = 0;
\r
1835 case ESoundDeviceType.ExclusiveWASAPI:
\r
1836 ConfigIni.nSoundDeviceType = 2;
\r
1838 case ESoundDeviceType.ASIO:
\r
1839 ConfigIni.nSoundDeviceType = 1;
\r
1840 ConfigIni.nASIODevice = DTXVmode.nASIOdevice;
\r
1844 CDTXMania.ConfigIni.b垂直帰線待ちを行う = DTXVmode.VSyncWait;
\r
1845 CDTXMania.ConfigIni.bTimeStretch = DTXVmode.TimeStretch;
\r
1846 CDTXMania.ConfigIni.bDrums有効 = !DTXVmode.GRmode;
\r
1847 CDTXMania.ConfigIni.bGuitar有効 = true;
\r
1849 else // 通常のコンパクトモード
\r
1851 strコンパクトモードファイル = commandLineArgs[ 1 ];
\r
1854 if ( !File.Exists( strコンパクトモードファイル ) ) // #32985 2014.1.23 yyagi
\r
1856 Trace.TraceError( "コンパクトモードで指定されたファイルが見つかりません。DTXManiaを終了します。[{0}]", strコンパクトモードファイル );
\r
1858 Environment.Exit( -1 );
\r
1860 if ( strコンパクトモードファイル == "" ) // DTXMania未起動状態で、DTXCで再生停止ボタンを押した場合は、何もせず終了
\r
1862 Environment.Exit( -1 );
\r
1866 throw new FileNotFoundException( "コンパクトモードで指定されたファイルが見つかりません。DTXManiaを終了します。", strコンパクトモードファイル );
\r
1870 if ( DTXVmode.Enabled )
\r
1872 Trace.TraceInformation( "DTXVモードで起動します。[{0}]", strコンパクトモードファイル );
\r
1876 Trace.TraceInformation( "コンパクトモードで起動します。[{0}]", strコンパクトモードファイル );
\r
1879 //---------------------
\r
1882 #region [ ウィンドウ初期化 ]
\r
1883 //---------------------
\r
1884 base.Window.StartPosition = FormStartPosition.Manual; // #30675 2013.02.04 ikanick add
\r
1885 base.Window.Location = new Point( ConfigIni.n初期ウィンドウ開始位置X, ConfigIni.n初期ウィンドウ開始位置Y ); // #30675 2013.02.04 ikanick add
\r
1887 base.Window.Text = this.strWindowTitle; // 事前にDTXVmodeの実体を作っておくこと
\r
1889 base.Window.StartPosition = FormStartPosition.Manual; // #30675 2013.02.04 ikanick add
\r
1890 base.Window.Location = new Point(ConfigIni.n初期ウィンドウ開始位置X, ConfigIni.n初期ウィンドウ開始位置Y); // #30675 2013.02.04 ikanick add
\r
1892 base.Window.ClientSize = new Size(ConfigIni.nウインドウwidth, ConfigIni.nウインドウheight); // #34510 yyagi 2010.10.31 to change window size got from Config.ini
\r
1893 #if !WindowedFullscreen
\r
1894 if (!ConfigIni.bウィンドウモード) // #23510 2010.11.02 yyagi: add; to recover window size in case bootup with fullscreen mode
\r
1895 { // #30666 2013.02.02 yyagi: currentClientSize should be always made
\r
1897 currentClientSize = new Size( ConfigIni.nウインドウwidth, ConfigIni.nウインドウheight );
\r
1898 #if !WindowedFullscreen
\r
1901 base.Window.MaximizeBox = true; // #23510 2010.11.04 yyagi: to support maximizing window
\r
1902 base.Window.FormBorderStyle = FormBorderStyle.Sizable; // #23510 2010.10.27 yyagi: changed from FixedDialog to Sizable, to support window resize
\r
1903 // #30666 2013.02.02 yyagi: moved the code to t全画面・ウインドウモード切り替え()
\r
1904 base.Window.ShowIcon = true;
\r
1905 base.Window.Icon = Properties.Resources.dtx;
\r
1906 base.Window.KeyDown += new KeyEventHandler( this.Window_KeyDown );
\r
1907 base.Window.MouseUp +=new MouseEventHandler( this.Window_MouseUp);
\r
1908 base.Window.MouseDoubleClick += new MouseEventHandler(this.Window_MouseDoubleClick); // #23510 2010.11.13 yyagi: to go fullscreen mode
\r
1909 base.Window.ResizeEnd += new EventHandler(this.Window_ResizeEnd); // #23510 2010.11.20 yyagi: to set resized window size in Config.ini
\r
1910 base.Window.ApplicationActivated += new EventHandler(this.Window_ApplicationActivated);
\r
1911 base.Window.ApplicationDeactivated += new EventHandler( this.Window_ApplicationDeactivated );
\r
1912 //---------------------
\r
1914 #region [ Direct3D9Exを使うかどうか判定 ]
\r
1916 #region [ Direct3D9 デバイスの生成 ]
\r
1917 //---------------------
\r
1918 DeviceSettings settings = new DeviceSettings();
\r
1919 #if WindowedFullscreen
\r
1920 settings.Windowed = true; // #30666 2013.2.2 yyagi: Fullscreenmode is "Maximized window" mode
\r
1922 settings.Windowed = ConfigIni.bウィンドウモード;
\r
1924 settings.BackBufferWidth = SampleFramework.GameWindowSize.Width;
\r
1925 settings.BackBufferHeight = SampleFramework.GameWindowSize.Height;
\r
1926 // settings.BackBufferCount = 3;
\r
1927 settings.EnableVSync = ConfigIni.b垂直帰線待ちを行う;
\r
1928 // settings.BackBufferFormat = Format.A8R8G8B8;
\r
1929 // settings.MultisampleType = MultisampleType.FourSamples;
\r
1930 // settings.MultisampleQuality = 4;
\r
1931 // settings.MultisampleType = MultisampleType.None;
\r
1932 // settings.MultisampleQuality = 0;
\r
1936 base.GraphicsDeviceManager.ChangeDevice(settings);
\r
1938 catch (DeviceCreationException e)
\r
1940 Trace.TraceError(e.ToString());
\r
1941 MessageBox.Show(e.Message + e.ToString(), "DTXMania failed to boot: DirectX9 Initialize Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
\r
1942 Environment.Exit(-1);
\r
1945 base.IsFixedTimeStep = false;
\r
1946 // base.TargetElapsedTime = TimeSpan.FromTicks( 10000000 / 75 );
\r
1947 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
1948 base.InactiveSleepTime = TimeSpan.FromMilliseconds((float)(ConfigIni.n非フォーカス時スリープms)); // #23568 2010.11.3 yyagi: to support valiable sleep value when !IsActive
\r
1949 // #23568 2010.11.4 ikanick changed ( 1 -> ConfigIni )
\r
1950 #if WindowedFullscreen
\r
1951 this.t全画面・ウィンドウモード切り替え(); // #30666 2013.2.2 yyagi: finalize settings for "Maximized window mode"
\r
1953 actFlushGPU = new CActFlushGPU();
\r
1954 //---------------------
\r
1959 #region [ Skin の初期化 ]
\r
1960 //---------------------
\r
1961 Trace.TraceInformation( "スキンの初期化を行います。" );
\r
1965 Skin = new CSkin( CDTXMania.ConfigIni.strSystemSkinSubfolderFullName, CDTXMania.ConfigIni.bUseBoxDefSkin );
\r
1966 CDTXMania.ConfigIni.strSystemSkinSubfolderFullName = CDTXMania.Skin.GetCurrentSkinSubfolderFullName( true ); // 旧指定のSkinフォルダが消滅していた場合に備える
\r
1967 Trace.TraceInformation( "スキンの初期化を完了しました。" );
\r
1971 Trace.TraceInformation( "スキンの初期化に失敗しました。" );
\r
1978 //---------------------
\r
1981 #region [ Timer の初期化 ]
\r
1982 //---------------------
\r
1983 Trace.TraceInformation( "タイマの初期化を行います。" );
\r
1987 Timer = new CTimer( CTimer.E種別.MultiMedia );
\r
1988 Trace.TraceInformation( "タイマの初期化を完了しました。" );
\r
1994 //---------------------
\r
1998 #region [ FPS カウンタの初期化 ]
\r
1999 //---------------------
\r
2000 Trace.TraceInformation( "FPSカウンタの初期化を行います。" );
\r
2005 Trace.TraceInformation( "FPSカウンタを生成しました。" );
\r
2011 //---------------------
\r
2013 #region [ act文字コンソールの初期化 ]
\r
2014 //---------------------
\r
2015 Trace.TraceInformation( "文字コンソールの初期化を行います。" );
\r
2019 act文字コンソール = new C文字コンソール();
\r
2020 Trace.TraceInformation( "文字コンソールを生成しました。" );
\r
2021 act文字コンソール.On活性化();
\r
2022 Trace.TraceInformation( "文字コンソールを活性化しました。" );
\r
2023 Trace.TraceInformation( "文字コンソールの初期化を完了しました。" );
\r
2025 catch( Exception exception )
\r
2027 Trace.TraceError( exception.Message );
\r
2028 Trace.TraceError( "文字コンソールの初期化に失敗しました。" );
\r
2034 //---------------------
\r
2036 #region [ Input管理 の初期化 ]
\r
2037 //---------------------
\r
2038 Trace.TraceInformation( "DirectInput, MIDI入力の初期化を行います。" );
\r
2042 bool bUseMIDIIn = !DTXVmode.Enabled;
\r
2043 Input管理 = new CInput管理( base.Window.Handle, bUseMIDIIn );
\r
2044 foreach( IInputDevice device in Input管理.list入力デバイス )
\r
2046 if( ( device.e入力デバイス種別 == E入力デバイス種別.Joystick ) && !ConfigIni.dicJoystick.ContainsValue( device.GUID ) )
\r
2049 while( ConfigIni.dicJoystick.ContainsKey( key ) )
\r
2053 ConfigIni.dicJoystick.Add( key, device.GUID );
\r
2056 foreach( IInputDevice device2 in Input管理.list入力デバイス )
\r
2058 if( device2.e入力デバイス種別 == E入力デバイス種別.Joystick )
\r
2060 foreach( KeyValuePair<int, string> pair in ConfigIni.dicJoystick )
\r
2062 if( device2.GUID.Equals( pair.Value ) )
\r
2064 ( (CInputJoystick) device2 ).SetID( pair.Key );
\r
2071 Trace.TraceInformation( "DirectInput の初期化を完了しました。" );
\r
2073 catch( Exception exception2 )
\r
2075 Trace.TraceError( exception2.Message );
\r
2076 Trace.TraceError( "DirectInput, MIDI入力の初期化に失敗しました。" );
\r
2083 //---------------------
\r
2085 #region [ Pad の初期化 ]
\r
2086 //---------------------
\r
2087 Trace.TraceInformation( "パッドの初期化を行います。" );
\r
2091 Pad = new CPad( ConfigIni, Input管理 );
\r
2092 Trace.TraceInformation( "パッドの初期化を完了しました。" );
\r
2094 catch( Exception exception3 )
\r
2096 Trace.TraceError( exception3.Message );
\r
2097 Trace.TraceError( "パッドの初期化に失敗しました。" );
\r
2103 //---------------------
\r
2105 #region [ Sound管理 の初期化 ]
\r
2106 //---------------------
\r
2107 Trace.TraceInformation( "サウンドデバイスの初期化を行います。" );
\r
2111 ESoundDeviceType soundDeviceType;
\r
2112 switch ( CDTXMania.ConfigIni.nSoundDeviceType )
\r
2115 soundDeviceType = ESoundDeviceType.DirectSound;
\r
2118 soundDeviceType = ESoundDeviceType.ASIO;
\r
2121 soundDeviceType = ESoundDeviceType.ExclusiveWASAPI;
\r
2124 soundDeviceType = ESoundDeviceType.Unknown;
\r
2127 Sound管理 = new CSound管理( base.Window.Handle,
\r
2129 CDTXMania.ConfigIni.nWASAPIBufferSizeMs,
\r
2131 // CDTXMania.ConfigIni.nASIOBufferSizeMs,
\r
2133 CDTXMania.ConfigIni.nASIODevice,
\r
2134 CDTXMania.ConfigIni.bUseOSTimer
\r
2136 //Sound管理 = FDK.CSound管理.Instance;
\r
2137 //Sound管理.t初期化( soundDeviceType, 0, 0, CDTXMania.ConfigIni.nASIODevice, base.Window.Handle );
\r
2139 ShowWindowTitleWithSoundType();
\r
2140 FDK.CSound管理.bIsTimeStretch = CDTXMania.ConfigIni.bTimeStretch;
\r
2141 Sound管理.nMasterVolume = CDTXMania.ConfigIni.nMasterVolume;
\r
2142 //FDK.CSound管理.bIsMP3DecodeByWindowsCodec = CDTXMania.ConfigIni.bNoMP3Streaming;
\r
2143 Trace.TraceInformation( "サウンドデバイスの初期化を完了しました。" );
\r
2145 catch (Exception e)
\r
2147 Trace.TraceError( e.Message );
\r
2154 //---------------------
\r
2156 #region [ Songs管理 の初期化 ]
\r
2157 //---------------------
\r
2158 Trace.TraceInformation( "曲リストの初期化を行います。" );
\r
2162 Songs管理 = new CSongs管理();
\r
2163 // Songs管理_裏読 = new CSongs管理();
\r
2164 EnumSongs = new CEnumSongs();
\r
2165 actEnumSongs = new CActEnumSongs();
\r
2166 Trace.TraceInformation( "曲リストの初期化を完了しました。" );
\r
2168 catch( Exception e )
\r
2170 Trace.TraceError( e.Message );
\r
2171 Trace.TraceError( "曲リストの初期化に失敗しました。" );
\r
2177 //---------------------
\r
2179 #region [ CAvi の初期化 ]
\r
2180 //---------------------
\r
2182 //---------------------
\r
2184 #region [ Random の初期化 ]
\r
2185 //---------------------
\r
2186 Random = new Random( (int) Timer.nシステム時刻 );
\r
2187 //---------------------
\r
2189 #region [ ステージの初期化 ]
\r
2190 //---------------------
\r
2193 stage起動 = new CStage起動();
\r
2194 stageタイトル = new CStageタイトル();
\r
2195 // stageオプション = new CStageオプション();
\r
2196 stageコンフィグ = new CStageコンフィグ();
\r
2197 stage選曲 = new CStage選曲();
\r
2198 stage曲読み込み = new CStage曲読み込み();
\r
2199 stage演奏ドラム画面 = new CStage演奏ドラム画面();
\r
2200 stage演奏ギター画面 = new CStage演奏ギター画面();
\r
2201 stage結果 = new CStage結果();
\r
2202 stageChangeSkin = new CStageChangeSkin();
\r
2203 stage終了 = new CStage終了();
\r
2204 this.listトップレベルActivities = new List<CActivity>();
\r
2205 this.listトップレベルActivities.Add( actEnumSongs );
\r
2206 this.listトップレベルActivities.Add( act文字コンソール );
\r
2207 this.listトップレベルActivities.Add( stage起動 );
\r
2208 this.listトップレベルActivities.Add( stageタイトル );
\r
2209 // this.listトップレベルActivities.Add( stageオプション );
\r
2210 this.listトップレベルActivities.Add( stageコンフィグ );
\r
2211 this.listトップレベルActivities.Add( stage選曲 );
\r
2212 this.listトップレベルActivities.Add( stage曲読み込み );
\r
2213 this.listトップレベルActivities.Add( stage演奏ドラム画面 );
\r
2214 this.listトップレベルActivities.Add( stage演奏ギター画面 );
\r
2215 this.listトップレベルActivities.Add( stage結果 );
\r
2216 this.listトップレベルActivities.Add( stageChangeSkin );
\r
2217 this.listトップレベルActivities.Add( stage終了 );
\r
2218 this.listトップレベルActivities.Add( actFlushGPU );
\r
2219 //---------------------
\r
2221 #region [ プラグインの検索と生成 ]
\r
2222 //---------------------
\r
2223 PluginHost = new CPluginHost();
\r
2225 Trace.TraceInformation( "プラグインの検索と生成を行います。" );
\r
2229 this.tプラグイン検索と生成();
\r
2230 Trace.TraceInformation( "プラグインの検索と生成を完了しました。" );
\r
2236 //---------------------
\r
2238 #region [ プラグインの初期化 ]
\r
2239 //---------------------
\r
2240 if( this.listプラグイン != null && this.listプラグイン.Count > 0 )
\r
2242 Trace.TraceInformation( "プラグインの初期化を行います。" );
\r
2246 foreach( STPlugin st in this.listプラグイン )
\r
2248 Directory.SetCurrentDirectory( st.strプラグインフォルダ );
\r
2249 st.plugin.On初期化( this.PluginHost );
\r
2250 st.plugin.OnManagedリソースの作成();
\r
2251 st.plugin.OnUnmanagedリソースの作成();
\r
2252 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
2254 Trace.TraceInformation( "すべてのプラグインの初期化を完了しました。" );
\r
2258 Trace.TraceError( "プラグインのどれかの初期化に失敗しました。" );
\r
2267 //---------------------
\r
2270 Trace.TraceInformation( "アプリケーションの初期化を完了しました。" );
\r
2272 #region [ 最初のステージの起動 ]
\r
2273 //---------------------
\r
2274 Trace.TraceInformation( "----------------------" );
\r
2275 Trace.TraceInformation( "■ 起動" );
\r
2277 if ( CDTXMania.bコンパクトモード )
\r
2279 r現在のステージ = stage曲読み込み;
\r
2283 r現在のステージ = stage起動;
\r
2286 //---------------------
\r
2290 public void ShowWindowTitleWithSoundType()
\r
2292 string delay = "";
\r
2293 if ( Sound管理.GetCurrentSoundDeviceType() != "DirectSound" )
\r
2295 delay = "(" + Sound管理.GetSoundDelay() + "ms)";
\r
2297 base.Window.Text = strWindowTitle + " (" + Sound管理.GetCurrentSoundDeviceType() + delay + ")";
\r
2300 private void t終了処理()
\r
2302 if( !this.b終了処理完了済み )
\r
2304 Trace.TraceInformation( "----------------------" );
\r
2305 Trace.TraceInformation( "■ アプリケーションの終了" );
\r
2306 #region [ 曲検索の終了処理 ]
\r
2307 //---------------------
\r
2308 if ( actEnumSongs != null )
\r
2310 Trace.TraceInformation( "曲検索actの終了処理を行います。" );
\r
2314 actEnumSongs.On非活性化();
\r
2315 actEnumSongs= null;
\r
2316 Trace.TraceInformation( "曲検索actの終了処理を完了しました。" );
\r
2318 catch ( Exception e )
\r
2320 Trace.TraceError( e.Message );
\r
2321 Trace.TraceError( "曲検索actの終了処理に失敗しました。" );
\r
2328 //---------------------
\r
2330 #region [ 現在のステージの終了処理 ]
\r
2331 //---------------------
\r
2332 if( CDTXMania.r現在のステージ != null && CDTXMania.r現在のステージ.b活性化してる ) // #25398 2011.06.07 MODIFY FROM
\r
2334 Trace.TraceInformation( "現在のステージを終了します。" );
\r
2338 r現在のステージ.On非活性化();
\r
2339 Trace.TraceInformation( "現在のステージの終了処理を完了しました。" );
\r
2346 //---------------------
\r
2348 #region [ プラグインの終了処理 ]
\r
2349 //---------------------
\r
2350 if (this.listプラグイン != null && this.listプラグイン.Count > 0)
\r
2352 Trace.TraceInformation( "すべてのプラグインを終了します。" );
\r
2356 foreach( STPlugin st in this.listプラグイン )
\r
2358 Directory.SetCurrentDirectory( st.strプラグインフォルダ );
\r
2359 st.plugin.OnUnmanagedリソースの解放();
\r
2360 st.plugin.OnManagedリソースの解放();
\r
2362 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
2364 PluginHost = null;
\r
2365 Trace.TraceInformation( "すべてのプラグインの終了処理を完了しました。" );
\r
2372 //---------------------
\r
2374 #region [ 曲リストの終了処理 ]
\r
2375 //---------------------
\r
2376 if (Songs管理 != null)
\r
2378 Trace.TraceInformation( "曲リストの終了処理を行います。" );
\r
2383 Trace.TraceInformation( "曲リストの終了処理を完了しました。" );
\r
2385 catch( Exception exception )
\r
2387 Trace.TraceError( exception.Message );
\r
2388 Trace.TraceError( "曲リストの終了処理に失敗しました。" );
\r
2396 //---------------------
\r
2398 #region [ スキンの終了処理 ]
\r
2399 //---------------------
\r
2402 Trace.TraceInformation( "スキンの終了処理を行います。" );
\r
2408 Trace.TraceInformation( "スキンの終了処理を完了しました。" );
\r
2410 catch( Exception exception2 )
\r
2412 Trace.TraceError( exception2.Message );
\r
2413 Trace.TraceError( "スキンの終了処理に失敗しました。" );
\r
2420 //---------------------
\r
2422 #region [ DirectSoundの終了処理 ]
\r
2423 //---------------------
\r
2424 if (Sound管理 != null)
\r
2426 Trace.TraceInformation( "DirectSound の終了処理を行います。" );
\r
2430 Sound管理.Dispose();
\r
2432 Trace.TraceInformation( "DirectSound の終了処理を完了しました。" );
\r
2434 catch( Exception exception3 )
\r
2436 Trace.TraceError( exception3.Message );
\r
2437 Trace.TraceError( "DirectSound の終了処理に失敗しました。" );
\r
2444 //---------------------
\r
2446 #region [ パッドの終了処理 ]
\r
2447 //---------------------
\r
2450 Trace.TraceInformation( "パッドの終了処理を行います。" );
\r
2455 Trace.TraceInformation( "パッドの終了処理を完了しました。" );
\r
2457 catch( Exception exception4 )
\r
2459 Trace.TraceError( exception4.Message );
\r
2460 Trace.TraceError( "パッドの終了処理に失敗しました。" );
\r
2467 //---------------------
\r
2469 #region [ DirectInput, MIDI入力の終了処理 ]
\r
2470 //---------------------
\r
2471 if (Input管理 != null)
\r
2473 Trace.TraceInformation( "DirectInput, MIDI入力の終了処理を行います。" );
\r
2477 Input管理.Dispose();
\r
2479 Trace.TraceInformation( "DirectInput, MIDI入力の終了処理を完了しました。" );
\r
2481 catch( Exception exception5 )
\r
2483 Trace.TraceError( exception5.Message );
\r
2484 Trace.TraceError( "DirectInput, MIDI入力の終了処理に失敗しました。" );
\r
2491 //---------------------
\r
2493 #region [ 文字コンソールの終了処理 ]
\r
2494 //---------------------
\r
2495 if (act文字コンソール != null)
\r
2497 Trace.TraceInformation( "文字コンソールの終了処理を行います。" );
\r
2501 act文字コンソール.On非活性化();
\r
2502 act文字コンソール = null;
\r
2503 Trace.TraceInformation( "文字コンソールの終了処理を完了しました。" );
\r
2505 catch( Exception exception6 )
\r
2507 Trace.TraceError( exception6.Message );
\r
2508 Trace.TraceError( "文字コンソールの終了処理に失敗しました。" );
\r
2515 //---------------------
\r
2517 #region [ FPSカウンタの終了処理 ]
\r
2518 //---------------------
\r
2519 Trace.TraceInformation("FPSカウンタの終了処理を行います。");
\r
2527 Trace.TraceInformation( "FPSカウンタの終了処理を完了しました。" );
\r
2533 //---------------------
\r
2535 #region [ タイマの終了処理 ]
\r
2536 //---------------------
\r
2537 Trace.TraceInformation("タイマの終了処理を行います。");
\r
2541 if( Timer != null )
\r
2545 Trace.TraceInformation( "タイマの終了処理を完了しました。" );
\r
2549 Trace.TraceInformation( "タイマは使用されていません。" );
\r
2556 //---------------------
\r
2558 #region [ Config.iniの出力 ]
\r
2559 //---------------------
\r
2560 Trace.TraceInformation("Config.ini を出力します。");
\r
2561 // if ( ConfigIni.bIsSwappedGuitarBass ) // #24063 2011.1.16 yyagi ギターベースがスワップしているときは元に戻す
\r
2562 if ( ConfigIni.bIsSwappedGuitarBass_AutoFlagsAreSwapped ) // #24415 2011.2.21 yyagi FLIP中かつ演奏中にalt-f4で終了したときは、AUTOのフラグをswapして戻す
\r
2564 ConfigIni.SwapGuitarBassInfos_AutoFlags();
\r
2566 string str = strEXEのあるフォルダ + "Config.ini";
\r
2570 if ( DTXVmode.Enabled )
\r
2572 DTXVmode.tUpdateConfigIni();
\r
2573 Trace.TraceInformation( "DTXVモードの設定情報を、Config.iniに保存しました。" );
\r
2577 ConfigIni.t書き出し( str );
\r
2578 Trace.TraceInformation( "保存しました。({0})", str );
\r
2581 catch( Exception e )
\r
2583 Trace.TraceError( e.Message );
\r
2584 Trace.TraceError( "Config.ini の出力に失敗しました。({0})", str );
\r
2590 //---------------------
\r
2592 #region [ DTXVmodeの終了処理 ]
\r
2593 //---------------------
\r
2594 //Trace.TraceInformation( "DTXVモードの終了処理を行います。" );
\r
2598 if ( DTXVmode != null )
\r
2601 //Trace.TraceInformation( "DTXVモードの終了処理を完了しました。" );
\r
2605 //Trace.TraceInformation( "DTXVモードは使用されていません。" );
\r
2610 //Trace.Unindent();
\r
2612 //---------------------
\r
2614 Trace.TraceInformation( "アプリケーションの終了処理を完了しました。" );
\r
2617 this.b終了処理完了済み = true;
\r
2620 private CScoreIni tScoreIniへBGMAdjustとHistoryとPlayCountを更新(string str新ヒストリ行)
\r
2622 bool bIsUpdatedDrums, bIsUpdatedGuitar, bIsUpdatedBass;
\r
2623 string strFilename = DTX.strファイル名の絶対パス + ".score.ini";
\r
2624 CScoreIni ini = new CScoreIni( strFilename );
\r
2625 if( !File.Exists( strFilename ) )
\r
2627 ini.stファイル.Title = DTX.TITLE;
\r
2628 ini.stファイル.Name = DTX.strファイル名;
\r
2629 ini.stファイル.Hash = CScoreIni.tファイルのMD5を求めて返す( DTX.strファイル名の絶対パス );
\r
2630 for( int i = 0; i < 6; i++ )
\r
2632 ini.stセクション[ i ].nPerfectになる範囲ms = nPerfect範囲ms;
\r
2633 ini.stセクション[ i ].nGreatになる範囲ms = nGreat範囲ms;
\r
2634 ini.stセクション[ i ].nGoodになる範囲ms = nGood範囲ms;
\r
2635 ini.stセクション[ i ].nPoorになる範囲ms = nPoor範囲ms;
\r
2638 ini.stファイル.BGMAdjust = DTX.nBGMAdjust;
\r
2639 CScoreIni.t更新条件を取得する( out bIsUpdatedDrums, out bIsUpdatedGuitar, out bIsUpdatedBass );
\r
2640 if( bIsUpdatedDrums || bIsUpdatedGuitar || bIsUpdatedBass )
\r
2642 if( bIsUpdatedDrums )
\r
2644 ini.stファイル.PlayCountDrums++;
\r
2646 if( bIsUpdatedGuitar )
\r
2648 ini.stファイル.PlayCountGuitar++;
\r
2650 if( bIsUpdatedBass )
\r
2652 ini.stファイル.PlayCountBass++;
\r
2654 ini.tヒストリを追加する( str新ヒストリ行 );
\r
2657 stage選曲.r現在選択中のスコア.譜面情報.演奏回数.Drums = ini.stファイル.PlayCountDrums;
\r
2658 stage選曲.r現在選択中のスコア.譜面情報.演奏回数.Guitar = ini.stファイル.PlayCountGuitar;
\r
2659 stage選曲.r現在選択中のスコア.譜面情報.演奏回数.Bass = ini.stファイル.PlayCountBass;
\r
2660 for( int j = 0; j < ini.stファイル.History.Length; j++ )
\r
2662 stage選曲.r現在選択中のスコア.譜面情報.演奏履歴[ j ] = ini.stファイル.History[ j ];
\r
2666 if( ConfigIni.bScoreIniを出力する )
\r
2668 ini.t書き出し( strFilename );
\r
2673 private void tガベージコレクションを実行する()
\r
2676 GC.WaitForPendingFinalizers();
\r
2678 GC.WaitForPendingFinalizers();
\r
2680 private void tプラグイン検索と生成()
\r
2682 this.listプラグイン = new List<STPlugin>();
\r
2684 string strIPluginActivityの名前 = typeof( IPluginActivity ).FullName;
\r
2685 string strプラグインフォルダパス = strEXEのあるフォルダ + "Plugins\\";
\r
2687 this.t指定フォルダ内でのプラグイン検索と生成( strプラグインフォルダパス, strIPluginActivityの名前 );
\r
2689 if( this.listプラグイン.Count > 0 )
\r
2690 Trace.TraceInformation( this.listプラグイン.Count + " 個のプラグインを読み込みました。" );
\r
2692 #region [ Windowイベント処理 ]
\r
2693 private void t指定フォルダ内でのプラグイン検索と生成( string strプラグインフォルダパス, string strプラグイン型名 )
\r
2695 // 指定されたパスが存在しないとエラー
\r
2696 if( !Directory.Exists( strプラグインフォルダパス ) )
\r
2698 Trace.TraceWarning( "プラグインフォルダが存在しません。(" + strプラグインフォルダパス + ")" );
\r
2702 // (1) すべての *.dll について…
\r
2703 string[] strDLLs = System.IO.Directory.GetFiles( strプラグインフォルダパス, "*.dll" );
\r
2704 foreach( string dllName in strDLLs )
\r
2706 if (Path.GetExtension(dllName).ToLower() != ".dll")
\r
2712 // (1-1) dll をアセンブリとして読み込む。
\r
2713 System.Reflection.Assembly asm = System.Reflection.Assembly.LoadFrom( dllName );
\r
2715 // (1-2) アセンブリ内のすべての型について、プラグインとして有効か調べる
\r
2716 foreach( Type t in asm.GetTypes() )
\r
2718 // (1-3) ↓クラスであり↓Publicであり↓抽象クラスでなく↓IPlugin型のインスタンスが作れる 型を持っていれば有効
\r
2719 if( t.IsClass && t.IsPublic && !t.IsAbstract && t.GetInterface( strプラグイン型名 ) != null )
\r
2721 // (1-4) クラス名からインスタンスを作成する
\r
2722 var st = new STPlugin() {
\r
2723 plugin = (IPluginActivity) asm.CreateInstance( t.FullName ),
\r
2724 strプラグインフォルダ = Path.GetDirectoryName( dllName ),
\r
2725 strアセンブリ簡易名 = asm.GetName().Name,
\r
2726 Version = asm.GetName().Version,
\r
2729 // (1-5) プラグインリストへ登録
\r
2730 this.listプラグイン.Add( st );
\r
2731 Trace.TraceInformation( "プラグイン {0} ({1}, {2}, {3}) を読み込みました。", t.FullName, Path.GetFileName( dllName ), st.strアセンブリ簡易名, st.Version.ToString() );
\r
2737 Trace.TraceInformation( dllName + " からプラグインを生成することに失敗しました。スキップします。" );
\r
2741 // (2) サブフォルダがあれば再帰する
\r
2742 string[] strDirs = Directory.GetDirectories( strプラグインフォルダパス, "*" );
\r
2743 foreach( string dir in strDirs )
\r
2744 this.t指定フォルダ内でのプラグイン検索と生成( dir + "\\", strプラグイン型名 );
\r
2746 //-----------------
\r
2747 private void Window_ApplicationActivated( object sender, EventArgs e )
\r
2749 this.bApplicationActive = true;
\r
2751 private void Window_ApplicationDeactivated( object sender, EventArgs e )
\r
2753 this.bApplicationActive = false;
\r
2755 private void Window_KeyDown( object sender, KeyEventArgs e )
\r
2757 if ( e.KeyCode == Keys.Menu )
\r
2760 e.SuppressKeyPress = true;
\r
2762 else if ( ( e.KeyCode == Keys.Return ) && e.Alt )
\r
2764 if ( ConfigIni != null )
\r
2766 ConfigIni.bウィンドウモード = !ConfigIni.bウィンドウモード;
\r
2767 this.t全画面・ウィンドウモード切り替え();
\r
2770 e.SuppressKeyPress = true;
\r
2774 for ( int i = 0; i < 0x10; i++ )
\r
2776 if ( ConfigIni.KeyAssign.System.Capture[ i ].コード > 0 &&
\r
2777 e.KeyCode == DeviceConstantConverter.KeyToKeyCode( (SlimDX.DirectInput.Key) ConfigIni.KeyAssign.System.Capture[ i ].コード ) )
\r
2779 // Debug.WriteLine( "capture: " + string.Format( "{0:2x}", (int) e.KeyCode ) + " " + (int) e.KeyCode );
\r
2780 string strFullPath =
\r
2781 Path.Combine( CDTXMania.strEXEのあるフォルダ, "Capture_img" );
\r
2782 strFullPath = Path.Combine( strFullPath, DateTime.Now.ToString( "yyyyMMddHHmmss" ) + ".png" );
\r
2783 SaveResultScreen( strFullPath );
\r
2788 private void Window_MouseUp( object sender, MouseEventArgs e )
\r
2793 private void Window_MouseDoubleClick( object sender, MouseEventArgs e) // #23510 2010.11.13 yyagi: to go full screen mode
\r
2795 if ( mb.Equals(MouseButtons.Left) && ConfigIni.bIsAllowedDoubleClickFullscreen ) // #26752 2011.11.27 yyagi
\r
2797 ConfigIni.bウィンドウモード = false;
\r
2798 this.t全画面・ウィンドウモード切り替え();
\r
2801 private void Window_ResizeEnd(object sender, EventArgs e) // #23510 2010.11.20 yyagi: to get resized window size
\r
2803 if ( ConfigIni.bウィンドウモード )
\r
2805 ConfigIni.n初期ウィンドウ開始位置X = base.Window.Location.X; // #30675 2013.02.04 ikanick add
\r
2806 ConfigIni.n初期ウィンドウ開始位置Y = base.Window.Location.Y; //
\r
2809 ConfigIni.nウインドウwidth = (ConfigIni.bウィンドウモード) ? base.Window.ClientSize.Width : currentClientSize.Width; // #23510 2010.10.31 yyagi add
\r
2810 ConfigIni.nウインドウheight = (ConfigIni.bウィンドウモード) ? base.Window.ClientSize.Height : currentClientSize.Height;
\r
2814 //internal sealed class GCBeep // GC発生の度にbeep
\r
2818 // Console.Beep();
\r
2819 // if ( !AppDomain.CurrentDomain.IsFinalizingForUnload()
\r
2820 // && !Environment.HasShutdownStarted )
\r
2827 //-----------------
\r
2829 //Stopwatch sw = new Stopwatch();
\r
2830 //List<int> swlist1, swlist2, swlist3, swlist4, swlist5;
\r