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