Develop and Download Open Source Software

Browse Subversion Repository

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 425 - (show annotations) (download)
Wed Dec 31 09:08:19 2014 UTC (9 years, 3 months ago) by kairera0467
File size: 103902 byte(s)
#xxxxx アセンブリバージョンの更新。
#xxxxx エクセレント、フルコンボ時のエフェクトを強化。
#xxxxx 一部画像の更新。
1 using System;
2 using System.Collections.Generic;
3 using System.Globalization;
4 using System.Text;
5 using System.Windows.Forms;
6 using System.Drawing;
7 using System.Diagnostics;
8 using System.Runtime.InteropServices;
9 using System.IO;
10 using System.Threading;
11 using System.Runtime.Serialization.Formatters.Binary;
12 using SlimDX;
13 using SlimDX.Direct3D9;
14 using FDK;
15 using SampleFramework;
16 using DTXMania.Properties;
17 using System.Reflection;
18 using DirectShowLib;
19
20 namespace DTXMania
21 {
22 internal class CDTXMania : Game
23 {
24 // プロパティ
25
26 public static readonly string VERSION = "Ver3.30(141231)";
27 public static readonly string SLIMDXDLL = "c_net20x86_Jun2010";
28 public static readonly string D3DXDLL = "d3dx9_43.dll"; // June 2010
29 //public static readonly string D3DXDLL = "d3dx9_42.dll"; // February 2010
30 //public static readonly string D3DXDLL = "d3dx9_41.dll"; // March 2009
31
32 public static CDTXMania app
33 {
34 get;
35 private set;
36 }
37 public static Folder Folder
38 {
39 get;
40 protected set;
41 }
42 public static CApp App
43 {
44 get;
45 private set;
46 }
47 public static C文字コンソ act文字コンソ
48 {
49 get;
50 private set;
51 }
52 public static bool bコンパクトモ
53 {
54 get;
55 private set;
56 }
57 public static CConfigIni ConfigIni
58 {
59 get;
60 private set;
61 }
62 public static CDTX DTX
63 {
64 get
65 {
66 return dtx;
67 }
68 set
69 {
70 if( ( dtx != null ) && ( app != null ) )
71 {
72 dtx.On非活性化();
73 app.listトップレベルActivities.Remove( dtx );
74 }
75 dtx = value;
76 if( ( dtx != null ) && ( app != null ) )
77 {
78 app.listトップレベルActivities.Add( dtx );
79 }
80 }
81 }
82 public static CFPS FPS
83 {
84 get;
85 private set;
86 }
87 public static CInput管理 Input管理
88 {
89 get;
90 private set;
91 }
92 public static int nSongDifficulty
93 {
94 get;
95 set;
96 }
97
98 public static string strSongDifficulyName
99 {
100 get;
101 set;
102 }
103 #region [ 入力範囲ms ]
104 public static int nPerfect範囲ms
105 {
106 get
107 {
108 if( stage選曲.r確定された曲 != null )
109 {
110 C曲リストノ c曲リストノ = stage選曲.r確定された曲.r親ノ;
111 if( ( ( c曲リストノ != null ) && ( c曲リストノ.eド種別 == C曲リストノ.Eド種別.BOX ) ) && ( c曲リストノ.nPerfect範囲ms >= 0 ) )
112 {
113 return c曲リストノ.nPerfect範囲ms;
114 }
115 }
116 return ConfigIni.nヒット範囲ms.Perfect;
117 }
118 }
119 public static int nGreat範囲ms
120 {
121 get
122 {
123 if( stage選曲.r確定された曲 != null )
124 {
125 C曲リストノ c曲リストノ = stage選曲.r確定された曲.r親ノ;
126 if( ( ( c曲リストノ != null ) && ( c曲リストノ.eド種別 == C曲リストノ.Eド種別.BOX ) ) && ( c曲リストノ.nGreat範囲ms >= 0 ) )
127 {
128 return c曲リストノ.nGreat範囲ms;
129 }
130 }
131 return ConfigIni.nヒット範囲ms.Great;
132 }
133 }
134 public static int nGood範囲ms
135 {
136 get
137 {
138 if( stage選曲.r確定された曲 != null )
139 {
140 C曲リストノ c曲リストノ = stage選曲.r確定された曲.r親ノ;
141 if( ( ( c曲リストノ != null ) && ( c曲リストノ.eド種別 == C曲リストノ.Eド種別.BOX ) ) && ( c曲リストノ.nGood範囲ms >= 0 ) )
142 {
143 return c曲リストノ.nGood範囲ms;
144 }
145 }
146 return ConfigIni.nヒット範囲ms.Good;
147 }
148 }
149 public static int nPoor範囲ms
150 {
151 get
152 {
153 if( stage選曲.r確定された曲 != null )
154 {
155 C曲リストノ c曲リストノ = stage選曲.r確定された曲.r親ノ;
156 if( ( ( c曲リストノ != null ) && ( c曲リストノ.eド種別 == C曲リストノ.Eド種別.BOX ) ) && ( c曲リストノ.nPoor範囲ms >= 0 ) )
157 {
158 return c曲リストノ.nPoor範囲ms;
159 }
160 }
161 return ConfigIni.nヒット範囲ms.Poor;
162 }
163 }
164 #endregion
165 public static CPad Pad
166 {
167 get;
168 private set;
169 }
170 public static Random Random
171 {
172 get;
173 private set;
174 }
175 public static CSkin Skin
176 {
177 get;
178 private set;
179 }
180 public static CSongs管理 Songs管理
181 {
182 get;
183 set; // 2012.1.26 yyagi private解除 CStage起動でのdesirialize読み込みのため
184 }
185 public static CEnumSongs EnumSongs
186 {
187 get;
188 private set;
189 }
190 public static CActEnumSongs actEnumSongs
191 {
192 get;
193 private set;
194 }
195 public static CActFlushGPU actFlushGPU
196 {
197 get;
198 private set;
199 }
200 public static CSound管理 Sound管理
201 {
202 get;
203 private set;
204 }
205 public static CStage起動 stage起動
206 {
207 get;
208 private set;
209 }
210 public static CStageタイトル stageタイトル
211 {
212 get;
213 private set;
214 }
215 public static CStageオプション stageオプション
216 {
217 get;
218 private set;
219 }
220 public static CStageコンフィグ stageコンフィグ
221 {
222 get;
223 private set;
224 }
225 public static CStage選曲 stage選曲
226 {
227 get;
228 private set;
229 }
230 public static CStage曲読み込み stage曲読み込み
231 {
232 get;
233 private set;
234 }
235 public static CStage演奏ギタ画面 stage演奏ギタ画面
236 {
237 get;
238 private set;
239 }
240 public static CStage演奏ドラム画面 stage演奏ドラム画面
241 {
242 get;
243 private set;
244 }
245 public static CStage演奏画面共通 stage演奏画面共通
246 {
247 get;
248 private set;
249 }
250 public static CStage結果 stage結果
251 {
252 get;
253 private set;
254 }
255 public static CStageChangeSkin stageChangeSkin
256 {
257 get;
258 private set;
259 }
260 public static CStage終了 stage終了
261 {
262 get;
263 private set;
264 }
265 public static CStage r現在のステ = null;
266 public static CStage r直前のステ = null;
267 public bool b汎用ムである = false;
268 public static string strEXEのあるフォルダ
269 {
270 get;
271 private set;
272 }
273 public static string strコンパクトモドファイル
274 {
275 get;
276 private set;
277 }
278 public static CTimer Timer
279 {
280 get;
281 private set;
282 }
283 public static Format TextureFormat = Format.A8R8G8B8;
284 internal static IPluginActivity act現在入力を占有中のプラグイン = null;
285 public bool bApplicationActive
286 {
287 get;
288 private set;
289 }
290 public bool b次のタイミングで垂直帰線同期切り替えを行う
291 {
292 get;
293 set;
294 }
295 public bool b次のタイミングで全画面・ウィンドウ切り替えを行う
296 {
297 get;
298 set;
299 }
300
301 public Device Device
302 {
303 get { return base.GraphicsDeviceManager.Direct3D9.Device; }
304 }
305 public CPluginHost PluginHost
306 {
307 get;
308 private set;
309 }
310 public List<STPlugin> listプラグイン = new List<STPlugin>();
311 public struct STPlugin
312 {
313 public IPluginActivity plugin;
314 public string strプラグインフォルダ;
315 public string strアセンブリ簡易名;
316 public Version Version;
317 }
318 private static Size currentClientSize // #23510 2010.10.27 add yyagi to keep current window size
319 {
320 get;
321 set;
322 }
323 // public static CTimer ct;
324 public IntPtr WindowHandle // 2012.10.24 yyagi; to add ASIO support
325 {
326 get { return base.Window.Handle; }
327 }
328 public static CDTXVmode DTXVmode // #28821 2014.1.23 yyagi
329 {
330 get;
331 set;
332 }
333
334 // コンストラクタ
335
336 public CDTXMania()
337 {
338 CDTXMania.app = this;
339 this.t起動処理();
340 }
341
342
343 // メソッド
344
345 public void t全画面・ウィンドウモド切り替え()
346 {
347 #if WindowedFullscreen
348 if ( ConfigIni != null )
349 #else
350 DeviceSettings settings = base.GraphicsDeviceManager.CurrentSettings.Clone();
351 if ( ( ConfigIni != null ) && ( ConfigIni.bウィンドウモ != settings.Windowed ) )
352 #endif
353 {
354 #if !WindowedFullscreen
355 settings.Windowed = ConfigIni.bウィンドウモ;
356 #endif
357 if ( ConfigIni.bウィンドウモ == false ) // #23510 2010.10.27 yyagi: backup current window size before going fullscreen mode
358 {
359 currentClientSize = this.Window.ClientSize;
360 ConfigIni.nウインドウwidth = this.Window.ClientSize.Width;
361 ConfigIni.nウインドウheight = this.Window.ClientSize.Height;
362 // FDK.CTaskBar.ShowTaskBar( false );
363 }
364 #if !WindowedFullscreen
365 base.GraphicsDeviceManager.ChangeDevice( settings );
366 #endif
367 if ( ConfigIni.bウィンドウモ == true ) // #23510 2010.10.27 yyagi: to resume window size from backuped value
368 {
369 #if WindowedFullscreen
370 // #30666 2013.2.2 yyagi Don't use Fullscreen mode becasue NVIDIA GeForce is
371 // tend to delay drawing on Fullscreen mode. So DTXMania uses Maximized window
372 // in spite of using fullscreen mode.
373 app.Window.WindowState = FormWindowState.Normal;
374 app.Window.FormBorderStyle = FormBorderStyle.Sizable;
375 app.Window.WindowState = FormWindowState.Normal;
376 #endif
377 base.Window.ClientSize =
378 new Size( currentClientSize.Width, currentClientSize.Height );
379 // FDK.CTaskBar.ShowTaskBar( true );
380 }
381 #if WindowedFullscreen
382 else
383 {
384 app.Window.WindowState = FormWindowState.Normal;
385 app.Window.FormBorderStyle = FormBorderStyle.None;
386 app.Window.WindowState = FormWindowState.Maximized;
387 }
388 if ( ConfigIni.bウィンドウモ )
389 {
390 if ( !this.bマウスカソル表示中 )
391 {
392 Cursor.Show();
393 this.bマウスカソル表示中 = true;
394 }
395 }
396 else if ( this.bマウスカソル表示中 )
397 {
398 Cursor.Hide();
399 this.bマウスカソル表示中 = false;
400 }
401 #endif
402 }
403 }
404
405
406 #region [ #24609 リザルト画像をpngで保存する ] // #24609 2011.3.14 yyagi; to save result screen in case BestRank or HiSkill.
407 /// <summary>
408 /// リザルト画像のキャプチャと保存。
409 /// </summary>
410 /// <param name="strFilename">保存するファイル名(フルパス)</param>
411 public bool SaveResultScreen( string strFullPath )
412 {
413 string strSavePath = Path.GetDirectoryName( strFullPath );
414 if ( !Directory.Exists( strSavePath ) )
415 {
416 try
417 {
418 Directory.CreateDirectory( strSavePath );
419 }
420 catch
421 {
422 return false;
423 }
424 }
425
426 // http://www.gamedev.net/topic/594369-dx9slimdxati-incorrect-saving-surface-to-file/
427 using ( Surface pSurface = CDTXMania.app.Device.GetRenderTarget( 0 ) )
428 {
429 Surface.ToFile( pSurface, strFullPath, ImageFileFormat.Png );
430 }
431 return true;
432 }
433 #endregion
434
435 // Game 実装
436 protected override void Initialize()
437 {
438 // new GCBeep();
439 sw.Start();
440 swlist = new List<double>( 8192 );
441 if( this.listトップレベルActivities != null )
442 {
443 foreach (CActivity activity in this.listトップレベルActivities)
444 {
445 activity.OnManagedリソスの作成();
446 }
447 }
448
449 foreach( STPlugin st in this.listプラグイン )
450 {
451 Directory.SetCurrentDirectory( st.strプラグインフォルダ );
452 st.plugin.OnManagedリソスの作成();
453 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
454 }
455 #if GPUFlushAfterPresent
456 FrameEnd += dtxmania_FrameEnd;
457 #endif
458 }
459 #if GPUFlushAfterPresent
460 void dtxmania_FrameEnd( object sender, EventArgs e ) // GraphicsDeviceManager.game_FrameEnd()後に実行される
461 { // → Present()直後にGPUをFlushする
462 // → 画面のカクツキが頻発したため、ここでのFlushは行わない
463 actFlushGPU.On進行描画(); // Flush GPU
464 }
465 #endif
466 protected override void LoadContent()
467 {
468 if ( ConfigIni.bウィンドウモ )
469 {
470 if( !this.bマウスカソル表示中 )
471 {
472 Cursor.Show();
473 this.bマウスカソル表示中 = true;
474 }
475 }
476 else if( this.bマウスカソル表示中 )
477 {
478 Cursor.Hide();
479 this.bマウスカソル表示中 = false;
480 }
481 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)));
482 this.Device.SetTransform(TransformState.Projection, Matrix.PerspectiveFovLH(C変換.DegreeToRadian((float)60f), ((float)this.Device.Viewport.Width) / ((float)this.Device.Viewport.Height), -100f, 100f));
483 this.Device.SetRenderState( RenderState.Lighting, false );
484 this.Device.SetRenderState( RenderState.ZEnable, false );
485 this.Device.SetRenderState( RenderState.AntialiasedLineEnable, false );
486 this.Device.SetRenderState( RenderState.AlphaTestEnable, true );
487 this.Device.SetRenderState( RenderState.AlphaRef, 10 );
488
489 if (CDTXMania.ConfigIni.b縮小文字のアンチエイリアスを有効にする == true)
490 {
491 this.Device.SetRenderState(RenderState.MultisampleAntialias, true);
492 this.Device.SetSamplerState(0, SamplerState.MinFilter, TextureFilter.Linear);
493 this.Device.SetSamplerState(0, SamplerState.MagFilter, TextureFilter.Linear);
494 }
495
496 this.Device.SetRenderState<Compare>(RenderState.AlphaFunc, Compare.Greater);
497 this.Device.SetRenderState(RenderState.AlphaBlendEnable, true);
498 this.Device.SetRenderState<Blend>(RenderState.SourceBlend, Blend.SourceAlpha);
499 this.Device.SetRenderState<Blend>(RenderState.DestinationBlend, Blend.InverseSourceAlpha);
500 this.Device.SetTextureStageState(0, TextureStage.AlphaOperation, TextureOperation.Modulate);
501 this.Device.SetTextureStageState(0, TextureStage.AlphaArg1, 2);
502 this.Device.SetTextureStageState(0, TextureStage.AlphaArg2, 1);
503
504 if( this.listトップレベルActivities != null )
505 {
506 foreach( CActivity activity in this.listトップレベルActivities )
507 activity.OnUnmanagedリソスの作成();
508 }
509
510 foreach( STPlugin st in this.listプラグイン )
511 {
512 Directory.SetCurrentDirectory( st.strプラグインフォルダ );
513 st.plugin.OnUnmanagedリソスの作成();
514 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
515 }
516
517 }
518 protected override void UnloadContent()
519 {
520 if( this.listトップレベルActivities != null )
521 {
522 foreach( CActivity activity in this.listトップレベルActivities )
523 activity.OnUnmanagedリソスの解放();
524 }
525
526 foreach( STPlugin st in this.listプラグイン )
527 {
528 Directory.SetCurrentDirectory( st.strプラグインフォルダ );
529 st.plugin.OnUnmanagedリソスの解放();
530 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
531 }
532 }
533 protected override void OnExiting( EventArgs e )
534 {
535 CPowerManagement.tEnableMonitorSuspend(); // スリープ抑止状態を解除
536 this.t終了処理();
537 base.OnExiting( e );
538 }
539 protected override void Update( GameTime gameTime )
540 {
541 }
542 protected override void Draw( GameTime gameTime )
543 {
544 Sound管理.t再生中の処理をする();
545
546 if( Timer != null )
547 Timer.t更新();
548
549 if ( CSound管理.rc演奏用タイマ != null )
550 CSound管理.rc演奏用タイマ.t更新();
551
552 if( Input管理 != null )
553 Input管理.tリング( this.bApplicationActive, CDTXMania.ConfigIni.bバッファ入力を行う );
554
555 if( FPS != null )
556 FPS.tカウンタ更新();
557
558 //if( Pad != null ) ポーリング時にクリアしたらダメ!曲の開始時に1回だけクリアする。(2010.9.11)
559 // Pad.st検知したデバイス.Clear();
560
561 if( this.Device == null )
562 return;
563
564 if (this.bApplicationActive) // DTXMania本体起動中の本体/モニタの省電力モード移行を抑止
565 CPowerManagement.tDisableMonitorSuspend();
566
567 // #xxxxx 2013.4.8 yyagi; sleepの挿入位置を、EndScnene~Present間から、BeginScene前に移動。描画遅延を小さくするため。
568 #region [ スリープ ]
569 if ( ConfigIni.nフレム毎スリms >= 0 ) // #xxxxx 2011.11.27 yyagi
570 {
571 Thread.Sleep( ConfigIni.nフレム毎スリms );
572 }
573 #endregion
574
575 #region [ DTXCreatorからの指示 ]
576 if ( this.Window.IsReceivedMessage ) // ウインドウメッセージで、
577 {
578 string strMes = this.Window.strMessage;
579 this.Window.IsReceivedMessage = false;
580
581 if ( strMes != null )
582 {
583 DTXVmode.ParseArguments( strMes );
584
585 if ( DTXVmode.Enabled )
586 {
587 bコンパクトモ = true;
588 strコンパクトモドファイル = DTXVmode.filename;
589 if ( DTXVmode.Command == CDTXVmode.ECommand.Preview )
590 {
591 // preview soundの再生
592 string strPreviewFilename = DTXVmode.previewFilename;
593 //Trace.TraceInformation( "Preview Filename=" + DTXVmode.previewFilename );
594 try
595 {
596 if ( this.previewSound != null )
597 {
598 this.previewSound.tサウンドを停止する();
599 this.previewSound.Dispose();
600 this.previewSound = null;
601 }
602 this.previewSound = CDTXMania.Sound管理.tサウンドを生成する( strPreviewFilename );
603 this.previewSound.n音量 = DTXVmode.previewVolume;
604 this.previewSound.n位置 = DTXVmode.previewPan;
605 this.previewSound.t再生を開始する();
606 Trace.TraceInformation( "DTXCからの指示で、サウンドを生成しました。({0})", strPreviewFilename );
607 }
608 catch
609 {
610 Trace.TraceError( "DTXCからの指示での、サウンドの生成に失敗しました。({0})", strPreviewFilename );
611 if ( this.previewSound != null )
612 {
613 this.previewSound.Dispose();
614 }
615 this.previewSound = null;
616 }
617 }
618 }
619 }
620 }
621 #endregion
622
623 this.Device.BeginScene();
624 this.Device.Clear(ClearFlags.ZBuffer | ClearFlags.Target, Color.Black, 1f, 0);
625
626 if( r現在のステ != null )
627 {
628 this.n進行描画の戻り値 = ( r現在のステ != null ) ? r現在のステ.On進行描画() : 0;
629
630 #region [ プラグインの進行描画 ]
631 //---------------------
632 foreach( STPlugin sp in this.listプラグイン )
633 {
634 Directory.SetCurrentDirectory( sp.strプラグインフォルダ );
635
636 if( CDTXMania.act現在入力を占有中のプラグイン == null || CDTXMania.act現在入力を占有中のプラグイン == sp.plugin )
637 sp.plugin.On進行描画( CDTXMania.Pad, CDTXMania.Input管理.Keyboard );
638 else
639 sp.plugin.On進行描画( null, null );
640
641 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
642 }
643 //---------------------
644 #endregion
645
646
647 CScoreIni scoreIni = null;
648
649 if( Control.IsKeyLocked( Keys.CapsLock ) ) // #30925 2013.3.11 yyagi; capslock=ON時は、EnumSongsしないようにして、起動負荷とASIOの音切れの関係を確認する
650 { // → songs.db等の書き込み時だと音切れするっぽい
651 actEnumSongs.On非活性化();
652 EnumSongs.SongListEnumCompletelyDone();
653 CDTXMania.stage選曲.bIsEnumeratingSongs = false;
654 }
655 #region [ 曲検索スレッドの起動/終了 ] // ここに"Enumerating Songs..."表示を集約
656 if (!CDTXMania.bコンパクトモ)
657 {
658 actEnumSongs.On進行描画(); // "Enumerating Songs..."アイコンの描画
659 } // "Enumerating Songs..."アイコンの描画
660 switch ( r現在のステ.eステID )
661 {
662 case CStage.Eステ.タイトル:
663 case CStage.Eステ.コンフィグ:
664 case CStage.Eステ.オプション:
665 case CStage.Eステ.選曲:
666 case CStage.Eステ.曲読み込み:
667 if ( EnumSongs != null )
668 {
669 DTXVmode.Refreshed = false; // 曲のリロード中に発生した再リロードは、無視する。
670 #region [ (特定条件時) 曲検索スレッドの起動・開始 ]
671 if ( r現在のステ.eステID == CStage.Eステ.タイトル &&
672 r直前のステ.eステID == CStage.Eステ.起動 &&
673 this.n進行描画の戻り値 == (int) CStageタイトル.E戻り値.継続 &&
674 !EnumSongs.IsSongListEnumStarted )
675 {
676 actEnumSongs.On活性化();
677 CDTXMania.stage選曲.bIsEnumeratingSongs = true;
678 EnumSongs.Init( CDTXMania.Songs管理.listSongsDB, CDTXMania.Songs管理.nSongsDBから取得できたスコア数 ); // songs.db情報と、取得した曲数を、新インスタンスにも与える
679 EnumSongs.StartEnumFromDisk(); // 曲検索スレッドの起動・開始
680 if ( CDTXMania.Songs管理.nSongsDBから取得できたスコア数 == 0 ) // もし初回起動なら、検索スレッドのプライオリティをLowestでなくNormalにする
681 {
682 EnumSongs.ChangeEnumeratePriority( ThreadPriority.Normal );
683 }
684 }
685 #endregion
686
687 #region [ 曲検索の中断と再開 ]
688 if ( r現在のステ.eステID == CStage.Eステ.選曲 && !EnumSongs.IsSongListEnumCompletelyDone )
689 {
690 switch ( this.n進行描画の戻り値 )
691 {
692 case 0: // 何もない
693 //if ( CDTXMania.stage選曲.bIsEnumeratingSongs )
694 if ( !CDTXMania.stage選曲.bIsPlayingPremovie || CDTXMania.Skin.ds選曲画面背景動画 != null )
695 {
696 EnumSongs.Resume(); // #27060 2012.2.6 yyagi 中止していたバックグランド曲検索を再開
697 EnumSongs.IsSlowdown = false;
698 }
699 else
700 {
701 // EnumSongs.Suspend(); // #27060 2012.3.2 yyagi #PREMOVIE再生中は曲検索を低速化
702 EnumSongs.IsSlowdown = true;
703 }
704 actEnumSongs.On活性化();
705 break;
706
707 case 2: // 曲決定
708 EnumSongs.Suspend(); // #27060 バックグラウンドの曲検索を一時停止
709 actEnumSongs.On非活性化();
710 break;
711 }
712 }
713 #endregion
714
715 #region [ 曲探索中断待ち待機 ]
716 if ( r現在のステ.eステID == CStage.Eステ.曲読み込み && !EnumSongs.IsSongListEnumCompletelyDone &&
717 EnumSongs.thDTXFileEnumerate != null ) // #28700 2012.6.12 yyagi; at Compact mode, enumerating thread does not exist.
718 {
719 EnumSongs.WaitUntilSuspended(); // 念のため、曲検索が一時中断されるまで待機
720 }
721 #endregion
722
723 #region [ 曲検索が完了したら、実際の曲リストに反映する ]
724 // CStage選曲.On活性化() に回した方がいいかな?
725 if ( EnumSongs.IsSongListEnumerated )
726 {
727 actEnumSongs.On非活性化();
728 CDTXMania.stage選曲.bIsEnumeratingSongs = false;
729
730 bool bRemakeSongTitleBar = ( r現在のステ.eステID == CStage.Eステ.選曲 ) ? true : false;
731 CDTXMania.stage選曲.Refresh( EnumSongs.Songs管理, bRemakeSongTitleBar );
732 EnumSongs.SongListEnumCompletelyDone();
733 }
734 #endregion
735 }
736 break;
737 }
738 #endregion
739
740 switch ( r現在のステ.eステID )
741 {
742 case CStage.Eステ.何もしない:
743 break;
744
745 case CStage.Eステ.起動:
746 #region [ *** ]
747 //-----------------------------
748 if( this.n進行描画の戻り値 != 0 )
749 {
750 if( !bコンパクトモ )
751 {
752 r現在のステ.On非活性化();
753 Trace.TraceInformation( "----------------------" );
754 Trace.TraceInformation( "■ タイトル" );
755 stageタイトル.On活性化();
756 r直前のステ = r現在のステ;
757 r現在のステ = stageタイトル;
758 }
759 else
760 {
761 r現在のステ.On非活性化();
762 Trace.TraceInformation( "----------------------" );
763 Trace.TraceInformation( "■ 曲読み込み" );
764 stage曲読み込み.On活性化();
765 r直前のステ = r現在のステ;
766 r現在のステ = stage曲読み込み;
767
768 }
769 foreach( STPlugin pg in this.listプラグイン )
770 {
771 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
772 pg.plugin.Onステジ変更();
773 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
774 }
775
776 this.tガベジコレクションを実行する();
777 }
778 //-----------------------------
779 #endregion
780 break;
781
782 case CStage.Eステ.タイトル:
783 #region [ *** ]
784 //-----------------------------
785 switch( this.n進行描画の戻り値 )
786 {
787 case (int)CStageタイトル.E戻り値.GAMESTART:
788 #region [ 選曲処理へ ]
789 //-----------------------------
790 r現在のステ.On非活性化();
791 Trace.TraceInformation( "----------------------" );
792 Trace.TraceInformation( "■ 選曲" );
793 stage選曲.On活性化();
794 r直前のステ = r現在のステ;
795 r現在のステ = stage選曲;
796 //-----------------------------
797 #endregion
798 break;
799
800 #region [ OPTION: 廃止済 ]
801 /*
802 case 2: // #24525 OPTIONとCONFIGの統合に伴い、OPTIONは廃止
803 #region [ *** ]
804 //-----------------------------
805 r現在のステージ.On非活性化();
806 Trace.TraceInformation( "----------------------" );
807 Trace.TraceInformation( "■ オプション" );
808 stageオプション.On活性化();
809 r直前のステージ = r現在のステージ;
810 r現在のステージ = stageオプション;
811 //-----------------------------
812 #endregion
813 break;
814 */
815 #endregion
816
817 case (int)CStageタイトル.E戻り値.CONFIG:
818 #region [ *** ]
819 //-----------------------------
820 r現在のステ.On非活性化();
821 Trace.TraceInformation( "----------------------" );
822 Trace.TraceInformation( "■ コンフィグ" );
823 stageコンフィグ.On活性化();
824 r直前のステ = r現在のステ;
825 r現在のステ = stageコンフィグ;
826 //-----------------------------
827 #endregion
828 break;
829
830 case (int)CStageタイトル.E戻り値.EXIT:
831 #region [ *** ]
832 //-----------------------------
833 r現在のステ.On非活性化();
834 Trace.TraceInformation( "----------------------" );
835 Trace.TraceInformation( "■ 終了" );
836 stage終了.On活性化();
837 r直前のステ = r現在のステ;
838 r現在のステ = stage終了;
839 //-----------------------------
840 #endregion
841 break;
842 }
843
844 foreach( STPlugin pg in this.listプラグイン )
845 {
846 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
847 pg.plugin.Onステジ変更();
848 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
849 }
850
851 //this.tガベージコレクションを実行する(); // #31980 2013.9.3 yyagi タイトル画面でだけ、毎フレームGCを実行して重くなっていた問題の修正
852 //-----------------------------
853 #endregion
854 break;
855
856
857 case CStage.Eステ.オプション:
858 #region [ *** ]
859 //-----------------------------
860 if( this.n進行描画の戻り値 != 0 )
861 {
862 switch( r直前のステ.eステID )
863 {
864 case CStage.Eステ.タイトル:
865 #region [ *** ]
866 //-----------------------------
867 r現在のステ.On非活性化();
868 Trace.TraceInformation( "----------------------" );
869 Trace.TraceInformation( "■ タイトル" );
870 stageタイトル.On活性化();
871 r直前のステ = r現在のステ;
872 r現在のステ = stageタイトル;
873
874 foreach( STPlugin pg in this.listプラグイン )
875 {
876 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
877 pg.plugin.Onステジ変更();
878 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
879 }
880
881 this.tガベジコレクションを実行する();
882 break;
883 //-----------------------------
884 #endregion
885
886 case CStage.Eステ.選曲:
887 #region [ *** ]
888 //-----------------------------
889 r現在のステ.On非活性化();
890 Trace.TraceInformation( "----------------------" );
891 Trace.TraceInformation( "■ 選曲" );
892 stage選曲.On活性化();
893 r直前のステ = r現在のステ;
894 r現在のステ = stage選曲;
895
896 foreach( STPlugin pg in this.listプラグイン )
897 {
898 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
899 pg.plugin.Onステジ変更();
900 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
901 }
902
903 this.tガベジコレクションを実行する();
904 break;
905 //-----------------------------
906 #endregion
907 }
908 }
909 //-----------------------------
910 #endregion
911 break;
912
913
914 case CStage.Eステ.コンフィグ:
915 #region [ *** ]
916 //-----------------------------
917 if( this.n進行描画の戻り値 != 0 )
918 {
919 switch( r直前のステ.eステID )
920 {
921 case CStage.Eステ.タイトル:
922 #region [ *** ]
923 //-----------------------------
924 r現在のステ.On非活性化();
925 Trace.TraceInformation( "----------------------" );
926 Trace.TraceInformation( "■ タイトル" );
927 stageタイトル.On活性化();
928 r直前のステ = r現在のステ;
929 r現在のステ = stageタイトル;
930
931 foreach( STPlugin pg in this.listプラグイン )
932 {
933 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
934 pg.plugin.Onステジ変更();
935 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
936 }
937
938 this.tガベジコレクションを実行する();
939 break;
940 //-----------------------------
941 #endregion
942
943 case CStage.Eステ.選曲:
944 #region [ *** ]
945 //-----------------------------
946 r現在のステ.On非活性化();
947 Trace.TraceInformation( "----------------------" );
948 Trace.TraceInformation( "■ 選曲" );
949 stage選曲.On活性化();
950 r直前のステ = r現在のステ;
951 r現在のステ = stage選曲;
952
953 foreach( STPlugin pg in this.listプラグイン )
954 {
955 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
956 pg.plugin.Onステジ変更();
957 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
958 }
959
960 this.tガベジコレクションを実行する();
961 break;
962 //-----------------------------
963 #endregion
964 }
965 }
966 //-----------------------------
967 #endregion
968 break;
969
970 case CStage.Eステ.選曲:
971 #region [ *** ]
972 //-----------------------------
973 switch( this.n進行描画の戻り値 )
974 {
975 case (int) CStage選曲.E戻り値.タイトルに戻る:
976 #region [ *** ]
977 //-----------------------------
978 r現在のステ.On非活性化();
979 Trace.TraceInformation( "----------------------" );
980 Trace.TraceInformation( "■ タイトル" );
981 stageタイトル.On活性化();
982 r直前のステ = r現在のステ;
983 r現在のステ = stageタイトル;
984
985 foreach( STPlugin pg in this.listプラグイン )
986 {
987 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
988 pg.plugin.Onステジ変更();
989 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
990 }
991
992 this.tガベジコレクションを実行する();
993 break;
994 //-----------------------------
995 #endregion
996
997 case (int) CStage選曲.E戻り値.選曲した:
998 #region [ *** ]
999 //-----------------------------
1000 r現在のステ.On非活性化();
1001 Trace.TraceInformation( "----------------------" );
1002 Trace.TraceInformation( "■ 曲読み込み" );
1003 stage曲読み込み.On活性化();
1004 r直前のステ = r現在のステ;
1005 r現在のステ = stage曲読み込み;
1006
1007 foreach( STPlugin pg in this.listプラグイン )
1008 {
1009 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
1010 pg.plugin.Onステジ変更();
1011 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
1012 }
1013
1014 this.tガベジコレクションを実行する();
1015 break;
1016 //-----------------------------
1017 #endregion
1018
1019
1020 case (int) CStage選曲.E戻り値.オプション呼び出し:
1021 #region [ *** ]
1022 //-----------------------------
1023
1024 r現在のステ.On非活性化();
1025 Trace.TraceInformation( "----------------------" );
1026 Trace.TraceInformation( "■ オプション" );
1027 stageオプション.On活性化();
1028 r直前のステ = r現在のステ;
1029 r現在のステ = stageオプション;
1030
1031 foreach( STPlugin pg in this.listプラグイン )
1032 {
1033 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
1034 pg.plugin.Onステジ変更();
1035 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
1036 }
1037
1038 this.tガベジコレクションを実行する();
1039 break;
1040 //-----------------------------
1041 #endregion
1042
1043 case (int) CStage選曲.E戻り値.コンフィグ呼び出し:
1044 #region [ *** ]
1045 //-----------------------------
1046 r現在のステ.On非活性化();
1047 Trace.TraceInformation( "----------------------" );
1048 Trace.TraceInformation( "■ コンフィグ" );
1049 stageコンフィグ.On活性化();
1050 r直前のステ = r現在のステ;
1051 r現在のステ = stageコンフィグ;
1052
1053 foreach( STPlugin pg in this.listプラグイン )
1054 {
1055 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
1056 pg.plugin.Onステジ変更();
1057 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
1058 }
1059
1060 this.tガベジコレクションを実行する();
1061 break;
1062 //-----------------------------
1063 #endregion
1064
1065 case (int) CStage選曲.E戻り値.スキン変更:
1066
1067 #region [ *** ]
1068 //-----------------------------
1069 r現在のステ.On非活性化();
1070 Trace.TraceInformation( "----------------------" );
1071 Trace.TraceInformation( "■ スキン切り替え" );
1072 stageChangeSkin.On活性化();
1073 r直前のステ = r現在のステ;
1074 r現在のステ = stageChangeSkin;
1075 break;
1076 //-----------------------------
1077 #endregion
1078 }
1079 //-----------------------------
1080 #endregion
1081 break;
1082
1083 case CStage.Eステ.曲読み込み:
1084 #region [ *** ]
1085 //-----------------------------
1086 if( this.n進行描画の戻り値 != 0 )
1087 {
1088 CDTXMania.Pad.st検知したデバイス.Clear(); // 入力デバイスフラグクリア(2010.9.11)
1089
1090 r現在のステ.On非活性化();
1091
1092 #region [ ESC押下時は、曲の読み込みを中止して選曲画面に戻る ]
1093 if ( this.n進行描画の戻り値 == (int) E曲読込画面の戻り値.読込中止 )
1094 {
1095 //DTX.t全チップの再生停止();
1096 DTX.On非活性化();
1097 Trace.TraceInformation( "曲の読み込みを中止しました。" );
1098 this.tガベジコレクションを実行する();
1099 Trace.TraceInformation( "----------------------" );
1100 Trace.TraceInformation( "■ 選曲" );
1101 stage選曲.On活性化();
1102 r直前のステ = r現在のステ;
1103 r現在のステ = stage選曲;
1104 foreach ( STPlugin pg in this.listプラグイン )
1105 {
1106 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
1107 pg.plugin.Onステジ変更();
1108 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
1109 }
1110 break;
1111 }
1112 #endregion
1113
1114
1115 if( !ConfigIni.bギタレボモ )
1116 {
1117 Trace.TraceInformation( "----------------------" );
1118 Trace.TraceInformation( "■ 演奏(ドラム画面)" );
1119 #if false // #23625 2011.1.11 Config.iniからダメージ/回復値の定数変更を行う場合はここを有効にする 087リリースに合わせ機能無効化
1120 for (int i = 0; i < 5; i++)
1121 {
1122 for (int j = 0; j < 2; j++)
1123 {
1124 stage演奏ドラム画面.fDamageGaugeDelta[i, j] = ConfigIni.fGaugeFactor[i, j];
1125 }
1126 }
1127 for (int i = 0; i < 3; i++) {
1128 stage演奏ドラム画面.fDamageLevelFactor[i] = ConfigIni.fDamageLevelFactor[i];
1129 }
1130 #endif
1131 r直前のステ = r現在のステ;
1132 r現在のステ = stage演奏ドラム画面;
1133 }
1134 else
1135 {
1136 Trace.TraceInformation( "----------------------" );
1137 Trace.TraceInformation( "■ 演奏(ギター画面)" );
1138 #if false // #23625 2011.1.11 Config.iniからダメージ/回復値の定数変更を行う場合はここを有効にする 087リリースに合わせ機能無効化
1139 for (int i = 0; i < 5; i++)
1140 {
1141 for (int j = 0; j < 2; j++)
1142 {
1143 stage演奏ギタ画面.fDamageGaugeDelta[i, j] = ConfigIni.fGaugeFactor[i, j];
1144 }
1145 }
1146 for (int i = 0; i < 3; i++) {
1147 stage演奏ギタ画面.fDamageLevelFactor[i] = ConfigIni.fDamageLevelFactor[i];
1148 }
1149 #endif
1150 r直前のステ = r現在のステ;
1151 r現在のステ = stage演奏ギタ画面;
1152 }
1153
1154 foreach( STPlugin pg in this.listプラグイン )
1155 {
1156 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
1157 pg.plugin.Onステジ変更();
1158 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
1159 }
1160
1161 this.tガベジコレクションを実行する();
1162 }
1163 //-----------------------------
1164 #endregion
1165 break;
1166
1167 case CStage.Eステ.演奏:
1168 #region [ *** ]
1169 //-----------------------------
1170
1171 double n = (double)sw.ElapsedTicks / (double)Stopwatch.Frequency;
1172 swlist.Add(n);
1173
1174 #region [ DTXVモード中にDTXCreatorから指示を受けた場合の処理 ]
1175 if ( DTXVmode.Enabled && DTXVmode.Refreshed )
1176 {
1177 DTXVmode.Refreshed = false;
1178
1179 if ( DTXVmode.Command == CDTXVmode.ECommand.Stop )
1180 {
1181 if ( !ConfigIni.bギタレボモ )
1182 {
1183 CDTXMania.stage演奏ドラム画面.t停止();
1184 }
1185 else
1186 {
1187 CDTXMania.stage演奏ギタ画面.t停止();
1188 }
1189 if ( previewSound != null )
1190 {
1191 this.previewSound.tサウンドを停止する();
1192 this.previewSound.Dispose();
1193 this.previewSound = null;
1194 }
1195 }
1196 else if ( DTXVmode.Command == CDTXVmode.ECommand.Play )
1197 {
1198 if ( DTXVmode.NeedReload )
1199 {
1200 if ( !ConfigIni.bギタレボモ )
1201 {
1202 CDTXMania.stage演奏ドラム画面.t再読込();
1203 }
1204 else
1205 {
1206 CDTXMania.stage演奏ギタ画面.t再読込();
1207 }
1208
1209 CDTXMania.ConfigIni.bDrums有効 = !DTXVmode.GRmode;
1210 CDTXMania.ConfigIni.bGuitar有効 = true;
1211 CDTXMania.ConfigIni.bTimeStretch = DTXVmode.TimeStretch;
1212 CSound管理.bIsTimeStretch = DTXVmode.TimeStretch;
1213 if ( CDTXMania.ConfigIni.b垂直帰線待ちを行う != DTXVmode.VSyncWait )
1214 {
1215 CDTXMania.ConfigIni.b垂直帰線待ちを行う = DTXVmode.VSyncWait;
1216 CDTXMania.app.b次のタイミングで垂直帰線同期切り替えを行う = true;
1217 }
1218 }
1219 else
1220 {
1221 if ( !ConfigIni.bギタレボモ )
1222 {
1223 CDTXMania.stage演奏ドラム画面.t演奏位置の変更( CDTXMania.DTXVmode.nStartBar );
1224 }
1225 else
1226 {
1227 CDTXMania.stage演奏ギタ画面.t演奏位置の変更( CDTXMania.DTXVmode.nStartBar );
1228 }
1229 }
1230 }
1231 }
1232 #endregion
1233
1234 switch( this.n進行描画の戻り値 )
1235 {
1236 case (int) E演奏画面の戻り値.再読込・再演奏:
1237 #region [ DTXファイルを再読み込みして、再演奏 ]
1238 DTX.t全チップの再生停止();
1239 DTX.On非活性化();
1240 r現在のステ.On非活性化();
1241 stage曲読み込み.On活性化();
1242 r直前のステ = r現在のステ;
1243 r現在のステ = stage曲読み込み;
1244 this.tガベジコレクションを実行する();
1245 break;
1246 #endregion
1247
1248 //case (int) E演奏画面の戻り値.再演奏:
1249 #region [ 再読み込み無しで、再演奏 ]
1250 #endregion
1251 // break;
1252
1253 case (int) E演奏画面の戻り値.継続:
1254 break;
1255
1256 case (int) E演奏画面の戻り値.演奏中断:
1257 #region [ 演奏キャンセル ]
1258 //-----------------------------
1259 scoreIni = this.tScoreIniBGMAdjustHistoryPlayCountを更新( "Play canceled" );
1260
1261 double lastd = 0f;
1262 int f = 0;
1263 foreach ( double d in swlist )
1264 {
1265 double dif = d - lastd;
1266 string s = "";
1267 if ( 0.016 < dif && dif < 0.017 )
1268 {
1269 }
1270 else
1271 {
1272 s = "★";
1273 }
1274 //Trace.TraceInformation( "frame " + f + ": " + d + " (" + dif + ")" + s );
1275 lastd = d;
1276 f++;
1277 }
1278 swlist.Clear();
1279
1280 #region [ プラグイン On演奏キャンセル() の呼び出し ]
1281 //---------------------
1282 foreach( STPlugin pg in this.listプラグイン )
1283 {
1284 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
1285 pg.plugin.On演奏キャンセル( scoreIni );
1286 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
1287 }
1288 //---------------------
1289 #endregion
1290
1291 DTX.t全チップの再生停止();
1292 DTX.On非活性化();
1293 r現在のステ.On非活性化();
1294 if( bコンパクトモ )
1295 {
1296 base.Window.Close();
1297 }
1298 else
1299 {
1300 Trace.TraceInformation( "----------------------" );
1301 Trace.TraceInformation( "■ 選曲" );
1302 stage選曲.On活性化();
1303 r直前のステ = r現在のステ;
1304 r現在のステ = stage選曲;
1305
1306 #region [ プラグイン Onステージ変更() の呼び出し ]
1307 //---------------------
1308 foreach( STPlugin pg in this.listプラグイン )
1309 {
1310 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
1311 pg.plugin.Onステジ変更();
1312 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
1313 }
1314 //---------------------
1315 #endregion
1316
1317 this.tガベジコレクションを実行する();
1318 }
1319 break;
1320 //-----------------------------
1321 #endregion
1322
1323 case (int) E演奏画面の戻り値.ステジ失敗:
1324 #region [ 演奏失敗(StageFailed) ]
1325 //-----------------------------
1326 scoreIni = this.tScoreIniBGMAdjustHistoryPlayCountを更新( "Stage failed" );
1327
1328 #region [ プラグイン On演奏失敗() の呼び出し ]
1329 //---------------------
1330 foreach( STPlugin pg in this.listプラグイン )
1331 {
1332 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
1333 pg.plugin.On演奏失敗( scoreIni );
1334 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
1335 }
1336 //---------------------
1337 #endregion
1338
1339 DTX.t全チップの再生停止();
1340 DTX.On非活性化();
1341 r現在のステ.On非活性化();
1342 if( bコンパクトモ )
1343 {
1344 base.Window.Close();
1345 }
1346 else
1347 {
1348 Trace.TraceInformation( "----------------------" );
1349 Trace.TraceInformation( "■ 選曲" );
1350 stage選曲.On活性化();
1351 r直前のステ = r現在のステ;
1352 r現在のステ = stage選曲;
1353
1354 #region [ プラグイン Onステージ変更() の呼び出し ]
1355 //---------------------
1356 foreach( STPlugin pg in this.listプラグイン )
1357 {
1358 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
1359 pg.plugin.Onステジ変更();
1360 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
1361 }
1362 //---------------------
1363 #endregion
1364
1365 this.tガベジコレクションを実行する();
1366 }
1367 break;
1368 //-----------------------------
1369 #endregion
1370
1371 case (int) E演奏画面の戻り値.ステジクリア:
1372 #region [ 演奏クリア ]
1373 //-----------------------------
1374 CScoreIni.C演奏記録 c演奏記録_Drums, c演奏記録_Guitar, c演奏記録_Bass;
1375 CDTX.CChip[] chipArray = new CDTX.CChip[10];
1376 if( ConfigIni.bギタレボモ )
1377 {
1378 stage演奏ギタ画面.t演奏結果を格納する( out c演奏記録_Drums, out c演奏記録_Guitar, out c演奏記録_Bass );
1379 }
1380 else
1381 {
1382 stage演奏ドラム画面.t演奏結果を格納する( out c演奏記録_Drums, out c演奏記録_Guitar, out c演奏記録_Bass, out chipArray );
1383 }
1384
1385 if ( CDTXMania.ConfigIni.bIsSwappedGuitarBass ) // #24063 2011.1.24 yyagi Gt/Bsを入れ替えていたなら、演奏結果も入れ替える
1386 {
1387 CScoreIni.C演奏記録 t;
1388 t = c演奏記録_Guitar;
1389 c演奏記録_Guitar = c演奏記録_Bass;
1390 c演奏記録_Bass = t;
1391
1392 CDTXMania.DTX.SwapGuitarBassInfos(); // 譜面情報も元に戻す
1393 CDTXMania.ConfigIni.SwapGuitarBassInfos_AutoFlags(); // #24415 2011.2.27 yyagi
1394 // リザルト集計時のみ、Auto系のフラグも元に戻す。
1395 // これを戻すのは、リザルト集計後。
1396 } // "case CStage.Eステージ.結果:"のところ。
1397
1398 double ps = 0.0, gs = 0.0;
1399 if ( !c演奏記録_Drums.bAUTOである && c演奏記録_Drums.n全チップ数 > 0) {
1400 ps = c演奏記録_Drums.db演奏型スキル値;
1401 gs = c演奏記録_Drums.dbム型スキル値;
1402 }
1403 else if ( !c演奏記録_Guitar.bAUTOである && c演奏記録_Guitar.n全チップ数 > 0) {
1404 ps = c演奏記録_Guitar.db演奏型スキル値;
1405 gs = c演奏記録_Guitar.dbム型スキル値;
1406 }
1407 else
1408 {
1409 ps = c演奏記録_Bass.db演奏型スキル値;
1410 gs = c演奏記録_Bass.dbム型スキル値;
1411 }
1412 string str = "Cleared";
1413 switch( CScoreIni.t総合ランク値を計算して返す( c演奏記録_Drums, c演奏記録_Guitar, c演奏記録_Bass ) )
1414 {
1415 case (int)CScoreIni.ERANK.SS:
1416 str = string.Format( "Cleared (SS: {0:F2})", ps );
1417 break;
1418
1419 case (int) CScoreIni.ERANK.S:
1420 str = string.Format( "Cleared (S: {0:F2})", ps );
1421 break;
1422
1423 case (int) CScoreIni.ERANK.A:
1424 str = string.Format( "Cleared (A: {0:F2})", ps );
1425 break;
1426
1427 case (int) CScoreIni.ERANK.B:
1428 str = string.Format( "Cleared (B: {0:F2})", ps );
1429 break;
1430
1431 case (int) CScoreIni.ERANK.C:
1432 str = string.Format( "Cleared (C: {0:F2})", ps );
1433 break;
1434
1435 case (int) CScoreIni.ERANK.D:
1436 str = string.Format( "Cleared (D: {0:F2})", ps );
1437 break;
1438
1439 case (int) CScoreIni.ERANK.E:
1440 str = string.Format( "Cleared (E: {0:F2})", ps );
1441 break;
1442
1443 case (int)CScoreIni.ERANK.UNKNOWN: // #23534 2010.10.28 yyagi add: 演奏チップが0個のとき
1444 str = "Cleared (No chips)";
1445 break;
1446 }
1447
1448 scoreIni = this.tScoreIniBGMAdjustHistoryPlayCountを更新( str );
1449
1450 #region [ プラグイン On演奏クリア() の呼び出し ]
1451 //---------------------
1452 foreach( STPlugin pg in this.listプラグイン )
1453 {
1454 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
1455 pg.plugin.On演奏クリア( scoreIni );
1456 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
1457 }
1458 //---------------------
1459 #endregion
1460
1461 r現在のステ.On非活性化();
1462 Trace.TraceInformation( "----------------------" );
1463 Trace.TraceInformation( "■ 結果" );
1464 stage結果.st演奏記録.Drums = c演奏記録_Drums;
1465 stage結果.st演奏記録.Guitar = c演奏記録_Guitar;
1466 stage結果.st演奏記録.Bass = c演奏記録_Bass;
1467 stage結果.r空うちドラムチップ = chipArray;
1468 stage結果.On活性化();
1469 r直前のステ = r現在のステ;
1470 r現在のステ = stage結果;
1471
1472 #region [ プラグイン Onステージ変更() の呼び出し ]
1473 //---------------------
1474 foreach( STPlugin pg in this.listプラグイン )
1475 {
1476 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
1477 pg.plugin.Onステジ変更();
1478 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
1479 }
1480 //---------------------
1481 #endregion
1482
1483 break;
1484 //-----------------------------
1485 #endregion
1486 }
1487 //-----------------------------
1488 #endregion
1489 break;
1490
1491 case CStage.Eステ.結果:
1492 #region [ *** ]
1493 //-----------------------------
1494 if( this.n進行描画の戻り値 != 0 )
1495 {
1496 if ( CDTXMania.ConfigIni.bIsSwappedGuitarBass ) // #24415 2011.2.27 yyagi Gt/Bsを入れ替えていたなら、Auto状態をリザルト画面終了後に元に戻す
1497 {
1498 CDTXMania.ConfigIni.SwapGuitarBassInfos_AutoFlags(); // Auto入れ替え
1499 }
1500
1501 DTX.t全チップの再生一時停止();
1502 DTX.On非活性化();
1503 r現在のステ.On非活性化();
1504 if( !bコンパクトモ )
1505 {
1506 Trace.TraceInformation( "----------------------" );
1507 Trace.TraceInformation( "■ 選曲" );
1508 stage選曲.On活性化();
1509 r直前のステ = r現在のステ;
1510 r現在のステ = stage選曲;
1511
1512 foreach( STPlugin pg in this.listプラグイン )
1513 {
1514 Directory.SetCurrentDirectory( pg.strプラグインフォルダ );
1515 pg.plugin.Onステジ変更();
1516 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
1517 }
1518
1519 this.tガベジコレクションを実行する();
1520 }
1521 else
1522 {
1523 base.Window.Close();
1524 }
1525 }
1526 //-----------------------------
1527 #endregion
1528 break;
1529
1530 case CStage.Eステ.ChangeSkin:
1531 #region [ *** ]
1532 //-----------------------------
1533 if ( this.n進行描画の戻り値 != 0 )
1534 {
1535 r現在のステ.On非活性化();
1536 Trace.TraceInformation( "----------------------" );
1537 Trace.TraceInformation( "■ 選曲" );
1538 stage選曲.On活性化();
1539 r直前のステ = r現在のステ;
1540 r現在のステ = stage選曲;
1541 this.tガベジコレクションを実行する();
1542 }
1543 //-----------------------------
1544 #endregion
1545 break;
1546
1547 case CStage.Eステ.終了:
1548 #region [ *** ]
1549 //-----------------------------
1550 if( this.n進行描画の戻り値 != 0 )
1551 {
1552 base.Exit();
1553 }
1554 //-----------------------------
1555 #endregion
1556 break;
1557 }
1558 }
1559 this.Device.EndScene(); // Present()は game.csのOnFrameEnd()に登録された、GraphicsDeviceManager.game_FrameEnd() 内で実行されるので不要
1560 // (つまり、Present()は、Draw()完了後に実行される)
1561 #if !GPUFlushAfterPresent
1562 actFlushGPU.On進行描画(); // Flush GPU // EndScene()~Present()間 (つまりVSync前) でFlush実行
1563 #endif
1564 if ( Sound管理.GetCurrentSoundDeviceType() != "DirectSound" )
1565 {
1566 Sound管理.t再生中の処理をする(); // サウンドバッファの更新; 画面描画と同期させることで、スクロールをスムーズにする
1567 }
1568
1569
1570 #region [ 全画面・ウインドウ切り替え ]
1571 if ( this.b次のタイミングで全画面・ウィンドウ切り替えを行う )
1572 {
1573 ConfigIni.b全画面モ = !ConfigIni.b全画面モ;
1574 app.t全画面・ウィンドウモド切り替え();
1575 this.b次のタイミングで全画面・ウィンドウ切り替えを行う = false;
1576 }
1577 #endregion
1578 #region [ 垂直基線同期切り替え ]
1579 if ( this.b次のタイミングで垂直帰線同期切り替えを行う )
1580 {
1581 bool bIsMaximized = this.Window.IsMaximized; // #23510 2010.11.3 yyagi: to backup current window mode before changing VSyncWait
1582 currentClientSize = this.Window.ClientSize; // #23510 2010.11.3 yyagi: to backup current window size before changing VSyncWait
1583 DeviceSettings currentSettings = app.GraphicsDeviceManager.CurrentSettings;
1584 currentSettings.EnableVSync = ConfigIni.b垂直帰線待ちを行う;
1585 app.GraphicsDeviceManager.ChangeDevice( currentSettings );
1586 this.b次のタイミングで垂直帰線同期切り替えを行う = false;
1587 base.Window.ClientSize = new Size(currentClientSize.Width, currentClientSize.Height); // #23510 2010.11.3 yyagi: to resume window size after changing VSyncWait
1588 if (bIsMaximized)
1589 {
1590 this.Window.WindowState = FormWindowState.Maximized; // #23510 2010.11.3 yyagi: to resume window mode after changing VSyncWait
1591 }
1592 }
1593 #endregion
1594 }
1595
1596
1597 // その他
1598
1599 #region [ 汎用ヘルパー ]
1600 //-----------------
1601 public static CTexture tテクスチャの生成( string fileName )
1602 {
1603 return tテクスチャの生成( fileName, false );
1604 }
1605 public static CTexture tテクスチャの生成( string fileName, bool b黒を透過する )
1606 {
1607 if ( app == null )
1608 {
1609 return null;
1610 }
1611 try
1612 {
1613 return new CTexture( app.Device, fileName, TextureFormat, b黒を透過する );
1614 }
1615 catch ( CTextureCreateFailedException )
1616 {
1617 Trace.TraceError( "テクスチャの生成に失敗しました。({0})", fileName );
1618 return null;
1619 }
1620 catch ( FileNotFoundException )
1621 {
1622 Trace.TraceError( "テクスチャファイルが見つかりませんでした。({0})", fileName );
1623 return null;
1624 }
1625 }
1626 public static void tテクスチャの解放( ref CTexture tx )
1627 {
1628 if( tx != null )
1629 CDTXMania.t安全にDisposeする( ref tx );
1630 }
1631
1632 public static CTexture tテクスチャの生成( byte[] txData )
1633 {
1634 return tテクスチャの生成( txData, false );
1635 }
1636 public static CTexture tテクスチャの生成( byte[] txData, bool b黒を透過する )
1637 {
1638 if ( app == null )
1639 {
1640 return null;
1641 }
1642 try
1643 {
1644 return new CTexture( app.Device, txData, TextureFormat, b黒を透過する );
1645 }
1646 catch ( CTextureCreateFailedException )
1647 {
1648 Trace.TraceError( "テクスチャの生成に失敗しました。(txData)" );
1649 return null;
1650 }
1651 }
1652
1653 public static CTexture tテクスチャの生成( Bitmap bitmap )
1654 {
1655 return tテクスチャの生成( bitmap, false );
1656 }
1657 public static CTexture tテクスチャの生成( Bitmap bitmap, bool b黒を透過する )
1658 {
1659 if ( app == null )
1660 {
1661 return null;
1662 }
1663 try
1664 {
1665 return new CTexture( app.Device, bitmap, TextureFormat, b黒を透過する );
1666 }
1667 catch ( CTextureCreateFailedException )
1668 {
1669 Trace.TraceError( "テクスチャの生成に失敗しました。(txData)" );
1670 return null;
1671 }
1672 }
1673
1674 public static CTexture tテクスチャを生成する(int width, int height)
1675 {
1676 try
1677 {
1678 return new CTexture(CDTXMania.App.D3D9Device, width, height, CDTXMania.TextureFormat);
1679 }
1680 catch
1681 {
1682 Trace.TraceError("空のテクスチャ({0}x{1})の生成に失敗しました。", width, height);
1683 return null;
1684 }
1685 }
1686
1687
1688 public static CDirectShow t失敗してもスキップ可能なDirectShowを生成する(string fileName, IntPtr hWnd, bool bディオレンダラなし)
1689 {
1690 CDirectShow ds = null;
1691 if( File.Exists( fileName ) )
1692 {
1693 try
1694 {
1695 ds = new CDirectShow(fileName, hWnd, bディオレンダラなし);
1696 }
1697 catch (FileNotFoundException)
1698 {
1699 Trace.TraceError("動画ファイルが見つかりませんでした。({0})", fileName);
1700 ds = null; // Dispose はコンストラクタ内で実施済み
1701 }
1702 catch
1703 {
1704 Trace.TraceError("DirectShow の生成に失敗しました。[{0}]", fileName);
1705 ds = null; // Dispose はコンストラクタ内で実施済み
1706 }
1707 }
1708 else
1709 {
1710 Trace.TraceError("動画ファイルが見つかりませんでした。({0})", fileName);
1711 return null;
1712 }
1713
1714 return ds;
1715 }
1716
1717 /// <summary>プロパティ、インデクサには ref は使用できないので注意。</summary>
1718 public static void t安全にDisposeする<T>( ref T obj )
1719 {
1720 if ( obj == null )
1721 return;
1722
1723 var d = obj as IDisposable;
1724
1725 if ( d != null )
1726 d.Dispose();
1727
1728 obj = default( T );
1729 }
1730 //-----------------
1731 #endregion
1732 #region [ private ]
1733 //-----------------
1734 private bool bマウスカソル表示中 = true;
1735 public bool bウィンドウがアクティブである = true;
1736 private bool b終了処理完了済み;
1737 private static CDTX dtx;
1738 private List<CActivity> listトップレベルActivities;
1739 public int n進行描画の戻り値;
1740 private MouseButtons mb = System.Windows.Forms.MouseButtons.Left;
1741 private string strWindowTitle
1742 {
1743 get
1744 {
1745 if ( DTXVmode.Enabled )
1746 {
1747 return "DTXViewer release " + VERSION;
1748 }
1749 else
1750 {
1751 return "DTXMania .NET style release " + VERSION;
1752 }
1753 }
1754 }
1755 private CSound previewSound;
1756
1757 private void t起動処理()
1758 {
1759 #region [ strEXEのあるフォルダを決定する ]
1760 //-----------------
1761 // BEGIN #23629 2010.11.13 from: デバッグ時は Application.ExecutablePath が ($SolutionDir)/bin/x86/Debug/ などになり System/ の読み込みに失敗するので、カレントディレクトリを採用する。(プロジェクトのプロパティ→デバッグ→作業ディレクトリが有効になる)
1762 #if DEBUG
1763 strEXEのあるフォルダ = Environment.CurrentDirectory + @"\";
1764 #else
1765 strEXEのあるフォルダ = Path.GetDirectoryName( Application.ExecutablePath ) + @"\"; // #23629 2010.11.9 yyagi: set correct pathname where DTXManiaGR.exe is.
1766 #endif
1767 // END #23629 2010.11.13 from
1768 //-----------------
1769 #endregion
1770
1771 #region [ Config.ini の読込み ]
1772 //---------------------
1773 ConfigIni = new CConfigIni();
1774 string path = strEXEのあるフォルダ + "Config.ini";
1775 if( File.Exists( path ) )
1776 {
1777 try
1778 {
1779 ConfigIni.tファイルから読み込み( path );
1780 }
1781 catch
1782 {
1783 //ConfigIni = new CConfigIni(); // 存在してなければ新規生成
1784 }
1785 }
1786 this.Window.EnableSystemMenu = CDTXMania.ConfigIni.bIsEnabledSystemMenu; // #28200 2011.5.1 yyagi
1787 // 2012.8.22 Config.iniが無いときに初期値が適用されるよう、この設定行をifブロック外に移動
1788
1789 //---------------------
1790 #endregion
1791 #region [ ログ出力開始 ]
1792 //---------------------
1793 Trace.AutoFlush = true;
1794 if( ConfigIni.bログ出力 )
1795 {
1796 try
1797 {
1798 Trace.Listeners.Add( new CTraceLogListener( new StreamWriter( strEXEのあるフォルダ + "DTXManiaLog.txt", false, Encoding.GetEncoding( "shift-jis" ) ) ) );
1799 }
1800 catch ( System.UnauthorizedAccessException ) // #24481 2011.2.20 yyagi
1801 {
1802 int c = (CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "ja")? 0 : 1;
1803 string[] mes_writeErr = {
1804 "DTXManiaLog.txtへの書き込みができませんでした。書き込みできるようにしてから、再度起動してください。",
1805 "Failed to write DTXManiaLog.txt. Please set it writable and try again."
1806 };
1807 MessageBox.Show( mes_writeErr[c], "DTXMania boot error", MessageBoxButtons.OK, MessageBoxIcon.Error );
1808 Environment.Exit(1);
1809 }
1810 }
1811 Trace.WriteLine("");
1812 Trace.WriteLine( "DTXMania powered by YAMAHA Silent Session Drums" );
1813 Trace.WriteLine( string.Format( "Release: {0}", VERSION ) );
1814 Trace.WriteLine( "" );
1815 Trace.TraceInformation( "----------------------" );
1816 Trace.TraceInformation( "■ アプリケーションの初期化" );
1817 Trace.TraceInformation( "OS Version: " + Environment.OSVersion );
1818 Trace.TraceInformation( "ProcessorCount: " + Environment.ProcessorCount.ToString() );
1819 Trace.TraceInformation( "CLR Version: " + Environment.Version.ToString() );
1820 //---------------------
1821 #endregion
1822 #region [ DTXVmodeクラス の初期化 ]
1823 //---------------------
1824 //Trace.TraceInformation( "DTXVモードの初期化を行います。" );
1825 //Trace.Indent();
1826 try
1827 {
1828 DTXVmode = new CDTXVmode();
1829 DTXVmode.Enabled = false;
1830 //Trace.TraceInformation( "DTXVモードの初期化を完了しました。" );
1831 }
1832 finally
1833 {
1834 //Trace.Unindent();
1835 }
1836 //---------------------
1837 #endregion
1838 #region [ コンパクトモードスイッチの有無、もしくは、DTXViewerとしての起動 ]
1839 //---------------------
1840 bコンパクトモ = false;
1841 strコンパクトモドファイル = "";
1842 string[] commandLineArgs = Environment.GetCommandLineArgs();
1843 if( ( commandLineArgs != null ) && ( commandLineArgs.Length > 1 ) )
1844 {
1845 bコンパクトモ = true;
1846 string arg = "";
1847
1848 for ( int i = 1; i < commandLineArgs.Length; i++ )
1849 {
1850 if ( i != 1 )
1851 {
1852 arg += " " + "\"" + commandLineArgs[ i ] + "\"";
1853 }
1854 else
1855 {
1856 arg += commandLineArgs[ i ];
1857 }
1858 }
1859 DTXVmode.ParseArguments( arg );
1860
1861 if ( DTXVmode.Enabled )
1862 {
1863 DTXVmode.Refreshed = false; // 初回起動時は再読み込みに走らせない
1864 strコンパクトモドファイル = DTXVmode.filename;
1865 switch( DTXVmode.soundDeviceType )
1866 {
1867 case ESoundDeviceType.DirectSound:
1868 ConfigIni.nSoundDeviceType = 0;
1869 break;
1870 case ESoundDeviceType.ExclusiveWASAPI:
1871 ConfigIni.nSoundDeviceType = 2;
1872 break;
1873 case ESoundDeviceType.ASIO:
1874 ConfigIni.nSoundDeviceType = 1;
1875 ConfigIni.nASIODevice = DTXVmode.nASIOdevice;
1876 break;
1877 }
1878
1879 CDTXMania.ConfigIni.b垂直帰線待ちを行う = DTXVmode.VSyncWait;
1880 CDTXMania.ConfigIni.bTimeStretch = DTXVmode.TimeStretch;
1881 CDTXMania.ConfigIni.bDrums有効 = !DTXVmode.GRmode;
1882 CDTXMania.ConfigIni.bGuitar有効 = true;
1883 }
1884 else // 通常のコンパクトモード
1885 {
1886 strコンパクトモドファイル = commandLineArgs[ 1 ];
1887 }
1888
1889 if ( !File.Exists( strコンパクトモドファイル ) ) // #32985 2014.1.23 yyagi
1890 {
1891 Trace.TraceError( "コンパクトモードで指定されたファイルが見つかりません。DTXManiaを終了します。[{0}]", strコンパクトモドファイル );
1892 #if DEBUG
1893 Environment.Exit( -1 );
1894 #else
1895 throw new FileNotFoundException( "コンパクトモードで指定されたファイルが見つかりません。DTXManiaを終了します。", strコンパクトモドファイル );
1896 #endif
1897 }
1898 if ( DTXVmode.Enabled )
1899 {
1900 Trace.TraceInformation( "DTXVモードで起動します。[{0}]", strコンパクトモドファイル );
1901 }
1902 else
1903 {
1904 Trace.TraceInformation( "コンパクトモードで起動します。[{0}]", strコンパクトモドファイル );
1905 }
1906 }
1907 //---------------------
1908 #endregion
1909
1910 #region [ ウィンドウ初期化 ]
1911 //---------------------
1912 base.Window.StartPosition = FormStartPosition.Manual; // #30675 2013.02.04 ikanick add
1913 base.Window.Location = new Point( ConfigIni.n初期ウィンドウ開始位置X, ConfigIni.n初期ウィンドウ開始位置Y ); // #30675 2013.02.04 ikanick add
1914
1915 base.Window.Text = this.strWindowTitle; // 事前にDTXVmodeの実体を作っておくこと
1916
1917
1918 base.Window.StartPosition = FormStartPosition.Manual; // #30675 2013.02.04 ikanick add
1919 base.Window.Location = new Point( ConfigIni.n初期ウィンドウ開始位置X, ConfigIni.n初期ウィンドウ開始位置Y ); // #30675 2013.02.04 ikanick add
1920
1921 base.Window.ClientSize = new Size(ConfigIni.nウインドウwidth, ConfigIni.nウインドウheight); // #34510 yyagi 2010.10.31 to change window size got from Config.ini
1922 #if !WindowedFullscreen
1923 if (!ConfigIni.bウィンドウモ) // #23510 2010.11.02 yyagi: add; to recover window size in case bootup with fullscreen mode
1924 { // #30666 2013.02.02 yyagi: currentClientSize should be always made
1925 #endif
1926 currentClientSize = new Size( ConfigIni.nウインドウwidth, ConfigIni.nウインドウheight );
1927 #if !WindowedFullscreen
1928 }
1929 #endif
1930 base.Window.MaximizeBox = true; // #23510 2010.11.04 yyagi: to support maximizing window
1931 base.Window.FormBorderStyle = FormBorderStyle.Sizable; // #23510 2010.10.27 yyagi: changed from FixedDialog to Sizable, to support window resize
1932 // #30666 2013.02.02 yyagi: moved the code to t全画面・ウインドウモード切り替え()
1933 base.Window.ShowIcon = true;
1934 base.Window.Icon = Properties.Resources.dtx;
1935 base.Window.KeyDown += new KeyEventHandler( this.Window_KeyDown );
1936 base.Window.MouseUp +=new MouseEventHandler( this.Window_MouseUp);
1937 base.Window.MouseDoubleClick += new MouseEventHandler(this.Window_MouseDoubleClick); // #23510 2010.11.13 yyagi: to go fullscreen mode
1938 base.Window.ResizeEnd += new EventHandler(this.Window_ResizeEnd); // #23510 2010.11.20 yyagi: to set resized window size in Config.ini
1939 base.Window.ApplicationActivated += new EventHandler(this.Window_ApplicationActivated);
1940 base.Window.ApplicationDeactivated += new EventHandler( this.Window_ApplicationDeactivated );
1941 //---------------------
1942 #endregion
1943 #region [ Direct3D9Exを使うかどうか判定 ]
1944 #endregion
1945 #region [ Direct3D9 デバイスの生成 ]
1946 //---------------------
1947 DeviceSettings settings = new DeviceSettings();
1948 #if WindowedFullscreen
1949 settings.Windowed = true; // #30666 2013.2.2 yyagi: Fullscreenmode is "Maximized window" mode
1950 #else
1951 settings.Windowed = ConfigIni.bウィンドウモ;
1952 #endif
1953 settings.BackBufferWidth = SampleFramework.GameWindowSize.Width;
1954 settings.BackBufferHeight = SampleFramework.GameWindowSize.Height;
1955 // settings.BackBufferCount = 3;
1956 settings.EnableVSync = ConfigIni.b垂直帰線待ちを行う;
1957 // settings.BackBufferFormat = Format.A8R8G8B8;
1958 // settings.MultisampleType = MultisampleType.FourSamples;
1959 // settings.MultisampleQuality = 4;
1960 // settings.MultisampleType = MultisampleType.None;
1961 // settings.MultisampleQuality = 0;
1962
1963 try
1964 {
1965 base.GraphicsDeviceManager.ChangeDevice(settings);
1966 }
1967 catch (DeviceCreationException e)
1968 {
1969 Trace.TraceError(e.ToString());
1970 MessageBox.Show(e.Message + e.ToString(), "DTXMania failed to boot: DirectX9 Initialize Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
1971 Environment.Exit(-1);
1972 }
1973
1974 base.IsFixedTimeStep = false;
1975 // base.TargetElapsedTime = TimeSpan.FromTicks( 10000000 / 75 );
1976 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.
1977 base.InactiveSleepTime = TimeSpan.FromMilliseconds((float)(ConfigIni.n非フォカス時スリms)); // #23568 2010.11.3 yyagi: to support valiable sleep value when !IsActive
1978 // #23568 2010.11.4 ikanick changed ( 1 -> ConfigIni )
1979 #if WindowedFullscreen
1980 this.t全画面・ウィンドウモド切り替え(); // #30666 2013.2.2 yyagi: finalize settings for "Maximized window mode"
1981 #endif
1982 actFlushGPU = new CActFlushGPU();
1983 //---------------------
1984 #endregion
1985
1986 DTX = null;
1987
1988 #region [ Skin の初期化 ]
1989 //---------------------
1990 Trace.TraceInformation( "スキンの初期化を行います。" );
1991 Trace.Indent();
1992 try
1993 {
1994 Skin = new CSkin( CDTXMania.ConfigIni.strSystemSkinSubfolderFullName, CDTXMania.ConfigIni.bUseBoxDefSkin );
1995 CDTXMania.ConfigIni.strSystemSkinSubfolderFullName = CDTXMania.Skin.GetCurrentSkinSubfolderFullName( true ); // 旧指定のSkinフォルダが消滅していた場合に備える
1996 Trace.TraceInformation( "スキンの初期化を完了しました。" );
1997 }
1998 catch
1999 {
2000 Trace.TraceInformation( "スキンの初期化に失敗しました。" );
2001 throw;
2002 }
2003 finally
2004 {
2005 Trace.Unindent();
2006 }
2007 //---------------------
2008 #endregion
2009 #region [ Timer の初期化 ]
2010 //---------------------
2011 Trace.TraceInformation( "タイマの初期化を行います。" );
2012 Trace.Indent();
2013 try
2014 {
2015 Timer = new CTimer( CTimer.E種別.MultiMedia );
2016 Trace.TraceInformation( "タイマの初期化を完了しました。" );
2017 }
2018 finally
2019 {
2020 Trace.Unindent();
2021 }
2022 //---------------------
2023 #endregion
2024 #region [ FPS カウンタの初期化 ]
2025 //---------------------
2026 Trace.TraceInformation( "FPSカウンタの初期化を行います。" );
2027 Trace.Indent();
2028 try
2029 {
2030 FPS = new CFPS();
2031 Trace.TraceInformation( "FPSカウンタを生成しました。" );
2032 }
2033 finally
2034 {
2035 Trace.Unindent();
2036 }
2037 //---------------------
2038 #endregion
2039 #region [ act文字コンソールの初期化 ]
2040 //---------------------
2041 Trace.TraceInformation( "文字コンソールの初期化を行います。" );
2042 Trace.Indent();
2043 try
2044 {
2045 act文字コンソ = new C文字コンソ();
2046 Trace.TraceInformation( "文字コンソールを生成しました。" );
2047 act文字コンソ.On活性化();
2048 Trace.TraceInformation( "文字コンソールを活性化しました。" );
2049 Trace.TraceInformation( "文字コンソールの初期化を完了しました。" );
2050 }
2051 catch( Exception exception )
2052 {
2053 Trace.TraceError( exception.Message );
2054 Trace.TraceError( "文字コンソールの初期化に失敗しました。" );
2055 }
2056 finally
2057 {
2058 Trace.Unindent();
2059 }
2060 //---------------------
2061 #endregion
2062 #region [ Input管理 の初期化 ]
2063 //---------------------
2064 Trace.TraceInformation( "DirectInput, MIDI入力の初期化を行います。" );
2065 Trace.Indent();
2066 try
2067 {
2068 Input管理 = new CInput管理( base.Window.Handle );
2069 foreach( IInputDevice device in Input管理.list入力デバイス )
2070 {
2071 if( ( device.e入力デバイス種別 == E入力デバイス種別.Joystick ) && !ConfigIni.dicJoystick.ContainsValue( device.GUID ) )
2072 {
2073 int key = 0;
2074 while( ConfigIni.dicJoystick.ContainsKey( key ) )
2075 {
2076 key++;
2077 }
2078 ConfigIni.dicJoystick.Add( key, device.GUID );
2079 }
2080 }
2081 foreach( IInputDevice device2 in Input管理.list入力デバイス )
2082 {
2083 if( device2.e入力デバイス種別 == E入力デバイス種別.Joystick )
2084 {
2085 foreach( KeyValuePair<int, string> pair in ConfigIni.dicJoystick )
2086 {
2087 if( device2.GUID.Equals( pair.Value ) )
2088 {
2089 ( (CInputJoystick) device2 ).SetID( pair.Key );
2090 break;
2091 }
2092 }
2093 continue;
2094 }
2095 }
2096 Trace.TraceInformation( "DirectInput の初期化を完了しました。" );
2097 }
2098 catch( Exception exception2 )
2099 {
2100 Trace.TraceError( exception2.Message );
2101 Trace.TraceError( "DirectInput, MIDI入力の初期化に失敗しました。" );
2102 throw;
2103 }
2104 finally
2105 {
2106 Trace.Unindent();
2107 }
2108 //---------------------
2109 #endregion
2110 #region [ Pad の初期化 ]
2111 //---------------------
2112 Trace.TraceInformation( "パッドの初期化を行います。" );
2113 Trace.Indent();
2114 try
2115 {
2116 Pad = new CPad( ConfigIni, Input管理 );
2117 Trace.TraceInformation( "パッドの初期化を完了しました。" );
2118 }
2119 catch( Exception exception3 )
2120 {
2121 Trace.TraceError( exception3.Message );
2122 Trace.TraceError( "パッドの初期化に失敗しました。" );
2123 }
2124 finally
2125 {
2126 Trace.Unindent();
2127 }
2128 //---------------------
2129 #endregion
2130 #region [ Sound管理 の初期化 ]
2131 //---------------------
2132 Trace.TraceInformation("サウンドデバイスの初期化を行います。");
2133 Trace.Indent();
2134 try
2135 {
2136 {
2137 ESoundDeviceType soundDeviceType;
2138 switch (CDTXMania.ConfigIni.nSoundDeviceType)
2139 {
2140 case 0:
2141 soundDeviceType = ESoundDeviceType.DirectSound;
2142 break;
2143 case 1:
2144 soundDeviceType = ESoundDeviceType.ASIO;
2145 break;
2146 case 2:
2147 soundDeviceType = ESoundDeviceType.ExclusiveWASAPI;
2148 break;
2149 default:
2150 soundDeviceType = ESoundDeviceType.Unknown;
2151 break;
2152 }
2153 Sound管理 = new CSound管理( base.Window.Handle,
2154 soundDeviceType,
2155 CDTXMania.ConfigIni.nWASAPIBufferSizeMs,
2156 //CDTXMania.ConfigIni.nASIOBufferSizeMs,
2157 0,
2158 CDTXMania.ConfigIni.nASIODevice
2159 );
2160 ShowWindowTitleWithSoundType();
2161 FDK.CSound管理.bIsTimeStretch = CDTXMania.ConfigIni.bTimeStretch;
2162 Sound管理.nMasterVolume = CDTXMania.ConfigIni.nMasterVolume;
2163 //FDK.CSound管理.bIsMP3DecodeByWindowsCodec = CDTXMania.ConfigIni.bNoMP3Streaming;
2164 Trace.TraceInformation("サウンドデバイスの初期化を完了しました。");
2165 }
2166 }
2167 catch (Exception e)
2168 {
2169 Trace.TraceError(e.Message);
2170 throw;
2171 }
2172 finally
2173 {
2174 Trace.Unindent();
2175 }
2176 //---------------------
2177 #endregion
2178 #region [ Songs管理 の初期化 ]
2179 //---------------------
2180 Trace.TraceInformation( "曲リストの初期化を行います。" );
2181 Trace.Indent();
2182 try
2183 {
2184 Songs管理 = new CSongs管理();
2185 // Songs管理_裏読 = new CSongs管理();
2186 EnumSongs = new CEnumSongs();
2187 actEnumSongs = new CActEnumSongs();
2188 Trace.TraceInformation( "曲リストの初期化を完了しました。" );
2189 }
2190 catch( Exception e )
2191 {
2192 Trace.TraceError( e.Message );
2193 Trace.TraceError( "曲リストの初期化に失敗しました。" );
2194 }
2195 finally
2196 {
2197 Trace.Unindent();
2198 }
2199 //---------------------
2200 #endregion
2201 #region [ CAvi の初期化 ]
2202 //---------------------
2203 CAvi.t初期化();
2204 //---------------------
2205 #endregion
2206 #region [ Random の初期化 ]
2207 //---------------------
2208 Random = new Random( (int) Timer.nシステム時刻 );
2209 //---------------------
2210 #endregion
2211 #region [ ステージの初期化 ]
2212 //---------------------
2213 r現在のステ = null;
2214 r直前のステ = null;
2215 stage起動 = new CStage起動();
2216 stageタイトル = new CStageタイトル();
2217 stageオプション = new CStageオプション();
2218 stageコンフィグ = new CStageコンフィグ();
2219 stage選曲 = new CStage選曲();
2220 stage曲読み込み = new CStage曲読み込み();
2221 stage演奏ドラム画面 = new CStage演奏ドラム画面();
2222 stage演奏ギタ画面 = new CStage演奏ギタ画面();
2223 stage結果 = new CStage結果();
2224 stageChangeSkin = new CStageChangeSkin();
2225 stage終了 = new CStage終了();
2226 this.listトップレベルActivities = new List<CActivity>();
2227 this.listトップレベルActivities.Add( actEnumSongs );
2228 this.listトップレベルActivities.Add( act文字コンソ );
2229 this.listトップレベルActivities.Add( stage起動 );
2230 this.listトップレベルActivities.Add( stageタイトル );
2231 this.listトップレベルActivities.Add( stageオプション );
2232 this.listトップレベルActivities.Add( stageコンフィグ );
2233 this.listトップレベルActivities.Add( stage選曲 );
2234 this.listトップレベルActivities.Add( stage曲読み込み );
2235 this.listトップレベルActivities.Add( stage演奏ドラム画面 );
2236 this.listトップレベルActivities.Add( stage演奏ギタ画面 );
2237 this.listトップレベルActivities.Add( stage結果 );
2238 this.listトップレベルActivities.Add( stageChangeSkin );
2239 this.listトップレベルActivities.Add( stage終了 );
2240 this.listトップレベルActivities.Add( actFlushGPU);
2241 //---------------------
2242 #endregion
2243 #region [ プラグインの検索と生成 ]
2244 //---------------------
2245 PluginHost = new CPluginHost();
2246
2247 Trace.TraceInformation( "プラグインの検索と生成を行います。" );
2248 Trace.Indent();
2249 try
2250 {
2251 this.tプラグイン検索と生成();
2252 Trace.TraceInformation( "プラグインの検索と生成を完了しました。" );
2253 }
2254 finally
2255 {
2256 Trace.Unindent();
2257 }
2258 //---------------------
2259 #endregion
2260 #region [ プラグインの初期化 ]
2261 //---------------------
2262 if( this.listプラグイン != null && this.listプラグイン.Count > 0 )
2263 {
2264 Trace.TraceInformation( "プラグインの初期化を行います。" );
2265 Trace.Indent();
2266 try
2267 {
2268 foreach( STPlugin st in this.listプラグイン )
2269 {
2270 Directory.SetCurrentDirectory( st.strプラグインフォルダ );
2271 st.plugin.On初期化( this.PluginHost );
2272 st.plugin.OnManagedリソスの作成();
2273 st.plugin.OnUnmanagedリソスの作成();
2274 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
2275 }
2276 Trace.TraceInformation( "すべてのプラグインの初期化を完了しました。" );
2277 }
2278 catch
2279 {
2280 Trace.TraceError( "プラグインのどれかの初期化に失敗しました。" );
2281 throw;
2282 }
2283 finally
2284 {
2285 Trace.Unindent();
2286 }
2287 }
2288
2289 //---------------------
2290 #endregion
2291
2292
2293 Trace.TraceInformation( "アプリケーションの初期化を完了しました。" );
2294
2295 #region [ 最初のステージの起動 ]
2296 //---------------------
2297 Trace.TraceInformation("----------------------");
2298 Trace.TraceInformation("■ 起動");
2299
2300 if (CDTXMania.bコンパクトモ)
2301 {
2302 r現在のステ = stage曲読み込み;
2303 }
2304 else
2305 {
2306 r現在のステ = stage起動;
2307 }
2308 r現在のステ.On活性化();
2309 //---------------------
2310 #endregion
2311 }
2312 public void ShowWindowTitleWithSoundType()
2313 {
2314 string delay = "";
2315 if (Sound管理.GetCurrentSoundDeviceType() != "DirectSound")
2316 {
2317 delay = "(" + Sound管理.GetSoundDelay() + "ms)";
2318 }
2319 base.Window.Text = strWindowTitle + " (" + Sound管理.GetCurrentSoundDeviceType() + delay + ")";
2320 }
2321
2322 private void t終了処理()
2323 {
2324 if( !this.b終了処理完了済み )
2325 {
2326 Trace.TraceInformation( "----------------------" );
2327 Trace.TraceInformation( "■ アプリケーションの終了" );
2328 #region [ 曲検索の終了処理 ]
2329 //---------------------
2330 if ( actEnumSongs != null )
2331 {
2332 Trace.TraceInformation( "曲検索actの終了処理を行います。" );
2333 Trace.Indent();
2334 try
2335 {
2336 actEnumSongs.On非活性化();
2337 actEnumSongs= null;
2338 Trace.TraceInformation( "曲検索actの終了処理を完了しました。" );
2339 }
2340 catch ( Exception e )
2341 {
2342 Trace.TraceError( e.Message );
2343 Trace.TraceError( "曲検索actの終了処理に失敗しました。" );
2344 }
2345 finally
2346 {
2347 Trace.Unindent();
2348 }
2349 }
2350 //---------------------
2351 #endregion
2352 #region [ 現在のステージの終了処理 ]
2353 //---------------------
2354 if( CDTXMania.r現在のステ != null && CDTXMania.r現在のステ.b活性化してる ) // #25398 2011.06.07 MODIFY FROM
2355 {
2356 Trace.TraceInformation( "現在のステージを終了します。" );
2357 Trace.Indent();
2358 try
2359 {
2360 r現在のステ.On非活性化();
2361 Trace.TraceInformation( "現在のステージの終了処理を完了しました。" );
2362 }
2363 finally
2364 {
2365 Trace.Unindent();
2366 }
2367 }
2368 //---------------------
2369 #endregion
2370 #region [ プラグインの終了処理 ]
2371 //---------------------
2372 if (this.listプラグイン != null && this.listプラグイン.Count > 0)
2373 {
2374 Trace.TraceInformation( "すべてのプラグインを終了します。" );
2375 Trace.Indent();
2376 try
2377 {
2378 foreach( STPlugin st in this.listプラグイン )
2379 {
2380 Directory.SetCurrentDirectory( st.strプラグインフォルダ );
2381 st.plugin.OnUnmanagedリソスの解放();
2382 st.plugin.OnManagedリソスの解放();
2383 st.plugin.On終了();
2384 Directory.SetCurrentDirectory( CDTXMania.strEXEのあるフォルダ );
2385 }
2386 PluginHost = null;
2387 Trace.TraceInformation( "すべてのプラグインの終了処理を完了しました。" );
2388 }
2389 finally
2390 {
2391 Trace.Unindent();
2392 }
2393 }
2394 //---------------------
2395 #endregion
2396 #region [ 曲リストの終了処理 ]
2397 //---------------------
2398 if (Songs管理 != null)
2399 {
2400 Trace.TraceInformation( "曲リストの終了処理を行います。" );
2401 Trace.Indent();
2402 try
2403 {
2404 Songs管理 = null;
2405 Trace.TraceInformation( "曲リストの終了処理を完了しました。" );
2406 }
2407 catch( Exception exception )
2408 {
2409 Trace.TraceError( exception.Message );
2410 Trace.TraceError( "曲リストの終了処理に失敗しました。" );
2411 }
2412 finally
2413 {
2414 Trace.Unindent();
2415 }
2416 }
2417 CAvi.t終了();
2418 //---------------------
2419 #endregion
2420 #region [ スキンの終了処理 ]
2421 //---------------------
2422 if (Skin != null)
2423 {
2424 Trace.TraceInformation( "スキンの終了処理を行います。" );
2425 Trace.Indent();
2426 try
2427 {
2428 Skin.Dispose();
2429 Skin = null;
2430 Trace.TraceInformation( "スキンの終了処理を完了しました。" );
2431 }
2432 catch( Exception exception2 )
2433 {
2434 Trace.TraceError( exception2.Message );
2435 Trace.TraceError( "スキンの終了処理に失敗しました。" );
2436 }
2437 finally
2438 {
2439 Trace.Unindent();
2440 }
2441 }
2442 //---------------------
2443 #endregion
2444 #region [ DirectSoundの終了処理 ]
2445 //---------------------
2446 if (Sound管理 != null)
2447 {
2448 Trace.TraceInformation( "DirectSound の終了処理を行います。" );
2449 Trace.Indent();
2450 try
2451 {
2452 Sound管理.Dispose();
2453 Sound管理 = null;
2454 Trace.TraceInformation( "DirectSound の終了処理を完了しました。" );
2455 }
2456 catch( Exception exception3 )
2457 {
2458 Trace.TraceError( exception3.Message );
2459 Trace.TraceError( "DirectSound の終了処理に失敗しました。" );
2460 }
2461 finally
2462 {
2463 Trace.Unindent();
2464 }
2465 }
2466 //---------------------
2467 #endregion
2468 #region [ パッドの終了処理 ]
2469 //---------------------
2470 if (Pad != null)
2471 {
2472 Trace.TraceInformation( "パッドの終了処理を行います。" );
2473 Trace.Indent();
2474 try
2475 {
2476 Pad = null;
2477 Trace.TraceInformation( "パッドの終了処理を完了しました。" );
2478 }
2479 catch( Exception exception4 )
2480 {
2481 Trace.TraceError( exception4.Message );
2482 Trace.TraceError( "パッドの終了処理に失敗しました。" );
2483 }
2484 finally
2485 {
2486 Trace.Unindent();
2487 }
2488 }
2489 //---------------------
2490 #endregion
2491 #region [ DirectInput, MIDI入力の終了処理 ]
2492 //---------------------
2493 if (Input管理 != null)
2494 {
2495 Trace.TraceInformation( "DirectInput, MIDI入力の終了処理を行います。" );
2496 Trace.Indent();
2497 try
2498 {
2499 Input管理.Dispose();
2500 Input管理 = null;
2501 Trace.TraceInformation( "DirectInput, MIDI入力の終了処理を完了しました。" );
2502 }
2503 catch( Exception exception5 )
2504 {
2505 Trace.TraceError( exception5.Message );
2506 Trace.TraceError( "DirectInput, MIDI入力の終了処理に失敗しました。" );
2507 }
2508 finally
2509 {
2510 Trace.Unindent();
2511 }
2512 }
2513 //---------------------
2514 #endregion
2515 #region [ 文字コンソールの終了処理 ]
2516 //---------------------
2517 if (act文字コンソ != null)
2518 {
2519 Trace.TraceInformation( "文字コンソールの終了処理を行います。" );
2520 Trace.Indent();
2521 try
2522 {
2523 act文字コンソ.On非活性化();
2524 act文字コンソ = null;
2525 Trace.TraceInformation( "文字コンソールの終了処理を完了しました。" );
2526 }
2527 catch( Exception exception6 )
2528 {
2529 Trace.TraceError( exception6.Message );
2530 Trace.TraceError( "文字コンソールの終了処理に失敗しました。" );
2531 }
2532 finally
2533 {
2534 Trace.Unindent();
2535 }
2536 }
2537 //---------------------
2538 #endregion
2539 #region [ FPSカウンタの終了処理 ]
2540 //---------------------
2541 Trace.TraceInformation("FPSカウンタの終了処理を行います。");
2542 Trace.Indent();
2543 try
2544 {
2545 if( FPS != null )
2546 {
2547 FPS = null;
2548 }
2549 Trace.TraceInformation( "FPSカウンタの終了処理を完了しました。" );
2550 }
2551 finally
2552 {
2553 Trace.Unindent();
2554 }
2555 //---------------------
2556 #endregion
2557
2558 // ct.Dispose();
2559
2560 #region [ タイマの終了処理 ]
2561 //---------------------
2562 Trace.TraceInformation("タイマの終了処理を行います。");
2563 Trace.Indent();
2564 try
2565 {
2566 if( Timer != null )
2567 {
2568 Timer.Dispose();
2569 Timer = null;
2570
2571 Trace.TraceInformation( "タイマの終了処理を完了しました。" );
2572 }
2573 else
2574 {
2575 Trace.TraceInformation( "タイマは使用されていません。" );
2576 }
2577 }
2578 finally
2579 {
2580 Trace.Unindent();
2581 }
2582 //---------------------
2583 #endregion
2584 #region [ Config.iniの出力 ]
2585 //---------------------
2586 Trace.TraceInformation("Config.ini を出力します。");
2587 // if ( ConfigIni.bIsSwappedGuitarBass ) // #24063 2011.1.16 yyagi ギターベースがスワップしているときは元に戻す
2588 if ( ConfigIni.bIsSwappedGuitarBass_AutoFlagsAreSwapped ) // #24415 2011.2.21 yyagi FLIP中かつ演奏中にalt-f4で終了したときは、AUTOのフラグをswapして戻す
2589 {
2590 ConfigIni.SwapGuitarBassInfos_AutoFlags();
2591 }
2592 string str = strEXEのあるフォルダ + "Config.ini";
2593 Trace.Indent();
2594 try
2595 {
2596 if ( DTXVmode.Enabled )
2597 {
2598 DTXVmode.tUpdateConfigIni();
2599 Trace.TraceInformation( "DTXVモードの設定情報を、Config.iniに保存しました。" );
2600 }
2601 else
2602 {
2603 ConfigIni.t書き出し( str );
2604 Trace.TraceInformation( "保存しました。({0})", str );
2605 }
2606 }
2607 catch( Exception e )
2608 {
2609 Trace.TraceError( e.Message );
2610 Trace.TraceError( "Config.ini の出力に失敗しました。({0})", str );
2611 }
2612 finally
2613 {
2614 Trace.Unindent();
2615 }
2616 //---------------------
2617 #endregion
2618 #region [ DTXVmodeの終了処理 ]
2619 //---------------------
2620 //Trace.TraceInformation( "DTXVモードの終了処理を行います。" );
2621 //Trace.Indent();
2622 try
2623 {
2624 if ( DTXVmode != null )
2625 {
2626 DTXVmode = null;
2627 //Trace.TraceInformation( "DTXVモードの終了処理を完了しました。" );
2628 }
2629 else
2630 {
2631 //Trace.TraceInformation( "DTXVモードは使用されていません。" );
2632 }
2633 }
2634 finally
2635 {
2636 //Trace.Unindent();
2637 }
2638 //---------------------
2639 #endregion
2640 Trace.TraceInformation("アプリケーションの終了処理を完了しました。");
2641
2642
2643 this.b終了処理完了済み = true;
2644 }
2645 }
2646
2647 private CScoreIni tScoreIniBGMAdjustHistoryPlayCountを更新(string str新ヒストリ行)
2648 {
2649 bool bIsUpdatedDrums, bIsUpdatedGuitar, bIsUpdatedBass;
2650 string strFilename = DTX.strファイル名の絶対パス + ".score.ini";
2651 CScoreIni ini = new CScoreIni( strFilename );
2652 if( !File.Exists( strFilename ) )
2653 {
2654 ini.stファイル.Title = DTX.TITLE;
2655 ini.stファイル.Name = DTX.strファイル名;
2656 ini.stファイル.Hash = CScoreIni.tファイルのMD5を求めて返す( DTX.strファイル名の絶対パス );
2657 for( int i = 0; i < 6; i++ )
2658 {
2659 ini.stセクション[ i ].nPerfectになる範囲ms = nPerfect範囲ms;
2660 ini.stセクション[ i ].nGreatになる範囲ms = nGreat範囲ms;
2661 ini.stセクション[ i ].nGoodになる範囲ms = nGood範囲ms;
2662 ini.stセクション[ i ].nPoorになる範囲ms = nPoor範囲ms;
2663 }
2664 }
2665 ini.stファイル.BGMAdjust = DTX.nBGMAdjust;
2666 CScoreIni.t更新条件を取得する( out bIsUpdatedDrums, out bIsUpdatedGuitar, out bIsUpdatedBass );
2667 if( bIsUpdatedDrums || bIsUpdatedGuitar || bIsUpdatedBass )
2668 {
2669 if( bIsUpdatedDrums )
2670 {
2671 ini.stファイル.PlayCountDrums++;
2672 }
2673 if( bIsUpdatedGuitar )
2674 {
2675 ini.stファイル.PlayCountGuitar++;
2676 }
2677 if( bIsUpdatedBass )
2678 {
2679 ini.stファイル.PlayCountBass++;
2680 }
2681 ini.tヒストリを追加する( str新ヒストリ行 );
2682 if( !bコンパクトモ )
2683 {
2684 stage選曲.r現在選択中のスコア.譜面情報.演奏回数.Drums = ini.stファイル.PlayCountDrums;
2685 stage選曲.r現在選択中のスコア.譜面情報.演奏回数.Guitar = ini.stファイル.PlayCountGuitar;
2686 stage選曲.r現在選択中のスコア.譜面情報.演奏回数.Bass = ini.stファイル.PlayCountBass;
2687 for( int j = 0; j < ini.stファイル.History.Length; j++ )
2688 {
2689 stage選曲.r現在選択中のスコア.譜面情報.演奏履歴[ j ] = ini.stファイル.History[ j ];
2690 }
2691 }
2692 }
2693 if( ConfigIni.bScoreIniを出力する )
2694 {
2695 ini.t書き出し( strFilename );
2696 }
2697
2698 return ini;
2699 }
2700 private void tガベジコレクションを実行する()
2701 {
2702 GC.Collect();
2703 GC.WaitForPendingFinalizers();
2704 GC.Collect();
2705 GC.WaitForPendingFinalizers();
2706 }
2707 private void tプラグイン検索と生成()
2708 {
2709 this.listプラグイン = new List<STPlugin>();
2710
2711 string strIPluginActivityの名前 = typeof( IPluginActivity ).FullName;
2712 string strプラグインフォルダパス = strEXEのあるフォルダ + "Plugins\\";
2713
2714 this.t指定フォルダ内でのプラグイン検索と生成( strプラグインフォルダパス, strIPluginActivityの名前 );
2715
2716 if( this.listプラグイン.Count > 0 )
2717 Trace.TraceInformation( this.listプラグイン.Count + " 個のプラグインを読み込みました。" );
2718 }
2719 #region [ Windowイベント処理 ]
2720 private void t指定フォルダ内でのプラグイン検索と生成( string strプラグインフォルダパス, string strプラグイン型名 )
2721 {
2722 // 指定されたパスが存在しないとエラー
2723 if( !Directory.Exists( strプラグインフォルダパス ) )
2724 {
2725 Trace.TraceWarning( "プラグインフォルダが存在しません。(" + strプラグインフォルダパス + ")" );
2726 return;
2727 }
2728
2729 // (1) すべての *.dll について…
2730 string[] strDLLs = System.IO.Directory.GetFiles( strプラグインフォルダパス, "*.dll" );
2731 foreach( string dllName in strDLLs )
2732 {
2733 try
2734 {
2735 // (1-1) dll をアセンブリとして読み込む。
2736 System.Reflection.Assembly asm = System.Reflection.Assembly.LoadFrom( dllName );
2737
2738 // (1-2) アセンブリ内のすべての型について、プラグインとして有効か調べる
2739 foreach( Type t in asm.GetTypes() )
2740 {
2741 // (1-3) ↓クラスであり↓Publicであり↓抽象クラスでなく↓IPlugin型のインスタンスが作れる 型を持っていれば有効
2742 if( t.IsClass && t.IsPublic && !t.IsAbstract && t.GetInterface( strプラグイン型名 ) != null )
2743 {
2744 // (1-4) クラス名からインスタンスを作成する
2745 var st = new STPlugin() {
2746 plugin = (IPluginActivity) asm.CreateInstance( t.FullName ),
2747 strプラグインフォルダ = Path.GetDirectoryName( dllName ),
2748 strアセンブリ簡易名 = asm.GetName().Name,
2749 Version = asm.GetName().Version,
2750 };
2751
2752 // (1-5) プラグインリストへ登録
2753 this.listプラグイン.Add( st );
2754 Trace.TraceInformation( "プラグイン {0} ({1}, {2}, {3}) を読み込みました。", t.FullName, Path.GetFileName( dllName ), st.strアセンブリ簡易名, st.Version.ToString() );
2755 }
2756 }
2757 }
2758 catch
2759 {
2760 Trace.TraceInformation( dllName + " からプラグインを生成することに失敗しました。スキップします。" );
2761 }
2762 }
2763
2764 // (2) サブフォルダがあれば再帰する
2765 string[] strDirs = Directory.GetDirectories( strプラグインフォルダパス, "*" );
2766 foreach( string dir in strDirs )
2767 this.t指定フォルダ内でのプラグイン検索と生成( dir + "\\", strプラグイン型名 );
2768 }
2769 //-----------------
2770 private void Window_ApplicationActivated(object sender, EventArgs e)
2771 {
2772 this.bApplicationActive = true;
2773 }
2774 private void Window_ApplicationDeactivated(object sender, EventArgs e)
2775 {
2776 this.bApplicationActive = false;
2777 }
2778 private void Window_KeyDown(object sender, KeyEventArgs e)
2779 {
2780 if (e.KeyCode == Keys.Menu)
2781 {
2782 e.Handled = true;
2783 e.SuppressKeyPress = true;
2784 }
2785 else if ((e.KeyCode == Keys.Return) && e.Alt)
2786 {
2787 if (ConfigIni != null)
2788 {
2789 ConfigIni.bウィンドウモ = !ConfigIni.bウィンドウモ;
2790 this.t全画面・ウィンドウモド切り替え();
2791 }
2792 e.Handled = true;
2793 e.SuppressKeyPress = true;
2794 }
2795 else
2796 {
2797 for (int i = 0; i < 0x10; i++)
2798 {
2799 if (ConfigIni.KeyAssign.System.Capture[i]. > 0 &&
2800 e.KeyCode == DeviceConstantConverter.KeyToKeyCode((SlimDX.DirectInput.Key)ConfigIni.KeyAssign.System.Capture[i].))
2801 {
2802 // Debug.WriteLine( "capture: " + string.Format( "{0:2x}", (int) e.KeyCode ) + " " + (int) e.KeyCode );
2803 string strFullPath =
2804 Path.Combine(CDTXMania.strEXEのあるフォルダ, "Capture_img");
2805 strFullPath = Path.Combine(strFullPath, DateTime.Now.ToString("yyyyMMddHHmmss") + ".png");
2806 SaveResultScreen(strFullPath);
2807 }
2808 }
2809 }
2810 }
2811 private void Window_MouseUp(object sender, MouseEventArgs e)
2812 {
2813 mb = e.Button;
2814 }
2815
2816 private void Window_MouseDoubleClick(object sender, MouseEventArgs e) // #23510 2010.11.13 yyagi: to go full screen mode
2817 {
2818 if (mb.Equals(MouseButtons.Left) && ConfigIni.bIsAllowedDoubleClickFullscreen) // #26752 2011.11.27 yyagi
2819 {
2820 ConfigIni.bウィンドウモ = false;
2821 this.t全画面・ウィンドウモド切り替え();
2822 }
2823 }
2824 private void Window_ResizeEnd(object sender, EventArgs e) // #23510 2010.11.20 yyagi: to get resized window size
2825 {
2826 if (ConfigIni.bウィンドウモ)
2827 {
2828 ConfigIni.n初期ウィンドウ開始位置X = base.Window.Location.X; // #30675 2013.02.04 ikanick add
2829 ConfigIni.n初期ウィンドウ開始位置Y = base.Window.Location.Y; //
2830 }
2831
2832 ConfigIni.nウインドウwidth = (ConfigIni.bウィンドウモ) ? base.Window.ClientSize.Width : currentClientSize.Width; // #23510 2010.10.31 yyagi add
2833 ConfigIni.nウインドウheight = (ConfigIni.bウィンドウモ) ? base.Window.ClientSize.Height : currentClientSize.Height;
2834 }
2835 #endregion
2836
2837 //internal sealed class GCBeep // GC発生の度にbeep
2838 //{
2839 // ~GCBeep()
2840 // {
2841 // Console.Beep();
2842 // if ( !AppDomain.CurrentDomain.IsFinalizingForUnload()
2843 // && !Environment.HasShutdownStarted )
2844 // {
2845 // new GCBeep();
2846 // }
2847 // }
2848 //}
2849
2850 //-----------------
2851
2852 Stopwatch sw = new Stopwatch();
2853 List<double> swlist;
2854
2855 #endregion
2856 }
2857 }

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