#pragma once #include #include #include #include "msclr/marshal_cppstd.h" #pragma comment(lib, "user32.lib") using namespace msclr::interop; namespace FairyWork { using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; using namespace std; /// /// Form1 の概要 /// public ref class Form1 : public System::Windows::Forms::Form { public: Form1(void) { InitializeComponent(); // //TODO: ここにコンストラクター コードを追加します // //設定用データFWConfig.iniが同一フォルダに存在したら読み込む //前回実行時の状態にする ifstream Config; Config.open("FWConfig.ini"); if(Config){ string buf; getline(Config, buf); textBox1->Text = marshal_as(buf);//MUGENフォルダ getline(Config, buf); textBox2->Text = marshal_as(buf);//対戦キャラクターリスト getline(Config, buf); textBox3->Text = marshal_as(buf);//使用ステージ getline(Config, buf); textBox4->Text = marshal_as(buf);//保存フォルダ getline(Config, buf); if(buf == "1"){ radioButton1->Checked = true; }else{ radioButton2->Checked = true; } getline(Config, buf); if(buf == "3"){ radioButton3->Checked = true; }else{ radioButton4->Checked = true; } getline(Config, buf); if(buf == "1")checkBox1->Checked = true; //nomusic getline(Config, buf); if(buf == "1")checkBox2->Checked = true; //nosound getline(Config, buf); if(buf == "1")checkBox3->Checked = true; //Ctrl+S getline(Config, buf); if(buf == "1")checkBox4->Checked = true; //自動縮小化 getline(Config, buf); if(buf == "1")checkBox5->Checked = true; //Record getline(Config, buf); if(buf == "1")checkBox6->Checked = true; //VSlist getline(Config, buf); if(buf == "0")checkBox7->Checked = false; //Result getline(Config, buf); if(buf == "1")checkBox8->Checked = true; //続きから getline(Config, buf); if(buf == "1")checkBox9->Checked = true; //上書き確認しない getline(Config, buf); int i; sscanf_s(buf.data(), "%d", &i); numericUpDown1->Value = (System::Decimal)i; //ラウンド数 getline(Config, buf); sscanf_s(buf.data(), "%d", &i); numericUpDown2->Value = (System::Decimal)i; //セット数 } } protected: /// /// 使用中のリソースをすべてクリーンアップします。 /// ~Form1() { if (components) { delete components; } } private: System::Windows::Forms::Button^ button1; private: System::Windows::Forms::Label^ label7; private: System::Windows::Forms::TextBox^ textBox1; private: System::Windows::Forms::TextBox^ textBox2; private: System::Windows::Forms::Button^ button2; private: System::Windows::Forms::Button^ button3; private: System::Windows::Forms::FolderBrowserDialog^ folderBrowserDialog1; private: System::Windows::Forms::Label^ label2; private: System::Windows::Forms::Label^ label3; private: System::Windows::Forms::OpenFileDialog^ openFileDialog1; private: System::Windows::Forms::GroupBox^ groupBox1; private: System::Windows::Forms::RadioButton^ radioButton2; private: System::Windows::Forms::RadioButton^ radioButton1; private: System::Windows::Forms::GroupBox^ groupBox2; private: System::Windows::Forms::RadioButton^ radioButton4; private: System::Windows::Forms::RadioButton^ radioButton3; private: System::Windows::Forms::Label^ label4; private: System::Windows::Forms::TextBox^ textBox3; private: System::Windows::Forms::CheckBox^ checkBox1; private: System::Windows::Forms::CheckBox^ checkBox2; private: System::Windows::Forms::CheckBox^ checkBox3; private: System::Windows::Forms::NumericUpDown^ numericUpDown1; private: System::Windows::Forms::NumericUpDown^ numericUpDown2; private: System::Windows::Forms::Label^ label5; private: System::Windows::Forms::Label^ label6; private: System::Windows::Forms::CheckBox^ checkBox4; private: System::Windows::Forms::GroupBox^ groupBox4; private: System::Windows::Forms::CheckBox^ checkBox7; private: System::Windows::Forms::CheckBox^ checkBox6; private: System::Windows::Forms::CheckBox^ checkBox5; private: System::Windows::Forms::GroupBox^ groupBox3; private: System::Windows::Forms::CheckBox^ checkBox8; private: System::Windows::Forms::GroupBox^ groupBox5; private: System::Windows::Forms::Label^ label8; private: System::Windows::Forms::CheckBox^ checkBox9; private: System::ComponentModel::BackgroundWorker^ backgroundWorker1; private: System::Windows::Forms::Button^ button4; private: System::Windows::Forms::TextBox^ textBox4; private: System::Windows::Forms::Label^ label1; protected: private: /// /// 必要なデザイナー変数です。 /// System::ComponentModel::Container ^components; #pragma region Windows Form Designer generated code /// /// デザイナー サポートに必要なメソッドです。このメソッドの内容を /// コード エディターで変更しないでください。 /// void InitializeComponent(void) { this->button1 = (gcnew System::Windows::Forms::Button()); this->label7 = (gcnew System::Windows::Forms::Label()); this->textBox1 = (gcnew System::Windows::Forms::TextBox()); this->textBox2 = (gcnew System::Windows::Forms::TextBox()); this->button2 = (gcnew System::Windows::Forms::Button()); this->button3 = (gcnew System::Windows::Forms::Button()); this->folderBrowserDialog1 = (gcnew System::Windows::Forms::FolderBrowserDialog()); this->label2 = (gcnew System::Windows::Forms::Label()); this->label3 = (gcnew System::Windows::Forms::Label()); this->openFileDialog1 = (gcnew System::Windows::Forms::OpenFileDialog()); this->groupBox1 = (gcnew System::Windows::Forms::GroupBox()); this->radioButton2 = (gcnew System::Windows::Forms::RadioButton()); this->radioButton1 = (gcnew System::Windows::Forms::RadioButton()); this->groupBox2 = (gcnew System::Windows::Forms::GroupBox()); this->radioButton4 = (gcnew System::Windows::Forms::RadioButton()); this->radioButton3 = (gcnew System::Windows::Forms::RadioButton()); this->label4 = (gcnew System::Windows::Forms::Label()); this->textBox3 = (gcnew System::Windows::Forms::TextBox()); this->checkBox1 = (gcnew System::Windows::Forms::CheckBox()); this->checkBox2 = (gcnew System::Windows::Forms::CheckBox()); this->checkBox3 = (gcnew System::Windows::Forms::CheckBox()); this->numericUpDown1 = (gcnew System::Windows::Forms::NumericUpDown()); this->numericUpDown2 = (gcnew System::Windows::Forms::NumericUpDown()); this->label5 = (gcnew System::Windows::Forms::Label()); this->label6 = (gcnew System::Windows::Forms::Label()); this->checkBox4 = (gcnew System::Windows::Forms::CheckBox()); this->groupBox4 = (gcnew System::Windows::Forms::GroupBox()); this->checkBox7 = (gcnew System::Windows::Forms::CheckBox()); this->checkBox6 = (gcnew System::Windows::Forms::CheckBox()); this->checkBox5 = (gcnew System::Windows::Forms::CheckBox()); this->groupBox3 = (gcnew System::Windows::Forms::GroupBox()); this->checkBox8 = (gcnew System::Windows::Forms::CheckBox()); this->groupBox5 = (gcnew System::Windows::Forms::GroupBox()); this->checkBox9 = (gcnew System::Windows::Forms::CheckBox()); this->label8 = (gcnew System::Windows::Forms::Label()); this->backgroundWorker1 = (gcnew System::ComponentModel::BackgroundWorker()); this->button4 = (gcnew System::Windows::Forms::Button()); this->textBox4 = (gcnew System::Windows::Forms::TextBox()); this->label1 = (gcnew System::Windows::Forms::Label()); this->groupBox1->SuspendLayout(); this->groupBox2->SuspendLayout(); (cli::safe_cast(this->numericUpDown1))->BeginInit(); (cli::safe_cast(this->numericUpDown2))->BeginInit(); this->groupBox4->SuspendLayout(); this->groupBox3->SuspendLayout(); this->groupBox5->SuspendLayout(); this->SuspendLayout(); // // button1 // this->button1->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, static_cast(128))); this->button1->Location = System::Drawing::Point(230, 308); this->button1->Name = L"button1"; this->button1->Size = System::Drawing::Size(101, 40); this->button1->TabIndex = 0; this->button1->Text = L"実行"; this->button1->UseVisualStyleBackColor = true; this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click); // // label7 // this->label7->Location = System::Drawing::Point(220, 269); this->label7->Name = L"label7"; this->label7->Size = System::Drawing::Size(111, 17); this->label7->TabIndex = 1; this->label7->Text = L" セット目"; this->label7->TextAlign = System::Drawing::ContentAlignment::MiddleRight; // // textBox1 // this->textBox1->Location = System::Drawing::Point(14, 24); this->textBox1->Name = L"textBox1"; this->textBox1->Size = System::Drawing::Size(258, 19); this->textBox1->TabIndex = 2; // // textBox2 // this->textBox2->Location = System::Drawing::Point(14, 61); this->textBox2->Name = L"textBox2"; this->textBox2->Size = System::Drawing::Size(258, 19); this->textBox2->TabIndex = 3; // // button2 // this->button2->Location = System::Drawing::Point(278, 22); this->button2->Name = L"button2"; this->button2->Size = System::Drawing::Size(53, 23); this->button2->TabIndex = 4; this->button2->Text = L"選択"; this->button2->UseVisualStyleBackColor = true; this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click); // // button3 // this->button3->Location = System::Drawing::Point(278, 61); this->button3->Name = L"button3"; this->button3->Size = System::Drawing::Size(53, 23); this->button3->TabIndex = 5; this->button3->Text = L"選択"; this->button3->UseVisualStyleBackColor = true; this->button3->Click += gcnew System::EventHandler(this, &Form1::button3_Click); // // label2 // this->label2->AutoSize = true; this->label2->Location = System::Drawing::Point(12, 9); this->label2->Name = L"label2"; this->label2->Size = System::Drawing::Size(80, 12); this->label2->TabIndex = 6; this->label2->Text = L"MUGENフォルダ"; // // label3 // this->label3->AutoSize = true; this->label3->Location = System::Drawing::Point(12, 46); this->label3->Name = L"label3"; this->label3->Size = System::Drawing::Size(105, 12); this->label3->TabIndex = 7; this->label3->Text = L"対戦キャラクターリスト"; // // openFileDialog1 // this->openFileDialog1->FileName = L"openFileDialog1"; // // groupBox1 // this->groupBox1->Controls->Add(this->radioButton2); this->groupBox1->Controls->Add(this->radioButton1); this->groupBox1->Location = System::Drawing::Point(16, 128); this->groupBox1->Name = L"groupBox1"; this->groupBox1->Size = System::Drawing::Size(120, 85); this->groupBox1->TabIndex = 8; this->groupBox1->TabStop = false; this->groupBox1->Text = L"繰り返し方式1"; // // radioButton2 // this->radioButton2->AutoSize = true; this->radioButton2->Location = System::Drawing::Point(6, 56); this->radioButton2->Name = L"radioButton2"; this->radioButton2->Size = System::Drawing::Size(88, 16); this->radioButton2->TabIndex = 1; this->radioButton2->Text = L"先頭キャラVS"; this->radioButton2->UseVisualStyleBackColor = true; // // radioButton1 // this->radioButton1->AutoSize = true; this->radioButton1->Checked = true; this->radioButton1->Location = System::Drawing::Point(6, 22); this->radioButton1->Name = L"radioButton1"; this->radioButton1->Size = System::Drawing::Size(67, 16); this->radioButton1->TabIndex = 0; this->radioButton1->TabStop = true; this->radioButton1->Text = L"総当り式"; this->radioButton1->UseVisualStyleBackColor = true; // // groupBox2 // this->groupBox2->Controls->Add(this->radioButton4); this->groupBox2->Controls->Add(this->radioButton3); this->groupBox2->Location = System::Drawing::Point(142, 128); this->groupBox2->Name = L"groupBox2"; this->groupBox2->Size = System::Drawing::Size(130, 85); this->groupBox2->TabIndex = 9; this->groupBox2->TabStop = false; this->groupBox2->Text = L"繰り返し方式2"; // // radioButton4 // this->radioButton4->AutoSize = true; this->radioButton4->Location = System::Drawing::Point(6, 56); this->radioButton4->Name = L"radioButton4"; this->radioButton4->Size = System::Drawing::Size(92, 16); this->radioButton4->TabIndex = 1; this->radioButton4->Text = L"表のみ(1P:2P)"; this->radioButton4->UseVisualStyleBackColor = true; // // radioButton3 // this->radioButton3->AutoSize = true; this->radioButton3->Checked = true; this->radioButton3->Location = System::Drawing::Point(6, 22); this->radioButton3->Name = L"radioButton3"; this->radioButton3->Size = System::Drawing::Size(121, 16); this->radioButton3->TabIndex = 0; this->radioButton3->TabStop = true; this->radioButton3->Text = L"表裏 (1P:2P,2P:1P)"; this->radioButton3->UseVisualStyleBackColor = true; // // label4 // this->label4->AutoSize = true; this->label4->Location = System::Drawing::Point(12, 83); this->label4->Name = L"label4"; this->label4->Size = System::Drawing::Size(67, 12); this->label4->TabIndex = 11; this->label4->Text = L"使用ステージ"; // // textBox3 // this->textBox3->Location = System::Drawing::Point(14, 98); this->textBox3->Name = L"textBox3"; this->textBox3->Size = System::Drawing::Size(155, 19); this->textBox3->TabIndex = 12; // // checkBox1 // this->checkBox1->AutoSize = true; this->checkBox1->Location = System::Drawing::Point(11, 18); this->checkBox1->Name = L"checkBox1"; this->checkBox1->Size = System::Drawing::Size(66, 16); this->checkBox1->TabIndex = 13; this->checkBox1->Text = L"nomusic"; this->checkBox1->UseVisualStyleBackColor = true; // // checkBox2 // this->checkBox2->AutoSize = true; this->checkBox2->Location = System::Drawing::Point(83, 18); this->checkBox2->Name = L"checkBox2"; this->checkBox2->Size = System::Drawing::Size(66, 16); this->checkBox2->TabIndex = 14; this->checkBox2->Text = L"nosound"; this->checkBox2->UseVisualStyleBackColor = true; // // checkBox3 // this->checkBox3->AutoSize = true; this->checkBox3->Location = System::Drawing::Point(155, 18); this->checkBox3->Name = L"checkBox3"; this->checkBox3->Size = System::Drawing::Size(56, 16); this->checkBox3->TabIndex = 15; this->checkBox3->Text = L"Ctrl+S"; this->checkBox3->UseVisualStyleBackColor = true; // // numericUpDown1 // this->numericUpDown1->Location = System::Drawing::Point(278, 147); this->numericUpDown1->Maximum = System::Decimal(gcnew cli::array< System::Int32 >(4) {10, 0, 0, 0}); this->numericUpDown1->Minimum = System::Decimal(gcnew cli::array< System::Int32 >(4) {1, 0, 0, 0}); this->numericUpDown1->Name = L"numericUpDown1"; this->numericUpDown1->Size = System::Drawing::Size(53, 19); this->numericUpDown1->TabIndex = 16; this->numericUpDown1->Value = System::Decimal(gcnew cli::array< System::Int32 >(4) {2, 0, 0, 0}); // // numericUpDown2 // this->numericUpDown2->Location = System::Drawing::Point(278, 184); this->numericUpDown2->Minimum = System::Decimal(gcnew cli::array< System::Int32 >(4) {1, 0, 0, 0}); this->numericUpDown2->Name = L"numericUpDown2"; this->numericUpDown2->Size = System::Drawing::Size(53, 19); this->numericUpDown2->TabIndex = 17; this->numericUpDown2->Value = System::Decimal(gcnew cli::array< System::Int32 >(4) {1, 0, 0, 0}); // // label5 // this->label5->AutoSize = true; this->label5->Location = System::Drawing::Point(279, 132); this->label5->Name = L"label5"; this->label5->Size = System::Drawing::Size(52, 12); this->label5->TabIndex = 18; this->label5->Text = L"ラウンド数"; // // label6 // this->label6->AutoSize = true; this->label6->Location = System::Drawing::Point(279, 169); this->label6->Name = L"label6"; this->label6->Size = System::Drawing::Size(42, 12); this->label6->TabIndex = 19; this->label6->Text = L"セット数"; // // checkBox4 // this->checkBox4->AutoSize = true; this->checkBox4->Location = System::Drawing::Point(225, 18); this->checkBox4->Name = L"checkBox4"; this->checkBox4->Size = System::Drawing::Size(84, 16); this->checkBox4->TabIndex = 20; this->checkBox4->Text = L"自動縮小化"; this->checkBox4->UseVisualStyleBackColor = true; // // groupBox4 // this->groupBox4->Controls->Add(this->checkBox7); this->groupBox4->Controls->Add(this->checkBox6); this->groupBox4->Controls->Add(this->checkBox5); this->groupBox4->Location = System::Drawing::Point(5, 265); this->groupBox4->Name = L"groupBox4"; this->groupBox4->Size = System::Drawing::Size(216, 37); this->groupBox4->TabIndex = 21; this->groupBox4->TabStop = false; this->groupBox4->Text = L"出力"; // // checkBox7 // this->checkBox7->AutoSize = true; this->checkBox7->Checked = true; this->checkBox7->CheckState = System::Windows::Forms::CheckState::Checked; this->checkBox7->Location = System::Drawing::Point(155, 15); this->checkBox7->Name = L"checkBox7"; this->checkBox7->Size = System::Drawing::Size(57, 16); this->checkBox7->TabIndex = 2; this->checkBox7->Text = L"Result"; this->checkBox7->UseVisualStyleBackColor = true; // // checkBox6 // this->checkBox6->AutoSize = true; this->checkBox6->Location = System::Drawing::Point(83, 15); this->checkBox6->Name = L"checkBox6"; this->checkBox6->Size = System::Drawing::Size(55, 16); this->checkBox6->TabIndex = 1; this->checkBox6->Text = L"VSlist"; this->checkBox6->UseVisualStyleBackColor = true; // // checkBox5 // this->checkBox5->AutoSize = true; this->checkBox5->Location = System::Drawing::Point(11, 15); this->checkBox5->Name = L"checkBox5"; this->checkBox5->Size = System::Drawing::Size(60, 16); this->checkBox5->TabIndex = 0; this->checkBox5->Text = L"Record"; this->checkBox5->UseVisualStyleBackColor = true; // // groupBox3 // this->groupBox3->Controls->Add(this->checkBox4); this->groupBox3->Controls->Add(this->checkBox1); this->groupBox3->Controls->Add(this->checkBox2); this->groupBox3->Controls->Add(this->checkBox3); this->groupBox3->Location = System::Drawing::Point(5, 219); this->groupBox3->Name = L"groupBox3"; this->groupBox3->Size = System::Drawing::Size(317, 40); this->groupBox3->TabIndex = 22; this->groupBox3->TabStop = false; this->groupBox3->Text = L"制御"; // // checkBox8 // this->checkBox8->AutoSize = true; this->checkBox8->Location = System::Drawing::Point(9, 18); this->checkBox8->Name = L"checkBox8"; this->checkBox8->Size = System::Drawing::Size(63, 16); this->checkBox8->TabIndex = 23; this->checkBox8->Text = L"続きから"; this->checkBox8->UseVisualStyleBackColor = true; // // groupBox5 // this->groupBox5->Controls->Add(this->checkBox9); this->groupBox5->Controls->Add(this->checkBox8); this->groupBox5->Location = System::Drawing::Point(5, 308); this->groupBox5->Name = L"groupBox5"; this->groupBox5->Size = System::Drawing::Size(216, 40); this->groupBox5->TabIndex = 25; this->groupBox5->TabStop = false; this->groupBox5->Text = L"その他"; // // checkBox9 // this->checkBox9->AutoSize = true; this->checkBox9->Location = System::Drawing::Point(83, 18); this->checkBox9->Name = L"checkBox9"; this->checkBox9->Size = System::Drawing::Size(110, 16); this->checkBox9->TabIndex = 24; this->checkBox9->Text = L"上書き確認しない"; this->checkBox9->UseVisualStyleBackColor = true; // // label8 // this->label8->ImageAlign = System::Drawing::ContentAlignment::MiddleRight; this->label8->Location = System::Drawing::Point(222, 286); this->label8->Name = L"label8"; this->label8->Size = System::Drawing::Size(109, 16); this->label8->TabIndex = 26; this->label8->Text = L"人目vs 人目"; this->label8->TextAlign = System::Drawing::ContentAlignment::MiddleRight; // // backgroundWorker1 // this->backgroundWorker1->WorkerReportsProgress = true; this->backgroundWorker1->WorkerSupportsCancellation = true; this->backgroundWorker1->DoWork += gcnew System::ComponentModel::DoWorkEventHandler(this, &Form1::backgroundWorker1_DoWork); this->backgroundWorker1->ProgressChanged += gcnew System::ComponentModel::ProgressChangedEventHandler(this, &Form1::backgroundWorker1_ProgressChanged); this->backgroundWorker1->RunWorkerCompleted += gcnew System::ComponentModel::RunWorkerCompletedEventHandler(this, &Form1::backgroundWorker1_RunWorkerCompleted); // // button4 // this->button4->Enabled = false; this->button4->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, static_cast(128))); this->button4->Location = System::Drawing::Point(230, 308); this->button4->Name = L"button4"; this->button4->Size = System::Drawing::Size(101, 40); this->button4->TabIndex = 27; this->button4->Text = L"中断"; this->button4->UseVisualStyleBackColor = true; this->button4->Visible = false; this->button4->Click += gcnew System::EventHandler(this, &Form1::button4_Click); // // textBox4 // this->textBox4->Location = System::Drawing::Point(176, 98); this->textBox4->Name = L"textBox4"; this->textBox4->Size = System::Drawing::Size(155, 19); this->textBox4->TabIndex = 28; // // label1 // this->label1->AutoSize = true; this->label1->Location = System::Drawing::Point(174, 83); this->label1->Name = L"label1"; this->label1->Size = System::Drawing::Size(64, 12); this->label1->TabIndex = 29; this->label1->Text = L"保存フォルダ"; // // Form1 // this->AutoScaleDimensions = System::Drawing::SizeF(6, 12); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; this->ClientSize = System::Drawing::Size(334, 358); this->Controls->Add(this->label1); this->Controls->Add(this->textBox4); this->Controls->Add(this->button4); this->Controls->Add(this->label8); this->Controls->Add(this->groupBox4); this->Controls->Add(this->label6); this->Controls->Add(this->label5); this->Controls->Add(this->numericUpDown2); this->Controls->Add(this->numericUpDown1); this->Controls->Add(this->textBox3); this->Controls->Add(this->label4); this->Controls->Add(this->groupBox2); this->Controls->Add(this->groupBox1); this->Controls->Add(this->label3); this->Controls->Add(this->label2); this->Controls->Add(this->button3); this->Controls->Add(this->button2); this->Controls->Add(this->textBox2); this->Controls->Add(this->textBox1); this->Controls->Add(this->label7); this->Controls->Add(this->button1); this->Controls->Add(this->groupBox3); this->Controls->Add(this->groupBox5); this->Name = L"Form1"; this->Text = L"FairyWork"; this->groupBox1->ResumeLayout(false); this->groupBox1->PerformLayout(); this->groupBox2->ResumeLayout(false); this->groupBox2->PerformLayout(); (cli::safe_cast(this->numericUpDown1))->EndInit(); (cli::safe_cast(this->numericUpDown2))->EndInit(); this->groupBox4->ResumeLayout(false); this->groupBox4->PerformLayout(); this->groupBox3->ResumeLayout(false); this->groupBox3->PerformLayout(); this->groupBox5->ResumeLayout(false); this->groupBox5->PerformLayout(); this->ResumeLayout(false); this->PerformLayout(); } #pragma endregion private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { // ボタン等のコントロールをOFFに textBox1->Enabled = false; textBox2->Enabled = false; textBox3->Enabled = false; textBox4->Enabled = false; button1->Enabled = false; button2->Enabled = false; button3->Enabled = false; radioButton1->Enabled = false; radioButton2->Enabled = false; radioButton3->Enabled = false; radioButton4->Enabled = false; numericUpDown1->Enabled = false; numericUpDown2->Enabled = false; checkBox1->Enabled = false; checkBox2->Enabled = false; checkBox3->Enabled = false; checkBox4->Enabled = false; checkBox5->Enabled = false; checkBox6->Enabled = false; checkBox7->Enabled = false; checkBox8->Enabled = false; checkBox9->Enabled = false; button1->Visible = false; backgroundWorker1->RunWorkerAsync(); //メイン処理実行 button4->Enabled = true; button4->Visible = true; } //実行クリックの終わり private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) { // フォルダ選択ダイアログの表示 FolderBrowserDialog ^dlg=gcnew FolderBrowserDialog(); if(dlg->ShowDialog() == System::Windows::Forms::DialogResult::OK) { String ^folderName=dlg->SelectedPath; textBox1->Text = folderName; } } private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) { //ファイルを開くダイアログの作成 OpenFileDialog^ openFileDialog1 = gcnew OpenFileDialog; //ダイアログの表示 (Cancelボタンがクリックされた場合は何もしない) if (openFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::Cancel) return; //取得したファイル名 textBox2->Text = L""; String^ FileName = openFileDialog1->FileName; textBox2->AppendText(FileName); } private: System::Void backgroundWorker1_DoWork(System::Object^ sender, System::ComponentModel::DoWorkEventArgs^ e) { //メイン処理 //☆☆ここから初期処理☆☆ //入力情報を取得 //MUGENフォルダ String^ MUGENfolder = gcnew String(textBox1->Text); marshal_context^ context = gcnew marshal_context; //あとで削除が必要らしい。 LPCTSTR MUGENfolderP = context->marshal_as(MUGENfolder); //キャラクターリストの場所 String^ InputcharsTxT = textBox2->Text; std::string Inputchars = marshal_as(InputcharsTxT); //ステージ名 String^ Inputstagename = textBox3->Text; std::string Inputstage = marshal_as(Inputstagename); //保存フォルダ名 String^ foldername = textBox4->Text; if(foldername!=""){ foldername = foldername + "\\"; //¥マークを最後につける。 } std::string folder = marshal_as(foldername); //ラウンド数 int numrounds = (int)numericUpDown1->Value; char t_char[3]; sprintf_s(t_char, "%d", numrounds); string numR; numR = t_char; //セット数 int numsets = (int)numericUpDown2->Value; //繰り返し方式 int settype = 1; if(radioButton2->Checked){ settype++; } if(radioButton4->Checked){ settype = settype+2; } //次回起動用に設定情報の書き出し(FWConfig.ini) OutConfig(); //GOTO 設定ファイル書出関数 //カレントディレクトリをMUGENフォルダに SetCurrentDirectory(MUGENfolderP); //出力先フォルダの作成 if(foldername!=""){ IO::Directory::CreateDirectory(foldername); } //コマンドラインのデフォルト部分 DefC を作成 string DefC = ("Winmugen -p1.ai 1 -p2.ai 1 -p1.color 1 -p2.color 1 ");//1P2PのAI起動と、1Pカラーをセット string stageC = (" -s "); string roundsC = (" -rounds "); string nomusicC = (" -nomusic "); string nosoundC = (" -nosound "); string p1C = (" -p1 "); string p2C = (" -p2 "); // "Winmugen -p1.ai 1 -p2.ai 1 -p2.color 1 -rounds ラウンド数" DefC = DefC + roundsC + numR; // ステージ指定があれば設定 if(Inputstage!=""){ DefC += stageC + Inputstage; // -s ステージ名 } // nomusic、nosoundのチェックの有無によりオプション追加 if(checkBox1->Checked){ DefC += nomusicC; } if(checkBox2->Checked){ DefC += nosoundC; } //試合進行管理用変数とか int linenum = 0; int lineMAX = 0; int line1P = 1; //1Pが何行目のキャラか int line2P = 1; //2Pが何行目のキャラか int numgame = 0; //何試合目か int nowsets = 1; //現在のセット数 string buf; //汎用文字列一時格納 string chars[4]; //キャラ名保存(コマンドライン用及びtxt出力用) //0:1Pコマンドライン 1:2Pコマンドライン //2:1Ptxt出力用 3:2Ptxt出力用 if(checkBox8->Checked){ //Checkflag.txtより中断情報取得 std::ifstream Checkflagin(folder+"outCheckflag.txt"); if(Checkflagin.fail()){ MessageBox::Show("outCheckflag.txt読み込みに失敗\n中断情報がありません。\n","エラーメッセージ"); delete context; //MUGENフォルダ情報削除 return; } getline(Checkflagin, buf); sscanf_s(buf.data(), "%d,%d,%d,%d,%d", &nowsets, &line1P, &line2P, &numgame, &lineMAX); Checkflagin.close(); }else if(!checkBox9->Checked){ //実行結果が残っていたら中断 std::ifstream Checkfile; if((checkBox6->Checked)){ Checkfile.open(folder+"outVSlist.txt"); if(!Checkfile.fail()){ MessageBox::Show("outVSlist.txtが残っています\n名前を変更するか、削除して下さい。\n","前回のVSlistが残ってます"); delete context; //MUGENフォルダ情報削除 return; } Checkfile.close(); } if((checkBox7->Checked)){ Checkfile.open(folder+"outCharResult.txt"); if(!Checkfile.fail()){ MessageBox::Show("outCharResult.txtが残っています\n名前を変更するか、削除して下さい。\n","前回のResultが残ってます"); delete context; //MUGENフォルダ情報削除 return; } Checkfile.close(); } } //☆☆ここまで初期処理☆☆ //☆☆ここからデータ収集☆☆ while(true){ //キャラクターリストから対戦者抽出 //キャラクターリスト読み込み std::ifstream charlist; charlist.open(Inputchars.c_str(), ios::in); if(charlist.fail()){ MessageBox::Show("指定されたキャラクターリストが読み込めません\n","エラーメッセージ"); break; } //次の対戦キャラクターを抽出 numgame ++; switch(settype){ case 1: //総当り・表裏 line2P++; if(line1P==line2P){ line2P++; } if(lineMAX && line2P>lineMAX){ line1P++; line2P=1; } if(lineMAX && line1P>lineMAX){ nowsets++; line1P=1; line2P=2; numgame=1; } break; case 2: //先頭・表裏 if(line1P==1){ line2P++; } if(line2P==1){ line1P++; } if(lineMAX && line2P>lineMAX){ line1P=2; line2P=1; } if(lineMAX && line1P>lineMAX){ nowsets++; line1P=1; line2P=2; numgame=1; } break; case 3: //総当り・表 line2P++; if(lineMAX && line2P>lineMAX){ line1P++; line2P=line1P+1; } if(lineMAX && line1P==lineMAX){ nowsets++; line1P=1; line2P=2; numgame=1; } break; case 4: //先頭・表 line2P++; if(lineMAX && line2P>lineMAX){ nowsets++; line1P=1; line2P=2; numgame=1; } break; } if(nowsets>numsets){ String^ defflag = foldername+"outCheckflag.txt"; IO::File::Delete(defflag); //終わったので中断情報削除 break; } linenum =0; while(charlist && getline(charlist, buf)) { if (buf=="")break; linenum++; if(linenum==line1P){ chars[2]=buf; //1P出力用 std::string::size_type pos = 0; while(pos = buf.find(":color", pos), pos != std::string::npos) { buf.replace(pos, 6, " -p1.color "); pos += 11; } chars[0]=buf; //カラー情報をコマンド用に変換 } if(linenum==line2P){ chars[3]=buf; //2P出力用 std::string::size_type pos = 0; while(pos = buf.find(":color", pos), pos != std::string::npos) { buf.replace(pos, 6, " -p2.color "); pos += 11; } chars[1]=buf; //カラー情報をコマンド用に変換 } if(lineMAX && linenum >= line1P && linenum >= line2P){ break; //必要な部分まで読んだら抜ける } } if(!lineMAX){ lineMAX=linenum; } linenum =0; charlist.clear(); //どこまで読んだかの情報クリア string MUGENCommand; MUGENCommand = DefC + p1C + chars[0] + p2C + chars[1]; //コマンドライン作成 //コマンドラインを変換 1000文字以上だと・・・ size_t origsize = strlen(MUGENCommand.c_str()) + 1; size_t convertedChars = 0; wchar_t wcstring[1000]; //ロケール指定 setlocale(LC_ALL,"japanese"); //2バイト文字対策・日本語指定! mbstowcs_s(&convertedChars, wcstring, origsize, MUGENCommand.c_str(), _TRUNCATE); //必要なアレコレを宣言 STARTUPINFO si; PROCESS_INFORMATION pi; ZeroMemory(&si, sizeof(si)); ZeroMemory(&pi, sizeof(pi)); si.cb = sizeof(si); char *lpData0; char *lpDataPP; char *lpDataGametime; char *lpDataRo; char *lpDataRoS; char *lpDataP1life; char *lpDataP2life; char *lpDataCtrlS; LPVOID EAX[1] = {0}; LPVOID EBX[2] = {0}; LPVOID Gametime[1] = {0}; LPVOID Round[5] = {0}; LPVOID RoundState[1] = {0}; LPVOID P1Life[2] = {0}; LPVOID P2Life[2] = {0}; LPVOID FlagON[1] = {0}; DWORD dwAccessByte = 0; int GameEnd = 0; int RoundEnd; int RoundtimeS; int RoundtimeE; int nowRound; int R_numRound[30] = {0}; int R_1PnumWin[30] = {0}; int R_2PnumWin[30] = {0}; int R_draw[30] = {0}; int R_1PHP[30] = {0}; int R_2PHP[30] = {0}; int R_Time[30] = {0}; //対戦状況を表示 String^ label=L""; label = line1P.ToString() + L"人目vs" + line2P.ToString() + L"人目"; backgroundWorker1->ReportProgress(nowsets,label); //MUGEN起動 CreateProcess( NULL, //szCmd, wcstring, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi); HANDLE ph = pi.hProcess; //MUGENのプロセスハンドル do{ // 基本のアドレス EAX取得 // 004B5B4C:ポインタ → EAX[0] lpData0=(char *)0x004B5B4C; ReadProcessMemory(ph,lpData0,EAX,4,&dwAccessByte); // プレイヤー情報ポインタ取得 // EAX+B754h:1Pのポインタ → EBX[0] // EAX+B758h:2Pのポインタ → EBX[1] lpDataPP=(char *)EAX[0]; lpDataPP+=0xB754; ReadProcessMemory(ph,lpDataPP,EBX,8,&dwAccessByte); if (backgroundWorker1->CancellationPending) { //中断ボタン処理 e->Cancel = true; delete context; //MUGENフォルダ情報削除 return; } }while(dwAccessByte == 0 || EBX[0]==0 || EBX[1]==0); //↑情報が取得できるまでループ // ゲーム高速化ON // EAX+C934h:ゲームスピード高速化(Ctrl+S)フラグ if(checkBox3->Checked){ FlagON[0] = (char *)0x01; //書き込み用データ フラグON用 lpDataCtrlS=(char *)EAX[0]; lpDataCtrlS+=0xC934; WriteProcessMemory(ph,lpDataCtrlS,FlagON,1,&dwAccessByte); } //ウィンドウ最小化 if(checkBox4->Checked){ HWND hWnd; // do{ hWnd = FindWindow(NULL, L"M.U.G.E.N"); //ウィンドウハンドルを名称より取得、多重起動は放置。 // }while(!hWnd); //半端にループしても邪魔なので除外 ShowWindow(hWnd,SW_SHOWMINNOACTIVE); //縮小化 } // MUGEN監視開始 // EAX+BC30h:ラウンドステート → RoundState[0] // EAX+BC04h:ラウンド数 → Round[0] // EAX+BC08h:1P勝ち数 → Round[1] // EAX+BC0Ch:2P勝ち数 → Round[2] // EAX+BC14h:引き分け数 → Round[4] // EAX+B3FCh:gametime → Gametime[0] ※MUGEN起動後の総試合の合計 1秒=60 // EBX+0160h:life → P1Life[0],P2Life[0] // EBX+0164h:lifemax → P1Life[1],P2Life[1] lpDataRo=(char *)EAX[0]; lpDataRo+=0xBC04; lpDataRoS=(char *)EAX[0]; lpDataRoS+=0xBC30; lpDataGametime=(char *)EAX[0]; lpDataGametime+=0xB3FC; lpDataP1life=(char *)EBX[0]; lpDataP1life+=0x0160; lpDataP2life=(char *)EBX[1]; lpDataP2life+=0x0160; nowRound = -1; do{ if (backgroundWorker1->CancellationPending) { //中断ボタン処理 e->Cancel = true; delete context; //MUGENフォルダ情報削除 return; } RoundEnd = 0; //試合終了フラグ RoundtimeS = 0; do{ if (backgroundWorker1->CancellationPending) { //中断ボタン処理 e->Cancel = true; delete context; //MUGENフォルダ情報削除 return; } // ラウンドステート取得 ReadProcessMemory(ph,lpDataRoS,RoundState,4,&dwAccessByte); // 試合開始時のgametimeを確認 if((int)RoundState[0] == 2 && RoundtimeS==0){ ReadProcessMemory(ph,lpDataGametime,Gametime,4,&dwAccessByte); RoundtimeS = (int)Gametime[0]; RoundtimeE = 0; } // 試合終了時のgametimeを確認 if((int)RoundState[0] > 2 && RoundtimeE==0){ ReadProcessMemory(ph,lpDataGametime,Gametime,4,&dwAccessByte); RoundtimeE = (int)Gametime[0]; } // 勝利モーション後 if((int)RoundState[0] == 4 && RoundtimeS!=0){ //RoundtimeS入れないと終了後ループ do{ // HP確認 ReadProcessMemory(ph,lpDataP1life,P1Life,8,&dwAccessByte); ReadProcessMemory(ph,lpDataP2life,P2Life,8,&dwAccessByte); // ラウンド情報取得 ReadProcessMemory(ph,lpDataRo,Round,20,&dwAccessByte); }while(Round[3] == 0 && (int)Round[0] ==nowRound+2); nowRound++; //30ラウンドオーバーはスルー。 //MAXHP取得失敗もスルー。どちらも記録しない。 if(nowRound>=30 || (int)P1Life[1]==0 || (int)P2Life[1]==0){ dwAccessByte=0; MessageBox::Show("30ラウンドオーバー。\nもしくは情報取得失敗。\n","保存エラー"); break; } //ラウンド結果保存 R_numRound[nowRound] = (int)Round[0]; R_1PnumWin[nowRound] = (int)Round[1]; R_2PnumWin[nowRound] = (int)Round[2]; R_draw[nowRound] = (int)Round[4]; R_1PHP[nowRound] = (int)((int)P1Life[0]*1000.0/(int)P1Life[1]+0.9); //MAX1000換算 端数切上 R_2PHP[nowRound] = (int)((int)P2Life[0]*1000.0/(int)P2Life[1]+0.9); R_Time[nowRound] = RoundtimeE - RoundtimeS; RoundEnd = 1; if(numrounds == R_1PnumWin[nowRound] || numrounds == R_2PnumWin[nowRound]){ GameEnd = 1; } } }while(RoundEnd==0 && dwAccessByte!=0); //ラウンド終了したらループを抜ける }while(GameEnd==0 && dwAccessByte!=0); //試合終了したらループを抜ける if(dwAccessByte==0){ //情報取得失敗時は記録せず抜ける。 break; } //試合結果保存処理 int r; int Win1P = 0; int Win2P = 0; int num1Pwin = 0; int num2Pwin = 0; int numdraw = 0; int AVERAGE1PHP = 0; int AVERAGE2PHP = 0; int Damage10s1P = 0; int Damage10s2P = 0; int sumtime = 0; for(r=0;r<=nowRound;r++){ AVERAGE1PHP += R_1PHP[r]; AVERAGE2PHP += R_2PHP[r]; sumtime += R_Time[r]; } num1Pwin = R_1PnumWin[nowRound]; num2Pwin = R_2PnumWin[nowRound]; numdraw = R_draw[nowRound]; if(sumtime<=0)sumtime=1; //0除算対策 nowRound++; if(numrounds == num1Pwin)Win1P=1; if(numrounds == num2Pwin)Win2P=1; Damage10s1P = (1000 * nowRound - AVERAGE1PHP)* 600 / sumtime; Damage10s2P = (1000 * nowRound - AVERAGE2PHP)* 600 / sumtime; AVERAGE1PHP = AVERAGE1PHP / nowRound; AVERAGE2PHP = AVERAGE2PHP / nowRound; int Win; int Win2; int numGames; int numRound; int winRound; int loseRound; int drowRound; int AverageHP; int AverageHP2; int Attack10s; int Def10s; ifstream::pos_type readpos; std::stringstream ss; buf = ""; //ラウンド毎のレコード情報出力(Record) if(checkBox5->Checked){ std::ofstream record(folder+"outRecord.txt", std::ios::app); //追記用 if(record.fail()){ MessageBox::Show("outRecord.txt読み込みに失敗\n","読み込みエラー"); break; } record.seekp(0, ios_base::end); readpos = record.tellp(); if((int)readpos==0){ record << "1PName,2PName,numRound,1PwinRound,2PwinRound,drowRound,1PHP,2PHP,GameTime" << std::endl; } for(r=0;r+1<=nowRound;r++){ ss << chars[2] << ',' << chars[3] << ',' << R_numRound[r] << ',' << R_1PnumWin[r] << ',' << R_2PnumWin[r] << ',' << R_draw[r] << ',' << R_1PHP[r] << ',' << R_2PHP[r] << ',' << R_Time[r]; buf = ss.str(); ss.str(""); record << buf << std::endl; } record.close(); } //対戦カード毎の集計情報出力(VSliset) if(checkBox6->Checked){ linenum = 0; if(nowsets == 1&&numgame == 1){ std::ofstream outVSlist(folder+"outVSlist.txt", ios::trunc); //初期化 if(outVSlist.fail()){ MessageBox::Show("outVSlist.txt作成に失敗\n","書き込みエラー"); break; } outVSlist << "1PName,2PName,1PWin,2PWin,numRound,1PwinRound,2PwinRound,drowRound,1PAverageHP,2PAverageHP,1PDamage/10s,2PDamage/10s" << std::endl; outVSlist.close(); } if(nowsets == 1){ std::ofstream outVSlist(folder+"outVSlist.txt", std::ios::app); //追記用 if(outVSlist.fail()){ MessageBox::Show("outVSlist.txt読み込みに失敗\n","読み込みエラー"); break; } Win = Win1P; Win2 = Win2P; numRound = nowRound; winRound = num1Pwin; loseRound = num2Pwin; drowRound = numdraw; AverageHP = AVERAGE1PHP; AverageHP2 = AVERAGE2PHP; Def10s = Damage10s1P; Attack10s = Damage10s2P; ss << chars[2] << ',' << chars[3] << ',' << Win << ',' << Win2 << ',' << numRound << ',' << winRound << ',' << loseRound << ',' << drowRound << ',' << AverageHP << ',' << AverageHP2 << ',' << Def10s << ',' << Attack10s << ','; buf = ss.str(); while(buf.size()<120){ buf+=" "; } ss.str(""); outVSlist << buf << std::endl; outVSlist.close(); }else{ std::fstream outVSlist(folder+"outVSlist.txt",ios::in|ios::out); if(outVSlist.fail()){ MessageBox::Show("outVSlist.txt読み込みに失敗\n","読み込みエラー"); break; } readpos = 1; while(linenumChecked){ linenum = 0; if(nowsets == 1&&line1P == 1&&line2P == 2){ std::ofstream outcharout(folder+"outCharResult.txt", ios::trunc); //初期化あり if(outcharout.fail()){ MessageBox::Show("outCharResult.txt作成に失敗\n","書き込みエラー"); break; } outcharout << "Name,Win,numGames,numRound,winRound,loseRound,drowRound,AverageHP,EnemyDamage/10s,OwnDamage/10s" << std::endl; Win = Win1P; numGames = 1; numRound = nowRound; winRound = num1Pwin; loseRound = num2Pwin; drowRound = numdraw; AverageHP = AVERAGE1PHP; Attack10s = Damage10s2P; Def10s = Damage10s1P; ss << chars[2] << ',' << Win << ',' << numGames << ',' << numRound << ',' << winRound << ',' << loseRound << ',' << drowRound << ',' << AverageHP << ',' << Attack10s << ',' << Def10s; buf = ss.str(); ss.str(""); outcharout << buf << std::endl; Win = Win2P; numGames = 1; numRound = nowRound; winRound = num2Pwin; loseRound = num1Pwin; drowRound = numdraw; AverageHP = AVERAGE2PHP; Attack10s = Damage10s1P; Def10s = Damage10s2P; ss << chars[3] << ',' << Win << ',' << numGames << ',' << numRound << ',' << winRound << ',' << loseRound << ',' << drowRound << ',' << AverageHP << ',' << Attack10s << ',' << Def10s; buf = ss.str(); ss.str(""); outcharout << buf << std::endl; outcharout.close(); } else{ std::ifstream outcharin(folder+"outCharResult.txt"); if(outcharin.fail()){ MessageBox::Show("outCharResult.txt読み込みに失敗\n","読み込みエラー"); break; } std::ofstream outcharout(folder+"outCharResult.tmp", ios::trunc); if(outcharout.fail()){ MessageBox::Show("outCharResult.tmp作成に失敗\n","書き込みエラー"); break; } if(nowsets == 1&&line1P == 1){ while(outcharin && getline(outcharin, buf)){ linenum++; if(linenum==line1P+1){ buf.erase(0,1+chars[2].size()); sscanf_s(buf.data(), "%d,%d,%d,%d,%d,%d,%d,%d,%d", &Win, &numGames, &numRound, &winRound, &loseRound, &drowRound, &AverageHP, &Attack10s, &Def10s); Win += Win1P; numGames = numGames + 1; winRound += num1Pwin; loseRound += num2Pwin; drowRound += numdraw; AverageHP = (int)((1.0*AverageHP*numRound+AVERAGE1PHP*nowRound)/(numRound+nowRound)); Attack10s = (int)((1.0*Attack10s*numRound+Damage10s2P*nowRound)/(numRound+nowRound)); Def10s = (int)((1.0*Def10s*numRound+Damage10s1P*nowRound)/(numRound+nowRound)); numRound += nowRound; ss << chars[2] << ',' << Win << ',' << numGames << ',' << numRound << ',' << winRound << ',' << loseRound << ',' << drowRound << ',' << AverageHP << ',' << Attack10s << ',' << Def10s; buf = ss.str(); ss.str(""); } outcharout << buf << std::endl; } Win = Win2P; numGames = 1; numRound = nowRound; winRound = num2Pwin; loseRound = num1Pwin; drowRound = numdraw; AverageHP = AVERAGE2PHP; Attack10s = Damage10s1P; Def10s = Damage10s2P; ss << chars[3] << ',' << Win << ',' << numGames << ',' << numRound << ',' << winRound << ',' << loseRound << ',' << drowRound << ',' << AverageHP << ',' << Attack10s << ',' << Def10s; buf = ss.str(); ss.str(""); outcharout << buf << std::endl; } else{ while(outcharin && getline(outcharin, buf)){ linenum++; if(linenum==line1P+1){ buf.erase(0,1+chars[2].size()); sscanf_s(buf.data(), "%d,%d,%d,%d,%d,%d,%d,%d,%d", &Win, &numGames, &numRound, &winRound, &loseRound, &drowRound, &AverageHP, &Attack10s, &Def10s); Win += Win1P; numGames = numGames + 1; winRound += num1Pwin; loseRound += num2Pwin; drowRound += numdraw; AverageHP = (int)((1.0*AverageHP*numRound+AVERAGE1PHP*nowRound)/(numRound+nowRound)); Attack10s = (int)((1.0*Attack10s*numRound+Damage10s2P*nowRound)/(numRound+nowRound)); Def10s = (int)((1.0*Def10s*numRound+Damage10s1P*nowRound)/(numRound+nowRound)); numRound += nowRound; ss << chars[2] << ',' << Win << ',' << numGames << ',' << numRound << ',' << winRound << ',' << loseRound << ',' << drowRound << ',' << AverageHP << ',' << Attack10s << ',' << Def10s; buf = ss.str(); ss.str(""); } if(linenum==line2P+1){ buf.erase(0,1+chars[3].size()); sscanf_s(buf.data(), "%d,%d,%d,%d,%d,%d,%d,%d,%d", &Win, &numGames, &numRound, &winRound, &loseRound, &drowRound, &AverageHP, &Attack10s, &Def10s); Win += Win2P; numGames = numGames + 1; winRound += num2Pwin; loseRound += num1Pwin; drowRound += numdraw; AverageHP = (int)((1.0*AverageHP*numRound+AVERAGE2PHP*nowRound)/(numRound+nowRound)); Attack10s = (int)((1.0*Attack10s*numRound+Damage10s1P*nowRound)/(numRound+nowRound)); Def10s = (int)((1.0*Def10s*numRound+Damage10s2P*nowRound)/(numRound+nowRound)); numRound += nowRound; ss << chars[3] << ',' << Win << ',' << numGames << ',' << numRound << ',' << winRound << ',' << loseRound << ',' << drowRound << ',' << AverageHP << ',' << Attack10s << ',' << Def10s; buf = ss.str(); ss.str(""); } outcharout << buf << std::endl; } } outcharin.close(); outcharout.close(); String^ deffname = foldername+"outCharResult.txt"; String^ tmpfname = foldername+"outCharResult.tmp"; IO::File::Delete(deffname); IO::File::Move(tmpfname,deffname); } } //再開用に終わった所まで書き出し std::ofstream Checkflag(folder+"outCheckflag.txt", ios::trunc); //初期化あり if(Checkflag.fail()){ MessageBox::Show("outCheckflag.txt作成に失敗\n","書き込みエラー"); break; } Checkflag << nowsets << ',' << line1P << ',' << line2P << ',' << numgame << ',' << lineMAX << std::endl; Checkflag.close(); } //☆☆ここまでデータ収集☆☆ delete context; //MUGENフォルダ情報削除 } private: System::Void backgroundWorker1_ProgressChanged(System::Object^ sender, System::ComponentModel::ProgressChangedEventArgs^ e) { label7->Text = e->ProgressPercentage + L" セット目"; label8->Text = (String^)e->UserState; } private: System::Void backgroundWorker1_RunWorkerCompleted(System::Object^ sender, System::ComponentModel::RunWorkerCompletedEventArgs^ e) { // ボタン等のコントロールをONに button4->Enabled = false; button4->Visible = false; button1->Visible = true; textBox1->Enabled = true; textBox2->Enabled = true; textBox3->Enabled = true; textBox4->Enabled = true; button1->Enabled = true; button2->Enabled = true; button3->Enabled = true; radioButton1->Enabled = true; radioButton2->Enabled = true; radioButton3->Enabled = true; radioButton4->Enabled = true; numericUpDown1->Enabled = true; numericUpDown2->Enabled = true; checkBox1->Enabled = true; checkBox2->Enabled = true; checkBox3->Enabled = true; checkBox4->Enabled = true; checkBox5->Enabled = true; checkBox6->Enabled = true; checkBox7->Enabled = true; checkBox8->Enabled = true; checkBox9->Enabled = true; } //S設定ファイル書出関数 //実行時の状態をファイルとして保存する。 void OutConfig(){ //初期のディレクトリに戻す TCHAR path[MAX_PATH]; if(GetModuleFileName( NULL, path, MAX_PATH)){ *( _tcsrchr( path, _T( '\\' ) ) + 1 ) = _T( '\0' ); SetCurrentDirectory(path); } std::ofstream Config("FWConfig.ini", ios::trunc); //初期化あり if(Config){ Config << marshal_as(textBox1->Text) << endl;//MUGENフォルダ Config << marshal_as(textBox2->Text) << endl;//対戦キャラクターリスト Config << marshal_as(textBox3->Text) << endl;//使用ステージ Config << marshal_as(textBox4->Text) << endl;//保存フォルダ if(radioButton1->Checked){ //繰り返し方式 Config << '1' << endl; }else{ Config << '2' << endl; } if(radioButton3->Checked){ Config << '3' << endl; }else{ Config << '4' << endl; } if(checkBox1->Checked){ //nomusic Config << '1' << endl; }else{ Config << '0' << endl; } if(checkBox2->Checked){ //nosound Config << '1' << endl; }else{ Config << '0' << endl; } if(checkBox3->Checked){ //Ctrl+S Config << '1' << endl; }else{ Config << '0' << endl; } if(checkBox4->Checked){ //自動縮小化 Config << '1' << endl; }else{ Config << '0' << endl; } if(checkBox5->Checked){ //Record Config << '1' << endl; }else{ Config << '0' << endl; } if(checkBox6->Checked){ //VSlist Config << '1' << endl; }else{ Config << '0' << endl; } if(checkBox7->Checked){ //Result Config << '1' << endl; }else{ Config << '0' << endl; } if(checkBox8->Checked){ //続きから Config << '1' << endl; }else{ Config << '0' << endl; } if(checkBox9->Checked){ //上書き確認しない Config << '1' << endl; }else{ Config << '0' << endl; } Config << (int)numericUpDown1->Value << endl; //ラウンド数 Config << (int)numericUpDown2->Value << endl; //セット数 } } //E設定ファイル書出関数 private: System::Void button4_Click(System::Object^ sender, System::EventArgs^ e) { //中断ボタン backgroundWorker1->CancelAsync(); } }; }