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 = "099f(160401)";
\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 Sound管理.t再生中の処理をする();
\r
515 if( Timer != null )
\r
517 if (CSound管理.rc演奏用タイマ != null)
\r
518 CSound管理.rc演奏用タイマ.t更新();
\r
520 if( Input管理 != null )
\r
521 Input管理.tポーリング( this.bApplicationActive, CDTXMania.ConfigIni.bバッファ入力を行う );
\r
526 //if( Pad != null ) ポーリング時にクリアしたらダメ!曲の開始時に1回だけクリアする。(2010.9.11)
\r
527 // Pad.st検知したデバイス.Clear();
\r
529 if( this.Device == null )
\r
532 if ( this.bApplicationActive ) // DTXMania本体起動中の本体/モニタの省電力モード移行を抑止
\r
533 CPowerManagement.tDisableMonitorSuspend();
\r
535 // #xxxxx 2013.4.8 yyagi; sleepの挿入位置を、EndScnene~Present間から、BeginScene前に移動。描画遅延を小さくするため。
\r
537 if ( ConfigIni.nフレーム毎スリープms >= 0 ) // #xxxxx 2011.11.27 yyagi
\r
539 Thread.Sleep( ConfigIni.nフレーム毎スリープms );
\r
543 #region [ DTXCreatorからの指示 ]
\r
544 if ( this.Window.IsReceivedMessage ) // ウインドウメッセージで、
\r
546 string strMes = this.Window.strMessage;
\r
547 this.Window.IsReceivedMessage = false;
\r
549 if ( strMes != null )
\r
551 DTXVmode.ParseArguments( strMes );
\r
553 if ( DTXVmode.Enabled )
\r
556 strコンパクトモードファイル = DTXVmode.filename;
\r
557 if ( DTXVmode.Command == CDTXVmode.ECommand.Preview )
\r
559 // preview soundの再生
\r
560 string strPreviewFilename = DTXVmode.previewFilename;
\r
561 //Trace.TraceInformation( "Preview Filename=" + DTXVmode.previewFilename );
\r
564 if ( this.previewSound != null )
\r
566 this.previewSound.tサウンドを停止する();
\r
567 this.previewSound.Dispose();
\r
568 this.previewSound = null;
\r
570 this.previewSound = CDTXMania.Sound管理.tサウンドを生成する( strPreviewFilename );
\r
571 this.previewSound.n音量 = DTXVmode.previewVolume;
\r
572 this.previewSound.n位置 = DTXVmode.previewPan;
\r
573 this.previewSound.t再生を開始する();
\r
574 Trace.TraceInformation( "DTXCからの指示で、サウンドを生成しました。({0})", strPreviewFilename );
\r
578 Trace.TraceError( "DTXCからの指示での、サウンドの生成に失敗しました。({0})", strPreviewFilename );
\r
579 if ( this.previewSound != null )
\r
581 this.previewSound.Dispose();
\r
583 this.previewSound = null;
\r
591 this.Device.BeginScene();
\r
592 this.Device.Clear( ClearFlags.ZBuffer | ClearFlags.Target, Color.Black, 1f, 0 );
\r
594 if( r現在のステージ != null )
\r
596 this.n進行描画の戻り値 = ( r現在のステージ != null ) ? r現在のステージ.On進行描画() : 0;
\r
598 #region [ プラグインの進行描画 ]
\r
599 //---------------------
\r
600 foreach( STPlugin sp in this.listプラグイン )
\r
602 Directory.SetCurrentDirectory( sp.strプラグインフォルダ );
\r
604 if( CDTXMania.act現在入力を占有中のプラグイン == null || CDTXMania.act現在入力を占有中のプラグイン == sp.plugin )
\r
605 sp.plugin.On進行描画( CDTXMania.Pad, CDTXMania.Input管理.Keyboard );
\r
607 sp.plugin.On進行描画( null, null );
\r
609 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
611 //---------------------
\r
615 CScoreIni scoreIni = null;
\r
617 if ( Control.IsKeyLocked( Keys.CapsLock ) ) // #30925 2013.3.11 yyagi; capslock=ON時は、EnumSongsしないようにして、起動負荷とASIOの音切れの関係を確認する
\r
618 { // → songs.db等の書き込み時だと音切れするっぽい
\r
619 actEnumSongs.On非活性化();
\r
620 EnumSongs.SongListEnumCompletelyDone();
\r
621 CDTXMania.stage選曲.bIsEnumeratingSongs = false;
\r
623 #region [ 曲検索スレッドの起動/終了 ] // ここに"Enumerating Songs..."表示を集約
\r
624 if ( !CDTXMania.bコンパクトモード )
\r
626 actEnumSongs.On進行描画(); // "Enumerating Songs..."アイコンの描画
\r
628 switch ( r現在のステージ.eステージID )
\r
630 case CStage.Eステージ.タイトル:
\r
631 case CStage.Eステージ.コンフィグ:
\r
632 case CStage.Eステージ.選曲:
\r
633 case CStage.Eステージ.曲読み込み:
\r
634 if ( EnumSongs != null )
\r
636 #region [ (特定条件時) 曲検索スレッドの起動・開始 ]
\r
637 if ( r現在のステージ.eステージID == CStage.Eステージ.タイトル &&
\r
638 r直前のステージ.eステージID == CStage.Eステージ.起動 &&
\r
639 this.n進行描画の戻り値 == (int) CStageタイトル.E戻り値.継続 &&
\r
640 !EnumSongs.IsSongListEnumStarted )
\r
642 actEnumSongs.On活性化();
\r
643 CDTXMania.stage選曲.bIsEnumeratingSongs = true;
\r
644 EnumSongs.Init( CDTXMania.Songs管理.listSongsDB, CDTXMania.Songs管理.nSongsDBから取得できたスコア数 ); // songs.db情報と、取得した曲数を、新インスタンスにも与える
\r
645 EnumSongs.StartEnumFromDisk(); // 曲検索スレッドの起動・開始
\r
646 if ( CDTXMania.Songs管理.nSongsDBから取得できたスコア数 == 0 ) // もし初回起動なら、検索スレッドのプライオリティをLowestでなくNormalにする
\r
648 EnumSongs.ChangeEnumeratePriority( ThreadPriority.Normal );
\r
653 #region [ 曲検索の中断と再開 ]
\r
654 if ( r現在のステージ.eステージID == CStage.Eステージ.選曲 && !EnumSongs.IsSongListEnumCompletelyDone )
\r
656 switch ( this.n進行描画の戻り値 )
\r
659 //if ( CDTXMania.stage選曲.bIsEnumeratingSongs )
\r
660 if ( !CDTXMania.stage選曲.bIsPlayingPremovie )
\r
662 EnumSongs.Resume(); // #27060 2012.2.6 yyagi 中止していたバックグランド曲検索を再開
\r
663 EnumSongs.IsSlowdown = false;
\r
667 // EnumSongs.Suspend(); // #27060 2012.3.2 yyagi #PREMOVIE再生中は曲検索を低速化
\r
668 EnumSongs.IsSlowdown = true;
\r
670 actEnumSongs.On活性化();
\r
674 EnumSongs.Suspend(); // #27060 バックグラウンドの曲検索を一時停止
\r
675 actEnumSongs.On非活性化();
\r
681 #region [ 曲探索中断待ち待機 ]
\r
682 if ( r現在のステージ.eステージID == CStage.Eステージ.曲読み込み && !EnumSongs.IsSongListEnumCompletelyDone &&
\r
683 EnumSongs.thDTXFileEnumerate != null ) // #28700 2012.6.12 yyagi; at Compact mode, enumerating thread does not exist.
\r
685 EnumSongs.WaitUntilSuspended(); // 念のため、曲検索が一時中断されるまで待機
\r
689 #region [ 曲検索が完了したら、実際の曲リストに反映する ]
\r
690 // CStage選曲.On活性化() に回した方がいいかな?
\r
691 if ( EnumSongs.IsSongListEnumerated )
\r
693 actEnumSongs.On非活性化();
\r
694 CDTXMania.stage選曲.bIsEnumeratingSongs = false;
\r
696 bool bRemakeSongTitleBar = ( r現在のステージ.eステージID == CStage.Eステージ.選曲 ) ? true : false;
\r
697 CDTXMania.stage選曲.Refresh( EnumSongs.Songs管理, bRemakeSongTitleBar );
\r
698 EnumSongs.SongListEnumCompletelyDone();
\r
706 switch ( r現在のステージ.eステージID )
\r
708 case CStage.Eステージ.何もしない:
\r
711 case CStage.Eステージ.起動:
\r
713 //-----------------------------
\r
714 if( this.n進行描画の戻り値 != 0 )
\r
719 Trace.TraceInformation( "----------------------" );
\r
720 Trace.TraceInformation( "■ タイトル" );
\r
722 r直前のステージ = r現在のステージ;
\r
723 r現在のステージ = stageタイトル;
\r
728 Trace.TraceInformation( "----------------------" );
\r
729 Trace.TraceInformation( "■ 曲読み込み" );
\r
730 stage曲読み込み.On活性化();
\r
731 r直前のステージ = r現在のステージ;
\r
732 r現在のステージ = stage曲読み込み;
\r
735 foreach( STPlugin pg in this.listプラグイン )
\r
737 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
738 pg.plugin.Onステージ変更();
\r
739 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
742 this.tガベージコレクションを実行する();
\r
744 //-----------------------------
\r
748 case CStage.Eステージ.タイトル:
\r
750 //-----------------------------
\r
751 switch( this.n進行描画の戻り値 )
\r
753 case (int)CStageタイトル.E戻り値.GAMESTART:
\r
755 //-----------------------------
\r
757 Trace.TraceInformation( "----------------------" );
\r
758 Trace.TraceInformation( "■ 選曲" );
\r
760 r直前のステージ = r現在のステージ;
\r
761 r現在のステージ = stage選曲;
\r
762 //-----------------------------
\r
766 #region [ OPTION: 廃止済 ]
\r
767 // case 2: // #24525 OPTIONとCONFIGの統合に伴い、OPTIONは廃止
\r
769 // //-----------------------------
\r
770 // r現在のステージ.On非活性化();
\r
771 // Trace.TraceInformation( "----------------------" );
\r
772 // Trace.TraceInformation( "■ オプション" );
\r
773 // stageオプション.On活性化();
\r
774 // r直前のステージ = r現在のステージ;
\r
775 // r現在のステージ = stageオプション;
\r
776 // //-----------------------------
\r
781 case (int)CStageタイトル.E戻り値.CONFIG:
\r
783 //-----------------------------
\r
785 Trace.TraceInformation( "----------------------" );
\r
786 Trace.TraceInformation( "■ コンフィグ" );
\r
787 stageコンフィグ.On活性化();
\r
788 r直前のステージ = r現在のステージ;
\r
789 r現在のステージ = stageコンフィグ;
\r
790 //-----------------------------
\r
794 case (int)CStageタイトル.E戻り値.EXIT:
\r
796 //-----------------------------
\r
798 Trace.TraceInformation( "----------------------" );
\r
799 Trace.TraceInformation( "■ 終了" );
\r
801 r直前のステージ = r現在のステージ;
\r
802 r現在のステージ = stage終了;
\r
803 //-----------------------------
\r
808 foreach( STPlugin pg in this.listプラグイン )
\r
810 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
811 pg.plugin.Onステージ変更();
\r
812 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
815 //this.tガベージコレクションを実行する(); // #31980 2013.9.3 yyagi タイトル画面でだけ、毎フレームGCを実行して重くなっていた問題の修正
\r
816 //-----------------------------
\r
820 // case CStage.Eステージ.オプション:
\r
822 // //-----------------------------
\r
823 // if( this.n進行描画の戻り値 != 0 )
\r
825 // switch( r直前のステージ.eステージID )
\r
827 // case CStage.Eステージ.タイトル:
\r
829 // //-----------------------------
\r
830 // r現在のステージ.On非活性化();
\r
831 // Trace.TraceInformation( "----------------------" );
\r
832 // Trace.TraceInformation( "■ タイトル" );
\r
833 // stageタイトル.On活性化();
\r
834 // r直前のステージ = r現在のステージ;
\r
835 // r現在のステージ = stageタイトル;
\r
837 // foreach( STPlugin pg in this.listプラグイン )
\r
839 // Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
840 // pg.plugin.Onステージ変更();
\r
841 // Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
844 // this.tガベージコレクションを実行する();
\r
846 // //-----------------------------
\r
849 // case CStage.Eステージ.選曲:
\r
851 // //-----------------------------
\r
852 // r現在のステージ.On非活性化();
\r
853 // Trace.TraceInformation( "----------------------" );
\r
854 // Trace.TraceInformation( "■ 選曲" );
\r
855 // stage選曲.On活性化();
\r
856 // r直前のステージ = r現在のステージ;
\r
857 // r現在のステージ = stage選曲;
\r
859 // foreach( STPlugin pg in this.listプラグイン )
\r
861 // Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
862 // pg.plugin.Onステージ変更();
\r
863 // Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
866 // this.tガベージコレクションを実行する();
\r
868 // //-----------------------------
\r
872 // //-----------------------------
\r
876 case CStage.Eステージ.コンフィグ:
\r
878 //-----------------------------
\r
879 if( this.n進行描画の戻り値 != 0 )
\r
881 switch( r直前のステージ.eステージID )
\r
883 case CStage.Eステージ.タイトル:
\r
885 //-----------------------------
\r
887 Trace.TraceInformation( "----------------------" );
\r
888 Trace.TraceInformation( "■ タイトル" );
\r
890 r直前のステージ = r現在のステージ;
\r
891 r現在のステージ = stageタイトル;
\r
893 foreach( STPlugin pg in this.listプラグイン )
\r
895 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
896 pg.plugin.Onステージ変更();
\r
897 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
900 this.tガベージコレクションを実行する();
\r
902 //-----------------------------
\r
905 case CStage.Eステージ.選曲:
\r
907 //-----------------------------
\r
909 Trace.TraceInformation( "----------------------" );
\r
910 Trace.TraceInformation( "■ 選曲" );
\r
912 r直前のステージ = r現在のステージ;
\r
913 r現在のステージ = stage選曲;
\r
915 foreach( STPlugin pg in this.listプラグイン )
\r
917 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
918 pg.plugin.Onステージ変更();
\r
919 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
922 this.tガベージコレクションを実行する();
\r
924 //-----------------------------
\r
928 //-----------------------------
\r
932 case CStage.Eステージ.選曲:
\r
934 //-----------------------------
\r
935 switch( this.n進行描画の戻り値 )
\r
937 case (int) CStage選曲.E戻り値.タイトルに戻る:
\r
939 //-----------------------------
\r
941 Trace.TraceInformation( "----------------------" );
\r
942 Trace.TraceInformation( "■ タイトル" );
\r
944 r直前のステージ = r現在のステージ;
\r
945 r現在のステージ = stageタイトル;
\r
947 foreach( STPlugin pg in this.listプラグイン )
\r
949 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
950 pg.plugin.Onステージ変更();
\r
951 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
954 this.tガベージコレクションを実行する();
\r
956 //-----------------------------
\r
959 case (int) CStage選曲.E戻り値.選曲した:
\r
961 //-----------------------------
\r
963 Trace.TraceInformation( "----------------------" );
\r
964 Trace.TraceInformation( "■ 曲読み込み" );
\r
965 stage曲読み込み.On活性化();
\r
966 r直前のステージ = r現在のステージ;
\r
967 r現在のステージ = stage曲読み込み;
\r
969 foreach( STPlugin pg in this.listプラグイン )
\r
971 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
972 pg.plugin.Onステージ変更();
\r
973 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
976 this.tガベージコレクションを実行する();
\r
978 //-----------------------------
\r
981 // case (int) CStage選曲.E戻り値.オプション呼び出し:
\r
983 // //-----------------------------
\r
984 // r現在のステージ.On非活性化();
\r
985 // Trace.TraceInformation( "----------------------" );
\r
986 // Trace.TraceInformation( "■ オプション" );
\r
987 // stageオプション.On活性化();
\r
988 // r直前のステージ = r現在のステージ;
\r
989 // r現在のステージ = stageオプション;
\r
991 // foreach( STPlugin pg in this.listプラグイン )
\r
993 // Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
994 // pg.plugin.Onステージ変更();
\r
995 // Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
998 // this.tガベージコレクションを実行する();
\r
1000 // //-----------------------------
\r
1003 case (int) CStage選曲.E戻り値.コンフィグ呼び出し:
\r
1005 //-----------------------------
\r
1006 r現在のステージ.On非活性化();
\r
1007 Trace.TraceInformation( "----------------------" );
\r
1008 Trace.TraceInformation( "■ コンフィグ" );
\r
1009 stageコンフィグ.On活性化();
\r
1010 r直前のステージ = r現在のステージ;
\r
1011 r現在のステージ = stageコンフィグ;
\r
1013 foreach( STPlugin pg in this.listプラグイン )
\r
1015 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
1016 pg.plugin.Onステージ変更();
\r
1017 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
1020 this.tガベージコレクションを実行する();
\r
1022 //-----------------------------
\r
1025 case (int) CStage選曲.E戻り値.スキン変更:
\r
1028 //-----------------------------
\r
1029 r現在のステージ.On非活性化();
\r
1030 Trace.TraceInformation( "----------------------" );
\r
1031 Trace.TraceInformation( "■ スキン切り替え" );
\r
1032 stageChangeSkin.On活性化();
\r
1033 r直前のステージ = r現在のステージ;
\r
1034 r現在のステージ = stageChangeSkin;
\r
1036 //-----------------------------
\r
1039 //-----------------------------
\r
1043 case CStage.Eステージ.曲読み込み:
\r
1045 //-----------------------------
\r
1046 DTXVmode.Refreshed = false; // 曲のリロード中に発生した再リロードは、無視する。
\r
1047 if( this.n進行描画の戻り値 != 0 )
\r
1049 CDTXMania.Pad.st検知したデバイス.Clear(); // 入力デバイスフラグクリア(2010.9.11)
\r
1050 r現在のステージ.On非活性化();
\r
1051 #region [ ESC押下時は、曲の読み込みを中止して選曲画面に戻る ]
\r
1052 if ( this.n進行描画の戻り値 == (int) E曲読込画面の戻り値.読込中止 )
\r
1054 //DTX.t全チップの再生停止();
\r
1056 Trace.TraceInformation( "曲の読み込みを中止しました。" );
\r
1057 this.tガベージコレクションを実行する();
\r
1058 Trace.TraceInformation( "----------------------" );
\r
1059 Trace.TraceInformation( "■ 選曲" );
\r
1061 r直前のステージ = r現在のステージ;
\r
1062 r現在のステージ = stage選曲;
\r
1063 foreach ( STPlugin pg in this.listプラグイン )
\r
1065 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
1066 pg.plugin.Onステージ変更();
\r
1067 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
1073 if( !ConfigIni.bギタレボモード )
\r
1075 Trace.TraceInformation( "----------------------" );
\r
1076 Trace.TraceInformation( "■ 演奏(ドラム画面)" );
\r
1077 #if false // #23625 2011.1.11 Config.iniからダメージ/回復値の定数変更を行う場合はここを有効にする 087リリースに合わせ機能無効化
\r
1078 for (int i = 0; i < 5; i++)
\r
1080 for (int j = 0; j < 2; j++)
\r
1082 stage演奏ドラム画面.fDamageGaugeDelta[i, j] = ConfigIni.fGaugeFactor[i, j];
\r
1085 for (int i = 0; i < 3; i++) {
\r
1086 stage演奏ドラム画面.fDamageLevelFactor[i] = ConfigIni.fDamageLevelFactor[i];
\r
1089 r直前のステージ = r現在のステージ;
\r
1090 r現在のステージ = stage演奏ドラム画面;
\r
1094 Trace.TraceInformation( "----------------------" );
\r
1095 Trace.TraceInformation( "■ 演奏(ギター画面)" );
\r
1096 #if false // #23625 2011.1.11 Config.iniからダメージ/回復値の定数変更を行う場合はここを有効にする 087リリースに合わせ機能無効化
\r
1097 for (int i = 0; i < 5; i++)
\r
1099 for (int j = 0; j < 2; j++)
\r
1101 stage演奏ギター画面.fDamageGaugeDelta[i, j] = ConfigIni.fGaugeFactor[i, j];
\r
1104 for (int i = 0; i < 3; i++) {
\r
1105 stage演奏ギター画面.fDamageLevelFactor[i] = ConfigIni.fDamageLevelFactor[i];
\r
1108 r直前のステージ = r現在のステージ;
\r
1109 r現在のステージ = stage演奏ギター画面;
\r
1112 foreach( STPlugin pg in this.listプラグイン )
\r
1114 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
1115 pg.plugin.Onステージ変更();
\r
1116 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
1119 this.tガベージコレクションを実行する();
\r
1121 //-----------------------------
\r
1125 case CStage.Eステージ.演奏:
\r
1127 //-----------------------------
\r
1128 //long n1 = FDK.CSound管理.rc演奏用タイマ.nシステム時刻ms;
\r
1129 //long n2 = FDK.CSound管理.SoundDevice.n経過時間ms;
\r
1130 //long n3 = FDK.CSound管理.SoundDevice.tmシステムタイマ.nシステム時刻ms;
\r
1131 //long n4 = FDK.CSound管理.rc演奏用タイマ.n現在時刻;
\r
1132 //long n5 = FDK.CSound管理.SoundDevice.n経過時間を更新したシステム時刻ms;
\r
1134 //swlist1.Add( Convert.ToInt32(n1) );
\r
1135 //swlist2.Add( Convert.ToInt32(n2) );
\r
1136 //swlist3.Add( Convert.ToInt32( n3 ) );
\r
1137 //swlist4.Add( Convert.ToInt32( n4 ) );
\r
1138 //swlist5.Add( Convert.ToInt32( n5 ) );
\r
1140 #region [ DTXVモード中にDTXCreatorから指示を受けた場合の処理 ]
\r
1141 if ( DTXVmode.Enabled && DTXVmode.Refreshed )
\r
1143 DTXVmode.Refreshed = false;
\r
1145 if ( DTXVmode.Command == CDTXVmode.ECommand.Stop )
\r
1147 if ( !ConfigIni.bギタレボモード )
\r
1149 CDTXMania.stage演奏ドラム画面.t停止();
\r
1153 CDTXMania.stage演奏ギター画面.t停止();
\r
1155 if ( previewSound != null )
\r
1157 this.previewSound.tサウンドを停止する();
\r
1158 this.previewSound.Dispose();
\r
1159 this.previewSound = null;
\r
1164 // for ( int i = 0; i < swlist1.Count; i++ )
\r
1166 // int d1 = swlist1[ i ];
\r
1167 // int d2 = swlist2[ i ];
\r
1168 // int d3 = swlist3[ i ];
\r
1169 // int d4 = swlist4[ i ];
\r
1170 // int d5 = swlist5[ i ];
\r
1172 // int dif = d1 - lastd;
\r
1174 // if ( 16 <= dif && dif <= 17 )
\r
1181 // 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
1185 // swlist1.Clear();
\r
1186 // swlist2.Clear();
\r
1187 // swlist3.Clear();
\r
1188 // swlist4.Clear();
\r
1189 // swlist5.Clear();
\r
1193 else if ( DTXVmode.Command == CDTXVmode.ECommand.Play )
\r
1195 if ( DTXVmode.NeedReload )
\r
1197 if ( !ConfigIni.bギタレボモード )
\r
1199 CDTXMania.stage演奏ドラム画面.t再読込();
\r
1203 CDTXMania.stage演奏ギター画面.t再読込();
\r
1206 CDTXMania.ConfigIni.bDrums有効 = !DTXVmode.GRmode;
\r
1207 CDTXMania.ConfigIni.bGuitar有効 = true;
\r
1208 CDTXMania.ConfigIni.bTimeStretch = DTXVmode.TimeStretch;
\r
1209 CSound管理.bIsTimeStretch = DTXVmode.TimeStretch;
\r
1210 if ( CDTXMania.ConfigIni.b垂直帰線待ちを行う != DTXVmode.VSyncWait )
\r
1212 CDTXMania.ConfigIni.b垂直帰線待ちを行う = DTXVmode.VSyncWait;
\r
1213 CDTXMania.app.b次のタイミングで垂直帰線同期切り替えを行う = true;
\r
1218 if ( !ConfigIni.bギタレボモード )
\r
1220 CDTXMania.stage演奏ドラム画面.t演奏位置の変更( CDTXMania.DTXVmode.nStartBar );
\r
1224 CDTXMania.stage演奏ギター画面.t演奏位置の変更( CDTXMania.DTXVmode.nStartBar );
\r
1231 switch( this.n進行描画の戻り値 )
\r
1233 case (int) E演奏画面の戻り値.再読込・再演奏:
\r
1234 #region [ DTXファイルを再読み込みして、再演奏 ]
\r
1237 r現在のステージ.On非活性化();
\r
1238 stage曲読み込み.On活性化();
\r
1239 r直前のステージ = r現在のステージ;
\r
1240 r現在のステージ = stage曲読み込み;
\r
1241 this.tガベージコレクションを実行する();
\r
1245 //case (int) E演奏画面の戻り値.再演奏:
\r
1246 #region [ 再読み込み無しで、再演奏 ]
\r
1250 case (int) E演奏画面の戻り値.継続:
\r
1253 case (int) E演奏画面の戻り値.演奏中断:
\r
1254 #region [ 演奏キャンセル ]
\r
1255 //-----------------------------
\r
1256 scoreIni = this.tScoreIniへBGMAdjustとHistoryとPlayCountを更新( "Play canceled" );
\r
1260 //for (int i = 0; i < swlist1.Count; i++)
\r
1262 // int d1 = swlist1[ i ];
\r
1263 // int d2 = swlist2[ i ];
\r
1264 // int d3 = swlist3[ i ];
\r
1265 // int d4 = swlist4[ i ];
\r
1267 // int dif = d1 - lastd;
\r
1269 // if ( 16 <= dif && dif <= 17 )
\r
1276 // Trace.TraceInformation( "frame {0:D4}: {1:D3} ( {2:D3}, {3:D3}, {4:D3} ) {5}, n現在時刻={6}", f, dif, d1, d2, d3, s, d4 );
\r
1280 //swlist1.Clear();
\r
1281 //swlist2.Clear();
\r
1282 //swlist3.Clear();
\r
1283 //swlist4.Clear();
\r
1285 #region [ プラグイン On演奏キャンセル() の呼び出し ]
\r
1286 //---------------------
\r
1287 foreach( STPlugin pg in this.listプラグイン )
\r
1289 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
1290 pg.plugin.On演奏キャンセル( scoreIni );
\r
1291 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
1293 //---------------------
\r
1298 r現在のステージ.On非活性化();
\r
1301 base.Window.Close();
\r
1305 Trace.TraceInformation( "----------------------" );
\r
1306 Trace.TraceInformation( "■ 選曲" );
\r
1308 r直前のステージ = r現在のステージ;
\r
1309 r現在のステージ = stage選曲;
\r
1311 #region [ プラグイン Onステージ変更() の呼び出し ]
\r
1312 //---------------------
\r
1313 foreach( STPlugin pg in this.listプラグイン )
\r
1315 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
1316 pg.plugin.Onステージ変更();
\r
1317 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
1319 //---------------------
\r
1322 this.tガベージコレクションを実行する();
\r
1325 //-----------------------------
\r
1328 case (int) E演奏画面の戻り値.ステージ失敗:
\r
1329 #region [ 演奏失敗(StageFailed) ]
\r
1330 //-----------------------------
\r
1331 scoreIni = this.tScoreIniへBGMAdjustとHistoryとPlayCountを更新( "Stage failed" );
\r
1333 #region [ プラグイン On演奏失敗() の呼び出し ]
\r
1334 //---------------------
\r
1335 foreach( STPlugin pg in this.listプラグイン )
\r
1337 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
1338 pg.plugin.On演奏失敗( scoreIni );
\r
1339 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
1341 //---------------------
\r
1346 r現在のステージ.On非活性化();
\r
1349 base.Window.Close();
\r
1353 Trace.TraceInformation( "----------------------" );
\r
1354 Trace.TraceInformation( "■ 選曲" );
\r
1356 r直前のステージ = r現在のステージ;
\r
1357 r現在のステージ = stage選曲;
\r
1359 #region [ プラグイン Onステージ変更() の呼び出し ]
\r
1360 //---------------------
\r
1361 foreach( STPlugin pg in this.listプラグイン )
\r
1363 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
1364 pg.plugin.Onステージ変更();
\r
1365 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
1367 //---------------------
\r
1370 this.tガベージコレクションを実行する();
\r
1373 //-----------------------------
\r
1376 case (int) E演奏画面の戻り値.ステージクリア:
\r
1378 //-----------------------------
\r
1379 CScoreIni.C演奏記録 c演奏記録_Drums, c演奏記録_Guitar, c演奏記録_Bass;
\r
1380 CDTX.CChip[] chipArray = new CDTX.CChip[ 10 ];
\r
1381 if( ConfigIni.bギタレボモード )
\r
1383 stage演奏ギター画面.t演奏結果を格納する( out c演奏記録_Drums, out c演奏記録_Guitar, out c演奏記録_Bass );
\r
1387 stage演奏ドラム画面.t演奏結果を格納する( out c演奏記録_Drums, out c演奏記録_Guitar, out c演奏記録_Bass, out chipArray );
\r
1390 if ( CDTXMania.ConfigIni.bIsSwappedGuitarBass ) // #24063 2011.1.24 yyagi Gt/Bsを入れ替えていたなら、演奏結果も入れ替える
\r
1392 CScoreIni.C演奏記録 t;
\r
1394 c演奏記録_Guitar = c演奏記録_Bass;
\r
1397 CDTXMania.DTX.SwapGuitarBassInfos(); // 譜面情報も元に戻す
\r
1398 CDTXMania.ConfigIni.SwapGuitarBassInfos_AutoFlags(); // #24415 2011.2.27 yyagi
\r
1399 // リザルト集計時のみ、Auto系のフラグも元に戻す。
\r
1400 // これを戻すのは、リザルト集計後。
\r
1401 } // "case CStage.Eステージ.結果:"のところ。
\r
1403 double ps = 0.0, gs = 0.0;
\r
1404 if ( !c演奏記録_Drums.b全AUTOである && c演奏記録_Drums.n全チップ数 > 0) {
\r
1405 ps = c演奏記録_Drums.db演奏型スキル値;
\r
1406 gs = c演奏記録_Drums.dbゲーム型スキル値;
\r
1408 else if ( !c演奏記録_Guitar.b全AUTOである && c演奏記録_Guitar.n全チップ数 > 0) {
\r
1409 ps = c演奏記録_Guitar.db演奏型スキル値;
\r
1410 gs = c演奏記録_Guitar.dbゲーム型スキル値;
\r
1414 ps = c演奏記録_Bass.db演奏型スキル値;
\r
1415 gs = c演奏記録_Bass.dbゲーム型スキル値;
\r
1417 string str = "Cleared";
\r
1418 switch( CScoreIni.t総合ランク値を計算して返す( c演奏記録_Drums, c演奏記録_Guitar, c演奏記録_Bass ) )
\r
1420 case (int)CScoreIni.ERANK.SS:
\r
1421 str = string.Format( "Cleared (SS: {0:F2})", ps );
\r
1424 case (int) CScoreIni.ERANK.S:
\r
1425 str = string.Format( "Cleared (S: {0:F2})", ps );
\r
1428 case (int) CScoreIni.ERANK.A:
\r
1429 str = string.Format( "Cleared (A: {0:F2})", ps );
\r
1432 case (int) CScoreIni.ERANK.B:
\r
1433 str = string.Format( "Cleared (B: {0:F2})", ps );
\r
1436 case (int) CScoreIni.ERANK.C:
\r
1437 str = string.Format( "Cleared (C: {0:F2})", ps );
\r
1440 case (int) CScoreIni.ERANK.D:
\r
1441 str = string.Format( "Cleared (D: {0:F2})", ps );
\r
1444 case (int) CScoreIni.ERANK.E:
\r
1445 str = string.Format( "Cleared (E: {0:F2})", ps );
\r
1448 case (int)CScoreIni.ERANK.UNKNOWN: // #23534 2010.10.28 yyagi add: 演奏チップが0個のとき
\r
1449 str = "Cleared (No chips)";
\r
1453 scoreIni = this.tScoreIniへBGMAdjustとHistoryとPlayCountを更新( str );
\r
1455 #region [ プラグイン On演奏クリア() の呼び出し ]
\r
1456 //---------------------
\r
1457 foreach( STPlugin pg in this.listプラグイン )
\r
1459 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
1460 pg.plugin.On演奏クリア( scoreIni );
\r
1461 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
1463 //---------------------
\r
1466 r現在のステージ.On非活性化();
\r
1467 Trace.TraceInformation( "----------------------" );
\r
1468 Trace.TraceInformation( "■ 結果" );
\r
1469 stage結果.st演奏記録.Drums = c演奏記録_Drums;
\r
1470 stage結果.st演奏記録.Guitar = c演奏記録_Guitar;
\r
1471 stage結果.st演奏記録.Bass = c演奏記録_Bass;
\r
1472 stage結果.r空うちドラムチップ = chipArray;
\r
1474 r直前のステージ = r現在のステージ;
\r
1475 r現在のステージ = stage結果;
\r
1477 #region [ プラグイン Onステージ変更() の呼び出し ]
\r
1478 //---------------------
\r
1479 foreach( STPlugin pg in this.listプラグイン )
\r
1481 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
1482 pg.plugin.Onステージ変更();
\r
1483 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
1485 //---------------------
\r
1489 //-----------------------------
\r
1492 //-----------------------------
\r
1496 case CStage.Eステージ.結果:
\r
1498 //-----------------------------
\r
1499 if( this.n進行描画の戻り値 != 0 )
\r
1501 if ( CDTXMania.ConfigIni.bIsSwappedGuitarBass ) // #24415 2011.2.27 yyagi Gt/Bsを入れ替えていたなら、Auto状態をリザルト画面終了後に元に戻す
\r
1503 CDTXMania.ConfigIni.SwapGuitarBassInfos_AutoFlags(); // Auto入れ替え
\r
1506 DTX.t全チップの再生一時停止();
\r
1508 r現在のステージ.On非活性化();
\r
1511 Trace.TraceInformation( "----------------------" );
\r
1512 Trace.TraceInformation( "■ 選曲" );
\r
1514 r直前のステージ = r現在のステージ;
\r
1515 r現在のステージ = stage選曲;
\r
1517 foreach( STPlugin pg in this.listプラグイン )
\r
1519 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
\r
1520 pg.plugin.Onステージ変更();
\r
1521 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
1524 this.tガベージコレクションを実行する();
\r
1528 base.Window.Close();
\r
1531 //-----------------------------
\r
1535 case CStage.Eステージ.ChangeSkin:
\r
1537 //-----------------------------
\r
1538 if ( this.n進行描画の戻り値 != 0 )
\r
1540 r現在のステージ.On非活性化();
\r
1541 Trace.TraceInformation( "----------------------" );
\r
1542 Trace.TraceInformation( "■ 選曲" );
\r
1544 r直前のステージ = r現在のステージ;
\r
1545 r現在のステージ = stage選曲;
\r
1546 this.tガベージコレクションを実行する();
\r
1548 //-----------------------------
\r
1552 case CStage.Eステージ.終了:
\r
1554 //-----------------------------
\r
1555 if( this.n進行描画の戻り値 != 0 )
\r
1559 //-----------------------------
\r
1564 this.Device.EndScene(); // Present()は game.csのOnFrameEnd()に登録された、GraphicsDeviceManager.game_FrameEnd() 内で実行されるので不要
\r
1565 // (つまり、Present()は、Draw()完了後に実行される)
\r
1566 #if !GPUFlushAfterPresent
\r
1567 actFlushGPU.On進行描画(); // Flush GPU // EndScene()~Present()間 (つまりVSync前) でFlush実行
\r
1569 if ( Sound管理.GetCurrentSoundDeviceType() != "DirectSound" )
\r
1571 Sound管理.t再生中の処理をする(); // サウンドバッファの更新; 画面描画と同期させることで、スクロールをスムーズにする
\r
1575 #region [ 全画面・ウインドウ切り替え ]
\r
1576 if ( this.b次のタイミングで全画面・ウィンドウ切り替えを行う )
\r
1578 ConfigIni.b全画面モード = !ConfigIni.b全画面モード;
\r
1579 app.t全画面・ウィンドウモード切り替え();
\r
1580 this.b次のタイミングで全画面・ウィンドウ切り替えを行う = false;
\r
1583 #region [ 垂直基線同期切り替え ]
\r
1584 if ( this.b次のタイミングで垂直帰線同期切り替えを行う )
\r
1586 bool bIsMaximized = this.Window.IsMaximized; // #23510 2010.11.3 yyagi: to backup current window mode before changing VSyncWait
\r
1587 currentClientSize = this.Window.ClientSize; // #23510 2010.11.3 yyagi: to backup current window size before changing VSyncWait
\r
1588 DeviceSettings currentSettings = app.GraphicsDeviceManager.CurrentSettings;
\r
1589 currentSettings.EnableVSync = ConfigIni.b垂直帰線待ちを行う;
\r
1590 app.GraphicsDeviceManager.ChangeDevice( currentSettings );
\r
1591 this.b次のタイミングで垂直帰線同期切り替えを行う = false;
\r
1592 base.Window.ClientSize = new Size(currentClientSize.Width, currentClientSize.Height); // #23510 2010.11.3 yyagi: to resume window size after changing VSyncWait
\r
1595 this.Window.WindowState = FormWindowState.Maximized; // #23510 2010.11.3 yyagi: to resume window mode after changing VSyncWait
\r
1603 #region [ 汎用ヘルパー ]
\r
1604 //-----------------
\r
1605 public static CTexture tテクスチャの生成( string fileName )
\r
1607 return tテクスチャの生成( fileName, false );
\r
1609 public static CTexture tテクスチャの生成( string fileName, bool b黒を透過する )
\r
1611 if ( app == null )
\r
1617 return new CTexture( app.Device, fileName, TextureFormat, b黒を透過する );
\r
1619 catch ( CTextureCreateFailedException )
\r
1621 Trace.TraceError( "テクスチャの生成に失敗しました。({0})", fileName );
\r
1624 catch ( FileNotFoundException )
\r
1626 Trace.TraceError( "テクスチャファイルが見つかりませんでした。({0})", fileName );
\r
1630 public static void tテクスチャの解放( ref CTexture tx )
\r
1632 CDTXMania.t安全にDisposeする( ref tx );
\r
1635 public static CTexture tテクスチャの生成( byte[] txData )
\r
1637 return tテクスチャの生成( txData, false );
\r
1639 public static CTexture tテクスチャの生成( byte[] txData, bool b黒を透過する )
\r
1641 if ( app == null )
\r
1647 return new CTexture( app.Device, txData, TextureFormat, b黒を透過する );
\r
1649 catch ( CTextureCreateFailedException )
\r
1651 Trace.TraceError( "テクスチャの生成に失敗しました。(txData)" );
\r
1656 public static CTexture tテクスチャの生成( Bitmap bitmap )
\r
1658 return tテクスチャの生成( bitmap, false );
\r
1660 public static CTexture tテクスチャの生成( Bitmap bitmap, bool b黒を透過する )
\r
1662 if ( app == null )
\r
1668 return new CTexture( app.Device, bitmap, TextureFormat, b黒を透過する );
\r
1670 catch ( CTextureCreateFailedException )
\r
1672 Trace.TraceError( "テクスチャの生成に失敗しました。(txData)" );
\r
1677 /// <summary>プロパティ、インデクサには ref は使用できないので注意。</summary>
\r
1678 public static void t安全にDisposeする<T>( ref T obj )
\r
1680 if ( obj == null )
\r
1683 var d = obj as IDisposable;
\r
1688 obj = default( T );
\r
1690 //-----------------
\r
1693 #region [ private ]
\r
1694 //-----------------
\r
1695 private bool bマウスカーソル表示中 = true;
\r
1696 private bool b終了処理完了済み;
\r
1697 private static CDTX dtx;
\r
1698 private List<CActivity> listトップレベルActivities;
\r
1699 private int n進行描画の戻り値;
\r
1700 private MouseButtons mb = System.Windows.Forms.MouseButtons.Left;
\r
1701 private string strWindowTitle
\r
1705 if ( DTXVmode.Enabled )
\r
1707 return "DTXViewer release " + VERSION;
\r
1711 return "DTXMania .NET style release " + VERSION;
\r
1715 private CSound previewSound;
\r
1717 private void t起動処理()
\r
1719 #region [ strEXEのあるフォルダを決定する ]
\r
1720 //-----------------
\r
1721 // BEGIN #23629 2010.11.13 from: デバッグ時は Application.ExecutablePath が ($SolutionDir)/bin/x86/Debug/ などになり System/ の読み込みに失敗するので、カレントディレクトリを採用する。(プロジェクトのプロパティ→デバッグ→作業ディレクトリが有効になる)
\r
1723 strEXEのあるフォルダ = Environment.CurrentDirectory + @"\";
\r
1724 //strEXEのあるフォルダ = Path.GetDirectoryName( Environment.GetCommandLineArgs()[ 0 ] ) + @"\";
\r
1726 strEXEのあるフォルダ = Path.GetDirectoryName( Application.ExecutablePath ) + @"\"; // #23629 2010.11.9 yyagi: set correct pathname where DTXManiaGR.exe is.
\r
1728 // END #23629 2010.11.13 from
\r
1729 //-----------------
\r
1732 #region [ Config.ini の読込み ]
\r
1733 //---------------------
\r
1734 ConfigIni = new CConfigIni();
\r
1735 string path = strEXEのあるフォルダ + "Config.ini";
\r
1736 if( File.Exists( path ) )
\r
1740 ConfigIni.tファイルから読み込み( path );
\r
1744 //ConfigIni = new CConfigIni(); // 存在してなければ新規生成
\r
1747 this.Window.EnableSystemMenu = CDTXMania.ConfigIni.bIsEnabledSystemMenu; // #28200 2011.5.1 yyagi
\r
1748 // 2012.8.22 Config.iniが無いときに初期値が適用されるよう、この設定行をifブロック外に移動
\r
1750 //---------------------
\r
1752 #region [ ログ出力開始 ]
\r
1753 //---------------------
\r
1754 Trace.AutoFlush = true;
\r
1755 if( ConfigIni.bログ出力 )
\r
1759 Trace.Listeners.Add( new CTraceLogListener( new StreamWriter( System.IO.Path.Combine( strEXEのあるフォルダ, "DTXManiaLog.txt" ), false, Encoding.GetEncoding( "Shift_JIS" ) ) ) );
\r
1761 catch ( System.UnauthorizedAccessException ) // #24481 2011.2.20 yyagi
\r
1763 int c = (CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "ja")? 0 : 1;
\r
1764 string[] mes_writeErr = {
\r
1765 "DTXManiaLog.txtへの書き込みができませんでした。書き込みできるようにしてから、再度起動してください。",
\r
1766 "Failed to write DTXManiaLog.txt. Please set it writable and try again."
\r
1768 MessageBox.Show( mes_writeErr[c], "DTXMania boot error", MessageBoxButtons.OK, MessageBoxIcon.Error );
\r
1769 Environment.Exit(1);
\r
1772 Trace.WriteLine("");
\r
1773 Trace.WriteLine( "DTXMania powered by YAMAHA Silent Session Drums" );
\r
1774 Trace.WriteLine( string.Format( "Release: {0}", VERSION ) );
\r
1775 Trace.WriteLine( "" );
\r
1776 Trace.TraceInformation( "----------------------" );
\r
1777 Trace.TraceInformation( "■ アプリケーションの初期化" );
\r
1778 Trace.TraceInformation( "OS Version: " + Environment.OSVersion );
\r
1779 Trace.TraceInformation( "ProcessorCount: " + Environment.ProcessorCount.ToString() );
\r
1780 Trace.TraceInformation( "CLR Version: " + Environment.Version.ToString() );
\r
1781 //---------------------
\r
1783 #region [ DTXVmodeクラス の初期化 ]
\r
1784 //---------------------
\r
1785 //Trace.TraceInformation( "DTXVモードの初期化を行います。" );
\r
1789 DTXVmode = new CDTXVmode();
\r
1790 DTXVmode.Enabled = false;
\r
1791 //Trace.TraceInformation( "DTXVモードの初期化を完了しました。" );
\r
1795 //Trace.Unindent();
\r
1797 //---------------------
\r
1799 #region [ コンパクトモードスイッチの有無、もしくは、DTXViewerとしての起動 ]
\r
1800 //---------------------
\r
1801 bコンパクトモード = false;
\r
1802 strコンパクトモードファイル = "";
\r
1803 string[] commandLineArgs = Environment.GetCommandLineArgs();
\r
1804 if( ( commandLineArgs != null ) && ( commandLineArgs.Length > 1 ) )
\r
1809 for ( int i = 1; i < commandLineArgs.Length; i++ )
\r
1813 arg += " " + "\"" + commandLineArgs[ i ] + "\"";
\r
1817 arg += commandLineArgs[ i ];
\r
1820 DTXVmode.ParseArguments( arg );
\r
1822 if ( DTXVmode.Enabled )
\r
1824 DTXVmode.Refreshed = false; // 初回起動時は再読み込みに走らせない
\r
1825 strコンパクトモードファイル = DTXVmode.filename;
\r
1826 switch ( DTXVmode.soundDeviceType ) // サウンド再生方式の設定
\r
1828 case ESoundDeviceType.DirectSound:
\r
1829 ConfigIni.nSoundDeviceType = 0;
\r
1831 case ESoundDeviceType.ExclusiveWASAPI:
\r
1832 ConfigIni.nSoundDeviceType = 2;
\r
1834 case ESoundDeviceType.ASIO:
\r
1835 ConfigIni.nSoundDeviceType = 1;
\r
1836 ConfigIni.nASIODevice = DTXVmode.nASIOdevice;
\r
1840 CDTXMania.ConfigIni.b垂直帰線待ちを行う = DTXVmode.VSyncWait;
\r
1841 CDTXMania.ConfigIni.bTimeStretch = DTXVmode.TimeStretch;
\r
1842 CDTXMania.ConfigIni.bDrums有効 = !DTXVmode.GRmode;
\r
1843 CDTXMania.ConfigIni.bGuitar有効 = true;
\r
1845 else // 通常のコンパクトモード
\r
1847 strコンパクトモードファイル = commandLineArgs[ 1 ];
\r
1850 if ( !File.Exists( strコンパクトモードファイル ) ) // #32985 2014.1.23 yyagi
\r
1852 Trace.TraceError( "コンパクトモードで指定されたファイルが見つかりません。DTXManiaを終了します。[{0}]", strコンパクトモードファイル );
\r
1854 Environment.Exit( -1 );
\r
1856 if ( strコンパクトモードファイル == "" ) // DTXMania未起動状態で、DTXCで再生停止ボタンを押した場合は、何もせず終了
\r
1858 Environment.Exit( -1 );
\r
1862 throw new FileNotFoundException( "コンパクトモードで指定されたファイルが見つかりません。DTXManiaを終了します。", strコンパクトモードファイル );
\r
1866 if ( DTXVmode.Enabled )
\r
1868 Trace.TraceInformation( "DTXVモードで起動します。[{0}]", strコンパクトモードファイル );
\r
1872 Trace.TraceInformation( "コンパクトモードで起動します。[{0}]", strコンパクトモードファイル );
\r
1875 //---------------------
\r
1878 #region [ ウィンドウ初期化 ]
\r
1879 //---------------------
\r
1880 base.Window.StartPosition = FormStartPosition.Manual; // #30675 2013.02.04 ikanick add
\r
1881 base.Window.Location = new Point( ConfigIni.n初期ウィンドウ開始位置X, ConfigIni.n初期ウィンドウ開始位置Y ); // #30675 2013.02.04 ikanick add
\r
1883 base.Window.Text = this.strWindowTitle; // 事前にDTXVmodeの実体を作っておくこと
\r
1885 base.Window.StartPosition = FormStartPosition.Manual; // #30675 2013.02.04 ikanick add
\r
1886 base.Window.Location = new Point(ConfigIni.n初期ウィンドウ開始位置X, ConfigIni.n初期ウィンドウ開始位置Y); // #30675 2013.02.04 ikanick add
\r
1888 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
1889 #if !WindowedFullscreen
\r
1890 if (!ConfigIni.bウィンドウモード) // #23510 2010.11.02 yyagi: add; to recover window size in case bootup with fullscreen mode
\r
1891 { // #30666 2013.02.02 yyagi: currentClientSize should be always made
\r
1893 currentClientSize = new Size( ConfigIni.nウインドウwidth, ConfigIni.nウインドウheight );
\r
1894 #if !WindowedFullscreen
\r
1897 base.Window.MaximizeBox = true; // #23510 2010.11.04 yyagi: to support maximizing window
\r
1898 base.Window.FormBorderStyle = FormBorderStyle.Sizable; // #23510 2010.10.27 yyagi: changed from FixedDialog to Sizable, to support window resize
\r
1899 // #30666 2013.02.02 yyagi: moved the code to t全画面・ウインドウモード切り替え()
\r
1900 base.Window.ShowIcon = true;
\r
1901 base.Window.Icon = Properties.Resources.dtx;
\r
1902 base.Window.KeyDown += new KeyEventHandler( this.Window_KeyDown );
\r
1903 base.Window.MouseUp +=new MouseEventHandler( this.Window_MouseUp);
\r
1904 base.Window.MouseDoubleClick += new MouseEventHandler(this.Window_MouseDoubleClick); // #23510 2010.11.13 yyagi: to go fullscreen mode
\r
1905 base.Window.ResizeEnd += new EventHandler(this.Window_ResizeEnd); // #23510 2010.11.20 yyagi: to set resized window size in Config.ini
\r
1906 base.Window.ApplicationActivated += new EventHandler(this.Window_ApplicationActivated);
\r
1907 base.Window.ApplicationDeactivated += new EventHandler( this.Window_ApplicationDeactivated );
\r
1908 //---------------------
\r
1910 #region [ Direct3D9Exを使うかどうか判定 ]
\r
1912 #region [ Direct3D9 デバイスの生成 ]
\r
1913 //---------------------
\r
1914 DeviceSettings settings = new DeviceSettings();
\r
1915 #if WindowedFullscreen
\r
1916 settings.Windowed = true; // #30666 2013.2.2 yyagi: Fullscreenmode is "Maximized window" mode
\r
1918 settings.Windowed = ConfigIni.bウィンドウモード;
\r
1920 settings.BackBufferWidth = SampleFramework.GameWindowSize.Width;
\r
1921 settings.BackBufferHeight = SampleFramework.GameWindowSize.Height;
\r
1922 // settings.BackBufferCount = 3;
\r
1923 settings.EnableVSync = ConfigIni.b垂直帰線待ちを行う;
\r
1924 // settings.BackBufferFormat = Format.A8R8G8B8;
\r
1925 // settings.MultisampleType = MultisampleType.FourSamples;
\r
1926 // settings.MultisampleQuality = 4;
\r
1927 // settings.MultisampleType = MultisampleType.None;
\r
1928 // settings.MultisampleQuality = 0;
\r
1932 base.GraphicsDeviceManager.ChangeDevice(settings);
\r
1934 catch (DeviceCreationException e)
\r
1936 Trace.TraceError(e.ToString());
\r
1937 MessageBox.Show(e.Message + e.ToString(), "DTXMania failed to boot: DirectX9 Initialize Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
\r
1938 Environment.Exit(-1);
\r
1941 base.IsFixedTimeStep = false;
\r
1942 // base.TargetElapsedTime = TimeSpan.FromTicks( 10000000 / 75 );
\r
1943 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
1944 base.InactiveSleepTime = TimeSpan.FromMilliseconds((float)(ConfigIni.n非フォーカス時スリープms)); // #23568 2010.11.3 yyagi: to support valiable sleep value when !IsActive
\r
1945 // #23568 2010.11.4 ikanick changed ( 1 -> ConfigIni )
\r
1946 #if WindowedFullscreen
\r
1947 this.t全画面・ウィンドウモード切り替え(); // #30666 2013.2.2 yyagi: finalize settings for "Maximized window mode"
\r
1949 actFlushGPU = new CActFlushGPU();
\r
1950 //---------------------
\r
1955 #region [ Skin の初期化 ]
\r
1956 //---------------------
\r
1957 Trace.TraceInformation( "スキンの初期化を行います。" );
\r
1961 Skin = new CSkin( CDTXMania.ConfigIni.strSystemSkinSubfolderFullName, CDTXMania.ConfigIni.bUseBoxDefSkin );
\r
1962 CDTXMania.ConfigIni.strSystemSkinSubfolderFullName = CDTXMania.Skin.GetCurrentSkinSubfolderFullName( true ); // 旧指定のSkinフォルダが消滅していた場合に備える
\r
1963 Trace.TraceInformation( "スキンの初期化を完了しました。" );
\r
1967 Trace.TraceInformation( "スキンの初期化に失敗しました。" );
\r
1974 //---------------------
\r
1977 #region [ Timer の初期化 ]
\r
1978 //---------------------
\r
1979 Trace.TraceInformation( "タイマの初期化を行います。" );
\r
1983 Timer = new CTimer( CTimer.E種別.MultiMedia );
\r
1984 Trace.TraceInformation( "タイマの初期化を完了しました。" );
\r
1990 //---------------------
\r
1994 #region [ FPS カウンタの初期化 ]
\r
1995 //---------------------
\r
1996 Trace.TraceInformation( "FPSカウンタの初期化を行います。" );
\r
2001 Trace.TraceInformation( "FPSカウンタを生成しました。" );
\r
2007 //---------------------
\r
2009 #region [ act文字コンソールの初期化 ]
\r
2010 //---------------------
\r
2011 Trace.TraceInformation( "文字コンソールの初期化を行います。" );
\r
2015 act文字コンソール = new C文字コンソール();
\r
2016 Trace.TraceInformation( "文字コンソールを生成しました。" );
\r
2017 act文字コンソール.On活性化();
\r
2018 Trace.TraceInformation( "文字コンソールを活性化しました。" );
\r
2019 Trace.TraceInformation( "文字コンソールの初期化を完了しました。" );
\r
2021 catch( Exception exception )
\r
2023 Trace.TraceError( exception.Message );
\r
2024 Trace.TraceError( "文字コンソールの初期化に失敗しました。" );
\r
2030 //---------------------
\r
2032 #region [ Input管理 の初期化 ]
\r
2033 //---------------------
\r
2034 Trace.TraceInformation( "DirectInput, MIDI入力の初期化を行います。" );
\r
2038 bool bUseMIDIIn = !DTXVmode.Enabled;
\r
2039 Input管理 = new CInput管理( base.Window.Handle, bUseMIDIIn );
\r
2040 foreach( IInputDevice device in Input管理.list入力デバイス )
\r
2042 if( ( device.e入力デバイス種別 == E入力デバイス種別.Joystick ) && !ConfigIni.dicJoystick.ContainsValue( device.GUID ) )
\r
2045 while( ConfigIni.dicJoystick.ContainsKey( key ) )
\r
2049 ConfigIni.dicJoystick.Add( key, device.GUID );
\r
2052 foreach( IInputDevice device2 in Input管理.list入力デバイス )
\r
2054 if( device2.e入力デバイス種別 == E入力デバイス種別.Joystick )
\r
2056 foreach( KeyValuePair<int, string> pair in ConfigIni.dicJoystick )
\r
2058 if( device2.GUID.Equals( pair.Value ) )
\r
2060 ( (CInputJoystick) device2 ).SetID( pair.Key );
\r
2067 Trace.TraceInformation( "DirectInput の初期化を完了しました。" );
\r
2069 catch( Exception exception2 )
\r
2071 Trace.TraceError( exception2.Message );
\r
2072 Trace.TraceError( "DirectInput, MIDI入力の初期化に失敗しました。" );
\r
2079 //---------------------
\r
2081 #region [ Pad の初期化 ]
\r
2082 //---------------------
\r
2083 Trace.TraceInformation( "パッドの初期化を行います。" );
\r
2087 Pad = new CPad( ConfigIni, Input管理 );
\r
2088 Trace.TraceInformation( "パッドの初期化を完了しました。" );
\r
2090 catch( Exception exception3 )
\r
2092 Trace.TraceError( exception3.Message );
\r
2093 Trace.TraceError( "パッドの初期化に失敗しました。" );
\r
2099 //---------------------
\r
2101 #region [ Sound管理 の初期化 ]
\r
2102 //---------------------
\r
2103 Trace.TraceInformation( "サウンドデバイスの初期化を行います。" );
\r
2107 ESoundDeviceType soundDeviceType;
\r
2108 switch ( CDTXMania.ConfigIni.nSoundDeviceType )
\r
2111 soundDeviceType = ESoundDeviceType.DirectSound;
\r
2114 soundDeviceType = ESoundDeviceType.ASIO;
\r
2117 soundDeviceType = ESoundDeviceType.ExclusiveWASAPI;
\r
2120 soundDeviceType = ESoundDeviceType.Unknown;
\r
2123 Sound管理 = new CSound管理( base.Window.Handle,
\r
2125 CDTXMania.ConfigIni.nWASAPIBufferSizeMs,
\r
2127 // CDTXMania.ConfigIni.nASIOBufferSizeMs,
\r
2129 CDTXMania.ConfigIni.nASIODevice,
\r
2130 CDTXMania.ConfigIni.bUseOSTimer
\r
2132 //Sound管理 = FDK.CSound管理.Instance;
\r
2133 //Sound管理.t初期化( soundDeviceType, 0, 0, CDTXMania.ConfigIni.nASIODevice, base.Window.Handle );
\r
2135 ShowWindowTitleWithSoundType();
\r
2136 FDK.CSound管理.bIsTimeStretch = CDTXMania.ConfigIni.bTimeStretch;
\r
2137 Sound管理.nMasterVolume = CDTXMania.ConfigIni.nMasterVolume;
\r
2138 //FDK.CSound管理.bIsMP3DecodeByWindowsCodec = CDTXMania.ConfigIni.bNoMP3Streaming;
\r
2139 Trace.TraceInformation( "サウンドデバイスの初期化を完了しました。" );
\r
2141 catch (Exception e)
\r
2143 Trace.TraceError( e.Message );
\r
2150 //---------------------
\r
2152 #region [ Songs管理 の初期化 ]
\r
2153 //---------------------
\r
2154 Trace.TraceInformation( "曲リストの初期化を行います。" );
\r
2158 Songs管理 = new CSongs管理();
\r
2159 // Songs管理_裏読 = new CSongs管理();
\r
2160 EnumSongs = new CEnumSongs();
\r
2161 actEnumSongs = new CActEnumSongs();
\r
2162 Trace.TraceInformation( "曲リストの初期化を完了しました。" );
\r
2164 catch( Exception e )
\r
2166 Trace.TraceError( e.Message );
\r
2167 Trace.TraceError( "曲リストの初期化に失敗しました。" );
\r
2173 //---------------------
\r
2175 #region [ CAvi の初期化 ]
\r
2176 //---------------------
\r
2178 //---------------------
\r
2180 #region [ Random の初期化 ]
\r
2181 //---------------------
\r
2182 Random = new Random( (int) Timer.nシステム時刻 );
\r
2183 //---------------------
\r
2185 #region [ ステージの初期化 ]
\r
2186 //---------------------
\r
2189 stage起動 = new CStage起動();
\r
2190 stageタイトル = new CStageタイトル();
\r
2191 // stageオプション = new CStageオプション();
\r
2192 stageコンフィグ = new CStageコンフィグ();
\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 stageChangeSkin = new CStageChangeSkin();
\r
2199 stage終了 = new CStage終了();
\r
2200 this.listトップレベルActivities = new List<CActivity>();
\r
2201 this.listトップレベルActivities.Add( actEnumSongs );
\r
2202 this.listトップレベルActivities.Add( act文字コンソール );
\r
2203 this.listトップレベルActivities.Add( stage起動 );
\r
2204 this.listトップレベルActivities.Add( stageタイトル );
\r
2205 // this.listトップレベルActivities.Add( stageオプション );
\r
2206 this.listトップレベルActivities.Add( stageコンフィグ );
\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( stageChangeSkin );
\r
2213 this.listトップレベルActivities.Add( stage終了 );
\r
2214 this.listトップレベルActivities.Add( actFlushGPU );
\r
2215 //---------------------
\r
2217 #region [ プラグインの検索と生成 ]
\r
2218 //---------------------
\r
2219 PluginHost = new CPluginHost();
\r
2221 Trace.TraceInformation( "プラグインの検索と生成を行います。" );
\r
2225 this.tプラグイン検索と生成();
\r
2226 Trace.TraceInformation( "プラグインの検索と生成を完了しました。" );
\r
2232 //---------------------
\r
2234 #region [ プラグインの初期化 ]
\r
2235 //---------------------
\r
2236 if( this.listプラグイン != null && this.listプラグイン.Count > 0 )
\r
2238 Trace.TraceInformation( "プラグインの初期化を行います。" );
\r
2242 foreach( STPlugin st in this.listプラグイン )
\r
2244 Directory.SetCurrentDirectory( st.strプラグインフォルダ );
\r
2245 st.plugin.On初期化( this.PluginHost );
\r
2246 st.plugin.OnManagedリソースの作成();
\r
2247 st.plugin.OnUnmanagedリソースの作成();
\r
2248 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
2250 Trace.TraceInformation( "すべてのプラグインの初期化を完了しました。" );
\r
2254 Trace.TraceError( "プラグインのどれかの初期化に失敗しました。" );
\r
2263 //---------------------
\r
2266 Trace.TraceInformation( "アプリケーションの初期化を完了しました。" );
\r
2268 #region [ 最初のステージの起動 ]
\r
2269 //---------------------
\r
2270 Trace.TraceInformation( "----------------------" );
\r
2271 Trace.TraceInformation( "■ 起動" );
\r
2273 if ( CDTXMania.bコンパクトモード )
\r
2275 r現在のステージ = stage曲読み込み;
\r
2279 r現在のステージ = stage起動;
\r
2282 //---------------------
\r
2286 public void ShowWindowTitleWithSoundType()
\r
2288 string delay = "";
\r
2289 if ( Sound管理.GetCurrentSoundDeviceType() != "DirectSound" )
\r
2291 delay = "(" + Sound管理.GetSoundDelay() + "ms)";
\r
2293 base.Window.Text = strWindowTitle + " (" + Sound管理.GetCurrentSoundDeviceType() + delay + ")";
\r
2296 private void t終了処理()
\r
2298 if( !this.b終了処理完了済み )
\r
2300 Trace.TraceInformation( "----------------------" );
\r
2301 Trace.TraceInformation( "■ アプリケーションの終了" );
\r
2302 #region [ 曲検索の終了処理 ]
\r
2303 //---------------------
\r
2304 if ( actEnumSongs != null )
\r
2306 Trace.TraceInformation( "曲検索actの終了処理を行います。" );
\r
2310 actEnumSongs.On非活性化();
\r
2311 actEnumSongs= null;
\r
2312 Trace.TraceInformation( "曲検索actの終了処理を完了しました。" );
\r
2314 catch ( Exception e )
\r
2316 Trace.TraceError( e.Message );
\r
2317 Trace.TraceError( "曲検索actの終了処理に失敗しました。" );
\r
2324 //---------------------
\r
2326 #region [ 現在のステージの終了処理 ]
\r
2327 //---------------------
\r
2328 if( CDTXMania.r現在のステージ != null && CDTXMania.r現在のステージ.b活性化してる ) // #25398 2011.06.07 MODIFY FROM
\r
2330 Trace.TraceInformation( "現在のステージを終了します。" );
\r
2334 r現在のステージ.On非活性化();
\r
2335 Trace.TraceInformation( "現在のステージの終了処理を完了しました。" );
\r
2342 //---------------------
\r
2344 #region [ プラグインの終了処理 ]
\r
2345 //---------------------
\r
2346 if (this.listプラグイン != null && this.listプラグイン.Count > 0)
\r
2348 Trace.TraceInformation( "すべてのプラグインを終了します。" );
\r
2352 foreach( STPlugin st in this.listプラグイン )
\r
2354 Directory.SetCurrentDirectory( st.strプラグインフォルダ );
\r
2355 st.plugin.OnUnmanagedリソースの解放();
\r
2356 st.plugin.OnManagedリソースの解放();
\r
2358 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
\r
2360 PluginHost = null;
\r
2361 Trace.TraceInformation( "すべてのプラグインの終了処理を完了しました。" );
\r
2368 //---------------------
\r
2370 #region [ 曲リストの終了処理 ]
\r
2371 //---------------------
\r
2372 if (Songs管理 != null)
\r
2374 Trace.TraceInformation( "曲リストの終了処理を行います。" );
\r
2379 Trace.TraceInformation( "曲リストの終了処理を完了しました。" );
\r
2381 catch( Exception exception )
\r
2383 Trace.TraceError( exception.Message );
\r
2384 Trace.TraceError( "曲リストの終了処理に失敗しました。" );
\r
2392 //---------------------
\r
2394 #region [ スキンの終了処理 ]
\r
2395 //---------------------
\r
2398 Trace.TraceInformation( "スキンの終了処理を行います。" );
\r
2404 Trace.TraceInformation( "スキンの終了処理を完了しました。" );
\r
2406 catch( Exception exception2 )
\r
2408 Trace.TraceError( exception2.Message );
\r
2409 Trace.TraceError( "スキンの終了処理に失敗しました。" );
\r
2416 //---------------------
\r
2418 #region [ DirectSoundの終了処理 ]
\r
2419 //---------------------
\r
2420 if (Sound管理 != null)
\r
2422 Trace.TraceInformation( "DirectSound の終了処理を行います。" );
\r
2426 Sound管理.Dispose();
\r
2428 Trace.TraceInformation( "DirectSound の終了処理を完了しました。" );
\r
2430 catch( Exception exception3 )
\r
2432 Trace.TraceError( exception3.Message );
\r
2433 Trace.TraceError( "DirectSound の終了処理に失敗しました。" );
\r
2440 //---------------------
\r
2442 #region [ パッドの終了処理 ]
\r
2443 //---------------------
\r
2446 Trace.TraceInformation( "パッドの終了処理を行います。" );
\r
2451 Trace.TraceInformation( "パッドの終了処理を完了しました。" );
\r
2453 catch( Exception exception4 )
\r
2455 Trace.TraceError( exception4.Message );
\r
2456 Trace.TraceError( "パッドの終了処理に失敗しました。" );
\r
2463 //---------------------
\r
2465 #region [ DirectInput, MIDI入力の終了処理 ]
\r
2466 //---------------------
\r
2467 if (Input管理 != null)
\r
2469 Trace.TraceInformation( "DirectInput, MIDI入力の終了処理を行います。" );
\r
2473 Input管理.Dispose();
\r
2475 Trace.TraceInformation( "DirectInput, MIDI入力の終了処理を完了しました。" );
\r
2477 catch( Exception exception5 )
\r
2479 Trace.TraceError( exception5.Message );
\r
2480 Trace.TraceError( "DirectInput, MIDI入力の終了処理に失敗しました。" );
\r
2487 //---------------------
\r
2489 #region [ 文字コンソールの終了処理 ]
\r
2490 //---------------------
\r
2491 if (act文字コンソール != null)
\r
2493 Trace.TraceInformation( "文字コンソールの終了処理を行います。" );
\r
2497 act文字コンソール.On非活性化();
\r
2498 act文字コンソール = null;
\r
2499 Trace.TraceInformation( "文字コンソールの終了処理を完了しました。" );
\r
2501 catch( Exception exception6 )
\r
2503 Trace.TraceError( exception6.Message );
\r
2504 Trace.TraceError( "文字コンソールの終了処理に失敗しました。" );
\r
2511 //---------------------
\r
2513 #region [ FPSカウンタの終了処理 ]
\r
2514 //---------------------
\r
2515 Trace.TraceInformation("FPSカウンタの終了処理を行います。");
\r
2523 Trace.TraceInformation( "FPSカウンタの終了処理を完了しました。" );
\r
2529 //---------------------
\r
2531 #region [ タイマの終了処理 ]
\r
2532 //---------------------
\r
2533 Trace.TraceInformation("タイマの終了処理を行います。");
\r
2537 if( Timer != null )
\r
2541 Trace.TraceInformation( "タイマの終了処理を完了しました。" );
\r
2545 Trace.TraceInformation( "タイマは使用されていません。" );
\r
2552 //---------------------
\r
2554 #region [ Config.iniの出力 ]
\r
2555 //---------------------
\r
2556 Trace.TraceInformation("Config.ini を出力します。");
\r
2557 // if ( ConfigIni.bIsSwappedGuitarBass ) // #24063 2011.1.16 yyagi ギターベースがスワップしているときは元に戻す
\r
2558 if ( ConfigIni.bIsSwappedGuitarBass_AutoFlagsAreSwapped ) // #24415 2011.2.21 yyagi FLIP中かつ演奏中にalt-f4で終了したときは、AUTOのフラグをswapして戻す
\r
2560 ConfigIni.SwapGuitarBassInfos_AutoFlags();
\r
2562 string str = strEXEのあるフォルダ + "Config.ini";
\r
2566 if ( DTXVmode.Enabled )
\r
2568 DTXVmode.tUpdateConfigIni();
\r
2569 Trace.TraceInformation( "DTXVモードの設定情報を、Config.iniに保存しました。" );
\r
2573 ConfigIni.t書き出し( str );
\r
2574 Trace.TraceInformation( "保存しました。({0})", str );
\r
2577 catch( Exception e )
\r
2579 Trace.TraceError( e.Message );
\r
2580 Trace.TraceError( "Config.ini の出力に失敗しました。({0})", str );
\r
2586 //---------------------
\r
2588 #region [ DTXVmodeの終了処理 ]
\r
2589 //---------------------
\r
2590 //Trace.TraceInformation( "DTXVモードの終了処理を行います。" );
\r
2594 if ( DTXVmode != null )
\r
2597 //Trace.TraceInformation( "DTXVモードの終了処理を完了しました。" );
\r
2601 //Trace.TraceInformation( "DTXVモードは使用されていません。" );
\r
2606 //Trace.Unindent();
\r
2608 //---------------------
\r
2610 Trace.TraceInformation( "アプリケーションの終了処理を完了しました。" );
\r
2613 this.b終了処理完了済み = true;
\r
2616 private CScoreIni tScoreIniへBGMAdjustとHistoryとPlayCountを更新(string str新ヒストリ行)
\r
2618 bool bIsUpdatedDrums, bIsUpdatedGuitar, bIsUpdatedBass;
\r
2619 string strFilename = DTX.strファイル名の絶対パス + ".score.ini";
\r
2620 CScoreIni ini = new CScoreIni( strFilename );
\r
2621 if( !File.Exists( strFilename ) )
\r
2623 ini.stファイル.Title = DTX.TITLE;
\r
2624 ini.stファイル.Name = DTX.strファイル名;
\r
2625 ini.stファイル.Hash = CScoreIni.tファイルのMD5を求めて返す( DTX.strファイル名の絶対パス );
\r
2626 for( int i = 0; i < 6; i++ )
\r
2628 ini.stセクション[ i ].nPerfectになる範囲ms = nPerfect範囲ms;
\r
2629 ini.stセクション[ i ].nGreatになる範囲ms = nGreat範囲ms;
\r
2630 ini.stセクション[ i ].nGoodになる範囲ms = nGood範囲ms;
\r
2631 ini.stセクション[ i ].nPoorになる範囲ms = nPoor範囲ms;
\r
2634 ini.stファイル.BGMAdjust = DTX.nBGMAdjust;
\r
2635 CScoreIni.t更新条件を取得する( out bIsUpdatedDrums, out bIsUpdatedGuitar, out bIsUpdatedBass );
\r
2636 if( bIsUpdatedDrums || bIsUpdatedGuitar || bIsUpdatedBass )
\r
2638 if( bIsUpdatedDrums )
\r
2640 ini.stファイル.PlayCountDrums++;
\r
2642 if( bIsUpdatedGuitar )
\r
2644 ini.stファイル.PlayCountGuitar++;
\r
2646 if( bIsUpdatedBass )
\r
2648 ini.stファイル.PlayCountBass++;
\r
2650 ini.tヒストリを追加する( str新ヒストリ行 );
\r
2653 stage選曲.r現在選択中のスコア.譜面情報.演奏回数.Drums = ini.stファイル.PlayCountDrums;
\r
2654 stage選曲.r現在選択中のスコア.譜面情報.演奏回数.Guitar = ini.stファイル.PlayCountGuitar;
\r
2655 stage選曲.r現在選択中のスコア.譜面情報.演奏回数.Bass = ini.stファイル.PlayCountBass;
\r
2656 for( int j = 0; j < ini.stファイル.History.Length; j++ )
\r
2658 stage選曲.r現在選択中のスコア.譜面情報.演奏履歴[ j ] = ini.stファイル.History[ j ];
\r
2662 if( ConfigIni.bScoreIniを出力する )
\r
2664 ini.t書き出し( strFilename );
\r
2669 private void tガベージコレクションを実行する()
\r
2672 GC.WaitForPendingFinalizers();
\r
2674 GC.WaitForPendingFinalizers();
\r
2676 private void tプラグイン検索と生成()
\r
2678 this.listプラグイン = new List<STPlugin>();
\r
2680 string strIPluginActivityの名前 = typeof( IPluginActivity ).FullName;
\r
2681 string strプラグインフォルダパス = strEXEのあるフォルダ + "Plugins\\";
\r
2683 this.t指定フォルダ内でのプラグイン検索と生成( strプラグインフォルダパス, strIPluginActivityの名前 );
\r
2685 if( this.listプラグイン.Count > 0 )
\r
2686 Trace.TraceInformation( this.listプラグイン.Count + " 個のプラグインを読み込みました。" );
\r
2688 #region [ Windowイベント処理 ]
\r
2689 private void t指定フォルダ内でのプラグイン検索と生成( string strプラグインフォルダパス, string strプラグイン型名 )
\r
2691 // 指定されたパスが存在しないとエラー
\r
2692 if( !Directory.Exists( strプラグインフォルダパス ) )
\r
2694 Trace.TraceWarning( "プラグインフォルダが存在しません。(" + strプラグインフォルダパス + ")" );
\r
2698 // (1) すべての *.dll について…
\r
2699 string[] strDLLs = System.IO.Directory.GetFiles( strプラグインフォルダパス, "*.dll" );
\r
2700 foreach( string dllName in strDLLs )
\r
2704 // (1-1) dll をアセンブリとして読み込む。
\r
2705 System.Reflection.Assembly asm = System.Reflection.Assembly.LoadFrom( dllName );
\r
2707 // (1-2) アセンブリ内のすべての型について、プラグインとして有効か調べる
\r
2708 foreach( Type t in asm.GetTypes() )
\r
2710 // (1-3) ↓クラスであり↓Publicであり↓抽象クラスでなく↓IPlugin型のインスタンスが作れる 型を持っていれば有効
\r
2711 if( t.IsClass && t.IsPublic && !t.IsAbstract && t.GetInterface( strプラグイン型名 ) != null )
\r
2713 // (1-4) クラス名からインスタンスを作成する
\r
2714 var st = new STPlugin() {
\r
2715 plugin = (IPluginActivity) asm.CreateInstance( t.FullName ),
\r
2716 strプラグインフォルダ = Path.GetDirectoryName( dllName ),
\r
2717 strアセンブリ簡易名 = asm.GetName().Name,
\r
2718 Version = asm.GetName().Version,
\r
2721 // (1-5) プラグインリストへ登録
\r
2722 this.listプラグイン.Add( st );
\r
2723 Trace.TraceInformation( "プラグイン {0} ({1}, {2}, {3}) を読み込みました。", t.FullName, Path.GetFileName( dllName ), st.strアセンブリ簡易名, st.Version.ToString() );
\r
2729 Trace.TraceInformation( dllName + " からプラグインを生成することに失敗しました。スキップします。" );
\r
2733 // (2) サブフォルダがあれば再帰する
\r
2734 string[] strDirs = Directory.GetDirectories( strプラグインフォルダパス, "*" );
\r
2735 foreach( string dir in strDirs )
\r
2736 this.t指定フォルダ内でのプラグイン検索と生成( dir + "\\", strプラグイン型名 );
\r
2738 //-----------------
\r
2739 private void Window_ApplicationActivated( object sender, EventArgs e )
\r
2741 this.bApplicationActive = true;
\r
2743 private void Window_ApplicationDeactivated( object sender, EventArgs e )
\r
2745 this.bApplicationActive = false;
\r
2747 private void Window_KeyDown( object sender, KeyEventArgs e )
\r
2749 if ( e.KeyCode == Keys.Menu )
\r
2752 e.SuppressKeyPress = true;
\r
2754 else if ( ( e.KeyCode == Keys.Return ) && e.Alt )
\r
2756 if ( ConfigIni != null )
\r
2758 ConfigIni.bウィンドウモード = !ConfigIni.bウィンドウモード;
\r
2759 this.t全画面・ウィンドウモード切り替え();
\r
2762 e.SuppressKeyPress = true;
\r
2766 for ( int i = 0; i < 0x10; i++ )
\r
2768 if ( ConfigIni.KeyAssign.System.Capture[ i ].コード > 0 &&
\r
2769 e.KeyCode == DeviceConstantConverter.KeyToKeyCode( (SlimDX.DirectInput.Key) ConfigIni.KeyAssign.System.Capture[ i ].コード ) )
\r
2771 // Debug.WriteLine( "capture: " + string.Format( "{0:2x}", (int) e.KeyCode ) + " " + (int) e.KeyCode );
\r
2772 string strFullPath =
\r
2773 Path.Combine( CDTXMania.strEXEのあるフォルダ, "Capture_img" );
\r
2774 strFullPath = Path.Combine( strFullPath, DateTime.Now.ToString( "yyyyMMddHHmmss" ) + ".png" );
\r
2775 SaveResultScreen( strFullPath );
\r
2780 private void Window_MouseUp( object sender, MouseEventArgs e )
\r
2785 private void Window_MouseDoubleClick( object sender, MouseEventArgs e) // #23510 2010.11.13 yyagi: to go full screen mode
\r
2787 if ( mb.Equals(MouseButtons.Left) && ConfigIni.bIsAllowedDoubleClickFullscreen ) // #26752 2011.11.27 yyagi
\r
2789 ConfigIni.bウィンドウモード = false;
\r
2790 this.t全画面・ウィンドウモード切り替え();
\r
2793 private void Window_ResizeEnd(object sender, EventArgs e) // #23510 2010.11.20 yyagi: to get resized window size
\r
2795 if ( ConfigIni.bウィンドウモード )
\r
2797 ConfigIni.n初期ウィンドウ開始位置X = base.Window.Location.X; // #30675 2013.02.04 ikanick add
\r
2798 ConfigIni.n初期ウィンドウ開始位置Y = base.Window.Location.Y; //
\r
2801 ConfigIni.nウインドウwidth = (ConfigIni.bウィンドウモード) ? base.Window.ClientSize.Width : currentClientSize.Width; // #23510 2010.10.31 yyagi add
\r
2802 ConfigIni.nウインドウheight = (ConfigIni.bウィンドウモード) ? base.Window.ClientSize.Height : currentClientSize.Height;
\r
2806 //internal sealed class GCBeep // GC発生の度にbeep
\r
2810 // Console.Beep();
\r
2811 // if ( !AppDomain.CurrentDomain.IsFinalizingForUnload()
\r
2812 // && !Environment.HasShutdownStarted )
\r
2819 //-----------------
\r
2821 //Stopwatch sw = new Stopwatch();
\r
2822 //List<int> swlist1, swlist2, swlist3, swlist4, swlist5;
\r